But now it will just, no matter what i do, set the selected scale to (1.0, 1.0, 1.0) even though the scale of the node3D is everything but!
if Input.is_key_pressed(KEY_ALT) and Input.is_key_pressed(KEY_R):
var selected = EditorInterface.get_selection().get_top_selected_nodes()
var selectedRoot : Node3D = selected[0]
selectedRoot.scale = selectedRoot.get_scale().round()
I’ve tried all sorts of things, but i cant figure it out.
if Input.is_key_pressed(KEY_ALT) and Input.is_key_pressed(KEY_R):
var selected = EditorInterface.get_selection().get_top_selected_nodes()
var selectedRoot : Node3D = selected[0]
#print's the scale
print(str(selectedRoot.get_scale()))
This is very interesting, so my suggestion was wrong…The transform you printed contains a pure rotation basis and basis.get_scale() correctly reports (1,1,1)
So I would kept the @gertkeno solution as his suggestion, is the next step I would follow…
What kind of node are you using this for? global_transform gets orthonomalized if scale is disabled, which is the default for some nodes like Camera3D. Local transform should ignore this flag though.
Here is the “real” (cluttered) script. Which HAS worked in older Godots, and it does do the rounding of the position!!!
if Input.is_key_pressed(KEY_ALT) and Input.is_key_pressed(KEY_R):
var selected = EditorInterface.get_selection().get_top_selected_nodes()
if selected.is_empty():
return
var selectedRoot : Node3D = selected[0]
selectedRoot.position = selectedRoot.position.round()
selectedRoot.scale = selectedRoot.get_scale().round()
not sure how i would do that specifically via the path… i feel like that is what im already doing and it IIISSS working with the position - so it does have a grip on the right object in the scene.
How do you know it’s the node you think it is? Just print the scale via the direct path to the node and also print selectedRoot.get_path() and see if it matches the direct path.
just gives me the correct path. Since that exact script worked in 4.4 I’m concerned that it is something with the scaling in editor TOOLs that has snapped.