Merge the "screenshare" modifs

Merge the "screenshare" modifs with renderWithZones update
This commit is contained in:
Alezia Kurdis 2020-05-08 15:16:38 -04:00 committed by GitHub
parent 95562f7e23
commit 096bc40aa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -394,7 +394,8 @@ const DEFAULT_ENTITY_PROPERTIES = {
}, },
shapeType: "box", shapeType: "box",
bloomMode: "inherit", bloomMode: "inherit",
avatarPriority: "inherit" avatarPriority: "inherit",
screenshare: "inherit",
}, },
Model: { Model: {
collisionShape: "none", collisionShape: "none",
@ -562,21 +563,20 @@ var toolBar = (function () {
if (!properties.grab) { if (!properties.grab) {
properties.grab = {}; properties.grab = {};
if (Menu.isOptionChecked(MENU_CREATE_ENTITIES_GRABBABLE) && if (Menu.isOptionChecked(MENU_CREATE_ENTITIES_GRABBABLE) &&
!(properties.type === "Zone" || properties.type === "Light" || properties.type === "ParticleEffect")) { !(properties.type === "Zone" || properties.type === "Light" || properties.type === "ParticleEffect" || properties.type === "Web")) {
properties.grab.grabbable = true; properties.grab.grabbable = true;
} else { } else {
properties.grab.grabbable = false; properties.grab.grabbable = false;
} }
} }
entityID = Entities.addEntity(properties); if (type === "Model") {
SelectionManager.addEntity(entityID, false, this); properties.visible = false;
SelectionManager.saveProperties(); }
pushCommandForSelections([{
entityID: entityID,
properties: properties
}], [], true);
entityID = Entities.addEntity(properties);
var dimensionsCheckCallback = function(){
var POST_ADJUST_ENTITY_TYPES = ["Model"]; var POST_ADJUST_ENTITY_TYPES = ["Model"];
if (POST_ADJUST_ENTITY_TYPES.indexOf(properties.type) !== -1) { if (POST_ADJUST_ENTITY_TYPES.indexOf(properties.type) !== -1) {
// Adjust position of entity per bounding box after it has been created and auto-resized. // Adjust position of entity per bounding box after it has been created and auto-resized.
@ -602,6 +602,34 @@ var toolBar = (function () {
}; };
Script.setTimeout(dimensionsCheckFunction, DIMENSIONS_CHECK_INTERVAL); Script.setTimeout(dimensionsCheckFunction, DIMENSIONS_CHECK_INTERVAL);
} }
}
// Make sure the entity is loaded before we try to figure out
// its dimensions.
var MAX_LOADED_CHECKS = 10;
var LOADED_CHECK_INTERVAL = 100;
var isLoadedCheckCount = 0;
var entityIsLoadedCheck = function() {
isLoadedCheckCount++;
if (isLoadedCheckCount === MAX_LOADED_CHECKS || Entities.isLoaded(entityID)) {
var naturalDimensions = Entities.getEntityProperties(entityID, "naturalDimensions").naturalDimensions
Entities.editEntity(entityID, {
visible: true,
dimensions: naturalDimensions
})
dimensionsCheckCallback();
return;
}
Script.setTimeout(entityIsLoadedCheck, LOADED_CHECK_INTERVAL);
}
Script.setTimeout(entityIsLoadedCheck, LOADED_CHECK_INTERVAL);
SelectionManager.addEntity(entityID, false, this);
SelectionManager.saveProperties();
pushCommandForSelections([{
entityID: entityID,
properties: properties
}], [], true);
} else { } else {
Window.notifyEditError("Can't create " + properties.type + ": " + Window.notifyEditError("Can't create " + properties.type + ": " +
properties.type + " would be out of bounds."); properties.type + " would be out of bounds.");