PDA

View Full Version : Resize Dummy Modifier?


MerlinEl
07-18-2011, 12:05 PM
Hi

I created a modifier to add a rezize property in Dummy helper.
Is there any way to have it permanently in modifier stack?


(
local ca = attributes dummy_settings
(
fn resize obj x y z = if classOf obj == dummy do obj.boxsize = [x,y,z]

parameters main rollout:params
(
Width type:#worldUnits ui:spn_x default:0
Lenght type:#worldUnits ui:spn_y default:0
Height type:#worldUnits ui:spn_z default:0
)
rollout params "Parameters:"
(
spinner spn_x "Width:" range:[-1000,1000,0] type:#worldUnits
spinner spn_y "Lenght:" range:[-1000,1000,0] type:#worldUnits
spinner spn_z "Height:" range:[-1000,1000,0] type:#worldUnits

on spn_x changed val do resize selection[1] val spn_y.value spn_z.value
on spn_y changed val do resize selection[1] spn_x.value val spn_z.value
on spn_z changed val do resize selection[1] spn_x.value spn_y.value val
)

)

local obj = selection[1]
if classOf obj == dummy do
(
local em = EmptyModifier name:"Dummy Settings"
addModifier obj em
custAttributes.add obj.modifiers[1] ca
em.width = obj.boxsize.x
em.lenght = obj.boxsize.y
em.height = obj.boxsize.z
)
)



any suggestion will be appreciated ;)

miauu
07-18-2011, 01:14 PM
Make it as a plugin.
See this: (http://www.scriptspot.com/3ds-max/scripts/dimension-0)

denisT
07-18-2011, 01:25 PM
... or as helper object:

/* by denisT */

plugin Helper ProDummy name:"ProDummy"
classID:#(0x00001967, 0x4023088b)
category:"Standard"
extends:Dummy
version:1
(
parameters main rollout:params
(
width type:#float ui:ui_width default:0
length type:#float ui:ui_length default:0
height type:#float ui:ui_height default:0

on width set val do delegate.boxsize.x = val
on length set val do delegate.boxsize.y = val
on height set val do delegate.boxsize.z = val
)
rollout params "Parameters"
(
spinner ui_width "Width: " fieldWidth:64 type:#worldunits range:[0,1e9,0] align:#right offset:[4,0] tooltip:"X"
spinner ui_length "Length: " fieldWidth:64 type:#worldunits range:[0,1e9,0] align:#right offset:[4,-2] tooltip:"Y"
spinner ui_height "Height: " fieldWidth:64 type:#worldunits range:[0,1e9,0] align:#right offset:[4,-2] tooltip:"Z"
)
tool create
(
local pos
on mousePoint click do case click of
(
1: pos = nodeTM.translation = gridPoint
2: pos = nodeTM.translation
3: #stop
)
on mouseMove click do case click of
(
2:
(
nodeTM.translation = pos + [griddist.x*0.5, griddist.y*0.5, 0]
width = abs griddist.x
length = abs griddist.y
)
3:
(
nodeTM.translation = pos + [0, 0, griddist.z*0.5]
height = abs griddist.z
)
)
)
)

MerlinEl
07-18-2011, 01:40 PM
... or as helper object:

/* by denisT */

plugin Helper ProDummy name:"ProDummy"
classID:#(0x00001967, 0x4023088b)
category:"Standard"
extends:Dummy
version:1
(
parameters main rollout:params
(
width type:#float ui:ui_width default:0
length type:#float ui:ui_length default:0
height type:#float ui:ui_height default:0

on width set val do delegate.boxsize.x = val
on length set val do delegate.boxsize.y = val
on height set val do delegate.boxsize.z = val
)
rollout params "Parameters"
(
spinner ui_width "Width: " fieldWidth:64 type:#worldunits range:[0,1e9,0] align:#right offset:[4,0] tooltip:"X"
spinner ui_length "Length: " fieldWidth:64 type:#worldunits range:[0,1e9,0] align:#right offset:[4,-2] tooltip:"Y"
spinner ui_height "Height: " fieldWidth:64 type:#worldunits range:[0,1e9,0] align:#right offset:[4,-2] tooltip:"Z"
)
tool create
(
local pos
on mousePoint click do case click of
(
1: pos = nodeTM.translation = gridPoint
2: pos = nodeTM.translation
3: #stop
)
on mouseMove click do case click of
(
2:
(
nodeTM.translation = pos + [griddist.x*0.5, griddist.y*0.5, 0]
width = abs griddist.x
length = abs griddist.y
)
3:
(
nodeTM.translation = pos + [0, 0, griddist.z*0.5]
height = abs griddist.z
)
)
)
)


So it was pretty fast :-D Thank you Denis :beer:

denisT
07-18-2011, 02:13 PM
So it was pretty fast :-D Thank you Denis :beer:

it was easy. i just deleted 90% of code from my old plugin. :)

CGTalk Moderation
07-18-2011, 02:13 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.