mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01: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'];
|
const SUPPORTED_FALLBACK_TYPES = ['number', 'number-draggable', 'rect', 'vec3', 'vec2', 'color'];
|
||||||
|
|
||||||
function getMultiplePropertyValue(originalPropertyName) {
|
function getMultiplePropertyValue(originalPropertyName) {
|
||||||
|
@ -2992,7 +2999,7 @@ function createProperty(propertyData, propertyElementID, propertyName, propertyI
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function parentIDChanged() {
|
function parentIDChanged() {
|
||||||
if (selectedEntityProperties.type === "Material") {
|
if (currentSelections.length === 1 && currentSelections[0].type === "Material") {
|
||||||
requestMaterialTarget();
|
requestMaterialTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3478,7 +3485,10 @@ function setTextareaScrolling(element) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function requestMaterialTarget() {
|
function requestMaterialTarget() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'materialTargetRequest', entityID: selectedEntityProperties.id }));
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
|
type: 'materialTargetRequest',
|
||||||
|
entityID: getFirstSelectedID(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMaterialTargetData(materialTargetData) {
|
function setMaterialTargetData(materialTargetData) {
|
||||||
|
@ -3643,16 +3653,6 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) {
|
||||||
const multipleSelections = currentSelections.length > 1;
|
const multipleSelections = currentSelections.length > 1;
|
||||||
const hasSelectedEntityChanged = !areSetsEqual(selectedEntityIDs, previouslySelectedEntityIDs);
|
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) {
|
if (selections.length === 0) {
|
||||||
deleteJSONEditor();
|
deleteJSONEditor();
|
||||||
deleteJSONMaterialEditor();
|
deleteJSONMaterialEditor();
|
||||||
|
@ -4200,7 +4200,7 @@ function loaded() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (data.type === 'materialTargetReply') {
|
} else if (data.type === 'materialTargetReply') {
|
||||||
if (data.entityID === selectedEntityProperties.id) {
|
if (data.entityID === getFirstSelectedID()) {
|
||||||
setMaterialTargetData(data.materialTargetData);
|
setMaterialTargetData(data.materialTargetData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue