|
@@ -40,6 +40,7 @@
|
|
#include "editor_import_export.h"
|
|
#include "editor_import_export.h"
|
|
#include "editor_node.h"
|
|
#include "editor_node.h"
|
|
#include "multi_node_edit.h"
|
|
#include "multi_node_edit.h"
|
|
|
|
+#include "array_property_edit.h"
|
|
|
|
|
|
void CustomPropertyEditor::_notification(int p_what) {
|
|
void CustomPropertyEditor::_notification(int p_what) {
|
|
|
|
|
|
@@ -2450,11 +2451,32 @@ void PropertyEditor::update_tree() {
|
|
}
|
|
}
|
|
|
|
|
|
} break;
|
|
} break;
|
|
|
|
+ case Variant::ARRAY: {
|
|
|
|
+
|
|
|
|
+ item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
|
|
+ item->add_button(1,get_icon("EditResource","EditorIcons"));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Variant v = obj->get(p.name);
|
|
|
|
+ if (v.is_array())
|
|
|
|
+ item->set_text(1,"Array["+itos(v.call("size"))+"]");
|
|
|
|
+ else
|
|
|
|
+ item->set_text(1,"Array[]");
|
|
|
|
+ item->set_icon( 0, get_icon("ArrayData","EditorIcons") );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ } break;
|
|
|
|
+
|
|
case Variant::INT_ARRAY: {
|
|
case Variant::INT_ARRAY: {
|
|
|
|
|
|
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
- item->set_editable( 1, !read_only );
|
|
|
|
- item->set_text(1,"[IntArray]");
|
|
|
|
|
|
+ item->add_button(1,get_icon("EditResource","EditorIcons"));
|
|
|
|
+
|
|
|
|
+ Variant v = obj->get(p.name);
|
|
|
|
+ if (v.is_array())
|
|
|
|
+ item->set_text(1,"IntArray["+itos(v.call("size"))+"]");
|
|
|
|
+ else
|
|
|
|
+ item->set_text(1,"IntArray[]");
|
|
item->set_icon( 0, get_icon("ArrayInt","EditorIcons") );
|
|
item->set_icon( 0, get_icon("ArrayInt","EditorIcons") );
|
|
|
|
|
|
|
|
|
|
@@ -2462,26 +2484,86 @@ void PropertyEditor::update_tree() {
|
|
case Variant::REAL_ARRAY: {
|
|
case Variant::REAL_ARRAY: {
|
|
|
|
|
|
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
- item->set_editable( 1, !read_only );
|
|
|
|
- item->set_text(1,"[RealArray]");
|
|
|
|
|
|
+ item->add_button(1,get_icon("EditResource","EditorIcons"));
|
|
|
|
+
|
|
|
|
+ Variant v = obj->get(p.name);
|
|
|
|
+ if (v.is_array())
|
|
|
|
+ item->set_text(1,"FloatArray["+itos(v.call("size"))+"]");
|
|
|
|
+ else
|
|
|
|
+ item->set_text(1,"FloatArray[]");
|
|
item->set_icon( 0, get_icon("ArrayReal","EditorIcons") );
|
|
item->set_icon( 0, get_icon("ArrayReal","EditorIcons") );
|
|
|
|
|
|
|
|
+
|
|
} break;
|
|
} break;
|
|
case Variant::STRING_ARRAY: {
|
|
case Variant::STRING_ARRAY: {
|
|
|
|
|
|
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
- item->set_editable( 1, !read_only );
|
|
|
|
- item->set_text(1,"[StringArray]");
|
|
|
|
|
|
+ item->add_button(1,get_icon("EditResource","EditorIcons"));
|
|
|
|
+
|
|
|
|
+ Variant v = obj->get(p.name);
|
|
|
|
+ if (v.is_array())
|
|
|
|
+ item->set_text(1,"String["+itos(v.call("size"))+"]");
|
|
|
|
+ else
|
|
|
|
+ item->set_text(1,"String[]");
|
|
item->set_icon( 0, get_icon("ArrayString","EditorIcons") );
|
|
item->set_icon( 0, get_icon("ArrayString","EditorIcons") );
|
|
|
|
|
|
|
|
+
|
|
} break;
|
|
} break;
|
|
case Variant::RAW_ARRAY: {
|
|
case Variant::RAW_ARRAY: {
|
|
|
|
|
|
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
- item->set_editable( 1, !read_only );
|
|
|
|
- item->set_text(1,"[Raw Data]");
|
|
|
|
|
|
+ item->add_button(1,get_icon("EditResource","EditorIcons"));
|
|
|
|
+
|
|
|
|
+ Variant v = obj->get(p.name);
|
|
|
|
+ if (v.is_array())
|
|
|
|
+ item->set_text(1,"Byte["+itos(v.call("size"))+"]");
|
|
|
|
+ else
|
|
|
|
+ item->set_text(1,"Byte[]");
|
|
item->set_icon( 0, get_icon("ArrayData","EditorIcons") );
|
|
item->set_icon( 0, get_icon("ArrayData","EditorIcons") );
|
|
|
|
|
|
|
|
+
|
|
|
|
+ } break;
|
|
|
|
+ case Variant::VECTOR2_ARRAY: {
|
|
|
|
+
|
|
|
|
+ item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
|
|
+ item->add_button(1,get_icon("EditResource","EditorIcons"));
|
|
|
|
+
|
|
|
|
+ Variant v = obj->get(p.name);
|
|
|
|
+ if (v.is_array())
|
|
|
|
+ item->set_text(1,"Vector2["+itos(v.call("size"))+"]");
|
|
|
|
+ else
|
|
|
|
+ item->set_text(1,"Vector2[]");
|
|
|
|
+ item->set_icon( 0, get_icon("Vector2","EditorIcons") );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ } break;
|
|
|
|
+ case Variant::VECTOR3_ARRAY: {
|
|
|
|
+
|
|
|
|
+ item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
|
|
+ item->add_button(1,get_icon("EditResource","EditorIcons"));
|
|
|
|
+
|
|
|
|
+ Variant v = obj->get(p.name);
|
|
|
|
+ if (v.is_array())
|
|
|
|
+ item->set_text(1,"Vector3["+itos(v.call("size"))+"]");
|
|
|
|
+ else
|
|
|
|
+ item->set_text(1,"Vector3[]");
|
|
|
|
+ item->set_icon( 0, get_icon("Vector","EditorIcons") );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ } break;
|
|
|
|
+ case Variant::COLOR_ARRAY: {
|
|
|
|
+
|
|
|
|
+ item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
|
|
|
|
+ item->add_button(1,get_icon("EditResource","EditorIcons"));
|
|
|
|
+
|
|
|
|
+ Variant v = obj->get(p.name);
|
|
|
|
+ if (v.is_array())
|
|
|
|
+ item->set_text(1,"Color["+itos(v.call("size"))+"]");
|
|
|
|
+ else
|
|
|
|
+ item->set_text(1,"Color[]");
|
|
|
|
+ item->set_icon( 0, get_icon("Color","EditorIcons") );
|
|
|
|
+
|
|
|
|
+
|
|
} break;
|
|
} break;
|
|
case Variant::VECTOR2: {
|
|
case Variant::VECTOR2: {
|
|
|
|
|
|
@@ -2677,7 +2759,7 @@ void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (!undo_redo || obj->cast_to<MultiNodeEdit>()) { //kind of hacky
|
|
|
|
|
|
+ if (!undo_redo || obj->cast_to<MultiNodeEdit>() || obj->cast_to<ArrayPropertyEdit>()) { //kind of hacky
|
|
|
|
|
|
obj->set(p_name,p_value);
|
|
obj->set(p_name,p_value);
|
|
_changed_callbacks(obj,p_name);
|
|
_changed_callbacks(obj,p_name);
|
|
@@ -2997,6 +3079,19 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) {
|
|
|
|
|
|
emit_signal("resource_selected",r,n);
|
|
emit_signal("resource_selected",r,n);
|
|
}
|
|
}
|
|
|
|
+ } else if (t==Variant::ARRAY || t==Variant::INT_ARRAY || t==Variant::REAL_ARRAY || t==Variant::STRING_ARRAY || t==Variant::VECTOR2_ARRAY || t==Variant::VECTOR3_ARRAY || t==Variant::COLOR_ARRAY || t==Variant::RAW_ARRAY) {
|
|
|
|
+
|
|
|
|
+ Variant v = obj->get(n);
|
|
|
|
+
|
|
|
|
+ if (v.get_type()!=t) {
|
|
|
|
+ Variant::CallError ce;
|
|
|
|
+ v=Variant::construct(Variant::Type(t),NULL,0,ce);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Ref<ArrayPropertyEdit> ape = memnew( ArrayPropertyEdit );
|
|
|
|
+ ape->edit(obj,n);
|
|
|
|
+
|
|
|
|
+ EditorNode::get_singleton()->push_item(ape.ptr());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|