summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/object.cpp4
-rw-r--r--drivers/SCsub63
-rw-r--r--scene/resources/font.cpp43
-rw-r--r--scene/resources/font.h12
-rw-r--r--tools/editor/editor_file_dialog.cpp4
-rw-r--r--tools/editor/property_editor.cpp76
-rw-r--r--tools/editor/property_editor.h1
7 files changed, 124 insertions, 79 deletions
diff --git a/core/object.cpp b/core/object.cpp
index 96f0c86832..f6ba76a0b5 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1405,6 +1405,10 @@ bool Object::is_connected(const StringName& p_signal, Object *p_to_object, const
bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_signal);
if (signal_is_valid)
return false;
+
+ if (!script.is_null() && Ref<Script>(script)->has_script_signal(p_signal))
+ return false;
+
ERR_EXPLAIN("Nonexistent signal: "+p_signal);
ERR_FAIL_COND_V(!s,false);
}
diff --git a/drivers/SCsub b/drivers/SCsub
index 8e241830f8..e52d6538e5 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -61,39 +61,42 @@ import string
if env['vsproj']=="yes":
env.AddToVSProject(env.drivers_sources)
-for f in env.drivers_sources:
- fname = ""
- if type(f) == type(""):
- fname = env.File(f).path
- else:
- fname = env.File(f)[0].path
- fname = fname.replace("\\", "/")
- base = string.join(fname.split("/")[:2], "/")
- if base != cur_base and len(list) > max_src:
- if num > 0:
- lib = env.Library("drivers"+str(num), list)
- lib_list.append(lib)
- list = []
- num = num+1
- cur_base = base
- list.append(f)
+if (False): #split drivers, this used to be needed for windows until separate builders for windows were created
-lib = env.Library("drivers"+str(num), list)
-lib_list.append(lib)
+ for f in env.drivers_sources:
+ fname = ""
+ if type(f) == type(""):
+ fname = env.File(f).path
+ else:
+ fname = env.File(f)[0].path
+ fname = fname.replace("\\", "/")
+ base = string.join(fname.split("/")[:2], "/")
+ if base != cur_base and len(list) > max_src:
+ if num > 0:
+ lib = env.Library("drivers"+str(num), list)
+ lib_list.append(lib)
+ list = []
+ num = num+1
+ cur_base = base
+ list.append(f)
-if len(lib_list) > 0:
- import os, sys
- if os.name=='posix' and sys.platform=='msys':
- env.Replace(ARFLAGS=['rcsT'])
+ lib = env.Library("drivers"+str(num), list)
+ lib_list.append(lib)
- lib = env.Library("drivers_collated", lib_list)
- lib_list = [lib]
+ if len(lib_list) > 0:
+ import os, sys
+ if os.name=='posix' and sys.platform=='msys':
+ env.Replace(ARFLAGS=['rcsT'])
-drivers_base=[]
-env.add_source_files(drivers_base,"*.cpp")
-lib_list.insert(0, env.Library("drivers", drivers_base))
+ lib = env.Library("drivers_collated", lib_list)
+ lib_list = [lib]
-env.Prepend(LIBS=lib_list)
+ drivers_base=[]
+ env.add_source_files(drivers_base,"*.cpp")
+ lib_list.insert(0, env.Library("drivers", drivers_base))
-#lib = env.Library("drivers",env.drivers_sources)
-#env.Prepend(LIBS=[lib])
+ env.Prepend(LIBS=lib_list)
+else:
+ env.add_source_files(env.drivers_sources,"*.cpp")
+ lib = env.Library("drivers",env.drivers_sources)
+ env.Prepend(LIBS=[lib])
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 2d93113b40..aad5e7cfdd 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -462,31 +462,16 @@ void Font::draw_halign(RID p_canvas_item, const Point2& p_pos, HAlign p_align,fl
void Font::draw(RID p_canvas_item, const Point2& p_pos, const String& p_text, const Color& p_modulate,int p_clip_w) const {
- Point2 pos=p_pos;
- float ofs=0;
- VisualServer *vs = VisualServer::get_singleton();
+ Vector2 ofs;
for (int i=0;i<p_text.length();i++) {
- const Character * c = char_map.getptr(p_text[i]);
+ int width = get_char_size(p_text[i]).width;
- if (!c)
- continue;
-
-// if (p_clip_w>=0 && (ofs+c->rect.size.width)>(p_clip_w))
-// break; //width exceeded
-
- if (p_clip_w>=0 && (ofs+c->rect.size.width)>p_clip_w)
+ if (p_clip_w>=0 && (ofs.x+width)>p_clip_w)
break; //clip
- Point2 cpos=pos;
- cpos.x+=ofs+c->h_align;
- cpos.y-=ascent;
- cpos.y+=c->v_align;
- ERR_CONTINUE( c->texture_idx<-1 || c->texture_idx>=textures.size());
- if (c->texture_idx!=-1)
- textures[c->texture_idx]->draw_rect_region( p_canvas_item, Rect2( cpos, c->rect.size ), c->rect, p_modulate );
-
- ofs+=get_char_size(p_text[i],p_text[i+1]).width;
+
+ ofs.x+=draw_char(p_canvas_item,p_pos+ofs,p_text[i],p_text[i+1],p_modulate);
}
}
@@ -494,8 +479,11 @@ float Font::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_
const Character * c = char_map.getptr(p_char);
- if (!c)
+ if (!c) {
+ if (fallback.is_valid())
+ return fallback->draw_char(p_canvas_item,p_pos,p_char,p_next,p_modulate);
return 0;
+ }
Point2 cpos=p_pos;
cpos.x+=c->h_align;
@@ -508,6 +496,16 @@ float Font::draw_char(RID p_canvas_item, const Point2& p_pos, const CharType& p_
return get_char_size(p_char,p_next).width;
}
+void Font::set_fallback(const Ref<Font> &p_fallback) {
+
+ fallback=p_fallback;
+}
+
+Ref<Font> Font::get_fallback() const{
+
+ return fallback;
+}
+
void Font::_bind_methods() {
ObjectTypeDB::bind_method(_MD("create_from_fnt","path"),&Font::create_from_fnt);
@@ -548,6 +546,8 @@ void Font::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_set_textures"),&Font::_set_textures);
ObjectTypeDB::bind_method(_MD("_get_textures"),&Font::_get_textures);
+ ObjectTypeDB::bind_method(_MD("set_fallback","fallback"),&Font::set_fallback);
+ ObjectTypeDB::bind_method(_MD("get_fallback"),&Font::get_fallback);
ADD_PROPERTY( PropertyInfo( Variant::ARRAY, "textures", PROPERTY_HINT_NONE,"", PROPERTY_USAGE_NOEDITOR ), _SCS("_set_textures"), _SCS("_get_textures") );
ADD_PROPERTY( PropertyInfo( Variant::INT_ARRAY, "chars", PROPERTY_HINT_NONE,"", PROPERTY_USAGE_NOEDITOR ), _SCS("_set_chars"), _SCS("_get_chars") );
@@ -556,6 +556,7 @@ void Font::_bind_methods() {
ADD_PROPERTY( PropertyInfo( Variant::REAL, "height", PROPERTY_HINT_RANGE,"-1024,1024,1" ), _SCS("set_height"), _SCS("get_height") );
ADD_PROPERTY( PropertyInfo( Variant::REAL, "ascent", PROPERTY_HINT_RANGE,"-1024,1024,1" ), _SCS("set_ascent"), _SCS("get_ascent") );
ADD_PROPERTY( PropertyInfo( Variant::BOOL, "distance_field" ), _SCS("set_distance_field_hint"), _SCS("is_distance_field_hint") );
+ ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "fallback", PROPERTY_HINT_RESOURCE_TYPE,"Font" ), _SCS("set_fallback"), _SCS("get_fallback") );
}
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 6728b59f8e..27e3045eaa 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -84,6 +84,7 @@ private:
void _set_textures(const Vector<Variant> & p_textures);
Vector<Variant> _get_textures() const;
+ Ref<Font> fallback;
protected:
static void _bind_methods();
@@ -113,9 +114,13 @@ public:
int get_kerning_pair(CharType p_A,CharType p_B) const;
Vector<KerningPairKey> get_kerning_pair_keys() const;
- _FORCE_INLINE_ Size2 get_char_size(CharType p_char,CharType p_next=0) const;
+ inline Size2 get_char_size(CharType p_char,CharType p_next=0) const;
Size2 get_string_size(const String& p_string) const;
+
+ void set_fallback(const Ref<Font> &p_fallback);
+ Ref<Font> get_fallback() const;
+
void clear();
void set_distance_field_hint(bool p_distance_field);
@@ -134,8 +139,11 @@ Size2 Font::get_char_size(CharType p_char,CharType p_next) const {
const Character * c = char_map.getptr(p_char);
- if (!c)
+ if (!c) {
+ if (fallback.is_valid())
+ return fallback->get_char_size(p_char,p_next);
return Size2();
+ }
Size2 ret(c->advance,c->rect.size.y);
diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp
index 104539c308..7365cf9069 100644
--- a/tools/editor/editor_file_dialog.cpp
+++ b/tools/editor/editor_file_dialog.cpp
@@ -435,6 +435,8 @@ void EditorFileDialog::update_file_list() {
}
+ String cdir = dir_access->get_current_dir();
+ bool skip_pp = access==ACCESS_RESOURCES && cdir=="res://";
dir_access->list_dir_begin();
@@ -455,7 +457,7 @@ void EditorFileDialog::update_file_list() {
if (show_hidden || !ishidden) {
if (!isdir)
files.push_back(item);
- else
+ else if (item!=".." || !skip_pp)
dirs.push_back(item);
}
}
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 7ab09f0487..0a06d78255 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -2549,7 +2549,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CHECK );
item->set_text(1,"On");
item->set_checked( 1, obj->get( p.name ) );
- item->set_icon( 0, get_icon("Bool","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("Bool","EditorIcons") );
item->set_editable(1,!read_only);
} break;
@@ -2561,7 +2562,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_text(1, String::num(obj->get( p.name ),2) );
item->set_editable(1,!read_only);
- item->set_icon( 0, get_icon("Curve","EditorIcons"));
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("Curve","EditorIcons"));
break;
@@ -2631,7 +2633,8 @@ void PropertyEditor::update_tree() {
// int c = p.hint_string.get_slice_count(",");
item->set_text(1,p.hint_string);
- item->set_icon( 0,get_icon("Enum","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Enum","EditorIcons") );
item->set_range(1, obj->get( p.name ) );
item->set_editable(1,!read_only);
break;
@@ -2647,11 +2650,13 @@ void PropertyEditor::update_tree() {
};
if (p.type==Variant::REAL) {
- item->set_icon( 0, get_icon("Real","EditorIcons"));
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("Real","EditorIcons"));
item->set_range(1, obj->get( p.name ) );
} else {
- item->set_icon( 0,get_icon("Integer","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Integer","EditorIcons") );
item->set_range(1, obj->get( p.name ) );
}
@@ -2671,7 +2676,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_STRING );
item->set_editable(1,!read_only);
- item->set_icon( 0, get_icon("File","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("File","EditorIcons") );
item->set_text(1,obj->get(p.name));
item->add_button(1,get_icon("Folder","EditorIcons"));
@@ -2691,7 +2697,8 @@ void PropertyEditor::update_tree() {
item->set_text(1, p.hint_string);
item->set_range(1,idx);
item->set_editable( 1, !read_only );
- item->set_icon( 0,get_icon("Enum","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Enum","EditorIcons") );
} break;
@@ -2699,7 +2706,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_STRING );
item->set_editable(1,!read_only);
- item->set_icon( 0, get_icon("String","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("String","EditorIcons") );
item->set_text(1,obj->get(p.name));
if (p.hint==PROPERTY_HINT_MULTILINE_TEXT)
item->add_button(1,get_icon("MultiLine","EditorIcons") );
@@ -2719,7 +2727,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"Array["+itos(v.call("size"))+"]");
else
item->set_text(1,"Array[]");
- item->set_icon( 0, get_icon("ArrayData","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("ArrayData","EditorIcons") );
} break;
@@ -2734,7 +2743,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"IntArray["+itos(v.call("size"))+"]");
else
item->set_text(1,"IntArray[]");
- item->set_icon( 0, get_icon("ArrayInt","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("ArrayInt","EditorIcons") );
} break;
@@ -2748,7 +2758,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"FloatArray["+itos(v.call("size"))+"]");
else
item->set_text(1,"FloatArray[]");
- item->set_icon( 0, get_icon("ArrayReal","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("ArrayReal","EditorIcons") );
} break;
@@ -2762,7 +2773,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"String["+itos(v.call("size"))+"]");
else
item->set_text(1,"String[]");
- item->set_icon( 0, get_icon("ArrayString","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("ArrayString","EditorIcons") );
} break;
@@ -2776,7 +2788,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"Byte["+itos(v.call("size"))+"]");
else
item->set_text(1,"Byte[]");
- item->set_icon( 0, get_icon("ArrayData","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("ArrayData","EditorIcons") );
} break;
@@ -2790,7 +2803,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"Vector2["+itos(v.call("size"))+"]");
else
item->set_text(1,"Vector2[]");
- item->set_icon( 0, get_icon("Vector2","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("Vector2","EditorIcons") );
} break;
@@ -2804,7 +2818,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"Vector3["+itos(v.call("size"))+"]");
else
item->set_text(1,"Vector3[]");
- item->set_icon( 0, get_icon("Vector","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("Vector","EditorIcons") );
} break;
@@ -2818,7 +2833,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"Color["+itos(v.call("size"))+"]");
else
item->set_text(1,"Color[]");
- item->set_icon( 0, get_icon("Color","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0, get_icon("Color","EditorIcons") );
} break;
@@ -2827,7 +2843,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true );
item->set_text(1,obj->get(p.name));
- item->set_icon( 0,get_icon("Vector2","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Vector2","EditorIcons") );
} break;
case Variant::RECT2: {
@@ -2835,7 +2852,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true );
item->set_text(1,obj->get(p.name));
- item->set_icon( 0,get_icon("Rect2","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Rect2","EditorIcons") );
} break;
case Variant::VECTOR3: {
@@ -2843,7 +2861,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true );
item->set_text(1,obj->get(p.name));
- item->set_icon( 0,get_icon("Vector","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Vector","EditorIcons") );
} break;
case Variant::MATRIX32:
@@ -2858,7 +2877,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true );
item->set_text(1,obj->get(p.name));
- item->set_icon( 0,get_icon("Matrix","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Matrix","EditorIcons") );
} break;
case Variant::PLANE: {
@@ -2866,7 +2886,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true );
item->set_text(1,obj->get(p.name));
- item->set_icon( 0,get_icon("Plane","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Plane","EditorIcons") );
} break;
case Variant::_AABB: {
@@ -2874,7 +2895,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true );
item->set_text(1,"AABB");
- item->set_icon( 0,get_icon("Rect3","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Rect3","EditorIcons") );
} break;
case Variant::QUAT: {
@@ -2882,7 +2904,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true );
item->set_text(1,obj->get(p.name));
- item->set_icon( 0,get_icon("Quat","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Quat","EditorIcons") );
} break;
case Variant::COLOR: {
@@ -2891,7 +2914,8 @@ void PropertyEditor::update_tree() {
item->set_editable( 1, !read_only );
// item->set_text(1,obj->get(p.name));
item->set_custom_bg_color(1,obj->get(p.name));
- item->set_icon( 0,get_icon("Color","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Color","EditorIcons") );
} break;
case Variant::IMAGE: {
@@ -2903,7 +2927,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"[Image (empty)]");
else
item->set_text(1,"[Image "+itos(img.get_width())+"x"+itos(img.get_height())+"]");
- item->set_icon( 0,get_icon("Image","EditorIcons") );
+ if (show_type_icons)
+ item->set_icon( 0,get_icon("Image","EditorIcons") );
} break;
case Variant::NODE_PATH: {
@@ -3583,6 +3608,7 @@ PropertyEditor::PropertyEditor() {
use_doc_hints=false;
use_filter=false;
subsection_selectable=false;
+ show_type_icons=EDITOR_DEF("inspector/show_type_icons",false);
}
diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h
index f004616c08..e933d7ab3b 100644
--- a/tools/editor/property_editor.h
+++ b/tools/editor/property_editor.h
@@ -161,6 +161,7 @@ class PropertyEditor : public Control {
bool keying;
bool read_only;
bool show_categories;
+ bool show_type_icons;
float refresh_countdown;
bool use_doc_hints;
bool use_filter;