PDA

View Full Version : Adding constrain after animation


goosh
01-29-2003, 10:24 PM
Hi.

I tried to add a point constraint to an object that has animation on it and it doesn't let me!!!

Can this be done?

it seems weird that it doesn't..

I want to be able to add the constrain (say a locator) so that I can still turn it off and have the old animation.. or turn it on and use the translator to animate with.

I can of course do this before I start animating, but sometimes you can't plan this kind of things ahead... any ideas if it can be done?

(and yes... I thought of a script where I would copy the animation to a dummy object, add the constrain and then copy the animation back.. but I was surprised that you just couldn't do it directly)

ideas?

Goosh

dmcgrath
01-30-2003, 02:56 AM
There are some workarounds for your problem, Goosh. But you have to be very creative sometimes when you want them to work. But if the object is moving around, you won't be able to constrain it the way you are thinking. Some times you can add it to an empty group and move the pivot of the group to the new constraint location, then add the constraint. Then it would be a matter of turning off one constraint and turning on the other on a frame to frame basis.

What, specifically, are you trying to add a constraint to? Maybe I can come up with an idea for you.

wrend
01-30-2003, 04:30 AM
hey goosh, one method -
stick your anim crvs into a blend node, break their conxn w the transform, apply your constraint, break its conxns to tranform, piping constraintXYZ into second colour, and its blend.output into your translate. now you can blend/weight between constraint and your animatn!

braam
01-30-2003, 08:53 AM
Wrend's technique seems to be very fresh for me! Could you please setup the scene and email me. Just check it as example. If it is too large, try zip it.

You are very creative dude! Keep so on!

Cheers
Braam

:bounce:

Rudity
01-30-2003, 12:18 PM
Originally posted by wrend
hey goosh, one method -
stick your anim crvs into a blend node, break their conxn w the transform, apply your constraint, break its conxns to tranform, piping constraintXYZ into second colour, and its blend.output into your translate. now you can blend/weight between constraint and your animatn!



I too would like to see an example of this if its possible.

Cheers:beer:

Rudity

olivier georges
01-30-2003, 12:54 PM
hi,
yes you can for example use the blendColor node utility, you`ll find it in the create render node menu in the hypergraph, plug your first set of three curves in the color1 r, g and b then plug the second set of curves in the color2 r, g and b, then you can use the output color and plug it on your translate curve.
i have done a little example with two locator and a cube but i don`t know how to upload it, ask and i`ll send you the file on your email.



Olivier. :)

wrend
01-30-2003, 02:05 PM
box and locators for those interested ...
just need to follow instructions that've been posted. only problem i can imagine is the order by which you make and brake the conxns.

have fun!

hmm, cant attach like use to .. really does mean only valid files are images.

well, construct for yourself, or Olivier's kind offer!

goosh
01-30-2003, 06:05 PM
Ok.. quick question then..

I select the box, go into upand down stream connections.. create a blendColors node.. delete the animation and connect it to the blend node.. all is great so far..

Now.. I go out of the up and downstream connections.. do the pointConstraint..

still everything is good

But now when I go back to the up and downstream connections for the cube I don't have the blendColors node anymore (of course, since it's not connected anymore) so how do I get it in the screen? I can't seem to find it anymore anywhere.. :(

Goosh

olivier georges
01-30-2003, 06:28 PM
hi goosh, uncheck DAG objects only in your outliner, then, you'll see all the node in your scene. :)

Olivier.

AWAKE
01-30-2003, 06:41 PM
doing this means you can't animate anymore.

goosh
01-30-2003, 08:49 PM
Cool... I got it to work with a blendColors node

BUT :) (there is always a but)

I loose all control over my box now.. sure.. I can still use the old animation or have it constrain to the locator (with the blends) but if I want to carry on animating the box I can't.

Ok.. here is the cenario..

I animate a box (let's just say I'm translating things) from fram 0 to 20.. now I realize that I need a constrain.. too late.. so I go through the blendColors node and get around it... I can now either have blends at 0 and I have my animation from 0 to 20 or blends at 1 and I animate the locator.
Ok.. so I animate the locator from frame 20 to 50 and now I realize that I want to turn it off and carry on animating my box...

I thought turning the constrain off or blends off would let me.. but I can't :(


ooh.. wait.. I get it.. I would have to change the Color1RGB colors since that's what I'm using now to translate my box... damn.. that makes it tough... I wish I could grab the box and move it around and still word fine.. :)

Anyway.. I was thinking about this 'cause soft can do it without a problem.. (and no.. I don't want to strart a war.. I actually don't like soft at all... I'm a maya guy) but there are sometimes tools in some packages that come standard and seems to easy since they are already integrated into the system.. :)

Thanks for the help everybody

Goosh

mark_wilkins
01-30-2003, 09:15 PM
Suppose you have a sphere with some animation on it and you want to point constrain it to something else, translating the animation you already have:


1) Group the sphere, which parents it to a new transform node, retaining its animation.

2) Point-constrain the transform node.

3) If you want to kill the constraint, set the constraint weight to 0 in the attribute editor. I think this attribute gets added to the transform when you constrain it.

-- Mark

dmcgrath
01-30-2003, 11:41 PM
Yeah Mark, that's almost exactly like I proposed earlier. It seems easier to do it that way "on the fly".

Goosh, I still think you can do what you want to do easier. The way that wrend and oliver have mentioned sounds great. But why dont you just add a keyable attribute (on the Box) and connect it to the color rgb's via Set Driven Keys? Then you don't have to ever worry about looking for the blend node again. Try it and I think you'll be very happy with something like that.

mark_wilkins
01-31-2003, 12:02 AM
oops, I apologize, I read quickly and didn't really see that you were suggesting about the same thing. :)

-- Mark

dmcgrath
01-31-2003, 12:04 AM
Oh no problem, man. It's worth repeating in my opinion. :thumbsup:

goosh
01-31-2003, 04:53 AM
Hi guys..

Thanks a lot for all the help..

Mark: Yeah.. of course that would be easy.. and in the simple example I put in with a box and a locator it would work.. but the set up where I need to do it is a lot more complicated and I can't just do it that way :(

BTW great book! :)

dmc.. good idea about creating a new attribute and linking it.. simple..

All in all if anything I've learnt tons on this little experiment..

Thanks for shearing everybody

Goosh

mark_wilkins
01-31-2003, 06:16 AM
I'll bet you could make some variation on that trick work, with enough effort. :) However, depending on what you're doing it may not be the best solution.

-- Mark

wrend
01-31-2003, 06:44 AM
constraing a transform stacked ontop of your animated transform will only make for an offset on your animated tansform around the constrain locatn?

to animate again as usual, just pipe your crvs back, takes minimal effort, and a task that wouldnt be repetitious. piping thru some new attribs as dcmgrath suggested could be another approach, but youd then have an additional layer of crvs to tweak, and its channel animatn rather than by widget. in anycase, i will script construction of this simple network, and an attrib to enable flipping the blend ctrl on and off (so you can do normal anim).

dandy. :)

wrend
02-01-2003, 06:38 AM
not sure if ppl are still interested, but i scripted this setup, w a toggle, along w a sample scene, and finally arranged some web space to post material.

so, the script:
animConstrntBlender.mel (http://www.users.on.net/neilandbron/animConstrntBlender.mel)
- read the header to get the idea

and a scene 4.5:
example_constraintAnimBlend.mb (http://www.users.on.net/neilandbron/example_constraintAnimBlend.mb)
- not very exciting, but I added a little colour (cough, splutter) ...its demonstrative, right! :D

-c.

AWAKE
02-01-2003, 07:01 AM
Whoa. It's too easy. I have to try and break it.


Nice. SOOOO nice...




EDIT: hmm... joints and IK get weird

Wait a minute... How what is the proper way to animate it? I'm toggling the blnd state, and animating the blnd. when I turn the blend state off, I cannot animate the object.

wrend
02-01-2003, 08:43 AM
w blndState off, its just like your normal animatn setup, exactly the same.

when it is on you are blending between your normal animatn input and the constrain input ....so to animate from a state of normal animatn to a state of complete 'constrainedness', you animate the coresponding tranformatnalBlnd (eg, animate T Blnd from 1 to 0 to do a gradual blend between your normal translational animatn to a state of fixed, pnt constrainedness), yeah?

the blndState toggle is _not_ intended to be animated, its there to facilitate further editing of your normal animatn (by normal i just mean not constrained), editing by your normal means (in a sense it just reverts you back to where you were before constraints were added). make sense? i shoulda done a better example.


... and to explain the example a little more, all the BS chunks of stuff whirling round ....the Torus is sSDKing the main onject's (the Cube) rotateY, the Cone is a directConxn to translateY, and scaleY has a sine expression on it, the others animated channels are normal fCrvs - these were there to demonstrate that this setup can blend any sorta input w your constraints ... not very clear, just looks like a bit of a jumble i guess. maybe i do another one.


please _do_ try and break it, its fresh and needs some throwin' about! think it should be relative robust tho. let me know what you find. havent played w it in the context of ik yet..., but i cant concieve of how they'd be different!

keep me informed!

AWAKE
02-01-2003, 05:31 PM
Cool I'll give it a shot again. Nice work..

AWAKE
02-02-2003, 03:33 PM
check this.

very simple. I made a cube and a cylinder set up a constraintblender on the cylinder, keyed the weight, changed its value to 1 (original Anim) and then set the toggle to off. That broke it.




CreatePolygonCylinder;
polyCylinder -r 1 -h 2 -sx 20 -sy 1 -sz 1 -ax 0 1 0 -tx 1 -ch 1;
// Result: pCylinder1 polyCylinder1 //
CreatePolygonCube;
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -tx 1 -ch 1;
// Result: pCube1 polyCube1 //
move -r 10.150454 0 0 ;
select -r pCylinder1 ;
select -r pCube1 ;
select -tgl pCylinder1 ;
animConstrntBlender;
setKeyframe "pCylinder1.tBlnd";
// Result: 1 //
currentTime 7 ;
setAttr "pCylinder1.tBlnd" 1;
autoKeyframe;
// Result: 1 //
setAttr "pCylinder1.blndState" 0;
// Error: No object matches name: pCylinder1_tBlnd.c1r //
// Error: An execution error occured in the expression pCylinder1_animConstBlndStater. //
select -cl ;

wrend
02-03-2003, 02:21 AM
stupid! broke its ankle before it even left the front door.

stupidly easy to sort tho.

i guess i really should be using it, not doing much anim tho. you're my beta man, sorry!

ok, hopefully it can make it to the gate -
animConstrntBlender.mel (http://www.users.on.net/neilandbron/animConstrntBlender.mel)

cheers,
keep me posted.

AWAKE
02-03-2003, 04:56 AM
word.

Here goes..

EDIT:

Pretty sweet on primitives.

The object must have keys on it for the connections to be right..
it should give you an error when you try to do it.


on Joints I'm still getting an error. The parent Joint works but the child does not.

// Warning: Removing invalid characters from name. //
// Error: No object matches name: joint8|joint6_animConstBlndStater //
// Error: Unable to parse command argument list. //
// Error: An execution error occured in the expression joint8_joint6_animConstBlndStater. //
// Error: No object matches name: joint8|joint6_animConstBlndStater //
// Error: Unable to parse command argument list. //
// Error: An execution error occured in the expression joint8_joint6_animConstBlndStater. //

wrend
02-03-2003, 08:25 AM
word.

jah, another "i havent used it yet" problem. simple shite tho, its just namespaces ...nothing especially to do w joints, just a generic issue (create a cube, dupe it, parent to first, dupe group and youd have that same problem w the children). gone for simpler naming conventions, just graph nodes if relations arent blatantly evident. only thing that should break it now is renaming the expressions (he sais tentatively ... prove me wrong dude! its been far too easy for ya thus far! sorry)


The object must have keys on it for the connections to be right.it should give you an error when you try to do it.
not sure i understand, give me an example ...
objects neednt have animatn on their channels for the setup to be constructed - you can have all, some, or none of the chans animtd (and w any sorta anim).

cheers, let me know.

AWAKE
02-04-2003, 06:40 AM
okay wrend.. This thing is getting more solid... I'm getting really excited about it.

when I try to set up a constraint with an object with no Keys on the attributes I'm tagging, switching the blndstate connects and then disconnects them making the animation not possible.


That's what I'm talking about.


here... notice the translate channels of the sphere towards the end.



sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;objectMoveCommand;
torus -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -msw 360 -r 1 -hr 0.5 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1; objectMoveCommand;
move -r 9.667367 0 0 ;
select -tgl nurbsSphere1 ;
animConstrntBlender;
setAttr "nurbsSphere1.blndState" 0;
move -r -ls -wd -11.109848 0 0 ;
setKeyframe "nurbsSphere1.tx";
setKeyframe "nurbsSphere1.ty";
setKeyframe "nurbsSphere1.tz";
// Result: 1 //
setAttr "nurbsSphere1.blndState" 1;
setAttr "nurbsSphere1.blndState" 0;

wrend
02-06-2003, 08:40 AM
heya.

right, it probably wasnt clear enuf :

in the script header:

- if you want to fundamentally alter animatn on a channel, its ok to delete, but adding requires you to make a conxn into the respective obj_chanBlender input (one simple conxn, could be automated, but is it worth the overhead?).

.. i never mentioned this inthe posts here, i probably should have.

but you can scrub that now, i'll build this in. make it an all terrain machine.

i've had a pluck at it, and there are few situations to resolve on, i'll get back to it soon, but just now, i want to go out and play w beer!

cheers for now.

CGTalk Moderation
01-14-2006, 07:00 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.