From c435a835bf26a0de1f8cb5ca44e4c5d4f74f1b89 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 13 Apr 2010 02:29:28 -0700 Subject: Ported Emerald build preferences and added them to llfloaterbuildoptions instead --- linden/indra/newview/app_settings/settings.xml | 225 +++++++++++++++++++++ linden/indra/newview/llfloaterbuildoptions.cpp | 81 ++++++++ linden/indra/newview/llfloaterbuildoptions.h | 11 + linden/indra/newview/llmanip.cpp | 86 +++++++- linden/indra/newview/llmanip.h | 13 ++ linden/indra/newview/lltoolplacer.cpp | 18 +- linden/indra/newview/llviewerobjectlist.cpp | 81 ++++++++ .../default/xui/en-us/floater_build_options.xml | 167 +++++++++++++-- .../skins/default/xui/en-us/floater_tools.xml | 6 +- 9 files changed, 660 insertions(+), 28 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 9f2854b..a1e335d 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -15,6 +15,231 @@ Value 1 + BuildPrefs_Xsize + + Comment + Default Size For New Objects to be created X + Persist + 1 + Type + F32 + Value + 0.5 + + BuildPrefs_Ysize + + Comment + Default Size For New Objects to be created Y + Persist + 1 + Type + F32 + Value + 0.5 + + BuildPrefs_Zsize + + Comment + Default Size For New Objects to be created Z + Persist + 1 + Type + F32 + Value + 0.5 + + BuildPrefs_Phantom + + Comment + Default Setting For New Objects to be created, phantom flag + Persist + 1 + Type + Boolean + Value + 0 + + BuildPrefs_Temporary + + Comment + Default Setting For New Objects to be created, temp flag + Persist + 1 + Type + Boolean + Value + 0 + + BuildPrefs_Physical + + Comment + Default Setting For New Objects to be created, physical flag + Persist + 1 + Type + Boolean + Value + 0 + + BuildPrefs_EmbedItem + + Comment + Whether to add item to objects + Persist + 1 + Type + Boolean + Value + 0 + + BuildPrefs_Material + + Comment + Default Setting For New Objects to be created, physical flag + Persist + 1 + Type + String + Value + Wood + + BuildPrefs_Color + + Comment + Color of new objects textures + Persist + 1 + Type + Color4 + Value + + 1.0 + 1.0 + 1.0 + 1.0 + + + BuildPrefs_Texture + + Comment + Texture used as 'Default' for new object created + Persist + 1 + Type + String + Value + 89556747-24cb-43ed-920b-47caed15465f + + BuildPrefs_Item + + Comment + item added to new object created + Persist + 1 + Type + String + Value + + + BuildPrefs_Alpha + + Comment + Default Alpha For New Objects to be created + Persist + 1 + Type + F32 + Value + 0.0 + + BuildPrefs_Glow + + Comment + Default Glow For New Objects to be created + Persist + 1 + Type + F32 + Value + 0.0 + + BuildPrefs_FullBright + + Comment + Default Setting For New Objects to be created, whether textures are full bright + Persist + 1 + Type + Boolean + Value + 0 + + BuildPrefs_Shiny + + Comment + Shiny level used as 'Default' for new objects created + Persist + 1 + Type + String + Value + None + + BuildPrefs_PivotX + + Comment + Pivot point on the X axis + Persist + 1 + Type + F32 + Value + 50 + + BuildPrefs_PivotY + + Comment + Pivot point on the Y axis + Persist + 1 + Type + F32 + Value + 50 + + BuildPrefs_PivotZ + + Comment + Pivot point on the Z axis + Persist + 1 + Type + F32 + Value + 50 + + BuildPrefs_PivotIsPercent + + Comment + Consider the Pivot points values as a percentage + Persist + 1 + Type + Boolean + Value + 1 + + BuildPrefs_ActualRoot + + Comment + Show the axis on the actual root of a linkset instead of mass center + Persist + 1 + Type + Boolean + Value + 0 + DisableLoginLogoutScreens Comment diff --git a/linden/indra/newview/llfloaterbuildoptions.cpp b/linden/indra/newview/llfloaterbuildoptions.cpp index 3cd35db..472f6bb 100644 --- a/linden/indra/newview/llfloaterbuildoptions.cpp +++ b/linden/indra/newview/llfloaterbuildoptions.cpp @@ -43,17 +43,24 @@ // library includes #include "llfontgl.h" #include "llcheckboxctrl.h" +#include "llcombobox.h" #include "llspinctrl.h" #include "llsliderctrl.h" +#include "lltexturectrl.h" // newview includes +#include "llinventorymodel.h" #include "llresmgr.h" +#include "llstartup.h" // not really necessary here, but just in case #include "llviewercontrol.h" +#include "llviewerinventory.h" +#include "floaterbusy.h" // class InvDropTarget // // Globals // LLFloaterBuildOptions *LLFloaterBuildOptions::sInstance = NULL; +InvDropTarget * LLFloaterBuildOptions::mBuildObjectDropTarget; // // Methods @@ -67,6 +74,55 @@ LLFloaterBuildOptions::LLFloaterBuildOptions( ) LLFloaterBuildOptions::~LLFloaterBuildOptions() { sInstance = NULL; + delete mBuildObjectDropTarget; + mBuildObjectDropTarget = NULL; +} + +BOOL LLFloaterBuildOptions::postBuild() +{ + getChild("material")->setSimple(gSavedSettings.getString("BuildPrefs_Material")); + getChild("combobox shininess")->setSimple(gSavedSettings.getString("BuildPrefs_Shiny")); + + getChild("material")->setCommitCallback(onComboBoxCommit); + getChild("combobox shininess")->setCommitCallback(onComboBoxCommit); + + getChild("texture control")->setDefaultImageAssetID(LLUUID("89556747-24cb-43ed-920b-47caed15465f")); + getChild("texture control")->setCommitCallback(onTexturePickerCommit); + + LLView *target_view = getChild("build_item_add_disp_rect"); + if (target_view) + { + if (mBuildObjectDropTarget) + { + delete mBuildObjectDropTarget; + } + mBuildObjectDropTarget = new InvDropTarget("build drop target", target_view->getRect(),BuildAutoResponseItemDrop); + addChild(mBuildObjectDropTarget); + } + + if (LLStartUp::getStartupState() == STATE_STARTED) + { + LLUUID itemid = (LLUUID)gSavedSettings.getString("BuildPrefs_Item"); + LLViewerInventoryItem* item = gInventory.getItem(itemid); + if (item) + { + childSetValue("build_item_add_disp_rect_txt", "Currently set to: "+item->getName()); + } + else if (itemid.isNull()) + { + childSetValue("build_item_add_disp_rect_txt", "Currently not set"); + } + else + { + childSetValue("build_item_add_disp_rect_txt", "Currently set to a item not on this account"); + } + } + else + { + childSetValue("build_item_add_disp_rect_txt", "Not logged in"); + } + + return TRUE; } // static @@ -95,3 +151,28 @@ BOOL LLFloaterBuildOptions::visible(void*) { return (sInstance != NULL); } + +void LLFloaterBuildOptions::BuildAutoResponseItemDrop(LLViewerInventoryItem* item) +{ + gSavedSettings.setString("BuildPrefs_Item", item->getUUID().asString()); + LLFloaterBuildOptions::getInstance()->childSetValue("build_item_add_disp_rect_txt", "Currently set to: "+item->getName()); +} + +void LLFloaterBuildOptions::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) +{ + + LLComboBox* box = (LLComboBox*)ctrl; + if(box) + { + gSavedSettings.setString(box->getControlName(), box->getValue().asString()); + } +} + +void LLFloaterBuildOptions::onTexturePickerCommit(LLUICtrl* ctrl, void* userdata) +{ + LLTextureCtrl* image_ctrl = (LLTextureCtrl*)ctrl; + if(image_ctrl) + { + gSavedSettings.setString("BuildPrefs_Texture", image_ctrl->getImageAssetID().asString()); + } +} diff --git a/linden/indra/newview/llfloaterbuildoptions.h b/linden/indra/newview/llfloaterbuildoptions.h index e030b06..50599dd 100644 --- a/linden/indra/newview/llfloaterbuildoptions.h +++ b/linden/indra/newview/llfloaterbuildoptions.h @@ -40,6 +40,8 @@ #include "llfloater.h" +class LLViewerInventoryItem; +class InvDropTarget; class LLFloaterBuildOptions : public LLFloater @@ -49,12 +51,21 @@ protected: ~LLFloaterBuildOptions(); public: + BOOL postBuild(); + static void show(void*); static LLFloaterBuildOptions* getInstance(); static BOOL visible(void*); protected: static LLFloaterBuildOptions* sInstance; + +private: + static InvDropTarget* mBuildObjectDropTarget; + + static void onTexturePickerCommit(LLUICtrl* ctrl, void* userdata); + static void onComboBoxCommit(LLUICtrl* ctrl, void* userdata); + static void BuildAutoResponseItemDrop(LLViewerInventoryItem* item); }; #endif diff --git a/linden/indra/newview/llmanip.cpp b/linden/indra/newview/llmanip.cpp index 53c74aa..fd24f6d 100644 --- a/linden/indra/newview/llmanip.cpp +++ b/linden/indra/newview/llmanip.cpp @@ -69,7 +69,11 @@ S32 LLManip::sMaxTimesShowHelpText = 5; F32 LLManip::sGridMaxSubdivisionLevel = 32.f; F32 LLManip::sGridMinSubdivisionLevel = 1.f; LLVector2 LLManip::sTickLabelSpacing(60.f, 25.f); - +bool LLManip::sActualRoot = false;// going to set these up in the main entry +bool LLManip::sPivotPerc = false; +F32 LLManip::sPivotX = 0.f; +F32 LLManip::sPivotY = 0.f; +F32 LLManip::sPivotZ = 0.f; //static void LLManip::rebuild(LLViewerObject* vobj) @@ -100,8 +104,48 @@ LLManip::LLManip( const std::string& name, LLToolComposite* composite ) mHighlightedPart(LL_NO_PART), mManipPart(LL_NO_PART) { -} + initPivot(); + gSavedSettings.getControl("BuildPrefs_ActualRoot")->getSignal()->connect(&updateActualRoot); + gSavedSettings.getControl("BuildPrefs_PivotIsPercent")->getSignal()->connect(&updatePivotIsPercent); + gSavedSettings.getControl("BuildPrefs_PivotX")->getSignal()->connect(&updatePivotX); + gSavedSettings.getControl("BuildPrefs_PivotY")->getSignal()->connect(&updatePivotY); + gSavedSettings.getControl("BuildPrefs_PivotZ")->getSignal()->connect(&updatePivotZ); +} +//static +void LLManip::initPivot() +{ + sActualRoot = (bool)gSavedSettings.getBOOL("BuildPrefs_ActualRoot"); + sPivotPerc = (bool)gSavedSettings.getBOOL("BuildPrefs_PivotIsPercent"); + sPivotX = gSavedSettings.getF32("BuildPrefs_PivotX"); + sPivotY = gSavedSettings.getF32("BuildPrefs_PivotY"); + sPivotZ = gSavedSettings.getF32("BuildPrefs_PivotZ"); +} +//static +void LLManip::updateActualRoot(const LLSD &data) +{ + sActualRoot = (bool)data.asBoolean(); +} +//static +void LLManip::updatePivotIsPercent(const LLSD &data) +{ + sPivotPerc = (bool)data.asBoolean(); +} +//static +void LLManip::updatePivotX(const LLSD &data) +{ + sPivotX = (F32)data.asReal(); +} +//static +void LLManip::updatePivotY(const LLSD &data) +{ + sPivotY = (F32)data.asReal(); +} +//static +void LLManip::updatePivotZ(const LLSD &data) +{ + sPivotZ = (F32)data.asReal(); +} void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal) { LLVector3 grid_origin; @@ -351,11 +395,43 @@ LLVector3 LLManip::getSavedPivotPoint() const LLVector3 LLManip::getPivotPoint() { - if (mObjectSelection->getFirstObject() && mObjectSelection->getObjectCount() == 1 && mObjectSelection->getSelectType() != SELECT_TYPE_HUD) + LLVector3 pos; + LLVector3 scale; + LLQuaternion rot;// = mObjectSelection->getFirstObject()->getRotation(); + if (mObjectSelection->getFirstRootObject(TRUE) && (mObjectSelection->getObjectCount() == 1 || sActualRoot) && mObjectSelection->getSelectType() != SELECT_TYPE_HUD) + { + pos = mObjectSelection->getFirstRootObject(TRUE)->getPivotPositionAgent(); + scale = mObjectSelection->getFirstRootObject(TRUE)->getScale(); + rot = mObjectSelection->getFirstRootObject(TRUE)->getRotation(); + }else + { + pos = LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent(); + scale = LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal(); + rot = LLSelectMgr::getInstance()->getBBoxOfSelection().getRotation(); + } + if(sPivotPerc) + { + + LLVector3 add( + (-scale[VX]*0.5) + (scale[VX]*(sPivotX*0.01)), + (-scale[VY]*0.5) + (scale[VY]*(sPivotY*0.01)), + (-scale[VZ]*0.5) + (scale[VZ]*(sPivotZ*0.01))); + add = add * rot; + pos = pos + add; + }else { - return mObjectSelection->getFirstObject()->getPivotPositionAgent(); + //pos[VX] = pos[VX] + gSavedSettings.getF32("BuildPrefs_PivotX"); + //pos[VY] = pos[VY] + gSavedSettings.getF32("BuildPrefs_PivotY"); + //pos[VZ] = pos[VZ] + gSavedSettings.getF32("BuildPrefs_PivotZ"); + LLVector3 add( + sPivotX, + sPivotY, + sPivotZ); + add = add * rot; + pos = pos + add; } - return LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent(); + //pos = pos * rot; + return pos; } diff --git a/linden/indra/newview/llmanip.h b/linden/indra/newview/llmanip.h index cdf6a36..38672fe 100644 --- a/linden/indra/newview/llmanip.h +++ b/linden/indra/newview/llmanip.h @@ -151,6 +151,13 @@ protected: BOOL getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal); BOOL nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param ); LLColor4 setupSnapGuideRenderPass(S32 pass); +private: + static void initPivot(); + static void updateActualRoot(const LLSD &data); + static void updatePivotIsPercent(const LLSD &data); + static void updatePivotX(const LLSD &data); + static void updatePivotY(const LLSD &data); + static void updatePivotZ(const LLSD &data); protected: LLFrameTimer mHelpTextTimer; BOOL mInSnapRegime; @@ -165,6 +172,12 @@ protected: static F32 sGridMaxSubdivisionLevel; static F32 sGridMinSubdivisionLevel; static LLVector2 sTickLabelSpacing; + + static bool sActualRoot; + static bool sPivotPerc; + static F32 sPivotX; + static F32 sPivotY; + static F32 sPivotZ; }; diff --git a/linden/indra/newview/lltoolplacer.cpp b/linden/indra/newview/lltoolplacer.cpp index d52d97c..dc4d6bf 100644 --- a/linden/indra/newview/lltoolplacer.cpp +++ b/linden/indra/newview/lltoolplacer.cpp @@ -216,8 +216,22 @@ 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 = DEFAULT_OBJECT_SCALE; + LLVector3 scale = LLVector3( + gSavedSettings.getF32("BuildPrefs_Xsize"), + gSavedSettings.getF32("BuildPrefs_Ysize"), + gSavedSettings.getF32("BuildPrefs_Zsize")); + U8 material = LL_MCODE_WOOD; + if(gSavedSettings.getString("BuildPrefs_Material")== "Stone") material = LL_MCODE_STONE; + if(gSavedSettings.getString("BuildPrefs_Material")== "Metal") material = LL_MCODE_METAL; + if(gSavedSettings.getString("BuildPrefs_Material")== "Wood") material = LL_MCODE_WOOD; + if(gSavedSettings.getString("BuildPrefs_Material")== "Flesh") material = LL_MCODE_FLESH; + if(gSavedSettings.getString("BuildPrefs_Material")== "Rubber") material = LL_MCODE_RUBBER; + if(gSavedSettings.getString("BuildPrefs_Material")== "Plastic") material = LL_MCODE_PLASTIC; + + + + BOOL create_selected = FALSE; LLVolumeParams volume_params; @@ -284,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 || gSavedSettings.getBOOL("BuildPrefs_Physical")) { flags |= FLAGS_USE_PHYSICS; } diff --git a/linden/indra/newview/llviewerobjectlist.cpp b/linden/indra/newview/llviewerobjectlist.cpp index 21a9252..78f374c 100644 --- a/linden/indra/newview/llviewerobjectlist.cpp +++ b/linden/indra/newview/llviewerobjectlist.cpp @@ -60,6 +60,7 @@ #include "llresmgr.h" #include "llviewerregion.h" #include "llviewerstats.h" +#include "lltooldraganddrop.h" #include "lltoolmgr.h" #include "lltoolpie.h" #include "llkeyboard.h" @@ -96,6 +97,7 @@ U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberatel LLMap LLViewerObjectList::sIPAndPortToIndex; std::map LLViewerObjectList::sIndexAndLocalIDToUUID; + LLViewerObjectList::LLViewerObjectList() { mNumVisCulled = 0; @@ -256,6 +258,85 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, // (from gPipeline.addObject) // so that the drawable parent is set properly findOrphans(objectp, msg->getSenderIP(), msg->getSenderPort()); + + // Apply custom settings not set in llmanip and lltoolplacer here. + // Don't check for permissions in case opensim ever implements + // default prim permission support serverside -- MC + if (objectp + && just_created + && objectp->permYouOwner() + && objectp->mCreateSelected) + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ObjectImage); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_ObjectData); + msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)(objectp->mLocalID)); + msg->addStringFast(_PREHASH_MediaURL, NULL); + + LLPrimitive obj; + obj.setNumTEs(U8(10)); + S32 shinnyLevel = 0; + if(gSavedSettings.getString("BuildPrefs_Shiny")== "None") shinnyLevel = 0; + if(gSavedSettings.getString("BuildPrefs_Shiny")== "Low") shinnyLevel = 1; + if(gSavedSettings.getString("BuildPrefs_Shiny")== "Medium") shinnyLevel = 2; + if(gSavedSettings.getString("BuildPrefs_Shiny")== "High") shinnyLevel = 3; + + for (int i = 0; i < 10; i++) + { + // I'm assuming this is because there's no good workaround for setting the default + // box texture manually without restarting? -- MC + LLTextureEntry tex = LLTextureEntry(LLUUID(gSavedSettings.getString("BuildPrefs_Texture"))); + tex.setColor(gSavedSettings.getColor4("BuildPrefs_Color")); + tex.setAlpha(1.0 - ((gSavedSettings.getF32("BuildPrefs_Alpha")) / 100.0)); + tex.setGlow(gSavedSettings.getF32("BuildPrefs_Glow")); + if(gSavedSettings.getBOOL("BuildPrefs_FullBright")) + { + tex.setFullbright(TEM_FULLBRIGHT_MASK); + } + + tex.setShiny((U8) shinnyLevel & TEM_SHINY_MASK); + + obj.setTE(U8(i), tex); + } + + obj.packTEMessage(gMessageSystem); + + msg->sendReliable(gAgent.getRegion()->getHost()); + + msg->newMessage("ObjectFlagUpdate"); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)(objectp->mLocalID) ); + msg->addBOOLFast(_PREHASH_UsePhysics, gSavedSettings.getBOOL("BuildPrefs_Physical")); + msg->addBOOL("IsTemporary", gSavedSettings.getBOOL("BuildPrefs_Temporary")); + msg->addBOOL("IsPhantom", gSavedSettings.getBOOL("BuildPrefs_Phantom") ); + msg->addBOOL("CastsShadows", true ); + msg->sendReliable(gAgent.getRegion()->getHost()); + + if(gSavedSettings.getBOOL("BuildPrefs_EmbedItem")) + { + LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem((LLUUID)gSavedSettings.getString("BuildPrefs_Item")); + if(item) + { + if(item->getType()==LLAssetType::AT_LSL_TEXT) + { + LLToolDragAndDrop::dropScript(objectp, + item, + TRUE, + LLToolDragAndDrop::SOURCE_AGENT, + gAgent.getID()); + }else + { + LLToolDragAndDrop::dropInventory(objectp,item,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID()); + } + } + //llinfos << "SENDING CUBE TEXTURE.." << llendl; + } + } // If we're just wandering around, don't create new objects selected. if (just_created diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_build_options.xml b/linden/indra/newview/skins/default/xui/en-us/floater_build_options.xml index 6e6e65c..cdd5dc1 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_build_options.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_build_options.xml @@ -1,30 +1,161 @@ - + + + Grid Options + - + - + - - + width="165" /> + + Object Size + Settings + Texture + + + + + + + + + + label="Physical" left_delta="0" mouse_opaque="true" name="PhysicalToggle" radio_style="false" + width="100" control_name="BuildPrefs_Physical"/> + + + Stone + Metal + Glass + Wood + Flesh + Plastic + Rubber + + + + + + + + + + None + Low + Medium + High + + + + Drop an inventory item here to have it added to the prim contents. + + Currently set to: ITEM + + + + Pivot Point + + + + + + + + diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml index 959ebde..52275ea 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml @@ -119,10 +119,10 @@ -