mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 18:58:20 +02:00
Merge pull request #14167 from ElderOrb/FB18859
Make material entities to be presented in avatarapp
This commit is contained in:
commit
12b833d121
3 changed files with 21 additions and 8 deletions
|
@ -48,16 +48,32 @@ Rectangle {
|
||||||
refresh(avatar);
|
refresh(avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function extractTitleFromUrl(url) {
|
||||||
|
for (var j = (url.length - 1); j >= 0; --j) {
|
||||||
|
if (url[j] === '/') {
|
||||||
|
return url.substring(j + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
function refresh(avatar) {
|
function refresh(avatar) {
|
||||||
wearablesCombobox.model.clear();
|
wearablesCombobox.model.clear();
|
||||||
wearablesCombobox.currentIndex = -1;
|
wearablesCombobox.currentIndex = -1;
|
||||||
|
|
||||||
for (var i = 0; i < avatar.wearables.count; ++i) {
|
for (var i = 0; i < avatar.wearables.count; ++i) {
|
||||||
var wearable = avatar.wearables.get(i).properties;
|
var wearable = avatar.wearables.get(i).properties;
|
||||||
for (var j = (wearable.modelURL.length - 1); j >= 0; --j) {
|
if (wearable.modelURL) {
|
||||||
if (wearable.modelURL[j] === '/') {
|
wearable.text = extractTitleFromUrl(wearable.modelURL);
|
||||||
wearable.text = wearable.modelURL.substring(j + 1);
|
} else if (wearable.materialURL) {
|
||||||
break;
|
var materialUrlOrJson = '';
|
||||||
|
if (!wearable.materialURL.startsWith('materialData')) {
|
||||||
|
materialUrlOrJson = extractTitleFromUrl(wearable.materialURL);
|
||||||
|
} else if (wearable.materialData) {
|
||||||
|
materialUrlOrJson = JSON.stringify(JSON.parse(wearable.materialData))
|
||||||
|
}
|
||||||
|
if(materialUrlOrJson) {
|
||||||
|
wearable.text = 'Material: ' + materialUrlOrJson;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wearablesCombobox.model.append(wearable);
|
wearablesCombobox.model.append(wearable);
|
||||||
|
|
|
@ -1893,8 +1893,6 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||||
|
|
||||||
bool isWearableEntity(const EntityItemPointer& entity) {
|
bool isWearableEntity(const EntityItemPointer& entity) {
|
||||||
return entity->isVisible()
|
return entity->isVisible()
|
||||||
&& (entity->getParentJointIndex() != INVALID_JOINT_INDEX
|
|
||||||
|| (entity->getType() == EntityTypes::Model && (std::static_pointer_cast<ModelEntityItem>(entity))->getRelayParentJoints()))
|
|
||||||
&& (entity->getParentID() == DependencyManager::get<NodeList>()->getSessionUUID()
|
&& (entity->getParentID() == DependencyManager::get<NodeList>()->getSessionUUID()
|
||||||
|| entity->getParentID() == AVATAR_SELF_ID);
|
|| entity->getParentID() == AVATAR_SELF_ID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,8 @@ function executeLater(callback) {
|
||||||
Script.setTimeout(callback, 300);
|
Script.setTimeout(callback, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
var INVALID_JOINT_INDEX = -1
|
|
||||||
function isWearable(avatarEntity) {
|
function isWearable(avatarEntity) {
|
||||||
return avatarEntity.properties.visible === true && (avatarEntity.properties.parentJointIndex !== INVALID_JOINT_INDEX || avatarEntity.properties.relayParentJoints === true) &&
|
return avatarEntity.properties.visible === true &&
|
||||||
(avatarEntity.properties.parentID === MyAvatar.sessionUUID || avatarEntity.properties.parentID === MyAvatar.SELF_ID);
|
(avatarEntity.properties.parentID === MyAvatar.sessionUUID || avatarEntity.properties.parentID === MyAvatar.SELF_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue