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 LLToolIndividual* gToolIndividual = NULL;
00053 
00057 
00058 
00062 
00063 // Default constructor
00064 LLToolIndividual::LLToolIndividual()
00065         : LLTool("Individual")
00066 {
00067 }
00068 
00069 // Destroys the object
00070 LLToolIndividual::~LLToolIndividual()
00071 {
00072 }
00073 
00074 BOOL LLToolIndividual::handleMouseDown(S32 x, S32 y, MASK mask)
00075 {
00076         gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback);
00077         return TRUE;
00078 }
00079 
00080 void LLToolIndividual::pickCallback(S32 x, S32 y, MASK mask)
00081 {
00082         LLViewerObject* obj = gViewerWindow->lastObjectHit();
00083         gSelectMgr->deselectAll();
00084         if(obj)
00085         {
00086                 gSelectMgr->selectObjectOnly(obj);
00087         }
00088 }
00089 
00090 BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask)
00091 {
00092         if(!gSelectMgr->getSelection()->isEmpty())
00093         {
00094                 // You should already have an object selected from the mousedown.
00095                 // If so, show its inventory. 
00096                 //gBuildView->showInventoryPanel();
00097                 //gBuildView->showPanel(LLBuildView::PANEL_CONTENTS);
00098                 gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS);
00099                 return TRUE;
00100         }
00101         else
00102         {
00103                 // Nothing selected means the first mouse click was probably
00104                 // bad, so try again.
00105                 return FALSE;
00106         }
00107 }
00108 
00109 void LLToolIndividual::handleSelect()
00110 {
00111         const BOOL children_ok = TRUE;
00112         LLViewerObject* obj = gSelectMgr->getSelection()->getFirstRootObject(children_ok);
00113         gSelectMgr->deselectAll();
00114         if(obj)
00115         {
00116                 gSelectMgr->selectObjectOnly(obj);
00117         }
00118 }
00119 

Generated on Thu Jul 1 06:09:21 2010 for Second Life Viewer by  doxygen 1.4.7