View Full Version : soft constraint (bi-directional) 1.2.0

08-17-2006, 10:48 AM
My latest script:soft constraint (bi-directional) 1.2.0

Download the attachement or follow the link below (highend):
softCon.mel (http://highend3d.com/maya/downloads/mel_scripts/animation/download-4221.html?loc=softCon.mel)



1. Added Parent Soft Constraint.
2. Added Scale Soft Constraint.
3. Fixed bug with translation (maintain offset and direct link "ON")
4.Made indirect link independent of scale.


This script creates a series of dynamic soft constraints (expression nodes) similar to that of XSI between two or more objects. It DOES NOT depend on the timeline or interactive playback, it calculates the softness with the movement of the parent object on realtime basis, using an inner timer function that determines the speed and hence the softness .

It can be applied on both translation and rotation , with or without maintaining the offset .

It has two modes of opperation :

A. Direct link : where the attributes (translation or rotation) are directly manipulated by a connection with the expression node and are "purple" expression driven. In this mode the constrained objects cannot be moved or rotated manually.

B.Indirect link: where a fake link is made with the object so that the expression will always evealuate , but the object remains free from any attribute locking . Both modes work with or without maintaing offset.

Rigidness factor:
this determines the softness of the constraint (0 is the softest) (1 resembles a normal maya constraint)

Each constrained object will have two new atributes :

A. Tsoft_eval (or Rsoft_eval) : is an integer attribute (0 or 1) to determine whether to evaluate the soft constraint . If it turns 0 the object will hold its current position.

B.Tfactor (or Rfactor):is to adjust the Rigidness factor after the creation of the constraint .

a good example to show the effectiveness of the script is to make a snake effect with multiple cubes each soft-t-constrained to the one beside it.

The link is non-circulating on parents; e.g. group1->obj1 , group2->obj2 . if obj1 soft constrain group2 and obj2 soft constrain group1 there will be NO-double transformation and will yield a perfect real time bi-directional soft constrain .

copy the softCon.mel file in the maya/x.0/scripts/ folder and type softCon in the command line and drag it to the shelf to create a button.

select the first object (the affector) shift select the second (the affected) and press the type of constraint you need.

for feedback please email me at wajdyf@gmail.com

08-24-2006, 06:00 PM
I'm having trouble. Two things:

I have a camera that has your softCon on it. It gently glides on a motion path.
BUT on the render farm, it's not updating. so the camera never moves.

So I tried baking the simulation and I got weird results in the curves as you can see below:


every frame is rendered on a different computer so...

I have to "bake" the softCon results.

09-05-2006, 08:46 AM
great tool :)

Robert Bateman
09-05-2006, 12:48 PM
I have a camera that has your softCon on it. It gently glides on a motion path.
BUT on the render farm, it's not updating. so the camera never moves.

yeah, i had a look at the script. Basically the expressions they set up use getAttr (which will not dirty the expression during a render - you always need to refer to things in expressions as node.attr otherwise they can often fail), and they use a number of mel GUI script commands which will not be available when the script is run from the maya in render mode (ie, when none of the gui scripts have actually been run - undoInfo is a good example).

When baking the simulation, anything that uses getAttr will not fire correctly either - that's probably why that has failed.

09-05-2006, 01:02 PM
I created a rigging system that features bi-directional constraints (API).
If you are interested check the link below. I had issues with rendering
and solved them with a "scene open" callback that uses the dgDirty command
to force dg evaluation, maybe that helps you, too.

11-04-2006, 10:37 PM
Hello wajdyf,

This is a really nice tool. I created a simple rig using the script, and found that it has some small bugs, it seems. I wonder if anyone would be interested in taking a look?

Here is the Maya scene: joel3d.com/Movies2006/CgForums/SofCon_TestRig.zip

Here are a couple test renders:
Playblast_Test (http://www.joel3d.com/Movies2006/CgForums/SoftCon_Plalyblast.mov)...Notice there is some popping, or somthing going on. I also went ahead and rendered the scene with similar results.
Render_Test (http://www.joel3d.com/Movies2006/CgForums/SoftCon_Rendertest.mov)...I went ahead and desided to Bake the keys on the joints, and deleted the rig...
Baked_keys_Test (http://www.joel3d.com/Movies2006/CgForums/SoftCon_Baked.mov)...Seems like it almost worked.

Well thanks again wajdy, I would be very interested in seeing more developments.

CGTalk Moderation
11-04-2006, 10: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.