Notifications
Clear all
[Closed] CA / maxscript newbie
Dec 10, 2008 12:08 pm
Hi
Im trying to make some small tools for example and automatic screw dummy object for technical animations which automaticaly will rotate when keyed along a specified axis. The Custom attribute will make me able to quickly change the height of the screw…
I think I need some good advise on how to structure my script – and In what order things are executed etc…
br
Kedde
fn makeobj =
(
sobj = dummy()
sobj.name = “ScrewObject”
–addModifier sobj (emptymodifier())
custAttributes.add sobj ScrewCA
–
txt = text()
txt.text = “ScrewHelper”
txt.size = 10
txt.rotation.controller.y_rotation = 90
txt.parent = sobj
)
fn makectrl =
(
–animation = bezier_float()
sobj.pos.controller.Z_position.controller = float_list ()
sobj.pos.controller.Z_position.controller.Available.controller = bezier_float()
sobj.rotation.controller.Z_Rotation.controller = float_list ()
sobj.rotation.controller.Z_Rotation.controller.Available.controller = fs
)
fn makeinterface = (
ScrewCA = attributes “screwdata”
(
parameters main rollout:params
(
height type:#float ui:Sheight default:10
)
rollout params “Screw Parameters”
(
spinner Sheight “height”
)
)
)
fn makescript = (
global fs = float_script()
fs.script = “k=sobj.screwdata.height
k2=sobj.position.controller.Z_Position.controller[2].value
(k2/k)2PI”
)
–
makeinterface()
makeobj()
makescript()
makectrl()
1 Reply
Dec 10, 2008 12:08 pm
I haven’t tested the code but it looks fine, a little hard to tell because you have not used the code tags here so every thing ended up left justified and hard to read. If it works then you are well on your way to writing useful code. A very talented programmer once said to me “the best code is code that works”.