@@ -125,26 +125,25 @@ func _process(delta: float) -> void:
125125
126126
127127func _on_snap_pressed (id : int ) -> void :
128- var tween = get_tree ().create_tween ()
129- var pivot = preview3D .get_node ("MaterialPreview/Preview3d/ObjectsPivot/Objects" )
130- var cam_control = preview3D .get_node ("MaterialPreview/Preview3d/CameraController" )
128+ var shift_down : bool = Input .is_key_pressed (KEY_SHIFT )
129+ var tween := get_tree ().create_tween ()
130+ var pivot := preview3D .get_node ("MaterialPreview/Preview3d/ObjectsPivot/Objects" )
131+ var cam_control := preview3D .get_node ("MaterialPreview/Preview3d/CameraController" )
131132 var camrot2 : Node3D = preview3D .camera_controller .camera_rotation2
132133 var camrot1 : Node3D = preview3D .camera_controller .camera_rotation1
133- var rot2 : Vector3
134- var rot1 : Vector3
134+ var rot2 := camrot2 . rotation
135+ var rot1 := Vector3 ( camrot1 . rotation . x , 0.0 , camrot2 . rotation . z )
135136 match id :
136137 SnapView .Top :
137- rot2 = Vector3 ( - PI * 0.5 , camrot2 . rotation . y , camrot2 . rotation . z )
138- rot1 = Vector3 ( camrot1 . rotation . x , 0.0 , camrot2 . rotation . z )
138+ rot2 . x = - PI * ( - 0.5 if shift_down else 0.5 )
139+ rot1 . y = 0.0
139140 SnapView .Front :
140- rot2 = Vector3 ( 0.0 , camrot2 . rotation . y , camrot2 . rotation . z )
141- rot1 = Vector3 ( camrot1 . rotation . x , 0.0 , camrot2 . rotation . z )
141+ rot2 . x = 0.0
142+ rot1 . y = PI * ( 1.0 if shift_down else 0.0 )
142143 SnapView .Right :
143- rot2 = Vector3 (0.0 , camrot2 .rotation .y , camrot2 .rotation .z )
144- rot1 = Vector3 (camrot1 .rotation .x , - PI * 0.5 , camrot2 .rotation .z )
145-
144+ rot2 .x = 0.0
145+ rot1 .y = - PI * (- 0.5 if shift_down else 0.5 )
146146 tween .tween_property (camrot2 , "rotation" , rot2 , 0.2 ).set_trans (Tween .TRANS_CUBIC )
147147 tween .parallel ().tween_property (camrot1 , "rotation" , rot1 , 0.2 ).set_trans (Tween .TRANS_CUBIC )
148148 tween .parallel ().tween_property (pivot , "transform:origin" , Vector3 .ZERO , 0.2 ).set_trans (Tween .TRANS_CUBIC )
149149 tween .parallel ().tween_property (cam_control , "transform:origin" , Vector3 .ZERO , 0.2 ).set_trans (Tween .TRANS_CUBIC )
150-
0 commit comments