Notifications
Clear all

[Closed] custom controllers + overall controller

hi, i have a custom ui to controll the direction of 4 missile wings separately, plus an overall controller, to control the 4 of them at the same time, like the pic:

right now, each of the wings are assigned, but i cant figure out how to wire the overall controller.
for example, if i wire a 2 way connection with each of them, the minute i move wing 01, it will move the overall, that way, will move all the other wings, you know?
any1 knows what to do?
thanks in advance

7 Replies

It should be simple additive math. Each each controller value is equal to the individual control slider value plus the master control. If that isn’t what you want then you should post some images of how it should work and actual values from the sliders.

EDIT: Or set a clause if Overall Control != 0 then wing_slider.value else overall_control_slider.value Personally I would use link buttons to link the wing controls instead of overall or an overall enable button. Otherwise you will get some complications of when what should be what.

-Eric

thats what i did, used buttons, way too complicated, not to say impossible, since i wanted to do this:

overall slider overrides each current wing# value, to its own (overall) value, but if you move each wing slider separately, it wont affect the overall slider.

dunno how to do that

1 Reply
(@pixel_monkey)
Joined: 11 months ago

Posts: 0

This leaves too many possible options, post images of what you want with the sliders set. If you really want help you would probably need to post a max file with your script, and a detailed description of the results you want. Right now your post are very vague and hard to diagnose what you want and what your problem is.

For example, if Overall is not 0.0 then how do the individual wing controls come into play? Are they simply individual controls? If so do what I said first, the controller value is overall_slider.val + wingX_slider.val. That way if overall_slider is 10.0, wing1 is -2.0, then wing1.controller.value = (10.0+(-2.0)) = 8.0, while wing2 is 1.0, then wing2.controller.value = (10.0+1.0) = 11.0, etc.

-Eric

 JHN

You just shouldn’t wire it. The sliders should just find the controllers of the rotation and assign the current slider value to it.


on sliderWing1 changed val do
(
  wing1.rotation.controller[#z_rotation].value = val
)

And just don’t care about linking them up, if you want to wire them up you’d definitely need a switch button. Just use keyframing and setting values directly to the controller.

-Johan

thanks for answering
Its actually pretty simple (what i want to do, not the solution)

I have 4 individual sliders, one for each wing, like the picture, and one overall slider. they are all the same thing, i didnt post any files because its simple, 5 sliders, same value range from -15 to 15, initial value of 0.
the only thing that changes are their names. Here’s the script I applied to the attribute holder:


ca=CustAttributes.getDef $.modifiers[1].missileControls
attributes missileControls
redefine:ca
(
	parameters frontP rollout:frontR
	(
		Foverall type:#float ui:(FoverallSp,FoverallSl)		
		Fwing01 type:#float ui:(Fwing01Sp,Fwing01Sl)
		Fwing02 type:#float ui:(Fwing02Sp,Fwing02Sl)
		Fwing03 type:#float ui:(Fwing03Sp,Fwing03Sl)
		Fwing04 type:#float ui:(Fwing04Sp,Fwing04Sl)
	)
	rollout frontR "Front Wings"
	(
		local fW = 60, oS = [0,-20], rG = [-15,15,0]
		group "Front Wings"
		(
			spinner FoverallSp "" range:rG fieldWidth:fW
			slider FoverallSl "Overall" range:rG offset:oS
			spinner Fwing01Sp "" range:rG fieldWidth:fW
			slider Fwing01Sl "Wing 01:" range:rG offset:oS
			spinner Fwing02Sp "" range:rG fieldWidth:fW
			slider Fwing02Sl "Wing 02:" range:rG offset:oS
			spinner Fwing03Sp "" range:rG fieldWidth:fW
			slider Fwing03Sl "Wing 03:" range:rG offset:oS
			spinner Fwing04Sp "" range:rG fieldWidth:fW
			slider Fwing04Sl "Wing 04:" range:rG offset:oS
		)
	)
)
--custAttributes.add $.modifiers[1] ca

I want it to work like this:
the overall slider, will override all individual values, for example, if each individual slider is set to a different value, lets say 13, 5, -7, 0, when i change the overall slider, all of the individual sliders will be set to the overall value, no matter what.
now, after i move the overall, lets say i set it to 15, and i move one of the individual sliders, it will not affect the overall value, you know?
overall only affects the other sliders when you move it. if you move them individually, overall no longer matters, until you slide it again.

hope im clear this time

1 Reply
(@pixel_monkey)
Joined: 11 months ago

Posts: 0

That won’t work as you want, at least I don’t think it will, as you are basically overriding the individual slider value any time you change the overall slider/spinner. If that is what you want simply add this:

on FoverallSp changed val do (
 	Fwing01Sp.value = Fwing02Sp.value = Fwing03Sp.value = Fwing04Sp.value = val
 )
 on FoverallSl changed val do (
 	Fwing01Sl.value = Fwing02Sl.value = Fwing03Sl.value = Fwing04Sl.value = val
 )

After the last slider control in the “Front Wings” Group. Basically what this does is any time you change the FoverallSp or FoverallSl you replace the individual wing values with that value. Look up the Slider and Spinner Events in the maxscript help for more information.

-Eric

lol actually that worked exactly as i wanted mate
thanks you so much for sorting it out, really appreciate all your help
best regards!