From 85a8dbb7b6eced8364e83c879f98e17862a22124 Mon Sep 17 00:00:00 2001 From: Duroxxigar Date: Thu, 1 Oct 2020 02:43:30 -0400 Subject: [PATCH] Made toplevel a property for Node3D and CanvasItem --- doc/classes/CanvasItem.xml | 19 +++---------------- doc/classes/Node3D.xml | 19 +++---------------- scene/3d/node_3d.cpp | 1 + scene/main/canvas_item.cpp | 3 +-- 4 files changed, 8 insertions(+), 34 deletions(-) diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 946c4f8988c..3524a5d22b3 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -525,13 +525,6 @@ Returns [code]true[/code] if local transform notifications are communicated to children. - - - - - Returns [code]true[/code] if the node is set as top-level. See [method set_as_toplevel]. - - @@ -564,15 +557,6 @@ Transformations issued by [code]event[/code]'s inputs are applied in local space instead of global space. - - - - - - - If [code]enable[/code] is [code]true[/code], the node won't inherit its transform from parent canvas items. - - @@ -622,6 +606,9 @@ If [code]true[/code], the object draws behind its parent. + + If [code]true[/code], the node will not inherit its transform from parent [CanvasItem]s. + If [code]true[/code], the object draws on top of its parent. diff --git a/doc/classes/Node3D.xml b/doc/classes/Node3D.xml index 1ef875f6068..daadde4fe44 100644 --- a/doc/classes/Node3D.xml +++ b/doc/classes/Node3D.xml @@ -83,13 +83,6 @@ Returns whether this node uses a scale of [code](1, 1, 1)[/code] or its local transformation scale. - - - - - Returns whether this node is set as Toplevel, that is whether it ignores its parent nodes transformations. - - @@ -195,15 +188,6 @@ Scales the local transformation by given 3D scale factors in object-local coordinate system. - - - - - - - Makes the node ignore its parents transformations. Node transformations are only in global space. - - @@ -316,6 +300,9 @@ Scale part of the local transformation. + + If [code]true[/code], the node will not inherit its transformations from its parent. Node transformations are only in global space. + Local space [Transform] of this node, with respect to the parent node. diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp index bd9e4f5bde5..bf1445edf2b 100644 --- a/scene/3d/node_3d.cpp +++ b/scene/3d/node_3d.cpp @@ -773,6 +773,7 @@ void Node3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "rotation_degrees", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_rotation_degrees", "get_rotation_degrees"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "rotation", PROPERTY_HINT_NONE, "", 0), "set_rotation", "get_rotation"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "scale", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_scale", "get_scale"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toplevel"), "set_as_toplevel", "is_set_as_toplevel"); ADD_GROUP("Matrix", ""); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform", PROPERTY_HINT_NONE, ""), "set_transform", "get_transform"); ADD_GROUP("Visibility", ""); diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index 796408a38d9..564de31dcaf 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -1218,6 +1218,7 @@ void CanvasItem::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR, "modulate"), "set_modulate", "get_modulate"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "self_modulate"), "set_self_modulate", "get_self_modulate"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_behind_parent"), "set_draw_behind_parent", "is_draw_behind_parent_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toplevel"), "set_as_toplevel", "is_set_as_toplevel"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_on_top", PROPERTY_HINT_NONE, "", 0), "_set_on_top", "_is_on_top"); //compatibility ADD_PROPERTY(PropertyInfo(Variant::INT, "light_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_light_mask", "get_light_mask"); @@ -1228,8 +1229,6 @@ void CanvasItem::_bind_methods() { ADD_GROUP("Material", ""); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,CanvasItemMaterial"), "set_material", "get_material"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_parent_material"), "set_use_parent_material", "get_use_parent_material"); - //exporting these things doesn't really make much sense i think - // ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toplevel", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_as_toplevel", "is_set_as_toplevel"); // ADD_PROPERTY(PropertyInfo(Variant::BOOL,"transform/notify"),"set_transform_notify","is_transform_notify_enabled"); ADD_SIGNAL(MethodInfo("draw"));