diff options
Diffstat (limited to 'tools/editor/property_editor.cpp')
-rw-r--r-- | tools/editor/property_editor.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 7163836f73..ef6b1aa47c 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -328,26 +328,26 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty if (c>=2) { if (!hint_text.get_slice(",",1).empty()) - max=hint_text.get_slice(",",1).to_double(); + max=hint_text.get_slice(",",1).to_double(); } - if (type==Variant::REAL && c>=3) { + if (c>=3) { if (!hint_text.get_slice(",",2).empty()) - step= hint_text.get_slice(",",2).to_double(); + step= hint_text.get_slice(",",2).to_double(); } if (c>=4 && hint_text.get_slice(",",3)=="slider") { slider->set_min(min); slider->set_max(max); - slider->set_step((type==Variant::REAL) ? step : 1); + slider->set_step(step); slider->set_val(v); slider->show(); set_size(Size2(110,30)*EDSCALE); } else { spinbox->set_min(min); spinbox->set_max(max); - spinbox->set_step((type==Variant::REAL) ? step : 1); + spinbox->set_step(step); spinbox->set_val(v); spinbox->show(); set_size(Size2(70,35)*EDSCALE); @@ -3258,7 +3258,7 @@ void PropertyEditor::update_tree() { max=p.hint_string.get_slice(",",1).to_double(); } - if (p.type==Variant::REAL && c>=3) { + if (p.type!=PROPERTY_HINT_SPRITE_FRAME && c>=3) { step= p.hint_string.get_slice(",",2).to_double(); } @@ -3613,9 +3613,10 @@ void PropertyEditor::update_tree() { } break; case Variant::NODE_PATH: { - item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); + item->set_cell_mode(1, TreeItem::CELL_MODE_STRING); item->set_editable( 1, !read_only ); item->set_text(1,obj->get(p.name)); + item->add_button(1, get_icon("Collapse", "EditorIcons")); } break; case Variant::OBJECT: { @@ -3892,6 +3893,7 @@ void PropertyEditor::_item_edited() { } break; case Variant::NODE_PATH: { + _edit_set(name, NodePath(item->get_text(1))); } break; @@ -4067,7 +4069,17 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) { String n = d["name"]; String ht = d["hint_text"]; - if (t==Variant::STRING) { + if(t == Variant::NODE_PATH) { + + Variant v = obj->get(n); + custom_editor->edit(obj, n, (Variant::Type)t, v, h, ht); + Rect2 where = tree->get_item_rect(ti, 1); + where.pos -= tree->get_scroll(); + where.pos += tree->get_global_pos(); + custom_editor->set_pos(where.pos); + custom_editor->popup(); + + } else if (t==Variant::STRING) { Variant v = obj->get(n); |