0

When iterating over nodes in a Maya scene (multiple geometries on multiple assets), I am setting blendShape targets as follows:

pm.blendShape(blendshape, edit=True, target=(mesh, target_index, corrective, 1.0))

Sometimes it works, at other times I get the following error:

Object will not allow alias 'corrective_name' to be set. Possibly because an attribute of that name already exists.

...where corrective_name is the name of the nt.Transform corrective. I cannot find an attribute with that name on the blendshape node, so that can't be the reason. Forcing the value of corrective to random nonsense (in an attempt to guarantee that there isn't a clash), leads to the same error.

What are other causes of this failure?


Note: A visible side-effect (or cause?) is that on blendShapes where the call is working, I can see weights with names matching the corrective names. On blendShapes where the call fails, the weights are called weight[0], weight[1], weight[2] and so on.

Note 2: It seems like (some) attribute aliases fail after the .ma file is saved and then loaded for the first time. The weight attributes on certain objects appear as weight[0] instead of actualName after loading. The same object fails consistently (aliases for attributes on that object always fail, aliases on other objects never fail). This means that the pm.blendShape succeeds on that object in the first session, but fails every time after the scene is loaded. Newly created attributes are then called weight[X] too. (Example of alias failure in a completely different context.)

This doesn't happen if an asset (which contains multiple objects) is imported into the scene, only if it is referenced.

Asset alias working (on first creation, and when asset imported):

working when asset imported

Asset alias failing (when asset referenced and saved scene is loaded for the first time):

fails when asset referenced and scene loaded

lofidevops
  • 15,528
  • 14
  • 79
  • 119
  • is `corrective` a shape name with a namespace, by any chance? – theodox Feb 25 '16 at 17:31
  • @theodox It turns out corrective is a Transform not a string (I've fixed this in the question). `str(corrective)` does not have a namespace. It returns *some_value* not *NAMESPACE:some_value* – lofidevops Feb 26 '16 at 12:27
  • my colleague found this link which describes a similar error (attribute aliases going AWOL) on a different node type (shaders): http://arnoldsupport.com/2015/02/18/the-case-of-the-cannot-remove-alias-runtimeerror/ – lofidevops Feb 26 '16 at 13:53
  • @theodox the link above led to a possible cause of the underlying problem, but I'm a software developer not a technical artist: does this sound like a maya problem, bad save flags, or creating the blendshape incorrectly in the first place (i.e. the first time `pm.blendShape` is called)? – lofidevops Feb 26 '16 at 14:28
  • Most maya nodes that involve weight lists create named aliases to make the hookups more user friendly. the `.weights[n]` is the 'real' thing, the aliases are basically just UI on top of that. You should be able to manipulate the weight values (animating or setting them by hand) but you'll have to test them to see what shapes they match. You can probably recreate them with `cmds.aliasAttr` – theodox Feb 26 '16 at 18:15
  • @theodox It looks like the weight aliases are lost after a save/load, despite appearing in the .ma, and once they're lost, new blendShape aliases fail. But only for referenced assets, not imported. The tricky thing is creating an SSCCE! But thanks for all your input. – lofidevops Mar 02 '16 at 07:36

0 Answers0