View Full Version : Change link inheritance when selected
11-14-2005, 02:25 AM
I would like to change an objects link inheritance, specifically turn off all rotations, when the object is selected and turn them back on when deselected. I know how to do this manually or use setInheritanceFlags in the listener window but it would be nice to have this done automatically with a script. This is just for four control objects in a character rig, not every object in the scene.
I don't know MXS so I'm asking for help here. I researched previous threads and the maxscript reference but I don't even know how to begin to do such a thing. I gather that I need some sort of callback function to know when I select the object then change the inheritance flags but that's as far as I got.
It would be nice if this was possible with an internal script that would save with the scene but either way would be helpful.
Thank you for your time and any help you may have.
EDIT: I did see the Inheritance_Rotation_All_Off.ms by Paul Hormis at ScriptSpot but I'm looking for a way to do this on object selection.
I'm not sure what this is going to do for you? If you move or rotate an object it will not affect the parent object anyway. Turning off it's inheritance would only have an effect on it if the parent object was moved or rotated.
So do you really want to turn off the inheritance off all the child objects of the one that you pick instead?
11-14-2005, 04:26 PM
Turning off it's inheritance would only have an effect on it if the parent object was moved or rotated.
In this case, that is what's happening and why I need to turn off its inheritance.
For example, I have a control object on a leg rig that is in front of the knee. I use it to change the swivel angle of the leg HI IK chain when it is rotated around the knee position helper that it is linked to. The helper is position constrained to the lower leg bone pivot and orientation constrained between the upper and lower leg bone pivots so the helper (knee) will stay in the correct orientation as the leg moves and bends.
The reason the swivel control is linked to the helper is so it will follow the knee as the leg moves and inherit its orientation. When I rotate the control around the helper I need to turn off rotation inheritance so the control's rotation doesn't get multiplied by the helpers rotation, because the helper follows with the swivel angle.
Going to the Inherit rollout every time I need to change the swivel angle takes time. I'm looking for a way to turn off rotation inheritance when the control object is selected then turn it back on when it's deselected (or when another object is selected).
I would have to see the rig but there shouldn't be a need to go through these steps to get your rig working. I have never had to do such things. I also think that you will find that you are going to run into other problems with this sort of work flow.
Can you post a pic of the rig so that I see what you are looking at. I might have a simple rigging solution for you.
11-14-2005, 11:04 PM
The reason I set up the swivel control this way is that I really like how it follows the knee orientation as the leg is animated. If you have a rigging solution that does the same thing then I would be all for it. The attached image shows just the leg and how the swivel control is set up to follow the knee. What is not shown is the control's Z axis rotation is wired to the leg HI IK chain's swivel angle. Also, the control object and the helper share the same axis position.
11-16-2005, 02:51 AM
I figured it out. Paul, you were right, the solution was a rigging issue and not a scripting one. Your comments made me go back and think "outside the box primitive". Even if I had been able to come up with some exotic callback script I would always feel it was overkill for such a simple issue.
Even though I didn't use scripting to solve this problem, I did learn quite a bit about it in the process so thats good. I'll describe what I did below so for anyone that doesn't care in the slightest, you may now be excused. :)
Ok, now that they are gone I'll explain what I did.
Starting from the same setup as the image in my previous post;
1. I created another point helper and aligned it to the first helper.
2. I linked the control object to the second helper.
3. I linked the second helper to the first helper.
4. I wired the IK chain's (negative)swivel angle to the second helper's Z axis.
With all link inheritance on, everything works like I want. The second helper cancels out the Z rotation that was getting propagated back to the control.
Thanks again Paul for showing me that my original idea wasn't very practical.
11-16-2005, 02:51 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.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.