Hello fellow Maya heads,

I've recently started to dive into Maya standalone land and was so 
adventurous to work with the unsupported render setup API. (
http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=GUID-FFC3298A-9803-4EAF-B472-D13247319EB0
)

Can anyone point me to an working example how to connect a material 
override to a shadingEngine?
Right now, my code looks like this(method of a class creating a render 
setup):
@staticmethod
def create_material_override(collection, shading_group, name):
    """
        Creates a material override for the provided collection and
        assigns it to the provided shadingEngine.
    """
    # Create material override
    __ovr = collection.createOverride(name, typeIDs.materialOverride)

    # Connect shadingEngine to override
    try:
        # Maya 2017 Update 4
        __ovr.setOverrideConnection(shading_group.name() + '.message', 
applyIt=True)
    except Exception as e:
        # Pre Maya 2017 Update 4
        # 2017 Update 3 also has a setMaterial method
        LOGGER.debug(e)
        __ovr.setSource(shading_group.name() + '.message')

    return __ovr

This is working in Maya 2017 Update 4 but throws all kind of "Python 
Callback failed" errors on Maya 2016.5 (Extension 2 SP2).

Is there a better way to connect the override? I -think- I can not simply 
connect it via cmds or OpenMaya API2 since the render setup objects are 
only available thru the render setup API.

Cheers, Stefan

-- 
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/6e5e0ac9-c037-4c80-bd91-d13cb5140a9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to