コード例 #1
0
ファイル: marqueeTool.cs プロジェクト: venerin/Maya-devkit
        public override void doRelease(MEvent eventArg)
        {
            // Selects objects within the marquee box.
            if (fsDrawn)
            {
                view.beginXorDrawing();
                // Redraw the marquee at its old position to erase it.
                drawMarquee();
                view.endXorDrawing();
            }
            // Get the end position of the marquee
            eventArg.getPosition(ref last_x, ref last_y);

            // Save the state of the current selections.  The "selectFromSceen"
            // below will alter the active list, and we have to be able to put
            // it back.
            MSelectionList incomingList = MGlobal.activeSelectionList;

            // If we have a zero dimension box, just do a point pick
            if (Math.Abs(start_x - last_x) < 2 && Math.Abs(start_y - last_y) < 2)
            {
                // This will check to see if the active view is in wireframe or not.
                MGlobal.SelectionMethod selectionMethod = MGlobal.selectionMethod;
                MGlobal.selectFromScreen(start_x, start_y, MGlobal.ListAdjustment.kReplaceList, selectionMethod);
            }
            else
            {
                // The Maya select tool goes to wireframe select when doing a marquee, so
                // we will copy that behaviour.
                // Select all the objects or components within the marquee.
                MGlobal.selectFromScreen(start_x, start_y, last_x, last_y,
                                         MGlobal.ListAdjustment.kReplaceList,
                                         MGlobal.SelectionMethod.kWireframeSelectMethod);
            }

            // Get the list of selected items
            MSelectionList marqueeList = MGlobal.activeSelectionList;

            // Restore the active selection list to what it was before
            // the "selectFromScreen"
            MGlobal.activeSelectionList = incomingList;              // MGlobal.ListAdjustment.kReplaceList

            // Update the selection list as indicated by the modifier keys.
            MGlobal.selectCommand(marqueeList, listAdjustment);
        }