summaryrefslogtreecommitdiff
path: root/tools/editor/property_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/property_editor.cpp')
-rw-r--r--tools/editor/property_editor.cpp42
1 files changed, 35 insertions, 7 deletions
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index c2243bcc03..645d967a4b 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -38,6 +38,7 @@
#include "scene/scene_string_names.h"
#include "editor_settings.h"
#include "editor_import_export.h"
+#include "editor_node.h"
void CustomPropertyEditor::_notification(int p_what) {
@@ -261,12 +262,12 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
for(int i=0;i<2;i++) {
Point2 ofs(4,4);
- ofs.y+=16*i;
+ ofs.y+=22*i;
for(int j=0;j<10;j++) {
- CheckButton *c=checks20[i*10+j];
+ Button *c=checks20[i*10+j];
Point2 o=ofs;
- o.x+=j*16;
+ o.x+=j*22;
if (j>=5)
o.x+=4;
c->set_pos(o);
@@ -277,7 +278,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
}
- set_size(checks20[19]->get_pos()+Size2(12,17));
+ set_size(checks20[19]->get_pos()+Size2(20,25));
} else if (hint==PROPERTY_HINT_EXP_EASING) {
@@ -1560,10 +1561,13 @@ CustomPropertyEditor::CustomPropertyEditor() {
}
for(int i=0;i<20;i++) {
- checks20[i]=memnew( CheckButton );
+ checks20[i]=memnew( Button );
+ checks20[i]->set_toggle_mode(true);
+ checks20[i]->set_focus_mode(FOCUS_NONE);
add_child(checks20[i]);
checks20[i]->hide();
checks20[i]->connect("pressed",this,"_action_pressed",make_binds(i));
+ checks20[i]->set_tooltip("Bit "+itos(i)+", val "+itos(1<<i)+".");
}
text_edit = memnew( TextEdit );
@@ -1616,6 +1620,7 @@ CustomPropertyEditor::CustomPropertyEditor() {
scene_tree = memnew( SceneTreeDialog );
add_child(scene_tree);
scene_tree->connect("selected", this,"_node_path_selected");
+ scene_tree->get_tree()->set_show_enabled_subscene(true);
texture_preview = memnew( TextureFrame );
add_child( texture_preview);
@@ -1825,6 +1830,13 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
if (obj->get( p_name ).get_type() == Variant::NIL || obj->get( p_name ).operator RefPtr().is_null()) {
p_item->set_text(1,"<null>");
+ Dictionary d = p_item->get_metadata(0);
+ int hint=d.has("hint")?d["hint"].operator int():-1;
+ String hint_text=d.has("hint_text")?d["hint_text"]:"";
+ if (hint==PROPERTY_HINT_RESOURCE_TYPE && hint_text == "Texture") {
+ p_item->set_icon(1,NULL);
+ }
+
} else {
RES res = obj->get( p_name ).operator RefPtr();
if (res->is_type("Texture")) {
@@ -1941,7 +1953,7 @@ TreeItem *PropertyEditor::get_parent_node(String p_path,HashMap<String,TreeItem*
TreeItem *parent = get_parent_node( p_path.left( p_path.find_last("/") ),item_paths,root );
item = tree->create_item( parent );
- String name = (p_path.find("/")!=-1)?p_path.right( p_path.find_last("/") ):p_path;
+ String name = (p_path.find("/")!=-1)?p_path.right( p_path.find_last("/")+1 ):p_path;
if (capitalize_paths)
item->set_text(0, name.capitalize() );
else
@@ -2027,6 +2039,17 @@ void PropertyEditor::update_tree() {
List<PropertyInfo> plist;
obj->get_property_list(&plist,true);
+ bool draw_red=false;
+
+ {
+ Node *nod = obj->cast_to<Node>();
+ Node *es = EditorNode::get_singleton()->get_edited_scene();
+ if (nod && es!=nod && nod->get_owner()!=es) {
+ draw_red=true;
+ }
+ }
+
+
Color sscolor=get_color("prop_subsection","Editor");
TreeItem * current_category=NULL;
@@ -2099,7 +2122,7 @@ void PropertyEditor::update_tree() {
TreeItem * item = tree->create_item( parent );
- String name = (p.name.find("/")!=-1)?p.name.right( p.name.find_last("/") ):p.name;
+ String name = (p.name.find("/")!=-1)?p.name.right( p.name.find_last("/")+1 ):p.name;
if (level>0) {
item->set_custom_bg_color(0,col);
@@ -2131,11 +2154,16 @@ void PropertyEditor::update_tree() {
item->set_metadata( 0, d );
item->set_metadata( 1, p.name );
+
+ if (draw_red)
+ item->set_custom_color(0,Color(0.8,0.4,0.20));
+
if (p.name==selected_property) {
item->select(1);
}
+
//printf("property %s type %i\n",p.name.ascii().get_data(),p.type);
switch( p.type ) {