summaryrefslogtreecommitdiff
path: root/editor/editor_inspector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_inspector.cpp')
-rw-r--r--editor/editor_inspector.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 0f76aeb818..a76d34e122 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -378,7 +378,7 @@ bool EditorPropertyRevert::get_instanced_node_original_property(Node *p_node, co
node = node->get_owner();
}
- if (!found) {
+ if (!found && node) {
//if not found, try default class value
Variant attempt = ClassDB::class_get_default_property_value(node->get_class_name(), p_prop);
if (attempt.get_type() != Variant::NIL) {
@@ -504,7 +504,7 @@ bool EditorProperty::use_keying_next() const {
PropertyInfo &p = I->get();
if (p.name == property) {
- return p.hint == PROPERTY_HINT_SPRITE_FRAME;
+ return (p.usage & PROPERTY_USAGE_KEYING_INCREMENTS);
}
}
@@ -1044,7 +1044,6 @@ void EditorInspectorSection::_notification(int p_what) {
Ref<Font> font = get_font("font", "Tree");
Ref<Texture> arrow;
-#ifdef TOOLS_ENABLED
if (foldable) {
if (object->editor_is_section_unfolded(section)) {
arrow = get_icon("arrow_up", "Tree");
@@ -1052,7 +1051,6 @@ void EditorInspectorSection::_notification(int p_what) {
arrow = get_icon("arrow", "Tree");
}
}
-#endif
Size2 size = get_size();
Point2 offset;
@@ -1087,7 +1085,6 @@ void EditorInspectorSection::_notification(int p_what) {
Ref<Texture> arrow;
-#ifdef TOOLS_ENABLED
if (foldable) {
if (object->editor_is_section_unfolded(section)) {
arrow = get_icon("arrow_up", "Tree");
@@ -1095,7 +1092,6 @@ void EditorInspectorSection::_notification(int p_what) {
arrow = get_icon("arrow", "Tree");
}
}
-#endif
Ref<Font> font = get_font("font", "Tree");
@@ -1155,7 +1151,6 @@ void EditorInspectorSection::setup(const String &p_section, const String &p_labe
vbox_added = true;
}
-#ifdef TOOLS_ENABLED
if (foldable) {
_test_unfold();
if (object->editor_is_section_unfolded(section)) {
@@ -1164,7 +1159,6 @@ void EditorInspectorSection::setup(const String &p_section, const String &p_labe
vbox->hide();
}
}
-#endif
}
void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
@@ -1172,7 +1166,6 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
if (!foldable)
return;
-#ifdef TOOLS_ENABLED
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
@@ -1191,7 +1184,6 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
vbox->hide();
}
}
-#endif
}
VBoxContainer *EditorInspectorSection::get_vbox() {
@@ -1205,11 +1197,9 @@ void EditorInspectorSection::unfold() {
_test_unfold();
-#ifdef TOOLS_ENABLED
object->editor_set_section_unfold(section, true);
vbox->show();
update();
-#endif
}
void EditorInspectorSection::fold() {
@@ -1219,11 +1209,9 @@ void EditorInspectorSection::fold() {
if (!vbox_added)
return; //kinda pointless
-#ifdef TOOLS_ENABLED
object->editor_set_section_unfold(section, false);
vbox->hide();
update();
-#endif
}
void EditorInspectorSection::_bind_methods() {
@@ -1302,6 +1290,7 @@ void EditorInspector::remove_inspector_plugin(const Ref<EditorInspectorPlugin> &
}
}
+ ERR_FAIL_COND(idx == -1);
for (int i = idx; i < inspector_plugin_count - 1; i++) {
inspector_plugins[i] = inspector_plugins[i + 1];
}
@@ -1550,7 +1539,7 @@ void EditorInspector::update_tree() {
if (p.usage & PROPERTY_USAGE_HIGH_END_GFX && VS::get_singleton()->is_low_end())
continue; //do not show this property in low end gfx
- if ((hide_object_properties || bool(object->call("_hide_object_properties_from_inspector"))) && (p.name == "script" || p.name == "__meta__")) {
+ if (p.name == "script" && (hide_script || bool(object->call("_hide_script_from_inspector")))) {
continue;
}
@@ -1877,8 +1866,8 @@ void EditorInspector::set_use_doc_hints(bool p_enable) {
use_doc_hints = p_enable;
update_tree();
}
-void EditorInspector::set_hide_object_properties(bool p_hide) {
- hide_object_properties = p_hide;
+void EditorInspector::set_hide_script(bool p_hide) {
+ hide_script = p_hide;
update_tree();
}
void EditorInspector::set_use_filter(bool p_use) {
@@ -2318,7 +2307,7 @@ EditorInspector::EditorInspector() {
set_enable_v_scroll(true);
show_categories = false;
- hide_object_properties = true;
+ hide_script = true;
use_doc_hints = false;
capitalize_paths = true;
use_filter = false;