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
183183 auto prototype = engine->globalObject().property("__hifi_vec3__");
184184 if (!prototype.hasProperty("defined") || !prototype.property("defined").toBool()) {
185185 prototype = engine->evaluate(
186− "__hifi_vec3__ = Object.defineProperties({}, { "
186+ "globalThis.__hifi_vec3__ = Object.defineProperties({}, { "
187187 "defined: { value: true },"
188188 "0: { set: function(nv) { return this.x = nv; }, get: function() { return this.x; } },"
189189 "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
209209 auto prototype = engine->globalObject().property("__hifi_vec3_color__");
210210 if (!prototype.property("defined").toBool()) {
211211 prototype = engine->evaluate(
212− "__hifi_vec3_color__ = Object.defineProperties({}, { "
212+ "globalThis.__hifi_vec3_color__ = Object.defineProperties({}, { "
213213 "defined: { value: true },"
214214 "0: { set: function(nv) { return this.red = nv; }, get: function() { return this.red; } },"
215215 "1: { set: function(nv) { return this.green = nv; }, get: function() { return this.green; } },"