Notifications
Clear all

[Closed] question about creating Interfaces for CTRL

Hey guys.

I’m new into scripting, but I’ve been trying to use it for creating interfaces for my controllers.

I created an interface with some sliders.

Now what am trying to do is have a checkbox that says “Both” and when it’s clicked on it moves the 2 sliders as instances of each other.

Does anybody know how to achieve this, or a different approach? I just need some guidance

Thank you.

5 Replies
 rdg

In the changed handler of both sliders check for the value of your checkbox and update the other slider.

Maybe there is another solution?

Hope this helps.

Georg

 PEN

Play with that a bit.


 b=box()
 
 def=attributes test
 (
 	parameters testP rollout:testR
 	(
 		link type:#boolean ui:linkCb
 		spinner1 type:#float ui:spinner1Sp
 		spinner2 type:#float ui:spinner2Sp
 		oldVal type:#float	--Holds the last value of spinner 2
 	)
 	rollout testR "test"
 	(
 		checkBox linkCb "Link"
 		spinner spinner1Sp "Spinner 1"
 		spinner spinner2Sp "Spinner 2"
 		
 		--Spinner one sets an absolute value
 		on spinner1Sp changed val do
 		(
 			if link then spinner2=val
 		)
 		
 		--Spinner two sets a reletive value
 		on spinner2Sp changed val do
 		(
 			if link then 
 			(
 				spinner1+=(val-oldVal)
 				oldVal=val
 			)else
 			(
 				oldVal=val
 			)
 		)
 	)
 )
 custAttributes.add b def
 select b
 max modify mode
 

Thanks for the break down Paul, the script works great.

I was also wondering if within an interface you could select 2 sliders at the same time.

Because you can only select one slider at a time, I don’t know if this could be done with scripting or if it’s just the way Max works.

Thanks again.

 PEN

There is no way in Max to do this but I’m not sure about Max 9 now with the .net controls that can be used. You might be able to with it as I have not yet looked into it. I’m stuck in Max 7,8 at the moment on projects so it is hard for me to comment.

I have set up something that sort of worked for letting you select multiple controls using Ax controls where you could sort of flag the controls. But it wasn’t like working in Maya where you can just swipe your mouse over all the controls that you need.

Oh alright, yea Im using max 8. So hopefully when I get max 9 I can figure it out, thanks Paul.

Alright I created a script and I added the checkbox script Paul showed me, but now I really don’t know what is wrong.

Can somebody look this over maybe im missing something.

I appreciate the help

This is the error I get.

<AttributeDef:footControls>

– Syntax error: at on, expected <rollout clause>

– In line: on t

[color=white]and this is the script
[/color]


ca=custAttributes.getDef $.modifiers[1].FaceControls
 
attributes footControls
 
redefine:ca
 
(
 
parameters params rollout:lipsR
 
(
 
lipUp type:#float ui:(lipUpSl,lipUpSp)
 
lipDown type:#float ui:(lipDownSl,lipDownSp)
 
 
 
topLid type:#float ui:(topLidSl,topLidSp)
 
BottomLid type:#float ui:(BottomLidSl,BottomLidSp)
 
toplLid type:#float ui:(toplLidSl,toplLidSp)
 
BottomlLid type:#float ui:(BottomlLidSl,BottomlLidSp)
 
 
 
LbrowOut type:#float ui:(LbrowOutSl,LbrowOutSp)
 
LbrowMid type:#float ui:(LbrowMidSl,LbrowMidSp)
 
browCenter type:#float ui:(browCenterSl,browCenterSp)
 
 
 
RbrowOut type:#float ui:(RbrowOutSl,RbrowOutSp)
 
RbrowMid type:#float ui:(RbrowMidSl,RbrowMidSp)
 
 
 
Both type:#boolean ui:BothCb
 
oldVal type:#float 
 
 
 
RcornerX type:#float
 
RcornerY type:#float
 
LcornerX type:#float
 
LcornerY type:#float
 
JawX type:#float
 
JawY type:#float
 
 
 
)
 
rollout lipsR "Face Controls"
 
(
 
group "lips"
 
(
 
slider lipUpSl "Lip Up" orient:#vertical range:[0,100,0] ticks:0 across:2
 
slider lipDownSl "Lip Down" orient:#vertical range:[0,100,0] ticks:0
 
spinner lipUpSp "" range:[0,100,0] across:2 fieldwidth:40 align:#left
 
spinner lipDownSp "" range:[0,100,0] fieldwidth:40 align:#right
 
)
 
local range=[0,100,0]
 
group "eyes" 
 
(
 
slider toplLidSl "TLid L" orient:#vertical range:range ticks:0 across:4
 
slider BottomlLidSl "BLid L" orient:#vertical range:range ticks:0 offset:[-6,0]
 
slider topLidSl "TLid R" orient:#vertical range:range ticks:0 offset:[6,0]
 
slider BottomLidSl "BLid R" orient:#vertical range:range ticks:0 
 
 
 
spinner toplLidSp "" range:range across:4 align:#left fieldwidth:30 
 
spinner BottomlLidSp "" range:range offset:[-10,30] fieldwidth:30
 
spinner topLidSp "" range:range fieldwidth:30 offset:[10,30]
 
spinner BottomLidSp "" range:range align:#right fieldwidth:30
 
 
 
checkBox BothCb "Both"
 

 
on toplLidSp changed val do
 
(
 
if Both then BottomlLid=val
 
)
 
on BottomlLidSp changed val do
 
(
 
if Both then 
 
(
 
toplLid+=(val-oldVal)
 
oldVal=val
 
)else
 
(
 
oldVal=val
 
)
 
)
 
 
 
 
 
)
 
local range=[-100,100,0]
 
group "Eye Brows" 
 
(
 
slider RbrowOutSl "L Out" orient:#vertical range:range ticks:0 across:5
 
slider RbrowMidSl "L Mid" orient:#vertical range:range ticks:0
 
slider browCenterSl "Center" orient:#vertical range:range ticks:0
 
slider LbrowMidSl "R Mid" orient:#vertical range:range ticks:0
 
slider LbrowOutSl "R Out" orient:#vertical range:range ticks:0
 
 
 
spinner RbrowOutSp "" range:range across:5 fieldwidth:30 align:#right offset:[8,0]
 
spinner RbrowMidSp "" range:range offset:[0,25] fieldwidth:30 align:#right
 
spinner browCenterSp "" range:range offset:[0,45] fieldwidth:30 align:#center
 
spinner LbrowMidSp "" range:range offset:[0,25] fieldwidth:30 align:#left
 
spinner LbrowOutSp "" range:range fieldwidth:30 align:#left offset:[-8,0]
 
 
 
)
 
 
 
)
 
)
 
--custAttributes.add $.modifiers[1] ca