1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-23 05:53:14 +00:00

Toggle 3D object visibility

This commit is contained in:
Emmanouil Papadeas 2023-03-28 18:31:51 +03:00
parent 162ba4c70b
commit 9e65eb7c07
2 changed files with 15 additions and 5 deletions

View file

@ -25,6 +25,7 @@ onready var layer_properties := {
}
onready var object_properties := {
"visible": $"%VisibleCheckBox",
"translation": $"%ObjectPosition",
"rotation_degrees": $"%ObjectRotation",
"scale": $"%ObjectScale",
@ -226,7 +227,6 @@ func _selected_object(object: Cel3DObject) -> void:
var property_path: String = prop
if property_path.ends_with("v2"):
property_path = property_path.replace("v2", "")
var prev_node: Control = node.get_parent().get_child(node.get_index() - 1)
var property = object.get_indexed(property_path)
var property_exists: bool = property != null
# Differentiate between the mesh size of a box/prism (Vector3) and a plane (Vector2)
@ -234,7 +234,9 @@ func _selected_object(object: Cel3DObject) -> void:
property_exists = false
elif node is ValueSliderV2 and typeof(property) != TYPE_VECTOR2:
property_exists = false
prev_node.visible = property_exists
if node.get_index() > 0:
var prev_node: Control = node.get_parent().get_child(node.get_index() - 1)
prev_node.visible = property_exists
node.visible = property_exists
mesh_options.visible = object.node3d_type is MeshInstance
light_options.visible = object.node3d_type is Light

View file

@ -56,6 +56,7 @@ focus_mode = 2
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
text = "Add new object"
align = 0
[node name="RemoveObject" type="Button" parent="HandleObjects" index="3"]
unique_name_in_owner = true
@ -185,7 +186,14 @@ margin_right = 1266.0
margin_bottom = 800.0
size_flags_vertical = 3
[node name="TransformOptions" type="VBoxContainer" parent="ObjectOptions" index="0"]
[node name="VisibleCheckBox" type="CheckBox" parent="ObjectOptions" index="0"]
unique_name_in_owner = true
margin_right = 24.0
margin_bottom = 24.0
mouse_default_cursor_shape = 2
text = "Visible"
[node name="TransformOptions" type="VBoxContainer" parent="ObjectOptions" index="1"]
margin_right = 1266.0
margin_bottom = 272.0
theme_type_variation = "CollapsibleContainer"
@ -260,7 +268,7 @@ suffix_x = "%"
suffix_y = "%"
suffix_z = "%"
[node name="MeshOptions" type="VBoxContainer" parent="ObjectOptions" index="1"]
[node name="MeshOptions" type="VBoxContainer" parent="ObjectOptions" index="2"]
unique_name_in_owner = true
margin_top = 276.0
margin_right = 1266.0
@ -626,7 +634,7 @@ text = "Center"
items = [ "Left", null, false, 0, null, "Center", null, false, 1, null, "Right", null, false, 2, null ]
selected = 1
[node name="LightOptions" type="VBoxContainer" parent="ObjectOptions" index="2"]
[node name="LightOptions" type="VBoxContainer" parent="ObjectOptions" index="3"]
unique_name_in_owner = true
margin_top = 276.0
margin_right = 1266.0