diff options
Diffstat (limited to 'editor/editor_inspector.cpp')
-rw-r--r-- | editor/editor_inspector.cpp | 69 |
1 files changed, 26 insertions, 43 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 20abe72750..4dd57cb1a8 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -380,7 +380,7 @@ StringName EditorProperty::get_edited_property() { void EditorProperty::update_property() { if (get_script_instance()) { - get_script_instance()->call("update_property"); + get_script_instance()->call("_update_property"); } } @@ -417,7 +417,7 @@ bool EditorPropertyRevert::may_node_be_in_instance(Node *p_node) { return might_be; // or might not be } -bool EditorPropertyRevert::get_instanced_node_original_property(Node *p_node, const StringName &p_prop, Variant &value) { +bool EditorPropertyRevert::get_instantiated_node_original_property(Node *p_node, const StringName &p_prop, Variant &value) { Node *node = p_node; Node *orig = node; @@ -524,7 +524,7 @@ bool EditorPropertyRevert::can_property_revert(Object *p_object, const StringNam if (node && EditorPropertyRevert::may_node_be_in_instance(node)) { //check for difference including instantiation Variant vorig; - if (EditorPropertyRevert::get_instanced_node_original_property(node, p_property, vorig)) { + if (EditorPropertyRevert::get_instantiated_node_original_property(node, p_property, vorig)) { Variant v = p_object->get(p_property); if (EditorPropertyRevert::is_node_property_different(node, v, vorig)) { @@ -753,7 +753,7 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) { call_deferred("emit_changed", property, object->get(property).operator int64_t() + 1, "", false); } - call_deferred("update_property"); + call_deferred("_update_property"); } } if (delete_rect.has_point(mpos)) { @@ -764,7 +764,7 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) { Variant vorig; Node *node = Object::cast_to<Node>(object); - if (node && EditorPropertyRevert::may_node_be_in_instance(node) && EditorPropertyRevert::get_instanced_node_original_property(node, property, vorig)) { + if (node && EditorPropertyRevert::may_node_be_in_instance(node) && EditorPropertyRevert::get_instantiated_node_original_property(node, property, vorig)) { emit_changed(property, vorig.duplicate(true)); update_property(); return; @@ -965,9 +965,7 @@ void EditorProperty::_bind_methods() { ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::INT, "id"))); ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "focusable_idx"))); - MethodInfo vm; - vm.name = "update_property"; - BIND_VMETHOD(vm); + BIND_VMETHOD(MethodInfo("_update_property")); } EditorProperty::EditorProperty() { @@ -1023,24 +1021,24 @@ void EditorInspectorPlugin::add_property_editor_for_multiple_properties(const St bool EditorInspectorPlugin::can_handle(Object *p_object) { if (get_script_instance()) { - return get_script_instance()->call("can_handle", p_object); + return get_script_instance()->call("_can_handle", p_object); } return false; } void EditorInspectorPlugin::parse_begin(Object *p_object) { if (get_script_instance()) { - get_script_instance()->call("parse_begin", p_object); + get_script_instance()->call("_parse_begin", p_object); } } void EditorInspectorPlugin::parse_category(Object *p_object, const String &p_parse_category) { if (get_script_instance()) { - get_script_instance()->call("parse_category", p_object, p_parse_category); + get_script_instance()->call("_parse_category", p_object, p_parse_category); } } -bool EditorInspectorPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) { +bool EditorInspectorPlugin::parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) { if (get_script_instance()) { Variant arg[6] = { p_object, p_type, p_path, p_hint, p_hint_text, p_usage @@ -1050,14 +1048,14 @@ bool EditorInspectorPlugin::parse_property(Object *p_object, Variant::Type p_typ }; Callable::CallError err; - return get_script_instance()->call("parse_property", (const Variant **)&argptr, 6, err); + return get_script_instance()->call("_parse_property", (const Variant **)&argptr, 6, err); } return false; } void EditorInspectorPlugin::parse_end() { if (get_script_instance()) { - get_script_instance()->call("parse_end"); + get_script_instance()->call("_parse_end"); } } @@ -1066,30 +1064,11 @@ void EditorInspectorPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("add_property_editor", "property", "editor"), &EditorInspectorPlugin::add_property_editor); ClassDB::bind_method(D_METHOD("add_property_editor_for_multiple_properties", "label", "properties", "editor"), &EditorInspectorPlugin::add_property_editor_for_multiple_properties); - MethodInfo vm; - vm.name = "can_handle"; - vm.return_val.type = Variant::BOOL; - vm.arguments.push_back(PropertyInfo(Variant::OBJECT, "object")); - BIND_VMETHOD(vm); - vm.name = "parse_begin"; - vm.return_val.type = Variant::NIL; - BIND_VMETHOD(vm); - vm.name = "parse_category"; - vm.arguments.push_back(PropertyInfo(Variant::STRING, "category")); - BIND_VMETHOD(vm); - vm.arguments.pop_back(); - vm.name = "parse_property"; - vm.return_val.type = Variant::BOOL; - vm.arguments.push_back(PropertyInfo(Variant::INT, "type")); - vm.arguments.push_back(PropertyInfo(Variant::STRING, "path")); - vm.arguments.push_back(PropertyInfo(Variant::INT, "hint")); - vm.arguments.push_back(PropertyInfo(Variant::STRING, "hint_text")); - vm.arguments.push_back(PropertyInfo(Variant::INT, "usage")); - BIND_VMETHOD(vm); - vm.arguments.clear(); - vm.name = "parse_end"; - vm.return_val.type = Variant::NIL; - BIND_VMETHOD(vm); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_can_handle", PropertyInfo(Variant::OBJECT, "object"))); + BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_begin")); + BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_category", PropertyInfo(Variant::STRING, "category"))); + BIND_VMETHOD(MethodInfo(Variant::BOOL, "_parse_property", PropertyInfo(Variant::INT, "type"), PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "hint"), PropertyInfo(Variant::STRING, "hint_text"), PropertyInfo(Variant::INT, "usage"))); + BIND_VMETHOD(MethodInfo(Variant::NIL, "_parse_end")); } //////////////////////////////////////////////// @@ -1203,15 +1182,19 @@ void EditorInspectorSection::_notification(int p_what) { Size2 size = get_size(); Point2 offset; + Rect2 rect; offset.y = font->get_height(font_size); if (arrow.is_valid()) { offset.y = MAX(offset.y, arrow->get_height()); } offset.y += get_theme_constant("vseparation", "Tree"); - offset.x += get_theme_constant("inspector_margin", "Editor"); - - Rect2 rect(offset, size - offset); + if (is_layout_rtl()) { + rect = Rect2(offset, size - offset - Vector2(get_theme_constant("inspector_margin", "Editor"), 0)); + } else { + offset.x += get_theme_constant("inspector_margin", "Editor"); + rect = Rect2(offset, size - offset); + } //set children for (int i = 0; i < get_child_count(); i++) { @@ -1290,7 +1273,7 @@ void EditorInspectorSection::_notification(int p_what) { Control *editor_property = Object::cast_to<Control>(vbox->get_child(child_idx)); // Test can_drop_data and can_drop_data_fw, since can_drop_data only works if set up with forwarding or if script attached. - if (editor_property && (editor_property->can_drop_data(Point2(), dd) || editor_property->call("can_drop_data_fw", Point2(), dd, this))) { + if (editor_property && (editor_property->can_drop_data(Point2(), dd) || editor_property->call("_can_drop_data_fw", Point2(), dd, this))) { children_can_drop = true; break; } @@ -1454,7 +1437,7 @@ EditorInspectorSection::~EditorInspectorSection() { Ref<EditorInspectorPlugin> EditorInspector::inspector_plugins[MAX_PLUGINS]; int EditorInspector::inspector_plugin_count = 0; -EditorProperty *EditorInspector::instantiate_property_editor(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) { +EditorProperty *EditorInspector::instantiate_property_editor(Object *p_object, const Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) { for (int i = inspector_plugin_count - 1; i >= 0; i--) { inspector_plugins[i]->parse_property(p_object, p_type, p_path, p_hint, p_hint_text, p_usage, p_wide); if (inspector_plugins[i]->added_editors.size()) { |