code review

This commit is contained in:
Seth Alves 2015-06-02 10:00:07 -07:00
parent ea3f002a65
commit 20d3814c1b
7 changed files with 60 additions and 68 deletions

View file

@ -1,4 +1,3 @@
// newEditEntities.js // newEditEntities.js
// examples // examples
// //
@ -139,7 +138,7 @@ var toolBar = (function () {
newTextButton, newTextButton,
newWebButton, newWebButton,
newZoneButton, newZoneButton,
newPolyVoxButton, newPolyVoxButton,
browseMarketplaceButton; browseMarketplaceButton;
function initialize() { function initialize() {
@ -225,7 +224,7 @@ var toolBar = (function () {
visible: false visible: false
}); });
newPolyVoxButton = toolBar.addTool({ newPolyVoxButton = toolBar.addTool({
imageURL: toolIconUrl + "upload.svg", // XXX need a new icon imageURL: toolIconUrl + "upload.svg", // XXX need a new icon
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT }, subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, width: toolWidth,
@ -276,7 +275,7 @@ var toolBar = (function () {
toolBar.showTool(newTextButton, doShow); toolBar.showTool(newTextButton, doShow);
toolBar.showTool(newWebButton, doShow); toolBar.showTool(newWebButton, doShow);
toolBar.showTool(newZoneButton, doShow); toolBar.showTool(newZoneButton, doShow);
toolBar.showTool(newPolyVoxButton, doShow); toolBar.showTool(newPolyVoxButton, doShow);
}; };
var RESIZE_INTERVAL = 50; var RESIZE_INTERVAL = 50;
@ -486,10 +485,10 @@ var toolBar = (function () {
placingEntityID = Entities.addEntity({ placingEntityID = Entities.addEntity({
type: "PolyVox", type: "PolyVox",
position: grid.snapToSurface(grid.snapToGrid(position, false, DEFAULT_DIMENSIONS), position: grid.snapToSurface(grid.snapToGrid(position, false, DEFAULT_DIMENSIONS),
DEFAULT_DIMENSIONS), DEFAULT_DIMENSIONS),
dimensions: { x: 10, y: 10, z: 10 }, dimensions: { x: 10, y: 10, z: 10 },
voxelVolumeSize: {x:16, y:16, z:16}, voxelVolumeSize: {x:16, y:16, z:16},
voxelSurfaceStyle: 1 voxelSurfaceStyle: 1
}); });
} else { } else {
print("Can't create PolyVox: would be out of bounds."); print("Can't create PolyVox: would be out of bounds.");
@ -949,7 +948,7 @@ function selectAllEtitiesInCurrentSelectionBox(keepIfTouching) {
var boundingBoxCorner = Vec3.subtract(selectionManager.worldPosition, var boundingBoxCorner = Vec3.subtract(selectionManager.worldPosition,
Vec3.multiply(selectionManager.worldDimensions, 0.5)); Vec3.multiply(selectionManager.worldDimensions, 0.5));
var entities = Entities.findEntitiesInBox(boundingBoxCorner, selectionManager.worldDimensions); var entities = Entities.findEntitiesInBox(boundingBoxCorner, selectionManager.worldDimensions);
if (!keepIfTouching) { if (!keepIfTouching) {
var isValid; var isValid;
if (selectionManager.localPosition === null) { if (selectionManager.localPosition === null) {
@ -1021,7 +1020,7 @@ function handeMenuEvent(menuItem) {
} }
} }
} else if (menuItem == "Import Entities" || menuItem == "Import Entities from URL") { } else if (menuItem == "Import Entities" || menuItem == "Import Entities from URL") {
var importURL; var importURL;
if (menuItem == "Import Entities") { if (menuItem == "Import Entities") {
importURL = Window.browse("Select models to import", "", "*.json"); importURL = Window.browse("Select models to import", "", "*.json");

View file

@ -21,11 +21,11 @@
els[i].setAttribute('disabled', 'disabled'); els[i].setAttribute('disabled', 'disabled');
} }
} }
function showElements(els, show) { function showElements(els, show) {
for (var i = 0; i < els.length; i++) { for (var i = 0; i < els.length; i++) {
els[i].style.display = (show) ? 'block' : 'none'; els[i].style.display = (show) ? 'block' : 'none';
} }
} }
function createEmitCheckedPropertyUpdateFunction(propertyName) { function createEmitCheckedPropertyUpdateFunction(propertyName) {
@ -344,7 +344,7 @@
var elZoneAtmosphereCenterY = document.getElementById("property-zone-atmosphere-center-y"); var elZoneAtmosphereCenterY = document.getElementById("property-zone-atmosphere-center-y");
var elZoneAtmosphereCenterZ = document.getElementById("property-zone-atmosphere-center-z"); var elZoneAtmosphereCenterZ = document.getElementById("property-zone-atmosphere-center-z");
var elCenterAtmosphereToZone = document.getElementById("center-atmosphere-in-zone"); var elCenterAtmosphereToZone = document.getElementById("center-atmosphere-in-zone");
var elZoneAtmosphereInnerRadius = document.getElementById("property-zone-atmosphere-inner-radius"); var elZoneAtmosphereInnerRadius = document.getElementById("property-zone-atmosphere-inner-radius");
var elZoneAtmosphereOuterRadius = document.getElementById("property-zone-atmosphere-outer-radius"); var elZoneAtmosphereOuterRadius = document.getElementById("property-zone-atmosphere-outer-radius");
var elZoneAtmosphereMieScattering = document.getElementById("property-zone-atmosphere-mie-scattering"); var elZoneAtmosphereMieScattering = document.getElementById("property-zone-atmosphere-mie-scattering");
@ -354,12 +354,12 @@
var elZoneAtmosphereScatteringWavelengthsZ = document.getElementById("property-zone-atmosphere-scattering-wavelengths-z"); var elZoneAtmosphereScatteringWavelengthsZ = document.getElementById("property-zone-atmosphere-scattering-wavelengths-z");
var elZoneAtmosphereHasStars = document.getElementById("property-zone-atmosphere-has-stars"); var elZoneAtmosphereHasStars = document.getElementById("property-zone-atmosphere-has-stars");
var elPolyVoxSelections = document.querySelectorAll(".poly-vox-section"); var elPolyVoxSelections = document.querySelectorAll(".poly-vox-section");
var elVoxelVolumeSizeX = document.getElementById("property-voxel-volume-size-x"); var elVoxelVolumeSizeX = document.getElementById("property-voxel-volume-size-x");
var elVoxelVolumeSizeY = document.getElementById("property-voxel-volume-size-y"); var elVoxelVolumeSizeY = document.getElementById("property-voxel-volume-size-y");
var elVoxelVolumeSizeZ = document.getElementById("property-voxel-volume-size-z"); var elVoxelVolumeSizeZ = document.getElementById("property-voxel-volume-size-z");
var elVoxelSurfaceStyle = document.getElementById("property-voxel-surface-style"); var elVoxelSurfaceStyle = document.getElementById("property-voxel-surface-style");
if (window.EventBridge !== undefined) { if (window.EventBridge !== undefined) {
EventBridge.scriptEventReceived.connect(function(data) { EventBridge.scriptEventReceived.connect(function(data) {
@ -577,7 +577,7 @@
elZoneAtmosphereScatteringWavelengthsY.value = properties.atmosphere.scatteringWavelengths.y; elZoneAtmosphereScatteringWavelengthsY.value = properties.atmosphere.scatteringWavelengths.y;
elZoneAtmosphereScatteringWavelengthsZ.value = properties.atmosphere.scatteringWavelengths.z; elZoneAtmosphereScatteringWavelengthsZ.value = properties.atmosphere.scatteringWavelengths.z;
elZoneAtmosphereHasStars.checked = properties.atmosphere.hasStars; elZoneAtmosphereHasStars.checked = properties.atmosphere.hasStars;
showElements(document.getElementsByClassName('skybox-section'), elZoneBackgroundMode.value == 'skybox'); showElements(document.getElementsByClassName('skybox-section'), elZoneBackgroundMode.value == 'skybox');
showElements(document.getElementsByClassName('atmosphere-section'), elZoneBackgroundMode.value == 'atmosphere'); showElements(document.getElementsByClassName('atmosphere-section'), elZoneBackgroundMode.value == 'atmosphere');
} else if (properties.type == "ParticleEffect") { } else if (properties.type == "ParticleEffect") {
@ -595,11 +595,11 @@
elParticleLocalGravity.value = properties.localGravity.toFixed(2); elParticleLocalGravity.value = properties.localGravity.toFixed(2);
elParticleRadius.value = properties.particleRadius.toFixed(3); elParticleRadius.value = properties.particleRadius.toFixed(3);
} else if (properties.type == "PolyVox") { } else if (properties.type == "PolyVox") {
elVoxelVolumeSizeX.value = properties.voxelVolumeSize.x.toFixed(2); elVoxelVolumeSizeX.value = properties.voxelVolumeSize.x.toFixed(2);
elVoxelVolumeSizeY.value = properties.voxelVolumeSize.y.toFixed(2); elVoxelVolumeSizeY.value = properties.voxelVolumeSize.y.toFixed(2);
elVoxelVolumeSizeZ.value = properties.voxelVolumeSize.z.toFixed(2); elVoxelVolumeSizeZ.value = properties.voxelVolumeSize.z.toFixed(2);
elVoxelSurfaceStyle.value = properties.voxelSurfaceStyle; elVoxelSurfaceStyle.value = properties.voxelSurfaceStyle;
} }
if (selected) { if (selected) {
activeElement.focus(); activeElement.focus();
@ -715,7 +715,7 @@
elLightCutoff.addEventListener('change', createEmitNumberPropertyUpdateFunction('cutoff')); elLightCutoff.addEventListener('change', createEmitNumberPropertyUpdateFunction('cutoff'));
elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl')); elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl'));
elParticleMaxParticles.addEventListener('change', createEmitNumberPropertyUpdateFunction('maxParticles')); elParticleMaxParticles.addEventListener('change', createEmitNumberPropertyUpdateFunction('maxParticles'));
elParticleLifeSpan.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifespan')); elParticleLifeSpan.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifespan'));
elParticleEmitRate.addEventListener('change', createEmitNumberPropertyUpdateFunction('emitRate')); elParticleEmitRate.addEventListener('change', createEmitNumberPropertyUpdateFunction('emitRate'));
@ -821,7 +821,7 @@
emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b, 'skybox'); emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b, 'skybox');
} }
}); });
elZoneSkyboxURL.addEventListener('change', createEmitGroupTextPropertyUpdateFunction('skybox','url')); elZoneSkyboxURL.addEventListener('change', createEmitGroupTextPropertyUpdateFunction('skybox','url'));
var zoneAtmosphereCenterChangeFunction = createEmitGroupVec3PropertyUpdateFunction( var zoneAtmosphereCenterChangeFunction = createEmitGroupVec3PropertyUpdateFunction(
@ -829,8 +829,8 @@
elZoneAtmosphereCenterX.addEventListener('change', zoneAtmosphereCenterChangeFunction); elZoneAtmosphereCenterX.addEventListener('change', zoneAtmosphereCenterChangeFunction);
elZoneAtmosphereCenterY.addEventListener('change', zoneAtmosphereCenterChangeFunction); elZoneAtmosphereCenterY.addEventListener('change', zoneAtmosphereCenterChangeFunction);
elZoneAtmosphereCenterZ.addEventListener('change', zoneAtmosphereCenterChangeFunction); elZoneAtmosphereCenterZ.addEventListener('change', zoneAtmosphereCenterChangeFunction);
elZoneAtmosphereInnerRadius.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('atmosphere','innerRadius')); elZoneAtmosphereInnerRadius.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('atmosphere','innerRadius'));
elZoneAtmosphereOuterRadius.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('atmosphere','outerRadius')); elZoneAtmosphereOuterRadius.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('atmosphere','outerRadius'));
elZoneAtmosphereMieScattering.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('atmosphere','mieScattering')); elZoneAtmosphereMieScattering.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('atmosphere','mieScattering'));
@ -848,8 +848,8 @@
elVoxelVolumeSizeX.addEventListener('change', voxelVolumeSizeChangeFunction); elVoxelVolumeSizeX.addEventListener('change', voxelVolumeSizeChangeFunction);
elVoxelVolumeSizeY.addEventListener('change', voxelVolumeSizeChangeFunction); elVoxelVolumeSizeY.addEventListener('change', voxelVolumeSizeChangeFunction);
elVoxelVolumeSizeZ.addEventListener('change', voxelVolumeSizeChangeFunction); elVoxelVolumeSizeZ.addEventListener('change', voxelVolumeSizeChangeFunction);
elVoxelSurfaceStyle.addEventListener('change', createEmitTextPropertyUpdateFunction('voxelSurfaceStyle')); elVoxelSurfaceStyle.addEventListener('change', createEmitTextPropertyUpdateFunction('voxelSurfaceStyle'));
elMoveSelectionToGrid.addEventListener("click", function() { elMoveSelectionToGrid.addEventListener("click", function() {
EventBridge.emitWebEvent(JSON.stringify({ EventBridge.emitWebEvent(JSON.stringify({
@ -997,14 +997,14 @@
<div class="input-area">X <br><input class="coord" type='number' id="property-voxel-volume-size-x"></input></div> <div class="input-area">X <br><input class="coord" type='number' id="property-voxel-volume-size-x"></input></div>
<div class="input-area">Y <br><input class="coord" type='number' id="property-voxel-volume-size-y"></input></div> <div class="input-area">Y <br><input class="coord" type='number' id="property-voxel-volume-size-y"></input></div>
<div class="input-area">Z <br><input class="coord" type='number' id="property-voxel-volume-size-z"></input></div> <div class="input-area">Z <br><input class="coord" type='number' id="property-voxel-volume-size-z"></input></div>
</div> </div>
<div class="label">Surface Extractor</div> <div class="label">Surface Extractor</div>
<div class="value"> <div class="value">
<select name="SelectVoxelSurfaceStyle" id="property-voxel-surface-style"> <select name="SelectVoxelSurfaceStyle" id="property-voxel-surface-style">
<option value='0'>marching cubes</option> <option value='0'>marching cubes</option>
<option value='1'>cubic</option> <option value='1'>cubic</option>
<option value='2'>edged cubic</option> <option value='2'>edged cubic</option>
</select> </select>
</div> </div>
</div> </div>
@ -1143,19 +1143,19 @@
<input type="text" id="property-web-source-url" class="url"></input> <input type="text" id="property-web-source-url" class="url"></input>
</div> </div>
</div> </div>
<div class="particle-section property"> <div class="particle-section property">
<div class="label">Max Particles</div> <div class="label">Max Particles</div>
<div class="value"> <div class="value">
<input type='number' id="property-particle-maxparticles" min="0" max="2048" step="1"></input> <input type='number' id="property-particle-maxparticles" min="0" max="2048" step="1"></input>
</div> </div>
</div> </div>
<div class="particle-section property"> <div class="particle-section property">
<div class="label">Particle Life Span</div> <div class="label">Particle Life Span</div>
<div class="value"> <div class="value">
<input type='number' id="property-particle-lifespan" min="0" step="0.1"></input> <input type='number' id="property-particle-lifespan" min="0" step="0.1"></input>
</div> </div>
</div> </div>
<div class="particle-section property"> <div class="particle-section property">
<div class="label">Particle Emission Rate</div> <div class="label">Particle Emission Rate</div>
<div class="value"> <div class="value">
@ -1188,7 +1188,7 @@
<input class="coord" type='number' id="property-particle-radius" min="0" step="0.005"></input> <input class="coord" type='number' id="property-particle-radius" min="0" step="0.005"></input>
</div> </div>
</div> </div>
<div class="model-section property"> <div class="model-section property">
<div class="label">Model URL</div> <div class="label">Model URL</div>
<div class="value"> <div class="value">
@ -1203,7 +1203,7 @@
<option value='box'>box</option> <option value='box'>box</option>
<option value='sphere'>sphere</option> <option value='sphere'>sphere</option>
<option value='compound'>compound</option> <option value='compound'>compound</option>
</select> </select>
</div> </div>
</div> </div>
<div class="model-section zone-section property"> <div class="model-section zone-section property">
@ -1382,7 +1382,7 @@
<input type='checkbox' id="property-zone-stage-automatic-hour-day"> <input type='checkbox' id="property-zone-stage-automatic-hour-day">
</span> </span>
</div> </div>
<div class="zone-section property"> <div class="zone-section property">
<div class="label">Stage Day</div> <div class="label">Stage Day</div>
<div class="value"> <div class="value">

View file

@ -1,4 +1,3 @@
var controlHeld = false; var controlHeld = false;
var shiftHeld = false; var shiftHeld = false;
@ -17,8 +16,8 @@ function mousePressEvent(event) {
var id = ids[i]; var id = ids[i];
if (controlHeld) { if (controlHeld) {
Entities.setVoxelSphere(id, intersection.intersection, 1.0, 0); Entities.setVoxelSphere(id, intersection.intersection, 1.0, 0);
} else if (shiftHeld) { } else if (shiftHeld) {
Entities.setAllVoxels(id, 255); Entities.setAllVoxels(id, 255);
} else { } else {
Entities.setVoxelSphere(id, intersection.intersection, 1.0, 255); Entities.setVoxelSphere(id, intersection.intersection, 1.0, 255);
} }

View file

@ -78,11 +78,7 @@ bool inUserBounds(const PolyVox::SimpleVolume<uint8_t>* vol, PolyVoxEntityItem::
bool inBounds(const PolyVox::SimpleVolume<uint8_t>* vol, int x, int y, int z) { bool inBounds(const PolyVox::SimpleVolume<uint8_t>* vol, int x, int y, int z) {
// x, y, z are in polyvox volume coords // x, y, z are in polyvox volume coords
if (x < 0 || y < 0 || z < 0 || return !(x < 0 || y < 0 || z < 0 || x >= vol->getWidth() || y >= vol->getHeight() || z >= vol->getDepth());
x >= vol->getWidth() || y >= vol->getHeight() || z >= vol->getDepth()) {
return false;
}
return true;
} }
@ -183,7 +179,7 @@ glm::vec3 RenderablePolyVoxEntityItem::getSurfacePositionAdjustment() const {
case PolyVoxEntityItem::SURFACE_CUBIC: case PolyVoxEntityItem::SURFACE_CUBIC:
return scale / 2.0f; return scale / 2.0f;
} }
return glm::vec3(0, 0, 0); return glm::vec3(0.0f, 0.0f, 0.0f);
} }
glm::mat4 RenderablePolyVoxEntityItem::voxelToLocalMatrix() const { glm::mat4 RenderablePolyVoxEntityItem::voxelToLocalMatrix() const {
@ -191,7 +187,7 @@ glm::mat4 RenderablePolyVoxEntityItem::voxelToLocalMatrix() const {
glm::vec3 center = getCenter(); glm::vec3 center = getCenter();
glm::vec3 position = getPosition(); glm::vec3 position = getPosition();
glm::vec3 positionToCenter = center - position; glm::vec3 positionToCenter = center - position;
positionToCenter -= _dimensions * glm::vec3(0.5f,0.5f,0.5f) - getSurfacePositionAdjustment(); positionToCenter -= _dimensions * glm::vec3(0.5f, 0.5f, 0.5f) - getSurfacePositionAdjustment();
glm::mat4 centerToCorner = glm::translate(glm::mat4(), positionToCenter); glm::mat4 centerToCorner = glm::translate(glm::mat4(), positionToCenter);
glm::mat4 scaled = glm::scale(centerToCorner, scale); glm::mat4 scaled = glm::scale(centerToCorner, scale);
return scaled; return scaled;

View file

@ -176,10 +176,8 @@ QString EntityItemProperties::getAnimationSettings() const {
return jsonByteString; return jsonByteString;
} }
void EntityItemProperties::setCreated(QDateTime &v) {
void EntityItemProperties::setCreated(QDateTime v) { _created = v.toMSecsSinceEpoch() * 1000; // usec per msec
QDateTime utcV = v;
_created = utcV.toMSecsSinceEpoch() * 1000; // usec per msec
qDebug() << "EntityItemProperties::setCreated QDateTime" << v << _created; qDebug() << "EntityItemProperties::setCreated QDateTime" << v << _created;
} }
@ -494,12 +492,6 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
COPY_PROPERTY_FROM_QSCRIPTVALUE(restitution, float, setRestitution); COPY_PROPERTY_FROM_QSCRIPTVALUE(restitution, float, setRestitution);
COPY_PROPERTY_FROM_QSCRIPTVALUE(friction, float, setFriction); COPY_PROPERTY_FROM_QSCRIPTVALUE(friction, float, setFriction);
COPY_PROPERTY_FROM_QSCRIPTVALUE(lifetime, float, setLifetime); COPY_PROPERTY_FROM_QSCRIPTVALUE(lifetime, float, setLifetime);
if (!honorReadOnly) {
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(created, QDateTime, setCreated, [this]() {
auto result = QDateTime::fromMSecsSinceEpoch(_created / 1000, Qt::UTC); // usec per msec
return result;
});
}
COPY_PROPERTY_FROM_QSCRIPTVALUE(script, QString, setScript); COPY_PROPERTY_FROM_QSCRIPTVALUE(script, QString, setScript);
COPY_PROPERTY_FROM_QSCRIPTVALUE(registrationPoint, glmVec3, setRegistrationPoint); COPY_PROPERTY_FROM_QSCRIPTVALUE(registrationPoint, glmVec3, setRegistrationPoint);
COPY_PROPERTY_FROM_QSCRIPTVALUE(angularVelocity, glmVec3, setAngularVelocity); COPY_PROPERTY_FROM_QSCRIPTVALUE(angularVelocity, glmVec3, setAngularVelocity);
@ -524,9 +516,6 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
COPY_PROPERTY_FROM_QSCRIPTVALUE(locked, bool, setLocked); COPY_PROPERTY_FROM_QSCRIPTVALUE(locked, bool, setLocked);
COPY_PROPERTY_FROM_QSCRIPTVALUE(textures, QString, setTextures); COPY_PROPERTY_FROM_QSCRIPTVALUE(textures, QString, setTextures);
COPY_PROPERTY_FROM_QSCRIPTVALUE(userData, QString, setUserData); COPY_PROPERTY_FROM_QSCRIPTVALUE(userData, QString, setUserData);
if (!honorReadOnly) {
COPY_PROPERTY_FROM_QSCRIPTVALUE(simulatorID, QUuid, setSimulatorID);
}
COPY_PROPERTY_FROM_QSCRIPTVALUE(text, QString, setText); COPY_PROPERTY_FROM_QSCRIPTVALUE(text, QString, setText);
COPY_PROPERTY_FROM_QSCRIPTVALUE(lineHeight, float, setLineHeight); COPY_PROPERTY_FROM_QSCRIPTVALUE(lineHeight, float, setLineHeight);
COPY_PROPERTY_FROM_QSCRIPTVALUE(textColor, xColor, setTextColor); COPY_PROPERTY_FROM_QSCRIPTVALUE(textColor, xColor, setTextColor);
@ -554,6 +543,15 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelData, QByteArray, setVoxelData); COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelData, QByteArray, setVoxelData);
COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelSurfaceStyle, uint16_t, setVoxelSurfaceStyle); COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelSurfaceStyle, uint16_t, setVoxelSurfaceStyle);
if (!honorReadOnly) {
// this is used by the json reader to set things that we don't want javascript to able to affect.
COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(created, QDateTime, setCreated, [this]() {
auto result = QDateTime::fromMSecsSinceEpoch(_created / 1000, Qt::UTC); // usec per msec
return result;
});
COPY_PROPERTY_FROM_QSCRIPTVALUE(simulatorID, QUuid, setSimulatorID);
}
_stage.copyFromScriptValue(object, _defaultSettings); _stage.copyFromScriptValue(object, _defaultSettings);
_atmosphere.copyFromScriptValue(object, _defaultSettings); _atmosphere.copyFromScriptValue(object, _defaultSettings);
_skybox.copyFromScriptValue(object, _defaultSettings); _skybox.copyFromScriptValue(object, _defaultSettings);

View file

@ -194,7 +194,7 @@ public:
void setVoxelDataDirty() { _voxelDataChanged = true; } void setVoxelDataDirty() { _voxelDataChanged = true; }
void setCreated(QDateTime v); void setCreated(QDateTime& v);
bool hasTerseUpdateChanges() const; bool hasTerseUpdateChanges() const;

View file

@ -39,12 +39,12 @@ namespace Setting {
void init() { void init() {
// read the ApplicationInfo.ini file for Name/Version/Domain information // read the ApplicationInfo.ini file for Name/Version/Domain information
QSettings::setDefaultFormat(QSettings::IniFormat); QSettings::setDefaultFormat(QSettings::IniFormat);
QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); // QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
// set the associated application properties // // set the associated application properties
applicationInfo.beginGroup("INFO"); // applicationInfo.beginGroup("INFO");
QCoreApplication::setApplicationName(applicationInfo.value("name").toString()); // QCoreApplication::setApplicationName(applicationInfo.value("name").toString());
QCoreApplication::setOrganizationName(applicationInfo.value("organizationName").toString()); // QCoreApplication::setOrganizationName(applicationInfo.value("organizationName").toString());
QCoreApplication::setOrganizationDomain(applicationInfo.value("organizationDomain").toString()); // QCoreApplication::setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
// Let's set up the settings Private instance on it's own thread // Let's set up the settings Private instance on it's own thread
QThread* thread = new QThread(); QThread* thread = new QThread();