View Full Version : Forcing SetAttr?

05-03-2007, 09:54 PM
I'm looking to load a map into it's appropriate attribute. I thought I had the right bit of code to do so, but apprently there seems to be perhaps more to it. I am unsure why, because I've gone into the code provided with Maya and I appear to be using the exact same technique but I am always getting an error such as this example:

// Error: line 4: The attribute 'head_patch_beardish_FurFeedbackShape.BaldnessMap' is locked or connected and cannot be modified. //

The lline of code I am using is setup like this:

setAttr -type "string" $plugAttr $mapFilePath;

In the beginning I had wondered if this was what was needed for what I needed, so went into the code like I said as well as testing possible other solutions. Now I'm just stumped, :?: . Is there a way to force the connection or am I thinking about it all wrong?

If anyone has any suggestions or possible solutions they'd definitely be appreciated. Thanks.

05-16-2007, 11:45 AM
the hint is in the returned result of your failed operation

...is locked or connected and cannot be modified.

to unlock you could try:

if( `getAttr -q -lock ( $mapFilePath + "." + $plugAttr ) ` == 1 )
setAttr -e -lock 0 ( $mapFilePath + "." + $plugAttr ) ;

with the connections you should clarify the situation by checking the hypergraph first to see what's involved.
if you want an automated procedure that is able to deal with these things, you should look into the manuals of these commands:

listConnections ;
isConnected ;
connectionInfo ;
and if necessary
disconnectAttr ;


CGTalk Moderation
05-16-2007, 11:45 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.