History

Optimized getEntityProperties

ksuprynowicz committed 3 years ago

Commit fdd8cb21 parent c18fd9017 files · +133 −96Browse files

Showing the changes to libraries/script-engine/src/ScriptValueUtils.cpp (1 of 17 files). Show all

Unified · Split

libraries/script-engine/src/ScriptValueUtils.cpp+2−2
@@ -183,7 +183,7 @@ ScriptValue vec3ToScriptValue(ScriptEngine* engine, const glm::vec3& vec3) { · 182 unmodified lines
183 auto prototype = engine->globalObject().property("__hifi_vec3__");183 auto prototype = engine->globalObject().property("__hifi_vec3__");
184 if (!prototype.hasProperty("defined") || !prototype.property("defined").toBool()) {184 if (!prototype.hasProperty("defined") || !prototype.property("defined").toBool()) {
185 prototype = engine->evaluate(185 prototype = engine->evaluate(
186 "__hifi_vec3__ = Object.defineProperties({}, { "186 "globalThis.__hifi_vec3__ = Object.defineProperties({}, { "
187 "defined: { value: true },"187 "defined: { value: true },"
188 "0: { set: function(nv) { return this.x = nv; }, get: function() { return this.x; } },"188 "0: { set: function(nv) { return this.x = nv; }, get: function() { return this.x; } },"
189 "1: { set: function(nv) { return this.y = nv; }, get: function() { return this.y; } },"189 "1: { set: function(nv) { return this.y = nv; }, get: function() { return this.y; } },"
@@ -209,7 +209,7 @@ ScriptValue vec3ColorToScriptValue(ScriptEngine* engine, const glm::vec3& vec3) · 19 unmodified lines
209 auto prototype = engine->globalObject().property("__hifi_vec3_color__");209 auto prototype = engine->globalObject().property("__hifi_vec3_color__");
210 if (!prototype.property("defined").toBool()) {210 if (!prototype.property("defined").toBool()) {
211 prototype = engine->evaluate(211 prototype = engine->evaluate(
212 "__hifi_vec3_color__ = Object.defineProperties({}, { "212 "globalThis.__hifi_vec3_color__ = Object.defineProperties({}, { "
213 "defined: { value: true },"213 "defined: { value: true },"
214 "0: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"214 "0: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"
215 "1: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"215 "1: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"