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> <string>F32</string>
<key>Value</key> <key>Value</key>
<real>0.5</real> <real>0.5</real>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>BuildPrefs_Ysize</key> <key>BuildPrefs_Ysize</key>
<map> <map>
@@ -225,6 +227,8 @@
<string>F32</string> <string>F32</string>
<key>Value</key> <key>Value</key>
<real>0.5</real> <real>0.5</real>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>BuildPrefs_Zsize</key> <key>BuildPrefs_Zsize</key>
<map> <map>
@@ -236,6 +240,8 @@
<string>F32</string> <string>F32</string>
<key>Value</key> <key>Value</key>
<real>0.5</real> <real>0.5</real>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>EmeraldBuildPrefs_Phantom</key> <key>EmeraldBuildPrefs_Phantom</key>
<map> <map>
@@ -247,6 +253,8 @@
<string>Boolean</string> <string>Boolean</string>
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>0</integer>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>EmeraldBuildPrefs_Temporary</key> <key>EmeraldBuildPrefs_Temporary</key>
<map> <map>
@@ -258,6 +266,8 @@
<string>Boolean</string> <string>Boolean</string>
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>0</integer>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>EmeraldBuildPrefs_Physical</key> <key>EmeraldBuildPrefs_Physical</key>
<map> <map>
@@ -269,6 +279,8 @@
<string>Boolean</string> <string>Boolean</string>
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>0</integer>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>EmeraldBuildPrefs_EmbedItem</key> <key>EmeraldBuildPrefs_EmbedItem</key>
<map> <map>
@@ -280,6 +292,8 @@
<string>Boolean</string> <string>Boolean</string>
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>0</integer>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>BuildPrefs_Material</key> <key>BuildPrefs_Material</key>
<map> <map>
@@ -291,6 +305,8 @@
<string>String</string> <string>String</string>
<key>Value</key> <key>Value</key>
<string>Wood</string> <string>Wood</string>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>EmeraldBuildPrefs_Color</key> <key>EmeraldBuildPrefs_Color</key>
<map> <map>
@@ -307,6 +323,8 @@
<real>1.0</real> <real>1.0</real>
<real>1.0</real> <real>1.0</real>
</array> </array>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>EmeraldBuildPrefs_Texture</key> <key>EmeraldBuildPrefs_Texture</key>
<map> <map>
@@ -318,6 +336,8 @@
<string>String</string> <string>String</string>
<key>Value</key> <key>Value</key>
<string>89556747-24cb-43ed-920b-47caed15465f</string> <string>89556747-24cb-43ed-920b-47caed15465f</string>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>EmeraldBuildPrefs_Alpha</key> <key>EmeraldBuildPrefs_Alpha</key>
<map> <map>
@@ -329,6 +349,8 @@
<string>F32</string> <string>F32</string>
<key>Value</key> <key>Value</key>
<real>0.0</real> <real>0.0</real>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>EmeraldBuildPrefs_Glow</key> <key>EmeraldBuildPrefs_Glow</key>
<map> <map>
@@ -340,6 +362,8 @@
<string>F32</string> <string>F32</string>
<key>Value</key> <key>Value</key>
<real>0.0</real> <real>0.0</real>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>EmeraldBuildPrefs_FullBright</key> <key>EmeraldBuildPrefs_FullBright</key>
<map> <map>
@@ -351,6 +375,8 @@
<string>Boolean</string> <string>Boolean</string>
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>0</integer>
<key>IsCOA</key>
<integer>1</integer>
</map> </map>
<key>EmeraldBuildPrefs_Shiny</key> <key>EmeraldBuildPrefs_Shiny</key>
<map> <map>
@@ -362,6 +388,21 @@
<string>String</string> <string>String</string>
<key>Value</key> <key>Value</key>
<string>None</string> <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>
</map> </map>
</llsd> </llsd>

View File

@@ -355,11 +355,17 @@ LLVector3 LLManip::getPivotPoint()
{ {
static LLCachedControl<bool> actual_root("AscentBuildPrefs_ActualRoot"); static LLCachedControl<bool> actual_root("AscentBuildPrefs_ActualRoot");
static LLCachedControl<bool> pivot_as_percent("AscentBuildPrefs_PivotIsPercent"); static LLCachedControl<bool> pivot_as_percent("AscentBuildPrefs_PivotIsPercent");
static LLCachedControl<F32> pivot_x("AscentBuildPrefs_PivotX"); LLVector3 offset(50,50,50);
static LLCachedControl<F32> pivot_y("AscentBuildPrefs_PivotY"); //Are we are using the defaults?
static LLCachedControl<F32> pivot_z("AscentBuildPrefs_PivotZ"); if(gSavedSettings.getBOOL("LiruEnableBuildPrefs"))
LLVector3 offset(pivot_x,pivot_y,pivot_z); {
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 (mObjectSelection->getFirstRootObject(TRUE) && (mObjectSelection->getObjectCount() == 1 || actual_root) && mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
{ {
if(pivot_as_percent) 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. // Set params for new object based on its PCode.
LLQuaternion rotation; LLQuaternion rotation;
LLVector3 scale = LLVector3( LLVector3 scale = DEFAULT_OBJECT_SCALE;
gSavedSettings.getF32("BuildPrefs_Xsize"),
gSavedSettings.getF32("BuildPrefs_Ysize"),
gSavedSettings.getF32("BuildPrefs_Zsize"));
U8 material = LL_MCODE_WOOD; U8 material = LL_MCODE_WOOD;
if(gSavedSettings.getString("BuildPrefs_Material")== "Stone") material = LL_MCODE_STONE; static LLCachedControl<bool> enable_BP("LiruEnableBuildPrefs", true);
else if(gSavedSettings.getString("BuildPrefs_Material")== "Metal") material = LL_MCODE_METAL; static LLCachedControl<bool> duplicate("CreateToolCopySelection", true);
//if(gSavedSettings.getString("BuildPrefs_Material")== "Wood") material = LL_MCODE_WOOD; redundant //If we are using the defaults, and we aren't duplicating
else if(gSavedSettings.getString("BuildPrefs_Material")== "Flesh") material = LL_MCODE_FLESH; if(enable_BP && !duplicate)
else if(gSavedSettings.getString("BuildPrefs_Material")== "Rubber") material = LL_MCODE_RUBBER; {
else if(gSavedSettings.getString("BuildPrefs_Material")== "Plastic") material = LL_MCODE_PLASTIC; 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; BOOL create_selected = FALSE;
LLVolumeParams volume_params; LLVolumeParams volume_params;
@@ -292,7 +298,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
gMessageSystem->addU8Fast(_PREHASH_Material, material); gMessageSystem->addU8Fast(_PREHASH_Material, material);
U32 flags = 0; // not selected U32 flags = 0; // not selected
if (use_physics) if (use_physics || (enable_BP && !duplicate && gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical")))
{ {
flags |= FLAGS_USE_PHYSICS; 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 // Pack in name value pairs
gMessageSystem->sendReliable(regionp->getHost()); gMessageSystem->sendReliable(regionp->getHost());
//Actually call expectRez so that importtracker can do its thing //If we are using the defaults, and we aren't duplicating
gImportTracker.expectRez(); 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 // Spawns a message, so must be after above send
if (create_selected) if (create_selected)
{ {