PDA

View Full Version : Adding a button to Attribute Holder...


erensaritas
04-06-2009, 07:54 AM
Hi everyone;

i want to add some custom buttons to attribute holder, that buttons will run the commands which i will write inside....

i know PEN has a holder but i need a diffrent thing, i ll add more than one button and write scripts in them...

thanks for help, regards.....

JHN
04-06-2009, 09:04 AM
Take apart that script and checkout what he does in the rollout part of the script. It works just like a normal rollout but with some extra options, because it acts as a plugin. Lookup scripted plugins the maxscript help file, everything you want should be there, but be prepared to invest some time reading it through, it's not the easiest part of the mxs helpfile.

-Johan

LoneRobot
04-06-2009, 10:11 AM
There are two levels to this really - In a custom attribute or scripted plugin (they are the same pretty much in terms of their setup), you have the ability to store information inside something called the Parameter Block. Its basically the part that allows you to assign a controller so that you can animate a component of the attribute/plugin. By assigning the parameter block to a rollout's ui component, it will mean that the two values are bound (a bit like if you had wired them) so changing the UI value of a slider will automatically change the Parameter block variable.

This gives you a number of options, since you are perfectly welcome to write an attribute that is based around a rollout and not worry about the parameters. It really depends on if there is any information the attribute will need in order to function, like storing the limbs of a rig, the geometry data of a mesh in an array, etc,etc.

If you are just calling some functions or automating a task in the handlers, then you dont have to worry about the parameter block if they arent going to be animated, or you dont need the storage variables for the script.

You can take any rollout and encase it in an attribute,

TestControl = attributes Test
(

rollout RoParams "A Test" width:163 height:138
(
button btn1 "1" pos:[12,103] width:137 height:26
button btn2 "2" pos:[12,71] width:137 height:26
button btn3 "3" pos:[12,39] width:137 height:26
button btn4 "4" pos:[12,7] width:137 height:26

on btn1 pressed do
(
print "button1"
)
on btn2 pressed do
(
print "button2"
)
on btn3 pressed do
(
print "button3"
)
on btn4 pressed do
(
print "button4"
)
)

)
custAttributes.add $ TestControl

I would read what Johan suggested also, as you will really be albe to do good things using attributes as suggested in this topic.

CGTalk Moderation
04-06-2009, 10:11 AM
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.