Hey Guys,
A thing I do manualy when i have objects that will be symmetrical (mirrored uvs) is delete half of it and uv it.
After is just a matter of mirroring the object and offseting the uvs to the right in the unwrap window.
I wanted to automate this, so i made this script:
(
macros.run "Modifiers" "Mirror"
subobjectLevel = 1
modPanel.setCurrentObject $.modifiers[#Mirror]
$.modifiers[#Mirror].copy = on
macros.run "Modifiers" "EditPolyMod"
subobjectLevel = 5
modPanel.addModToSelection (UVW_Xform ()) ui:on
$.modifiers[#UVW_Xform].U_Offset = 1
macros.run "Modifiers" "EditPolyMod"
subobjectLevel = 1
actionMan.executeAction 0 "40021"
max select all
macros.run "Ribbon - Modeling" "EPoly_WeldOptions"
$.modifiers[#Edit_Poly].weldVertexThreshold = 0.01
$.modifiers[#Edit_Poly].Commit ()
)
and behaves like this
https://dl.dropboxusercontent.com/u/93793/Screenshots/2015-09-23_02-25-18.mp4
But, it's a bit hacky.
I was wondering if anyone can comeup with a better way for this?
Cheers!
Pedro
Replies
Looks great what is your MSN nick for add? Do you have nice photo?
( ͡° ͜ʖ ͡°)
1. Make sure they work on a selection objects.
2. Make as few UI updates as possible.
3. Add undo context.
4. Try to get modeling tools to work on EPoly or EditablePoly.
5. Look for bugs. In your tool if faces were selected before starting, they also become offset.
6. Make a perf pass. For example, my code below runs in about 140ms. And yours runs in about 560 ms. Because of #2 above.
( t = timeStamp() --SWITCH TO MODIFY PANEL AND DISABLE UI max modify mode windows.sendmessage (windows.getmaxhwnd()) 0x000B 0 1 undo "Mirror and Weld" on ( try ( selObjs = getCurrentSelection() for obj in selObjs do ( --CLEAR FACE SELECTION select obj if classof obj == Editable_Poly do PolyOp.setFaceSelection obj #{} if classof obj == PolyMeshObject do EditPolyMod.SetSelection obj.modifiers[1] #Face #{} --MIRROR THE GEO mMod = mirror() mMod.copy = true addModifier obj mMod --ADJUST UVs uvMod = UVW_Xform() uvMod.U_Offset = 1 addModifier obj uvMod --WELD vMod = vertexWeld() addModifier obj vMod vMod.threshold = 0.01 ) select selObjs ) catch ( format "%\n" getCurrentException() ) ) --ENABLE UI windows.sendmessage (windows.getmaxhwnd()) 0x000B 1 1 format "% ms\n" (timeStamp()-t) )Works super fast and on multiple objs and they can even have preselected faces, because it won't matter. It will work nicely as well
Thank you so much!
Plus, you always have to offset the uvs to the side on the mirrored parts or else you will have overlaped uvs and it will cause issues when baking.
For reals. this script is bomb!
The Mirror Tool applies a negative scale to flip your model. This is bad.
The Mirror Modifier and Symmetry Modifier rebuild the geometry mirrored, this is acceptable.