From 5080746fa0c976c22368fe55befe5a22912cd2c6 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 14 Jul 2012 15:54:36 -0400 Subject: [PATCH] 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. --- .../app_settings/settings_ascent_coa.xml | 41 +++++++++++++++++++ indra/newview/llmanip.cpp | 16 +++++--- indra/newview/lltoolplacer.cpp | 35 +++++++++------- 3 files changed, 73 insertions(+), 19 deletions(-) diff --git a/indra/newview/app_settings/settings_ascent_coa.xml b/indra/newview/app_settings/settings_ascent_coa.xml index 9c94281c4..b76f74109 100644 --- a/indra/newview/app_settings/settings_ascent_coa.xml +++ b/indra/newview/app_settings/settings_ascent_coa.xml @@ -214,6 +214,8 @@ F32 Value 0.5 + IsCOA + 1 BuildPrefs_Ysize @@ -225,6 +227,8 @@ F32 Value 0.5 + IsCOA + 1 BuildPrefs_Zsize @@ -236,6 +240,8 @@ F32 Value 0.5 + IsCOA + 1 EmeraldBuildPrefs_Phantom @@ -247,6 +253,8 @@ Boolean Value 0 + IsCOA + 1 EmeraldBuildPrefs_Temporary @@ -258,6 +266,8 @@ Boolean Value 0 + IsCOA + 1 EmeraldBuildPrefs_Physical @@ -269,6 +279,8 @@ Boolean Value 0 + IsCOA + 1 EmeraldBuildPrefs_EmbedItem @@ -280,6 +292,8 @@ Boolean Value 0 + IsCOA + 1 BuildPrefs_Material @@ -291,6 +305,8 @@ String Value Wood + IsCOA + 1 EmeraldBuildPrefs_Color @@ -307,6 +323,8 @@ 1.0 1.0 + IsCOA + 1 EmeraldBuildPrefs_Texture @@ -318,6 +336,8 @@ String Value 89556747-24cb-43ed-920b-47caed15465f + IsCOA + 1 EmeraldBuildPrefs_Alpha @@ -329,6 +349,8 @@ F32 Value 0.0 + IsCOA + 1 EmeraldBuildPrefs_Glow @@ -340,6 +362,8 @@ F32 Value 0.0 + IsCOA + 1 EmeraldBuildPrefs_FullBright @@ -351,6 +375,8 @@ Boolean Value 0 + IsCOA + 1 EmeraldBuildPrefs_Shiny @@ -362,6 +388,21 @@ String Value None + IsCOA + 1 + + LiruEnableBuildPrefs + + Comment + When false, disables all defaults set in the building preferences panel, without resetting them. + Persist + 1 + Type + Boolean + Value + 1 + IsCOA + 1 diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index b5f17f2af..3ffb93f69 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -355,11 +355,17 @@ LLVector3 LLManip::getPivotPoint() { static LLCachedControl actual_root("AscentBuildPrefs_ActualRoot"); static LLCachedControl pivot_as_percent("AscentBuildPrefs_PivotIsPercent"); - static LLCachedControl pivot_x("AscentBuildPrefs_PivotX"); - static LLCachedControl pivot_y("AscentBuildPrefs_PivotY"); - static LLCachedControl 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 pivot_x("AscentBuildPrefs_PivotX"); + static LLCachedControl pivot_y("AscentBuildPrefs_PivotY"); + static LLCachedControl 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) diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index f9b5e4541..063b28f1e 100644 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -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 enable_BP("LiruEnableBuildPrefs", true); + static LLCachedControl 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) {