in your compute myClass is a (uninstanced) class not a string.
anyway, the easiest way is just check the plug like:
if pPlug == myClass.output_t_qqq:
    do stuff
elif pPlug == myClass.output_t_rrr:
    do other stuff
...


On 25 November 2013 11:26, <[email protected]> wrote:

> Hello everyone,
>
> I have a plugin that defines several output plugs:
>
> output_t_qqq = OpenMaya.MObject()
> output_t_rrr = OpenMaya.MObject()
> output_t_sss = OpenMaya.MObject()
> output_t_ttt = OpenMaya.MObject()
>
> These output plugs get added correctly as an attributes to the class, in
> the nodeInitializer function:
>
> myClass.output_t_qqq = numericAttributeFn.createPoint(
> 'qqq_translate_out', 'qqq_t_out' )
> numericAttributeFn.setWritable( False )
> numericAttributeFn.setStorable( False )
> numericAttributeFn.setHidden( True )
> numericAttributeFn.setReadable(True)
> myClass.addAttribute( myClass.output_t_qqq )
>
> etc...
>
> Here's my question: I want to optimize my compute function by executing a
> particular block if the plug name is .._qqq, or .._rrr, etc.  I thought I
> could do this :
>
> def compute(self, pPlug, pDataBlock):
>     params = ['qqq', 'rrr', 'sss', 'ttt']
>     for param in params:
>         if (pPlug == myClass + '.output_t_' + param):
>             # do math for the _qqq output attr.
>
> However Maya complains, at the if statement:
>
> "unsupported operand type(s) for +: 'type' and 'str'"
>
>
> So.... performing string concatenation in an expression, inside compute()
> is illegal in some way.  What's the legal way of doing this?
>
> Mitch
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/e05523fd-ab1f-4832-ad0f-f11ce5e1c010%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CANg-o7nAr4AQ1AX0AdJ2NH4RLWx%2Bga-F91tLxvRk8r8hYbYs4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to