Merge back the ability to select the tree (not just random, from Imprudence).
Conflicts: indra/newview/app_settings/settings.xml indra/newview/llfloatertools.cpp
This commit is contained in:
@@ -14538,5 +14538,27 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
</map>
|
</map>
|
||||||
|
<key>LastGrass</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>The last grass selected in the create dialog</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>String</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<string>Random</string>
|
||||||
|
</map>
|
||||||
|
<key>LastTree</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>The last tree selected in the create dialog</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>String</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<string>Random</string>
|
||||||
|
</map>
|
||||||
</map>
|
</map>
|
||||||
</llsd>
|
</llsd>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "llviewerprecompiledheaders.h"
|
||||||
|
indra/newview/llfloatertools.cpp
|
||||||
|
|
||||||
#include "llfloatertools.h"
|
#include "llfloatertools.h"
|
||||||
|
|
||||||
@@ -87,6 +88,8 @@
|
|||||||
|
|
||||||
#include "qtoolalign.h" //Thank Qarl!
|
#include "qtoolalign.h" //Thank Qarl!
|
||||||
|
|
||||||
|
#include "llvograss.h"
|
||||||
|
#include "llvotree.h"
|
||||||
|
|
||||||
// Globals
|
// Globals
|
||||||
LLFloaterTools *gFloaterTools = NULL;
|
LLFloaterTools *gFloaterTools = NULL;
|
||||||
@@ -295,6 +298,8 @@ BOOL LLFloaterTools::postBuild()
|
|||||||
llwarns << "Tool button not found! DOA Pending." << llendl;
|
llwarns << "Tool button not found! DOA Pending." << llendl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mComboTreesGrass = getChild<LLComboBox>("trees_grass");
|
||||||
|
childSetCommitCallback("trees_grass", onSelectTreesGrass, (void*)0);
|
||||||
mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection");
|
mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection");
|
||||||
childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection"));
|
childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection"));
|
||||||
mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky");
|
mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky");
|
||||||
@@ -392,6 +397,7 @@ LLFloaterTools::LLFloaterTools()
|
|||||||
mBtnDuplicate(NULL),
|
mBtnDuplicate(NULL),
|
||||||
mBtnDuplicateInPlace(NULL),
|
mBtnDuplicateInPlace(NULL),
|
||||||
|
|
||||||
|
mComboTreesGrass(NULL),
|
||||||
mCheckSticky(NULL),
|
mCheckSticky(NULL),
|
||||||
mCheckCopySelection(NULL),
|
mCheckCopySelection(NULL),
|
||||||
mCheckCopyCenters(NULL),
|
mCheckCopyCenters(NULL),
|
||||||
@@ -721,6 +727,8 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
|
|||||||
|
|
||||||
mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() );
|
mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() );
|
||||||
|
|
||||||
|
updateTreeGrassCombo(create_visible);
|
||||||
|
|
||||||
if (mCheckCopySelection
|
if (mCheckCopySelection
|
||||||
&& mCheckCopySelection->get())
|
&& mCheckCopySelection->get())
|
||||||
{
|
{
|
||||||
@@ -1058,3 +1066,77 @@ void LLFloaterTools::onFocusReceived()
|
|||||||
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
|
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
|
||||||
LLFloater::onFocusReceived();
|
LLFloater::onFocusReceived();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void LLFloaterTools::onSelectTreesGrass(LLUICtrl*, void*)
|
||||||
|
{
|
||||||
|
const std::string &selected = gFloaterTools->mComboTreesGrass->getValue();
|
||||||
|
LLPCode pcode = LLToolPlacer::getObjectType();
|
||||||
|
if (pcode == LLToolPlacerPanel::sTree)
|
||||||
|
{
|
||||||
|
gSavedSettings.setString("LastTree", selected);
|
||||||
|
}
|
||||||
|
else if (pcode == LLToolPlacerPanel::sGrass)
|
||||||
|
{
|
||||||
|
gSavedSettings.setString("LastGrass", selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLFloaterTools::updateTreeGrassCombo(bool visible)
|
||||||
|
{
|
||||||
|
LLTextBox* tree_grass_label = getChild<LLTextBox>("tree_grass_label");
|
||||||
|
if (visible)
|
||||||
|
{
|
||||||
|
LLPCode pcode = LLToolPlacer::getObjectType();
|
||||||
|
std::map<std::string, S32>::iterator it, end;
|
||||||
|
std::string selected;
|
||||||
|
if (pcode == LLToolPlacerPanel::sTree)
|
||||||
|
{
|
||||||
|
tree_grass_label->setVisible(visible);
|
||||||
|
LLButton* button = getChild<LLButton>("ToolTree");
|
||||||
|
tree_grass_label->setText(button->getToolTip());
|
||||||
|
|
||||||
|
selected = gSavedSettings.getString("LastTree");
|
||||||
|
it = LLVOTree::sSpeciesNames.begin();
|
||||||
|
end = LLVOTree::sSpeciesNames.end();
|
||||||
|
}
|
||||||
|
else if (pcode == LLToolPlacerPanel::sGrass)
|
||||||
|
{
|
||||||
|
tree_grass_label->setVisible(visible);
|
||||||
|
LLButton* button = getChild<LLButton>("ToolGrass");
|
||||||
|
tree_grass_label->setText(button->getToolTip());
|
||||||
|
|
||||||
|
selected = gSavedSettings.getString("LastGrass");
|
||||||
|
it = LLVOGrass::sSpeciesNames.begin();
|
||||||
|
end = LLVOGrass::sSpeciesNames.end();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mComboTreesGrass->removeall();
|
||||||
|
mComboTreesGrass->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label
|
||||||
|
mComboTreesGrass->setEnabled(false);
|
||||||
|
mComboTreesGrass->setVisible(false);
|
||||||
|
tree_grass_label->setVisible(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mComboTreesGrass->removeall();
|
||||||
|
mComboTreesGrass->add("Random");
|
||||||
|
|
||||||
|
int select = 0, i = 0;
|
||||||
|
|
||||||
|
while (it != end)
|
||||||
|
{
|
||||||
|
const std::string &species = it->first;
|
||||||
|
mComboTreesGrass->add(species); ++i;
|
||||||
|
if (species == selected) select = i;
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
// if saved species not found, default to "Random"
|
||||||
|
mComboTreesGrass->selectNthItem(select);
|
||||||
|
mComboTreesGrass->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
mComboTreesGrass->setVisible(visible);
|
||||||
|
tree_grass_label->setVisible(visible);
|
||||||
|
}
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ public:
|
|||||||
LLButton *mBtnDuplicateInPlace;
|
LLButton *mBtnDuplicateInPlace;
|
||||||
|
|
||||||
// Create buttons
|
// Create buttons
|
||||||
|
LLComboBox *mComboTreesGrass;
|
||||||
LLCheckBoxCtrl *mCheckSticky;
|
LLCheckBoxCtrl *mCheckSticky;
|
||||||
LLCheckBoxCtrl *mCheckCopySelection;
|
LLCheckBoxCtrl *mCheckCopySelection;
|
||||||
LLCheckBoxCtrl *mCheckCopyCenters;
|
LLCheckBoxCtrl *mCheckCopyCenters;
|
||||||
@@ -194,6 +195,9 @@ private:
|
|||||||
BOOL mDirty;
|
BOOL mDirty;
|
||||||
|
|
||||||
std::map<std::string, std::string> mStatusText;
|
std::map<std::string, std::string> mStatusText;
|
||||||
|
|
||||||
|
void updateTreeGrassCombo(bool visible);
|
||||||
|
static void onSelectTreesGrass(LLUICtrl*, void*);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LLFloaterTools *gFloaterTools;
|
extern LLFloaterTools *gFloaterTools;
|
||||||
|
|||||||
@@ -175,7 +175,18 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S32 LLToolPlacer::getTreeGrassSpecies(std::map<std::string, S32> &table, const char *control, S32 max)
|
||||||
|
{
|
||||||
|
const std::string &species = gSavedSettings.getString(control);
|
||||||
|
std::map<std::string, S32>::iterator it;
|
||||||
|
it = table.find(species);
|
||||||
|
if (it != table.end()) {
|
||||||
|
return it->second;
|
||||||
|
} else {
|
||||||
|
// if saved species not found, default to "Random"
|
||||||
|
return (rand() % max);
|
||||||
|
}
|
||||||
|
}
|
||||||
BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
|
BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
|
||||||
{
|
{
|
||||||
LLVector3 ray_start_region;
|
LLVector3 ray_start_region;
|
||||||
@@ -220,13 +231,13 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
|
|||||||
case LL_PCODE_LEGACY_GRASS:
|
case LL_PCODE_LEGACY_GRASS:
|
||||||
// Randomize size of grass patch
|
// Randomize size of grass patch
|
||||||
scale.setVec(10.f + ll_frand(20.f), 10.f + ll_frand(20.f), 1.f + ll_frand(2.f));
|
scale.setVec(10.f + ll_frand(20.f), 10.f + ll_frand(20.f), 1.f + ll_frand(2.f));
|
||||||
state = rand() % LLVOGrass::sMaxGrassSpecies;
|
state = getTreeGrassSpecies(LLVOGrass::sSpeciesNames, "LastGrass", LLVOGrass::sMaxGrassSpecies);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case LL_PCODE_LEGACY_TREE:
|
case LL_PCODE_LEGACY_TREE:
|
||||||
case LL_PCODE_TREE_NEW:
|
case LL_PCODE_TREE_NEW:
|
||||||
state = rand() % LLVOTree::sMaxTreeSpecies;
|
state = getTreeGrassSpecies(LLVOTree::sSpeciesNames, "LastTree", LLVOTree::sMaxTreeSpecies);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LL_PCODE_SPHERE:
|
case LL_PCODE_SPHERE:
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BOOL addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics );
|
BOOL addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics );
|
||||||
|
S32 getTreeGrassSpecies(std::map<std::string, S32> &table, const char *control, S32 max);
|
||||||
BOOL raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face,
|
BOOL raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face,
|
||||||
BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region );
|
BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region );
|
||||||
BOOL addDuplicate(S32 x, S32 y);
|
BOOL addDuplicate(S32 x, S32 y);
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ F32 w_mod[GRASS_MAX_BLADES]; // Factor to modulate wind movement by to rand
|
|||||||
LLVOGrass::SpeciesMap LLVOGrass::sSpeciesTable;
|
LLVOGrass::SpeciesMap LLVOGrass::sSpeciesTable;
|
||||||
S32 LLVOGrass::sMaxGrassSpecies = 0;
|
S32 LLVOGrass::sMaxGrassSpecies = 0;
|
||||||
|
|
||||||
|
LLVOGrass::SpeciesNames LLVOGrass::sSpeciesNames;
|
||||||
|
|
||||||
|
|
||||||
LLVOGrass::LLVOGrass(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
|
LLVOGrass::LLVOGrass(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
|
||||||
: LLAlphaObject(id, pcode, regionp)
|
: LLAlphaObject(id, pcode, regionp)
|
||||||
@@ -198,6 +200,11 @@ void LLVOGrass::initClass()
|
|||||||
|
|
||||||
if (species >= sMaxGrassSpecies) sMaxGrassSpecies = species + 1;
|
if (species >= sMaxGrassSpecies) sMaxGrassSpecies = species + 1;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
|
||||||
|
success &= grass_def->getFastAttributeString(name_string, name);
|
||||||
|
sSpeciesNames[name] = species;
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ public:
|
|||||||
F32 mBladeWindAngle;
|
F32 mBladeWindAngle;
|
||||||
F32 mBWAOverlap;
|
F32 mBWAOverlap;
|
||||||
|
|
||||||
|
typedef std::map<std::string, S32> SpeciesNames;
|
||||||
|
static SpeciesNames sSpeciesNames;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~LLVOGrass();
|
~LLVOGrass();
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ F32 LLVOTree::sTreeFactor = 1.f;
|
|||||||
LLVOTree::SpeciesMap LLVOTree::sSpeciesTable;
|
LLVOTree::SpeciesMap LLVOTree::sSpeciesTable;
|
||||||
S32 LLVOTree::sMaxTreeSpecies = 0;
|
S32 LLVOTree::sMaxTreeSpecies = 0;
|
||||||
|
|
||||||
|
LLVOTree::SpeciesNames LLVOTree::sSpeciesNames;
|
||||||
|
|
||||||
// Tree variables and functions
|
// Tree variables and functions
|
||||||
|
|
||||||
LLVOTree::LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp):
|
LLVOTree::LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp):
|
||||||
@@ -242,6 +244,11 @@ void LLVOTree::initClass()
|
|||||||
sSpeciesTable[species] = newTree;
|
sSpeciesTable[species] = newTree;
|
||||||
|
|
||||||
if (species >= sMaxTreeSpecies) sMaxTreeSpecies = species + 1;
|
if (species >= sMaxTreeSpecies) sMaxTreeSpecies = species + 1;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
|
||||||
|
success &= tree_def->getFastAttributeString(name_string, name);
|
||||||
|
sSpeciesNames[name] = species;
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -153,6 +153,10 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static F32 sTreeFactor; // Tree level of detail factor
|
static F32 sTreeFactor; // Tree level of detail factor
|
||||||
|
|
||||||
|
typedef std::map<std::string, S32> SpeciesNames;
|
||||||
|
static SpeciesNames sSpeciesNames;
|
||||||
|
|
||||||
static const S32 sMAX_NUM_TREE_LOD_LEVELS ;
|
static const S32 sMAX_NUM_TREE_LOD_LEVELS ;
|
||||||
|
|
||||||
friend class LLDrawPoolTree;
|
friend class LLDrawPoolTree;
|
||||||
|
|||||||
Reference in New Issue
Block a user