ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
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
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
Comments
Added another button
Try the second button. Other wise I am at a total loss as to what your trying to do.
email: [email protected]
thanks
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?
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.
email: [email protected]