diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/node_3d.cpp | 53 | ||||
-rw-r--r-- | scene/3d/node_3d.h | 18 |
2 files changed, 26 insertions, 45 deletions
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp index 2a611d9ce7..e189b705d8 100644 --- a/scene/3d/node_3d.cpp +++ b/scene/3d/node_3d.cpp @@ -172,6 +172,7 @@ void Node3D::_notification(int p_what) { if (get_script_instance()) { get_script_instance()->call(SceneStringNames::get_singleton()->_enter_world); } + #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint() && get_tree()->is_node_being_edited(this)) { get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this); @@ -186,7 +187,6 @@ void Node3D::_notification(int p_what) { } } #endif - } break; case NOTIFICATION_EXIT_WORLD: { #ifdef TOOLS_ENABLED @@ -456,7 +456,6 @@ void Node3D::clear_subgizmo_selection() { void Node3D::add_gizmo(Ref<Node3DGizmo> p_gizmo) { #ifdef TOOLS_ENABLED - if (data.gizmos_disabled || p_gizmo.is_null()) { return; } @@ -474,7 +473,6 @@ void Node3D::add_gizmo(Ref<Node3DGizmo> p_gizmo) { void Node3D::remove_gizmo(Ref<Node3DGizmo> p_gizmo) { #ifdef TOOLS_ENABLED - int idx = data.gizmos.find(p_gizmo); if (idx != -1) { p_gizmo->free(); @@ -506,10 +504,8 @@ Array Node3D::get_gizmos_bind() const { Vector<Ref<Node3DGizmo>> Node3D::get_gizmos() const { #ifdef TOOLS_ENABLED - return data.gizmos; #else - return Vector<Ref<Node3DGizmo>>(); #endif } @@ -561,7 +557,6 @@ void Node3D::set_as_top_level(bool p_enabled) { data.top_level = p_enabled; data.top_level_active = p_enabled; - } else { data.top_level = p_enabled; } @@ -581,6 +576,7 @@ Ref<World3D> Node3D::get_world_3d() const { void Node3D::_propagate_visibility_changed() { notification(NOTIFICATION_VISIBILITY_CHANGED); emit_signal(SceneStringNames::get_singleton()->visibility_changed); + #ifdef TOOLS_ENABLED if (!data.gizmos.is_empty()) { data.gizmos_dirty = true; @@ -597,33 +593,30 @@ void Node3D::_propagate_visibility_changed() { } void Node3D::show() { - if (data.visible) { - return; - } - - data.visible = true; - - if (!is_inside_tree()) { - return; - } - - _propagate_visibility_changed(); + set_visible(true); } void Node3D::hide() { - if (!data.visible) { + set_visible(false); +} + +void Node3D::set_visible(bool p_visible) { + if (data.visible == p_visible) { return; } - data.visible = false; + data.visible = p_visible; if (!is_inside_tree()) { return; } - _propagate_visibility_changed(); } +bool Node3D::is_visible() const { + return data.visible; +} + bool Node3D::is_visible_in_tree() const { const Node3D *s = this; @@ -637,18 +630,6 @@ bool Node3D::is_visible_in_tree() const { return true; } -void Node3D::set_visible(bool p_visible) { - if (p_visible) { - show(); - } else { - hide(); - } -} - -bool Node3D::is_visible() const { - return data.visible; -} - void Node3D::rotate_object_local(const Vector3 &p_axis, real_t p_angle) { Transform3D t = get_transform(); t.basis.rotate_local(p_axis, p_angle); @@ -757,16 +738,16 @@ Vector3 Node3D::to_global(Vector3 p_local) const { return get_global_transform().xform(p_local); } -void Node3D::set_notify_transform(bool p_enable) { - data.notify_transform = p_enable; +void Node3D::set_notify_transform(bool p_enabled) { + data.notify_transform = p_enabled; } bool Node3D::is_transform_notification_enabled() const { return data.notify_transform; } -void Node3D::set_notify_local_transform(bool p_enable) { - data.notify_local_transform = p_enable; +void Node3D::set_notify_local_transform(bool p_enabled) { + data.notify_local_transform = p_enabled; } bool Node3D::is_local_transform_notification_enabled() const { diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h index 31f7d45797..ec62291d41 100644 --- a/scene/3d/node_3d.h +++ b/scene/3d/node_3d.h @@ -182,12 +182,6 @@ public: virtual bool is_transform_gizmo_visible() const { return data.transform_gizmo_visible; }; #endif - void set_as_top_level(bool p_enabled); - bool is_set_as_top_level() const; - - void set_disable_scale(bool p_enabled); - bool is_scale_disabled() const; - void set_disable_gizmos(bool p_enabled); void update_gizmos(); void set_subgizmo_selection(Ref<Node3DGizmo> p_gizmo, int p_id, Transform3D p_transform = Transform3D()); @@ -198,6 +192,12 @@ public: void remove_gizmo(Ref<Node3DGizmo> p_gizmo); void clear_gizmos(); + void set_as_top_level(bool p_enabled); + bool is_set_as_top_level() const; + + void set_disable_scale(bool p_enabled); + bool is_scale_disabled() const; + _FORCE_INLINE_ bool is_inside_world() const { return data.inside_world; } Transform3D get_relative_transform(const Node *p_parent) const; @@ -223,19 +223,19 @@ public: Vector3 to_local(Vector3 p_global) const; Vector3 to_global(Vector3 p_local) const; - void set_notify_transform(bool p_enable); + void set_notify_transform(bool p_enabled); bool is_transform_notification_enabled() const; - void set_notify_local_transform(bool p_enable); + void set_notify_local_transform(bool p_enabled); bool is_local_transform_notification_enabled() const; void orthonormalize(); void set_identity(); void set_visible(bool p_visible); - bool is_visible() const; void show(); void hide(); + bool is_visible() const; bool is_visible_in_tree() const; void force_update_transform(); |