ok thank you okdan85, you helped a lot.
i’ll try to fix the mirrored axis by trying some different export approach.
your script will be a great resource in my workflow.
maybe the solutions is easier than expected
just apply the script to all objects that shows the same pivots alignment.
this mean that i run your script two times and now there is no flipped pivots in the scene
btw wish you a happy new year
hi all hi dokdan85, and happy new year!!!
i’m back and i’m trying to get the right workflow to reorient the pivots.
it’s a bit harder than expected but it works… i just need to apply the script on sets of geometries that shows the different pivot orientation after to had applied the reset x-form… mirroring some sets of them… applying again the script. well this way i got sets with just 3 time x-form applied and sets with 6 time x- form applied but finally all pointing right pivots
my question is: is there a way to create a script that simply mirror the pivots?
because the mirror tool affect both geometry and pivots at once.
if i could mirror just the pivots the task would be a lot easier.
than i need to collapse them all before to instance them all
thank you in advance
here a screenshot of the correctly aligned pivots… and just instanced.
8MB is the original file
118MB the same scene with correctly aligned pivots and collapsed stack
3Mb the instanced
but now i can tweak them all at once and faster rendering…
any idea how to mirror just the pivots?
Happy new year
rollout MirrorPivot "MirrorPivot"
(
button x "X"
button y "Y"
button z "Z"
checkbox col "Flip Normals and Collapse"
fn setTm o axis =
(
if col.state do convertToMesh o
local xf = xform name:("MirrorPivot " + axis as string)
xf.gizmo.transform = matrix3 (axis[1]*xf.gizmo.transform[1]) (axis[2]*xf.gizmo.transform[2]) (axis[3]*xf.gizmo.transform[3]) xf.gizmo.transform[4]
addmodifier o xf
if col.state do (
convertToMesh o
meshop.flipNormals o #{1..(getNumFaces o)}
update o
)
o.transform = Matrix3 (axis[1]*o.transform[1]) (axis[2]*o.transform[2]) (axis[3]*o.transform[3]) o.transform[4]
)
fn mirrorA axis =
(
local sel = selection as array
if sel.count > 0 do (
case axis of(
1:( for o in sel do setTm o [-1,1,1])
2:( for o in sel do setTm o [1,-1,1])
3:( for o in sel do setTm o [1,1,-1])
)
)
)
on x pressed do mirrorA 1
on y pressed do mirrorA 2
on z pressed do mirrorA 3
)
createDialog MirrorPivot
hahaha… sorry to say that but you are my Xmas gift…
the script as you just know works
it also flip normals is there a way to avoid it?
also to avoid the conversion to editable mesh or poly? just “collapse stack”
i tried it… collapsing one seam manually still remain a body object.
btw… my workaround to get the pivots looking correctly has the same effect it flip normals. but while instancing i got them looking right again.
I glad to help
About normal flip. Mirroring the pivot also flip normals because they have coordinates in the pivot’s coordinate space.
try this one,
this version assign normal modifier to flip normals instead of doing it internally on every face
rollout MirrorPivot "MirrorPivot"
(
button x "X"
button y "Y"
button z "Z"
checkbox col "Flip Normals and Collapse"
fn setTm o axis =
(
if col.state do convertToMesh o
local xf = xform name:("MirrorPivot " + axis as string)
xf.gizmo.transform = matrix3 (axis[1]*xf.gizmo.transform[1]) (axis[2]*xf.gizmo.transform[2]) (axis[3]*xf.gizmo.transform[3]) xf.gizmo.transform[4]
addmodifier o xf
nm = Normalmodifier()
nm.flip = true
addmodifier o (nm)
if col.state do convertToMesh o
o.transform = Matrix3 (axis[1]*o.transform[1]) (axis[2]*o.transform[2]) (axis[3]*o.transform[3]) o.transform[4]
)
fn mirrorA axis =
(
local sel = selection as array
if sel.count > 0 do (
case axis of(
1:( for o in sel do setTm o [-1,1,1])
2:( for o in sel do setTm o [1,-1,1])
3:( for o in sel do setTm o [1,1,-1])
)
)
)
on x pressed do mirrorA 1
on y pressed do mirrorA 2
on z pressed do mirrorA 3
)
createDialog MirrorPivot
as noob i tried to add all the reaming axis like the max mirror tool
also i thought to add the undo ability but it’s not working
“fn chk_undo do” wont work
the collapseStack work but i don’t know how to avoid the mesh conversion and do it generic.
rollout MirrorPivot "MirrorPivot"
(
button x "X" across:2 align:#center
button xy "XY" align:#center
button y "Y" across:2 align:#center
button yz "YZ" align:#center
button z "Z" across:2 align:#center
button zx "ZX" align:#center
checkbox col "Flip Normals and Collapse"
checkbox chk_undo "undo"
fn setTm o axis =
(
if col.state do collapseStack o
local xf = xform name:("MirrorPivot " + axis as string)
xf.gizmo.transform = matrix3 (axis[1]*xf.gizmo.transform[1]) (axis[2]*xf.gizmo.transform[2]) (axis[3]*xf.gizmo.transform[3]) xf.gizmo.transform[4]
addmodifier o xf
if col.state do (
collapseStack o
meshop.flipNormals o #{1..(getNumFaces o)}
update o
)
o.transform = Matrix3 (axis[1]*o.transform[1]) (axis[2]*o.transform[2]) (axis[3]*o.transform[3]) o.transform[4]
)
fn mirrorA axis =
(
local sel = selection as array
if sel.count > 0 do (
case axis of(
1:( for o in sel do setTm o [-1,1,1])
2:( for o in sel do setTm o [1,-1,1])
3:( for o in sel do setTm o [1,1,-1])
4:( for o in sel do setTm o [-1,-1,1])
5:( for o in sel do setTm o [1,-1,-1])
6:( for o in sel do setTm o [-1,1,-1])
)
)
)
on x pressed do mirrorA 1
on y pressed do mirrorA 2
on z pressed do mirrorA 3
on xy pressed do mirrorA 4
on yz pressed do mirrorA 5
on zx pressed do mirrorA 6
fn chk_undo do
(
with undo label:"undo" chk_undo.state (
if $ != undefined then(
--Hold the scene
if chk_hold.state == True then(holdMaxFile()
)
on chk_undo st do
(
if st == True then(
if (querybox "collapsing may slow down") == True then(
chk_undo.state = True
)else(
chk_undo.state = False
)
)
)
)
createDialog MirrorPivot
the addition of the normal modifier to a body object convert it to a editable mesh cause it affect the geometry.
the nurbs and the body objects have a internal normal flipping menù called “face Flip” they don’t need an extra modifier. this is why there is no way to avoid the conversion to editable mesh!