15 #ifndef hifi_EntityItemPropertiesMacros_h
16 #define hifi_EntityItemPropertiesMacros_h
18 #include <EntityItemID.h>
19 #include <EntityPropertyFlags.h>
20 #include <RegisteredMetaTypes.h>
21 #include <ScriptEngine.h>
22 #include <ScriptValue.h>
23 #include <ScriptValueUtils.h>
26 const quint64 UNKNOWN_CREATED_TIME = 0;
28 using vec3Color = glm::vec3;
29 using u8vec3Color = glm::u8vec3;
31 struct EntityPropertyInfo {
32 EntityPropertyInfo(EntityPropertyList propEnum) :
33 propertyEnums(propEnum) {}
34 EntityPropertyInfo(EntityPropertyList propEnum, QVariant min, QVariant max) :
35 propertyEnums(propEnum), minimum(min), maximum(max) {}
36 EntityPropertyInfo() =
default;
37 EntityPropertyFlags propertyEnums;
43 EntityPropertyInfo makePropertyInfo(EntityPropertyList p,
typename std::enable_if<!std::is_integral<T>::value>::type* = 0) {
44 return EntityPropertyInfo(p);
48 EntityPropertyInfo makePropertyInfo(EntityPropertyList p,
typename std::enable_if<std::is_integral<T>::value>::type* = 0) {
49 return EntityPropertyInfo(p, std::numeric_limits<T>::min(), std::numeric_limits<T>::max());
52 #define APPEND_ENTITY_PROPERTY(P,V) \
53 if (requestedProperties.getHasProperty(P)) { \
54 LevelDetails propertyLevel = packetData->startLevel(); \
55 successPropertyFits = packetData->appendValue(V); \
56 if (successPropertyFits) { \
58 propertiesDidntFit -= P; \
60 packetData->endLevel(propertyLevel); \
62 packetData->discardLevel(propertyLevel); \
63 appendState = OctreeElement::PARTIAL; \
66 propertiesDidntFit -= P; \
69 #define READ_ENTITY_PROPERTY(P,T,S) \
70 if (propertyFlags.getHasProperty(P)) { \
72 int bytes = OctreePacketData::unpackDataFromBytes(dataAt, fromBuffer); \
75 if (overwriteLocalData) { \
78 somethingChanged = true; \
81 #define SKIP_ENTITY_PROPERTY(P,T) \
82 if (propertyFlags.getHasProperty(P)) { \
84 int bytes = OctreePacketData::unpackDataFromBytes(dataAt, fromBuffer); \
89 #define DECODE_GROUP_PROPERTY_HAS_CHANGED(P,N) \
90 if (propertyFlags.getHasProperty(P)) { \
91 set##N##Changed(true); \
95 #define READ_ENTITY_PROPERTY_TO_PROPERTIES(P,T,O) \
96 if (propertyFlags.getHasProperty(P)) { \
98 int bytes = OctreePacketData::unpackDataFromBytes(dataAt, fromBuffer); \
100 processedBytes += bytes; \
101 properties.O(fromBuffer); \
104 #define SET_ENTITY_PROPERTY_FROM_PROPERTIES(P,M) \
105 if (properties._##P##Changed) { \
106 M(properties._##P); \
107 somethingChanged = true; \
110 #define SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(G,P,p,M) \
111 if (properties.get##G().p##Changed()) { \
112 M(properties.get##G().get##P()); \
113 somethingChanged = true; \
116 #define SET_ENTITY_PROPERTY_FROM_PROPERTIES_GETTER(C,G,S) \
117 if (properties.C()) { \
119 somethingChanged = true; \
122 #define COPY_ENTITY_PROPERTY_TO_PROPERTIES(P,M) \
123 properties._##P = M(); \
124 properties._##P##Changed = false;
126 #define COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(G,P,M) \
127 properties.get##G().set##P(M()); \
128 properties.get##G().set##P##Changed(false);
130 #define CHECK_PROPERTY_CHANGE(P,M) \
131 if (_##M##Changed) { \
132 changedProperties += P; \
137 inline ScriptValue vec3Color_convertScriptValue(
ScriptEngine* e,
const glm::vec3& v) {
return vec3ColorToScriptValue(e, v); }
138 inline ScriptValue convertScriptValue(
ScriptEngine* e,
const glm::u8vec3& v) {
return u8vec3ToScriptValue(e, v); }
139 inline ScriptValue u8vec3Color_convertScriptValue(
ScriptEngine* e,
const glm::u8vec3& v) {
return u8vec3ColorToScriptValue(e, v); }
150 inline ScriptValue convertScriptValue(
ScriptEngine* e,
const QVector<glm::vec3>& v) {
return qVectorVec3ToScriptValue(e, v); }
151 inline ScriptValue qVectorVec3Color_convertScriptValue(
ScriptEngine* e,
const QVector<glm::vec3>& v) {
return qVectorVec3ColorToScriptValue(e, v); }
152 inline ScriptValue convertScriptValue(
ScriptEngine* e,
const QVector<glm::quat>& v) {
return qVectorQuatToScriptValue(e, v); }
153 inline ScriptValue convertScriptValue(
ScriptEngine* e,
const QVector<bool>& v) {
return qVectorBoolToScriptValue(e, v); }
154 inline ScriptValue convertScriptValue(
ScriptEngine* e,
const QVector<float>& v) {
return qVectorFloatToScriptValue(e, v); }
155 inline ScriptValue convertScriptValue(
ScriptEngine* e,
const QVector<QUuid>& v) {
return qVectorQUuidToScriptValue(e, v); }
156 inline ScriptValue convertScriptValue(
ScriptEngine* e,
const QVector<QString>& v) {
return qVectorQStringToScriptValue(e, v); }
161 QByteArray b64 = v.toBase64();
162 return e->newValue(QString(b64));
169 inline ScriptValue convertScriptValue(
ScriptEngine* e,
const Sampler& v) {
return samplerToScriptValue(e, v); }
171 #define COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(X,G,g,P,p) \
172 if (((!returnNothingOnEmptyPropertyFlags && desiredProperties.isEmpty()) || desiredProperties.getHasProperty(X)) && \
173 (!skipDefaults || defaultEntityProperties.get##G().get##P() != get##P())) { \
174 ScriptValue groupProperties = properties.property(#g); \
175 if (!groupProperties.isValid()) { \
176 groupProperties = engine->newObject(); \
178 ScriptValue V = convertScriptValue(engine, get##P()); \
179 groupProperties.setProperty(#p, V); \
180 properties.setProperty(#g, groupProperties); \
183 #define COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(X,G,g,P,p,T) \
184 if (((!returnNothingOnEmptyPropertyFlags && desiredProperties.isEmpty()) || desiredProperties.getHasProperty(X)) && \
185 (!skipDefaults || defaultEntityProperties.get##G().get##P() != get##P())) { \
186 ScriptValue groupProperties = properties.property(#g); \
187 if (!groupProperties.isValid()) { \
188 groupProperties = engine->newObject(); \
190 ScriptValue V = T##_convertScriptValue(engine, get##P()); \
191 groupProperties.setProperty(#p, V); \
192 properties.setProperty(#g, groupProperties); \
195 #define COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_GETTER(X,G,g,P,p,M) \
196 if (((!returnNothingOnEmptyPropertyFlags && desiredProperties.isEmpty()) || desiredProperties.getHasProperty(X)) && \
197 (!skipDefaults || defaultEntityProperties.get##G().get##P() != get##P())) { \
198 ScriptValue groupProperties = properties.property(#g); \
199 if (!groupProperties.isValid()) { \
200 groupProperties = engine->newObject(); \
202 ScriptValue V = convertScriptValue(engine, M()); \
203 groupProperties.setProperty(#p, V); \
204 properties.setProperty(#g, groupProperties); \
207 #define COPY_PROPERTY_TO_QSCRIPTVALUE(p,P) \
208 if (((!returnNothingOnEmptyPropertyFlags && _desiredProperties.isEmpty()) || _desiredProperties.getHasProperty(p)) && \
209 (!skipDefaults || defaultEntityProperties._##P != _##P)) { \
210 ScriptValue V = convertScriptValue(engine, _##P); \
211 properties.setProperty(#P, V); \
214 #define COPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(p,P,T) \
215 if (((!returnNothingOnEmptyPropertyFlags && _desiredProperties.isEmpty()) || _desiredProperties.getHasProperty(p)) && \
216 (!skipDefaults || defaultEntityProperties._##P != _##P)) { \
217 ScriptValue V = T##_convertScriptValue(engine, _##P); \
218 properties.setProperty(#P, V); \
221 #define COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(P, G) \
222 properties.setProperty(#P, G);
224 #define COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(p, P, G) \
225 if (((!returnNothingOnEmptyPropertyFlags && _desiredProperties.isEmpty()) || _desiredProperties.getHasProperty(p)) && \
226 (!skipDefaults || defaultEntityProperties._##P != _##P)) { \
227 ScriptValue V = convertScriptValue(engine, G); \
228 properties.setProperty(#P, V); \
231 #define COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_TYPED(p, P, G, T) \
232 if ((_desiredProperties.isEmpty() || _desiredProperties.getHasProperty(p)) && \
233 (!skipDefaults || defaultEntityProperties._##P != _##P)) { \
234 ScriptValue V = T##_convertScriptValue(engine, G()); \
235 properties.setProperty(#P, V); \
239 #define COPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(p, P, X, G) \
240 if (((!returnNothingOnEmptyPropertyFlags && _desiredProperties.isEmpty()) || _desiredProperties.getHasProperty(p)) && \
241 (!skipDefaults || defaultEntityProperties._##P != _##P)) { \
242 ScriptValue V = convertScriptValue(engine, G()); \
243 properties.setProperty(#X, V); \
246 #define COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(P, G) \
247 if (!skipDefaults || defaultEntityProperties._##P != _##P) { \
248 ScriptValue V = convertScriptValue(engine, G); \
249 properties.setProperty(#P, V); \
252 #define COPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(p, P) \
253 if (((!returnNothingOnEmptyPropertyFlags && _desiredProperties.isEmpty()) || _desiredProperties.getHasProperty(p)) && \
254 (!skipDefaults || defaultEntityProperties._##P != _##P)) { \
255 if (isMyOwnAvatarEntity || nodeList->getThisNodeCanViewAssetURLs()) { \
256 ScriptValue V = convertScriptValue(engine, _##P); \
257 properties.setProperty(#P, V); \
259 const QString emptyURL = ""; \
260 ScriptValue V = convertScriptValue(engine, emptyURL); \
261 properties.setProperty(#P, V); \
265 #define COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(X, G, g, P, p) \
266 if (((!returnNothingOnEmptyPropertyFlags && desiredProperties.isEmpty()) || desiredProperties.getHasProperty(X)) && \
267 (!skipDefaults || defaultEntityProperties.get##G().get##P() != get##P())) { \
268 if (isMyOwnAvatarEntity || nodeList->getThisNodeCanViewAssetURLs()) { \
269 ScriptValue groupProperties = properties.property(#g); \
270 if (!groupProperties.isValid()) { \
271 groupProperties = engine->newObject(); \
273 ScriptValue V = convertScriptValue(engine, get##P()); \
274 groupProperties.setProperty(#p, V); \
275 properties.setProperty(#g, groupProperties); \
277 const QString emptyURL = ""; \
278 ScriptValue V = convertScriptValue(engine, emptyURL); \
279 properties.setProperty(#P, V); \
283 typedef QVector<glm::vec3> qVectorVec3;
284 typedef QVector<glm::quat> qVectorQuat;
285 typedef QVector<bool> qVectorBool;
286 typedef QVector<float> qVectorFloat;
287 typedef QVector<QUuid> qVectorQUuid;
288 typedef QVector<QString> qVectorQString;
289 typedef QSet<QString> qSetQString;
290 inline float float_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
return v.toVariant().toFloat(&isValid); }
291 inline quint64 quint64_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
return v.toVariant().toULongLong(&isValid); }
292 inline quint32 quint32_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
294 return v.toString().toUInt(&isValid);
296 inline quint16 quint16_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
return v.toVariant().toInt(&isValid); }
297 inline uint16_t uint16_t_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
return v.toVariant().toInt(&isValid); }
298 inline uint32_t uint32_t_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
return v.toVariant().toInt(&isValid); }
299 inline int int_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
return v.toVariant().toInt(&isValid); }
300 inline bool bool_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) { isValid =
true;
return v.toVariant().toBool(); }
301 inline uint8_t uint8_t_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) { isValid =
true;
return (uint8_t)(0xff & v.toVariant().toInt(&isValid)); }
302 inline QString QString_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) { isValid =
true;
return v.toVariant().toString().trimmed(); }
303 inline QUuid QUuid_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) { isValid =
true;
return v.toVariant().toUuid(); }
304 inline EntityItemID EntityItemID_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) { isValid =
true;
return v.toVariant().toUuid(); }
306 inline QByteArray QByteArray_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
308 QString b64 = v.toVariant().toString().trimmed();
309 return QByteArray::fromBase64(b64.toUtf8());
312 inline glm::vec2 vec2_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
315 vec2FromScriptValue(v, vec2);
319 inline glm::vec3 vec3_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
322 vec3FromScriptValue(v, vec3);
326 inline glm::vec3 vec3Color_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
329 vec3FromScriptValue(v, vec3);
333 inline glm::u8vec3 u8vec3Color_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
336 u8vec3FromScriptValue(v, vec3);
340 inline AACube AACube_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
343 aaCubeFromScriptValue(v, result);
347 inline qVectorFloat qVectorFloat_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
349 return qVectorFloatFromScriptValue(v);
352 inline qVectorVec3 qVectorVec3_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
354 return qVectorVec3FromScriptValue(v);
357 inline qVectorQuat qVectorQuat_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
359 return qVectorQuatFromScriptValue(v);
362 inline qVectorBool qVectorBool_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
364 return qVectorBoolFromScriptValue(v);
367 inline qVectorQUuid qVectorQUuid_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
369 return qVectorQUuidFromScriptValue(v);
372 inline qVectorQString qVectorQString_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
374 return qVectorQStringFromScriptValue(v);
377 inline glm::quat quat_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
383 if (x.isValid() && y.isValid() && z.isValid() && w.isValid()) {
385 newValue.x = x.toVariant().toFloat();
386 newValue.y = y.toVariant().toFloat();
387 newValue.z = z.toVariant().toFloat();
388 newValue.w = w.toVariant().toFloat();
389 isValid = !glm::isnan(newValue.x) &&
390 !glm::isnan(newValue.y) &&
391 !glm::isnan(newValue.z) &&
392 !glm::isnan(newValue.w);
400 inline QRect QRect_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
403 qRectFromScriptValue(v, rect);
407 inline Sampler Sampler_convertFromScriptValue(
const ScriptValue& v,
bool& isValid) {
410 samplerFromScriptValue(v, sampler);
414 #define COPY_PROPERTY_IF_CHANGED(P) \
416 if (other._##P##Changed) { \
421 #define COPY_PROPERTY_FROM_QSCRIPTVALUE(P, T, S) \
423 if (namesSet.contains(#P)) { \
424 ScriptValue V = object.property(#P); \
426 bool isValid = false; \
427 T newValue = T##_convertFromScriptValue(V, isValid); \
428 if (isValid && (_defaultSettings || newValue != _##P)) { \
435 #define COPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(P, T, S, G) \
437 if (namesSet.contains(#P)) { \
438 ScriptValue V = object.property(#P); \
440 bool isValid = false; \
441 T newValue = T##_convertFromScriptValue(V, isValid); \
442 if (isValid && (_defaultSettings || newValue != G())) { \
449 #define COPY_PROPERTY_FROM_QSCRIPTVALUE_NOCHECK(P, T, S) \
451 if (namesSet.contains(#P)) { \
452 ScriptValue V = object.property(#P); \
454 bool isValid = false; \
455 T newValue = T##_convertFromScriptValue(V, isValid); \
456 if (isValid && (_defaultSettings)) { \
463 #define COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(G, P, T, S) \
465 if (namesSet.contains(#G)) { \
466 ScriptValue G = object.property(#G); \
468 ScriptValue V = G.property(#P); \
470 bool isValid = false; \
471 T newValue = T##_convertFromScriptValue(V, isValid); \
472 if (isValid && (_defaultSettings || newValue != _##P)) { \
480 #define COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(P, S) \
482 if (namesSet.contains(#P)) { \
483 ScriptValue P = object.property(#P); \
485 QString newValue = P.toVariant().toString(); \
486 if (_defaultSettings || newValue != get##S##AsString()) { \
487 set##S##FromString(newValue); \
493 #define COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE_ENUM(G, P, S) \
495 if (namesSet.contains(#G)) { \
496 ScriptValue G = object.property(#G); \
498 ScriptValue P = G.property(#P); \
500 QString newValue = P.toVariant().toString(); \
501 if (_defaultSettings || newValue != get##S##AsString()) { \
502 set##S##FromString(newValue); \
509 #define DEFINE_PROPERTY_GROUP(N, n, T) \
511 const T& get##N() const { return _##n; } \
512 T& get##N() { return _##n; } \
518 #define ADD_PROPERTY_TO_MAP(P, n, T) \
520 EntityPropertyInfo propertyInfo { makePropertyInfo<T>(P) }; \
521 _propertyInfos[#n] = propertyInfo; \
522 _enumsToPropertyStrings[P] = #n; \
525 #define ADD_PROPERTY_TO_MAP_WITH_RANGE(P, n, M, X) \
527 EntityPropertyInfo propertyInfo = EntityPropertyInfo(P, M, X); \
528 _propertyInfos[#n] = propertyInfo; \
529 _enumsToPropertyStrings[P] = #n; \
532 #define ADD_GROUP_PROPERTY_TO_MAP(P, g, n) \
534 EntityPropertyInfo propertyInfo = EntityPropertyInfo(P); \
535 _propertyInfos[#g "." #n] = propertyInfo; \
536 _propertyInfos[#g].propertyEnums << P; \
537 _enumsToPropertyStrings[P] = #g "." #n; \
540 #define ADD_GROUP_PROPERTY_TO_MAP_WITH_RANGE(P, g, n, M, X) \
542 EntityPropertyInfo propertyInfo = EntityPropertyInfo(P, M, X); \
543 _propertyInfos[#g "." #n] = propertyInfo; \
544 _propertyInfos[#g].propertyEnums << P; \
545 _enumsToPropertyStrings[P] = #g "." #n; \
548 #define DEFINE_CORE(N, n, T, V) \
550 bool n##Changed() const { return _##n##Changed; } \
551 void set##N##Changed(bool value) { _##n##Changed = value; } \
554 bool _##n##Changed { false };
556 #define DEFINE_PROPERTY(N, n, T, V) \
558 T get##N() const { return _##n; } \
559 void set##N(T value) { _##n = value; _##n##Changed = true; } \
560 DEFINE_CORE(N, n, T, V)
562 #define DEFINE_PROPERTY_REF(N, n, T, V) \
564 const T& get##N() const { return _##n; } \
565 void set##N(const T& value) { _##n = value; _##n##Changed = true; } \
566 DEFINE_CORE(N, n, T, V)
568 #define DEFINE_PROPERTY_REF_WITH_SETTER(N, n, T, V) \
570 const T& get##N() const { return _##n; } \
571 void set##N(const T& value); \
572 DEFINE_CORE(N, n, T, V)
574 #define DEFINE_PROPERTY_REF_WITH_SETTER_AND_GETTER(N, n, T, V) \
577 void set##N(const T& value); \
578 DEFINE_CORE(N, n, T, V)
580 #define DEFINE_PROPERTY_REF_ENUM(N, n, T, V) \
582 const T& get##N() const { return _##n; } \
583 void set##N(const T& value) { _##n = value; _##n##Changed = true; } \
584 QString get##N##AsString() const; \
585 void set##N##FromString(const QString& name); \
586 DEFINE_CORE(N, n, T, V)
588 #define DEBUG_PROPERTY(D, P, N, n, x) \
589 D << " " << #n << ":" << P.get##N() << x << "[changed:" << P.n##Changed() << "]\n";
591 #define DEBUG_PROPERTY_IF_CHANGED(D, P, N, n, x) \
592 if (P.n##Changed()) { \
593 D << " " << #n << ":" << P.get##N() << x << "\n"; \
597 #define DEFINE_VARIABLE_NO_GETTER_SETTER(N, n, T, V) \
601 #define DEFINE_VARIABLE(N, n, T, V) \
604 void set##N(T value); \
608 #define DEFINE_VARIABLE_REF(N, n, T, V) \
611 void set##N(const T& value); \
615 #define DEFINE_VARIABLE_BASIC(N, n, T, V) \
618 return resultWithReadLock<T>([&] { \
622 void set##N(T value) { \
623 withWriteLock([&] { \
630 #define DEFINE_VARIABLE_BASIC_REF(N, n, T, V) \
633 return resultWithReadLock<T>([&] { \
637 void set##N(const T& value) { \
638 withWriteLock([&] { \
645 #define DEFINE_VARIABLE_RENDER(N, n, T, V) \
648 return resultWithReadLock<T>([&] { \
652 void set##N(T value) { \
653 withWriteLock([&] { \
654 _needsRenderUpdate |= _##n != value; \
661 #define DEFINE_VARIABLE_RENDER_REF(N, n, T, V) \
664 return resultWithReadLock<T>([&] { \
668 void set##N(const T& value) { \
669 withWriteLock([&] { \
670 _needsRenderUpdate |= _##n != value; \
677 #define ENTITY_PROPERTY_SUBCLASS_METHODS \
678 EntityItemProperties getProperties(const EntityPropertyFlags& desiredProperties, \
679 bool allowEmptyDesiredProperties) const override; \
680 bool setSubClassProperties(const EntityItemProperties& properties) override; \
681 EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override; \
682 void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, \
683 EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData, \
684 EntityPropertyFlags& requestedProperties, \
685 EntityPropertyFlags& propertyFlags, \
686 EntityPropertyFlags& propertiesDidntFit, \
687 int& propertyCount, \
688 OctreeElement::AppendState& appendState) const override; \
689 int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, \
690 ReadBitstreamToTreeParams& args, \
691 EntityPropertyFlags& propertyFlags, bool overwriteLocalData, \
692 bool& somethingChanged) override; \
693 virtual void debugDump() const override;
695 #define ENTITY_PROPERTY_GROUP_METHODS(P) \
696 virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties, \
697 ScriptEngine* engine, bool skipDefaults, \
698 EntityItemProperties& defaultEntityProperties, \
699 bool returnNothingOnEmptyPropertyFlags, \
700 bool isMyOwnAvatarEntity) const override; \
701 virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, \
702 bool& _defaultSettings) override; \
703 void merge(const P& other); \
704 virtual void debugDump() const override; \
705 virtual void listChangedProperties(QList<QString>& out) override; \
706 virtual bool appendToEditPacket(OctreePacketData* packetData, \
707 EntityPropertyFlags& requestedProperties, \
708 EntityPropertyFlags& propertyFlags, \
709 EntityPropertyFlags& propertiesDidntFit, \
710 int& propertyCount, \
711 OctreeElement::AppendState& appendState) const override; \
712 virtual bool decodeFromEditPacket(EntityPropertyFlags& propertyFlags, \
713 const unsigned char*& dataAt, int& processedBytes) override; \
714 virtual void markAllChanged() override; \
715 virtual EntityPropertyFlags getChangedProperties() const override; \
716 virtual void getProperties(EntityItemProperties& propertiesOut) const override; \
717 virtual bool setProperties(const EntityItemProperties& properties) override; \
718 virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override; \
719 virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, \
720 ReadBitstreamToTreeParams& args, \
721 EntityPropertyFlags& propertyFlags, \
722 bool overwriteLocalData, bool& somethingChanged) override; \
723 static void addPropertyMap(QHash<QString, EntityPropertyInfo>& _propertyInfos, \
724 QHash<EntityPropertyList, QString>& _enumsToPropertyStrings);
Abstract ID for editing model items. Used in EntityItem JS API.
Definition: EntityItemID.h:28
Provides an engine-independent interface for a scripting engine.
Definition: ScriptEngine.h:93
[ScriptInterface] Provides an engine-independent interface for QScriptValue
Definition: ScriptValue.h:40