Say you pass in the name of a ramp node (from the GUI) to your command/plug-in.
How do you create an MRampAttribute from this? I want to read the ramp node in OpenMaya.
This breaks and gives me a kFailure. Unexpected Internal Failure. -error:
import maya.OpenMaya as om
import pymel.core as pm
# Just a dummy test
my_ramp = pm.createNode("ramp") # Node created with MEL, Maya.cmds or PyMEL.
node_selection_list = om.MSelectionList()
node_selection_list.add("ramp1") # Name of dummy ramp node
node_obj = om.MObject()
node_selection_list.getDependNode(0, node_obj)
ramp_attribute = om.MObject()
om.MRampAttribute(node_obj, ramp_attribute) # FAILS - kFailure. Unexpected Internal Failure.