manipulators/manip_customselection/ormanip_customselection_manip.cxx

manipulators/manip_customselection/ormanip_customselection_manip.cxx
/***************************************************************************************
Autodesk(R) Open Reality(R) Samples
(C) 2008 Autodesk, Inc. and/or its licensors
All rights reserved.
AUTODESK SOFTWARE LICENSE AGREEMENT
Autodesk, Inc. licenses this Software to you only upon the condition that
you accept all of the terms contained in the Software License Agreement ("Agreement")
that is embedded in or that is delivered with this Software. By selecting
the "I ACCEPT" button at the end of the Agreement or by copying, installing,
uploading, accessing or using all or any portion of the Software you agree
to enter into the Agreement. A contract is then formed between Autodesk and
either you personally, if you acquire the Software for yourself, or the company
or other legal entity for which you are acquiring the software.
AUTODESK, INC., MAKES NO WARRANTY, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE REGARDING THESE MATERIALS, AND MAKES SUCH MATERIALS AVAILABLE SOLELY ON AN
"AS-IS" BASIS.
IN NO EVENT SHALL AUTODESK, INC., BE LIABLE TO ANYONE FOR SPECIAL, COLLATERAL,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH OR ARISING OUT OF PURCHASE
OR USE OF THESE MATERIALS. THE SOLE AND EXCLUSIVE LIABILITY TO AUTODESK, INC.,
REGARDLESS OF THE FORM OF ACTION, SHALL NOT EXCEED THE PURCHASE PRICE OF THE
MATERIALS DESCRIBED HEREIN.
Autodesk, Inc., reserves the right to revise and improve its products as it sees fit.
Autodesk and Open Reality are registered trademarks or trademarks of Autodesk, Inc.,
in the U.S.A. and/or other countries. All other brand names, product names, or
trademarks belong to their respective holders.
GOVERNMENT USE
Use, duplication, or disclosure by the U.S. Government is subject to restrictions as
set forth in FAR 12.212 (Commercial Computer Software-Restricted Rights) and
DFAR 227.7202 (Rights in Technical Data and Computer Software), as applicable.
Manufacturer is Autodesk, Inc., 10 Duke Street, Montreal, Quebec, Canada, H3C 2L7.
***************************************************************************************/
//--- Class declarations
#include "ormanip_customselection_manip.h"
//--- Registration defines
#define ORMANIP_CUSTOMSELECTION__CLASS ORMANIP_CUSTOMSELECTION__CLASSNAME
#define ORMANIP_CUSTOMSELECTION__LABEL "OR - Custom selection manipulator"
#define ORMANIP_CUSTOMSELECTION__DESC "OR - Custom selection manipulator that select root models only."
//--- FiLMBOX implementation and registration
FBManipulatorImplementation ( ORMANIP_CUSTOMSELECTION__CLASS );
FBRegisterManipulator ( ORMANIP_CUSTOMSELECTION__CLASS,
ORMANIP_CUSTOMSELECTION__LABEL,
ORMANIP_CUSTOMSELECTION__DESC,
FB_DEFAULT_SDK_ICON ); // Icon filename (default=Open Reality icon)
/************************************************
* FiLMBOX Constructor.
************************************************/
bool ORManip_CustomSelection::FBCreate()
{
if( FBManipulator::FBCreate() )
{
// Properties
DefaultBehavior = false;
ViewerText = "Custom selection manipulator";
return true;
}
return false;
}
/************************************************
* FiLMBOX Destructor.
************************************************/
void ORManip_CustomSelection::FBDestroy()
{
FBManipulator::FBDestroy();
}
/************************************************
* Draw function for manipulator
************************************************/
void ORManip_CustomSelection::ViewExpose()
{
}
/************************************************
* Deal with maniplator input.
************************************************/
bool ORManip_CustomSelection::ViewInput(int pMouseX, int pMouseY, FBInputType pAction, int pButtonKey, int pModifier)
{
static bool lPressed = false;
switch( pAction )
{
{
// When a keyboard key is pressed.
}
break;
{
// When a keyboard key is released.
}
break;
{
// Mouse button double-clicked.
if(!lPressed){
FBModelList lModels;
for(int i = 0; i < lModels.GetCount(); i++)
{
lModels[i]->Selected = false;
}
PickRectStart(FBPickObjects);
}else{
PickRectStop();
for(int i = 0; i < PickGetCount(); i++)
{
if(PickGetModel(i)->Parent == NULL)
PickGetModel(i)->Selected = true;
}
}
lPressed = !lPressed;
}
break;
{
// Mouse button clicked.
}
break;
{
// Mouse button released.
}
break;
{
// When there is mouse movement in the viewer window
if(lPressed)
PickRectMotion();
}
break;
{
// Items are being dragged.
}
break;
{
// Items are being dropped.
}
break;
}
return true;
}