소스 검색

Revert "Made toplevel a property for Node3D and CanvasItem"

This reverts commit a726d011d5c91f5344c35e6d6cba1e6529dc6981.
Rémi Verschelde 4 년 전
부모
커밋
4028414e0e
4개의 변경된 파일34개의 추가작업 그리고 8개의 파일을 삭제
  1. 16 3
      doc/classes/CanvasItem.xml
  2. 16 3
      doc/classes/Spatial.xml
  3. 2 1
      scene/2d/canvas_item.cpp
  4. 0 1
      scene/3d/spatial.cpp

+ 16 - 3
doc/classes/CanvasItem.xml

@@ -473,6 +473,13 @@
 				Returns [code]true[/code] if local transform notifications are communicated to children.
 				Returns [code]true[/code] if local transform notifications are communicated to children.
 			</description>
 			</description>
 		</method>
 		</method>
+		<method name="is_set_as_toplevel" qualifiers="const">
+			<return type="bool">
+			</return>
+			<description>
+				Returns [code]true[/code] if the node is set as top-level. See [method set_as_toplevel].
+			</description>
+		</method>
 		<method name="is_transform_notification_enabled" qualifiers="const">
 		<method name="is_transform_notification_enabled" qualifiers="const">
 			<return type="bool">
 			<return type="bool">
 			</return>
 			</return>
@@ -505,6 +512,15 @@
 				Transformations issued by [code]event[/code]'s inputs are applied in local space instead of global space.
 				Transformations issued by [code]event[/code]'s inputs are applied in local space instead of global space.
 			</description>
 			</description>
 		</method>
 		</method>
+		<method name="set_as_toplevel">
+			<return type="void">
+			</return>
+			<argument index="0" name="enable" type="bool">
+			</argument>
+			<description>
+				If [code]enable[/code] is [code]true[/code], the node won't inherit its transform from parent canvas items.
+			</description>
+		</method>
 		<method name="set_notify_local_transform">
 		<method name="set_notify_local_transform">
 			<return type="void">
 			<return type="void">
 			</return>
 			</return>
@@ -554,9 +570,6 @@
 		<member name="show_behind_parent" type="bool" setter="set_draw_behind_parent" getter="is_draw_behind_parent_enabled" default="false">
 		<member name="show_behind_parent" type="bool" setter="set_draw_behind_parent" getter="is_draw_behind_parent_enabled" default="false">
 			If [code]true[/code], the object draws behind its parent.
 			If [code]true[/code], the object draws behind its parent.
 		</member>
 		</member>
-		<member name="toplevel" type="bool" setter="set_as_toplevel" getter="is_set_as_toplevel">
-			If [code]true[/code], the node will not inherit its transform from parent [CanvasItem]s.
-		</member>
 		<member name="show_on_top" type="bool" setter="_set_on_top" getter="_is_on_top">
 		<member name="show_on_top" type="bool" setter="_set_on_top" getter="_is_on_top">
 			If [code]true[/code], the object draws on top of its parent.
 			If [code]true[/code], the object draws on top of its parent.
 		</member>
 		</member>

+ 16 - 3
doc/classes/Spatial.xml

@@ -84,6 +84,13 @@
 				Returns whether this node uses a scale of [code](1, 1, 1)[/code] or its local transformation scale.
 				Returns whether this node uses a scale of [code](1, 1, 1)[/code] or its local transformation scale.
 			</description>
 			</description>
 		</method>
 		</method>
+		<method name="is_set_as_toplevel" qualifiers="const">
+			<return type="bool">
+			</return>
+			<description>
+				Returns whether this node is set as Toplevel, that is whether it ignores its parent nodes transformations.
+			</description>
+		</method>
 		<method name="is_transform_notification_enabled" qualifiers="const">
 		<method name="is_transform_notification_enabled" qualifiers="const">
 			<return type="bool">
 			<return type="bool">
 			</return>
 			</return>
@@ -189,6 +196,15 @@
 				Scales the local transformation by given 3D scale factors in object-local coordinate system.
 				Scales the local transformation by given 3D scale factors in object-local coordinate system.
 			</description>
 			</description>
 		</method>
 		</method>
+		<method name="set_as_toplevel">
+			<return type="void">
+			</return>
+			<argument index="0" name="enable" type="bool">
+			</argument>
+			<description>
+				Makes the node ignore its parents transformations. Node transformations are only in global space.
+			</description>
+		</method>
 		<method name="set_disable_scale">
 		<method name="set_disable_scale">
 			<return type="void">
 			<return type="void">
 			</return>
 			</return>
@@ -301,9 +317,6 @@
 		<member name="scale" type="Vector3" setter="set_scale" getter="get_scale" default="Vector3( 1, 1, 1 )">
 		<member name="scale" type="Vector3" setter="set_scale" getter="get_scale" default="Vector3( 1, 1, 1 )">
 			Scale part of the local transformation.
 			Scale part of the local transformation.
 		</member>
 		</member>
-		<member name="toplevel" type="bool" setter="set_as_toplevel" getter="is_set_as_toplevel">
-			If [code]true[/code], the node will not inherit its transformations from its parent. Node transformations are only in global space.
-		</member>
 		<member name="transform" type="Transform" setter="set_transform" getter="get_transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
 		<member name="transform" type="Transform" setter="set_transform" getter="get_transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
 			Local space [Transform] of this node, with respect to the parent node.
 			Local space [Transform] of this node, with respect to the parent node.
 		</member>
 		</member>

+ 2 - 1
scene/2d/canvas_item.cpp

@@ -1228,13 +1228,14 @@ void CanvasItem::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::COLOR, "modulate"), "set_modulate", "get_modulate");
 	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::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, "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::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");
 	ADD_PROPERTY(PropertyInfo(Variant::INT, "light_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_light_mask", "get_light_mask");
 
 
 	ADD_GROUP("Material", "");
 	ADD_GROUP("Material", "");
 	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,CanvasItemMaterial"), "set_material", "get_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");
 	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_PROPERTY(PropertyInfo(Variant::BOOL,"transform/notify"),"set_transform_notify","is_transform_notify_enabled");
 
 
 	ADD_SIGNAL(MethodInfo("draw"));
 	ADD_SIGNAL(MethodInfo("draw"));

+ 0 - 1
scene/3d/spatial.cpp

@@ -810,7 +810,6 @@ void Spatial::_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_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, "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::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_GROUP("Matrix", "");
 	ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform", PROPERTY_HINT_NONE, ""), "set_transform", "get_transform");
 	ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform", PROPERTY_HINT_NONE, ""), "set_transform", "get_transform");
 	ADD_GROUP("Visibility", "");
 	ADD_GROUP("Visibility", "");