Hi everyone,

I apologize in advance for not having a clear subject for this topic, but 
in this case I believe the two things are strictly related...

I'm having a huge problem adding new targets on a blendShape node.
Every time I try to add a new target to one of my blendShape nodes, it 
fails and gives me this error:

# Error: line 1: Specified blendShape not found in history of baseShape. #


After researching for a few days, I've found out that the problem actually 
happens only when using a parallelBlender.
It seems as if Maya is not able to find a relationship between the base 
mesh and the blendShape nodes beyond the parallelBlender.

<https://lh3.googleusercontent.com/-NPWYfB4Io14/V_-o_xP6IyI/AAAAAAAABeo/M4WWOIvKatU3G1rfbKvuoBCGztQcnI6kwCLcB/s1600/parallel_graph.PNG>






So I jumped into the GroupId/GroupParts/Set jungle and I checked all the 
connections, but they were right.
I tried using maya.cmds, maya api's' (MFnBlendShape.addTarget()), pymel, 
but none seem to work.

So I decided to take a more 'hacky' approach and wrote a function that 
temporarily connect the node I want directly to the 'baseShape', add the 
target (it works!!) and then restore the original connections.
I'm happy with the result, but I wanted this function to be fired off only 
when the normal blendShape.addTarget() doesn't work.
The easiest way of doing this is to 
try:
    bs_node.addTarget('baseShape', 1, 'targetShape', 1)
except:
    my_*add_target(bs_node, attr_name)*

Problem is: it doesn't work. When I run this code I still get the same 
error in the script editor. The error is not recognized as such by Python, 
thus not caught by the 'except'. Moreover, the execution of the script 
keeps going: if you add a print statement after the addTarget, it will be 
printed in the log!
Apparently there's a MEL 'catch' and 'catchQuiet' command supposed to catch 
Maya errors, but is not available for Python (and not embedded into the 
maya.mel module).
Has anyone had a similar situation? It's so frustrating when things just 
don't work the way they should after you tried everything...

So, summing up:
- i believe the two topics are strictly related, cause if I try to catch a 
normal cmds.error, it is caught regularly
- is there a non hacky solution that you know of, to solve the addTarget 
problem?
- what is the proper way to catch an internal Maya Error (which is not a 
Python Exception)?

Any help is greatly appreciated!
Thanks,

Enrico

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/3364bb84-88ba-48e0-88e9-2e9384853311%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to