summaryrefslogtreecommitdiffstats
path: root/tools/editor/property_editor.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-05-27 14:18:40 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-05-27 14:19:11 -0300
commit8be2fabbe5cd846bac5e5a38e55f3fb70e73f2da (patch)
treea3e932282cdafdd13c4f02bdf21f72f9846adcbe /tools/editor/property_editor.cpp
parenteb7227a20b27e91c6e2adfb1ded738f2dd7e453b (diff)
downloadredot-engine-8be2fabbe5cd846bac5e5a38e55f3fb70e73f2da.tar.gz
Changed import workflow
-Rearrange favorites in fs dock with drag and drop -Removed import -> sub-scene, moved to scenetree contextual menu -Removed import -> re-import , moved and integrated to FS dock -Added ability in FS dock to re-import more than one resource simultaneously -Added ability to drag from native filesystem explorer to Godot, only works on Windows though -Removed scene reimport merge options, never worked well. Eventually merging materials should be re-added -Added ability to set custom root node type when importing scenes -Re-Import is now automatic, can be configured back to manual in editor settings -Added resource previews in property list for many resource types
Diffstat (limited to 'tools/editor/property_editor.cpp')
-rw-r--r--tools/editor/property_editor.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index afc6396ab3..ddbaad5ea1 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -1673,6 +1673,7 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns,int
}
+
void CustomPropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method("_focus_enter", &CustomPropertyEditor::_focus_enter);
@@ -1691,6 +1692,7 @@ void CustomPropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method( "_menu_option",&CustomPropertyEditor::_menu_option);
+
ADD_SIGNAL( MethodInfo("variant_changed") );
ADD_SIGNAL( MethodInfo("resource_edit_request") );
}
@@ -2180,6 +2182,11 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
}
}
+ if (!res->is_type("Texture")) {
+ //texture already previews via itself
+ EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res,this,"_resource_preview_done",p_item->get_instance_ID());
+ }
+
}
@@ -3357,6 +3364,10 @@ void PropertyEditor::update_tree() {
} else if (res.is_valid()) {
item->set_tooltip(1,res->get_name()+" ("+res->get_type()+")");
}
+ if (!res->is_type("Texture")) {
+ //texture already previews via itself
+ EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res,this,"_resource_preview_done",item->get_instance_ID());
+ }
}
@@ -3870,6 +3881,29 @@ void PropertyEditor::_filter_changed(const String& p_text) {
update_tree();
}
+
+
+void PropertyEditor::_resource_preview_done(const String& p_path,const Ref<Texture>& p_preview,Variant p_ud) {
+
+ if (p_preview.is_null())
+ return; //don't bother with empty preview
+
+ ObjectID id = p_ud;
+ Object *obj = ObjectDB::get_instance(id);
+
+ if (!obj)
+ return;
+
+ TreeItem *ti = obj->cast_to<TreeItem>();
+
+ ERR_FAIL_COND(!ti);
+
+ int tw = EditorSettings::get_singleton()->get("property_editor/texture_preview_width");
+
+ ti->set_icon(1,p_preview); //should be scaled I think?
+ ti->set_icon_max_width(1,tw);
+ ti->set_text(1,"");
+}
void PropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method( "_item_edited",&PropertyEditor::_item_edited);
@@ -3884,6 +3918,7 @@ void PropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method( "_set_range_def",&PropertyEditor::_set_range_def);
ObjectTypeDB::bind_method( "_filter_changed",&PropertyEditor::_filter_changed);
ObjectTypeDB::bind_method( "update_tree",&PropertyEditor::update_tree);
+ ObjectTypeDB::bind_method( "_resource_preview_done",&PropertyEditor::_resource_preview_done);
ObjectTypeDB::bind_method(_MD("get_drag_data_fw"), &PropertyEditor::get_drag_data_fw);
ObjectTypeDB::bind_method(_MD("can_drop_data_fw"), &PropertyEditor::can_drop_data_fw);