diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index c96f2191f..315b42a71 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -1288,7 +1288,7 @@ public: LL_CONT << "slowest framerate for last " << int(prevSize * MEM_INFO_THROTTLE) << " seconds "; } - LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' + LL_CONT << std::fixed << std::setprecision(1) << framerate << std::setprecision(6) << '\n' << LLMemoryInfo() << LL_ENDL; return false; diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 1b163ee4c..5171dcf87 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -2065,14 +2065,14 @@ bool LLVertexBuffer::getWeightStrider(LLStrider& strider, S32 index, S32 co return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getWeight4Strider(LLStrider& strider, S32 index, S32 count, bool map_range) +bool LLVertexBuffer::getWeight4Strider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index, count, map_range); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 index, S32 count, bool map_range) +bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index, count, map_range); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } //---------------------------------------------------------------------------- diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index d33bc9ff4..77c753fc9 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -255,8 +255,8 @@ public: bool getColorStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getEmissiveStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); - bool getWeight4Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); - bool getClothWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getWeight4Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getClothWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool useVBOs() const; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index aceb1a4fa..17acc27eb 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -635,7 +635,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, LLCoordScreen windowPos(x,y); LLCoordScreen windowSize(window_rect.right - window_rect.left, window_rect.bottom - window_rect.top); - if (!switchContext(mFullscreen, windowSize, TRUE, &windowPos)) + if (!switchContext(mFullscreen, windowSize, vsync_mode, &windowPos)) { return; } @@ -1654,21 +1654,21 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, co { if (vsync_mode == 0) { - LL_DEBUGS("Window") << "Disabling vertical sync" << LL_ENDL; + LL_INFOS("Window") << "Disabling vertical sync" << LL_ENDL; wglSwapIntervalEXT(0); } else if(vsync_mode == -1) { - LL_DEBUGS("Window") << "Enabling adaptive vertical sync" << LL_ENDL; + LL_INFOS("Window") << "Enabling adaptive vertical sync" << LL_ENDL; if(wglSwapIntervalEXT(-1) == 0) { - LL_DEBUGS("Window") << "Failed to enable adaptive vertical sync. Disabling vsync." << LL_ENDL; + LL_INFOS("Window") << "Failed to enable adaptive vertical sync. Disabling vsync." << LL_ENDL; wglSwapIntervalEXT(0); } } else { - LL_DEBUGS("Window") << "Enabling vertical sync" << LL_ENDL; + LL_INFOS("Window") << "Enabling vertical sync" << LL_ENDL; wglSwapIntervalEXT(1); } } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 01aec311a..52b98e92d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -904,6 +904,19 @@ Value 0 + LiruRegionRestartMinimized + + Comment + Whether or not to spawn the region restart notice minimized (Useful for sim owners and people who need to pack up before leaving) + Persist + 1 + Type + Boolean + Value + 0 + IsCOA + 1 + LiruScriptErrorsStealFocus Comment @@ -2429,6 +2442,17 @@ This should be as low as possible, but too low may break functionality Value 1 + AllowSelectAvatar + + Comment + Allow selecting an avatar that you have modify rights on (via tag) while in edit mode to reposition them + Persist + 1 + Type + Boolean + Value + 0 + AllowTapTapHoldRun Comment diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 44bd9f5ed..f4e86409c 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -22,30 +22,34 @@ * $/LicenseInfo$ */ +#define FLT_MAX 3.402823466e+38 + ATTRIBUTE vec4 weight4; uniform mat3 matrixPalette[52]; uniform vec3 translationPalette[52]; uniform float maxWeight; + + mat4 getObjectSkinnedTransform() { int i; vec4 w = fract(weight4); vec4 index = floor(weight4); - + index = min(index, vec4(maxWeight)); index = max(index, vec4( 0.0)); - float scale = 1.0/(w.x+w.y+w.z+w.w); - w *= scale; - + float sum = (w.x+w.y+w.z+w.w); + int i1 = int(index.x); int i2 = int(index.y); int i3 = int(index.z); int i4 = int(index.w); - + + mat3 mat = matrixPalette[i1]*w.x; mat += matrixPalette[i2]*w.y; mat += matrixPalette[i3]*w.z; @@ -58,10 +62,10 @@ mat4 getObjectSkinnedTransform() mat4 ret; - ret[0] = vec4(mat[0], 0); - ret[1] = vec4(mat[1], 0); - ret[2] = vec4(mat[2], 0); - ret[3] = vec4(trans, 1.0); + ret[0] = vec4(mat[0].xyz, 0); + ret[1] = vec4(mat[1].xyz, 0); + ret[2] = vec4(mat[2].xyz, 0); + ret[3] = vec4(trans, sum); return ret; } diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index 660be832d..dc8f0bc9b 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -89,9 +89,6 @@ LLPrefsAscentChat::LLPrefsAscentChat() childSetEnabled("reset_antispam", started); getChild("reset_antispam")->setCommitCallback(boost::bind(NACLAntiSpamRegistry::purgeAllQueues)); - getChild("enable_as")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitEnableAS, this, _2)); - getChild("antispam_checkbox")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitDialogBlock, this, _1, _2)); - getChild("Group Invites")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitDialogBlock, this, _1, _2)); getChild("autoreplace")->setCommitCallback(boost::bind(LLFloaterAutoReplaceSettings::showInstance, LLSD())); getChild("KeywordsOn")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitKeywords, this, _1)); @@ -186,39 +183,6 @@ void LLPrefsAscentChat::onCommitTimeDate(LLUICtrl* ctrl) gSavedSettings.setString("TimestampFormat", timestamp); } -void LLPrefsAscentChat::onCommitEnableAS(const LLSD& value) -{ - bool enabled = value.asBoolean(); - childSetEnabled("spammsg_checkbox", enabled); - childSetEnabled("antispamtime", enabled); - childSetEnabled("antispamamount", enabled); - childSetEnabled("antispamsoundmulti", enabled); - childSetEnabled("antispamsoundpreloadmulti", enabled); - childSetEnabled("antispamnewlines", enabled); - childSetEnabled("Notify On Spam", enabled); -} - -void LLPrefsAscentChat::onCommitDialogBlock(LLUICtrl* ctrl, const LLSD& value) -{ - childSetEnabled("Group Fee Invites", !childGetValue("antispam_checkbox").asBoolean() && !childGetValue("Group Invites").asBoolean()); - bool enabled = value.asBoolean(); - if (ctrl->getName() == "antispam_checkbox") - { - childSetEnabled("Block All Dialogs From", !enabled); - childSetEnabled("Alerts", !enabled); - childSetEnabled("Friendship Offers", !enabled); - childSetEnabled("Group Invites", !enabled); - childSetEnabled("Group Notices", !enabled); - childSetEnabled("Item Offers", !enabled); - childSetEnabled("Scripts", !enabled); - childSetEnabled("Teleport Offers", !enabled); - childSetEnabled("Teleport Requests", !enabled); - childSetEnabled("Except those from:", !enabled); - childSetEnabled("My objects", !enabled); - childSetEnabled("My friends", !enabled); - } -} - void LLPrefsAscentChat::onCommitKeywords(LLUICtrl* ctrl) { if (ctrl->getName() == "KeywordsOn") @@ -394,26 +358,6 @@ void LLPrefsAscentChat::refresh() if (combo = getChild("speaker_namesystem_combobox")) combo->setCurrentByIndex(mSpeakerNames); - //Antispam ------------------------------------------------------------------------ - // sensitivity tuners - childSetEnabled("spammsg_checkbox", mEnableAS); - childSetEnabled("antispamtime", mEnableAS); - childSetEnabled("antispamamount", mEnableAS); - childSetEnabled("antispamsoundmulti", mEnableAS); - childSetEnabled("antispamsoundpreloadmulti", mEnableAS); - childSetEnabled("antispamnewlines", mEnableAS); - childSetEnabled("Notify On Spam", mEnableAS); - // dialog blocking tuners - childSetEnabled("Block All Dialogs From", !mBlockDialogSpam); - childSetEnabled("Alerts", !mBlockDialogSpam); - childSetEnabled("Friendship Offers", !mBlockDialogSpam); - childSetEnabled("Group Invites", !mBlockDialogSpam); - childSetEnabled("Group Fee Invites", !mBlockDialogSpam && !mBlockGroupInviteSpam); - childSetEnabled("Group Notices", !mBlockDialogSpam); - childSetEnabled("Item Offers", !mBlockDialogSpam); - childSetEnabled("Scripts", !mBlockDialogSpam); - childSetEnabled("Teleport Offers", !mBlockDialogSpam); - //Text Options ------------------------------------------------------------------------ combo = getChild("SpellBase"); diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index d3f324a60..bc45d71d7 100644 --- a/indra/newview/ascentprefschat.h +++ b/indra/newview/ascentprefschat.h @@ -52,8 +52,6 @@ protected: void onSpellEditCustom(); void onSpellBaseComboBoxCommit(const LLSD& value); void onCommitTimeDate(LLUICtrl* ctrl); - void onCommitEnableAS(const LLSD& value); - void onCommitDialogBlock(LLUICtrl* ctrl, const LLSD& value); void onCommitKeywords(LLUICtrl* ctrl); private: diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp index 85d3bf5f2..6ae4a634a 100644 --- a/indra/newview/ascentprefssys.cpp +++ b/indra/newview/ascentprefssys.cpp @@ -51,33 +51,30 @@ LLPrefsAscentSys::LLPrefsAscentSys() LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_ascent_system.xml"); //General ----------------------------------------------------------------------------- - getChild("speed_rez_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); - getChild("double_click_teleport_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); getChild("show_look_at_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); - getChild("enable_clouds")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); getChild("power_user_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); getChild("power_user_confirm_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); //Command Line ------------------------------------------------------------------------ - getChild("chat_cmd_toggle")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLinePos")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineGround")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineHeight")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineTeleportHome")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineRezPlatform")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineCalc")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineClearChat")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineDrawDistance")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdTeleportToCam")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineKeyToName")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineOfferTp")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineMapTo")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("AscentCmdLineTP2")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("SinguCmdLineAway")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); - getChild("SinguCmdLineURL")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + commit_callback_t lineEditorControl(boost::bind(&LLControlGroup::setString, boost::ref(gSavedSettings), boost::bind(&LLUICtrl::getName, _1), _2)); + getChild("AscentCmdLinePos")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineGround")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineHeight")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineTeleportHome")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineRezPlatform")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineCalc")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineClearChat")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineDrawDistance")->setCommitCallback(lineEditorControl); + getChild("AscentCmdTeleportToCam")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineKeyToName")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineOfferTp")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineMapTo")->setCommitCallback(lineEditorControl); + getChild("AscentCmdLineTP2")->setCommitCallback(lineEditorControl); + getChild("SinguCmdLineAway")->setCommitCallback(lineEditorControl); + getChild("SinguCmdLineURL")->setCommitCallback(lineEditorControl); //Security ---------------------------------------------------------------------------- - getChild("disable_click_sit_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); + getChild("UISndRestart")->setCommitCallback(lineEditorControl); //Build ------------------------------------------------------------------------------- getChild("next_owner_copy")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); @@ -101,21 +98,7 @@ void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value) const std::string name = ctrl->getName(); bool enabled = value.asBoolean(); - if (name == "speed_rez_check") - { - childSetEnabled("speed_rez_interval", enabled); - childSetEnabled("speed_rez_seconds", enabled); - } - else if (name == "double_click_teleport_check") - { - childSetEnabled("center_after_teleport_check", enabled); - childSetEnabled("offset_teleport_check", enabled); - } - else if (name == "enable_clouds") - { - childSetEnabled("enable_classic_clouds", enabled); - } - else if (name == "power_user_check") + if (name == "power_user_check") { childSetEnabled("power_user_confirm_check", enabled); childSetValue("power_user_confirm_check", false); @@ -135,10 +118,6 @@ void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value) LLFloaterChat::addChat(chat); } } - else if (name == "disable_click_sit_check") - { - childSetEnabled("disable_click_sit_own_check", !enabled); - } else if (name == "next_owner_copy") { if (!enabled) gSavedSettings.setBOOL("NextOwnerTransfer", true); @@ -146,49 +125,6 @@ void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value) } } -void LLPrefsAscentSys::onCommitCmdLine(LLUICtrl* ctrl, const LLSD& value) -{ - const std::string& name = ctrl->getName(); - if (name == "chat_cmd_toggle") - { - bool enabled = value.asBoolean(); - childSetEnabled("cmd_line_text_2", enabled); - childSetEnabled("cmd_line_text_3", enabled); - childSetEnabled("cmd_line_text_4", enabled); - childSetEnabled("cmd_line_text_5", enabled); - childSetEnabled("cmd_line_text_6", enabled); - childSetEnabled("cmd_line_text_7", enabled); - childSetEnabled("cmd_line_text_8", enabled); - childSetEnabled("cmd_line_text_9", enabled); - childSetEnabled("cmd_line_text_10", enabled); - childSetEnabled("cmd_line_text_11", enabled); - childSetEnabled("cmd_line_text_12", enabled); - childSetEnabled("cmd_line_text_13", enabled); - childSetEnabled("cmd_line_text_15", enabled); - childSetEnabled("AscentCmdLinePos", enabled); - childSetEnabled("AscentCmdLineGround", enabled); - childSetEnabled("AscentCmdLineHeight", enabled); - childSetEnabled("AscentCmdLineTeleportHome", enabled); - childSetEnabled("AscentCmdLineRezPlatform", enabled); - childSetEnabled("AscentPlatformSize", enabled); - childSetEnabled("AscentCmdLineCalc", enabled); - childSetEnabled("AscentCmdLineClearChat", enabled); - childSetEnabled("AscentCmdLineDrawDistance", enabled); - childSetEnabled("AscentCmdTeleportToCam", enabled); - childSetEnabled("AscentCmdLineKeyToName", enabled); - childSetEnabled("AscentCmdLineOfferTp", enabled); - childSetEnabled("AscentCmdLineMapTo", enabled); - childSetEnabled("map_to_keep_pos", enabled); - childSetEnabled("AscentCmdLineTP2", enabled); - childSetEnabled("SinguCmdLineAway", enabled); - childSetEnabled("SinguCmdLineURL", enabled); - } - else - { - gSavedSettings.setString(name, value); // Singu Note: Keep commandline settings using the same name as their settings - } -} - void LLPrefsAscentSys::onCommitComboBox(LLUICtrl* ctrl, const LLSD& value) { gSavedSettings.setString(ctrl->getControlName(), value.asString()); @@ -259,6 +195,8 @@ void LLPrefsAscentSys::refreshValues() mDisableClickSitOtherOwner = gSavedSettings.getBOOL("DisableClickSitOtherOwner"); mDisplayScriptJumps = gSavedSettings.getBOOL("AscentDisplayTotalScriptJumps"); mNumScriptDiff = gSavedSettings.getF32("Ascentnumscriptdiff"); + mRestartMinimized = gSavedSettings.getBOOL("LiruRegionRestartMinimized"); + mRestartSound = gSavedSettings.getString("UISndRestart"); mLandmark = gSavedPerAccountSettings.getString("EmergencyTeleportLandmark"); //Build ------------------------------------------------------------------------------- @@ -284,44 +222,12 @@ void LLPrefsAscentSys::refreshValues() void LLPrefsAscentSys::refresh() { //General ----------------------------------------------------------------------------- - childSetEnabled("center_after_teleport_check", mDoubleClickTeleport); - childSetEnabled("offset_teleport_check", mDoubleClickTeleport); childSetValue("power_user_check", mPowerUser); - childSetValue("power_user_confirm_check", mPowerUser); - childSetEnabled("speed_rez_interval", mSpeedRez); - childSetEnabled("speed_rez_seconds", mSpeedRez); - - //Command Line ------------------------------------------------------------------------ - childSetEnabled("cmd_line_text_2", mCmdLine); - childSetEnabled("cmd_line_text_3", mCmdLine); - childSetEnabled("cmd_line_text_4", mCmdLine); - childSetEnabled("cmd_line_text_5", mCmdLine); - childSetEnabled("cmd_line_text_6", mCmdLine); - childSetEnabled("cmd_line_text_7", mCmdLine); - childSetEnabled("cmd_line_text_8", mCmdLine); - childSetEnabled("cmd_line_text_9", mCmdLine); - childSetEnabled("cmd_line_text_10", mCmdLine); - childSetEnabled("cmd_line_text_11", mCmdLine); - childSetEnabled("cmd_line_text_12", mCmdLine); - childSetEnabled("cmd_line_text_13", mCmdLine); - childSetEnabled("cmd_line_text_15", mCmdLine); - childSetEnabled("AscentCmdLinePos", mCmdLine); - childSetEnabled("AscentCmdLineGround", mCmdLine); - childSetEnabled("AscentCmdLineHeight", mCmdLine); - childSetEnabled("AscentCmdLineTeleportHome", mCmdLine); - childSetEnabled("AscentCmdLineRezPlatform", mCmdLine); - childSetEnabled("AscentPlatformSize", mCmdLine); - childSetEnabled("AscentCmdLineCalc", mCmdLine); - childSetEnabled("AscentCmdLineClearChat", mCmdLine); - childSetEnabled("AscentCmdLineDrawDistance", mCmdLine); - childSetEnabled("AscentCmdTeleportToCam", mCmdLine); - childSetEnabled("AscentCmdLineKeyToName", mCmdLine); - childSetEnabled("AscentCmdLineOfferTp", mCmdLine); - childSetEnabled("AscentCmdLineMapTo", mCmdLine); - childSetEnabled("map_to_keep_pos", mCmdLine); - childSetEnabled("AscentCmdLineTP2", mCmdLine); - childSetEnabled("SinguCmdLineAway", mCmdLine); - childSetEnabled("SinguCmdLineURL", mCmdLine); + if (LLUICtrl* ctrl = getChild("power_user_confirm_check")) + { + ctrl->setEnabled(mPowerUser); + ctrl->setValue(mPowerUser); + } //Security ---------------------------------------------------------------------------- childSetValue("AscentCmdLinePos", mCmdLinePos); @@ -340,6 +246,9 @@ void LLPrefsAscentSys::refresh() childSetValue("SinguCmdLineAway", mCmdLineAway); childSetValue("SinguCmdLineURL", mCmdLineURL); + //Security ---------------------------------------------------------------------------- + getChildView("UISndRestart")->setValue(mRestartSound); + //Build ------------------------------------------------------------------------------- childSetValue("alpha", mAlpha); getChild("colorswatch")->setOriginal(mColor); @@ -417,6 +326,8 @@ void LLPrefsAscentSys::cancel() gSavedSettings.setBOOL("DisableClickSitOtherOwner", mDisableClickSitOtherOwner); gSavedSettings.setBOOL("AscentDisplayTotalScriptJumps", mDisplayScriptJumps); gSavedSettings.setF32("Ascentnumscriptdiff", mNumScriptDiff); + gSavedSettings.setBOOL("LiruRegionRestartMinimized", mRestartMinimized); + gSavedSettings.setString("UISndRestart", mRestartSound); gSavedPerAccountSettings.setString("EmergencyTeleportLandmark", mLandmark); //Build ------------------------------------------------------------------------------- diff --git a/indra/newview/ascentprefssys.h b/indra/newview/ascentprefssys.h index 455a072a1..8a8bed9e3 100644 --- a/indra/newview/ascentprefssys.h +++ b/indra/newview/ascentprefssys.h @@ -48,7 +48,6 @@ public: protected: void onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value); - void onCommitCmdLine(LLUICtrl* ctrl, const LLSD& value); void onCommitComboBox(LLUICtrl* ctrl, const LLSD& value); void onCommitTexturePicker(LLUICtrl* ctrl); @@ -109,7 +108,9 @@ private: bool mDisableClickSit; bool mDisableClickSitOtherOwner; bool mDisplayScriptJumps; + bool mRestartMinimized; F32 mNumScriptDiff; + std::string mRestartSound; std::string mLandmark; //Build ------------------------------------------------------------------------------- diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index 0166c951b..b746c0747 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -61,14 +61,7 @@ LLPrefsAscentVan::LLPrefsAscentVan() getChild("tag_spoofing_combobox")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitClientTag, this, _1)); - getChild("show_my_tag_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); - getChild("show_self_tag_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); - getChild("show_self_tag_color_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); - getChild("customize_own_tag_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); - getChild("show_friend_tag_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); - getChild("use_status_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); - - getChild("custom_tag_label_box")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitTextModified, this, _1, _2)); + getChild("custom_tag_label_box")->setCommitCallback(boost::bind(&LLControlGroup::setString, boost::ref(gSavedSettings), "AscentCustomTagLabel", _2)); getChild("update_clientdefs")->setCommitCallback(boost::bind(LLPrefsAscentVan::onManualClientUpdate)); @@ -104,14 +97,6 @@ void LLPrefsAscentVan::onCommitClientTag(LLUICtrl* ctrl) } } -void LLPrefsAscentVan::onCommitTextModified(LLUICtrl* ctrl, const LLSD& value) -{ - if (ctrl->getName() == "custom_tag_label_box") - { - gSavedSettings.setString("AscentCustomTagLabel", value); - } -} - //static void LLPrefsAscentVan::onManualClientUpdate() { @@ -127,29 +112,6 @@ void LLPrefsAscentVan::onManualClientUpdate() LLFloaterChat::addChat(chat); } -void LLPrefsAscentVan::onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value) -{ -// llinfos << "Control named " << ctrl->getControlName() << llendl; - - if (ctrl->getName() == "use_status_check") - { - bool showCustomColors = value.asBoolean(); - childSetEnabled("friends_color_textbox", showCustomColors); - childSetEnabled("friend_color_swatch", showCustomColors || gSavedSettings.getBOOL("ColorFriendChat")); - childSetEnabled("estate_owner_color_swatch", showCustomColors || gSavedSettings.getBOOL("ColorEstateOwnerChat")); - childSetEnabled("linden_color_swatch", showCustomColors || gSavedSettings.getBOOL("ColorLindenChat")); - childSetEnabled("muted_color_swatch", showCustomColors || gSavedSettings.getBOOL("ColorMutedChat")); - } - else if (ctrl->getName() == "customize_own_tag_check") - { - bool showCustomOptions = value.asBoolean(); - childSetEnabled("custom_tag_label_text", showCustomOptions); - childSetEnabled("custom_tag_label_box", showCustomOptions); - childSetEnabled("custom_tag_color_text", showCustomOptions); - childSetEnabled("custom_tag_color_swatch", showCustomOptions); - } -} - // Store current settings for cancel void LLPrefsAscentVan::refreshValues() { diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h index edbe2cefb..9d5100559 100644 --- a/indra/newview/ascentprefsvan.h +++ b/indra/newview/ascentprefsvan.h @@ -48,8 +48,6 @@ public: protected: void onCommitClientTag(LLUICtrl* ctrl); - void onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value); - void onCommitTextModified(LLUICtrl* ctrl, const LLSD& value); static void onManualClientUpdate(); private: diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 42dcd4547..4597f6e9d 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -61,8 +61,6 @@ static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK; static U32 sBufferUsage = GL_STREAM_DRAW_ARB; static U32 sShaderLevel = 0; -#define JOINT_COUNT 52 - LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL; BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE; BOOL LLDrawPoolAvatar::sSkipTransparent = FALSE; @@ -1550,93 +1548,8 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* } if (sShaderLevel <= 0 && face->mLastSkinTime < avatar->getLastSkinTime()) - { //perform software vertex skinning for this face - LLStrider position; - LLStrider normal; - - bool has_normal = buffer->hasDataType(LLVertexBuffer::TYPE_NORMAL); - buffer->getVertexStrider(position); - - if (has_normal) - { - buffer->getNormalStrider(normal); - } - - LLVector4a* pos = (LLVector4a*) position.get(); - - LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL; - - //build matrix palette - LLMatrix4a mp[JOINT_COUNT]; - LLMatrix4* mat = (LLMatrix4*) mp; - - U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT); - - for (U32 j = 0; j < count; ++j) - { - LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); - if(!joint) - { - joint = avatar->getJoint("mRoot"); - } - if (joint) - { - mat[j] = skin->mInvBindMatrix[j]; - mat[j] *= joint->getWorldMatrix(); - } - } - - LLMatrix4a bind_shape_matrix; - bind_shape_matrix.loadu(skin->mBindShapeMatrix); - - for (U32 j = 0; j < (U32)buffer->getNumVerts(); ++j) - { - LLMatrix4a final_mat; - final_mat.clear(); - - S32 idx[4]; - - LLVector4 wght; - - F32 scale = 0.f; - for (U32 k = 0; k < 4; k++) - { - F32 w = weight[j][k]; - - idx[k] = llclamp((S32) floorf(w), 0, S32(count-1)); - wght[k] = w - floorf(w); - scale += wght[k]; - } - - wght *= 1.f/scale; - - for (U32 k = 0; k < 4; k++) - { - F32 w = wght[k]; - - LLMatrix4a src; - src.setMul(mp[idx[k]], w); - - final_mat.add(src); - } - - - LLVector4a& v = vol_face.mPositions[j]; - LLVector4a t; - LLVector4a dst; - bind_shape_matrix.affineTransform(v, t); - final_mat.affineTransform(t, dst); - pos[j] = dst; - - if (norm) - { - LLVector4a& n = vol_face.mNormals[j]; - bind_shape_matrix.rotate(n, t); - final_mat.rotate(t, dst); - dst.normalize3fast(); - norm[j] = dst; - } - } + { + avatar->updateSoftwareSkinnedVertices(skin, weight, vol_face, buffer); } } diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index 9569a9b1f..af06c4836 100644 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -42,6 +42,7 @@ class LLMeshSkinInfo; class LLVolume; class LLVolumeFace; +const U32 JOINT_COUNT = 52; class LLDrawPoolAvatar : public LLFacePool { diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 15430989e..692724a38 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -452,7 +452,7 @@ U16 LLFace::getGeometryAvatar( LLStrider &normals, LLStrider &tex_coords, LLStrider &vertex_weights, - LLStrider &clothing_weights) + LLStrider &clothing_weights) { if (mVertexBuffer.notNull()) { @@ -1143,11 +1143,11 @@ void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf) if (vf.mWeights) { - LLStrider f_wght; + LLStrider f_wght; buff->getWeight4Strider(f_wght); for (U32 i = 0; i < (U32)vf.mNumVertices; ++i) { - (*f_wght++).set(vf.mWeights[i].getF32ptr()); + (*f_wght++) = vf.mWeights[i]; } } @@ -1253,7 +1253,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLStrider colors; LLStrider tangent; LLStrider indicesp; - LLStrider wght; + LLStrider wght; BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME); @@ -2126,8 +2126,10 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { LLFastTimer t(FTM_FACE_GEOM_WEIGHTS); mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, map_range); - F32* weights = (F32*) wght.get(); - LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32)); + for(S32 i=0;iflush(); diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 7cdb6272e..470375b04 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -183,7 +183,7 @@ public: LLStrider &normals, LLStrider &texCoords, LLStrider &vertex_weights, - LLStrider &clothing_weights); + LLStrider &clothing_weights); // For volumes, etc. U16 getGeometry(LLStrider &vertices, diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 6e50ed2a4..159a25a21 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4737,7 +4737,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) LLStrider normal_strider; LLStrider tc_strider; LLStrider index_strider; - LLStrider weights_strider; + LLStrider weights_strider; vb->getVertexStrider(vertex_strider); vb->getIndexStrider(index_strider); @@ -4780,7 +4780,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) w.mV[i] = joint + wght; } - *(weights_strider++) = w; + (*(weights_strider++)).loadua(w.mV); } } @@ -5417,71 +5417,11 @@ BOOL LLModelPreview::render() for (U32 i = 0; i < mVertexBuffer[mPreviewLOD][model].size(); ++i) { LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i]; - const LLVolumeFace& face = model->getVolumeFace(i); - - LLStrider position; - buffer->getVertexStrider(position); - - LLStrider weight; + LLStrider weight; buffer->getWeight4Strider(weight); - //quick 'n dirty software vertex skinning - - //build matrix palette - - LLMatrix4 mat[64]; - for (U32 j = 0; j < model->mSkinInfo.mJointNames.size(); ++j) - { - LLJoint* joint = getPreviewAvatar()->getJoint(model->mSkinInfo.mJointNames[j]); - if (joint) - { - mat[j] = model->mSkinInfo.mInvBindMatrix[j]; - mat[j] *= joint->getWorldMatrix(); - } - } - - for (S32 j = 0; j < buffer->getNumVerts(); ++j) - { - LLMatrix4 final_mat; - final_mat.mMatrix[0][0] = final_mat.mMatrix[1][1] = final_mat.mMatrix[2][2] = final_mat.mMatrix[3][3] = 0.f; - - LLVector4 wght; - S32 idx[4]; - - F32 scale = 0.f; - for (U32 k = 0; k < 4; k++) - { - F32 w = weight[j].mV[k]; - - idx[k] = (S32) floorf(w); - wght.mV[k] = w - floorf(w); - scale += wght.mV[k]; - } - - wght *= 1.f/scale; - - for (U32 k = 0; k < 4; k++) - { - F32* src = (F32*) mat[idx[k]].mMatrix; - F32* dst = (F32*) final_mat.mMatrix; - - F32 w = wght.mV[k]; - - for (U32 l = 0; l < 16; l++) - { - dst[l] += src[l]*w; - } - } - - //VECTORIZE THIS - LLVector3 v(face.mPositions[j].getF32ptr()); - - v = v * model->mSkinInfo.mBindShapeMatrix; - v = v * final_mat; - - position[j] = v; - } + getPreviewAvatar()->updateSoftwareSkinnedVertices(&model->mSkinInfo, weight.get(), face, buffer); const std::string& binding = instance.mModel->mMaterialList[i]; const LLImportMaterial& material = instance.mMaterial[binding]; diff --git a/indra/newview/llfloaterregionrestarting.cpp b/indra/newview/llfloaterregionrestarting.cpp index 4e4116016..35af32390 100644 --- a/indra/newview/llfloaterregionrestarting.cpp +++ b/indra/newview/llfloaterregionrestarting.cpp @@ -116,7 +116,7 @@ void LLFloaterRegionRestarting::draw() LLFloater::draw(); static const LLCachedControl alchemyRegionShake(gSavedSettings, "AlchemyRegionRestartShake", true); - if (!alchemyRegionShake) + if (!alchemyRegionShake || isMinimized()) // If we're minimized, leave the user alone return; const F32 SHAKE_INTERVAL = 0.025; diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index d4830adbf..09463f049 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -109,7 +109,7 @@ F32 FALL_TIME = 0.6f; S32 BORDER_WIDTH = 6; const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte -const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 +const S32 MAX_TEXTURE_SIZE = 1024; //max upload texture size 1024 * 1024 static std::string snapshotKeepAspectName(); @@ -1185,7 +1185,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormatt if (mSnapshotType == SNAPSHOT_TEXTURE) { // 'scaled' must be a power of two. - scaled->biasedScaleToPowerOfTwo(mWidth, mHeight, 512); + scaled->biasedScaleToPowerOfTwo(mWidth, mHeight, 1024); } else { @@ -2488,8 +2488,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool LLSpinCtrl* width_spinner = view->getChild("snapshot_width"); LLSpinCtrl* height_spinner = view->getChild("snapshot_height"); - if (gSavedSettings.getS32("LastSnapshotType") == LLSnapshotLivePreview::SNAPSHOT_TEXTURE || - gSavedSettings.getBOOL("RenderUIInSnapshot") || + if ( gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot")) { // Disable without making label gray. diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index 9fc9b96c9..0c1e60d76 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -865,11 +865,20 @@ void LLPanelDisplay::apply() { U32 fsaa_value = childGetValue("fsaa").asInteger(); S32 vsync_value = childGetValue("vsync").asInteger(); + bool fbo_value = childGetValue("fbo").asBoolean(); + + LLWindow* window = gViewerWindow->getWindow(); if(vsync_value == -1 && !gGLManager.mHasAdaptiveVsync) vsync_value = 0; - bool apply_fsaa_change = !gSavedSettings.getBOOL("RenderUseFBO") && (mFSAASamples != fsaa_value); + bool apply_fsaa_change = fbo_value ? false : (mFSAASamples != fsaa_value); + + if(!apply_fsaa_change && (bool)mUseFBO != fbo_value) + { + apply_fsaa_change = fsaa_value != 0 || mFSAASamples != 0 ; + } + bool apply_vsync_change = vsync_value != mVsyncMode; gSavedSettings.setU32("RenderFSAASamples", fsaa_value); @@ -889,7 +898,6 @@ void LLPanelDisplay::apply() if(apply_fsaa_change || apply_vsync_change) { bool logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); - LLWindow* window = gViewerWindow->getWindow(); LLCoordScreen size; window->getSize(&size); LLGLState::checkStates(); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b211047bc..db44b78d8 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -98,37 +98,23 @@ std::string USE_TEXTURE; LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit() { - LLComboBox* combobox_matmedia = getChild("combobox matmedia"); - LLComboBox* combobox_mattype = getChild("combobox mattype"); - - LLRender::eTexIndex channel_to_edit = (combobox_matmedia && combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? - (combobox_mattype ? (LLRender::eTexIndex)combobox_mattype->getCurrentIndex() : LLRender::DIFFUSE_MAP) : LLRender::DIFFUSE_MAP; +// + LLRender::eTexIndex channel_to_edit = (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? + (mComboMatType ? (LLRender::eTexIndex)mComboMatType->getCurrentIndex() : LLRender::DIFFUSE_MAP) : LLRender::DIFFUSE_MAP; channel_to_edit = (channel_to_edit == LLRender::NORMAL_MAP) ? (getCurrentNormalMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit; channel_to_edit = (channel_to_edit == LLRender::SPECULAR_MAP) ? (getCurrentSpecularMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit; return channel_to_edit; +// } // Things the UI provides... // -LLUUID LLPanelFace::getCurrentNormalMap() { return getChild("bumpytexture control")->getImageAssetID(); } -LLUUID LLPanelFace::getCurrentSpecularMap() { return getChild("shinytexture control")->getImageAssetID(); } -U32 LLPanelFace::getCurrentShininess() { return getChild("combobox shininess")->getCurrentIndex(); } -U32 LLPanelFace::getCurrentBumpiness() { return getChild("combobox bumpiness")->getCurrentIndex(); } -U8 LLPanelFace::getCurrentDiffuseAlphaMode() { return (U8)getChild("combobox alphamode")->getCurrentIndex(); } -U8 LLPanelFace::getCurrentAlphaMaskCutoff() { return (U8)getChild("maskcutoff")->getValue().asInteger(); } -U8 LLPanelFace::getCurrentEnvIntensity() { return (U8)getChild("environment")->getValue().asInteger(); } -U8 LLPanelFace::getCurrentGlossiness() { return (U8)getChild("glossiness")->getValue().asInteger(); } -F32 LLPanelFace::getCurrentBumpyRot() { return getChild("bumpyRot")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyScaleU() { return getChild("bumpyScaleU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyScaleV() { return getChild("bumpyScaleV")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyOffsetU() { return getChild("bumpyOffsetU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentBumpyOffsetV() { return getChild("bumpyOffsetV")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyRot() { return getChild("shinyRot")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyScaleU() { return getChild("shinyScaleU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyScaleV() { return getChild("shinyScaleV")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyOffsetU() { return getChild("shinyOffsetU")->getValue().asReal(); } -F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild("shinyOffsetV")->getValue().asReal(); } +// +LLUUID LLPanelFace::getCurrentNormalMap() { return mBumpyTextureCtrl->getImageAssetID(); } +LLUUID LLPanelFace::getCurrentSpecularMap() { return mShinyTextureCtrl->getImageAssetID(); } +U8 LLPanelFace::getCurrentDiffuseAlphaMode() { return (U8)mComboAlpha->getCurrentIndex(); } +// // // Methods @@ -136,55 +122,86 @@ F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild("shinyOf BOOL LLPanelFace::postBuild() { - childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); - childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); - childSetCommitCallback("combobox alphamode",&LLPanelFace::onCommitAlphaMode,this); - childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this); - childSetCommitCallback("flipTextureScaleU", boost::bind(&LLPanelFace::onCommitFlip, this, true)); - childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureInfo, this); - childSetCommitCallback("flipTextureScaleV", boost::bind(&LLPanelFace::onCommitFlip, this, false)); - childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureInfo, this); - childSetCommitCallback("rptctrl",&LLPanelFace::onCommitRepeatsPerMeter, this); - childSetCommitCallback("checkbox planar align",&LLPanelFace::onCommitPlanarAlign, this); - childSetCommitCallback("TexOffsetU",LLPanelFace::onCommitTextureInfo, this); - childSetCommitCallback("TexOffsetV",LLPanelFace::onCommitTextureInfo, this); + // Media button caching + mMediaInfo = getChildView("media_info"); + mMediaAdd = getChildView("add_media"); + mMediaDelete = getChildView("delete_media"); - childSetCommitCallback("bumpyScaleU",&LLPanelFace::onCommitMaterialBumpyScaleX, this); - childSetCommitCallback("bumpyScaleV",&LLPanelFace::onCommitMaterialBumpyScaleY, this); - childSetCommitCallback("bumpyRot",&LLPanelFace::onCommitMaterialBumpyRot, this); - childSetCommitCallback("bumpyOffsetU",&LLPanelFace::onCommitMaterialBumpyOffsetX, this); - childSetCommitCallback("bumpyOffsetV",&LLPanelFace::onCommitMaterialBumpyOffsetY, this); - childSetCommitCallback("shinyScaleU",&LLPanelFace::onCommitMaterialShinyScaleX, this); - childSetCommitCallback("shinyScaleV",&LLPanelFace::onCommitMaterialShinyScaleY, this); - childSetCommitCallback("shinyRot",&LLPanelFace::onCommitMaterialShinyRot, this); - childSetCommitCallback("shinyOffsetU",&LLPanelFace::onCommitMaterialShinyOffsetX, this); - childSetCommitCallback("shinyOffsetV",&LLPanelFace::onCommitMaterialShinyOffsetY, this); - childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterialGloss, this); - childSetCommitCallback("environment",&LLPanelFace::onCommitMaterialEnv, this); - childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterialMaskCutoff, this); + // Label caching + mLabelGlossy = getChildView("label glossy"); + mLabelEnvironment = getChildView("label environment"); + mLabelShinyColor = getChildView("label shinycolor"); + mLabelAlphaMode = getChildView("label alphamode"); + mLabelMaskCutoff = getChildView("label maskcutoff"); + mLabelBumpy = getChildView("label bumpiness"); + mLabelShiny = getChildView("label shininess"); + mLabelColor = getChildView("color label"); + mLabelGlow = getChildView("glow label"); + mLabelTexGen = getChildView("tex gen"); - childSetAction("button align",&LLPanelFace::onClickAutoFix,this); + // UICtrl Caching + mComboShiny = getChild("combobox shininess"); + mComboBumpy = getChild("combobox bumpiness"); + mComboAlpha = getChild("combobox alphamode"); + mCtrlTexScaleU = getChild("TexScaleU"); + mCtrlFlipTexScaleU = getChild("flipTextureScaleU"); + mCtrlTexScaleV = getChild("TexScaleV"); + mCtrlFlipTexScaleV = getChild("flipTextureScaleV"); + mCtrlTexRot = getChild("TexRot"); + mCtrlRpt = getChild("rptctrl"); + mCtrlPlanar = getChild("checkbox planar align"); + mCtrlTexOffsetU = getChild("TexOffsetU"); + mCtrlTexOffsetV = getChild("TexOffsetV"); + mBumpyScaleU = getChild("bumpyScaleU"); + mBumpyScaleV = getChild("bumpyScaleV"); + mBumpyRot = getChild("bumpyRot"); + mBumpyOffsetU = getChild("bumpyOffsetU"); + mBumpyOffsetV = getChild("bumpyOffsetV"); + mShinyScaleU = getChild("shinyScaleU"); + mShinyScaleV = getChild("shinyScaleV"); + mShinyRot = getChild("shinyRot"); + mShinyOffsetU = getChild("shinyOffsetU"); + mShinyOffsetV = getChild("shinyOffsetV"); + mGlossyCtrl = getChild("glossiness"); + mEnvironmentCtrl = getChild("environment"); + mCtrlMaskCutoff = getChild("maskcutoff"); + mCtrlAlign = getChild("button align"); + mCtrlMapsSync = getChild("checkbox maps sync"); + mCtrlCopy = getChild("copytextures"); + mCtrlPaste = getChild("pastetextures"); - childSetCommitCallback("checkbox maps sync", boost::bind(&LLPanelFace::onClickMapsSync, this)); - childSetAction("copytextures",&LLPanelFace::onClickCopy,this); - childSetAction("pastetextures",&LLPanelFace::onClickPaste,this); + mComboShiny->setCommitCallback(boost::bind(&LLPanelFace::sendShiny, this, boost::bind(&LLSD::asInteger, _2))); + mComboBumpy->setCommitCallback(boost::bind(&LLPanelFace::sendBump, this, boost::bind(&LLSD::asInteger, _2))); + mComboAlpha->setCommitCallback(boost::bind(&LLPanelFace::onCommitAlphaMode, this)); + mCtrlTexScaleU->setCommitCallback(boost::bind(&LLPanelFace::onCommitTextureInfo, this)); + mCtrlFlipTexScaleU->setCommitCallback(boost::bind(&LLPanelFace::onCommitFlip, this, true)); + mCtrlTexScaleV->setCommitCallback(boost::bind(&LLPanelFace::onCommitTextureInfo, this)); + mCtrlFlipTexScaleV->setCommitCallback(boost::bind(&LLPanelFace::onCommitFlip, this, false)); + mCtrlTexRot->setCommitCallback(boost::bind(&LLPanelFace::onCommitTextureInfo, this)); + mCtrlRpt->setCommitCallback(boost::bind(&LLPanelFace::onCommitRepeatsPerMeter, this, _1)); + mCtrlPlanar->setCommitCallback(boost::bind(&LLPanelFace::onCommitPlanarAlign, this)); + mCtrlTexOffsetU->setCommitCallback(boost::bind(&LLPanelFace::onCommitTextureInfo, this)); + mCtrlTexOffsetV->setCommitCallback(boost::bind(&LLPanelFace::onCommitTextureInfo, this)); - LLTextureCtrl* mTextureCtrl; - LLTextureCtrl* mShinyTextureCtrl; - LLTextureCtrl* mBumpyTextureCtrl; - LLColorSwatchCtrl* mColorSwatch; - LLColorSwatchCtrl* mShinyColorSwatch; + mBumpyScaleU->setCommitCallback(boost::bind(&LLPanelFace::onCommitMaterialBumpyScaleX, this, _2)); + mBumpyScaleV->setCommitCallback(boost::bind(&LLPanelFace::onCommitMaterialBumpyScaleY, this, _2)); + mBumpyRot->setCommitCallback(boost::bind(&LLPanelFace::onCommitMaterialBumpyRot, this, _2)); + mBumpyOffsetU->setCommitCallback(boost::bind(LLSelectedTEMaterial::setNormalOffsetX, this, _2)); + mBumpyOffsetV->setCommitCallback(boost::bind(LLSelectedTEMaterial::setNormalOffsetY, this, _2)); + mShinyScaleU->setCommitCallback(boost::bind(&LLPanelFace::onCommitMaterialShinyScaleX, this, _2)); + mShinyScaleV->setCommitCallback(boost::bind(&LLPanelFace::onCommitMaterialShinyScaleY, this, _2)); + mShinyRot->setCommitCallback(boost::bind(&LLPanelFace::onCommitMaterialShinyRot, this, _2)); + mShinyOffsetU->setCommitCallback(boost::bind(LLSelectedTEMaterial::setSpecularOffsetX, this, _2)); + mShinyOffsetV->setCommitCallback(boost::bind(LLSelectedTEMaterial::setSpecularOffsetY, this, _2)); + mGlossyCtrl->setCommitCallback(boost::bind(LLSelectedTEMaterial::setSpecularLightExponent, this, boost::bind(&LLSD::asInteger, _2))); + mEnvironmentCtrl->setCommitCallback(boost::bind(LLSelectedTEMaterial::setEnvironmentIntensity, this, boost::bind(&LLSD::asInteger, _2))); + mCtrlMaskCutoff->setCommitCallback(boost::bind(LLSelectedTEMaterial::setAlphaMaskCutoff, this, boost::bind(&LLSD::asInteger, _2))); - LLComboBox* mComboTexGen; - LLComboBox* mComboMatMedia; - LLComboBox* mComboMatType; + mCtrlAlign->setCommitCallback(boost::bind(&LLPanelFace::onClickAutoFix,this)); - LLCheckBoxCtrl *mCheckFullbright; - - LLTextBox* mLabelColorTransp; - LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha - - LLSpinCtrl* mCtrlGlow; + mCtrlMapsSync->setCommitCallback(boost::bind(&LLPanelFace::onClickMapsSync, this)); + mCtrlCopy->setCommitCallback(boost::bind(&LLPanelFace::onClickCopy,this)); + mCtrlPaste->setCommitCallback(boost::bind(&LLPanelFace::onClickPaste,this)); setMouseOpaque(FALSE); @@ -243,7 +260,7 @@ BOOL LLPanelFace::postBuild() mColorSwatch = getChild("colorswatch"); if(mColorSwatch) { - mColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitColor, this, _2)); + mColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::sendColor, this)); mColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelColor, this, _2)); mColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectColor, this, _2)); mColorSwatch->setFollowsTop(); @@ -270,7 +287,7 @@ BOOL LLPanelFace::postBuild() mCtrlColorTransp = getChild("ColorTrans"); if(mCtrlColorTransp) { - mCtrlColorTransp->setCommitCallback(boost::bind(&LLPanelFace::onCommitAlpha, this, _2)); + mCtrlColorTransp->setCommitCallback(boost::bind(&LLPanelFace::sendAlpha, this)); mCtrlColorTransp->setPrecision(0); mCtrlColorTransp->setFollowsTop(); mCtrlColorTransp->setFollowsLeft(); @@ -279,20 +296,20 @@ BOOL LLPanelFace::postBuild() mCheckFullbright = getChild("checkbox fullbright"); if (mCheckFullbright) { - mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright, this); + mCheckFullbright->setCommitCallback(boost::bind(&LLPanelFace::sendFullbright, this)); } mComboTexGen = getChild("combobox texgen"); if(mComboTexGen) { - mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen, this); + mComboTexGen->setCommitCallback(boost::bind(&LLPanelFace::sendTexGen, this)); mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } mComboMatMedia = getChild("combobox matmedia"); if(mComboMatMedia) { - mComboMatMedia->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); + mComboMatMedia->setCommitCallback(boost::bind(&LLPanelFace::onCommitMaterialsMedia,this)); mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); } @@ -306,7 +323,7 @@ BOOL LLPanelFace::postBuild() mCtrlGlow = getChild("glow"); if(mCtrlGlow) { - mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow, this); + mCtrlGlow->setCommitCallback(boost::bind(&LLPanelFace::sendGlow, this)); } @@ -317,6 +334,62 @@ BOOL LLPanelFace::postBuild() LLPanelFace::LLPanelFace(const std::string& name) : LLPanel(name), +// + mMediaInfo(NULL), + mMediaAdd(NULL), + mMediaDelete(NULL), + mLabelGlossy(NULL), + mLabelEnvironment(NULL), + mLabelShinyColor(NULL), + mLabelAlphaMode(NULL), + mLabelMaskCutoff(NULL), + mLabelBumpy(NULL), + mLabelShiny(NULL), + mLabelColor(NULL), + mLabelGlow(NULL), + mLabelTexGen(NULL), + mComboShiny(NULL), + mComboBumpy(NULL), + mComboAlpha(NULL), + mCtrlTexScaleU(NULL), + mCtrlFlipTexScaleU(NULL), + mCtrlTexScaleV(NULL), + mCtrlFlipTexScaleV(NULL), + mCtrlTexRot(NULL), + mCtrlRpt(NULL), + mCtrlPlanar(NULL), + mCtrlTexOffsetU(NULL), + mCtrlTexOffsetV(NULL), + mBumpyScaleU(NULL), + mBumpyScaleV(NULL), + mBumpyRot(NULL), + mBumpyOffsetU(NULL), + mBumpyOffsetV(NULL), + mShinyScaleU(NULL), + mShinyScaleV(NULL), + mShinyRot(NULL), + mShinyOffsetU(NULL), + mShinyOffsetV(NULL), + mGlossyCtrl(NULL), + mEnvironmentCtrl(NULL), + mCtrlMaskCutoff(NULL), + mCtrlAlign(NULL), + mCtrlMapsSync(NULL), + mCtrlCopy(NULL), + mCtrlPaste(NULL), + mTextureCtrl(NULL), + mShinyTextureCtrl(NULL), + mBumpyTextureCtrl(NULL), + mColorSwatch(NULL), + mShinyColorSwatch(NULL), + mComboTexGen(NULL), + mComboMatMedia(NULL), + mComboMatType(NULL), + mCheckFullbright(NULL), + mLabelColorTransp(NULL), + mCtrlColorTransp(NULL), // transparency = 1 - alpha + mCtrlGlow(NULL), +// mIsAlpha(false) { USE_TEXTURE = LLTrans::getString("use_texture"); @@ -331,7 +404,6 @@ LLPanelFace::~LLPanelFace() void LLPanelFace::sendTexture() { - LLTextureCtrl* mTextureCtrl = getChild("texture control"); if(!mTextureCtrl) return; if( !mTextureCtrl->getTentative() ) { @@ -348,7 +420,7 @@ void LLPanelFace::sendTexture() void LLPanelFace::sendBump(U32 bumpiness) { - LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); + LLTextureCtrl* bumpytexture_ctrl = mBumpyTextureCtrl; if (bumpiness < BUMPY_TEXTURE) { LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; @@ -376,7 +448,6 @@ void LLPanelFace::sendBump(U32 bumpiness) void LLPanelFace::sendTexGen() { - LLComboBox* mComboTexGen = getChild("combobox texgen"); if(!mComboTexGen)return; U8 tex_gen = (U8) mComboTexGen->getCurrentIndex() << TEM_TEX_GEN_SHIFT; LLSelectMgr::getInstance()->selectionSetTexGen( tex_gen ); @@ -384,7 +455,7 @@ void LLPanelFace::sendTexGen() void LLPanelFace::sendShiny(U32 shininess) { - LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); + LLTextureCtrl* texture_ctrl = mShinyTextureCtrl; if (shininess < SHINY_TEXTURE) { @@ -408,7 +479,6 @@ void LLPanelFace::sendShiny(U32 shininess) void LLPanelFace::sendFullbright() { - LLCheckBoxCtrl* mCheckFullbright = getChild("checkbox fullbright"); if(!mCheckFullbright)return; U8 fullbright = mCheckFullbright->get() ? TEM_FULLBRIGHT_MASK : 0; LLSelectMgr::getInstance()->selectionSetFullbright( fullbright ); @@ -416,7 +486,6 @@ void LLPanelFace::sendFullbright() void LLPanelFace::sendColor() { - LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); if(!mColorSwatch)return; LLColor4 color = mColorSwatch->get(); @@ -425,7 +494,6 @@ void LLPanelFace::sendColor() void LLPanelFace::sendAlpha() { - LLSpinCtrl* mCtrlColorTransp = getChild("ColorTrans"); if(!mCtrlColorTransp)return; F32 alpha = (100.f - mCtrlColorTransp->get()) / 100.f; @@ -435,7 +503,6 @@ void LLPanelFace::sendAlpha() void LLPanelFace::sendGlow() { - LLSpinCtrl* mCtrlGlow = getChild("glow"); llassert(mCtrlGlow); if (mCtrlGlow) { @@ -451,12 +518,12 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor { BOOL valid; F32 value; - LLSpinCtrl* ctrlTexScaleS = mPanel->getChild("TexScaleU"); - LLSpinCtrl* ctrlTexScaleT = mPanel->getChild("TexScaleV"); - LLSpinCtrl* ctrlTexOffsetS = mPanel->getChild("TexOffsetU"); - LLSpinCtrl* ctrlTexOffsetT = mPanel->getChild("TexOffsetV"); - LLSpinCtrl* ctrlTexRotation = mPanel->getChild("TexRot"); - LLComboBox* comboTexGen = mPanel->getChild("combobox texgen"); + LLSpinCtrl* ctrlTexScaleS = mPanel->mCtrlTexScaleU; + LLSpinCtrl* ctrlTexScaleT = mPanel->mCtrlTexScaleV; + LLSpinCtrl* ctrlTexOffsetS = mPanel->mCtrlTexOffsetU; + LLSpinCtrl* ctrlTexOffsetT = mPanel->mCtrlTexOffsetV; + LLSpinCtrl* ctrlTexRotation = mPanel->mCtrlTexRot; + LLComboBox* comboTexGen = mPanel->mComboTexGen; llassert(comboTexGen); llassert(object); @@ -634,7 +701,7 @@ struct LLPanelFaceSendFunctor : public LLSelectedObjectFunctor void LLPanelFace::sendTextureInfo() { - if ((bool)childGetValue("checkbox planar align").asBoolean()) + if ((bool)mCtrlPlanar->getValue().asBoolean()) { LLFace* last_face = NULL; bool identical_face = false; @@ -668,17 +735,17 @@ void LLPanelFace::updateUI() BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); // only turn on auto-adjust button if there is a media renderer and the media is loaded - getChildView("button align")->setEnabled(editable); + mCtrlAlign->setEnabled(editable); bool enable_material_controls = (!gSavedSettings.getBOOL("FSSynchronizeTextureMaps")); S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) && (selected_count == 1); - getChildView("copytextures")->setEnabled(single_volume && editable); - getChildView("pastetextures")->setEnabled(editable); + mCtrlCopy->setEnabled(single_volume && editable); + mCtrlPaste->setEnabled(editable); - LLComboBox* combobox_matmedia = getChild("combobox matmedia"); + LLComboBox* combobox_matmedia = mComboMatMedia; if (combobox_matmedia) { if (combobox_matmedia->getCurrentIndex() < MATMEDIA_MATERIAL) @@ -686,13 +753,9 @@ void LLPanelFace::updateUI() combobox_matmedia->selectNthItem(MATMEDIA_MATERIAL); } } - else - { - LL_WARNS("Materials") << "failed getChild for 'combobox matmedia'" << LL_ENDL; - } - getChildView("combobox matmedia")->setEnabled(editable); + mComboMatMedia->setEnabled(editable); - LLComboBox* combobox_mattype = getChild("combobox mattype"); + LLComboBox* combobox_mattype = mComboMatType; if (combobox_mattype) { if (combobox_mattype->getCurrentIndex() < MATTYPE_DIFFUSE) @@ -700,11 +763,7 @@ void LLPanelFace::updateUI() combobox_mattype->selectNthItem(MATTYPE_DIFFUSE); } } - else - { - LL_WARNS("Materials") << "failed getChild for 'combobox mattype'" << LL_ENDL; - } - getChildView("combobox mattype")->setEnabled(editable); + mComboMatType->setEnabled(editable); updateVisibility(); @@ -713,11 +772,11 @@ void LLPanelFace::updateUI() bool identical_norm = false; bool identical_spec = false; - LLTextureCtrl* texture_ctrl = getChild("texture control"); + LLTextureCtrl* texture_ctrl = mTextureCtrl; texture_ctrl->setFallbackImageName( "" ); //Singu Note: Don't show the 'locked' image when the texid is null. - LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); + LLTextureCtrl* shinytexture_ctrl = mShinyTextureCtrl; shinytexture_ctrl->setFallbackImageName( "" ); //Singu Note: Don't show the 'locked' image when the texid is null. - LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); + LLTextureCtrl* bumpytexture_ctrl = mBumpyTextureCtrl; bumpytexture_ctrl->setFallbackImageName( "" ); //Singu Note: Don't show the 'locked' image when the texid is null. LLUUID id; @@ -726,9 +785,8 @@ void LLPanelFace::updateUI() // Color swatch { - getChildView("color label")->setEnabled(editable); + mLabelColor->setEnabled(editable); } - LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); LLColor4 color = LLColor4::white; bool identical_color =false; @@ -746,11 +804,11 @@ void LLPanelFace::updateUI() } // Color transparency - getChildView("color trans")->setEnabled(editable); + mLabelColorTransp->setEnabled(editable); F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; - getChild("ColorTrans")->setValue(editable ? transparency : 0); - getChildView("ColorTrans")->setEnabled(editable); + mCtrlColorTransp->setValue(editable ? transparency : 0); + mCtrlColorTransp->setEnabled(editable); // Specular map LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); @@ -764,28 +822,26 @@ void LLPanelFace::updateUI() shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE; - LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); - if (combobox_shininess) + if (mComboShiny) { - combobox_shininess->selectNthItem((S32)shiny); + mComboShiny->selectNthItem((S32)shiny); } - getChildView("label shininess")->setEnabled(editable); - getChildView("combobox shininess")->setEnabled(editable); + mLabelShiny->setEnabled(editable); + mComboShiny->setEnabled(editable); - getChildView("label glossiness")->setEnabled(editable); - getChildView("glossiness")->setEnabled(editable); + mLabelGlossy->setEnabled(editable); + mGlossyCtrl->setEnabled(editable); - getChildView("label environment")->setEnabled(editable); - getChildView("environment")->setEnabled(editable); - getChildView("label shinycolor")->setEnabled(editable); + mLabelEnvironment->setEnabled(editable); + mEnvironmentCtrl->setEnabled(editable); + mLabelShinyColor->setEnabled(editable); - getChild("combobox shininess")->setTentative(!identical_spec); - getChild("glossiness")->setTentative(!identical_spec); - getChild("environment")->setTentative(!identical_spec); - getChild("shinycolorswatch")->setTentative(!identical_spec); + mComboShiny->setTentative(!identical_spec); + mGlossyCtrl->setTentative(!identical_spec); + mEnvironmentCtrl->setTentative(!identical_spec); + mShinyColorSwatch->setTentative(!identical_spec); - LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch"); if(mShinyColorSwatch) { mShinyColorSwatch->setValid(editable); @@ -800,7 +856,7 @@ void LLPanelFace::updateUI() LLSelectedTE::getBumpmap(bumpy,identical_bumpy); LLUUID norm_map_id = getCurrentNormalMap(); - LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); + LLCtrlSelectionInterface* combobox_bumpiness = mComboBumpy; bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE; @@ -808,14 +864,10 @@ void LLPanelFace::updateUI() { combobox_bumpiness->selectNthItem((S32)bumpy); } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; - } - getChildView("combobox bumpiness")->setEnabled(editable); - getChild("combobox bumpiness")->setTentative(!identical_bumpy); - getChildView("label bumpiness")->setEnabled(editable); + mComboBumpy->setEnabled(editable); + mComboBumpy->setTentative(!identical_bumpy); + mLabelBumpy->setEnabled(editable); } // Texture @@ -850,7 +902,7 @@ void LLPanelFace::updateUI() if(LLViewerMedia::textureHasMedia(id)) { - getChildView("button align")->setEnabled(editable); + mCtrlAlign->setEnabled(editable); } // Diffuse Alpha Mode @@ -865,7 +917,7 @@ void LLPanelFace::updateUI() // LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(alpha_mode, identical_alpha_mode, mIsAlpha); - LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); + LLCtrlSelectionInterface* combobox_alphamode = mComboAlpha; if (combobox_alphamode) { //it is invalid to have any alpha mode other than blend if transparency is greater than zero ... @@ -877,10 +929,6 @@ void LLPanelFace::updateUI() combobox_alphamode->selectNthItem(alpha_mode); } - else - { - LL_WARNS("Materials") << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL; - } updateAlphaControls(); @@ -891,10 +939,10 @@ void LLPanelFace::updateUI() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); - getChildView("label alphamode")->setEnabled(editable && mIsAlpha); - getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); - getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); + mComboAlpha->setEnabled(editable && mIsAlpha && transparency <= 0.f); + mLabelAlphaMode->setEnabled(editable && mIsAlpha); + mCtrlMaskCutoff->setEnabled(editable && mIsAlpha); + mLabelMaskCutoff->setEnabled(editable && mIsAlpha); } else if (id.isNull()) { @@ -902,10 +950,10 @@ void LLPanelFace::updateUI() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( FALSE ); texture_ctrl->setImageAssetID( LLUUID::null ); - getChildView("combobox alphamode")->setEnabled( FALSE ); - getChildView("label alphamode")->setEnabled( FALSE ); - getChildView("maskcutoff")->setEnabled( FALSE); - getChildView("label maskcutoff")->setEnabled( FALSE ); + mComboAlpha->setEnabled( FALSE ); + mLabelAlphaMode->setEnabled( FALSE ); + mCtrlMaskCutoff->setEnabled( FALSE); + mLabelMaskCutoff->setEnabled( FALSE ); } else { @@ -913,10 +961,10 @@ void LLPanelFace::updateUI() texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); - getChildView("label alphamode")->setEnabled(editable && mIsAlpha); - getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); - getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); + mComboAlpha->setEnabled(editable && mIsAlpha && transparency <= 0.f); + mLabelAlphaMode->setEnabled(editable && mIsAlpha); + mCtrlMaskCutoff->setEnabled(editable && mIsAlpha); + mLabelMaskCutoff->setEnabled(editable && mIsAlpha); } } @@ -969,12 +1017,12 @@ void LLPanelFace::updateUI() bool align_planar = false; bool identical_planar_aligned = false; { - LLCheckBoxCtrl* cb_planar_align = getChild("checkbox planar align"); - align_planar = (cb_planar_align && cb_planar_align->get()); + LLUICtrl* cb_planar_align = mCtrlPlanar; + align_planar = (cb_planar_align && cb_planar_align->getValue().asBoolean()); bool enabled = (editable && isIdenticalPlanarTexgen()); - childSetValue("checkbox planar align", align_planar && enabled); - childSetEnabled("checkbox planar align", enabled); + mCtrlPlanar->setValue(align_planar && enabled); + mCtrlPlanar->setEnabled(enabled); if (align_planar && enabled) { @@ -1026,26 +1074,26 @@ void LLPanelFace::updateUI() spec_scale_s = editable ? spec_scale_s : 1.0f; spec_scale_s *= identical_planar_texgen ? 2.0f : 1.0f; - getChild("TexScaleU")->setValue(diff_scale_s); - getChild("shinyScaleU")->setValue(spec_scale_s); - getChild("bumpyScaleU")->setValue(norm_scale_s); + mCtrlTexScaleU->setValue(diff_scale_s); + mShinyScaleU->setValue(spec_scale_s); + mBumpyScaleU->setValue(norm_scale_s); - getChildView("TexScaleU")->setEnabled(editable); - getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull() + mCtrlTexScaleU->setEnabled(editable); + mShinyScaleU->setEnabled(editable && specmap_id.notNull() && enable_material_controls); // Materials alignment - getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull() + mBumpyScaleU->setEnabled(editable && normmap_id.notNull() && enable_material_controls); // Materials alignment BOOL diff_scale_tentative = !(identical && identical_diff_scale_s); BOOL norm_scale_tentative = !(identical && identical_norm_scale_s); BOOL spec_scale_tentative = !(identical && identical_spec_scale_s); - getChild("TexScaleU")->setTentative( LLSD(diff_scale_tentative)); - getChild("shinyScaleU")->setTentative(LLSD(spec_scale_tentative)); - getChild("bumpyScaleU")->setTentative(LLSD(norm_scale_tentative)); + mCtrlTexScaleU->setTentative( LLSD(diff_scale_tentative)); + mShinyScaleU->setTentative(LLSD(spec_scale_tentative)); + mBumpyScaleU->setTentative(LLSD(norm_scale_tentative)); // FIRE-11407 - Materials alignment - getChildView("checkbox maps sync")->setEnabled(editable && (specmap_id.notNull() || normmap_id.notNull())); + mCtrlMapsSync->setEnabled(editable && (specmap_id.notNull() || normmap_id.notNull())); // } @@ -1075,19 +1123,19 @@ void LLPanelFace::updateUI() BOOL norm_scale_tentative = !identical_norm_scale_t; BOOL spec_scale_tentative = !identical_spec_scale_t; - getChildView("TexScaleV")->setEnabled(editable); - getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull() + mCtrlTexScaleV->setEnabled(editable); + mShinyScaleV->setEnabled(editable && specmap_id.notNull() && enable_material_controls); // Materials alignment - getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull() + mBumpyScaleV->setEnabled(editable && normmap_id.notNull() && enable_material_controls); // Materials alignment - getChild("TexScaleV")->setValue(diff_scale_t); - getChild("shinyScaleV")->setValue(norm_scale_t); - getChild("bumpyScaleV")->setValue(spec_scale_t); + mCtrlTexScaleV->setValue(diff_scale_t); + mShinyScaleV->setValue(norm_scale_t); + mBumpyScaleV->setValue(spec_scale_t); - getChild("TexScaleV")->setTentative(LLSD(diff_scale_tentative)); - getChild("shinyScaleV")->setTentative(LLSD(norm_scale_tentative)); - getChild("bumpyScaleV")->setTentative(LLSD(spec_scale_tentative)); + mCtrlTexScaleV->setTentative(LLSD(diff_scale_tentative)); + mShinyScaleV->setTentative(LLSD(norm_scale_tentative)); + mBumpyScaleV->setTentative(LLSD(spec_scale_tentative)); } // Texture offset @@ -1108,18 +1156,18 @@ void LLPanelFace::updateUI() BOOL norm_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_s); BOOL spec_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_s); - getChild("TexOffsetU")->setValue( editable ? diff_offset_s : 0.0f); - getChild("bumpyOffsetU")->setValue(editable ? norm_offset_s : 0.0f); - getChild("shinyOffsetU")->setValue(editable ? spec_offset_s : 0.0f); + mCtrlTexOffsetU->setValue( editable ? diff_offset_s : 0.0f); + mBumpyOffsetU->setValue(editable ? norm_offset_s : 0.0f); + mShinyOffsetU->setValue(editable ? spec_offset_s : 0.0f); - getChild("TexOffsetU")->setTentative(LLSD(diff_offset_u_tentative)); - getChild("shinyOffsetU")->setTentative(LLSD(norm_offset_u_tentative)); - getChild("bumpyOffsetU")->setTentative(LLSD(spec_offset_u_tentative)); + mCtrlTexOffsetU->setTentative(LLSD(diff_offset_u_tentative)); + mShinyOffsetU->setTentative(LLSD(norm_offset_u_tentative)); + mBumpyOffsetU->setTentative(LLSD(spec_offset_u_tentative)); - getChildView("TexOffsetU")->setEnabled(editable); - getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull() + mCtrlTexOffsetU->setEnabled(editable); + mShinyOffsetU->setEnabled(editable && specmap_id.notNull() && enable_material_controls); // Materials alignment - getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull() + mBumpyOffsetU->setEnabled(editable && normmap_id.notNull() && enable_material_controls); // Materials alignment } @@ -1140,18 +1188,18 @@ void LLPanelFace::updateUI() BOOL norm_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_t); BOOL spec_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_t); - getChild("TexOffsetV")->setValue( editable ? diff_offset_t : 0.0f); - getChild("bumpyOffsetV")->setValue(editable ? norm_offset_t : 0.0f); - getChild("shinyOffsetV")->setValue(editable ? spec_offset_t : 0.0f); + mCtrlTexOffsetV->setValue( editable ? diff_offset_t : 0.0f); + mBumpyOffsetV->setValue(editable ? norm_offset_t : 0.0f); + mShinyOffsetV->setValue(editable ? spec_offset_t : 0.0f); - getChild("TexOffsetV")->setTentative(LLSD(diff_offset_v_tentative)); - getChild("shinyOffsetV")->setTentative(LLSD(norm_offset_v_tentative)); - getChild("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative)); + mCtrlTexOffsetV->setTentative(LLSD(diff_offset_v_tentative)); + mShinyOffsetV->setTentative(LLSD(norm_offset_v_tentative)); + mBumpyOffsetV->setTentative(LLSD(spec_offset_v_tentative)); - getChildView("TexOffsetV")->setEnabled(editable); - getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull() + mCtrlTexOffsetV->setEnabled(editable); + mShinyOffsetV->setEnabled(editable && specmap_id.notNull() && enable_material_controls); // Materials alignment - getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull() + mBumpyOffsetV->setEnabled(editable && normmap_id.notNull() && enable_material_controls); // Materials alignment } @@ -1177,47 +1225,44 @@ void LLPanelFace::updateUI() F32 norm_rot_deg = norm_rotation * RAD_TO_DEG; F32 spec_rot_deg = spec_rotation * RAD_TO_DEG; - getChildView("TexRot")->setEnabled(editable); - getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull() + mCtrlTexRot->setEnabled(editable); + mShinyRot->setEnabled(editable && specmap_id.notNull() && enable_material_controls); // Materials alignment - getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull() + mBumpyRot->setEnabled(editable && normmap_id.notNull() && enable_material_controls); // Materials alignment - getChild("TexRot")->setTentative(diff_rot_tentative); - getChild("shinyRot")->setTentative(LLSD(norm_rot_tentative)); - getChild("bumpyRot")->setTentative(LLSD(spec_rot_tentative)); + mCtrlTexRot->setTentative(diff_rot_tentative); + mShinyRot->setTentative(LLSD(norm_rot_tentative)); + mBumpyRot->setTentative(LLSD(spec_rot_tentative)); - getChild("TexRot")->setValue( editable ? diff_rot_deg : 0.0f); - getChild("shinyRot")->setValue(editable ? spec_rot_deg : 0.0f); - getChild("bumpyRot")->setValue(editable ? norm_rot_deg : 0.0f); + mCtrlTexRot->setValue( editable ? diff_rot_deg : 0.0f); + mShinyRot->setValue(editable ? spec_rot_deg : 0.0f); + mBumpyRot->setValue(editable ? norm_rot_deg : 0.0f); } { F32 glow = 0.f; bool identical_glow = false; LLSelectedTE::getGlow(glow,identical_glow); - getChild("glow")->setValue(glow); - getChild("glow")->setTentative(!identical_glow); - getChildView("glow")->setEnabled(editable); - getChildView("glow label")->setEnabled(editable); + mCtrlGlow->setValue(glow); + mCtrlGlow->setTentative(!identical_glow); + mCtrlGlow->setEnabled(editable); + mLabelGlow->setEnabled(editable); } { - LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); + LLCtrlSelectionInterface* combobox_texgen = mComboTexGen; if (combobox_texgen) { // Maps from enum to combobox entry index combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1); } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox texgen'" << llendl; - } - getChildView("combobox texgen")->setEnabled(editable); - getChild("combobox texgen")->setTentative(!identical); - getChildView("tex gen")->setEnabled(editable); + mComboTexGen->setEnabled(editable); + mComboTexGen->setTentative(!identical); + mLabelTexGen->setEnabled(editable); + /* Singu Note: Dead code if (selected_texgen == LLTextureEntry::TEX_GEN_PLANAR) { // EXP-1507 (change label based on the mapping mode) @@ -1228,6 +1273,7 @@ void LLPanelFace::updateUI() { getChild("rpt")->setValue(getString("string repeats per face")); } + */ } { @@ -1236,9 +1282,9 @@ void LLPanelFace::updateUI() LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright); - getChild("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); - getChildView("checkbox fullbright")->setEnabled(editable); - getChild("checkbox fullbright")->setTentative(!identical_fullbright); + mCheckFullbright->setValue((S32)(fullbright_flag != 0)); + mCheckFullbright->setEnabled(editable); + mCheckFullbright->setTentative(!identical_fullbright); } @@ -1256,7 +1302,6 @@ void LLPanelFace::updateUI() LLSelectedTEMaterial::getMaxNormalRepeats(repeats_norm, identical_norm_repeats); LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats); - LLComboBox* mComboTexGen = getChild("combobox texgen"); if (mComboTexGen) { S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; @@ -1300,13 +1345,13 @@ void LLPanelFace::updateUI() BOOL repeats_tentative = !identical_repeats; - getChildView("rptctrl")->setEnabled(identical_planar_texgen ? FALSE : enabled); - getChild("rptctrl")->setValue(editable ? repeats : 1.0f); - getChild("rptctrl")->setTentative(LLSD(repeats_tentative)); + mCtrlRpt->setEnabled(identical_planar_texgen ? FALSE : enabled); + mCtrlRpt->setValue(editable ? repeats : 1.0f); + mCtrlRpt->setTentative(LLSD(repeats_tentative)); // FIRE-11407 - Flip buttons - getChildView("flipTextureScaleU")->setEnabled(enabled); - getChildView("flipTextureScaleV")->setEnabled(enabled); + mCtrlFlipTexScaleU->setEnabled(enabled); + mCtrlFlipTexScaleV->setEnabled(enabled); // } } @@ -1318,11 +1363,11 @@ void LLPanelFace::updateUI() if (material && editable) { - LL_DEBUGS("Materials: OnMatererialsLoaded:") << material->asLLSD() << LL_ENDL; + LL_DEBUGS("Materials: OnMaterialsLoaded:") << material->asLLSD() << LL_ENDL; // Alpha LLCtrlSelectionInterface* combobox_alphamode = - childGetSelectionInterface("combobox alphamode"); + mComboAlpha; if (combobox_alphamode) { U32 alpha_mode = material->getDiffuseAlphaMode(); @@ -1339,18 +1384,14 @@ void LLPanelFace::updateUI() combobox_alphamode->selectNthItem(alpha_mode); } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; - } - getChild("maskcutoff")->setValue(material->getAlphaMaskCutoff()); + mCtrlMaskCutoff->setValue(material->getAlphaMaskCutoff()); updateAlphaControls(); identical_planar_texgen = isIdenticalPlanarTexgen(); // Shiny (specular) F32 offset_x, offset_y, repeat_x, repeat_y, rot; - LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); + LLTextureCtrl* texture_ctrl = mShinyTextureCtrl; texture_ctrl->setImageAssetID(material->getSpecularID()); if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE)) @@ -1365,13 +1406,13 @@ void LLPanelFace::updateUI() } rot = material->getSpecularRotation(); - getChild("shinyScaleU")->setValue(repeat_x); - getChild("shinyScaleV")->setValue(repeat_y); - getChild("shinyRot")->setValue(rot*RAD_TO_DEG); - getChild("shinyOffsetU")->setValue(offset_x); - getChild("shinyOffsetV")->setValue(offset_y); - getChild("glossiness")->setValue(material->getSpecularLightExponent()); - getChild("environment")->setValue(material->getEnvironmentIntensity()); + mShinyScaleU->setValue(repeat_x); + mShinyScaleV->setValue(repeat_y); + mShinyRot->setValue(rot*RAD_TO_DEG); + mShinyOffsetU->setValue(offset_x); + mShinyOffsetV->setValue(offset_y); + mGlossyCtrl->setValue(material->getSpecularLightExponent()); + mEnvironmentCtrl->setValue(material->getEnvironmentIntensity()); updateShinyControls(!material->getSpecularID().isNull(), true); } @@ -1381,12 +1422,12 @@ void LLPanelFace::updateUI() // if (!material->getSpecularID().isNull()) { - getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); - getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); + mShinyColorSwatch->setOriginal(material->getSpecularLightColor()); + mShinyColorSwatch->set(material->getSpecularLightColor(),TRUE); } // Bumpy (normal) - texture_ctrl = getChild("bumpytexture control"); + texture_ctrl = mBumpyTextureCtrl; texture_ctrl->setImageAssetID(material->getNormalID()); if (!material->getNormalID().isNull()) @@ -1401,11 +1442,11 @@ void LLPanelFace::updateUI() } rot = material->getNormalRotation(); - getChild("bumpyScaleU")->setValue(repeat_x); - getChild("bumpyScaleV")->setValue(repeat_y); - getChild("bumpyRot")->setValue(rot*RAD_TO_DEG); - getChild("bumpyOffsetU")->setValue(offset_x); - getChild("bumpyOffsetV")->setValue(offset_y); + mBumpyScaleU->setValue(repeat_x); + mBumpyScaleV->setValue(repeat_y); + mBumpyRot->setValue(rot*RAD_TO_DEG); + mBumpyOffsetU->setValue(offset_x); + mBumpyOffsetV->setValue(offset_y); updateBumpyControls(!material->getNormalID().isNull(), true); } @@ -1414,13 +1455,13 @@ void LLPanelFace::updateUI() // Set variable values for numeric expressions LLCalc* calcp = LLCalc::getInstance(); - calcp->setVar(LLCalc::TEX_U_SCALE, childGetValue("TexScaleU").asReal()); - calcp->setVar(LLCalc::TEX_V_SCALE, childGetValue("TexScaleV").asReal()); - calcp->setVar(LLCalc::TEX_U_OFFSET, childGetValue("TexOffsetU").asReal()); - calcp->setVar(LLCalc::TEX_V_OFFSET, childGetValue("TexOffsetV").asReal()); - calcp->setVar(LLCalc::TEX_ROTATION, childGetValue("TexRot").asReal()); - calcp->setVar(LLCalc::TEX_TRANSPARENCY, childGetValue("ColorTrans").asReal()); - calcp->setVar(LLCalc::TEX_GLOW, childGetValue("glow").asReal()); + calcp->setVar(LLCalc::TEX_U_SCALE, mCtrlTexScaleU->getValue().asReal()); + calcp->setVar(LLCalc::TEX_V_SCALE, mCtrlTexScaleV->getValue().asReal()); + calcp->setVar(LLCalc::TEX_U_OFFSET, mCtrlTexOffsetU->getValue().asReal()); + calcp->setVar(LLCalc::TEX_V_OFFSET, mCtrlTexOffsetV->getValue().asReal()); + calcp->setVar(LLCalc::TEX_ROTATION, mCtrlTexRot->getValue().asReal()); + calcp->setVar(LLCalc::TEX_TRANSPARENCY, mCtrlColorTransp->getValue().asReal()); + calcp->setVar(LLCalc::TEX_GLOW, mCtrlGlow->getValue().asReal()); } else { @@ -1428,27 +1469,28 @@ void LLPanelFace::updateUI() clearCtrls(); // Disable non-UICtrls - LLTextureCtrl* texture_ctrl = getChild("texture control"); + LLTextureCtrl* texture_ctrl = mTextureCtrl; if(texture_ctrl) { texture_ctrl->setImageAssetID( LLUUID::null ); texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. // texture_ctrl->setValid(FALSE); } - LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); if(mColorSwatch) { mColorSwatch->setEnabled( FALSE ); mColorSwatch->setFallbackImageName("locked_image.j2c" ); mColorSwatch->setValid(FALSE); } - getChildView("color trans")->setEnabled(FALSE); + mLabelColorTransp->setEnabled(FALSE); + /* Singu Note: This is missing in xml getChildView("rpt")->setEnabled(FALSE); getChildView("tex offset")->setEnabled(FALSE); - getChildView("tex gen")->setEnabled(FALSE); - getChildView("label shininess")->setEnabled(FALSE); - getChildView("label bumpiness")->setEnabled(FALSE); - getChildView("button align")->setEnabled(FALSE); + */ + mLabelTexGen->setEnabled(FALSE); + mLabelShiny->setEnabled(FALSE); + mLabelBumpy->setEnabled(FALSE); + mCtrlAlign->setEnabled(FALSE); //getChildView("has media")->setEnabled(FALSE); //getChildView("media info set")->setEnabled(FALSE); @@ -1484,19 +1526,9 @@ F32 LLPanelFace::valueGlow(LLViewerObject* object, S32 face) } -void LLPanelFace::onCommitColor(const LLSD& data) -{ - sendColor(); -} - void LLPanelFace::onCommitShinyColor(const LLSD& data) { - LLSelectedTEMaterial::setSpecularLightColor(this, getChild("shinycolorswatch")->get()); -} - -void LLPanelFace::onCommitAlpha(const LLSD& data) -{ - sendAlpha(); + LLSelectedTEMaterial::setSpecularLightColor(this, mShinyColorSwatch->get()); } void LLPanelFace::onCancelColor(const LLSD& data) @@ -1510,25 +1542,23 @@ void LLPanelFace::onSelectColor(const LLSD& data) sendColor(); } -// static -void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialsMedia() { - LLPanelFace* self = (LLPanelFace*) userdata; // Force to default states to side-step problems with menu contents // and generally reflecting old state when switching tabs or objects // - self->updateShinyControls(false,true); - self->updateBumpyControls(false,true); - self->updateUI(); + updateShinyControls(false,true); + updateBumpyControls(false,true); + updateUI(); } // static void LLPanelFace::updateVisibility() { - LLComboBox* combo_matmedia = getChild("combobox matmedia"); - LLComboBox* combo_mattype = getChild("combobox mattype"); - LLComboBox* combo_shininess = getChild("combobox shininess"); - LLComboBox* combo_bumpiness = getChild("combobox bumpiness"); + LLComboBox* combo_matmedia = mComboMatMedia; + LLComboBox* combo_mattype = mComboMatType; + LLComboBox* combo_shininess = mComboShiny; + LLComboBox* combo_bumpiness = mComboBumpy; if (!combo_mattype || !combo_matmedia || !combo_shininess || !combo_bumpiness) { LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL; @@ -1540,70 +1570,70 @@ void LLPanelFace::updateVisibility() bool show_texture = (show_media || ((material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled())); bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && combo_matmedia->getEnabled(); bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); - getChildView("combobox mattype")->setVisible(!show_media); + mComboMatType->setVisible(!show_media); // FIRE-11407 - Be consistant and hide this with the other controls - //getChildView("rptctrl")->setVisible(true); - getChildView("rptctrl")->setVisible(combo_matmedia->getEnabled()); + //mCtrlRpt->setVisible(true); + mCtrlRpt->setVisible(combo_matmedia->getEnabled()); // and other additions... - getChildView("flipTextureScaleU")->setVisible(combo_matmedia->getEnabled()); - getChildView("flipTextureScaleV")->setVisible(combo_matmedia->getEnabled()); + mCtrlFlipTexScaleU->setVisible(combo_matmedia->getEnabled()); + mCtrlFlipTexScaleV->setVisible(combo_matmedia->getEnabled()); // // Media controls - getChildView("media_info")->setVisible(show_media); - getChildView("add_media")->setVisible(show_media); - getChildView("delete_media")->setVisible(show_media); - getChildView("button align")->setVisible(show_media); + mMediaInfo->setVisible(show_media); + mMediaAdd->setVisible(show_media); + mMediaDelete->setVisible(show_media); + mCtrlAlign->setVisible(show_media); // Diffuse texture controls - getChildView("texture control")->setVisible(show_texture && !show_media); - getChildView("label alphamode")->setVisible(show_texture && !show_media); - getChildView("combobox alphamode")->setVisible(show_texture && !show_media); - getChildView("label maskcutoff")->setVisible(false); - getChildView("maskcutoff")->setVisible(false); + mTextureCtrl->setVisible(show_texture && !show_media); + mLabelAlphaMode->setVisible(show_texture && !show_media); + mComboAlpha->setVisible(show_texture && !show_media); + mLabelMaskCutoff->setVisible(false); + mCtrlMaskCutoff->setVisible(false); if (show_texture && !show_media) { updateAlphaControls(); } - getChildView("TexScaleU")->setVisible(show_texture); - getChildView("TexScaleV")->setVisible(show_texture); - getChildView("TexRot")->setVisible(show_texture); - getChildView("TexOffsetU")->setVisible(show_texture); - getChildView("TexOffsetV")->setVisible(show_texture); + mCtrlTexScaleU->setVisible(show_texture); + mCtrlTexScaleV->setVisible(show_texture); + mCtrlTexRot->setVisible(show_texture); + mCtrlTexOffsetU->setVisible(show_texture); + mCtrlTexOffsetV->setVisible(show_texture); // Specular map controls - getChildView("shinytexture control")->setVisible(show_shininess); - getChildView("combobox shininess")->setVisible(show_shininess); - getChildView("label shininess")->setVisible(show_shininess); - getChildView("label glossiness")->setVisible(false); - getChildView("glossiness")->setVisible(false); - getChildView("label environment")->setVisible(false); - getChildView("environment")->setVisible(false); - getChildView("label shinycolor")->setVisible(false); - getChildView("shinycolorswatch")->setVisible(false); + mShinyTextureCtrl->setVisible(show_shininess); + mComboShiny->setVisible(show_shininess); + mLabelShiny->setVisible(show_shininess); + mLabelGlossy->setVisible(false); + mGlossyCtrl->setVisible(false); + mLabelEnvironment->setVisible(false); + mEnvironmentCtrl->setVisible(false); + mLabelShinyColor->setVisible(false); + mShinyColorSwatch->setVisible(false); if (show_shininess) { updateShinyControls(); } - getChildView("shinyScaleU")->setVisible(show_shininess); - getChildView("shinyScaleV")->setVisible(show_shininess); - getChildView("shinyRot")->setVisible(show_shininess); - getChildView("shinyOffsetU")->setVisible(show_shininess); - getChildView("shinyOffsetV")->setVisible(show_shininess); + mShinyScaleU->setVisible(show_shininess); + mShinyScaleV->setVisible(show_shininess); + mShinyRot->setVisible(show_shininess); + mShinyOffsetU->setVisible(show_shininess); + mShinyOffsetV->setVisible(show_shininess); // Normal map controls if (show_bumpiness) { updateBumpyControls(); } - getChildView("bumpytexture control")->setVisible(show_bumpiness); - getChildView("combobox bumpiness")->setVisible(show_bumpiness); - getChildView("label bumpiness")->setVisible(show_bumpiness); - getChildView("bumpyScaleU")->setVisible(show_bumpiness); - getChildView("bumpyScaleV")->setVisible(show_bumpiness); - getChildView("bumpyRot")->setVisible(show_bumpiness); - getChildView("bumpyOffsetU")->setVisible(show_bumpiness); - getChildView("bumpyOffsetV")->setVisible(show_bumpiness); + mBumpyTextureCtrl->setVisible(show_bumpiness); + mComboBumpy->setVisible(show_bumpiness); + mLabelBumpy->setVisible(show_bumpiness); + mBumpyScaleU->setVisible(show_bumpiness); + mBumpyScaleV->setVisible(show_bumpiness); + mBumpyRot->setVisible(show_bumpiness); + mBumpyOffsetU->setVisible(show_bumpiness); + mBumpyOffsetV->setVisible(show_bumpiness); } void LLPanelFace::onCommitMaterialType() @@ -1616,33 +1646,12 @@ void LLPanelFace::onCommitMaterialType() updateUI(); } -// static -void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - - LLComboBox* mComboBumpiness = self->getChild("combobox bumpiness"); - if(!mComboBumpiness) - return; - - U32 bumpiness = mComboBumpiness->getCurrentIndex(); - - self->sendBump(bumpiness); -} - -// static -void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendTexGen(); -} - void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_shiny_combobox) { - LLTextureCtrl* texture_ctrl = getChild("shinytexture control"); + LLTextureCtrl* texture_ctrl = mShinyTextureCtrl; LLUUID shiny_texture_ID = texture_ctrl->getImageAssetID(); LL_DEBUGS("Materials") << "Shiny texture selected: " << shiny_texture_ID << LL_ENDL; - LLComboBox* comboShiny = getChild("combobox shininess"); + LLComboBox* comboShiny = mComboShiny; if(mess_with_shiny_combobox) { @@ -1668,28 +1677,28 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh } } - LLComboBox* combo_matmedia = getChild("combobox matmedia"); - LLComboBox* combo_mattype = getChild("combobox mattype"); + LLComboBox* combo_matmedia = mComboMatMedia; + LLComboBox* combo_mattype =mComboMatType; U32 materials_media = combo_matmedia->getCurrentIndex(); U32 material_type = combo_mattype->getCurrentIndex(); bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); U32 shiny_value = comboShiny->getCurrentIndex(); bool show_shinyctrls = (shiny_value == SHINY_TEXTURE) && show_shininess; // Use texture - getChildView("label glossiness")->setVisible(show_shinyctrls); - getChildView("glossiness")->setVisible(show_shinyctrls); - getChildView("label environment")->setVisible(show_shinyctrls); - getChildView("environment")->setVisible(show_shinyctrls); - getChildView("label shinycolor")->setVisible(show_shinyctrls); - getChildView("shinycolorswatch")->setVisible(show_shinyctrls); + mLabelGlossy->setVisible(show_shinyctrls); + mGlossyCtrl->setVisible(show_shinyctrls); + mLabelEnvironment->setVisible(show_shinyctrls); + mEnvironmentCtrl->setVisible(show_shinyctrls); + mLabelShinyColor->setVisible(show_shinyctrls); + mShinyColorSwatch->setVisible(show_shinyctrls); } void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_combobox) { - LLTextureCtrl* texture_ctrl = getChild("bumpytexture control"); + LLTextureCtrl* texture_ctrl = mBumpyTextureCtrl; LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; - LLComboBox* comboBumpy = getChild("combobox bumpiness"); + LLComboBox* comboBumpy = mComboBumpy; if (!comboBumpy) { return; @@ -1697,7 +1706,7 @@ void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_co if (mess_with_combobox) { - LLTextureCtrl* texture_ctrl = getChild("bumpytexture control"); + LLTextureCtrl* texture_ctrl = mBumpyTextureCtrl; LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; @@ -1720,25 +1729,9 @@ void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_co } } -// static -void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - - - LLComboBox* mComboShininess = self->getChild("combobox shininess"); - if(!mComboShininess) - return; - - U32 shininess = mComboShininess->getCurrentIndex(); - - self->sendShiny(shininess); -} - -// static void LLPanelFace::updateAlphaControls() { - LLComboBox* comboAlphaMode = getChild("combobox alphamode"); + LLComboBox* comboAlphaMode = mComboAlpha; if (!comboAlphaMode) { return; @@ -1746,14 +1739,14 @@ void LLPanelFace::updateAlphaControls() U32 alpha_value = comboAlphaMode->getCurrentIndex(); bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking - LLComboBox* combobox_matmedia = getChild("combobox matmedia"); + LLComboBox* combobox_matmedia = mComboMatMedia; U32 mat_media = MATMEDIA_MATERIAL; if (combobox_matmedia) { mat_media = combobox_matmedia->getCurrentIndex(); } - LLComboBox* combobox_mattype = getChild("combobox mattype"); + LLComboBox* combobox_mattype = mComboMatType; U32 mat_type = MATTYPE_DIFFUSE; if (combobox_mattype) { @@ -1763,30 +1756,14 @@ void LLPanelFace::updateAlphaControls() show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL); show_alphactrls = show_alphactrls && (mat_type == MATTYPE_DIFFUSE); - getChildView("label maskcutoff")->setVisible(show_alphactrls); - getChildView("maskcutoff")->setVisible(show_alphactrls); + mLabelMaskCutoff->setVisible(show_alphactrls); + mCtrlMaskCutoff->setVisible(show_alphactrls); } -// static -void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitAlphaMode() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->updateAlphaControls(); - LLSelectedTEMaterial::setDiffuseAlphaMode(self,self->getCurrentDiffuseAlphaMode()); -} - -// static -void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendFullbright(); -} - -// static -void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendGlow(); + updateAlphaControls(); + LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode()); } // static @@ -1828,7 +1805,7 @@ void LLPanelFace::onSelectTexture(const LLSD& data) LLSelectedTE::getImageFormat(image_format, identical_image_format); LLCtrlSelectionInterface* combobox_alphamode = - childGetSelectionInterface("combobox alphamode"); + mComboAlpha; U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; if (combobox_alphamode) @@ -1879,7 +1856,7 @@ void LLPanelFace::onCancelSpecularTexture(const LLSD& data) U8 shiny = 0; bool identical_shiny = false; LLSelectedTE::getShiny(shiny, identical_shiny); - LLUUID spec_map_id = getChild("shinytexture control")->getImageAssetID(); + LLUUID spec_map_id = mShinyTextureCtrl->getImageAssetID(); shiny = spec_map_id.isNull() ? shiny : SHINY_TEXTURE; sendShiny(shiny); } @@ -1905,151 +1882,72 @@ void LLPanelFace::onSelectNormalTexture(const LLSD& data) sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE); } -//static -void LLPanelFace::onCommitMaterialBumpyOffsetX(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyScaleX(const LLSD& value) { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setNormalOffsetX(self,self->getCurrentBumpyOffsetU()); -} - -//static -void LLPanelFace::onCommitMaterialBumpyOffsetY(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setNormalOffsetY(self,self->getCurrentBumpyOffsetV()); -} - -//static -void LLPanelFace::onCommitMaterialShinyOffsetX(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setSpecularOffsetX(self,self->getCurrentShinyOffsetU()); -} - -//static -void LLPanelFace::onCommitMaterialShinyOffsetY(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setSpecularOffsetY(self,self->getCurrentShinyOffsetV()); -} - -//static -void LLPanelFace::onCommitMaterialBumpyScaleX(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 bumpy_scale_u = self->getCurrentBumpyScaleU(); - if (self->isIdenticalPlanarTexgen()) + F32 bumpy_scale_u = value.asReal(); + if (isIdenticalPlanarTexgen()) { bumpy_scale_u *= 0.5f; } - LLSelectedTEMaterial::setNormalRepeatX(self,bumpy_scale_u); + LLSelectedTEMaterial::setNormalRepeatX(this, bumpy_scale_u); } -//static -void LLPanelFace::onCommitMaterialBumpyScaleY(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyScaleY(const LLSD& value) { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 bumpy_scale_v = self->getCurrentBumpyScaleV(); - if (self->isIdenticalPlanarTexgen()) + F32 bumpy_scale_v = value.asReal(); + if (isIdenticalPlanarTexgen()) { bumpy_scale_v *= 0.5f; } - LLSelectedTEMaterial::setNormalRepeatY(self,bumpy_scale_v); + LLSelectedTEMaterial::setNormalRepeatY(this, bumpy_scale_v); } -//static -void LLPanelFace::onCommitMaterialShinyScaleX(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyScaleX(const LLSD& value) { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 shiny_scale_u = self->getCurrentShinyScaleU(); - if (self->isIdenticalPlanarTexgen()) + F32 shiny_scale_u = value.asReal(); + if (isIdenticalPlanarTexgen()) { shiny_scale_u *= 0.5f; } - LLSelectedTEMaterial::setSpecularRepeatX(self,shiny_scale_u); + LLSelectedTEMaterial::setSpecularRepeatX(this, shiny_scale_u); } -//static -void LLPanelFace::onCommitMaterialShinyScaleY(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyScaleY(const LLSD& value) { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - F32 shiny_scale_v = self->getCurrentShinyScaleV(); - if (self->isIdenticalPlanarTexgen()) + F32 shiny_scale_v = value.asReal(); + if (isIdenticalPlanarTexgen()) { shiny_scale_v *= 0.5f; } - LLSelectedTEMaterial::setSpecularRepeatY(self,shiny_scale_v); + LLSelectedTEMaterial::setSpecularRepeatY(this, shiny_scale_v); } -//static -void LLPanelFace::onCommitMaterialBumpyRot(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialBumpyRot(const LLSD& value) { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setNormalRotation(self,self->getCurrentBumpyRot() * DEG_TO_RAD); + LLSelectedTEMaterial::setNormalRotation(this, value.asReal() * DEG_TO_RAD); } -//static -void LLPanelFace::onCommitMaterialShinyRot(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitMaterialShinyRot(const LLSD& value) { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setSpecularRotation(self,self->getCurrentShinyRot() * DEG_TO_RAD); + LLSelectedTEMaterial::setSpecularRotation(this, value.asReal() * DEG_TO_RAD); } -//static -void LLPanelFace::onCommitMaterialGloss(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitTextureInfo() { - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setSpecularLightExponent(self,self->getCurrentGlossiness()); -} - -//static -void LLPanelFace::onCommitMaterialEnv(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - llassert_always(self); - LLSelectedTEMaterial::setEnvironmentIntensity(self,self->getCurrentEnvIntensity()); -} - -//static -void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - LLSelectedTEMaterial::setAlphaMaskCutoff(self,self->getCurrentAlphaMaskCutoff()); -} - -// static -void LLPanelFace::onCommitTextureInfo( LLUICtrl* ctrl, void* userdata ) -{ - LLPanelFace* self = (LLPanelFace*) userdata; - self->sendTextureInfo(); + sendTextureInfo(); // Materials alignment if (gSavedSettings.getBOOL("FSSynchronizeTextureMaps")) { - self->alignMaterialsProperties(); + alignMaterialsProperties(); } // } // Commit the number of repeats per meter -// static -void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* repeats_ctrl) { - LLPanelFace* self = (LLPanelFace*) userdata; - - LLUICtrl* repeats_ctrl = self->getChild("rptctrl"); - LLComboBox* combo_matmedia = self->getChild("combobox matmedia"); - LLComboBox* combo_mattype = self->getChild("combobox mattype"); + LLComboBox* combo_matmedia = mComboMatMedia; + LLComboBox* combo_mattype = mComboMatType; U32 materials_media = combo_matmedia->getCurrentIndex(); @@ -2076,27 +1974,27 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) case MATTYPE_NORMAL: { - LLUICtrl* bumpy_scale_u = self->getChild("bumpyScaleU"); - LLUICtrl* bumpy_scale_v = self->getChild("bumpyScaleV"); + LLUICtrl* bumpy_scale_u = mBumpyScaleU; + LLUICtrl* bumpy_scale_v = mBumpyScaleV; bumpy_scale_u->setValue(obj_scale_s * repeats_per_meter); bumpy_scale_v->setValue(obj_scale_t * repeats_per_meter); - LLSelectedTEMaterial::setNormalRepeatX(self,obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setNormalRepeatY(self,obj_scale_t * repeats_per_meter); + LLSelectedTEMaterial::setNormalRepeatX(this,obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setNormalRepeatY(this,obj_scale_t * repeats_per_meter); } break; case MATTYPE_SPECULAR: { - LLUICtrl* shiny_scale_u = self->getChild("shinyScaleU"); - LLUICtrl* shiny_scale_v = self->getChild("shinyScaleV"); + LLUICtrl* shiny_scale_u = mShinyScaleU; + LLUICtrl* shiny_scale_v = mShinyScaleV; shiny_scale_u->setValue(obj_scale_s * repeats_per_meter); shiny_scale_v->setValue(obj_scale_t * repeats_per_meter); - LLSelectedTEMaterial::setSpecularRepeatX(self,obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setSpecularRepeatY(self,obj_scale_t * repeats_per_meter); + LLSelectedTEMaterial::setSpecularRepeatX(this,obj_scale_s * repeats_per_meter); + LLSelectedTEMaterial::setSpecularRepeatY(this,obj_scale_t * repeats_per_meter); } break; @@ -2148,7 +2046,7 @@ struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor }; }; -void LLPanelFace::onClickAutoFix(void* userdata) +void LLPanelFace::onClickAutoFix() { LLPanelFaceSetMediaFunctor setfunc; LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); @@ -2167,36 +2065,32 @@ void LLPanelFace::setMediaType(const std::string& mime_type) { } -// static -void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitPlanarAlign() { - LLPanelFace* self = (LLPanelFace*) userdata; - self->getState(); - self->sendTextureInfo(); + getState(); + sendTextureInfo(); } void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) { LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL; - LLComboBox* combo_mattype = getChild("combobox mattype"); + LLComboBox* combo_mattype = mComboMatType; if (!combo_mattype) { return; } U32 mattype = combo_mattype->getCurrentIndex(); - std::string which_control="texture control"; + LLTextureCtrl* texture_ctrl = mTextureCtrl; switch (mattype) { case MATTYPE_SPECULAR: - which_control = "shinytexture control"; + texture_ctrl = mShinyTextureCtrl; break; case MATTYPE_NORMAL: - which_control = "bumpytexture control"; + texture_ctrl = mBumpyTextureCtrl; break; // no default needed } - LL_DEBUGS("Materials") << "control " << which_control << LL_ENDL; - LLTextureCtrl* texture_ctrl = getChild(which_control); if (texture_ctrl) { LLUUID obj_owner_id; @@ -2438,7 +2332,7 @@ void LLPanelFace::LLSelectedTE::getMaxDiffuseRepeats(F32& repeats, bool& identic static LLSD textures; -void LLPanelFace::onClickCopy(void* userdata) +void LLPanelFace::onClickCopy() { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); if(!objectp) @@ -2472,7 +2366,7 @@ void LLPanelFace::onClickCopy(void* userdata) } } -void LLPanelFace::onClickPaste(void* userdata) +void LLPanelFace::onClickPaste() { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(); if(!objectp) @@ -2524,17 +2418,17 @@ void LLPanelFace::onClickMapsSync() void LLPanelFace::alignMaterialsProperties() { - F32 tex_scale_u = getChildView("TexScaleU")->getValue().asReal(); - F32 tex_scale_v = getChildView("TexScaleV")->getValue().asReal(); - F32 tex_offset_u = getChildView("TexOffsetU")->getValue().asReal(); - F32 tex_offset_v = getChildView("TexOffsetU")->getValue().asReal(); - F32 tex_rot = getChildView("TexRot")->getValue().asReal(); + F32 tex_scale_u = mCtrlTexScaleU->getValue().asReal(); + F32 tex_scale_v = mCtrlTexScaleV->getValue().asReal(); + F32 tex_offset_u = mCtrlTexOffsetU->getValue().asReal(); + F32 tex_offset_v = mCtrlTexOffsetV->getValue().asReal(); + F32 tex_rot = mCtrlTexRot->getValue().asReal(); - childSetValue("shinyScaleU", tex_scale_u); - childSetValue("shinyScaleV", tex_scale_v); - childSetValue("shinyOffsetU", tex_offset_u); - childSetValue("shinyOffsetV", tex_offset_v); - childSetValue("shinyRot", tex_rot); + mShinyScaleU->setValue(tex_scale_u); + mShinyScaleV->setValue(tex_scale_v); + mShinyOffsetU->setValue(tex_offset_u); + mShinyOffsetV->setValue(tex_offset_v); + mShinyRot->setValue(tex_rot); LLSelectedTEMaterial::setSpecularRepeatX(this, tex_scale_u); LLSelectedTEMaterial::setSpecularRepeatY(this, tex_scale_v); @@ -2542,11 +2436,11 @@ void LLPanelFace::alignMaterialsProperties() LLSelectedTEMaterial::setSpecularOffsetY(this, tex_offset_v); LLSelectedTEMaterial::setSpecularRotation(this, tex_rot * DEG_TO_RAD); - childSetValue("bumpyScaleU", tex_scale_u); - childSetValue("bumpyScaleV", tex_scale_v); - childSetValue("bumpyOffsetU", tex_offset_u); - childSetValue("bumpyOffsetV", tex_offset_v); - childSetValue("bumpyRot", tex_rot); + mBumpyScaleU->setValue(tex_scale_u); + mBumpyScaleV->setValue(tex_scale_v); + mBumpyOffsetU->setValue(tex_offset_u); + mBumpyOffsetV->setValue(tex_offset_v); + mBumpyRot->setValue(tex_rot); LLSelectedTEMaterial::setNormalRepeatX(this, tex_scale_u); LLSelectedTEMaterial::setNormalRepeatY(this, tex_scale_v); @@ -2558,25 +2452,25 @@ void LLPanelFace::alignMaterialsProperties() // FIRE-11407 - Flip buttons void LLPanelFace::onCommitFlip(bool flip_x) { - std::string control_name = ""; - S32 mattype(getChild("combobox mattype")->getCurrentIndex()); + S32 mattype(mComboMatType->getCurrentIndex()); + LLUICtrl* spinner = NULL; switch (mattype) { case MATTYPE_DIFFUSE: - control_name = "TexScale"; + spinner = flip_x ? mCtrlTexScaleU : mCtrlTexScaleV; break; case MATTYPE_NORMAL: - control_name = "bumpyScale"; + spinner = flip_x ? mBumpyScaleU : mBumpyScaleV; break; case MATTYPE_SPECULAR: - control_name = "shinyScale"; + spinner = flip_x ? mShinyScaleU : mShinyScaleV; break; default: //llassert(mattype); return; } - if (LLUICtrl* spinner = getChild(control_name + (flip_x ? "U" : "V"))) + if (spinner) { F32 value = -(spinner->getValue().asReal()); spinner->setValue(value); diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 5ac63c20b..0ad383b14 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -145,9 +145,7 @@ protected: void onCommitNormalTexture(const LLSD& data); void onCancelNormalTexture(const LLSD& data); void onSelectNormalTexture(const LLSD& data); - void onCommitColor(const LLSD& data); void onCommitShinyColor(const LLSD& data); - void onCommitAlpha(const LLSD& data); void onCancelColor(const LLSD& data); void onSelectColor(const LLSD& data); @@ -165,39 +163,27 @@ protected: // Callback funcs for individual controls // - static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata); + void onCommitTextureInfo(); - static void onCommitMaterialBumpyScaleX( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialBumpyScaleY( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialBumpyRot( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialBumpyOffsetX( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialBumpyOffsetY( LLUICtrl* ctrl, void* userdata); + void onCommitMaterialBumpyScaleX(const LLSD& value); + void onCommitMaterialBumpyScaleY(const LLSD& value); + void onCommitMaterialBumpyRot(const LLSD& value); - static void onCommitMaterialShinyScaleX( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialShinyScaleY( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialShinyRot( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialShinyOffsetX( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialShinyOffsetY( LLUICtrl* ctrl, void* userdata); + void onCommitMaterialShinyScaleX(const LLSD& value); + void onCommitMaterialShinyScaleY(const LLSD& value); + void onCommitMaterialShinyRot(const LLSD& value); - static void onCommitMaterialGloss( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialEnv( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialMaskCutoff( LLUICtrl* ctrl, void* userdata); - static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata); + void onCommitMaterialsMedia(); void onCommitMaterialType(); - static void onCommitBump( LLUICtrl* ctrl, void* userdata); - static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); - static void onCommitShiny( LLUICtrl* ctrl, void* userdata); - static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); - static void onCommitFullbright( LLUICtrl* ctrl, void* userdata); - static void onCommitGlow( LLUICtrl* ctrl, void *userdata); - static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata); - static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo); - static void onClickAutoFix(void*); + void onCommitAlphaMode(); + void onCommitPlanarAlign(); + void onCommitRepeatsPerMeter(LLUICtrl* repeats_ctrl); + void onClickAutoFix(); static F32 valueGlow(LLViewerObject* object, S32 face); - static void onClickCopy(void*); - static void onClickPaste(void*); + void onClickCopy(); + void onClickPaste(); // Build tool enhancements void onClickMapsSync(); void alignMaterialsProperties(); @@ -212,22 +198,7 @@ private: // LLUUID getCurrentNormalMap(); LLUUID getCurrentSpecularMap(); - U32 getCurrentShininess(); - U32 getCurrentBumpiness(); U8 getCurrentDiffuseAlphaMode(); - U8 getCurrentAlphaMaskCutoff(); - U8 getCurrentEnvIntensity(); - U8 getCurrentGlossiness(); - F32 getCurrentBumpyRot(); - F32 getCurrentBumpyScaleU(); - F32 getCurrentBumpyScaleV(); - F32 getCurrentBumpyOffsetU(); - F32 getCurrentBumpyOffsetV(); - F32 getCurrentShinyRot(); - F32 getCurrentShinyScaleU(); - F32 getCurrentShinyScaleV(); - F32 getCurrentShinyOffsetU(); - F32 getCurrentShinyOffsetV(); // Update visibility of controls to match current UI mode // (e.g. materials vs media editing) @@ -382,6 +353,69 @@ private: data_to_return = data_value; } +// + friend struct LLPanelFaceSetTEFunctor; // Must access some of these + // UI Widgets + LLView* mMediaInfo; + LLView* mMediaAdd; + LLView* mMediaDelete; + LLView* mLabelGlossy; + LLView* mLabelEnvironment; + LLView* mLabelShinyColor; + LLView* mLabelAlphaMode; + LLView* mLabelMaskCutoff; + LLView* mLabelBumpy; + LLView* mLabelShiny; + LLView* mLabelColor; + LLView* mLabelGlow; + LLView* mLabelTexGen; + LLComboBox* mComboShiny; + LLComboBox* mComboBumpy; + LLComboBox* mComboAlpha; + LLSpinCtrl* mCtrlTexScaleU; + LLUICtrl* mCtrlFlipTexScaleU; + LLSpinCtrl* mCtrlTexScaleV; + LLUICtrl* mCtrlFlipTexScaleV; + LLSpinCtrl* mCtrlTexRot; + LLUICtrl* mCtrlRpt; + LLUICtrl* mCtrlPlanar; + LLSpinCtrl* mCtrlTexOffsetU; + LLSpinCtrl* mCtrlTexOffsetV; + LLUICtrl* mBumpyScaleU; + LLUICtrl* mBumpyScaleV; + LLUICtrl* mBumpyRot; + LLUICtrl* mBumpyOffsetU; + LLUICtrl* mBumpyOffsetV; + LLUICtrl* mShinyScaleU; + LLUICtrl* mShinyScaleV; + LLUICtrl* mShinyRot; + LLUICtrl* mShinyOffsetU; + LLUICtrl* mShinyOffsetV; + LLUICtrl* mGlossyCtrl; + LLUICtrl* mEnvironmentCtrl; + LLUICtrl* mCtrlMaskCutoff; + LLUICtrl* mCtrlAlign; + LLUICtrl* mCtrlMapsSync; + LLUICtrl* mCtrlCopy; + LLUICtrl* mCtrlPaste; + LLTextureCtrl* mTextureCtrl; + LLTextureCtrl* mShinyTextureCtrl; + LLTextureCtrl* mBumpyTextureCtrl; + LLColorSwatchCtrl* mColorSwatch; + LLColorSwatchCtrl* mShinyColorSwatch; + + LLComboBox* mComboTexGen; + LLComboBox* mComboMatMedia; + LLComboBox* mComboMatType; + + LLCheckBoxCtrl* mCheckFullbright; + + LLTextBox* mLabelColorTransp; + LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha + + LLSpinCtrl* mCtrlGlow; +// + // Update vis and enabling of specific subsets of controls based on material params // (e.g. hide the spec controls if no spec texture is applied) // diff --git a/indra/newview/llprefsvoice.cpp b/indra/newview/llprefsvoice.cpp index 275778de4..eddfd2408 100644 --- a/indra/newview/llprefsvoice.cpp +++ b/indra/newview/llprefsvoice.cpp @@ -53,7 +53,7 @@ public: BOOL handleKeyHere(KEY key, MASK mask); - static void onCancel(void* user_data); + static void start(LLPrefsVoice* p) { (new LLVoiceSetKeyDialog(p))->startModal(); } private: LLPrefsVoice* mParent; @@ -63,8 +63,11 @@ LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(LLPrefsVoice* parent) : LLModalDialog(LLStringUtil::null, 240, 100), mParent(parent) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml"); - childSetAction("Cancel", onCancel, this); - childSetFocus("Cancel"); + if (LLUICtrl* ctrl = findChild("Cancel")) + { + ctrl->setCommitCallback(boost::bind(&LLModalDialog::close, this, false)); + ctrl->setFocus(true); + } gFocusMgr.setKeystrokesOnly(TRUE); } @@ -77,7 +80,7 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) { BOOL result = TRUE; - if(key == 'Q' && mask == MASK_CONTROL) + if (key == 'Q' && mask == MASK_CONTROL) { result = FALSE; } @@ -90,13 +93,6 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) return result; } -//static -void LLVoiceSetKeyDialog::onCancel(void* user_data) -{ - LLVoiceSetKeyDialog* self = (LLVoiceSetKeyDialog*)user_data; - self->close(); -} - namespace { void* createDevicePanel(void*) @@ -121,20 +117,13 @@ LLPrefsVoice::~LLPrefsVoice() BOOL LLPrefsVoice::postBuild() { - childSetCommitCallback("enable_voice_check", onCommitEnableVoiceChat, this); - childSetAction("set_voice_hotkey_button", onClickSetKey, this); - childSetAction("set_voice_middlemouse_button", onClickSetMiddleMouse, this); + getChild("enable_voice_check")->setCommitCallback(boost::bind(&LLPrefsVoice::onCommitEnableVoiceChat, this, _2)); + getChild("set_voice_hotkey_button")->setCommitCallback(boost::bind(LLVoiceSetKeyDialog::start, this)); + getChild("set_voice_middlemouse_button")->setCommitCallback(boost::bind(&LLView::setValue, getChildView("modifier_combo"), "MiddleMouse")); - BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice"); - childSetVisible("voice_unavailable", voice_disabled); - childSetVisible("enable_voice_check", !voice_disabled); - childSetEnabled("enable_voice_check", !voice_disabled); + getChild("set_voice_middlemouse_button")->setEnabled(!gSavedSettings.getBOOL("CmdLineDisableVoice") && gSavedSettings.getBOOL("EnableVoiceChat")); - bool enable = !voice_disabled && gSavedSettings.getBOOL("EnableVoiceChat"); - childSetValue("enable_voice_check", enable); - onCommitEnableVoiceChat(getChild("enable_voice_check"), this); - - if (LLCheckBoxCtrl* check = getChild("enable_multivoice_check")) + if (LLCheckBoxCtrl* check = findChild("enable_multivoice_check")) { check->setValue(gSavedSettings.getBOOL("VoiceMultiInstance")); check->setLabel(getString("multivoice_label", LLTrans::getDefaultArgs())); @@ -160,7 +149,7 @@ void LLPrefsVoice::apply() gSavedSettings.setBOOL("LipSyncEnabled", childGetValue("enable_lip_sync_check")); gSavedSettings.setBOOL("VoiceMultiInstance", childGetValue("enable_multivoice_check")); - if (LLPanelVoiceDeviceSettings* voice_device_settings = getChild("device_settings_panel")) + if (LLPanelVoiceDeviceSettings* voice_device_settings = findChild("device_settings_panel")) { voice_device_settings->apply(); } @@ -180,7 +169,7 @@ void LLPrefsVoice::apply() void LLPrefsVoice::cancel() { - if (LLPanelVoiceDeviceSettings* voice_device_settings = getChild("device_settings_panel")) + if (LLPanelVoiceDeviceSettings* voice_device_settings = findChild("device_settings_panel")) { voice_device_settings->cancel(); } @@ -188,42 +177,23 @@ void LLPrefsVoice::cancel() void LLPrefsVoice::setKey(KEY key) { - childSetValue("modifier_combo", LLKeyboard::stringFromKey(key)); + getChildView("modifier_combo")->setValue(LLKeyboard::stringFromKey(key)); } -//static -void LLPrefsVoice::onCommitEnableVoiceChat(LLUICtrl* ctrl, void* user_data) +void LLPrefsVoice::onCommitEnableVoiceChat(const LLSD& value) { - LLPrefsVoice* self = (LLPrefsVoice*)user_data; - LLCheckBoxCtrl* enable_voice_chat = (LLCheckBoxCtrl*)ctrl; + bool enable = value.asBoolean(); - bool enable = enable_voice_chat->getValue(); - - self->childSetEnabled("modifier_combo", enable); - self->childSetEnabled("push_to_talk_label", enable); - self->childSetEnabled("voice_call_friends_only_check", enable); - self->childSetEnabled("auto_disengage_mic_check", enable); - self->childSetEnabled("push_to_talk_toggle_check", enable); - self->childSetEnabled("ear_location", enable); - self->childSetEnabled("enable_lip_sync_check", enable); - self->childSetEnabled("set_voice_hotkey_button", enable); - self->childSetEnabled("set_voice_middlemouse_button", enable); - self->childSetEnabled("device_settings_btn", enable); - self->childSetEnabled("device_settings_panel", enable); -} - -//static -void LLPrefsVoice::onClickSetKey(void* user_data) -{ - LLPrefsVoice* self = (LLPrefsVoice*)user_data; - LLVoiceSetKeyDialog* dialog = new LLVoiceSetKeyDialog(self); - dialog->startModal(); -} - -//static -void LLPrefsVoice::onClickSetMiddleMouse(void* user_data) -{ - LLPrefsVoice* self = (LLPrefsVoice*)user_data; - self->childSetValue("modifier_combo", "MiddleMouse"); + getChildView("modifier_combo")->setEnabled(enable); + getChildView("push_to_talk_label")->setEnabled(enable); + getChildView("voice_call_friends_only_check")->setEnabled(enable); + getChildView("auto_disengage_mic_check")->setEnabled(enable); + getChildView("push_to_talk_toggle_check")->setEnabled(enable); + getChildView("ear_location")->setEnabled(enable); + getChildView("enable_lip_sync_check")->setEnabled(enable); + getChildView("set_voice_hotkey_button")->setEnabled(enable); + getChildView("set_voice_middlemouse_button")->setEnabled(enable); + getChildView("device_settings_btn")->setEnabled(enable); + getChildView("device_settings_panel")->setEnabled(enable); } diff --git a/indra/newview/llprefsvoice.h b/indra/newview/llprefsvoice.h index a1cd8c933..70ce6a032 100644 --- a/indra/newview/llprefsvoice.h +++ b/indra/newview/llprefsvoice.h @@ -49,9 +49,7 @@ public: void setKey(KEY key); private: - static void onCommitEnableVoiceChat(LLUICtrl* ctrl, void* user_data); - static void onClickSetKey(void* user_data); - static void onClickSetMiddleMouse(void* user_data); + void onCommitEnableVoiceChat(const LLSD& value); }; #endif // LLPREFSVOICE_H diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 1184cf73c..c3bdfe5f8 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -413,7 +413,7 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w LLStrider normalsp; LLStrider tex_coordsp; LLStrider vertex_weightsp; - LLStrider clothing_weightsp; + LLStrider clothing_weightsp; LLStrider indicesp; // Copy data into the faces from the polymesh data. diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 877bfdce3..483b80ab9 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -870,6 +870,13 @@ void upload_new_resource(const std::string& src_filename, std::string name, asset_type = LLAssetType::AT_ANIMATION; filename = src_filename; } + else if(exten == "lsl" || exten == "gesture" || exten == "notecard") + { + if (exten == "lsl") asset_type = LLAssetType::AT_LSL_TEXT; + else if (exten == "gesture") asset_type = LLAssetType::AT_GESTURE; + else if (exten == "notecard") asset_type = LLAssetType::AT_NOTECARD; + filename = src_filename; + } // else { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 4adce648c..13cf64827 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6600,7 +6600,8 @@ void update_region_restart(const LLSD& llsdBlock) if (restarting_floater) { restarting_floater->updateTime(seconds); - restarting_floater->center(); + if (!restarting_floater->isMinimized()) + restarting_floater->center(); } else { @@ -6608,6 +6609,8 @@ void update_region_restart(const LLSD& llsdBlock) params["NAME"] = llsdBlock["NAME"]; params["SECONDS"] = (LLSD::Integer)seconds; LLFloaterRegionRestarting::showInstance(params); + if (gSavedSettings.getBOOL("LiruRegionRestartMinimized")) + LLFloaterRegionRestarting::findInstance()->setMinimized(true); } } diff --git a/indra/newview/llviewerobjectbackup.cpp b/indra/newview/llviewerobjectbackup.cpp index e3afde844..e19e58afd 100644 --- a/indra/newview/llviewerobjectbackup.cpp +++ b/indra/newview/llviewerobjectbackup.cpp @@ -44,6 +44,7 @@ #include "llimage.h" #include "llimagej2c.h" #include "lllfsthread.h" +#include "llnotificationsutil.h" #include "llsdserialize.h" #include "llsdutil.h" #include "llsdutil_math.h" @@ -62,8 +63,8 @@ #include "llfloatersnapshot.h" #include "llinventorymodel.h" // gInventory #include "llinventoryfunctions.h" -#include "llnotificationsutil.h" #include "llresourcedata.h" +#include "llmaterialmgr.h" #include "llselectmgr.h" #include "llstatusbar.h" #include "lltexturecache.h" @@ -94,27 +95,9 @@ static LLUUID LL_TEXTURE_INVISIBLE = LLUUID("38b86f85-2575-52a9-a531-23108d8da8 static LLUUID LL_TEXTURE_TRANSPARENT = LLUUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); static LLUUID LL_TEXTURE_MEDIA = LLUUID("8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"); -void setDefaultTextures() -{ - if (!gHippoGridManager->getConnectedGrid()->isSecondLife()) - { - // When not in SL (no texture perm check needed), we can get these - // defaults from the user settings... - LL_TEXTURE_PLYWOOD = LLUUID(gSavedSettings.getString("DefaultObjectTexture")); - LL_TEXTURE_BLANK = LLUUID(gSavedSettings.getString("UIImgWhiteUUID")); - if (gSavedSettings.controlExists("UIImgInvisibleUUID")) - { - // This control only exists in the Cool VL Viewer (added by the - // AllowInvisibleTextureInPicker patch) - LL_TEXTURE_INVISIBLE = LLUUID(gSavedSettings.getString("UIImgInvisibleUUID")); - } - } -} - class importResponder : public LLNewAgentInventoryResponder { public: - importResponder(const LLSD& post_data, const LLUUID& vfile_id, LLAssetType::EType asset_type) : LLNewAgentInventoryResponder(post_data, vfile_id, asset_type) { @@ -136,15 +119,11 @@ public: { gMessageSystem->newMessageFast(_PREHASH_MoneyBalanceRequest); gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgentID); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); gMessageSystem->nextBlockFast(_PREHASH_MoneyData); gMessageSystem->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); gAgent.sendReliableMessage(); - -// LLStringUtil::format_map_t args; -// args["[AMOUNT]"] = llformat("%d",LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()); -// LLNotifyBox::showXml("UploadPayment", args); } // Actually add the upload to viewer inventory @@ -154,7 +133,7 @@ public: { LLPermissions perm; U32 next_owner_perm; - perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); + perm.init(gAgentID, gAgentID, LLUUID::null, LLUUID::null); if (mPostData["inventory_type"].asString() == "snapshot") { next_owner_perm = PERM_ALL; @@ -203,9 +182,11 @@ public: { setImage(image); } + void setData(U8* data, S32 datasize, S32 imagesize, S32 imageformat, BOOL imagelocal) { - if (imageformat == IMG_CODEC_TGA && mFormattedImage->getCodec() == IMG_CODEC_J2C) + if (imageformat == IMG_CODEC_TGA && + mFormattedImage->getCodec() == IMG_CODEC_J2C) { LL_WARNS("ObjectBackup") << "FAILED: texture " << mID << " is formatted as TGA. Not saving." << LL_ENDL; LLObjectBackup::getInstance()->mNonExportedTextures |= LLObjectBackup::TEXTURE_BAD_ENCODING; @@ -236,7 +217,7 @@ public: std::string name; mID.toString(name); name = LLObjectBackup::getInstance()->getfolder() + "//" + name; - LL_INFOS("ObjectBackup") << "Saving to " << name << LL_ENDL; + LL_INFOS("ObjectBackup") << "Saving to " << name << LL_ENDL; if (!mFormattedImage->save(name)) { LL_WARNS("ObjectBackup") << "FAILED to save texture " << mID << LL_ENDL; @@ -257,10 +238,9 @@ public: } } - LLObjectBackup::getInstance()->mNextTextureReady = true; - //JUST SAY NO TO APR DEADLOCKING - //LLObjectBackup::getInstance()->exportNextTexture(); + LLObjectBackup::getInstance()->mCheckNextTexture = true; } + private: LLPointer mFormattedImage; LLUUID mID; @@ -269,13 +249,13 @@ private: LLObjectBackup::LLObjectBackup() : LLFloater(std::string("Object Backup Floater"), std::string("FloaterObjectBackuptRect"), LLStringUtil::null) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_object_backup.xml"); + //buildFromFile("floater_object.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_object_backup.xml", NULL, false); mRunning = false; mTexturesList.clear(); mAssetMap.clear(); - mCurrentAsset = LLUUID::null; + mCurrentAsset.setNull(); mRetexture = false; - close(); } //////////////////////////////////////////////////////////////////////////////// @@ -283,7 +263,9 @@ LLObjectBackup::LLObjectBackup() LLObjectBackup* LLObjectBackup::getInstance() { if (!sInstance) + { sInstance = new LLObjectBackup(); + } return sInstance; } @@ -294,11 +276,6 @@ LLObjectBackup::~LLObjectBackup() sInstance = NULL; } -void LLObjectBackup::draw() -{ - LLFloater::draw(); -} - void LLObjectBackup::show(bool exporting) { // set the title @@ -367,11 +344,11 @@ void LLObjectBackup::updateImportNumbers() void LLObjectBackup::exportObject() { mTexturesList.clear(); + mBadPermsTexturesList.clear(); mLLSD.clear(); mThisGroup.clear(); - setDefaultTextures(); - LLSelectMgr::getInstance()->getSelection()->ref(); + LLSelectMgr::getInstance()->getSelection()->ref(); // Open the file save dialog AIFilePicker* filepicker = AIFilePicker::create(); @@ -384,7 +361,7 @@ void LLObjectBackup::exportObject_continued(AIFilePicker* filepicker) if (!filepicker->hasFilename()) { // User canceled save. - LLSelectMgr::getInstance()->getSelection()->unref(); + LLSelectMgr::getInstance()->getSelection()->unref(); return; } @@ -392,14 +369,32 @@ void LLObjectBackup::exportObject_continued(AIFilePicker* filepicker) mFolder = gDirUtilp->getDirName(mFileName); mNonExportedTextures = TEXTURE_OK; - mExportState = EXPORT_INIT; + mGotExtraPhysics = !gAgent.getRegion()->getCapability("GetObjectPhysicsData").empty(); gIdleCallbacks.addFunction(exportWorker, NULL); } -bool LLObjectBackup::validatePerms(const LLPermissions *item_permissions) +//---------------------------------------------------------------------------// +// Permissions checking functions +//---------------------------------------------------------------------------// + +//static +void LLObjectBackup::setDefaultTextures() { - return item_permissions->allowExportBy(gAgent.getID(), LFSimFeatureHandler::instance().exportPolicy()); + if (LFSimFeatureHandler::instance().exportPolicy() == ep_full_perm) + { + // When not in SL and not in an OpenSIM grid with export permission + // support (i.e. when no texture permission check is needed), we can + // get these defaults from the user settings... + LL_TEXTURE_PLYWOOD = LLUUID(gSavedSettings.getString("DefaultObjectTexture")); + LL_TEXTURE_BLANK = LLUUID(gSavedSettings.getString("UIImgWhiteUUID")); + LL_TEXTURE_INVISIBLE = LLUUID(gSavedSettings.getString("UIImgInvisibleUUID")); + } +} + +bool LLObjectBackup::validatePerms(const LLPermissions* item_permissions) +{ + return item_permissions->allowExportBy(gAgentID, LFSimFeatureHandler::instance().exportPolicy()); } // So far, only Second Life forces TPVs to verify the creator for textures... @@ -411,15 +406,21 @@ bool LLObjectBackup::validatePerms(const LLPermissions *item_permissions) // The "must be creator" stuff also goes against the usage in Linden Lab's own // official viewers, since those allow you to save full perm textures (such as // the textures in the Library), whoever is the actual creator... Go figure ! -LLUUID LLObjectBackup::validateTextureID(LLUUID asset_id) +LLUUID LLObjectBackup::validateTextureID(const LLUUID& asset_id) { if (!gHippoGridManager->getConnectedGrid()->isSecondLife()) { // If we are not in Second Life, don't bother. return asset_id; } - LLUUID texture = LL_TEXTURE_PLYWOOD; - if (asset_id == texture || + + if (mBadPermsTexturesList.count(asset_id)) + { + // We already checked it and know it's bad... + return LL_TEXTURE_PLYWOOD; + } + + if (asset_id == LL_TEXTURE_PLYWOOD || asset_id == LL_TEXTURE_BLANK || asset_id == LL_TEXTURE_INVISIBLE || asset_id == LL_TEXTURE_TRANSPARENT || @@ -428,127 +429,205 @@ LLUUID LLObjectBackup::validateTextureID(LLUUID asset_id) // Allow to export a few default SL textures. return asset_id; } + LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLAssetIDMatches asset_id_matches(asset_id); - gInventory.collectDescendentsIf(LLUUID::null, - cats, - items, + gInventory.collectDescendentsIf(LLUUID::null, cats, items, LLInventoryModel::INCLUDE_TRASH, asset_id_matches); - - if (items.count()) + S32 count = items.size(); + if (count > 0) { - for (S32 i = 0; i < items.count(); i++) + for (S32 i = 0; i < count; ++i) { const LLPermissions item_permissions = items[i]->getPermissions(); if (validatePerms(&item_permissions)) { - texture = asset_id; + return asset_id; } } } - if (texture != asset_id) { + mBadPermsTexturesList.insert(asset_id); // Cache bad texture ID mNonExportedTextures |= TEXTURE_BAD_PERM; + LL_WARNS("ObjectBackup") << "Bad permissions for texture ID: " << asset_id + << " - Texture will not be exported." << LL_ENDL; + return LL_TEXTURE_PLYWOOD; } - - return texture; } + +//---------------------------------------------------------------------------// + void LLObjectBackup::exportWorker(void *userdata) { - LLObjectBackup::getInstance()->updateExportNumbers(); + getInstance()->updateExportNumbers(); - switch (LLObjectBackup::getInstance()->mExportState) + switch (getInstance()->mExportState) { case EXPORT_INIT: + { + getInstance()->show(true); + // Fall through to EXPORT_CHECK_PERMS + } + case EXPORT_CHECK_PERMS: + { + struct ff : public LLSelectedNodeFunctor { - LLObjectBackup::getInstance()->show(true); - struct ff : public LLSelectedNodeFunctor + virtual bool apply(LLSelectNode* node) { - virtual bool apply(LLSelectNode* node) - { - return LLObjectBackup::getInstance()->validatePerms(node->mPermissions); - } - } func; + return getInstance()->validatePerms(node->mPermissions); + } + } func; + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + if (object) + { if (LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func, false)) { - LLObjectBackup::getInstance()->mExportState = EXPORT_STRUCTURE; + getInstance()->mExportState = EXPORT_FETCH_PHYSICS; } else { - LL_WARNS("ObjectBackup") << "Incorrect permission to export" << LL_ENDL; - LLObjectBackup::getInstance()->mExportState = EXPORT_FAILED; - LLSelectMgr::getInstance()->getSelection()->unref(); + struct vv : public LLSelectedNodeFunctor + { + virtual bool apply(LLSelectNode* node) + { + return node->mValid; + } + } func2; + + if (LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func2, false)) + { + LL_WARNS("ObjectBackup") << "Incorrect permission to export" << LL_ENDL; + getInstance()->mExportState = EXPORT_FAILED; + LLSelectMgr::getInstance()->getSelection()->unref(); + } + else + { + LL_DEBUGS("ObjectBackup") << "Nodes permissions not yet received, delaying..." + << LL_ENDL; + getInstance()->mExportState = EXPORT_CHECK_PERMS; + } } } - break; - - case EXPORT_STRUCTURE: + else { - struct ff : public LLSelectedObjectFunctor - { - virtual bool apply(LLViewerObject* object) - { - bool is_attachment = object->isAttachment(); - object->boostTexturePriority(TRUE); - LLViewerObject::child_list_t children = object->getChildren(); - children.push_front(object); //push root onto list - LLSD prim_llsd = LLObjectBackup::getInstance()->primsToLLSD(children, is_attachment); - LLSD stuff; - if (is_attachment) - { - stuff["root_position"] = object->getPositionEdit().getValue(); - stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotationEdit()); - } - else - { - stuff["root_position"] = object->getPosition().getValue(); - stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotation()); - } - stuff["group_body"] = prim_llsd; - LLObjectBackup::getInstance()->mLLSD["data"].append(stuff); - return true; - } - } func; - - LLObjectBackup::getInstance()->mExportState = EXPORT_LLSD; - LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, false); + LLObjectBackup::getInstance()->mExportState = EXPORT_FAILED; LLSelectMgr::getInstance()->getSelection()->unref(); } break; + } + + case EXPORT_FETCH_PHYSICS: + { + // Don't bother to try and fetch the extra physics flags if we + // don't have sim support for them... + if (!getInstance()->mGotExtraPhysics) + { + getInstance()->mExportState = EXPORT_STRUCTURE; + break; + } + + struct ff : public LLSelectedNodeFunctor + { + virtual bool apply(LLSelectNode* node) + { + LLViewerObject* object = node->getObject(); + return object->getPhysicsShapeUnknown(); + } + } func; + + LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); + if (object) + { + if (LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func, false)) + { + getInstance()->mExportState = EXPORT_STRUCTURE; + } + else + { + LL_DEBUGS("ObjectBackup") << "Nodes physics not yet received, delaying..." + << LL_ENDL; + } + } + else + { + getInstance()->mExportState = EXPORT_FAILED; + LLSelectMgr::getInstance()->getSelection()->unref(); + } + break; + } + + case EXPORT_STRUCTURE: + { + struct ff : public LLSelectedObjectFunctor + { + virtual bool apply(LLViewerObject* object) + { + bool is_attachment = object->isAttachment(); + object->boostTexturePriority(true); + LLViewerObject::child_list_t children = object->getChildren(); + children.push_front(object); //push root onto list + LLSD prim_llsd = LLObjectBackup::getInstance()->primsToLLSD(children, is_attachment); + LLSD stuff; + if (is_attachment) + { + stuff["root_position"] = object->getPositionEdit().getValue(); + stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotationEdit()); + } + else + { + stuff["root_position"] = object->getPosition().getValue(); + stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotation()); + } + stuff["group_body"] = prim_llsd; + getInstance()->mLLSD["data"].append(stuff); + return true; + } + } func; + + getInstance()->mExportState = EXPORT_LLSD; + LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, false); + LLSelectMgr::getInstance()->getSelection()->unref(); + break; + } case EXPORT_TEXTURES: - if (LLObjectBackup::getInstance()->mNextTextureReady == false) - return; - - // Ok we got work to do - LLObjectBackup::getInstance()->mNextTextureReady = false; - - if (LLObjectBackup::getInstance()->mTexturesList.empty()) + { + if (!getInstance()->mCheckNextTexture) { - LLObjectBackup::getInstance()->mExportState = EXPORT_DONE; + // The texture is being fetched. Wait till next idle callback. return; } - LLObjectBackup::getInstance()->exportNextTexture(); + if (getInstance()->mTexturesList.empty()) + { + getInstance()->mExportState = EXPORT_DONE; + return; + } + + // Ok, we got work to do... + getInstance()->mCheckNextTexture= false; + getInstance()->exportNextTexture(); break; + } case EXPORT_LLSD: - { - // Create a file stream and write to it - llofstream export_file(LLObjectBackup::getInstance()->mFileName); - LLSDSerialize::toPrettyXML(LLObjectBackup::getInstance()->mLLSD, export_file); - export_file.close(); - LLObjectBackup::getInstance()->mNextTextureReady = true; - LLObjectBackup::getInstance()->mExportState = EXPORT_TEXTURES; - } + { + // Create a file stream and write to it + llofstream export_file(getInstance()->mFileName); + LLSDSerialize::toPrettyXML(getInstance()->mLLSD, export_file); + export_file.close(); + getInstance()->mCheckNextTexture = true; + getInstance()->mExportState = EXPORT_TEXTURES; break; + } case EXPORT_DONE: + { gIdleCallbacks.deleteFunction(exportWorker); if (LLObjectBackup::getInstance()->mNonExportedTextures == LLObjectBackup::TEXTURE_OK) { @@ -559,23 +638,23 @@ void LLObjectBackup::exportWorker(void *userdata) { LL_INFOS("ObjectBackup") << "Export successful but incomplete: some texture(s) not saved." << LL_ENDL; std::string reason; - if (LLObjectBackup::getInstance()->mNonExportedTextures & LLObjectBackup::TEXTURE_BAD_PERM) + if (getInstance()->mNonExportedTextures & LLObjectBackup::TEXTURE_BAD_PERM) { reason += "\nBad permissions/creator."; } - if (LLObjectBackup::getInstance()->mNonExportedTextures & LLObjectBackup::TEXTURE_MISSING) + if (getInstance()->mNonExportedTextures & LLObjectBackup::TEXTURE_MISSING) { reason += "\nMissing texture (retrying after full rezzing might work)."; } - if (LLObjectBackup::getInstance()->mNonExportedTextures & LLObjectBackup::TEXTURE_BAD_ENCODING) + if (getInstance()->mNonExportedTextures & LLObjectBackup::TEXTURE_BAD_ENCODING) { reason += "\nBad texture encoding."; } - if (LLObjectBackup::getInstance()->mNonExportedTextures & LLObjectBackup::TEXTURE_IS_NULL) + if (getInstance()->mNonExportedTextures & LLObjectBackup::TEXTURE_IS_NULL) { reason += "\nNull texture."; } - if (LLObjectBackup::getInstance()->mNonExportedTextures & LLObjectBackup::TEXTURE_SAVED_FAILED) + if (getInstance()->mNonExportedTextures & LLObjectBackup::TEXTURE_SAVED_FAILED) { reason += "\nCould not write to disk."; } @@ -583,15 +662,18 @@ void LLObjectBackup::exportWorker(void *userdata) args["REASON"] = reason; LLNotificationsUtil::add("ExportPartial", args); } - LLObjectBackup::getInstance()->close(); + getInstance()->close(); break; + } case EXPORT_FAILED: + { gIdleCallbacks.deleteFunction(exportWorker); LL_WARNS("ObjectBackup") << "Export process aborted." << LL_ENDL; LLNotificationsUtil::add("ExportFailed"); LLObjectBackup::getInstance()->close(); break; + } } } @@ -600,22 +682,25 @@ LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list, bool i LLViewerObject* object; LLSD llsd; char localid[16]; + LLUUID t_id; - for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) + for (LLViewerObject::child_list_t::iterator i = child_list.begin(); + i != child_list.end(); ++i) { object = (*i); LLUUID id = object->getID(); LL_INFOS("ObjectBackup") << "Exporting prim " << object->getID().asString() << LL_ENDL; - // Create an LLSD object that represents this prim. It will be injected in to the overall LLSD - // tree structure + // Create an LLSD object that represents this prim. It will be injected + // in to the overall LLSD tree structure LLSD prim_llsd; if (!object->isRoot()) { // Parent id - snprintf(localid, sizeof(localid), "%u", object->getSubParent()->getLocalID()); + snprintf(localid, sizeof(localid), "%u", + object->getSubParent()->getLocalID()); prim_llsd["parent"] = localid; } @@ -641,30 +726,32 @@ LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list, bool i prim_llsd["scale"] = object->getScale().getValue(); // Flags - prim_llsd["flags"] = (S32)object->getFlags(); + prim_llsd["phantom"] = object->flagPhantom(); // legacy + prim_llsd["physical"] = object->flagUsePhysics(); // legacy + prim_llsd["flags"] = (S32)object->getFlags(); // new way + + // Extra physics flags + if (mGotExtraPhysics) + { + LLSD& physics = prim_llsd["ExtraPhysics"]; + physics["PhysicsShapeType"] = object->getPhysicsShapeType(); + physics["Gravity"] = object->getPhysicsGravity(); + physics["Friction"] = object->getPhysicsFriction(); + physics["Density"] = object->getPhysicsDensity(); + physics["Restitution"] = object->getPhysicsRestitution(); + } + + // Click action + if (S32 action = object->getClickAction()) // Non-zero + prim_llsd["clickaction"] = action; + + // Prim material + prim_llsd["material"] = object->getMaterial(); // Volume params LLVolumeParams params = object->getVolume()->getParams(); prim_llsd["volume"] = params.asLLSD(); - // Material - prim_llsd["material"] = object->getMaterial(); - - // Click Action - if (S32 action = object->getClickAction()) // Non-zero - prim_llsd["clickaction"] = action; - - // Physics - if (!object->getPhysicsShapeUnknown()) - { - LLSD& physics = prim_llsd["ExtraPhysics"]; - physics["PhysicsShapeType"] = object->getPhysicsShapeType(); - physics["Density"] = object->getPhysicsDensity(); - physics["Friction"] = object->getPhysicsFriction(); - physics["GravityMultiplier"] = object->getPhysicsGravity(); - physics["Restitution"] = object->getPhysicsRestitution(); - } - // Extra paramsb6fab961-af18-77f8-cf08-f021377a7244 if (object->isFlexible()) { @@ -672,6 +759,7 @@ LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list, bool i LLFlexibleObjectData* flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); prim_llsd["flexible"] = flex->asLLSD(); } + if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT)) { // Light @@ -680,125 +768,162 @@ LLSD LLObjectBackup::primsToLLSD(LLViewerObject::child_list_t child_list, bool i } if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) { - // Light Texture - LLLightImageParams* light_texture = (LLLightImageParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); - prim_llsd["light_texture"] = light_texture->asLLSD(); + // Light image + LLLightImageParams* light_param = (LLLightImageParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); + t_id = validateTextureID(light_param->getLightTexture()); + if (mTexturesList.count(t_id) == 0) + { + LL_INFOS("ObjectBackup") << "Found a light texture, adding to list " << t_id << LL_ENDL; + mTexturesList.insert(t_id); + } + prim_llsd["light_texture"] = light_param->asLLSD(); } + if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { // Sculpt LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); prim_llsd["sculpt"] = sculpt->asLLSD(); - - LLUUID sculpt_texture = sculpt->getSculptTexture(); - if (sculpt_texture == validateTextureID(sculpt_texture)) + if ((sculpt->getSculptType() & LL_SCULPT_TYPE_MASK) != LL_SCULPT_TYPE_MESH) { - bool alreadyseen = false; - std::list::iterator iter; - for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++) + LLUUID sculpt_texture = sculpt->getSculptTexture(); + if (sculpt_texture == validateTextureID(sculpt_texture)) { - if ((*iter) == sculpt_texture) - alreadyseen = true; + if (mTexturesList.count(sculpt_texture) == 0) + { + LL_INFOS("ObjectBackup") << "Found a sculpt texture, adding to list " << sculpt_texture << LL_ENDL; + mTexturesList.insert(sculpt_texture); + } } - if (alreadyseen == false) + else { - LL_INFOS("ObjectBackup") << "Found a sculpt texture, adding to list " << sculpt_texture << LL_ENDL; - mTexturesList.push_back(sculpt_texture); + LL_WARNS("ObjectBackup") << "Incorrect permission to export a sculpt texture." << LL_ENDL; + getInstance()->mExportState = EXPORT_FAILED; } } - else - { - LL_WARNS("ObjectBackup") << "Incorrect permission to export a sculpt texture." << LL_ENDL; - LLObjectBackup::getInstance()->mExportState = EXPORT_FAILED; - } } - // Textures + // Textures and materials LLSD te_llsd; LLSD this_te_llsd; - LLUUID t_id; - U8 te_count = object->getNumTEs(); - for (U8 i = 0; i < te_count; i++) + LLSD te_mat_llsd; + LLSD this_te_mat_llsd; + bool has_materials = false; + for (U8 i = 0, count = object->getNumTEs(); i < count; ++i) { - bool alreadyseen = false; - t_id = validateTextureID(object->getTE(i)->getID()); - this_te_llsd = object->getTE(i)->asLLSD(); + LLTextureEntry* te = object->getTE(i); + if (!te) continue; // Paranoia + + // Normal texture/diffuse map + t_id = validateTextureID(te->getID()); + this_te_llsd = te->asLLSD(); this_te_llsd["imageid"] = t_id; te_llsd.append(this_te_llsd); // Do not export Linden textures even though they don't taint creation. - if (t_id != LL_TEXTURE_PLYWOOD && + if (t_id != LL_TEXTURE_PLYWOOD && t_id != LL_TEXTURE_BLANK && t_id != LL_TEXTURE_TRANSPARENT && t_id != LL_TEXTURE_INVISIBLE && t_id != LL_TEXTURE_MEDIA) - { - std::list::iterator iter; - for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++) + { + if (mTexturesList.count(t_id) == 0) { - if ((*iter) == t_id) - { - alreadyseen = true; - break; - } + mTexturesList.insert(t_id); } - if (alreadyseen == false) - mTexturesList.push_back(t_id); + } + + // Materials + LLMaterial* mat = te->getMaterialParams().get(); + if (mat) + { + has_materials = true; + this_te_mat_llsd = mat->asLLSD(); + + t_id = validateTextureID(mat->getNormalID()); + this_te_mat_llsd["NormMap"] = t_id; + if (mTexturesList.count(t_id) == 0) + { + mTexturesList.insert(t_id); + } + + t_id = validateTextureID(mat->getSpecularID()); + this_te_mat_llsd["SpecMap"] = t_id; + if (mTexturesList.count(t_id) == 0) + { + mTexturesList.insert(t_id); + } + + te_mat_llsd.append(this_te_mat_llsd); } } prim_llsd["textures"] = te_llsd; + if (has_materials) + { + prim_llsd["materials"] = te_mat_llsd; + } // The keys in the primitive maps do not have to be localids, they can be any // string. We simply use localids because they are a unique identifier snprintf(localid, sizeof(localid), "%u", object->getLocalID()); llsd[(const char*)localid] = prim_llsd; } + updateExportNumbers(); + return llsd; } void LLObjectBackup::exportNextTexture() { - if (mTexturesList.empty()) - { - LL_INFOS("ObjectBackup") << "Finished exporting textures." << LL_ENDL; - return; - } - LLUUID id; - std::list::iterator iter; - iter = mTexturesList.begin(); - + textures_set_t::iterator iter = mTexturesList.begin(); while (true) { + if (mTexturesList.empty()) + { + mCheckNextTexture = true; + LL_INFOS("ObjectBackup") << "Finished exporting textures." << LL_ENDL; + return; + } if (iter == mTexturesList.end()) { - mNextTextureReady = true; + // Not yet ready, wait and re-check at next idle callback... + mCheckNextTexture = true; return; } - id = (*iter); + id = *iter++; if (id.isNull()) { // NULL texture id: just remove and ignore. - mTexturesList.remove(id); - iter = mTexturesList.begin(); + mTexturesList.erase(id); + LL_DEBUGS("ObjectBackup") << "Null texture UUID found, ignoring." + << LL_ENDL; continue; } LLViewerTexture* imagep = LLViewerTextureManager::findTexture(id); - if (imagep != NULL) + if (imagep) { - S32 cur_discard = imagep->getDiscardLevel(); - if (cur_discard > 0) + if (imagep->getDiscardLevel() > 0) { - if (imagep->getBoostLevel() != LLGLTexture::BOOST_PREVIEW) + // Boost texture loading + imagep->setBoostLevel(LLGLTexture::BOOST_PREVIEW); + LL_DEBUGS("ObjectBackup") << "Boosting texture: " << id + << LL_ENDL; + LLViewerFetchedTexture* tex; + tex = LLViewerTextureManager::staticCastToFetchedTexture(imagep); + if (tex && tex->getDesiredDiscardLevel() > 0) { - // we want to force discard 0: this one does this. - imagep->setBoostLevel(LLGLTexture::BOOST_PREVIEW); + // Set min discard level to 0 + tex->setMinDiscardLevel(0); + LL_DEBUGS("ObjectBackup") << "Min discard level set to 0 for texture: " + << id << LL_ENDL; } } else { + // Texture is ready ! break; } } @@ -806,13 +931,11 @@ void LLObjectBackup::exportNextTexture() { LL_WARNS("ObjectBackup") << "We *DON'T* have the texture " << id.asString() << LL_ENDL; mNonExportedTextures |= TEXTURE_MISSING; - mTexturesList.remove(id); - return; + mTexturesList.erase(id); } - iter++; } - mTexturesList.remove(id); + mTexturesList.erase(id); LL_INFOS("ObjectBackup") << "Requesting texture " << id << LL_ENDL; LLImageJ2C* mFormattedImage = new LLImageJ2C; @@ -822,20 +945,19 @@ void LLObjectBackup::exportNextTexture() void LLObjectBackup::importObject(bool upload) { + mRetexture = upload; mTexturesList.clear(); mAssetMap.clear(); - mCurrentAsset = LLUUID::null; + mCurrentAsset.setNull(); + mGotExtraPhysics = !gAgent.getRegion()->getCapability("GetObjectPhysicsData").empty(); + setDefaultTextures(); - - mRetexture = upload; - + // Open the file open dialog AIFilePicker* filepicker = AIFilePicker::create(); filepicker->open(FFLOAD_XML, "", "import"); filepicker->run(boost::bind(&LLObjectBackup::importObject_continued, this, filepicker)); - - return; } void LLObjectBackup::importObject_continued(AIFilePicker* filepicker) @@ -857,10 +979,12 @@ void LLObjectBackup::importObject_continued(AIFilePicker* filepicker) close(); return; } + show(false); mAgentPos = gAgent.getPositionAgent(); - mAgentRot = LLQuaternion(gAgent.getAtAxis(), gAgent.getLeftAxis(), gAgent.getUpAxis()); + mAgentRot = LLQuaternion(gAgent.getAtAxis(), gAgent.getLeftAxis(), + gAgent.getUpAxis()); // Get the texture map mCurObject = 1; @@ -870,66 +994,101 @@ void LLObjectBackup::importObject_continued(AIFilePicker* filepicker) mRezCount = 0; updateImportNumbers(); - for (LLSD::array_const_iterator prim_arr_it = mLLSD["data"].beginArray(); prim_arr_it != mLLSD["data"].endArray(); prim_arr_it++) + for (LLSD::array_const_iterator prim_arr_it = mLLSD["data"].beginArray(), + prim_arr_end = mLLSD["data"].endArray(); + prim_arr_it != prim_arr_end; ++prim_arr_it) { LLSD llsd2 = (*prim_arr_it)["group_body"]; - for (LLSD::map_const_iterator prim_it = llsd2.beginMap(); prim_it != llsd2.endMap(); prim_it++) + for (LLSD::map_const_iterator prim_it = llsd2.beginMap(), + prim_end = llsd2.endMap(); + prim_it != prim_end; ++prim_it) { LLSD prim_llsd = llsd2[prim_it->first]; - LLSD::array_iterator text_it; - std::list::iterator iter; - if (prim_llsd.has("sculpt")) { LLSculptParams sculpt; sculpt.fromLLSD(prim_llsd["sculpt"]); - LLUUID orig = sculpt.getSculptTexture(); - bool alreadyseen = false; - for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++) + if ((sculpt.getSculptType() & LL_SCULPT_TYPE_MASK) != LL_SCULPT_TYPE_MESH) { - if ((*iter) == orig) - alreadyseen = true; - } - if (alreadyseen == false) - { - LL_INFOS("ObjectBackup") << "Found a new SCULPT texture to upload " << orig << LL_ENDL; - mTexturesList.push_back(orig); + LLUUID orig = sculpt.getSculptTexture(); + if (mTexturesList.count(orig) == 0) + { + LL_INFOS("ObjectBackup") << "Found a new SCULPT texture to upload " << orig << LL_ENDL; + mTexturesList.insert(orig); + } } } LLSD& te_llsd = prim_llsd.has("textures") ? prim_llsd["textures"] : prim_llsd["texture"]; // Firestorm's format uses singular "texture" - for (text_it = te_llsd.beginArray(); text_it != te_llsd.endArray(); text_it++) + for (LLSD::array_iterator it = te_llsd.beginArray(); + it != te_llsd.endArray(); ++it) { - LLSD the_te = (*text_it); + LLSD the_te = *it; LLTextureEntry te; te.fromLLSD(the_te); - LLUUID id = te.getID(); - if (id != LL_TEXTURE_PLYWOOD && id != LL_TEXTURE_BLANK && id != LL_TEXTURE_INVISIBLE) // Do not upload the default textures - { - bool alreadyseen = false; + LLUUID t_id = te.getID(); + // Do not upload the default textures + if (t_id != LL_TEXTURE_PLYWOOD && t_id != LL_TEXTURE_BLANK && t_id != LL_TEXTURE_INVISIBLE) // Do not upload the default textures + { + if (mTexturesList.count(t_id) == 0) + { + LL_INFOS("ObjectBackup") << "Found a new texture to upload: "<< t_id << LL_ENDL; + mTexturesList.insert(t_id); + } + } + } - for (iter = mTexturesList.begin(); iter != mTexturesList.end(); iter++) + if (prim_llsd.has("materials")) + { + LLSD mat_llsd = prim_llsd["materials"]; + for (LLSD::array_iterator it = mat_llsd.beginArray(); + it != mat_llsd.endArray(); ++it) + { + LLSD the_mat = *it; + LLMaterial mat; + mat.fromLLSD(the_mat); + + LLUUID t_id = mat.getNormalID(); + if (t_id.notNull() && t_id != LL_TEXTURE_PLYWOOD && + t_id != LL_TEXTURE_BLANK && + t_id != LL_TEXTURE_INVISIBLE) { - if ((*iter) == te.getID()) - alreadyseen = true; + if (mTexturesList.count(t_id) == 0) + { + LL_INFOS("ObjectBackup") << "Found a new normal map to upload: " + << t_id << LL_ENDL; + mTexturesList.insert(t_id); + } } - if (alreadyseen == false) + + t_id = mat.getSpecularID(); + if (t_id.notNull() && t_id != LL_TEXTURE_PLYWOOD && + t_id != LL_TEXTURE_BLANK && + t_id != LL_TEXTURE_INVISIBLE) { - LL_INFOS("ObjectBackup") << "Found a new texture to upload "<< te.getID() << LL_ENDL; - mTexturesList.push_back(te.getID()); + if (mTexturesList.count(t_id) == 0) + { + LL_INFOS("ObjectBackup") << "Found a new specular map to upload: " + << t_id << LL_ENDL; + mTexturesList.insert(t_id); + } } - } + } } } } - if (mRetexture == TRUE) + if (mRetexture) + { uploadNextAsset(); + } else + { importFirstObject(); + } } LLVector3 LLObjectBackup::offsetAgent(LLVector3 offset) @@ -942,7 +1101,6 @@ void LLObjectBackup::rezAgentOffset(LLVector3 offset) // This will break for a sitting agent LLToolPlacer mPlacer; mPlacer.setObjectType(LL_PCODE_CUBE); - //LLVector3 pos = offsetAgent(offset); mPlacer.placeObject((S32)offset.mV[0], (S32)offset.mV[1], MASK_NONE); } @@ -975,10 +1133,12 @@ void LLObjectBackup::importNextObject() mRootRot = ll_quaternion_from_sd((*mGroupPrimImportIter)["root_rotation"]); rezAgentOffset(LLVector3(0.0, 2.0, 0.0)); - // Now we must wait for the callback when ViewerObjectList gets the new objects and we have the correct number selected + // Now we must wait for the callback when ViewerObjectList gets the new + // objects and we have the correct number selected } -// This function takes a pointer to a viewerobject and applies the prim definition that prim_llsd has +// This function takes a pointer to a viewerobject and applies the prim +// definition that prim_llsd has void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object) { LLUUID id = object->getID(); @@ -1027,29 +1187,34 @@ void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object) U32 flags(prim_llsd["flags"].asInteger()); object->setFlags(flags, true); } - else // Legacy + else // Kept for backward compatibility { - /*if (prim_llsd.has("shadows")) - if (prim_llsd["shadows"].asInteger() == 1) - object->setFlags(FLAGS_CAST_SHADOWS, true);*/ + /*if (prim_llsd.has("shadows")) + if (prim_llsd["shadows"].asInteger() == 1) + object->setFlags(FLAGS_CAST_SHADOWS, true);*/ - if (prim_llsd.has("phantom")) - if (prim_llsd["phantom"].asInteger() == 1) - object->setFlags(FLAGS_PHANTOM, true); + if (prim_llsd.has("phantom") && prim_llsd["phantom"].asInteger() == 1) + { + object->setFlags(FLAGS_PHANTOM, true); + } - if (prim_llsd.has("physical")) - if (prim_llsd["physical"].asInteger() == 1) + if (prim_llsd.has("physical") && + prim_llsd["physical"].asInteger() == 1) + { object->setFlags(FLAGS_USE_PHYSICS, true); + } } - if (prim_llsd.has("ExtraPhysics")) + if (mGotExtraPhysics && prim_llsd.has("ExtraPhysics")) { const LLSD& physics = prim_llsd["ExtraPhysics"]; object->setPhysicsShapeType(physics["PhysicsShapeType"].asInteger()); - object->setPhysicsDensity(physics["Density"].asFloat()); - object->setPhysicsFriction(physics["Friction"].asFloat()); - object->setPhysicsGravity(physics["GravityMultiplier"].asFloat()); - object->setPhysicsRestitution(physics["Restitution"].asFloat()); + F32 gravity = physics.has("Gravity") ? physics["Gravity"].asReal() + : physics["GravityMultiplier"].asReal(); + object->setPhysicsGravity(gravity); + object->setPhysicsFriction(physics["Friction"].asReal()); + object->setPhysicsDensity(physics["Density"].asReal()); + object->setPhysicsRestitution(physics["Restitution"].asReal()); object->updateFlags(true); } @@ -1065,10 +1230,10 @@ void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object) // TODO: check if map is valid and only set texture if map is valid and changes - if (mAssetMap[sculpt.getSculptTexture()].notNull()) + if (mAssetMap.count(sculpt.getSculptTexture())) { - LLUUID replacment = mAssetMap[sculpt.getSculptTexture()]; - sculpt.setSculptTexture(replacment); + LLUUID replacement = mAssetMap[sculpt.getSculptTexture()]; + sculpt.setSculptTexture(replacement); } object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt, true); @@ -1080,13 +1245,12 @@ void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object) light.fromLLSD(prim_llsd["light"]); object->setParameterEntry(LLNetworkData::PARAMS_LIGHT, light, true); } - if (prim_llsd.has("light_texture")) { - // Light Texture - LLLightImageParams light_texture; - light_texture.fromLLSD(prim_llsd["light_texture"]); - object->setParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE, light_texture, true); + // Light image + LLLightImageParams lightimg; + lightimg.fromLLSD(prim_llsd["light_texture"]); + object->setParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE, lightimg, true); } if (prim_llsd.has("flexible")) @@ -1097,31 +1261,56 @@ void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object) } // Textures - LL_INFOS("ObjectBackup") << "Processing textures for prim" << LL_ENDL; + LL_INFOS("ObjectBackup") << "Processing textures for prim" << id << LL_ENDL; LLSD& te_llsd = prim_llsd.has("textures") ? prim_llsd["textures"] : prim_llsd["texture"]; // Firestorm's format uses singular "texture" - LLSD::array_iterator text_it; U8 i = 0; - - for (text_it = te_llsd.beginArray(); text_it != te_llsd.endArray(); text_it++) + for (LLSD::array_iterator it = te_llsd.beginArray(); + it != te_llsd.endArray(); ++it) { - LLSD the_te = (*text_it); + LLSD the_te = *it; LLTextureEntry te; te.fromLLSD(the_te); - - if (mAssetMap[te.getID()].notNull()) + LLUUID t_id = te.getID(); + if (mAssetMap.count(t_id)) { - LLUUID replacment = mAssetMap[te.getID()]; - te.setID(replacment); + LLUUID replacement = mAssetMap[t_id]; + te.setID(replacement); } object->setTE(i++, te); } - LL_INFOS("ObjectBackup") << "Textures done !" << LL_ENDL; - //bump the iterator now so the callbacks hook together nicely - //if (mPrimImportIter != mThisGroup.endMap()) - // mPrimImportIter++; + // Materials + if (prim_llsd.has("materials")) + { + LL_INFOS("ObjectBackup") << "Processing materials for prim " << id << LL_ENDL; + te_llsd = prim_llsd["materials"]; + i = 0; + for (LLSD::array_iterator it = te_llsd.beginArray(); + it != te_llsd.endArray(); ++it) + { + LLSD the_mat = *it; + LLMaterialPtr mat = new LLMaterial(the_mat); + + LLUUID t_id = mat->getNormalID(); + if (id.notNull() && mAssetMap.count(t_id)) + { + LLUUID replacement = mAssetMap[t_id]; + mat->setNormalID(replacement); + } + + t_id = mat->getSpecularID(); + if (id.notNull() && mAssetMap.count(t_id)) + { + LLUUID replacement = mAssetMap[t_id]; + mat->setSpecularID(replacement); + } + + LLMaterialMgr::getInstance()->put(id, i++, *mat); + } + LL_INFOS("ObjectBackup") << "Materials done !" << LL_ENDL; + } object->sendRotationUpdate(); object->sendTEUpdate(); @@ -1134,16 +1323,14 @@ void LLObjectBackup::xmlToPrim(LLSD prim_llsd, LLViewerObject* object) // This is fired when the update packet is processed so we know the prim settings have stuck void LLObjectBackup::primUpdate(LLViewerObject* object) { - if (!mRunning) - return; - - if (object != NULL) - if (object->mID != mExpectingUpdate) + if (!mRunning || (object != NULL && object->mID != mExpectingUpdate)) + { return; + } - mCurPrim++; + ++mCurPrim; updateImportNumbers(); - mPrimImportIter++; + ++mPrimImportIter; LLUUID x; mExpectingUpdate = x.null; @@ -1163,8 +1350,8 @@ void LLObjectBackup::primUpdate(LLViewerObject* object) root->setRotation(mRootRot); } - mCurObject++; - mGroupPrimImportIter++; + ++mCurObject; + ++mGroupPrimImportIter; if (mGroupPrimImportIter != mLLSD["data"].endArray()) { importNextObject(); @@ -1181,6 +1368,8 @@ void LLObjectBackup::primUpdate(LLViewerObject* object) if (mToSelect.empty()) { LL_WARNS("ObjectBackup") << "error: ran out of objects to mod." << LL_ENDL; + mRunning = false; + close(); return; } @@ -1188,7 +1377,7 @@ void LLObjectBackup::primUpdate(LLViewerObject* object) { //rezAgentOffset(LLVector3(1.0, 0.0, 0.0)); LLSD prim_llsd = mThisGroup[mPrimImportIter->first]; - mProcessIter++; + ++mProcessIter; xmlToPrim(prim_llsd, *mProcessIter); } } @@ -1198,10 +1387,10 @@ bool LLObjectBackup::newPrim(LLViewerObject* pobject) { if (mRunning) { - mRezCount++; + ++mRezCount; mToSelect.push_back(pobject); updateImportNumbers(); - mPrimImportIter++; + ++mPrimImportIter; pobject->setPosition(offsetAgent(LLVector3(0.0, 1.0, 0.0))); LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); @@ -1213,8 +1402,8 @@ bool LLObjectBackup::newPrim(LLViewerObject* pobject) else { LL_INFOS("ObjectBackup") << "All prims rezzed, moving to build stage" << LL_ENDL; - // Deselecting is required to ensure that the first child prim - // in the link set (which is also the last rezzed prim and thus + // Deselecting is required to ensure that the first child prim in + // the link set (which is also the last rezzed prim and thus // currently selected) will be properly renamed and desced. LLSelectMgr::getInstance()->deselectAll(); mPrimImportIter = mThisGroup.beginMap(); @@ -1228,17 +1417,22 @@ bool LLObjectBackup::newPrim(LLViewerObject* pobject) void LLObjectBackup::updateMap(LLUUID uploaded_asset) { - if (mCurrentAsset.isNull()) - return; + if (mCurrentAsset.notNull()) + { + LL_INFOS("ObjectBackup") << "Mapping " << mCurrentAsset << " to " << uploaded_asset << LL_ENDL; - LL_INFOS("ObjectBackup") << "Mapping " << mCurrentAsset << " to " << uploaded_asset << LL_ENDL; - mAssetMap.insert(std::pair(mCurrentAsset, uploaded_asset)); + mAssetMap[mCurrentAsset] = uploaded_asset; + } } -void myupload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type, - std::string name, std::string desc, S32 compression_info, +void myupload_new_resource(const LLTransactionID &tid, + LLAssetType::EType asset_type, + std::string name, + std::string desc, + S32 compression_info, LLFolderType::EType destination_folder_type, - LLInventoryType::EType inv_type, U32 next_owner_perm, + LLInventoryType::EType inv_type, + U32 next_owner_perm, const std::string& display_name, LLAssetStorage::LLStoreAssetCallback callback, void *userdata) @@ -1259,7 +1453,9 @@ void myupload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ if (!url.empty()) { LLSD body; - body["folder_id"] = gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type); + body["folder_id"] = gInventory.findCategoryUUIDForType(destination_folder_type == LLFolderType::FT_NONE ? + LLFolderType::assetTypeToFolderType(asset_type) : + destination_folder_type); body["asset_type"] = LLAssetType::lookup(asset_type); body["inventory_type"] = LLInventoryType::lookup(inv_type); body["name"] = name; @@ -1268,7 +1464,6 @@ void myupload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ std::ostringstream llsdxml; LLSDSerialize::toXML(body, llsdxml); LL_DEBUGS("ObjectBackup") << "posting body to capability: " << llsdxml.str() << LL_ENDL; - //LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type)); LLHTTPClient::post(url, body, new importResponder(body, uuid, asset_type)); } else @@ -1282,19 +1477,18 @@ void LLObjectBackup::uploadNextAsset() if (mTexturesList.empty()) { LL_INFOS("ObjectBackup") << "Texture list is empty, moving to rez stage." << LL_ENDL; - mCurrentAsset = LLUUID::null; + mCurrentAsset.setNull(); importFirstObject(); return; } updateImportNumbers(); - std::list::iterator iter; - iter = mTexturesList.begin(); + textures_set_t::iterator iter = mTexturesList.begin(); LLUUID id = *iter; - mTexturesList.pop_front(); + mTexturesList.erase(iter); - LL_INFOS("ObjectBackup") << "Got texture ID " << id << ": trying to upload" << LL_ENDL; + LL_INFOS("ObjectBackup") << "Got texture ID " << id << ": trying to upload..." << LL_ENDL; mCurrentAsset = id; std::string struid; @@ -1329,6 +1523,7 @@ void LLObjectBackup::uploadNextAsset() } myupload_new_resource(tid, LLAssetType::AT_TEXTURE, struid, struid, 0, - LLFolderType::FT_TEXTURE, LLInventoryType::defaultForAssetType(LLAssetType::AT_TEXTURE), + LLFolderType::FT_TEXTURE, + LLInventoryType::defaultForAssetType(LLAssetType::AT_TEXTURE), 0x0, "Uploaded texture", NULL, NULL); } diff --git a/indra/newview/llviewerobjectbackup.h b/indra/newview/llviewerobjectbackup.h index ddf4f021f..2b29d91fd 100644 --- a/indra/newview/llviewerobjectbackup.h +++ b/indra/newview/llviewerobjectbackup.h @@ -30,10 +30,15 @@ #ifndef LL_LLVIEWEROBJECTBACKUP_H #define LL_LLVIEWEROBJECTBACKUP_H +#include "boost/unordered_map.hpp" +#include "boost/unordered_set.hpp" + #include "llviewerinventory.h" enum export_states { EXPORT_INIT, + EXPORT_CHECK_PERMS, + EXPORT_FETCH_PHYSICS, EXPORT_STRUCTURE, EXPORT_TEXTURES, EXPORT_LLSD, @@ -48,17 +53,17 @@ public: // Floater stuff virtual void show(bool exporting); - virtual void draw(); virtual void onClose(bool app_quitting); // Static accessor static LLObjectBackup* getInstance(); + static bool instanceExists() { return sInstance != NULL; } // Export idle callback static void exportWorker(void *userdata); // Import entry point - void importObject(bool upload=FALSE); + void importObject(bool upload = false); void importObject_continued(AIFilePicker* filepicker); // Export entry point @@ -72,7 +77,7 @@ public: void uploadNextAsset(); // Folder public geter - std::string getfolder() { return mFolder; }; + std::string getfolder() { return mFolder; } // Prim updated callback void primUpdate(LLViewerObject* object); @@ -87,8 +92,11 @@ public: static const U32 TEXTURE_IS_NULL = 0x08; static const U32 TEXTURE_SAVED_FAILED = 0x10; - // Is ready for next texture? - bool mNextTextureReady; + // Set when the region supports the extra physics flags + bool mGotExtraPhysics; + + // Are we ready to check for next texture? + bool mCheckNextTexture; // Export state machine enum export_states mExportState; @@ -96,23 +104,24 @@ public: // Export result flags for textures. U32 mNonExportedTextures; + static void setDefaultTextures(); + // Is exporting these objects allowed bool validatePerms(const LLPermissions* item_permissions); private: - // Static singleton stuff - LLObjectBackup(); - static LLObjectBackup* sInstance; + LLObjectBackup(); // Update the floater with status numbers void updateImportNumbers(); void updateExportNumbers(); // Permissions stuff. - LLUUID validateTextureID(LLUUID asset_id); + LLUUID validateTextureID(const LLUUID& asset_id); // Convert a selection list of objects to LLSD - LLSD primsToLLSD(LLViewerObject::child_list_t child_list, bool is_attachment); + LLSD primsToLLSD(LLViewerObject::child_list_t child_list, + bool is_attachment); // Start the import process void importFirstObject(); @@ -126,19 +135,18 @@ private: // Apply LLSD to object void xmlToPrim(LLSD prim_llsd, LLViewerObject* pobject); - // Rez a prim at a given position (note not agent offset X/Y screen for raycast) + // Rez a prim at a given position void rezAgentOffset(LLVector3 offset); // Get an offset from the agent based on rotation and current pos LLVector3 offsetAgent(LLVector3 offset); +private: + static LLObjectBackup* sInstance; + // Are we active flag bool mRunning; - // File and folder name control - std::string mFileName; - std::string mFolder; - // True if we need to rebase the assets bool mRetexture; @@ -151,26 +159,6 @@ private: // No prims rezed U32 mRezCount; - // Rebase map - std::map mAssetMap; - - // Export texture list - std::list mTexturesList; - - // Import object tracking - std::vector mToSelect; - std::vector::iterator mProcessIter; - - // Working LLSD holders - LLUUID mCurrentAsset; - LLSD mLLSD; - LLSD mThisGroup; - LLUUID mExpectingUpdate; - - // Working llsd itterators for objects and linksets - LLSD::map_const_iterator mPrimImportIter; - LLSD::array_const_iterator mGroupPrimImportIter; - // Root pos and rotation and central root pos for link set LLVector3 mRootPos; LLQuaternion mRootRot; @@ -180,6 +168,31 @@ private: // Agent inital pos and rot when starting import LLVector3 mAgentPos; LLQuaternion mAgentRot; + // Rebase map + boost::unordered_map mAssetMap; + + // Export texture list + typedef boost::unordered_set textures_set_t; + textures_set_t mTexturesList; + textures_set_t mBadPermsTexturesList; + + // Import object tracking + std::vector mToSelect; + std::vector::iterator mProcessIter; + + // File and folder name control + std::string mFileName; + std::string mFolder; + + // Working LLSD holders + LLUUID mCurrentAsset; + LLUUID mExpectingUpdate; + LLSD mLLSD; + LLSD mThisGroup; + + // Working llsd itterators for objects and linksets + LLSD::map_const_iterator mPrimImportIter; + LLSD::array_const_iterator mGroupPrimImportIter; }; #endif \ No newline at end of file diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1e77f7b43..f0b74c6e1 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1654,7 +1654,7 @@ LLViewerWindow::LLViewerWindow( vsync_mode, !gNoRender, ignore_pixel_depth, - gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled + LLRenderTarget::sUseFBO ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled if (!LLViewerShaderMgr::sInitialized) { //immediately initialize shaders @@ -5500,7 +5500,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, return TRUE; } - U32 fsaa = gSavedSettings.getU32("RenderFSAASamples"); + U32 fsaa = LLRenderTarget::sUseFBO ? 0 : gSavedSettings.getU32("RenderFSAASamples"); //don't use window level anti-aliasing if FBOs are enabled U32 old_fsaa = mWindow->getFSAASamples(); // going from windowed to windowed @@ -5512,7 +5512,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, mWindow->setSize(size); } - if (fsaa == old_fsaa && vsync_mode == mWindow->getFSAASamples()) + if (fsaa == old_fsaa && vsync_mode == mWindow->getVsyncMode()) { return TRUE; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 64222ff51..26dae3313 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -8819,6 +8819,100 @@ void LLVOAvatar::updateLODRiggedAttachments( void ) updateLOD(); rebuildRiggedAttachments(); } + +void LLVOAvatar::updateSoftwareSkinnedVertices(const LLMeshSkinInfo* skin, const LLVector4a* weight, const LLVolumeFace& vol_face, LLVertexBuffer *buffer) +{ + //perform software vertex skinning for this face + LLStrider position; + LLStrider normal; + + bool has_normal = buffer->hasDataType(LLVertexBuffer::TYPE_NORMAL); + buffer->getVertexStrider(position); + + if (has_normal) + { + buffer->getNormalStrider(normal); + } + + LLVector4a* pos = (LLVector4a*) position.get(); + + LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL; + + //build matrix palette + LLMatrix4a mp[JOINT_COUNT]; + LLMatrix4* mat = (LLMatrix4*) mp; + + U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT); + + llassert_always(count); + + for (U32 j = 0; j < count; ++j) + { + LLJoint* joint = getJoint(skin->mJointNames[j]); + if(!joint) + { + joint = getJoint("mRoot"); + } + if (joint) + { + mat[j] = skin->mInvBindMatrix[j]; + mat[j] *= joint->getWorldMatrix(); + } + } + + LLMatrix4a bind_shape_matrix; + bind_shape_matrix.loadu(skin->mBindShapeMatrix); + + for (U32 j = 0; j < (U32)buffer->getNumVerts(); ++j) + { + LLMatrix4a final_mat; + final_mat.clear(); + + S32 idx[4]; + + LLVector4 wght; + + F32 scale = 0.f; + for (U32 k = 0; k < 4; k++) + { + F32 w = weight[j][k]; + + idx[k] = (S32) floorf(w); + wght[k] = w - floorf(w); + scale += wght[k]; + } + + if(scale > 0.f) + wght *= 1.f/scale; + else + wght = LLVector4(F32_MAX,F32_MAX,F32_MAX,F32_MAX); + + for (U32 k = 0; k < 4; k++) + { + F32 w = wght[k]; + LLMatrix4a src; + src.setMul(mp[idx[k]], w); + + final_mat.add(src); + } + + LLVector4a& v = vol_face.mPositions[j]; + LLVector4a t; + LLVector4a dst; + bind_shape_matrix.affineTransform(v, t); + final_mat.affineTransform(t, dst); + pos[j] = dst; + + if (norm) + { + LLVector4a& n = vol_face.mNormals[j]; + bind_shape_matrix.rotate(n, t); + final_mat.rotate(t, dst); + dst.normalize3fast(); + norm[j] = dst; + } + } +} U32 LLVOAvatar::getPartitionType() const { // Avatars merely exist as drawables in the bridge partition diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index ded74c50b..f8bd7fe13 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -79,6 +79,7 @@ class LLHUDEffectSpiral; class LLTexGlobalColor; class LLViewerJoint; struct LLAppearanceMessageContents; +class LLMeshSkinInfo; class SHClientTagMgr : public LLSingleton, public boost::signals2::trackable { @@ -181,6 +182,7 @@ public: /*virtual*/ BOOL updateLOD(); BOOL updateJointLODs(); void updateLODRiggedAttachments( void ); + void updateSoftwareSkinnedVertices(const LLMeshSkinInfo* skin, const LLVector4a* weight, const LLVolumeFace& vol_face, LLVertexBuffer *buffer); /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. S32 totalTextureMemForUUIDS(std::set& ids); bool allTexturesCompletelyDownloaded(std::set& ids) const; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a94d9e856..2c7aa39aa 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3916,15 +3916,20 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons } //build matrix palette - static const size_t kMaxJoints = 64; - - LLMatrix4a mp[kMaxJoints]; + LLMatrix4a mp[JOINT_COUNT]; LLMatrix4* mat = (LLMatrix4*) mp; - - U32 maxJoints = llmin(skin->mJointNames.size(), kMaxJoints); - for (U32 j = 0; j < maxJoints; ++j) + + U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT); + + llassert_always(count); + + for (U32 j = 0; j < count; ++j) { LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); + if(!joint) + { + joint = avatar->getJoint("mRoot"); + } if (joint) { mat[j] = skin->mInvBindMatrix[j]; @@ -3973,17 +3978,17 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons scale += wght[k]; } - wght *= 1.f/scale; + if(scale > 0.f) + wght *= 1.f/scale; + else + wght = LLVector4(F32_MAX,F32_MAX,F32_MAX,F32_MAX); for (U32 k = 0; k < 4; k++) { F32 w = wght[k]; - LLMatrix4a src; - // Ensure ref'd bone is in our clamped array of mats - llassert(idx[k] < kMaxJoints); - // clamp k to kMaxJoints to avoid reading garbage off stack in release - src.setMul(mp[idx[(k < kMaxJoints) ? k : 0]], w); + src.setMul(mp[idx[k]], w); + final_mat.add(src); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 2593391be..4e40e2a89 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -428,6 +428,9 @@ void LLPipeline::init() { refreshCachedSettings(); + bool can_defer = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred"); + LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderUseFBO") || (gSavedSettings.getBOOL("RenderDeferred") && can_defer); + gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); gOctreeReserveCapacity = llmin(gSavedSettings.getU32("OctreeReserveNodeCapacity"),U32(512)); sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); diff --git a/indra/newview/skins/default/xui/en-us/floater_region_restarting.xml b/indra/newview/skins/default/xui/en-us/floater_region_restarting.xml index fdad11853..e9dc5c902 100644 --- a/indra/newview/skins/default/xui/en-us/floater_region_restarting.xml +++ b/indra/newview/skins/default/xui/en-us/floater_region_restarting.xml @@ -7,6 +7,7 @@ help_topic="floater_region_restarting" single_instance="true" reuse_instance="false" + can_minimize="true" title="Region Restarting"> The region you are in now diff --git a/indra/newview/skins/default/xui/en-us/floater_snapshot.xml b/indra/newview/skins/default/xui/en-us/floater_snapshot.xml index 9e78bb6d3..f85602818 100644 --- a/indra/newview/skins/default/xui/en-us/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en-us/floater_snapshot.xml @@ -104,6 +104,9 @@ + + Current Window + 512x512 (1:1) @@ -131,6 +134,9 @@ 128x512 (1:4) + + Custom + diff --git a/indra/newview/skins/default/xui/en-us/floater_tools.xml b/indra/newview/skins/default/xui/en-us/floater_tools.xml index 2a07de761..09bb81cb4 100644 --- a/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/indra/newview/skins/default/xui/en-us/floater_tools.xml @@ -972,8 +972,8 @@ increment="5" initial_val="0" left="121" max_val="95" min_val="0" mouse_opaque="true" name="Scale 1" width="68" /> + increment="0.05" initial_val="0" left_delta="73" max_val="0.99" + min_val="-0.99" mouse_opaque="true" name="Skew" width="68" /> - - - @@ -25,11 +25,11 @@ - -