diff options
author | Geenz <geenz@geenzo.com> | 2013-02-04 11:55:04 -0500 |
---|---|---|
committer | Geenz <geenz@geenzo.com> | 2013-02-04 11:55:04 -0500 |
commit | aae698ff0c1973d7ad6ba6ccc1ca858fb3baf5b8 (patch) | |
tree | 8f012ef9ce35c8b3f671748b377741f2640be521 /indra | |
parent | 2ae4b6976baf0556066d5a3b43b8f6148f18c1d8 (diff) | |
parent | 68ec77127b158f0abffb6160eb7d870c85b278ad (diff) |
Merged with latest viewer-dev-materials.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/tests/llprocess_test.cpp | 12 | ||||
-rw-r--r-- | indra/llcorehttp/tests/test_httpstatus.hpp | 18 | ||||
-rw-r--r-- | indra/llprimitive/llmaterialid.cpp | 7 | ||||
-rw-r--r-- | indra/llprimitive/llmaterialid.h | 2 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl | 4 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl | 4 | ||||
-rw-r--r-- | indra/newview/llmaterialmgr.cpp | 75 | ||||
-rw-r--r-- | indra/newview/llpanelface.cpp | 215 | ||||
-rw-r--r-- | indra/newview/llpanelface.h | 2 | ||||
-rw-r--r-- | indra/newview/llselectmgr.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 1 | ||||
-rw-r--r-- | indra/test/io.cpp | 2 |
13 files changed, 245 insertions, 111 deletions
diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 99186ed434..6f1e7d46b8 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -608,6 +608,9 @@ namespace tut void object::test<5>() { set_test_name("exit(2)"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif PythonProcessLauncher py(get_test_name(), "import sys\n" "sys.exit(2)\n"); @@ -620,6 +623,9 @@ namespace tut void object::test<6>() { set_test_name("syntax_error:"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif PythonProcessLauncher py(get_test_name(), "syntax_error:\n"); py.mParams.files.add(LLProcess::FileParam()); // inherit stdin @@ -641,6 +647,9 @@ namespace tut void object::test<7>() { set_test_name("explicit kill()"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif PythonProcessLauncher py(get_test_name(), "from __future__ import with_statement\n" "import sys, time\n" @@ -685,6 +694,9 @@ namespace tut void object::test<8>() { set_test_name("implicit kill()"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif NamedTempFile out("out", "not started"); LLProcess::handle phandle(0); { diff --git a/indra/llcorehttp/tests/test_httpstatus.hpp b/indra/llcorehttp/tests/test_httpstatus.hpp index f7b542d3b5..887315befc 100644 --- a/indra/llcorehttp/tests/test_httpstatus.hpp +++ b/indra/llcorehttp/tests/test_httpstatus.hpp @@ -91,6 +91,9 @@ template <> template <> void HttpStatusTestObjectType::test<2>() { set_test_name("HttpStatus memory structure"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif // Require that an HttpStatus object can be trivially // returned as a function return value in registers. @@ -104,6 +107,9 @@ template <> template <> void HttpStatusTestObjectType::test<3>() { set_test_name("HttpStatus valid error string conversion"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif HttpStatus status; status.mType = HttpStatus::EXT_CURL_EASY; @@ -136,6 +142,9 @@ template <> template <> void HttpStatusTestObjectType::test<4>() { set_test_name("HttpStatus invalid error string conversion"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif HttpStatus status; status.mType = HttpStatus::EXT_CURL_EASY; @@ -161,6 +170,9 @@ template <> template <> void HttpStatusTestObjectType::test<5>() { set_test_name("HttpStatus equality/inequality testing"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif // Make certain equality/inequality tests do not pass // through the bool conversion. Distinct successful @@ -181,6 +193,9 @@ template <> template <> void HttpStatusTestObjectType::test<6>() { set_test_name("HttpStatus basic HTTP status encoding"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif HttpStatus status; status.mType = 200; @@ -228,6 +243,9 @@ template <> template <> void HttpStatusTestObjectType::test<7>() { set_test_name("HttpStatus HTTP error text strings"); +#if LL_WINDOWS + skip("MAINT-2302: This frequently (though not always) fails on Windows."); +#endif HttpStatus status(100, HE_REPLY_ERROR); std::string msg(status.toString()); diff --git a/indra/llprimitive/llmaterialid.cpp b/indra/llprimitive/llmaterialid.cpp index 590f5cd91f..820f62c43c 100644 --- a/indra/llprimitive/llmaterialid.cpp +++ b/indra/llprimitive/llmaterialid.cpp @@ -150,6 +150,13 @@ std::string LLMaterialID::asString() const return materialIDString; } +std::ostream& operator<<(std::ostream& s, const LLMaterialID &material_id) +{ + s << material_id.asString(); + return s; +} + + void LLMaterialID::parseFromBinary (const LLSD::Binary& pMaterialID) { llassert(pMaterialID.size() == (MATERIAL_ID_SIZE * sizeof(U8))); diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h index 9db4065302..0a95204085 100644 --- a/indra/llprimitive/llmaterialid.h +++ b/indra/llprimitive/llmaterialid.h @@ -60,6 +60,8 @@ public: LLSD asLLSD() const; std::string asString() const; + friend std::ostream& operator<<(std::ostream& s, const LLMaterialID &material_id); + static const LLMaterialID null; private: diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl index 86390bdd83..85f28f68c0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl @@ -38,10 +38,10 @@ VARYING vec2 vary_texcoord0; void main() { vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb; - frag_data[0] = vec4(col, 0.0); + frag_data[0] = vec4(col * (1 - vertex_color.a), 0.0); frag_data[1] = vertex_color.aaaa; // spec //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested vec3 nvn = normalize(vary_normal); - frag_data[2] = vec4(nvn.xyz * 0.5 + 0.5, 0.0); + frag_data[2] = vec4(nvn.xyz * 0.5 + 0.5, vertex_color.a); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl index 788b966af8..6b5a922c29 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl @@ -37,9 +37,9 @@ void main() { vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb; - frag_data[0] = vec4(col, 0.0); + frag_data[0] = vec4(col * (1 - vertex_color.a), 0.0); frag_data[1] = vertex_color.aaaa; // spec //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested vec3 nvn = normalize(vary_normal); - frag_data[2] = vec4(nvn.xyz * 0.5 + 0.5, 0.0); + frag_data[2] = vec4(nvn.xyz * 0.5 + 0.5, vertex_color.a); } diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 3138bfd4e1..d74cc0c6ed 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -2,9 +2,9 @@ * @file llmaterialmgr.cpp * @brief Material manager * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * $LicenseInfo:firstyear=2013&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2013, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -96,10 +96,10 @@ void LLMaterialsResponder::result(const LLSD& pContent) void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason) { - LL_WARNS("debugMaterials") << "--------------------------------------------------------------------------" << LL_ENDL; - LL_WARNS("debugMaterials") << mMethod << " Error[" << pStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME + LL_WARNS("Materials") << "--------------------------------------------------------------------------" << LL_ENDL; + LL_WARNS("Materials") << mMethod << " Error[" << pStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME << "' with url '" << mCapabilityURL << "' because " << pReason << LL_ENDL; - LL_WARNS("debugMaterials") << "--------------------------------------------------------------------------" << LL_ENDL; + LL_WARNS("Materials") << "--------------------------------------------------------------------------" << LL_ENDL; LLSD emptyResult; mCallback(false, emptyResult); @@ -128,23 +128,31 @@ bool LLMaterialMgr::isGetPending(const LLUUID& region_id, const LLMaterialID& ma const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id) { + LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL; + LLMaterialPtr material; material_map_t::const_iterator itMaterial = mMaterials.find(material_id); if (mMaterials.end() != itMaterial) { - return itMaterial->second; + material = itMaterial->second; + LL_DEBUGS("Materials") << " found material " << LL_ENDL; } - - if (!isGetPending(region_id, material_id)) + else { - get_queue_t::iterator itQueue = mGetQueue.find(region_id); - if (mGetQueue.end() == itQueue) + if (!isGetPending(region_id, material_id)) { - std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t())); - itQueue = ret.first; + LL_DEBUGS("Materials") << " material pending " << material_id << LL_ENDL; + get_queue_t::iterator itQueue = mGetQueue.find(region_id); + if (mGetQueue.end() == itQueue) + { + std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t())); + itQueue = ret.first; + } + itQueue->second.insert(material_id); } - itQueue->second.insert(material_id); + LL_DEBUGS("Materials") << " returning empty material " << LL_ENDL; + material = LLMaterialPtr(); } - return LLMaterialPtr(); + return material; } boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id, LLMaterialMgr::get_callback_t::slot_type cb) @@ -188,8 +196,13 @@ void LLMaterialMgr::getAll(const LLUUID& region_id) { if (!isGetAllPending(region_id)) { + LL_DEBUGS("Materials") << "queuing for region " << region_id << LL_ENDL; mGetAllQueue.insert(region_id); } + else + { + LL_DEBUGS("Materials") << "already pending for region " << region_id << LL_ENDL; + } } boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMaterialMgr::getall_callback_t::slot_type cb) @@ -210,6 +223,7 @@ boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMat void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& material) { + LL_DEBUGS("Materials") << "object " << object_id << LL_ENDL; put_queue_t::iterator itQueue = mPutQueue.find(object_id); if (mPutQueue.end() == itQueue) { @@ -230,9 +244,11 @@ void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial& const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data) { + LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL; material_map_t::const_iterator itMaterial = mMaterials.find(material_id); if (mMaterials.end() == itMaterial) { + LL_DEBUGS("Materials") << "new material" << LL_ENDL; LLMaterialPtr newMaterial(new LLMaterial(material_data)); std::pair<material_map_t::const_iterator, bool> ret = mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(material_id, newMaterial)); itMaterial = ret.first; @@ -257,6 +273,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI if (!success) { // *TODO: is there any kind of error handling we can do here? + LL_WARNS("Materials")<< "failed"<<LL_ENDL; return; } @@ -271,11 +288,12 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI LLSD response_data; if (!unzip_llsd(response_data, content_stream, content_binary.size())) { - LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; + LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL; return; } llassert(response_data.isArray()); + LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL; for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial) { const LLSD& material_data = *itMaterial; @@ -297,6 +315,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL if (!success) { // *TODO: is there any kind of error handling we can do here? + LL_WARNS("Materials")<< "failed"<<LL_ENDL; return; } @@ -311,7 +330,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL LLSD response_data; if (!unzip_llsd(response_data, content_stream, content_binary.size())) { - LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; + LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL; return; } @@ -319,6 +338,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL material_map_t materials; llassert(response_data.isArray()); + LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL; for (LLSD::array_const_iterator itMaterial = response_data.beginArray(); itMaterial != response_data.endArray(); ++itMaterial) { const LLSD& material_data = *itMaterial; @@ -361,6 +381,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) if (!success) { // *TODO: is there any kind of error handling we can do here? + LL_WARNS("Materials")<< "failed"<<LL_ENDL; return; } @@ -375,13 +396,13 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) LLSD response_data; if (!unzip_llsd(response_data, content_stream, content_binary.size())) { - LL_ERRS("debugMaterials") << "Cannot unzip LLSD binary content" << LL_ENDL; + LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL; return; } else { llassert(response_data.isArray()); - + LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL; for (LLSD::array_const_iterator faceIter = response_data.beginArray(); faceIter != response_data.endArray(); ++faceIter) { # ifndef LL_RELEASE_FOR_DOWNLOAD @@ -446,7 +467,7 @@ void LLMaterialMgr::processGetQueue() const LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); if (!regionp) { - LL_WARNS("debugMaterials") << "Unknown region with id " << region_id.asString() << LL_ENDL; + LL_WARNS("Materials") << "Unknown region with id " << region_id.asString() << LL_ENDL; mGetQueue.erase(itRegionQueue); continue; } @@ -463,7 +484,7 @@ void LLMaterialMgr::processGetQueue() const std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); if (capURL.empty()) { - LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME + LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; mGetQueue.erase(itRegionQueue); continue; @@ -486,7 +507,7 @@ void LLMaterialMgr::processGetQueue() S32 materialSize = materialString.size(); if (materialSize <= 0) { - LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; + LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL; return; } @@ -513,7 +534,7 @@ void LLMaterialMgr::processGetAllQueue() LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); if (regionp == NULL) { - LL_WARNS("debugMaterials") << "Unknown region with id " << region_id.asString() << LL_ENDL; + LL_WARNS("Materials") << "Unknown region with id " << region_id.asString() << LL_ENDL; mGetAllQueue.erase(itRegion); continue; } @@ -525,12 +546,13 @@ void LLMaterialMgr::processGetAllQueue() std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); if (capURL.empty()) { - LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME + LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME << "' is not defined on the current region '" << regionp->getName() << "'" << LL_ENDL; mGetAllQueue.erase(itRegion); continue; } + LL_DEBUGS("Materials") << "getAll for region " << region_id << LL_ENDL; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("GET", capURL, boost::bind(&LLMaterialMgr::onGetAllResponse, this, _1, _2, *itRegion)); LLHTTPClient::get(capURL, materialsResponder); mGetAllPending.insert(std::pair<LLUUID, F64>(region_id, LLFrameTimer::getTotalSeconds())); @@ -549,7 +571,7 @@ void LLMaterialMgr::processPutQueue() const LLViewerObject* objectp = gObjectList.findObject(object_id); if ( (!objectp) || (!objectp->getRegion()) ) { - LL_WARNS("debugMaterials") << "Object or object region is NULL" << LL_ENDL; + LL_WARNS("Materials") << "Object or object region is NULL" << LL_ENDL; mPutQueue.erase(itQueue); continue; @@ -564,7 +586,7 @@ void LLMaterialMgr::processPutQueue() std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME); if (capURL.empty()) { - LL_WARNS("debugMaterials") << "Capability '" << MATERIALS_CAPABILITY_NAME + LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME << "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL; mPutQueue.erase(itQueue); @@ -592,7 +614,7 @@ void LLMaterialMgr::processPutQueue() S32 materialSize = materialString.size(); if (materialSize <= 0) { - LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL; + LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL; mPutQueue.erase(itQueue); continue; @@ -606,6 +628,7 @@ void LLMaterialMgr::processPutQueue() LLSD putData = LLSD::emptyMap(); putData[MATERIALS_CAP_ZIP_FIELD] = materialBinary; + LL_DEBUGS("Materials") << "put for " << facesData.size() << " faces; object " << object_id << LL_ENDL; LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("PUT", capURL, boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2)); LLHTTPClient::put(capURL, putData, materialsResponder); } diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 024265b377..474fa9d58e 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -699,7 +699,7 @@ void LLPanelFace::getState() { llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; } - onCommitAlphaMode(getChild<LLComboBox>("combobox alphamode"),this); + updateAlphaControls(getChild<LLComboBox>("combobox alphamode"),this); } if (identical) @@ -712,10 +712,10 @@ void LLPanelFace::getState() texture_ctrl->setImageAssetID( id ); shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); - shinytexture_ctrl->setImageAssetID( id ); + shinytexture_ctrl->setImageAssetID( LLUUID::null ); bumpytexture_ctrl->setTentative( FALSE ); bumpytexture_ctrl->setEnabled( editable ); - bumpytexture_ctrl->setImageAssetID( id ); + bumpytexture_ctrl->setImageAssetID( LLUUID::null ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); @@ -751,10 +751,10 @@ void LLPanelFace::getState() texture_ctrl->setImageAssetID( id ); shinytexture_ctrl->setTentative( TRUE ); shinytexture_ctrl->setEnabled( editable ); - shinytexture_ctrl->setImageAssetID( id ); + shinytexture_ctrl->setImageAssetID( LLUUID::null ); bumpytexture_ctrl->setTentative( TRUE ); bumpytexture_ctrl->setEnabled( editable ); - bumpytexture_ctrl->setImageAssetID( id ); + bumpytexture_ctrl->setImageAssetID( LLUUID::null ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); @@ -1091,11 +1091,6 @@ void LLPanelFace::getState() getChild<LLUICtrl>("checkbox fullbright")->setTentative(!identical); } - // Repeats per meter label - { - getChildView("rpt")->setEnabled(editable); - } - // Repeats per meter { F32 repeats = 1.f; @@ -1126,7 +1121,7 @@ void LLPanelFace::getState() // Materials { mMaterialID = LLMaterialID::null; - //mMaterial = LLMaterialPtr(); + mMaterial.reset(); struct f1 : public LLSelectedTEGetFunctor<LLMaterialID> { LLMaterialID get(LLViewerObject* object, S32 te_index) @@ -1142,6 +1137,7 @@ void LLPanelFace::getState() << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; if (!mMaterialID.isNull() && editable) { + llinfos << "Requesting material ID " << mMaterialID.asString() << llendl; LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); } } @@ -1209,14 +1205,25 @@ void LLPanelFace::refresh() void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) { - llinfos << "Material loaded: " << material_id.asString() - << ", LLSD: " << material->asLLSD() << llendl; mMaterial = material; - getChild<LLUICtrl>("maskcutoff")->setValue(material->getAlphaMaskCutoff()); - getChild<LLColorSwatchCtrl>("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); - getChild<LLColorSwatchCtrl>("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); - getChild<LLUICtrl>("glossiness")->setValue((F32)(material->getSpecularLightExponent())/255.0); - getChild<LLUICtrl>("environment")->setValue((F32)(material->getEnvironmentIntensity())/255.0); +#if 0 + static LLMaterialID old_material_id = LLMaterialID::null; + if (material_id == old_material_id) + { + llinfos << "Material ID " << material_id.asString() + << " unchanged, not updating" << llendl; + return; + } + else + { + llinfos << "Material ID changed, old " << old_material_id.asString() + << ", new " << material_id.asString() + << ", updating controls: " << material->asLLSD() + << llendl; + } + old_material_id = material_id; +#endif + // Alpha LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); if (combobox_alphamode) @@ -1227,17 +1234,18 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate { llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; } - onCommitAlphaMode(getChild<LLComboBox>("combobox alphamode"),this); - LLComboBox* comboMaterialType = getChild<LLComboBox>("combobox mattype"); + getChild<LLUICtrl>("maskcutoff")->setValue(material->getAlphaMaskCutoff()); + updateAlphaControls(getChild<LLComboBox>("combobox alphamode"),this); + + // Shiny (specular) F32 offset_x, offset_y, repeat_x, repeat_y, rot; - if ((comboMaterialType->getCurrentIndex() == MATTYPE_SPECULAR) && - !material->getSpecularID().isNull()) + LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); + texture_ctrl->setImageAssetID(material->getSpecularID()); + if (!material->getSpecularID().isNull()) { material->getSpecularOffset(offset_x,offset_y); material->getSpecularRepeat(repeat_x,repeat_y); rot = material->getSpecularRotation(); - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); - texture_ctrl->setImageAssetID(material->getSpecularID()); LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) @@ -1253,15 +1261,20 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild<LLUICtrl>("shinyRot")->setValue(rot); getChild<LLUICtrl>("shinyOffsetU")->setValue(offset_x); getChild<LLUICtrl>("shinyOffsetV")->setValue(offset_y); + getChild<LLColorSwatchCtrl>("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); + getChild<LLColorSwatchCtrl>("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); + getChild<LLUICtrl>("glossiness")->setValue((F32)(material->getSpecularLightExponent())/255.0); + getChild<LLUICtrl>("environment")->setValue((F32)(material->getEnvironmentIntensity())/255.0); } - if ((comboMaterialType->getCurrentIndex() == MATTYPE_NORMAL) && - !material->getNormalID().isNull()) + + // Bumpy (normal) + texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); + texture_ctrl->setImageAssetID(material->getNormalID()); + if (!material->getNormalID().isNull()) { material->getNormalOffset(offset_x,offset_y); material->getNormalRepeat(repeat_x,repeat_y); rot = material->getNormalRotation(); - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); - texture_ctrl->setImageAssetID(material->getNormalID()); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); if (combobox_bumpiness) @@ -1289,42 +1302,69 @@ void LLPanelFace::updateMaterial() { return; } - if ((mIsAlpha && (comboAlphaMode->getCurrentIndex() != ALPHAMODE_BLEND)) - || (comboBumpiness->getCurrentIndex() != BUMPY_TEXTURE) - || (comboShininess->getCurrentIndex() != SHINY_TEXTURE)) + U32 alpha_mode = comboAlphaMode->getCurrentIndex(); + U32 bumpiness = comboBumpiness->getCurrentIndex(); + U32 shininess = comboShininess->getCurrentIndex(); + if ((mIsAlpha && (alpha_mode != ALPHAMODE_BLEND)) + || (bumpiness == BUMPY_TEXTURE) + || (shininess == SHINY_TEXTURE)) { // The user's specified something that needs a material. if (!mMaterial) { mMaterial = LLMaterialPtr(new LLMaterial()); } - mMaterial->setNormalID(getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID()); - mMaterial->setNormalOffset(getChild<LLUICtrl>("bumpyOffsetU")->getValue().asReal(), - getChild<LLUICtrl>("bumpyOffsetV")->getValue().asReal()); - mMaterial->setNormalRepeat(getChild<LLUICtrl>("bumpyScaleU")->getValue().asReal(), - getChild<LLUICtrl>("bumpyScaleV")->getValue().asReal()); - mMaterial->setNormalRotation(getChild<LLUICtrl>("bumpyRot")->getValue().asReal()); - mMaterial->setSpecularID(getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID()); - mMaterial->setSpecularOffset(getChild<LLUICtrl>("shinyOffsetU")->getValue().asReal(), - getChild<LLUICtrl>("shinyOffsetV")->getValue().asReal()); - mMaterial->setSpecularRepeat(getChild<LLUICtrl>("shinyScaleU")->getValue().asReal(), - getChild<LLUICtrl>("shinyScaleV")->getValue().asReal()); - mMaterial->setSpecularRotation(getChild<LLUICtrl>("shinyRot")->getValue().asReal()); + if (bumpiness == BUMPY_TEXTURE) + { + mMaterial->setNormalID(getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID()); + mMaterial->setNormalOffset(getChild<LLUICtrl>("bumpyOffsetU")->getValue().asReal(), + getChild<LLUICtrl>("bumpyOffsetV")->getValue().asReal()); + mMaterial->setNormalRepeat(getChild<LLUICtrl>("bumpyScaleU")->getValue().asReal(), + getChild<LLUICtrl>("bumpyScaleV")->getValue().asReal()); + mMaterial->setNormalRotation(getChild<LLUICtrl>("bumpyRot")->getValue().asReal()); + } + else + { + mMaterial->setNormalID(LLUUID()); + mMaterial->setNormalOffset(0.0f,0.0f); + mMaterial->setNormalRepeat(1.0f,1.0f); + mMaterial->setNormalRotation(0.0f); + } + if (shininess == SHINY_TEXTURE) + { + mMaterial->setSpecularID(getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID()); + mMaterial->setSpecularOffset(getChild<LLUICtrl>("shinyOffsetU")->getValue().asReal(), + getChild<LLUICtrl>("shinyOffsetV")->getValue().asReal()); + mMaterial->setSpecularRepeat(getChild<LLUICtrl>("shinyScaleU")->getValue().asReal(), + getChild<LLUICtrl>("shinyScaleV")->getValue().asReal()); + mMaterial->setSpecularRotation(getChild<LLUICtrl>("shinyRot")->getValue().asReal()); + } + else + { + mMaterial->setSpecularID(LLUUID()); + mMaterial->setSpecularOffset(0.0f,0.0f); + mMaterial->setSpecularRepeat(1.0f,1.0f); + mMaterial->setSpecularRotation(0.0f); + } mMaterial->setSpecularLightColor(getChild<LLColorSwatchCtrl>("shinycolorswatch")->get()); mMaterial->setSpecularLightExponent((U8)(255*getChild<LLUICtrl>("glossiness")->getValue().asReal())); mMaterial->setEnvironmentIntensity((U8)(255*getChild<LLUICtrl>("environment")->getValue().asReal())); mMaterial->setDiffuseAlphaMode(getChild<LLComboBox>("combobox alphamode")->getCurrentIndex()); mMaterial->setAlphaMaskCutoff((U8)(getChild<LLUICtrl>("maskcutoff")->getValue().asInteger())); + llinfos << "Updating material: " << mMaterial->asLLSD() << llendl; + LLSelectMgr::getInstance()->selectionSetMaterial( *mMaterial ); } else { // The user has specified settings that don't need a material. - if (mMaterial) + if (mMaterial || !mMaterialID.isNull()) { + llinfos << "Resetting material entry" << llendl; mMaterial.reset(); + mMaterialID = LLMaterialID::null; + // Delete existing material entry... } } - LLSelectMgr::getInstance()->selectionSetMaterial( *mMaterial ); } // @@ -1345,7 +1385,8 @@ void LLPanelFace::onCommitColor(const LLSD& data) void LLPanelFace::onCommitShinyColor(const LLSD& data) { - updateMaterial(); + llinfos << "updating material" << llendl; + //updateMaterial(); } void LLPanelFace::onCommitAlpha(const LLSD& data) @@ -1368,23 +1409,21 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - // Get material info so we can use it later - if (self->mMaterial) - { - self->onMaterialLoaded(self->mMaterialID,self->mMaterial); - } - LLComboBox* comboMaterialsMedia = self->getChild<LLComboBox>("combobox matmedia"); - LLComboBox* comboMaterialType = self->getChild<LLComboBox>("combobox mattype"); - if (!comboMaterialType || !comboMaterialsMedia) + LLComboBox* combo_matmedia = self->getChild<LLComboBox>("combobox matmedia"); + LLComboBox* combo_mattype = self->getChild<LLComboBox>("combobox mattype"); + LLComboBox* combo_shininess = self->getChild<LLComboBox>("combobox shininess"); + LLComboBox* combo_bumpiness = self->getChild<LLComboBox>("combobox bumpiness"); + if (!combo_mattype || !combo_matmedia || !combo_shininess || !combo_bumpiness) { + llwarns << "Combo box not found...exiting." << llendl; return; } - U32 materials_media = comboMaterialsMedia->getCurrentIndex(); - U32 material_type = comboMaterialType->getCurrentIndex(); - bool show_media = (materials_media == MATMEDIA_MEDIA) && comboMaterialsMedia->getEnabled(); - bool show_texture = (!show_media) && (material_type == MATTYPE_DIFFUSE) && comboMaterialsMedia->getEnabled(); - bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && comboMaterialsMedia->getEnabled(); - bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && comboMaterialsMedia->getEnabled(); + U32 materials_media = combo_matmedia->getCurrentIndex(); + U32 material_type = combo_mattype->getCurrentIndex(); + bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); + 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(); self->getChildView("combobox mattype")->setVisible(!show_media); self->getChildView("rptctrl")->setVisible(!show_media); @@ -1402,7 +1441,7 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) self->getChildView("maskcutoff")->setVisible(false); if (show_texture) { - onCommitAlphaMode(ctrl, userdata); + updateAlphaControls(ctrl, userdata); } self->getChildView("TexScaleU")->setVisible(show_texture); self->getChildView("TexScaleV")->setVisible(show_texture); @@ -1422,7 +1461,7 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) self->getChildView("shinycolorswatch")->setVisible(false); if (show_shininess) { - onCommitShiny(ctrl, userdata); + updateShinyControls(ctrl, userdata); } self->getChildView("shinyScaleU")->setVisible(show_shininess); self->getChildView("shinyScaleV")->setVisible(show_shininess); @@ -1442,13 +1481,9 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) // Enable texture scale/rotation/offset parameters if there's one // present to set for - bool texParmsEnable = show_texture; - if (self->mMaterial) - { - texParmsEnable = texParmsEnable || - (!self->mMaterial->getNormalID().isNull() && show_bumpiness) || - (!self->mMaterial->getSpecularID().isNull() && show_shininess); - } + bool texParmsEnable = show_texture || + (show_shininess && (combo_shininess->getCurrentIndex() == SHINY_TEXTURE)) || + (show_bumpiness && (combo_bumpiness->getCurrentIndex() == BUMPY_TEXTURE)); self->getChildView("tex gen")->setEnabled(texParmsEnable); self->getChildView("combobox texgen")->setEnabled(texParmsEnable); self->getChildView("rptctrl")->setEnabled(texParmsEnable); @@ -1491,8 +1526,9 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) } // static -void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata) { + llinfos << "Entered." << llendl; LLPanelFace* self = (LLPanelFace*) userdata; LLComboBox* comboShiny = self->getChild<LLComboBox>("combobox shininess"); if (!comboShiny) @@ -1507,12 +1543,21 @@ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) self->getChildView("environment")->setVisible(show_shinyctrls); self->getChildView("label shinycolor")->setVisible(show_shinyctrls); self->getChildView("shinycolorswatch")->setVisible(show_shinyctrls); +} + +// static +void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; self->sendShiny(); + llinfos << "updating material" << llendl; + //self->updateMaterial(); } // static -void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::updateAlphaControls(LLUICtrl* ctrl, void* userdata) { + llinfos << "Entered." << llendl; LLPanelFace* self = (LLPanelFace*) userdata; LLComboBox* comboAlphaMode = self->getChild<LLComboBox>("combobox alphamode"); if (!comboAlphaMode) @@ -1523,7 +1568,15 @@ void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking self->getChildView("label maskcutoff")->setVisible(show_alphactrls); self->getChildView("maskcutoff")->setVisible(show_alphactrls); - self->updateMaterial(); +} + +// static +void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) +{ + //LLPanelFace* self = (LLPanelFace*) userdata; + updateAlphaControls(ctrl,userdata); + llinfos << "updating material" << llendl; + //self->updateMaterial(); } // static @@ -1577,25 +1630,29 @@ void LLPanelFace::onSelectTexture(const LLSD& data) void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) { - updateMaterial(); + llinfos << "updating material" << llendl; + //updateMaterial(); } void LLPanelFace::onCancelMaterialTexture(const LLSD& data) { // not sure what to do here other than - updateMaterial(); + llinfos << "updating material" << llendl; + //updateMaterial(); } void LLPanelFace::onSelectMaterialTexture(const LLSD& data) { - updateMaterial(); + llinfos << "updating material" << llendl; + //updateMaterial(); } //static void LLPanelFace::onCommitMaterial(LLUICtrl* ctrl, void* userdata) { - LLPanelFace* self = (LLPanelFace*) userdata; - self->updateMaterial(); + llinfos << "updating material" << llendl; + //LLPanelFace* self = (LLPanelFace*) userdata; + //self->updateMaterial(); } // static @@ -1699,10 +1756,10 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) switch (mattype) { case MATTYPE_SPECULAR: - which_control = "shinytexture_control"; + which_control = "shinytexture control"; break; case MATTYPE_NORMAL: - which_control = "bumpytexture_control"; + which_control = "bumpytexture control"; break; // no default needed } diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index c6322d59b2..62aa632821 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -93,7 +93,9 @@ protected: static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); + static void updateShinyControls( LLUICtrl* ctrl, void* userdata); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); + static void updateAlphaControls( 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); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index b5dc1dae90..c93cecdd5d 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2020,6 +2020,7 @@ void LLSelectMgr::selectionSetMaterial(LLMaterial& material) { if (object->permModify()) { + llinfos << "Putting material on object " << object->getID() << " face " << face << ", material: " << mMaterial.asLLSD() << llendl; LLMaterialMgr::getInstance()->put(object->getID(),face,mMaterial); } return true; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index b8de345a9a..4c6d655058 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4351,10 +4351,17 @@ S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS("Material") << "No texture entry for te " << (S32)te + << ", object " << mID + << ", material " << pMaterialID + << LL_ENDL; } else if (pMaterialID != tep->getMaterialID()) { + LL_DEBUGS("Material") << "Changing texture entry for te " << (S32)te + << ", object " << mID + << ", material " << pMaterialID + << LL_ENDL; retval = LLPrimitive::setTEMaterialID(te, pMaterialID); setChanged(TEXTURE); if (mDrawable.notNull() && retval) @@ -4376,6 +4383,10 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri else if (pMaterialParams != tep->getMaterialParams()) { retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams); + LL_DEBUGS("Material") << "Changing material params for te " << (S32)te + << ", object " << mID + << " (" << retval << ")" + << LL_ENDL; setTENormalMap(te, tep->getMaterialParams()->getNormalID()); setTESpecularMap(te, tep->getMaterialParams()->getSpecularID()); setChanged(TEXTURE); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 324d3de499..9ed940e61a 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2004,6 +2004,7 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { if (!pMaterialID.isNull()) { + LL_INFOS("Materials") << " " << pMaterialID.asString() << LL_ENDL; S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); if (res) { diff --git a/indra/test/io.cpp b/indra/test/io.cpp index ce747f667d..406e2d7bef 100644 --- a/indra/test/io.cpp +++ b/indra/test/io.cpp @@ -1158,7 +1158,7 @@ namespace tut // pump for a bit and make sure all 3 chains are running elapsed = pump_loop(mPump,0.1f); count = mPump->runningChains(); - ensure_equals("client chain onboard", count, 3); + // ensure_equals("client chain onboard", count, 3); commented out because it fails frequently - appears to be timing sensitive lldebugs << "** request should have been sent." << llendl; // pump for long enough the the client socket closes, and the |