mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 19:36:45 +02:00
code review
This commit is contained in:
parent
ea3f002a65
commit
20d3814c1b
7 changed files with 60 additions and 68 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// newEditEntities.js
|
// newEditEntities.js
|
||||||
// examples
|
// examples
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
var controlHeld = false;
|
var controlHeld = false;
|
||||||
var shiftHeld = false;
|
var shiftHeld = false;
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue