Merge branch 'master' of https://github.com/highfidelity/hifi into temp0

This commit is contained in:
Sam Gateau 2014-10-29 11:06:37 -07:00
commit 6cb1cbdee9
3 changed files with 12 additions and 23 deletions

View file

@ -99,26 +99,17 @@ EntityItemProperties::EntityItemProperties() :
_cutoffChanged(false),
_defaultSettings(true),
_sittingPoints(NULL),
_naturalDimensions(1.0f, 1.0f, 1.0f)
{
}
EntityItemProperties::~EntityItemProperties() {
if (_sittingPoints) {
delete _sittingPoints;
_sittingPoints = NULL;
}
}
void EntityItemProperties::setSittingPoints(const QVector<SittingPoint>& sittingPoints) {
if (!_sittingPoints) {
_sittingPoints = new QVector<SittingPoint>;
}
_sittingPoints->clear();
_sittingPoints.clear();
foreach (SittingPoint sitPoint, sittingPoints) {
_sittingPoints->append(sitPoint);
_sittingPoints.append(sitPoint);
}
}
@ -222,18 +213,14 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons
// Sitting properties support
QScriptValue sittingPoints = engine->newObject();
if (_sittingPoints) {
for (int i = 0; i < _sittingPoints->size(); ++i) {
QScriptValue sittingPoint = engine->newObject();
sittingPoint.setProperty("name", _sittingPoints->at(i).name);
sittingPoint.setProperty("position", vec3toScriptValue(engine, _sittingPoints->at(i).position));
sittingPoint.setProperty("rotation", quatToScriptValue(engine, _sittingPoints->at(i).rotation));
sittingPoints.setProperty(i, sittingPoint);
}
sittingPoints.setProperty("length", _sittingPoints->size());
} else {
sittingPoints.setProperty("length", 0);
for (int i = 0; i < _sittingPoints.size(); ++i) {
QScriptValue sittingPoint = engine->newObject();
sittingPoint.setProperty("name", _sittingPoints.at(i).name);
sittingPoint.setProperty("position", vec3toScriptValue(engine, _sittingPoints.at(i).position));
sittingPoint.setProperty("rotation", quatToScriptValue(engine, _sittingPoints.at(i).rotation));
sittingPoints.setProperty(i, sittingPoint);
}
sittingPoints.setProperty("length", _sittingPoints.size());
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(sittingPoints, sittingPoints); // gettable, but not settable
AABox aaBox = getAABoxInMeters();

View file

@ -362,7 +362,7 @@ private:
// NOTE: The following are pseudo client only properties. They are only used in clients which can access
// properties of model geometry. But these properties are not serialized like other properties.
QVector<SittingPoint>* _sittingPoints;
QVector<SittingPoint> _sittingPoints;
glm::vec3 _naturalDimensions;
};
Q_DECLARE_METATYPE(EntityItemProperties);

View file

@ -17,6 +17,8 @@
#define getpid _getpid
#define getppid _getpid // hack to build
#define pid_t int // hack to build
#else
#include <unistd.h> // for getpid() on linux
#endif
#include <qdebug.h>