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.cpp34
1 files changed, 24 insertions, 10 deletions
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 1a8d373f7f..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);
@@ -3049,7 +3049,7 @@ void PropertyEditor::update_tree() {
if (E) {
descr=E->get().brief_description;
}
- class_descr_cache[type]=descr.world_wrap(80);
+ class_descr_cache[type]=descr.word_wrap(80);
}
@@ -3142,7 +3142,7 @@ void PropertyEditor::update_tree() {
if (E) {
for(int i=0;i<E->get().methods.size();i++) {
if (E->get().methods[i].name==setter.operator String()) {
- descr=E->get().methods[i].description.strip_edges().world_wrap(80);
+ descr=E->get().methods[i].description.strip_edges().word_wrap(80);
}
}
}
@@ -3182,6 +3182,7 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CHECK );
item->set_text(1,TTR("On"));
+ item->set_tooltip(1, obj->get(p.name) ? "True" : "False");
item->set_checked( 1, obj->get( p.name ) );
if (show_type_icons)
item->set_icon( 0, get_icon("Bool","EditorIcons") );
@@ -3257,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();
}
@@ -3612,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: {
@@ -3828,6 +3830,7 @@ void PropertyEditor::_item_edited() {
case Variant::BOOL: {
_edit_set(name,item->is_checked(1));
+ item->set_tooltip(1, item->is_checked(1) ? "True" : "False");
} break;
case Variant::INT:
case Variant::REAL: {
@@ -3890,6 +3893,7 @@ void PropertyEditor::_item_edited() {
} break;
case Variant::NODE_PATH: {
+ _edit_set(name, NodePath(item->get_text(1)));
} break;
@@ -4065,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);