# Conflicts:
#	indra/newview/lltexturectrl.cpp
#	indra/newview/llviewermenufile.cpp
#	indra/newview/pipeline.cpp
#	indra/newview/skins/default/xui/en/panel_tools_texture.xml
master
Ansariel 2022-12-02 19:19:40 +01:00
commit 98f6ece775
22 changed files with 584 additions and 464 deletions

View File

@ -166,6 +166,11 @@ void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLoca
void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const
{
if (!gSky.mVOSkyp)
{
return;
}
LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))
@ -278,6 +283,11 @@ void LLDrawPoolWLSky::renderStars(const LLVector3& camPosLocal) const
void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const
{
if (!gSky.mVOSkyp)
{
return;
}
LLGLSPipelineBlendSkyBox gls_sky(true, false);
gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);

View File

@ -190,6 +190,7 @@ BOOL LLFilePicker::setupFilter(ELoadFilter filter)
SOUND_FILTER \
IMAGE_FILTER \
ANIM_FILTER \
MATERIAL_FILTER \
L"\0";
break;
case FFLOAD_EXE:

View File

@ -2136,7 +2136,6 @@ BOOL LLPanelLandOptions::postBuild()
mSnapshotCtrl->setAllowNoTexture ( TRUE );
mSnapshotCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mSnapshotCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
mSnapshotCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
}
else
{

View File

@ -308,48 +308,10 @@ S32 LLLocalGLTFMaterialMgr::addUnit(const std::vector<std::string>& filenames)
S32 LLLocalGLTFMaterialMgr::addUnit(const std::string& filename)
{
std::string exten = gDirUtilp->getExtension(filename);
S32 materials_in_file = 0;
if (exten == "gltf" || exten == "glb")
S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename);
if (materials_in_file <= 0)
{
tinygltf::TinyGLTF loader;
std::string error_msg;
std::string warn_msg;
tinygltf::Model model_in;
std::string filename_lc = filename;
LLStringUtil::toLower(filename_lc);
// Load a tinygltf model fom a file. Assumes that the input filename has already been
// been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish.
bool decode_successful = false;
if (std::string::npos == filename_lc.rfind(".gltf"))
{ // file is binary
decode_successful = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename_lc);
}
else
{ // file is ascii
decode_successful = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename_lc);
}
if (!decode_successful)
{
LL_WARNS("GLTF") << "Cannot load, error: Failed to decode" << error_msg
<< ", warning:" << warn_msg
<< " file: " << filename
<< LL_ENDL;
return 0;
}
if (model_in.materials.empty())
{
// materials are missing
LL_WARNS("GLTF") << "Cannot load. File has no materials " << filename << LL_ENDL;
return 0;
}
materials_in_file = model_in.materials.size();
return 0;
}
S32 loaded_materials = 0;

View File

@ -390,14 +390,10 @@ BOOL LLMaterialEditor::postBuild()
if (!gAgent.isGodlike())
{
// Only allow fully permissive textures
mBaseColorTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED);
mBaseColorTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED);
mMetallicTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED);
mMetallicTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED);
mEmissiveTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED);
mEmissiveTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED);
mNormalTextureCtrl->setImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED);
mNormalTextureCtrl->setNonImmediateFilterPermMask(PERM_ITEM_UNRESTRICTED);
mBaseColorTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mMetallicTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mEmissiveTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mNormalTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
}
// Texture callback
@ -1404,8 +1400,6 @@ void LLMaterialEditor::createInventoryItem(const std::string &buffer, const std:
LLNotificationsUtil::add("MaterialCreated", params);
});
// todo: apply permissions from textures here if server doesn't
// if any texture is 'no transfer', material should be 'no transfer' as well
const LLViewerRegion* region = gAgent.getRegion();
if (region)
{
@ -1688,6 +1682,59 @@ static void pack_textures(
}
}
void LLMaterialEditor::uploadMaterialFromFile(const std::string& filename, S32 index)
{
if (index < 0)
{
return;
}
tinygltf::TinyGLTF loader;
std::string error_msg;
std::string warn_msg;
bool loaded = false;
tinygltf::Model model_in;
std::string filename_lc = filename;
LLStringUtil::toLower(filename_lc);
// Load a tinygltf model fom a file. Assumes that the input filename has already been
// been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish.
if (std::string::npos == filename_lc.rfind(".gltf"))
{ // file is binary
loaded = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename);
}
else
{ // file is ascii
loaded = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename);
}
if (!loaded)
{
LLNotificationsUtil::add("CannotUploadMaterial");
return;
}
if (model_in.materials.empty())
{
// materials are missing
return;
}
if (index >= 0 && model_in.materials.size() <= index)
{
// material is missing
return;
}
// Todo: no point in loading whole editor
LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor", LLSD().with("filename", filename).with("index", LLSD::Integer(index)));
me->loadMaterial(model_in, filename_lc, index, false);
me->saveIfNeeded();
}
void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 index)
{
tinygltf::TinyGLTF loader;
@ -1980,7 +2027,7 @@ void LLMaterialEditor::loadFromGLTFMaterial(LLUUID &asset_id)
me->setFocus(TRUE);
}
void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::string &filename_lc, S32 index)
void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::string &filename_lc, S32 index, bool open_floater)
{
if (model_in.materials.size() <= index)
{
@ -2078,10 +2125,13 @@ void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::
markChangesUnsaved(U32_MAX);
openFloater();
setFocus(TRUE);
if (open_floater)
{
openFloater(getKey());
setFocus(TRUE);
applyToSelection();
applyToSelection();
}
}
bool LLMaterialEditor::setFromGltfModel(const tinygltf::Model& model, S32 index, bool set_textures)

View File

@ -103,6 +103,7 @@ public:
void loadAsset() override;
// @index if -1 and file contains more than one material,
// will promt to select specific one
static void uploadMaterialFromFile(const std::string& filename, S32 index);
static void loadMaterialFromFile(const std::string& filename, S32 index = -1);
void onSelectionChanged(); // live overrides selection changes
@ -242,7 +243,7 @@ private:
void setFromGLTFMaterial(LLGLTFMaterial* mat);
bool setFromSelection();
void loadMaterial(const tinygltf::Model &model, const std::string &filename_lc, S32 index);
void loadMaterial(const tinygltf::Model &model, const std::string &filename_lc, S32 index, bool open_floater = true);
friend class LLMaterialFilePicker;

View File

@ -1360,7 +1360,6 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id)
LLTrans::getString("TexturePickerOutfitHeader"), // "SELECT PHOTO", // <FS:Ansariel> Localizable floater header
PERM_NONE,
PERM_NONE,
PERM_NONE,
FALSE,
NULL);

View File

@ -587,7 +587,6 @@ static void init_texture_ctrl(LLPanelEditWearable* self, LLPanel* panel, const L
// Don't allow (no copy) or (notransfer) textures to be selected.
texture_ctrl->setImmediateFilterPermMask(PERM_NONE);
texture_ctrl->setDnDFilterPermMask(PERM_NONE);
texture_ctrl->setNonImmediateFilterPermMask(PERM_NONE);
}
}

View File

@ -1107,8 +1107,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
if (mComboMatMedia->getCurrentIndex() < MATMEDIA_MATERIAL)
{
mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL);
// When selecting an object with a pbr and UI combo is not set,
// set to pbr option, otherwise to a texture (material)
if (has_pbr_material)
{
mComboMatMedia->selectNthItem(MATMEDIA_PBR);
}
else
{
mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL);
}
}
mComboMatMedia->setEnabled(editable);
//LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
@ -1175,7 +1185,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/)
F32 transparency = (1.f - color.mV[VALPHA]) * 100.f;
getChild<LLUICtrl>("ColorTrans")->setValue(editable ? transparency : 0);
getChildView("ColorTrans")->setEnabled(editable);
getChildView("ColorTrans")->setEnabled(editable && has_material);
// Specular map
LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec);
@ -1964,11 +1974,11 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,
LLUICtrl* gltfCtrlTextureOffsetU = getChild<LLUICtrl>("gltfTextureOffsetU");
LLUICtrl* gltfCtrlTextureOffsetV = getChild<LLUICtrl>("gltfTextureOffsetV");
gltfCtrlTextureScaleU->setEnabled(show_texture_info && has_pbr_capabilities);
gltfCtrlTextureScaleV->setEnabled(show_texture_info && has_pbr_capabilities);
gltfCtrlTextureRotation->setEnabled(show_texture_info && has_pbr_capabilities);
gltfCtrlTextureOffsetU->setEnabled(show_texture_info && has_pbr_capabilities);
gltfCtrlTextureOffsetV->setEnabled(show_texture_info && has_pbr_capabilities);
gltfCtrlTextureScaleU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material);
gltfCtrlTextureScaleV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material);
gltfCtrlTextureRotation->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material);
gltfCtrlTextureOffsetU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material);
gltfCtrlTextureOffsetV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material);
// Control values are set in setMaterialOverridesFromSelection
}

View File

@ -86,7 +86,6 @@ BOOL LLPanelLandMedia::postBuild()
mMediaTextureCtrl->setAllowNoTexture ( TRUE );
mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mMediaTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
mMediaTextureCtrl->setNonImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mMediaAutoScaleCheck = getChild<LLCheckBoxCtrl>("media_auto_scale");
childSetCommitCallback("media_auto_scale", onCommitAny, this);

View File

@ -304,8 +304,6 @@ BOOL LLPanelObject::postBuild()
// Don't allow (no copy) or (no transfer) textures to be selected during immediate mode
mCtrlSculptTexture->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER);
mCtrlSculptTexture->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER);
// Allow any texture to be used during non-immediate mode.
mCtrlSculptTexture->setNonImmediateFilterPermMask(PERM_NONE);
LLAggregatePermissions texture_perms;
if (LLSelectMgr::getInstance()->selectGetAggregateTexturePermissions(texture_perms))
{

View File

@ -2370,7 +2370,6 @@ void LLPanelProfileSecondLife::onShowTexturePicker()
getString("texture_picker_label"), // "SELECT PHOTO", // <FS:Ansariel> Fix LL UI/UX design accident
PERM_NONE,
PERM_NONE,
PERM_NONE,
FALSE,
NULL);
@ -2778,7 +2777,6 @@ void LLPanelProfileFirstLife::onChangePhoto()
getString("texture_picker_label"), // "SELECT PHOTO", // <FS:Ansariel> Fix LL UI/UX design accident
PERM_NONE,
PERM_NONE,
PERM_NONE,
FALSE,
NULL);

View File

@ -40,6 +40,11 @@ extern BOOL gCubeSnapshot;
extern BOOL gTeleportDisplay;
LLReflectionMapManager::LLReflectionMapManager()
{
initCubeFree();
}
void LLReflectionMapManager::initCubeFree()
{
for (int i = 1; i < LL_MAX_REFLECTION_PROBE_COUNT; ++i)
{
@ -50,12 +55,6 @@ LLReflectionMapManager::LLReflectionMapManager()
mCubeFree[0] = false;
}
struct CompareReflectionMapDistance
{
};
struct CompareProbeDistance
{
bool operator()(const LLPointer<LLReflectionMap>& lhs, const LLPointer<LLReflectionMap>& rhs)
@ -79,7 +78,6 @@ void LLReflectionMapManager::update()
return;
}
// =============== TODO -- move to an init function =================
initReflectionMaps();
if (!mRenderTarget.isComplete())
@ -955,7 +953,11 @@ void LLReflectionMapManager::cleanup()
mUpdatingFace = 0;
mDefaultProbe = nullptr;
mUpdatingProbe = nullptr;
glDeleteBuffers(1, &mUBO);
mUBO = 0;
// note: also called on teleport (not just shutdown), so make sure we're in a good "starting" state
initCubeFree();
}

View File

@ -97,6 +97,9 @@ public:
private:
friend class LLPipeline;
// initialize mCubeFree array to default values
void initCubeFree();
// delete the probe with the given index in mProbes
void deleteProbe(U32 i);

View File

@ -149,7 +149,6 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
const std::string& label,
PermissionMask immediate_filter_perm_mask,
PermissionMask dnd_filter_perm_mask,
PermissionMask non_immediate_filter_perm_mask,
BOOL can_apply_immediately,
LLUIImagePtr fallback_image)
: LLFloater(LLSD()),
@ -169,7 +168,6 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mFilterEdit(NULL),
mImmediateFilterPermMask(immediate_filter_perm_mask),
mDnDFilterPermMask(dnd_filter_perm_mask),
mNonImmediateFilterPermMask(non_immediate_filter_perm_mask),
mContextConeOpacity(0.f),
mSelectedItemPinned( FALSE ),
mCanApply(true),
@ -292,7 +290,6 @@ void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b)
mCanApplyImmediately = b;
getChild<LLUICtrl>("apply_immediate_check")->setValue(mCanApplyImmediately);
updateFilterPermMask();
}
void LLFloaterTexturePicker::stopUsingPipette()
@ -370,7 +367,6 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
if (mod) item_perm_mask |= PERM_MODIFY;
if (xfer) item_perm_mask |= PERM_TRANSFER;
//PermissionMask filter_perm_mask = getFilterPermMask(); Commented out due to no-copy texture loss.
PermissionMask filter_perm_mask = mDnDFilterPermMask;
if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
{
@ -548,8 +544,6 @@ BOOL LLFloaterTexturePicker::postBuild()
childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this);
childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this);
// update permission filter once UI is fully initialized
updateFilterPermMask();
mSavedFolderState.setApply(FALSE);
LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1));
@ -728,12 +722,6 @@ const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL co
return LLUUID::null;
}
PermissionMask LLFloaterTexturePicker::getFilterPermMask()
{
bool apply_immediate = getChild<LLUICtrl>("apply_immediate_check")->getValue().asBoolean();
return apply_immediate ? mImmediateFilterPermMask : mNonImmediateFilterPermMask;
}
void LLFloaterTexturePicker::commitIfImmediateSet()
{
// <FS:Ansariel> FIRE-8298: Apply now checkbox has no effect
@ -1176,7 +1164,6 @@ void LLFloaterTexturePicker::onApplyImmediateCheck(LLUICtrl* ctrl, void *user_da
// <FS:Ansariel> FIRE-8298: Apply now checkbox has no effect
picker->setCanApply(true, true);
// </FS:Ansariel>
picker->updateFilterPermMask();
picker->commitIfImmediateSet();
}
@ -1253,11 +1240,6 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data
}
}
void LLFloaterTexturePicker::updateFilterPermMask()
{
//mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss.
}
void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply)
{
getChildRef<LLUICtrl>("Select").setEnabled(can_apply);
@ -1517,7 +1499,6 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
mAllowNoTexture( p.allow_no_texture ),
mAllowLocalTexture( TRUE ),
mImmediateFilterPermMask( PERM_NONE ),
mNonImmediateFilterPermMask( PERM_NONE ),
mCanApplyImmediately( FALSE ),
mNeedsRawImageData( FALSE ),
mValid( TRUE ),
@ -1714,7 +1695,6 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
mLabel,
mImmediateFilterPermMask,
mDnDFilterPermMask,
mNonImmediateFilterPermMask,
mCanApplyImmediately,
mFallbackImage);
mFloaterHandle = floaterp->getHandle();
@ -1994,8 +1974,8 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
}
// <FS:Ansariel> FIRE-10125: Texture picker allows dragging of textures while in preview mode
//if (getEnabled() && allow_dnd && allowDrop(item))
if (getEnabled() && !mOpenTexPreview && allow_dnd && allowDrop(item))
//if (getEnabled() && allow_dnd && allowDrop(item, cargo_type, tooltip_msg))
if (getEnabled() && !mOpenTexPreview && allow_dnd && allowDrop(item, cargo_type, tooltip_msg))
// </FS:Ansariel>
{
if (drop)
@ -2157,7 +2137,7 @@ void LLTextureCtrl::draw()
LLUICtrl::draw();
}
BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item)
BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg)
{
BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
@ -2169,8 +2149,6 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item)
if (mod) item_perm_mask |= PERM_MODIFY;
if (xfer) item_perm_mask |= PERM_TRANSFER;
// PermissionMask filter_perm_mask = mCanApplyImmediately ? commented out due to no-copy texture loss.
// mImmediateFilterPermMask : mNonImmediateFilterPermMask;
PermissionMask filter_perm_mask = mImmediateFilterPermMask;
if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
{
@ -2185,6 +2163,12 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item)
}
else
{
PermissionMask mask = PERM_COPY | PERM_TRANSFER;
if ((filter_perm_mask & mask) == mask
&& cargo_type == DAD_TEXTURE)
{
tooltip_msg.assign(LLTrans::getString("TooltipTextureRestrictedDrop"));
}
return FALSE;
}
}

View File

@ -190,10 +190,7 @@ public:
{ mImmediateFilterPermMask = mask; }
void setDnDFilterPermMask(PermissionMask mask)
{ mDnDFilterPermMask = mask; }
void setNonImmediateFilterPermMask(PermissionMask mask)
{ mNonImmediateFilterPermMask = mask; }
PermissionMask getImmediateFilterPermMask() { return mImmediateFilterPermMask; }
PermissionMask getNonImmediateFilterPermMask() { return mNonImmediateFilterPermMask; }
void closeDependentFloater();
@ -232,7 +229,7 @@ public:
void setIsMasked(BOOL masked) { mIsMasked = masked; }
private:
BOOL allowDrop(LLInventoryItem* item);
BOOL allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg);
BOOL doDrop(LLInventoryItem* item);
private:
@ -259,7 +256,6 @@ private:
BOOL mAllowLocalTexture;
PermissionMask mImmediateFilterPermMask;
PermissionMask mDnDFilterPermMask;
PermissionMask mNonImmediateFilterPermMask;
BOOL mCanApplyImmediately;
BOOL mCommitOnSelection;
BOOL mNeedsRawImageData;
@ -296,7 +292,6 @@ public:
const std::string& label,
PermissionMask immediate_filter_perm_mask,
PermissionMask dnd_filter_perm_mask,
PermissionMask non_immediate_filter_perm_mask,
BOOL can_apply_immediately,
LLUIImagePtr fallback_image_name
);
@ -329,9 +324,7 @@ public:
LLView* getOwner() const { return mOwner; }
void setOwner(LLView* owner) { mOwner = owner; }
void stopUsingPipette();
PermissionMask getFilterPermMask();
void updateFilterPermMask();
void commitIfImmediateSet();
void commitCancel();
@ -405,7 +398,6 @@ protected:
LLInventoryPanel* mInventoryPanel;
PermissionMask mImmediateFilterPermMask;
PermissionMask mDnDFilterPermMask;
PermissionMask mNonImmediateFilterPermMask;
BOOL mCanApplyImmediately;
BOOL mNoCopyTextureSelected;
F32 mContextConeOpacity;

View File

@ -182,12 +182,62 @@ LLImageRaw * LLTinyGLTFHelper::getTexture(const std::string & folder, const tiny
return rawImage;
}
S32 LLTinyGLTFHelper::getMaterialCountFromFile(const std::string& filename)
{
std::string exten = gDirUtilp->getExtension(filename);
S32 materials_in_file = 0;
if (exten == "gltf" || exten == "glb")
{
tinygltf::TinyGLTF loader;
std::string error_msg;
std::string warn_msg;
tinygltf::Model model_in;
std::string filename_lc = filename;
LLStringUtil::toLower(filename_lc);
// Load a tinygltf model fom a file. Assumes that the input filename has already been
// been sanitized to one of (.gltf , .glb) extensions, so does a simple find to distinguish.
bool decode_successful = false;
if (std::string::npos == filename_lc.rfind(".gltf"))
{ // file is binary
decode_successful = loader.LoadBinaryFromFile(&model_in, &error_msg, &warn_msg, filename_lc);
}
else
{ // file is ascii
decode_successful = loader.LoadASCIIFromFile(&model_in, &error_msg, &warn_msg, filename_lc);
}
if (!decode_successful)
{
LL_WARNS("GLTF") << "Cannot load, error: Failed to decode" << error_msg
<< ", warning:" << warn_msg
<< " file: " << filename
<< LL_ENDL;
return 0;
}
if (model_in.materials.empty())
{
// materials are missing
LL_WARNS("GLTF") << "Cannot load. File has no materials " << filename << LL_ENDL;
return 0;
}
materials_in_file = model_in.materials.size();
}
return materials_in_file;
}
bool LLTinyGLTFHelper::getMaterialFromFile(
const std::string& filename,
S32 mat_index,
LLPointer < LLFetchedGLTFMaterial> material,
LLFetchedGLTFMaterial* material,
std::string& material_name)
{
llassert(material);
tinygltf::TinyGLTF loader;
std::string error_msg;
std::string warn_msg;
@ -304,5 +354,4 @@ bool LLTinyGLTFHelper::getMaterialFromFile(
}
return true;
}

View File

@ -43,10 +43,12 @@ namespace LLTinyGLTFHelper
LLImageRaw* getTexture(const std::string& folder, const tinygltf::Model& model, S32 texture_index);
S32 getMaterialCountFromFile(const std::string& filename);
bool getMaterialFromFile(
const std::string& filename,
S32 mat_index,
LLPointer < LLFetchedGLTFMaterial> material,
LLFetchedGLTFMaterial* material,
std::string& material_name);
void initFetchedTextures(tinygltf::Material& material,

View File

@ -38,6 +38,7 @@
#include "llfloatermap.h"
#include "llfloatermodelpreview.h"
#include "llmaterialeditor.h"
#include "llfloaterperms.h"
#include "llfloatersnapshot.h"
#include "llfloateroutfitsnapshot.h"
#include "llimage.h"
@ -49,9 +50,9 @@
#include "llinventorymodel.h" // gInventory
#include "llpluginclassmedia.h"
#include "llresourcedata.h"
#include "lltoast.h"
#include "llfloaterperms.h"
#include "llstatusbar.h"
#include "lltinygltfhelper.h"
#include "lltoast.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llviewertexturelist.h"
#include "lluictrlfactory.h"
@ -486,19 +487,33 @@ void do_bulk_upload(std::vector<std::string> filenames, const LLSD& notification
if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) &&
LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost))
{
LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo(
filename,
asset_name,
asset_name, 0,
LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
LLFloaterPerms::getNextOwnerPerms("Uploads"),
LLFloaterPerms::getGroupPerms("Uploads"),
LLFloaterPerms::getEveryonePerms("Uploads"),
expected_upload_cost));
upload_new_resource(uploadInfo);
}
}
LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo(
filename,
asset_name,
asset_name, 0,
LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
LLFloaterPerms::getNextOwnerPerms("Uploads"),
LLFloaterPerms::getGroupPerms("Uploads"),
LLFloaterPerms::getEveryonePerms("Uploads"),
expected_upload_cost));
upload_new_resource(uploadInfo);
}
// gltf does not use normal upload procedure
if (ext == "gltf" || ext == "glb")
{
S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename);
for (S32 i = 0; i < materials_in_file; i++)
{
// Todo:
// 1. Decouple bulk upload from material editor
// 2. Take into account possiblity of identical textures
LLMaterialEditor::uploadMaterialFromFile(filename, i);
}
}
}
}
bool get_bulk_upload_expected_cost(const std::vector<std::string>& filenames, S32& total_cost, S32& file_count, S32& bvh_count)
@ -526,6 +541,44 @@ bool get_bulk_upload_expected_cost(const std::vector<std::string>& filenames, S3
total_cost += cost;
file_count++;
}
if (ext == "gltf" || ext == "glb")
{
S32 texture_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost();
S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename);
for (S32 i = 0; i < materials_in_file; i++)
{
LLPointer<LLFetchedGLTFMaterial> material = new LLFetchedGLTFMaterial();
std::string material_name;
bool decode_successful = LLTinyGLTFHelper::getMaterialFromFile(filename, i, material.get(), material_name);
if (decode_successful)
{
// Todo: make it account for possibility of same texture in different
// materials and even in scope of same material
S32 texture_count = 0;
if (material->mBaseColorId.notNull())
{
texture_count++;
}
if (material->mMetallicRoughnessId.notNull())
{
texture_count++;
}
if (material->mNormalId.notNull())
{
texture_count++;
}
if (material->mEmissiveId.notNull())
{
texture_count++;
}
total_cost += texture_count * texture_upload_cost;
file_count++;
}
}
}
}
return file_count > 0;

View File

@ -3784,166 +3784,161 @@ void renderScriptedBeacons(LLDrawable* drawablep)
}
}
void renderScriptedTouchBeacons(LLDrawable* drawablep)
void renderScriptedTouchBeacons(LLDrawable *drawablep)
{
LLViewerObject *vobj = drawablep->getVObj();
if (vobj
&& !vobj->isAvatar()
&& !vobj->getParent()
&& vobj->flagScripted()
&& vobj->flagHandleTouch())
{
if (gPipeline.sRenderBeacons)
{
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
}
LLViewerObject *vobj = drawablep->getVObj();
if (vobj && !vobj->isAvatar() && !vobj->getParent() && vobj->flagScripted() && vobj->flagHandleTouch())
{
if (gPipeline.sRenderBeacons)
{
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f),
LLPipeline::DebugBeaconLineWidth);
}
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
LLFace * facep = drawablep->getFace(face_id);
if (facep)
{
gPipeline.mHighlightFaces.push_back(facep);
}
}
}
}
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
LLFace *facep = drawablep->getFace(face_id);
if (facep)
{
gPipeline.mHighlightFaces.push_back(facep);
}
}
}
}
}
void renderPhysicalBeacons(LLDrawable* drawablep)
void renderPhysicalBeacons(LLDrawable *drawablep)
{
LLViewerObject *vobj = drawablep->getVObj();
if (vobj
&& !vobj->isAvatar()
//&& !vobj->getParent()
&& vobj->flagUsePhysics())
{
if (gPipeline.sRenderBeacons)
{
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
}
LLViewerObject *vobj = drawablep->getVObj();
if (vobj &&
!vobj->isAvatar()
//&& !vobj->getParent()
&& vobj->flagUsePhysics())
{
if (gPipeline.sRenderBeacons)
{
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f),
LLPipeline::DebugBeaconLineWidth);
}
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
LLFace * facep = drawablep->getFace(face_id);
if (facep)
{
gPipeline.mHighlightFaces.push_back(facep);
}
}
}
}
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
LLFace *facep = drawablep->getFace(face_id);
if (facep)
{
gPipeline.mHighlightFaces.push_back(facep);
}
}
}
}
}
void renderMOAPBeacons(LLDrawable* drawablep)
void renderMOAPBeacons(LLDrawable *drawablep)
{
LLViewerObject *vobj = drawablep->getVObj();
LLViewerObject *vobj = drawablep->getVObj();
if(!vobj || vobj->isAvatar())
return;
if (!vobj || vobj->isAvatar())
return;
bool beacon=false;
U8 tecount=vobj->getNumTEs();
for(int x=0;x<tecount;x++)
{
if(vobj->getTEref(x).hasMedia())
{
beacon=true;
break;
}
}
if(beacon)
{
if (gPipeline.sRenderBeacons)
{
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
}
bool beacon = false;
U8 tecount = vobj->getNumTEs();
for (int x = 0; x < tecount; x++)
{
if (vobj->getTEref(x)->hasMedia())
{
beacon = true;
break;
}
}
if (beacon)
{
if (gPipeline.sRenderBeacons)
{
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f),
LLPipeline::DebugBeaconLineWidth);
}
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
LLFace * facep = drawablep->getFace(face_id);
if (facep)
{
gPipeline.mHighlightFaces.push_back(facep);
}
}
}
}
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
LLFace *facep = drawablep->getFace(face_id);
if (facep)
{
gPipeline.mHighlightFaces.push_back(facep);
}
}
}
}
}
void renderParticleBeacons(LLDrawable* drawablep)
void renderParticleBeacons(LLDrawable *drawablep)
{
// Look for attachments, objects, etc.
LLViewerObject *vobj = drawablep->getVObj();
if (vobj
&& vobj->isParticleSource())
{
if (gPipeline.sRenderBeacons)
{
LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f);
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), LLPipeline::DebugBeaconLineWidth);
}
// Look for attachments, objects, etc.
LLViewerObject *vobj = drawablep->getVObj();
if (vobj && vobj->isParticleSource())
{
if (gPipeline.sRenderBeacons)
{
LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f);
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f),
LLPipeline::DebugBeaconLineWidth);
}
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
LLFace * facep = drawablep->getFace(face_id);
if (facep)
{
gPipeline.mHighlightFaces.push_back(facep);
}
}
}
}
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
LLFace *facep = drawablep->getFace(face_id);
if (facep)
{
gPipeline.mHighlightFaces.push_back(facep);
}
}
}
}
}
void renderSoundHighlights(LLDrawable* drawablep)
void renderSoundHighlights(LLDrawable *drawablep)
{
// Look for attachments, objects, etc.
LLViewerObject *vobj = drawablep->getVObj();
if (vobj && vobj->isAudioSource())
{
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
LLFace * facep = drawablep->getFace(face_id);
if (facep)
{
gPipeline.mHighlightFaces.push_back(facep);
}
}
}
}
// Look for attachments, objects, etc.
LLViewerObject *vobj = drawablep->getVObj();
if (vobj && vobj->isAudioSource())
{
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
LLFace *facep = drawablep->getFace(face_id);
if (facep)
{
gPipeline.mHighlightFaces.push_back(facep);
}
}
}
}
}
void LLPipeline::touchTexture(LLViewerTexture* tex, F32 vsize)
{
if (tex)
{
LLImageGL* gl_tex = tex->getGLTexture();
if (gl_tex && gl_tex->updateBindStats())
{
tex->setActive();
tex->addTextureStats(vsize);
}
tex->setActive();
tex->addTextureStats(vsize);
}
}
@ -3982,59 +3977,56 @@ void LLPipeline::touchTextures(LLDrawInfo* info)
}
}
void LLPipeline::postSort(LLCamera& camera)
void LLPipeline::postSort(LLCamera &camera)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
assertInitialized();
sVolumeSAFrame = 0.f; //ZK LBG
assertInitialized();
sVolumeSAFrame = 0.f; //ZK LBG
LL_PUSH_CALLSTACKS();
LL_PUSH_CALLSTACKS();
if (!gCubeSnapshot)
{
//rebuild drawable geometry
// rebuild drawable geometry
for (LLCullResult::sg_iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i)
{
LLSpatialGroup* group = *i;
if (!sUseOcclusion ||
!group->isOcclusionState(LLSpatialGroup::OCCLUDED))
LLSpatialGroup *group = *i;
if (!sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED))
{
group->rebuildGeom();
}
}
LL_PUSH_CALLSTACKS();
//rebuild groups
// rebuild groups
sCull->assertDrawMapsEmpty();
rebuildPriorityGroups();
}
LL_PUSH_CALLSTACKS();
LL_PUSH_CALLSTACKS();
//build render map
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("build render map");
for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
{
LLSpatialGroup* group = *i;
if ((sUseOcclusion &&
group->isOcclusionState(LLSpatialGroup::OCCLUDED)) ||
(RenderAutoHideSurfaceAreaLimit > 0.f &&
group->mSurfaceArea > RenderAutoHideSurfaceAreaLimit*llmax(group->mObjectBoxSize, 10.f)))
{
continue;
}
// build render map
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("build render map");
for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
{
LLSpatialGroup *group = *i;
if ((sUseOcclusion && group->isOcclusionState(LLSpatialGroup::OCCLUDED)) ||
(RenderAutoHideSurfaceAreaLimit > 0.f &&
group->mSurfaceArea > RenderAutoHideSurfaceAreaLimit * llmax(group->mObjectBoxSize, 10.f)))
{
continue;
}
if (group->hasState(LLSpatialGroup::NEW_DRAWINFO) && group->hasState(LLSpatialGroup::GEOM_DIRTY) && !gCubeSnapshot)
{ //no way this group is going to be drawable without a rebuild
group->rebuildGeom();
}
if (group->hasState(LLSpatialGroup::NEW_DRAWINFO) && group->hasState(LLSpatialGroup::GEOM_DIRTY) && !gCubeSnapshot)
{ // no way this group is going to be drawable without a rebuild
group->rebuildGeom();
}
for (LLSpatialGroup::draw_map_t::iterator j = group->mDrawMap.begin(); j != group->mDrawMap.end(); ++j)
{
LLSpatialGroup::drawmap_elem_t& src_vec = j->second;
LLSpatialGroup::drawmap_elem_t &src_vec = j->second;
if (!hasRenderType(j->first))
{
continue;
@ -4064,7 +4056,7 @@ void LLPipeline::postSort(LLCamera& camera)
for (LLSpatialGroup::drawmap_elem_t::iterator k = src_vec.begin(); k != src_vec.end(); ++k)
{
LLDrawInfo* info = *k;
LLDrawInfo *info = *k;
sCull->pushDrawInfo(j->first, info);
if (!sShadowRender && !sReflectionRender && !gCubeSnapshot)
@ -4073,198 +4065,198 @@ void LLPipeline::postSort(LLCamera& camera)
addTrianglesDrawn(info->mCount);
}
}
}
}
if (hasRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA))
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("Collect Alpha groups");
LLSpatialGroup::draw_map_t::iterator alpha = group->mDrawMap.find(LLRenderPass::PASS_ALPHA);
if (alpha != group->mDrawMap.end())
{ //store alpha groups for sorting
LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge();
if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot)
{
if (bridge)
{
LLCamera trans_camera = bridge->transformCamera(camera);
group->updateDistance(trans_camera);
}
else
{
group->updateDistance(camera);
}
}
if (hasRenderType(LLDrawPool::POOL_ALPHA))
{
sCull->pushAlphaGroup(group);
}
}
if (hasRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA))
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("Collect Alpha groups");
LLSpatialGroup::draw_map_t::iterator alpha = group->mDrawMap.find(LLRenderPass::PASS_ALPHA);
if (alpha != group->mDrawMap.end())
{ // store alpha groups for sorting
LLSpatialBridge *bridge = group->getSpatialPartition()->asBridge();
if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD && !gCubeSnapshot)
{
if (bridge)
{
LLCamera trans_camera = bridge->transformCamera(camera);
group->updateDistance(trans_camera);
}
else
{
group->updateDistance(camera);
}
}
if (hasRenderType(LLDrawPool::POOL_ALPHA))
{
sCull->pushAlphaGroup(group);
}
}
LLSpatialGroup::draw_map_t::iterator rigged_alpha = group->mDrawMap.find(LLRenderPass::PASS_ALPHA_RIGGED);
if (rigged_alpha != group->mDrawMap.end())
{ //store rigged alpha groups for LLDrawPoolAlpha prepass (skip distance update, rigged attachments use depth buffer)
{ // store rigged alpha groups for LLDrawPoolAlpha prepass (skip distance update, rigged attachments use depth buffer)
if (hasRenderType(LLDrawPool::POOL_ALPHA))
{
sCull->pushRiggedAlphaGroup(group);
}
}
}
}
}
//flush particle VB
if (LLVOPartGroup::sVB)
{
LLVOPartGroup::sVB->flush();
}
else
{
LL_WARNS_ONCE() << "Missing particle buffer" << LL_ENDL;
}
}
}
}
/*bool use_transform_feedback = gTransformPositionProgram.mProgramObject && !mMeshDirtyGroup.empty();
// flush particle VB
if (LLVOPartGroup::sVB)
{
LLVOPartGroup::sVB->flush();
}
else
{
LL_WARNS_ONCE() << "Missing particle buffer" << LL_ENDL;
}
if (use_transform_feedback)
{ //place a query around potential transform feedback code for synchronization
mTransformFeedbackPrimitives = 0;
/*bool use_transform_feedback = gTransformPositionProgram.mProgramObject && !mMeshDirtyGroup.empty();
if (!mMeshDirtyQueryObject)
{
glGenQueries(1, &mMeshDirtyQueryObject);
}
if (use_transform_feedback)
{ //place a query around potential transform feedback code for synchronization
mTransformFeedbackPrimitives = 0;
glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, mMeshDirtyQueryObject);
}*/
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rebuild delayed upd groups");
//pack vertex buffers for groups that chose to delay their updates
for (LLSpatialGroup::sg_vector_t::iterator iter = mMeshDirtyGroup.begin(); iter != mMeshDirtyGroup.end(); ++iter)
{
(*iter)->rebuildMesh();
}
}
if (!mMeshDirtyQueryObject)
{
glGenQueries(1, &mMeshDirtyQueryObject);
}
/*if (use_transform_feedback)
{
glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
}*/
mMeshDirtyGroup.clear();
glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, mMeshDirtyQueryObject);
}*/
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("sort alpha groups");
if (!sShadowRender)
{
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rebuild delayed upd groups");
// pack vertex buffers for groups that chose to delay their updates
for (LLSpatialGroup::sg_vector_t::iterator iter = mMeshDirtyGroup.begin(); iter != mMeshDirtyGroup.end(); ++iter)
{
(*iter)->rebuildMesh();
}
}
/*if (use_transform_feedback)
{
glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
}*/
mMeshDirtyGroup.clear();
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("sort alpha groups");
if (!sShadowRender)
{
// order alpha groups by distance
std::sort(sCull->beginAlphaGroups(), sCull->endAlphaGroups(), LLSpatialGroup::CompareDepthGreater());
std::sort(sCull->beginAlphaGroups(), sCull->endAlphaGroups(), LLSpatialGroup::CompareDepthGreater());
// order rigged alpha groups by avatar attachment order
std::sort(sCull->beginRiggedAlphaGroups(), sCull->endRiggedAlphaGroups(), LLSpatialGroup::CompareRenderOrder());
}
}
}
}
LL_PUSH_CALLSTACKS();
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("beacon rendering flags");
// only render if the flag is set. The flag is only set if we are in edit mode or the toggle is set in the menus
// <FS:Ansariel> Make beacons also show when beacons floater is closed.
if (/*LLFloaterReg::instanceVisible("beacons") &&*/ !sShadowRender && !gCubeSnapshot)
{
if (sRenderScriptedTouchBeacons)
{
// Only show the beacon on the root object.
forAllVisibleDrawables(renderScriptedTouchBeacons);
}
else
if (sRenderScriptedBeacons)
{
// Only show the beacon on the root object.
forAllVisibleDrawables(renderScriptedBeacons);
}
LL_PUSH_CALLSTACKS();
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("beacon rendering flags");
// only render if the flag is set. The flag is only set if we are in edit mode or the toggle is set in the menus
// <FS:Ansariel> Make beacons also show when beacons floater is closed.
if (/*LLFloaterReg::instanceVisible("beacons") &&*/ !sShadowRender && !gCubeSnapshot)
{
if (sRenderScriptedTouchBeacons)
{
// Only show the beacon on the root object.
forAllVisibleDrawables(renderScriptedTouchBeacons);
}
else if (sRenderScriptedBeacons)
{
// Only show the beacon on the root object.
forAllVisibleDrawables(renderScriptedBeacons);
}
if (sRenderPhysicalBeacons)
{
// Only show the beacon on the root object.
forAllVisibleDrawables(renderPhysicalBeacons);
}
if (sRenderPhysicalBeacons)
{
// Only show the beacon on the root object.
forAllVisibleDrawables(renderPhysicalBeacons);
}
if(sRenderMOAPBeacons)
{
forAllVisibleDrawables(renderMOAPBeacons);
}
if (sRenderMOAPBeacons)
{
forAllVisibleDrawables(renderMOAPBeacons);
}
if (sRenderParticleBeacons)
{
forAllVisibleDrawables(renderParticleBeacons);
}
if (sRenderParticleBeacons)
{
forAllVisibleDrawables(renderParticleBeacons);
}
// If god mode, also show audio cues
if (sRenderSoundBeacons && gAudiop)
{
// Walk all sound sources and render out beacons for them. Note, this isn't done in the ForAllVisibleDrawables function, because some are not visible.
LLAudioEngine::source_map::iterator iter;
for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter)
{
LLAudioSource *sourcep = iter->second;
// If god mode, also show audio cues
if (sRenderSoundBeacons && gAudiop)
{
// Walk all sound sources and render out beacons for them. Note, this isn't done in the ForAllVisibleDrawables function, because
// some are not visible.
LLAudioEngine::source_map::iterator iter;
for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter)
{
LLAudioSource *sourcep = iter->second;
LLVector3d pos_global = sourcep->getPositionGlobal();
LLVector3 pos = gAgent.getPosAgentFromGlobal(pos_global);
if (gPipeline.sRenderBeacons)
{
//pos += LLVector3(0.f, 0.f, 0.2f);
gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), DebugBeaconLineWidth);
}
}
// now deal with highlights for all those seeable sound sources
forAllVisibleDrawables(renderSoundHighlights);
}
}
}
LL_PUSH_CALLSTACKS();
// If managing your telehub, draw beacons at telehub and currently selected spawnpoint.
if (LLFloaterTelehub::renderBeacons() && !sShadowRender && !gCubeSnapshot)
{
LLFloaterTelehub::addBeacons();
}
LLVector3d pos_global = sourcep->getPositionGlobal();
LLVector3 pos = gAgent.getPosAgentFromGlobal(pos_global);
if (gPipeline.sRenderBeacons)
{
// pos += LLVector3(0.f, 0.f, 0.2f);
gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), DebugBeaconLineWidth);
}
}
// now deal with highlights for all those seeable sound sources
forAllVisibleDrawables(renderSoundHighlights);
}
}
}
LL_PUSH_CALLSTACKS();
// If managing your telehub, draw beacons at telehub and currently selected spawnpoint.
if (LLFloaterTelehub::renderBeacons() && !sShadowRender && !gCubeSnapshot)
{
LLFloaterTelehub::addBeacons();
}
if (!sShadowRender && !gCubeSnapshot)
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("Render face highlights");
mSelectedFaces.clear();
if (!sShadowRender && !gCubeSnapshot)
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("Render face highlights");
mSelectedFaces.clear();
if (!gNonInteractive)
{
LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit());
}
if (!gNonInteractive)
{
LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit());
}
// Draw face highlights for selected faces.
if (LLSelectMgr::getInstance()->getTEMode())
{
struct f : public LLSelectedTEFunctor
{
virtual bool apply(LLViewerObject* object, S32 te)
{
if (object->mDrawable)
{
LLFace * facep = object->mDrawable->getFace(te);
if (facep)
{
gPipeline.mSelectedFaces.push_back(facep);
}
}
return true;
}
} func;
LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func);
}
}
// Draw face highlights for selected faces.
if (LLSelectMgr::getInstance()->getTEMode())
{
struct f : public LLSelectedTEFunctor
{
virtual bool apply(LLViewerObject *object, S32 te)
{
if (object->mDrawable)
{
LLFace *facep = object->mDrawable->getFace(te);
if (facep)
{
gPipeline.mSelectedFaces.push_back(facep);
}
}
return true;
}
} func;
LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func);
}
}
//LLSpatialGroup::sNoDelete = FALSE;
LL_PUSH_CALLSTACKS();
// LLSpatialGroup::sNoDelete = FALSE;
LL_PUSH_CALLSTACKS();
}
@ -7629,6 +7621,8 @@ void LLPipeline::doResetVertexBuffers(bool forced)
LLVOPartGroup::destroyGL();
gGL.resetVertexBuffer();
mReflectionMapManager.cleanup();
SUBSYSTEM_CLEANUP(LLVertexBuffer);
if (LLVertexBuffer::sGLCount != 0)

View File

@ -47,13 +47,23 @@
label="Model..."
layout="topleft"
name="Upload Model">
<menu_item_call.on_click
function="File.UploadModel"
parameter="" />
<menu_item_call.on_enable
function="File.EnableUploadModel" />
<menu_item_call.on_visible
function="File.VisibleUploadModel"/>
<menu_item_call.on_click
function="File.UploadModel"
parameter="" />
<menu_item_call.on_enable
function="File.EnableUploadModel" />
<menu_item_call.on_visible
function="File.VisibleUploadModel"/>
</menu_item_call>
<menu_item_call
label="Material..."
layout="topleft"
name="Upload Material">
<menu_item_call.on_click
function="File.UploadMaterial"
parameter="" />
<menu_item_call.on_enable
function="File.EnableUploadMaterial" />
</menu_item_call>
<menu_item_call
label="Bulk..."

View File

@ -382,6 +382,11 @@ Only items with unrestricted
'next owner' permissions
can be attached to notecards.
</string>
<string name="TooltipTextureRestrictedDrop">
Only textures with unrestricted
copy and transfer permissions
are allowed.
</string>
<!-- searching - generic -->
<string name="Searching">Searching...</string>