mirror of
https://github.com/overte-org/overte.git
synced 2025-04-09 07:12:45 +02:00
fixing materialTargets, after the rebase
This commit is contained in:
parent
c283c062c1
commit
00a024fde2
1 changed files with 13 additions and 13 deletions
|
@ -1902,6 +1902,13 @@ function showGroupsForTypes(types) {
|
|||
});
|
||||
}
|
||||
|
||||
function getFirstSelectedID() {
|
||||
if (selectedEntityIDs.size === 0) {
|
||||
return null;
|
||||
}
|
||||
return selectedEntityIDs.values().next().value;
|
||||
}
|
||||
|
||||
const SUPPORTED_FALLBACK_TYPES = ['number', 'number-draggable', 'rect', 'vec3', 'vec2', 'color'];
|
||||
|
||||
function getMultiplePropertyValue(originalPropertyName) {
|
||||
|
@ -2992,7 +2999,7 @@ function createProperty(propertyData, propertyElementID, propertyName, propertyI
|
|||
*/
|
||||
|
||||
function parentIDChanged() {
|
||||
if (selectedEntityProperties.type === "Material") {
|
||||
if (currentSelections.length === 1 && currentSelections[0].type === "Material") {
|
||||
requestMaterialTarget();
|
||||
}
|
||||
}
|
||||
|
@ -3478,7 +3485,10 @@ function setTextareaScrolling(element) {
|
|||
*/
|
||||
|
||||
function requestMaterialTarget() {
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'materialTargetRequest', entityID: selectedEntityProperties.id }));
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
type: 'materialTargetRequest',
|
||||
entityID: getFirstSelectedID(),
|
||||
}));
|
||||
}
|
||||
|
||||
function setMaterialTargetData(materialTargetData) {
|
||||
|
@ -3643,16 +3653,6 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
|||
const multipleSelections = currentSelections.length > 1;
|
||||
const hasSelectedEntityChanged = !areSetsEqual(selectedEntityIDs, previouslySelectedEntityIDs);
|
||||
|
||||
// FIXME: do we really want to save userData/materialData here instead of saving it on the blur event of the json editor?
|
||||
if (hasSelectedEntityChanged) {
|
||||
if (editor !== null) {
|
||||
saveUserData(previouslySelectedEntityIDs);
|
||||
}
|
||||
if (materialEditor !== null) {
|
||||
saveMaterialData(previouslySelectedEntityIDs);
|
||||
}
|
||||
}
|
||||
|
||||
if (selections.length === 0) {
|
||||
deleteJSONEditor();
|
||||
deleteJSONMaterialEditor();
|
||||
|
@ -4200,7 +4200,7 @@ function loaded() {
|
|||
}
|
||||
}
|
||||
} else if (data.type === 'materialTargetReply') {
|
||||
if (data.entityID === selectedEntityProperties.id) {
|
||||
if (data.entityID === getFirstSelectedID()) {
|
||||
setMaterialTargetData(data.materialTargetData);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue