Ejemplo n.º 1
0
        /*!
         * Callback that creates the manipulator if valid geometry is
         * selected. Also removes the manipulator if no geometry is
         * selected. Handles connecting the manipulator to multiply
         * selected nodes.
         *
         * \param[in] data Pointer to the current context class.
         */
        void updateManipulators()
        {
            deleteManipulators();

            if (!validGeometrySelected())
            {
                return;
            }

            // Clear info
            owner = null;
            firstObjectSelected = MObject.kNullObj;

            MSelectionList list = new MSelectionList();

            MGlobal.getActiveSelectionList(list);
            MItSelectionList iter = new MItSelectionList(list, MFn.Type.kInvalid);

            string             manipName   = "lineManipContainerCSharp";
            MObject            manipObject = new MObject();
            lineManipContainer manipulator = MPxManipContainer.newManipulator(manipName, manipObject) as lineManipContainer;

            if (null != manipulator)
            {
                // Save state
                owner = manipulator;
                // Add the manipulator
                addManipulator(manipObject);
                //
                for (; !iter.isDone; iter.next())
                {
                    MObject dependNode = new MObject();
                    iter.getDependNode(dependNode);
                    MFnDependencyNode dependNodeFn = new MFnDependencyNode(dependNode);
                    // Connect the manipulator to the object in the selection list.
                    manipulator.connectToDependNode(dependNode);
                    //
                    if (MObject.kNullObj == firstObjectSelected)
                    {
                        firstObjectSelected = dependNode;
                    }
                }

                // Allow the manipulator to set initial state
                setInitialState();
            }
        }
Ejemplo n.º 2
0
 new public static void initialize()
 {
     MPxManipContainer.initialize();
 }