Initial materials support for the object exporter.
parent
c18f33a1ba
commit
1668af80b1
|
|
@ -503,6 +503,21 @@ void FSFloaterObjectExport::addPrim(LLViewerObject* object, bool root)
|
|||
checkTE->setID(LL_DEFAULT_WOOD_UUID); // TODO: use user option of default texture.
|
||||
prim["texture"].append(checkTE->asLLSD());
|
||||
}
|
||||
|
||||
// [FS:CR] Materials support
|
||||
if (checkTE->getMaterialParams().notNull())
|
||||
{
|
||||
LL_DEBUGS("export") << "found materials. Checking permissions..." << LL_ENDL;
|
||||
LLSD params = checkTE->getMaterialParams().get()->asLLSD();
|
||||
/// *TODO: Feeling lazy so I made it check both. This is incorrect and needs to be expanded
|
||||
/// to retain exportable textures not just failing both when one is non-exportable (or unset).
|
||||
if (exportTexture(params["NormMap"].asUUID()) &&
|
||||
exportTexture(params["SpecMap"].asUUID()))
|
||||
{
|
||||
LL_DEBUGS("export") << "...passed check." << LL_ENDL;
|
||||
prim["materials"].append(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!object->getPhysicsShapeUnknown())
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "llinventorydefines.h"
|
||||
#include "llinventoryfunctions.h"
|
||||
#include "lllineeditor.h"
|
||||
#include "llmaterialmgr.h"
|
||||
#include "llmultigesture.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llparcel.h"
|
||||
|
|
@ -771,6 +772,23 @@ bool FSFloaterImport::processPrimCreated(LLViewerObject* object)
|
|||
}
|
||||
}
|
||||
object->sendTEUpdate();
|
||||
|
||||
// [FS:CR] Materials
|
||||
if(prim.has("materials"))
|
||||
{
|
||||
U8 te = 0;
|
||||
LLSD materials = prim["materials"];
|
||||
for (LLSD::array_iterator m_itr = materials.beginArray() ;
|
||||
m_itr != materials.endArray() ;
|
||||
++m_itr)
|
||||
{
|
||||
LL_DEBUGS("import") << "Setting materials" << LL_ENDL;
|
||||
LLMaterial* mat = new LLMaterial();
|
||||
mat->fromLLSD(*m_itr);
|
||||
object->setTEMaterialParams(te, mat);
|
||||
++te;
|
||||
}
|
||||
}
|
||||
|
||||
if (prim.has("sculpt"))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue