PDA

View Full Version : Help needed! Creating ON/OFF Ctrl In Max to hide/unhide objects in viewport


Black_Fox
02-14-2008, 12:36 PM
Ok guys, i need your wisdom once more.

Here's the case: I got, for example, an arm with an FK/IK switch. Each system has it's own controllers (in this case they are shapes). Right now i have all the controllers together in the view port. I've done what i could so they would differ and the animator would not get confused with them but...

What i want to make is a button in the attribute holder that will hide/unhide the desired objects. When the animator uses a slider to switch from IK to FK there will be a button right under the slider to hide/unhide the IK/FK controls.

Sooo...... how do we do it guys?

PEN
02-14-2008, 03:18 PM
Ok guys, i need your wisdom once more.

Here's the case: I got, for example, an arm with an FK/IK switch. Each system has it's own controllers (in this case they are shapes). Right now i have all the controllers together in the view port. I've done what i could so they would differ and the animator would not get confused with them but...

What i want to make is a button in the attribute holder that will hide/unhide the desired objects. When the animator uses a slider to switch from IK to FK there will be a button right under the slider to hide/unhide the IK/FK controls.

Sooo...... how do we do it guys?

The simplest solution is to place an xform modifier on the controls and wire the scale of the xform gizmo to the blend spinner for the IK/FK.

Black_Fox
02-14-2008, 03:36 PM
The simplest solution is to place an xform modifier on the controls and wire the scale of the xform gizmo to the blend spinner for the IK/FK.


.............. :surprised...................... ?? LOL

So you actually shrink the object to the point it's not visible?? And that won't affect any animation on it??.....

That's like.... smart... i feel like a complete noob :blush:

Thank PEN.

eek
02-14-2008, 03:48 PM
That, or you could use a script controller on an external object to hide and unhide the object based on a keyable boolean controller.

if val == 1 then (hide #(fk1,fk2)) else (unhide #(fk1,fk2)

PEN
02-14-2008, 06:07 PM
The xform method is easy, fast and doesn't require anything fancy. It also looks kinda cool when you blend from one to the other. I often set it up so that it doesn't completely disapear, just get it out of th way. That way you can still see where the other is.

labbejason
02-14-2008, 06:49 PM
Actually, being able to combine eek and paul's method would be good. Like it was made so they scaled accordingly with xform, and also freezed or unfreezed depending on the blend value. Otherwise, even though they are shrinked down, it's very easy for the animator to grab a selection of the arm controls, and accidently grabbing the ones that were shrinked down and start setting keys on them.

eek
02-14-2008, 10:10 PM
The key is you can always drive a non-keyable parameter of an object via another. A script-controller doesnt need to be on the object being driven.

Black_Fox
02-15-2008, 10:23 AM
Actually, being able to combine eek and paul's method would be good. Like it was made so they scaled accordingly with xform, and also freezed or unfreezed depending on the blend value. Otherwise, even though they are shrinked down, it's very easy for the animator to grab a selection of the arm controls, and accidently grabbing the ones that were shrinked down and start setting keys on them.

good point.

A colleague of mine wrote a script with which he created a small panel with a button on it. When you click the button it hides/un-hides the object.
I was thinking maybe you'll have your IK/FK slider and right under it the hide/un-hide button.
Of course something with less buttons would be better.

If doing it with Pen's way, then you definitely need to freeze/unfreeze the ctrls or the animator will end selecting the invisible ctrls and animating them.

Hmm... i need to start learning how to script.

The key is you can always drive a non-keyable parameter of an object via another. A script-controller doesnt need to be on the object being driven.

Soo... if you actually create a slider for the hide/unhide function, hiding/unhiding objects will become animatable... !! But of course the values can only be from 0 to 1. So from one frame to the next only.

eek
02-15-2008, 03:26 PM
good point.



Soo... if you actually create a slider for the hide/unhide function, hiding/unhiding objects will become animatable... !! But of course the values can only be from 0 to 1. So from one frame to the next only.

Yes, because hide and unhide are really just true or false, 0 or 1.

PEN
02-15-2008, 05:09 PM
Charles, I would like to point out what you said about controlling properties that the script controller isn't on is a bit missleading. The method that you are suggesting works but if you were to try and control an animatable property that way it will not update durring renders correctly.

I now Charles knows this but just wanted to make sure some one else doesn't think that it is a good idea when setting up other systems. Max help states that a script controller must be on the track that it is controlling.

eek
02-15-2008, 06:15 PM
Charles, I would like to point out what you said about controlling properties that the script controller isn't on is a bit missleading. The method that you are suggesting works but if you were to try and control an animatable property that way it will not update durring renders correctly.

I now Charles knows this but just wanted to make sure some one else doesn't think that it is a good idea when setting up other systems. Max help states that a script controller must be on the track that it is controlling.

Yes, good point Paul, Its good for this that only work in the viewport else your'll have bake the keys physically onto the object - a good example of this is dynamics simuations.

Black_Fox
04-22-2008, 01:01 PM
Max help states that a script controller must be on the track that it is controlling.

So is there any way to put the script controller on the Hide/unhide track??
Where do you even find the hide/unhide tracker?
Is there any way to make it appear in your curve editor??

scrimski
04-22-2008, 01:06 PM
If I remeber right you have to animate the visibilty via the object properties first to unveil the visibility track.

Black_Fox
04-22-2008, 02:21 PM
If I remeber right you have to animate the visibilty via the object properties first to unveil the visibility track.

No no no. I'm not talking about the visibility track but the Hide/Unhide function. There's no track even by default but maybe there is a way for that.

spacegroo
04-23-2008, 04:35 PM
Max doesn't have a "Hide" track. The hidden state is not animatable in that sense. The Visibility Track is what you want to mess with in that case, but of course an object keyed to be Invisible is still visible within the viewport, and is just ghosted. The Visibility track is intended principally for rendering purposes, though we use it with our game engine also.

Honestly, the XForm method Paul has outlined is probably more than adequate. He demonstrates this on his website in one of his recent tutorials. (Nice tutorial, btw!) Personally, I'd be wary of using Freeze or Hidden states in conjunction with this since I frequently use Unhide/Unfreeze All operands. I don't believe any rig can be completely safe from user-error, so I honestly wouldn't be overly concerned about animators accidentally selecting a scaled down controller object as a ) that should be fairly infrequent and b ) the animator should be smart enough to realize they selected the wrong object.

JamesLane
04-23-2008, 08:18 PM
just my two cents, you can always put your IK and FK controls on separate layers and hide/unhide those accordingly....thats just a really simple solution. Then when you would use a unfreeze all or unhide all, you will have the option to leave those layers the way they are.

As an animator, I personally use a script with a hide/unhide button in my attribute holder (usually a PEN attribute holder):cool: right under my IK/FK slider. Either that or a script that hides the handles depending on the value of the IK/FK spinner or Slider

S-S
04-23-2008, 09:37 PM
JamesLane:

I like that solution too. I've just used a check box and custom attributes to hide-unhide objects. Layers are simple to use, and it's easy to see what's hidden and they are transferred with objects.

Black_Fox:
Here's a way i've done it.

Just have one object with Attribute holder or some other modifier added, then run this script. It adds one button which will hide-unhide layers which have either "FK" or "IK" name.


myCAs = attributes myCA
(
parameters myCA_pars rollOut:test_roll
(
onOff type:#boolean animatable:true default:false ui:onOff_cb
)

rollout test_roll "Test rollout"
(
checkBox onOff_cb "Show FK - Show IK"

on onOff_cb changed toState do
(
fkLayer = LayerManager.getLayerFromName "FK"
ikLayer = LayerManager.getLayerFromName "IK"

if toState == true then
(
fkLayer.on = false
ikLayer.on = true
)
else
(
fkLayer.on = true
ikLayer.on = false
)
)
)
)
custattributes.add $.modifiers[1] myCAs

CGTalk Moderation
04-23-2008, 09:37 PM
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.