CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 07-20-2011, 08:50 PM   #1
SnipeyX
Animator
 
SnipeyX's Avatar
James Clarke
Senior Applications Specialist
Kansas City, USA
 
Join Date: Mar 2003
Posts: 792
Link Constraint Key Access

It's been a long couple days, so it may just be the fog of crunchtime getting to me, but I'm not seeing any way to access/manipulate the keys of a link constraint controller? Ran searches here, looked in maxscript help, not seeing anything that points to a keyArray for that controller.

Specifically what I'm looking to do is have a function that deletes any keys after the currentTime on any sleceted objects that have link constraint controllers. I can figure out how to code that, if I can manage to find how to get what the existing constraint keys are.


Thanks for any ideas!

Edit: Getting closer, I don't know enough about subAnims, so found
$.transform.controller[2].keys
to get to the linkTimes keyArray, but doing
deleteKey $.transform.controller[2].keys 3
results in OK but the $.transform.controller[2].keys.count doesn't change. More digging needed...
__________________
| Twitter | LinkedIn | JCanimator.com |

Last edited by SnipeyX : 07-20-2011 at 08:59 PM.
 
Old 07-20-2011, 10:36 PM   #2
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,508
Send a message via ICQ to denisT
Quote:
Originally Posted by SnipeyX
It's been a long couple days, so it may just be the fog of crunchtime getting to me, but I'm not seeing any way to access/manipulate the keys of a link constraint controller? Ran searches here, looked in maxscript help, not seeing anything that points to a keyArray for that controller.

Specifically what I'm looking to do is have a function that deletes any keys after the currentTime on any sleceted objects that have link constraint controllers. I can figure out how to code that, if I can manage to find how to get what the existing constraint keys are.


Thanks for any ideas!



you can't delete keys from LinkTimeControl controller. It's driven by link targets. You have to delete a target, and it automatically deletes the correspondent key from Link_Times.
getframeno, getnumyargets, deletetarget are your methods.
 
Old 07-20-2011, 10:38 PM   #3
SnipeyX
Animator
 
SnipeyX's Avatar
James Clarke
Senior Applications Specialist
Kansas City, USA
 
Join Date: Mar 2003
Posts: 792
Ahhhhhhhhhhhhhhh. Right. I knew that. I used addTarget all over the place in this script, but DeleteTarget never even entered my mind when it came to this.

Thank you!
__________________
| Twitter | LinkedIn | JCanimator.com |
 
Old 07-21-2011, 01:48 AM   #4
SnipeyX
Animator
 
SnipeyX's Avatar
James Clarke
Senior Applications Specialist
Kansas City, USA
 
Join Date: Mar 2003
Posts: 792
The Solution

In case anyone else comes across wanting to do the same thing, here's what I wound up doing, seems to work thus far.

Code:
sel = selection as array objs = for o in sel where classOf o.transform.controller == Link_Constraint collect o for o in objs do ( num = o.transform.controller.getNumTargets() for i=num to 1 by -1 do ( frameNo = o.transform.controller.getFrameNo i if frameNo > currentTime then o.transform.controller.DeleteTarget i ) )
__________________
| Twitter | LinkedIn | JCanimator.com |
 
Old 07-21-2011, 02:45 AM   #5
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,508
Send a message via ICQ to denisT
Quote:
Originally Posted by SnipeyX
In case anyone else comes across wanting to do the same thing, here's what I wound up doing, seems to work thus far.

Code:
sel = selection as array objs = for o in sel where classOf o.transform.controller == Link_Constraint collect o for o in objs do ( num = o.transform.controller.getNumTargets() for i=num to 1 by -1 do ( frameNo = o.transform.controller.getFrameNo i if frameNo > currentTime then o.transform.controller.DeleteTarget i ) )

j-man knows my paranoid taste of optimization... i can't just ignore the it:
Code:
for node in selection where iskindof (c = node.track) Link_Constraint do for i = c.getnumtargets() to 1 by -1 where (c.getframeno i ) > currenttime do c.deletetarget i
 
Old 07-21-2011, 03:15 AM   #6
SnipeyX
Animator
 
SnipeyX's Avatar
James Clarke
Senior Applications Specialist
Kansas City, USA
 
Join Date: Mar 2003
Posts: 792
Wow, that's pretty awesome. Still working my way up that coding knowledge hill where I can think of it like that. This helps a lot, appreciate it.
__________________
| Twitter | LinkedIn | JCanimator.com |
 
Old 07-21-2011, 03:15 AM   #7
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,480
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 06:47 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.