Prevent build preferences from altering objects we've duplicated. Offer an off switch for build prefs.

Added LiruEnableBuildPrefs, for turning off, when users do not want to use their default build parameters for a few prims, but don't wish to reset them permanently.
    This should perhaps end up on the build floater somewhere... but for now, debug only.
Note some of this fix for duplication may be overly cautious, but better safe than sorry.
Added a check for physical default in during creation, so that building at great distances adheres a bit more to build preferences.
Added IsCOA into the build settings, since I'd forgotten, previously.
This commit is contained in:
Lirusaito
2012-07-14 15:54:36 -04:00
parent 533675416c
commit 5080746fa0
3 changed files with 73 additions and 19 deletions

View File

@@ -214,6 +214,8 @@
<string>F32</string>
<key>Value</key>
<real>0.5</real>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>BuildPrefs_Ysize</key>
<map>
@@ -225,6 +227,8 @@
<string>F32</string>
<key>Value</key>
<real>0.5</real>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>BuildPrefs_Zsize</key>
<map>
@@ -236,6 +240,8 @@
<string>F32</string>
<key>Value</key>
<real>0.5</real>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>EmeraldBuildPrefs_Phantom</key>
<map>
@@ -247,6 +253,8 @@
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>EmeraldBuildPrefs_Temporary</key>
<map>
@@ -258,6 +266,8 @@
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>EmeraldBuildPrefs_Physical</key>
<map>
@@ -269,6 +279,8 @@
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>EmeraldBuildPrefs_EmbedItem</key>
<map>
@@ -280,6 +292,8 @@
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>BuildPrefs_Material</key>
<map>
@@ -291,6 +305,8 @@
<string>String</string>
<key>Value</key>
<string>Wood</string>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>EmeraldBuildPrefs_Color</key>
<map>
@@ -307,6 +323,8 @@
<real>1.0</real>
<real>1.0</real>
</array>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>EmeraldBuildPrefs_Texture</key>
<map>
@@ -318,6 +336,8 @@
<string>String</string>
<key>Value</key>
<string>89556747-24cb-43ed-920b-47caed15465f</string>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>EmeraldBuildPrefs_Alpha</key>
<map>
@@ -329,6 +349,8 @@
<string>F32</string>
<key>Value</key>
<real>0.0</real>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>EmeraldBuildPrefs_Glow</key>
<map>
@@ -340,6 +362,8 @@
<string>F32</string>
<key>Value</key>
<real>0.0</real>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>EmeraldBuildPrefs_FullBright</key>
<map>
@@ -351,6 +375,8 @@
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>EmeraldBuildPrefs_Shiny</key>
<map>
@@ -362,6 +388,21 @@
<string>String</string>
<key>Value</key>
<string>None</string>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>LiruEnableBuildPrefs</key>
<map>
<key>Comment</key>
<string>When false, disables all defaults set in the building preferences panel, without resetting them.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<string>1</string>
<key>IsCOA</key>
<integer>1</integer>
</map>
</map>
</llsd>

View File

@@ -355,11 +355,17 @@ LLVector3 LLManip::getPivotPoint()
{
static LLCachedControl<bool> actual_root("AscentBuildPrefs_ActualRoot");
static LLCachedControl<bool> pivot_as_percent("AscentBuildPrefs_PivotIsPercent");
static LLCachedControl<F32> pivot_x("AscentBuildPrefs_PivotX");
static LLCachedControl<F32> pivot_y("AscentBuildPrefs_PivotY");
static LLCachedControl<F32> pivot_z("AscentBuildPrefs_PivotZ");
LLVector3 offset(pivot_x,pivot_y,pivot_z);
LLVector3 offset(50,50,50);
//Are we are using the defaults?
if(gSavedSettings.getBOOL("LiruEnableBuildPrefs"))
{
static LLCachedControl<F32> pivot_x("AscentBuildPrefs_PivotX");
static LLCachedControl<F32> pivot_y("AscentBuildPrefs_PivotY");
static LLCachedControl<F32> pivot_z("AscentBuildPrefs_PivotZ");
offset = LLVector3(pivot_x,pivot_y,pivot_z);
}
else
pivot_as_percent = true;
if (mObjectSelection->getFirstRootObject(TRUE) && (mObjectSelection->getObjectCount() == 1 || actual_root) && mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
{
if(pivot_as_percent)

View File

@@ -223,19 +223,25 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
// Set params for new object based on its PCode.
LLQuaternion rotation;
LLVector3 scale = LLVector3(
gSavedSettings.getF32("BuildPrefs_Xsize"),
gSavedSettings.getF32("BuildPrefs_Ysize"),
gSavedSettings.getF32("BuildPrefs_Zsize"));
LLVector3 scale = DEFAULT_OBJECT_SCALE;
U8 material = LL_MCODE_WOOD;
if(gSavedSettings.getString("BuildPrefs_Material")== "Stone") material = LL_MCODE_STONE;
else if(gSavedSettings.getString("BuildPrefs_Material")== "Metal") material = LL_MCODE_METAL;
//if(gSavedSettings.getString("BuildPrefs_Material")== "Wood") material = LL_MCODE_WOOD; redundant
else if(gSavedSettings.getString("BuildPrefs_Material")== "Flesh") material = LL_MCODE_FLESH;
else if(gSavedSettings.getString("BuildPrefs_Material")== "Rubber") material = LL_MCODE_RUBBER;
else if(gSavedSettings.getString("BuildPrefs_Material")== "Plastic") material = LL_MCODE_PLASTIC;
static LLCachedControl<bool> enable_BP("LiruEnableBuildPrefs", true);
static LLCachedControl<bool> duplicate("CreateToolCopySelection", true);
//If we are using the defaults, and we aren't duplicating
if(enable_BP && !duplicate)
{
scale = LLVector3(
gSavedSettings.getF32("BuildPrefs_Xsize"),
gSavedSettings.getF32("BuildPrefs_Ysize"),
gSavedSettings.getF32("BuildPrefs_Zsize"));
if(gSavedSettings.getString("BuildPrefs_Material")== "Stone") material = LL_MCODE_STONE;
else if(gSavedSettings.getString("BuildPrefs_Material")== "Metal") material = LL_MCODE_METAL;
//if(gSavedSettings.getString("BuildPrefs_Material")== "Wood") material = LL_MCODE_WOOD; redundant
else if(gSavedSettings.getString("BuildPrefs_Material")== "Flesh") material = LL_MCODE_FLESH;
else if(gSavedSettings.getString("BuildPrefs_Material")== "Rubber") material = LL_MCODE_RUBBER;
else if(gSavedSettings.getString("BuildPrefs_Material")== "Plastic") material = LL_MCODE_PLASTIC;
}
BOOL create_selected = FALSE;
LLVolumeParams volume_params;
@@ -292,7 +298,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
gMessageSystem->addU8Fast(_PREHASH_Material, material);
U32 flags = 0; // not selected
if (use_physics)
if (use_physics || (enable_BP && !duplicate && gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical")))
{
flags |= FLAGS_USE_PHYSICS;
}
@@ -477,8 +483,9 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
// Pack in name value pairs
gMessageSystem->sendReliable(regionp->getHost());
//Actually call expectRez so that importtracker can do its thing
gImportTracker.expectRez();
//If we are using the defaults, and we aren't duplicating
if(enable_BP && !duplicate) //then, actually call expectRez so that importtracker can do its thing, which sadly only works close up.
gImportTracker.expectRez();
// Spawns a message, so must be after above send
if (create_selected)
{