hello
would be great if anyone could add Put Pivot To Center option to XForm modifier or create this one
thanks
Forum topic · Scripts Wanted
Put Pivot To Center modifier
By harumscarum · 2012-08-12
Description
Comments (3)
Added another button
MKlejnowski · 2012-08-14
Try the second button. Other wise I am at a total loss as to what your trying to do.
try(destroydialog xFormAdjustRO )catch()
rollout xFormAdjustRO "Adjust Pivot" width:160 height:102
(
----UI
button ctoBtn "Center Object to Pivot" pos:[16,32] width:128 height:20 toolTip:"Have a XForm align its Gizmo so that the object can be centered to the pivot as if the \"Align to Pivot\" action with \"Affect Object Only\" was used"
button ctpBtn "Center Pivot to Object" pos:[16,60] width:128 height:20 toolTip:"Have a XForm align its Gizmo so that the object can be centered to the pivot as if the \"Align to Pivot\" action with \"Affect Object Only\" was used"
groupBox grp1 "Alignment:" pos:[8,8] width:144 height:86
----FUNCTIONS
fn affectXForm oORp=
(
curMod = modPanel.getCurrentObject()
if (classof curMod == XForm) then
(--do event
local GizmoTrans , copyTrans
undo off
(
disablesceneredraw()
curObj = selection[1]
copyObj = copy curObj
modNum = finditem curObj.modifiers curmod
maxOps.CollapseNode copyObj true
CenterPivot copyObj
difTrans = copyObj.transform * (inverse curOBJ.transform)
copyTrans = copyObj.transform
delete copyObj
enablesceneredraw()
)
undo "Center Xform" on
(
curMod.gizmo.transform = inverse difTrans
if oORp then curObj.transform = copyTrans
)
)
else
(--print message asking to select a xform modifiers in the mod panel
MessageBox "No XForm Modifier is selected in the modifier panel. To edit the Xform please select the XForm modifier in the modifier panel and try again."
)
)--end affectXForm fn
----EVENTS
on ctoBtn pressed do AffectXForm false
on ctpBtn pressed do AffectXForm true
)--End xFormAdjustRO
createDialog xFormAdjustRO
thanks
harumscarum · 2012-08-14
yeah, it center object to its pivot position, but i need opposite - put object's pivot to its center automatically (as modifier)
actually just one checkbox "center pivot" in existing XForm modifier will be enough
thank you anyway)
is this it?
MKlejnowski · 2012-08-14
Give this a try. Select the Xform modifier in the mod panel and click the button. Not sure if this is what your where looking for.
try(destroydialog xFormAdjustRO )catch()
rollout xFormAdjustRO "Adjust Pivot" width:160 height:80
(
----UI
button ctoBtn "Center Object to Pivot" pos:[16,32] width:128 height:20 toolTip:"Have a XForm align its Gizmo so that the object can be centered to the pivot as if the \"Align to Pivot\" action with \"Affect Object Only\" was used"
groupBox grp1 "Alignment:" pos:[8,8] width:144 height:56
----FUNCTIONS
fn affectXForm =
(
curMod = modPanel.getCurrentObject()
if (classof curMod == XForm) then
(--do event
local GizmoTrans
undo off
(
disablesceneredraw()
curObj = selection[1]
copyObj = copy curObj
modNum = finditem curObj.modifiers curmod
maxOps.CollapseNode copyObj true
CenterPivot copyObj
difTrans = copyObj.transform * (inverse curOBJ.transform)
delete copyObj
enablesceneredraw()
)
undo "Center Xform" on
(
curMod.gizmo.transform = inverse difTrans
)
)
else
(--print message asking to select a xform modifiers in the mod panel
MessageBox "No XForm Modifier is selected in the modifier panel. To edit the Xform please select the XForm modifier in the modifier panel and try again."
)
)--end affectXForm fn
----EVENTS
on ctoBtn pressed do AffectXForm()
)--End xFormAdjustRO
createDialog xFormAdjustRO