mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 03:53:52 +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);
|
||||
}
|
||||
|
||||
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) {
|
||||
wearablesCombobox.model.clear();
|
||||
wearablesCombobox.currentIndex = -1;
|
||||
|
||||
for (var i = 0; i < avatar.wearables.count; ++i) {
|
||||
var wearable = avatar.wearables.get(i).properties;
|
||||
for (var j = (wearable.modelURL.length - 1); j >= 0; --j) {
|
||||
if (wearable.modelURL[j] === '/') {
|
||||
wearable.text = wearable.modelURL.substring(j + 1);
|
||||
break;
|
||||
if (wearable.modelURL) {
|
||||
wearable.text = extractTitleFromUrl(wearable.modelURL);
|
||||
} else if (wearable.materialURL) {
|
||||
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);
|
||||
|
|
|
@ -1893,8 +1893,6 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
|||
|
||||
bool isWearableEntity(const EntityItemPointer& entity) {
|
||||
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() == AVATAR_SELF_ID);
|
||||
}
|
||||
|
|
|
@ -28,9 +28,8 @@ function executeLater(callback) {
|
|||
Script.setTimeout(callback, 300);
|
||||
}
|
||||
|
||||
var INVALID_JOINT_INDEX = -1
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue