From ce6c8c72f528e24cf73254f5708d74dab5f6ade9 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Fri, 10 Aug 2018 19:09:47 +0300 Subject: [PATCH] ensure selection of newly-added wearable always happens after pushing updated wearables list to UI --- scripts/system/avatarapp.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/system/avatarapp.js b/scripts/system/avatarapp.js index 38b6d2447c..85946c644a 100644 --- a/scripts/system/avatarapp.js +++ b/scripts/system/avatarapp.js @@ -72,12 +72,15 @@ function getMyAvatarSettings() { } } -function updateAvatarWearables(avatar, bookmarkAvatarName) { +function updateAvatarWearables(avatar, bookmarkAvatarName, callback) { executeLater(function() { var wearables = getMyAvatarWearables(); avatar[ENTRY_AVATAR_ENTITIES] = wearables; sendToQml({'method' : 'wearablesUpdated', 'wearables' : wearables, 'avatarName' : bookmarkAvatarName}) + + if(callback) + callback(); }); } @@ -257,8 +260,7 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See }; var entityID = Entities.addEntity(properties, true); - updateAvatarWearables(currentAvatar, message.avatarName); - executeLater(function() { + updateAvatarWearables(currentAvatar, message.avatarName, function() { onSelectedEntity(entityID); }); break;