lltoolindividual.cpp

Go to the documentation of this file.
00001 
00032 //*****************************************************************************
00033 //
00034 // This is a tool for selecting individual object from the
00035 // toolbox. Handy for when you want to deal with child object
00036 // inventory...
00037 //
00038 //*****************************************************************************
00039 
00040 #include "llviewerprecompiledheaders.h"
00041 #include "lltoolindividual.h"
00042 
00043 #include "llselectmgr.h"
00044 #include "llviewerobject.h"
00045 #include "llviewerwindow.h"
00046 #include "llfloatertools.h"
00047 
00051 
00052 
00056 
00057 
00061 
00062 // Default constructor
00063 LLToolIndividual::LLToolIndividual()
00064         : LLTool("Individual")
00065 {
00066 }
00067 
00068 // Destroys the object
00069 LLToolIndividual::~LLToolIndividual()
00070 {
00071 }
00072 
00073 BOOL LLToolIndividual::handleMouseDown(S32 x, S32 y, MASK mask)
00074 {
00075         gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback);
00076         return TRUE;
00077 }
00078 
00079 void LLToolIndividual::pickCallback(S32 x, S32 y, MASK mask)
00080 {
00081         LLViewerObject* obj = gViewerWindow->lastObjectHit();
00082         LLSelectMgr::getInstance()->deselectAll();
00083         if(obj)
00084         {
00085                 LLSelectMgr::getInstance()->selectObjectOnly(obj);
00086         }
00087 }
00088 
00089 BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask)
00090 {
00091         if(!LLSelectMgr::getInstance()->getSelection()->isEmpty())
00092         {
00093                 // You should already have an object selected from the mousedown.
00094                 // If so, show its inventory. 
00095                 //gBuildView->showInventoryPanel();
00096                 //gBuildView->showPanel(LLBuildView::PANEL_CONTENTS);
00097                 gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS);
00098                 return TRUE;
00099         }
00100         else
00101         {
00102                 // Nothing selected means the first mouse click was probably
00103                 // bad, so try again.
00104                 return FALSE;
00105         }
00106 }
00107 
00108 void LLToolIndividual::handleSelect()
00109 {
00110         const BOOL children_ok = TRUE;
00111         LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok);
00112         LLSelectMgr::getInstance()->deselectAll();
00113         if(obj)
00114         {
00115                 LLSelectMgr::getInstance()->selectObjectOnly(obj);
00116         }
00117 }
00118 

Generated on Fri May 16 08:34:07 2008 for SecondLife by  doxygen 1.5.5