is there a way to mirror the pivot by offset the pivot instead to offset the object?
and than just center the pivot again…
dokdan85 i found a problem with the one you made. it affects also the not selected instanced ones but by mirroring the geometry.
EDITED:
the script mirrorpivot made by dokdan85 is very important and useful for me because it correct the wrong flipped normal on some of the scene object which the pivots were realigned.
the adjustment of a node pivot shouldn’t effect the mesh normals. so it doesn’t need any extra steps (edit/flip normal, collapse stack, etc.)
maybe this is true considering mesh poly or nurbs… unfortunately i use “body object” that i don’t want convert into mesh or poly because i would lost all the surface tweaking… and they can be affected from the script made by dokdan85 for the pivots realignment.
i’m playing for now to see if with your script i can avoid normals flipping of that kind of geometry.
what you do to flip a pivot is overcomplicated…
the adjustment of a node pivot shouldn’t effect the mesh normals
don know why I thought
&.objectoffsetscale is readOnly
thanks denisT
here is a version of a flipping the pivot that takes into account object’s transform:
try(destroydialog FlipPivotRollout) catch()
rollout FlipPivotRollout "Flip Pivot by denisT" width:202
(
button flipX_bt "X" width:60 align:#left offset:[-5,0] tooltip:"Flip Pivot X" across:3
button flipY_bt "Y" width:60 align:#center offset:[0,0] tooltip:"Flip Pivot Y"
button flipZ_bt "Z" width:60 align:#right offset:[5,0] tooltip:"Flip Pivot Z"
mapped fn flipPivot node axis:#x =
(
local flip = case axis of
(
#x: #([-1,1,1], matrix3 [-1,0,0] [0,1,0] [0,0,1] [0,0,0])
#y: #([1,-1,1], matrix3 [1,0,0] [0,-1,0] [0,0,1] [0,0,0])
#z: #([1,1,-1], matrix3 [1,0,0] [0,1,0] [0,0,-1] [0,0,0])
default: #([1,1,1], matrix3 1)
)
node.transform = prescale node.transform flip[1]
node.objectoffsetscale *= [-1,1,-1]
node.objectoffsetrot *= flip[2].rotation
node.objectoffsetpos *= flip[2]
node
)
on flipX_bt pressed do undo "Flip Pivot" on flipPivot selection axis:#x
on flipY_bt pressed do undo "Flip Pivot" on flipPivot selection axis:#y
on flipZ_bt pressed do undo "Flip Pivot" on flipPivot selection axis:#z
)
createdialog FlipPivotRollout
the function is mapped, so it works for multiple selection… it can’t be faster or memory safer.
Originally Posted by denisT
PS. if pivot’s position is off the object’s center you also have to adjust the object’s objectoffsetpos
I think I found more elegant way to do it
rollout MirrorPivot "MirrorPivot"
(
button x " X " width:40
button y " Y " width:40
button z " Z " width:40
mapped fn setTm o axis =
(
tm = o.objectoffsetpos * o.transform
o.transform = prescale o.transform axis
o.objectoffsetpos = tm * inverse o.transform
o.objectoffsetscale *= axis
)
fn mirrorA axis =
(
case axis of(
"x":( setTm selection [-1,1,1] )
"y":( setTm selection [1,-1,1] )
"z":( setTm selection [1,1,-1] )
)
)
on x pressed do with undo label:"Mirror Pivots X" on mirrorA "x"
on y pressed do with undo label:"Mirror Pivots Y" on mirrorA "y"
on z pressed do with undo label:"Mirror Pivots Z" on mirrorA "z"
)
createDialog MirrorPivot
i mean that if i flip the pivot vertically along the z axis the geometry is flipped orizontally along the x axis or something like that.
another problem:
try to put any modifier on the object and run your script
you’ll see that gizmo of modifier is affected.
But what did you expect? Of course it effects modifiers because the object offset scale is flipped…
The flipping pivot axis is not the right idea of itself. I don’t see any reason to live with flipped pivot. The ideal situation when all objects have XForm reset.
I know. therefore I was surprised when the first version of your script didn’t affect modifier’s gizmo
The problem is in compensation of rotation part
dokdan85, the new script works fine it flips the pivot and doesn’t affect by offset.
@ DenisT it’s a simple editable mesh… the one from Studio_scene_share.max 2012 maybe collapsed.
but after to had reset xform it works fine now…
Hi all hi dokdan85 i’m back to report feedback about the scripts.
well they work smooth and without bugs…
but i noticed working with bigger imported objects, not like the big amount of small objects from the example pics and file, that the pivot will not aligned correctly or identically on every geometry pieces.
the mirror flip script is helpful when the axis are flipped and it’s ok, but on some other geometry pieces the pivot is oriented for example
on one it shows a rotations on the xyz axis of 5°
on another one a rotation on xyz of -5°
instancing can’t be done. also while applying the pivot alignment script the new recreated bounding box is different on some identical geometries pieces.
if you are interested and i hope so, to find a solutions to make the script perfect, i will post a max file with such geometries example, so to show the slightly difference.
as always thank you in advance and anyway.