public static void updateManipulators(RotateManipContext ctx) { if (ctx == null) return; ctx.deleteManipulators(); // Add the rotate manipulator to each selected object. This produces // behavior different from the default rotate manipulator behavior. Here, // a distinct rotate manipulator is attached to every object. // try { MSelectionList list = MGlobal.activeSelectionList; MItSelectionList iter = new MItSelectionList(list, MFn.Type.kInvalid); for (; !iter.isDone; iter.next()) { // Make sure the selection list item is a depend node and has the // required plugs before manipulating it. // MObject dependNode = new MObject(); iter.getDependNode(dependNode); if (dependNode.isNull || !dependNode.hasFn(MFn.Type.kDependencyNode)) { MGlobal.displayWarning("Object in selection list is not a depend node."); continue; } MFnDependencyNode dependNodeFn = new MFnDependencyNode(dependNode); try { /* MPlug rPlug = */ dependNodeFn.findPlug("rotate"); } catch (System.Exception) { MGlobal.displayWarning("Object cannot be manipulated: " + dependNodeFn.name); continue; } // Add manipulator to the selected object // MObject manipObject = new MObject(); exampleRotateManip manipulator; try { manipulator = exampleRotateManip.newManipulator("exampleRotateManipCSharp", manipObject) as exampleRotateManip; // Add the manipulator // ctx.addManipulator(manipObject); // Connect the manipulator to the object in the selection list. // try { manipulator.connectToDependNode(dependNode); } catch (System.Exception) { MGlobal.displayWarning("Error connecting manipulator to object: " + dependNodeFn.name); } } catch (System.Exception) { } } } catch (System.Exception) { } }
public updateManipulatorBridge(RotateManipContext data) { Data = new WeakReference(data); }
// Callback issued when selection list changes public void updateManipulators(object sender, MBasicFunctionArgs args) { RotateManipContext ctxPtr = Data.Target as RotateManipContext; RotateManipContext.updateManipulators(ctxPtr); }
public static void updateManipulators(RotateManipContext ctx) { if (ctx == null) { return; } ctx.deleteManipulators(); // Add the rotate manipulator to each selected object. This produces // behavior different from the default rotate manipulator behavior. Here, // a distinct rotate manipulator is attached to every object. // try { MSelectionList list = MGlobal.activeSelectionList; MItSelectionList iter = new MItSelectionList(list, MFn.Type.kInvalid); for (; !iter.isDone; iter.next()) { // Make sure the selection list item is a depend node and has the // required plugs before manipulating it. // MObject dependNode = new MObject(); iter.getDependNode(dependNode); if (dependNode.isNull || !dependNode.hasFn(MFn.Type.kDependencyNode)) { MGlobal.displayWarning("Object in selection list is not a depend node."); continue; } MFnDependencyNode dependNodeFn = new MFnDependencyNode(dependNode); try { /* MPlug rPlug = */ dependNodeFn.findPlug("rotate"); } catch (System.Exception) { MGlobal.displayWarning("Object cannot be manipulated: " + dependNodeFn.name); continue; } // Add manipulator to the selected object // MObject manipObject = new MObject(); exampleRotateManip manipulator; try { manipulator = exampleRotateManip.newManipulator("exampleRotateManipCSharp", manipObject) as exampleRotateManip; // Add the manipulator // ctx.addManipulator(manipObject); // Connect the manipulator to the object in the selection list. // try { manipulator.connectToDependNode(dependNode); } catch (System.Exception) { MGlobal.displayWarning("Error connecting manipulator to object: " + dependNodeFn.name); } } catch (System.Exception) { } } } catch (System.Exception) { } }
public updateManipulatorBridge(RotateManipContext data) { Data = new WeakReference(data); }