Commit 77621dd3 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files
parents 8053bcea e2416706
......@@ -550,3 +550,6 @@ a3143db58a0f6b005232bf9018e7fef17ff9ec90 6.1.0-release
706bdc7e25c6e6b8fb56f4a13fcce2936e70a79c 6.2.1-release
ec09daf1899c1c01c4ba0ba950fae572f2a612a8 6.2.2-release
ab2ec5c5423b277d23fd0511ce50c15123ff2e03 6.2.3-release
67297f9902857e357570c44722ad84de3aff974e 6.2.4-release
9777aec6dc4a30a24537297ac040861ce16b82ae 6.3.0-release
ece699718f163921717bb95a6131e94af4c4138f 6.3.1-release
......@@ -1073,6 +1073,7 @@ Nicky Dasmijn
MAINT-6665
SL-10291
SL-10293
SL-11061
Nicky Perian
OPEN-1
STORM-1087
......
......@@ -3,8 +3,8 @@
# cmake_minimum_required should appear before any
# other commands to guarantee full compatibility
# with the version specified
## prior to 3.4, the Windows manifest handling was missing
cmake_minimum_required(VERSION 3.4.0 FATAL_ERROR)
## 3.8 added VS_DEBUGGER_WORKING_DIRECTORY support
cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR)
set(ROOT_PROJECT_NAME "SecondLife" CACHE STRING
"The root project/makefile/solution name. Defaults to SecondLife.")
......@@ -83,6 +83,12 @@ add_dependencies(viewer secondlife-bin)
add_subdirectory(${VIEWER_PREFIX}doxygen EXCLUDE_FROM_ALL)
# sets the 'startup project' for debugging from visual studio.
set_property(
DIRECTORY ${VIEWER_PREFIX}
PROPERTY VS_STARTUP_PROJECT secondlife-bin
)
if (LL_TESTS)
# Define after the custom targets are created so
# individual apps can add themselves as dependencies
......
......@@ -151,6 +151,8 @@ endif (LINUX)
if (DARWIN)
# Warnings should be fatal -- thanks, Nicky Perian, for spotting reversed default
set(CLANG_DISABLE_FATAL_WARNINGS OFF)
set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
set(DARWIN_extra_cstar_flags "-Wno-unused-local-typedef -Wno-deprecated-declarations")
......
......@@ -1482,6 +1482,21 @@ BOOL LLAvatarAppearance::teToColorParams( ETextureIndex te, U32 *param_name )
param_name[0] = 1071; //"tattoo_red";
param_name[1] = 1072; //"tattoo_green";
param_name[2] = 1073; //"tattoo_blue";
break;
case TEX_HEAD_UNIVERSAL_TATTOO:
case TEX_UPPER_UNIVERSAL_TATTOO:
case TEX_LOWER_UNIVERSAL_TATTOO:
case TEX_SKIRT_TATTOO:
case TEX_HAIR_TATTOO:
case TEX_EYES_TATTOO:
case TEX_LEFT_ARM_TATTOO:
case TEX_LEFT_LEG_TATTOO:
case TEX_AUX1_TATTOO:
case TEX_AUX2_TATTOO:
case TEX_AUX3_TATTOO:
param_name[0] = 1238; //"tattoo_universal_red";
param_name[1] = 1239; //"tattoo_universal_green";
param_name[2] = 1240; //"tattoo_universal_blue";
break;
default:
......
......@@ -26,9 +26,10 @@
#include "linden_common.h"
#include "llavatarappearancedefines.h"
#include "indra_constants.h"
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 512;
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 512;
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 1024;
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 1024;
const S32 LLAvatarAppearanceDefines::IMPOSTOR_PERIOD = 2;
using namespace LLAvatarAppearanceDefines;
......@@ -65,12 +66,30 @@ LLAvatarAppearanceDictionary::Textures::Textures()
addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
addEntry(TEX_HEAD_UNIVERSAL_TATTOO, new TextureEntry("head_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_UPPER_UNIVERSAL_TATTOO, new TextureEntry("upper_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_LOWER_UNIVERSAL_TATTOO, new TextureEntry("lower_universal_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_SKIRT_TATTOO, new TextureEntry("skirt_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_HAIR_TATTOO, new TextureEntry("hair_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_EYES_TATTOO, new TextureEntry("eyes_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_LEFT_ARM_TATTOO, new TextureEntry("leftarm_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_LEFT_LEG_TATTOO, new TextureEntry("leftleg_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_AUX1_TATTOO, new TextureEntry("aux1_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_AUX2_TATTOO, new TextureEntry("aux2_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_AUX3_TATTOO, new TextureEntry("aux3_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_UNIVERSAL));
addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD, "head"));
addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER, "upper"));
addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER, "lower"));
addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES, "eyes"));
addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR, "hair"));
addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT, "skirt"));
addEntry(TEX_LEFT_ARM_BAKED, new TextureEntry("leftarm-baked", FALSE, BAKED_LEFT_ARM, "leftarm"));
addEntry(TEX_LEFT_LEG_BAKED, new TextureEntry("leftleg-baked", FALSE, BAKED_LEFT_LEG, "leftleg"));
addEntry(TEX_AUX1_BAKED, new TextureEntry("aux1-baked", FALSE, BAKED_AUX1, "aux1"));
addEntry(TEX_AUX2_BAKED, new TextureEntry("aux2-baked", FALSE, BAKED_AUX2, "aux2"));
addEntry(TEX_AUX3_BAKED, new TextureEntry("aux3-baked", FALSE, BAKED_AUX3, "aux3"));
}
LLAvatarAppearanceDictionary::BakedTextures::BakedTextures()
......@@ -78,35 +97,60 @@ LLAvatarAppearanceDictionary::BakedTextures::BakedTextures()
// Baked textures
addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED,
"head", "a4b9dc38-e13b-4df9-b284-751efb0566ff",
3, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA,
5, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_HAIR, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA));
4, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA, TEX_HEAD_UNIVERSAL_TATTOO,
6, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_HAIR, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA, LLWearableType::WT_UNIVERSAL));
addEntry(BAKED_UPPER, new BakedEntry(TEX_UPPER_BAKED,
"upper_body", "5943ff64-d26c-4a90-a8c0-d61f56bd98d4",
7, TEX_UPPER_SHIRT,TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET,
TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA,
8, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_SHIRT, LLWearableType::WT_JACKET, LLWearableType::WT_GLOVES, LLWearableType::WT_UNDERSHIRT, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA));
8, TEX_UPPER_SHIRT,TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET,
TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA, TEX_UPPER_UNIVERSAL_TATTOO,
9, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_SHIRT, LLWearableType::WT_JACKET, LLWearableType::WT_GLOVES, LLWearableType::WT_UNDERSHIRT, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA, LLWearableType::WT_UNIVERSAL));
addEntry(BAKED_LOWER, new BakedEntry(TEX_LOWER_BAKED,
"lower_body", "2944ee70-90a7-425d-a5fb-d749c782ed7d",
8, TEX_LOWER_PANTS,TEX_LOWER_BODYPAINT,TEX_LOWER_SHOES, TEX_LOWER_SOCKS,
TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA,
9, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_PANTS, LLWearableType::WT_SHOES, LLWearableType::WT_SOCKS, LLWearableType::WT_JACKET, LLWearableType::WT_UNDERPANTS, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA));
9, TEX_LOWER_PANTS,TEX_LOWER_BODYPAINT,TEX_LOWER_SHOES, TEX_LOWER_SOCKS,
TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA, TEX_LOWER_UNIVERSAL_TATTOO,
10, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_PANTS, LLWearableType::WT_SHOES, LLWearableType::WT_SOCKS, LLWearableType::WT_JACKET, LLWearableType::WT_UNDERPANTS, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA, LLWearableType::WT_UNIVERSAL));
addEntry(BAKED_EYES, new BakedEntry(TEX_EYES_BAKED,
"eyes", "27b1bc0f-979f-4b13-95fe-b981c2ba9788",
2, TEX_EYES_IRIS, TEX_EYES_ALPHA,
2, LLWearableType::WT_EYES, LLWearableType::WT_ALPHA));
3, TEX_EYES_IRIS, TEX_EYES_TATTOO, TEX_EYES_ALPHA,
3, LLWearableType::WT_EYES, LLWearableType::WT_UNIVERSAL, LLWearableType::WT_ALPHA));
addEntry(BAKED_SKIRT, new BakedEntry(TEX_SKIRT_BAKED,
"skirt", "03e7e8cb-1368-483b-b6f3-74850838ba63",
1, TEX_SKIRT,
1, LLWearableType::WT_SKIRT));
2, TEX_SKIRT, TEX_SKIRT_TATTOO,
2, LLWearableType::WT_SKIRT, LLWearableType::WT_UNIVERSAL ));
addEntry(BAKED_HAIR, new BakedEntry(TEX_HAIR_BAKED,
"hair", "a60e85a9-74e8-48d8-8a2d-8129f28d9b61",
2, TEX_HAIR, TEX_HAIR_ALPHA,
2, LLWearableType::WT_HAIR, LLWearableType::WT_ALPHA));
3, TEX_HAIR, TEX_HAIR_TATTOO, TEX_HAIR_ALPHA,
3, LLWearableType::WT_HAIR, LLWearableType::WT_UNIVERSAL, LLWearableType::WT_ALPHA));
addEntry(BAKED_LEFT_ARM, new BakedEntry(TEX_LEFT_ARM_BAKED,
"leftarm", "9f39febf-22d7-0087-79d1-e9e8c6c9ed19",
1, TEX_LEFT_ARM_TATTOO,
1, LLWearableType::WT_UNIVERSAL));
addEntry(BAKED_LEFT_LEG, new BakedEntry(TEX_LEFT_LEG_BAKED,
"leftleg", "054a7a58-8ed5-6386-0add-3b636fb28b78",
1, TEX_LEFT_LEG_TATTOO,
1, LLWearableType::WT_UNIVERSAL));
addEntry(BAKED_AUX1, new BakedEntry(TEX_AUX1_BAKED,
"aux1", "790c11be-b25c-c17e-b4d2-6a4ad786b752",
1, TEX_AUX1_TATTOO,
1, LLWearableType::WT_UNIVERSAL));
addEntry(BAKED_AUX2, new BakedEntry(TEX_AUX2_BAKED,
"aux2", "d78c478f-48c7-5928-5864-8d99fb1f521e",
1, TEX_AUX2_TATTOO,
1, LLWearableType::WT_UNIVERSAL));
addEntry(BAKED_AUX3, new BakedEntry(TEX_AUX3_BAKED,
"aux3", "6a95dd53-edd9-aac8-f6d3-27ed99f3c3eb",
1, TEX_AUX3_TATTOO,
1, LLWearableType::WT_UNIVERSAL));
}
LLAvatarAppearanceDictionary::MeshEntries::MeshEntries()
......@@ -265,3 +309,113 @@ LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIn
{
return getInstance()->getTexture(index)->mWearableType;
}
// static
BOOL LLAvatarAppearanceDictionary::isBakedImageId(const LLUUID& id)
{
if ((id == IMG_USE_BAKED_EYES) || (id == IMG_USE_BAKED_HAIR) || (id == IMG_USE_BAKED_HEAD) || (id == IMG_USE_BAKED_LOWER) || (id == IMG_USE_BAKED_SKIRT) || (id == IMG_USE_BAKED_UPPER)
|| (id == IMG_USE_BAKED_LEFTARM) || (id == IMG_USE_BAKED_LEFTLEG) || (id == IMG_USE_BAKED_AUX1) || (id == IMG_USE_BAKED_AUX2) || (id == IMG_USE_BAKED_AUX3) )
{
return TRUE;
}
return FALSE;
}
// static
EBakedTextureIndex LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(const LLUUID& id)
{
if (id == IMG_USE_BAKED_EYES)
{
return BAKED_EYES;
}
else if (id == IMG_USE_BAKED_HAIR)
{
return BAKED_HAIR;
}
else if (id == IMG_USE_BAKED_HEAD)
{
return BAKED_HEAD;
}
else if (id == IMG_USE_BAKED_LOWER)
{
return BAKED_LOWER;
}
else if (id == IMG_USE_BAKED_SKIRT)
{
return BAKED_SKIRT;
}
else if (id == IMG_USE_BAKED_UPPER)
{
return BAKED_UPPER;
}
else if (id == IMG_USE_BAKED_LEFTARM)
{
return BAKED_LEFT_ARM;
}
else if (id == IMG_USE_BAKED_LEFTLEG)
{
return BAKED_LEFT_LEG;
}
else if (id == IMG_USE_BAKED_AUX1)
{
return BAKED_AUX1;
}
else if (id == IMG_USE_BAKED_AUX2)
{
return BAKED_AUX2;
}
else if (id == IMG_USE_BAKED_AUX3)
{
return BAKED_AUX3;
}
return BAKED_NUM_INDICES;
}
//static
LLUUID LLAvatarAppearanceDictionary::localTextureIndexToMagicId(ETextureIndex t)
{
LLUUID id = LLUUID::null;
switch (t)
{
case LLAvatarAppearanceDefines::TEX_HEAD_BAKED:
id = IMG_USE_BAKED_HEAD;
break;
case LLAvatarAppearanceDefines::TEX_UPPER_BAKED:
id = IMG_USE_BAKED_UPPER;
break;
case LLAvatarAppearanceDefines::TEX_LOWER_BAKED:
id = IMG_USE_BAKED_LOWER;
break;
case LLAvatarAppearanceDefines::TEX_EYES_BAKED:
id = IMG_USE_BAKED_EYES;
break;
case LLAvatarAppearanceDefines::TEX_SKIRT_BAKED:
id = IMG_USE_BAKED_SKIRT;
break;
case LLAvatarAppearanceDefines::TEX_HAIR_BAKED:
id = IMG_USE_BAKED_HAIR;
break;
case LLAvatarAppearanceDefines::TEX_LEFT_ARM_BAKED:
id = IMG_USE_BAKED_LEFTARM;
break;
case LLAvatarAppearanceDefines::TEX_LEFT_LEG_BAKED:
id = IMG_USE_BAKED_LEFTLEG;
break;
case LLAvatarAppearanceDefines::TEX_AUX1_BAKED:
id = IMG_USE_BAKED_AUX1;
break;
case LLAvatarAppearanceDefines::TEX_AUX2_BAKED:
id = IMG_USE_BAKED_AUX2;
break;
case LLAvatarAppearanceDefines::TEX_AUX3_BAKED:
id = IMG_USE_BAKED_AUX3;
break;
default:
break;
}
return id;
}
......@@ -78,6 +78,22 @@ enum ETextureIndex
TEX_HEAD_TATTOO,
TEX_UPPER_TATTOO,
TEX_LOWER_TATTOO,
TEX_HEAD_UNIVERSAL_TATTOO,
TEX_UPPER_UNIVERSAL_TATTOO,
TEX_LOWER_UNIVERSAL_TATTOO,
TEX_SKIRT_TATTOO,
TEX_HAIR_TATTOO,
TEX_EYES_TATTOO,
TEX_LEFT_ARM_TATTOO,
TEX_LEFT_LEG_TATTOO,
TEX_AUX1_TATTOO,
TEX_AUX2_TATTOO,
TEX_AUX3_TATTOO,
TEX_LEFT_ARM_BAKED, // Pre-composited
TEX_LEFT_LEG_BAKED, // Pre-composited
TEX_AUX1_BAKED, // Pre-composited
TEX_AUX2_BAKED, // Pre-composited
TEX_AUX3_BAKED, // Pre-composited
TEX_NUM_INDICES
};
......@@ -89,6 +105,11 @@ enum EBakedTextureIndex
BAKED_EYES,
BAKED_SKIRT,
BAKED_HAIR,
BAKED_LEFT_ARM,
BAKED_LEFT_LEG,
BAKED_AUX1,
BAKED_AUX2,
BAKED_AUX3,
BAKED_NUM_INDICES
};
......@@ -223,6 +244,10 @@ class LLAvatarAppearanceDictionary : public LLSingleton<LLAvatarAppearanceDictio
// Given a texture entry, determine which wearable type owns it.
static LLWearableType::EType getTEWearableType(ETextureIndex index);
static BOOL isBakedImageId(const LLUUID& id);
static EBakedTextureIndex assetIdToBakedTextureIndex(const LLUUID& id);
static LLUUID localTextureIndexToMagicId(ETextureIndex t);
}; // End LLAvatarAppearanceDictionary
} // End namespace LLAvatarAppearanceDefines
......
......@@ -1581,8 +1581,8 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
// nSight doesn't support use of glReadPixels
if (!LLRender::sNsightDebugSupport)
{
glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data);
}
glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data);
}
}
getTexLayerSet()->getAvatarAppearance()->dirtyMesh();
......
......@@ -91,6 +91,7 @@ LLWearableDictionary::LLWearableDictionary()
addEntry(LLWearableType::WT_SKIRT, new WearableEntry("skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SKIRT, FALSE, TRUE));
addEntry(LLWearableType::WT_ALPHA, new WearableEntry("alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_ALPHA, FALSE, TRUE));
addEntry(LLWearableType::WT_TATTOO, new WearableEntry("tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_TATTOO, FALSE, TRUE));
addEntry(LLWearableType::WT_UNIVERSAL, new WearableEntry("universal", "New Universal", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNIVERSAL, FALSE, TRUE));
addEntry(LLWearableType::WT_PHYSICS, new WearableEntry("physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PHYSICS, TRUE, TRUE));
......
......@@ -63,7 +63,8 @@ class LLWearableType
WT_ALPHA = 13,
WT_TATTOO = 14,
WT_PHYSICS = 15,
WT_COUNT = 16,
WT_UNIVERSAL = 16,
WT_COUNT = 17,
WT_INVALID = 255,
WT_NONE = -1,
......
......@@ -40,7 +40,7 @@ const S32 LLVORBISENC_UNSUPPORTED_WORD_SIZE = 9; // unsupported word size
const S32 LLVORBISENC_CLIP_TOO_LONG = 10; // source file is too long
const S32 LLVORBISENC_CHUNK_SIZE_ERR = 11; // chunk size is wrong
const F32 LLVORBIS_CLIP_MAX_TIME = 10.0f;
const F32 LLVORBIS_CLIP_MAX_TIME = 30.0f;
const U8 LLVORBIS_CLIP_MAX_CHANNELS = 2;
const U32 LLVORBIS_CLIP_SAMPLE_RATE = 44100;
const U32 LLVORBIS_CLIP_MAX_SAMPLES_PER_CHANNEL = (U32)(LLVORBIS_CLIP_MAX_TIME * LLVORBIS_CLIP_SAMPLE_RATE);
......
......@@ -72,3 +72,15 @@ const LLUUID TERRAIN_ROCK_DETAIL ("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // V
const LLUUID DEFAULT_WATER_NORMAL ("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER
const LLUUID IMG_USE_BAKED_HEAD ("5a9f4a74-30f2-821c-b88d-70499d3e7183");
const LLUUID IMG_USE_BAKED_UPPER ("ae2de45c-d252-50b8-5c6e-19f39ce79317");
const LLUUID IMG_USE_BAKED_LOWER ("24daea5f-0539-cfcf-047f-fbc40b2786ba");
const LLUUID IMG_USE_BAKED_EYES ("52cc6bb6-2ee5-e632-d3ad-50197b1dcb8a");
const LLUUID IMG_USE_BAKED_SKIRT ("43529ce8-7faa-ad92-165a-bc4078371687");
const LLUUID IMG_USE_BAKED_HAIR ("09aac1fb-6bce-0bee-7d44-caac6dbb6c63");
const LLUUID IMG_USE_BAKED_LEFTARM ("ff62763f-d60a-9855-890b-0c96f8f8cd98");
const LLUUID IMG_USE_BAKED_LEFTLEG ("8e915e25-31d1-cc95-ae08-d58a47488251");
const LLUUID IMG_USE_BAKED_AUX1 ("9742065b-19b5-297c-858a-29711d539043");
const LLUUID IMG_USE_BAKED_AUX2 ("03642e83-2bd1-4eb9-34b4-4c47ed586d2d");
const LLUUID IMG_USE_BAKED_AUX3 ("edd51b77-fc10-ce7a-4b3d-011dfc349e4f");
......@@ -206,6 +206,18 @@ LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL;
LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL;
LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_HEAD;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_UPPER;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_LOWER;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_EYES;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_SKIRT;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_HAIR;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_LEFTARM;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_LEFTLEG;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_AUX1;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_AUX2;
LL_COMMON_API extern const LLUUID IMG_USE_BAKED_AUX3;
LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL;
......
......@@ -1735,7 +1735,8 @@ bool LLStringUtilBase<T>::startsWith(
const string_type& substr)
{
if(string.empty() || (substr.empty())) return false;
if(0 == string.find(substr)) return true;
if (substr.length() > string.length()) return false;
if (0 == string.compare(0, substr.length(), substr)) return true;
return false;
}
......@@ -1746,9 +1747,11 @@ bool LLStringUtilBase<T>::endsWith(
const string_type& substr)
{
if(string.empty() || (substr.empty())) return false;
std::string::size_type idx = string.rfind(substr);
if(std::string::npos == idx) return false;
return (idx == (string.size() - substr.size()));
size_t sub_len = substr.length();
size_t str_len = string.length();
if (sub_len > str_len) return false;
if (0 == string.compare(str_len - sub_len, sub_len, substr)) return true;
return false;
}
// static
......
......@@ -173,6 +173,19 @@ namespace
"-._~";
return s;
}
const std::string path()
{
static const std::string s =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"$-_.+"
"!*'(),"
"{}|\\^~[]`"
"<>#%"
";/?:@&=";
return s;
}
const std::string sub_delims()
{
static const std::string s = "!$&'()*+,;=";
......@@ -187,6 +200,12 @@ namespace
{ return LLURI::escape(s, unreserved() + ":@!$'()*+,"); } // sub_delims - "&;=" + ":@"
std::string escapeQueryValue(const std::string& s)
{ return LLURI::escape(s, unreserved() + ":@!$'()*+,="); } // sub_delims - "&;" + ":@"
std::string escapeUriQuery(const std::string& s)
{ return LLURI::escape(s, unreserved() + ":@?&$;*+=%/"); }
std::string escapeUriData(const std::string& s)
{ return LLURI::escape(s, unreserved() + "%"); }
std::string escapeUriPath(const std::string& s)
{ return LLURI::escape(s, path()); }
}
//static
......@@ -202,6 +221,85 @@ std::string LLURI::escape(const std::string& str)
return escape(str, default_allowed, true);
}
//static
std::string LLURI::escapePathAndData(const std::string &str)
{
std::string result;
const std::string data_marker = "data:";
if (str.compare(0, data_marker.length(), data_marker) == 0)
{
// This is not url, but data, data part needs to be properly escaped
// data part is separated by ',' from header. Minimal data uri is "data:,"
// See "data URI scheme"
size_t separator = str.find(',');
if (separator != std::string::npos)
{
size_t header_size = separator + 1;
std::string header = str.substr(0, header_size);
// base64 is url-safe
if (header.find("base64") != std::string::npos)
{
// assume url-safe data
result = str;
}
else
{
std::string data = str.substr(header_size, str.length() - header_size);
// Notes: File can be partially pre-escaped, that's why escaping ignores '%'
// It somewhat limits user from displaying strings like "%20" in text
// but that's how viewer worked for a while and user can double-escape it
// Header doesn't need escaping
result = header + escapeUriData(data);
}
}
}
else
{
// try processing it as path with query separator
// The query component is indicated by the first question
// mark("?") character and terminated by a number sign("#")
size_t delim_pos = str.find('?');
if (delim_pos == std::string::npos)
{
// alternate separator
delim_pos = str.find(';');
}
if (delim_pos != std::string::npos)
{
size_t path_size = delim_pos + 1;
std::string query;
std::string fragment;
size_t fragment_pos = str.find('#');
if (fragment_pos != std::string::npos)
{
query = str.substr(path_size, fragment_pos - path_size);
fragment = str.substr(fragment_pos);
}
else
{
query = str.substr(path_size);
}
std::string path = str.substr(0, path_size);
result = escapeUriPath(path) + escapeUriQuery(query) + escapeUriPath(fragment);
}
}
if (result.empty())
{
// Not a known scheme or no data part, try just escaping as Uri path
result = escapeUriPath(str);