Smart version of Op.operator function. It accepts python values, simple structures and Data objects as values for the Op parameters. It also accepts a single IECore.CompoundObject parameter that is forwarded to the operate method as the values for all the Op parameters.
( self, *cargs, **args )
| 39 | """ |
| 40 | |
| 41 | def __opSmartOperator( self, *cargs, **args ): |
| 42 | """ |
| 43 | Smart version of Op.operator function. It accepts python values, simple structures and Data objects |
| 44 | as values for the Op parameters. It also accepts a single IECore.CompoundObject parameter that is |
| 45 | forwarded to the operate method as the values for all the Op parameters. |
| 46 | """ |
| 47 | |
| 48 | if len(cargs) == 1 and not args and isinstance( cargs[0], IECore.CompoundObject ) : |
| 49 | return self.operate( cargs[0] ) |
| 50 | |
| 51 | if len(cargs) : |
| 52 | raise Exception( "Attempt to call an Op with invalid parameter values!" ) |
| 53 | |
| 54 | for (paramName, paramValue) in args.items(): |
| 55 | if isinstance(paramValue, IECore.Object): |
| 56 | self[ paramName ].setValue( paramValue ) |
| 57 | else: |
| 58 | self[ paramName ].setTypedValue( paramValue ) |
| 59 | |
| 60 | return self.operate( ) |
| 61 | |
| 62 | # redefine Op |
| 63 | IECore.Op.__call__ = __opSmartOperator |