filter out left/right hands from joints list in avatarapp

should fix:
	FB17884 - Wearable disappears when added to some joints
	FB17885 - Changing werable joint moves the model and detaches from avatar body
This commit is contained in:
Alexander Ivash 2018-08-29 22:34:35 +03:00
parent 156f1dc60d
commit cb1855b0d7
2 changed files with 26 additions and 6 deletions

View file

@ -46,7 +46,7 @@ Rectangle {
}
}
property var jointNames;
property var jointNames: []
property var currentAvatarSettings;
function fetchAvatarModelName(marketId, avatar) {

View file

@ -25,7 +25,17 @@ Rectangle {
modified = false;
}
property var jointNames;
property var jointNames: []
onJointNamesChanged: {
jointsModel.clear();
for (var i = 0; i < jointNames.length; ++i) {
var jointName = jointNames[i];
if(jointName !== 'LeftHand' && jointName !== 'RightHand') {
jointsModel.append({'text' : jointName, 'jointIndex' : i});
}
}
}
property string avatarName: ''
property var wearablesModel;
@ -268,20 +278,30 @@ Rectangle {
anchors.right: parent.right
enabled: getCurrentWearable() !== null && !isSoft.checked
comboBox.displayText: isSoft.checked ? 'Hips' : comboBox.currentText
comboBox.textRole: "text"
model: jointNames
model: ListModel {
id: jointsModel
}
property bool notify: false
function set(jointIndex) {
notify = false;
currentIndex = jointIndex;
for(var i = 0; i < jointsModel.count; ++i) {
if(jointsModel.get(i).jointIndex === jointIndex) {
currentIndex = i;
break;
}
}
notify = true;
}
function notifyJointChanged() {
modified = true;
var jointIndex = jointsModel.get(jointsCombobox.currentIndex).jointIndex;
var properties = {
parentJointIndex: currentIndex,
parentJointIndex: jointIndex,
localPosition: {
x: positionVector.xvalue,
y: positionVector.yvalue,
@ -294,7 +314,7 @@ Rectangle {
}
};
wearableUpdated(getCurrentWearable().id, wearablesCombobox.currentIndex, properties);
wearableUpdated(getCurrentWearable().id, jointIndex, properties);
}
onCurrentIndexChanged: {