Notifications
Clear all

[Closed] how do I create a Custom Attribute slider?

Hi!

I’m using PEN attribute holder 2 and I would like to add a custom attribute slider (with script)

How can I do that?

1 Reply
 rdg

Hi one way is this:

create a string containing your customAttribute definition and add it to the object:

 
 -- dummy values
    theKm=10
   realKM=10    
   -- attrib def start
theCustAttr = "theAttribute = attributes CAT_Test (
"
theCustAttr +=	"parameters main rollout:roTest
"
theCustAttr +=    "	(
"
theCustAttr +=	"		theKm type:#integer ui:theKm default:"+realKm as String+"
"
 -- skiped details
theCustAttr +=	"	)
"
 		 			 
theCustAttr +=	"	rollout roTest \"Parameters\" 
"
theCustAttr +=	"	(
"
theCustAttr += "		spinner theKm \"km:\" range:[0, 100000.0, "+realKm as String+"] type:#integer 
"
theCustAttr +=	"	)
"
theCustAttr +=	")
"
-- attrib def end	 
 -- add it to the selected object
custAttributes.add $.modifiers[1] (execute(theCustAttr))

This examle adds a spinner, but adjusting it would be easy.
If there is a way without “execute”, please post it.

Georg