diff --git a/deps/flecs.c b/deps/flecs.c index bc3efe3..f7331b3 100644 --- a/deps/flecs.c +++ b/deps/flecs.c @@ -20357,7 +20357,7 @@ int ecs_app_run( } /* Monitoring periodically collects statistics */ - if (desc->enable_monitor) { + if (desc->enable_stats) { #ifdef FLECS_STATS ECS_IMPORT(world, FlecsStats); #else diff --git a/deps/flecs.h b/deps/flecs.h index 57fb0ba..156bf8c 100644 --- a/deps/flecs.h +++ b/deps/flecs.h @@ -10729,7 +10729,7 @@ typedef struct ecs_app_desc_t { int32_t threads; /**< Number of threads. */ int32_t frames; /**< Number of frames to run (0 for infinite) */ bool enable_rest; /**< Enables ECS access over HTTP, necessary for explorer */ - bool enable_monitor; /**< Periodically collect statistics */ + bool enable_stats; /**< Periodically collect statistics */ uint16_t port; /**< HTTP port used by REST API */ ecs_app_init_action_t init; /**< If set, function is ran before starting the @@ -19333,8 +19333,8 @@ struct app_builder { return *this; } - app_builder& enable_monitor(bool value = true) { - desc_.enable_monitor = value; + app_builder& enable_stats(bool value = true) { + desc_.enable_stats = value; return *this; } diff --git a/etc/v4/flecs.js b/etc/v4/flecs.js index 23dfa28..63ec578 100644 --- a/etc/v4/flecs.js +++ b/etc/v4/flecs.js @@ -235,7 +235,7 @@ const flecs = { query = flecs.trimQuery(query); query = query.replaceAll(", ", ","); - params.q = encodeURIComponent(query); + params.expr = encodeURIComponent(query); return this._.requestQuery( this, params, recv, err, abort, params.poll_interval_ms); }, @@ -248,14 +248,14 @@ const flecs = { }, // Set component - set: function(path, component, data) { + set: function(path, component, value) { path = this._.escapePath(path); - if (typeof data == "object") { - data = JSON.stringify(data); - data = encodeURIComponent(data); + if (typeof value == "object") { + value = JSON.stringify(value); + value = encodeURIComponent(value); } return this._.request(this, "PUT", "component/" + path, - {component: component, data: data}); + {component: component, value: value}); }, // Get component @@ -274,33 +274,38 @@ const flecs = { // Add component add: function(path, component) { path = this._.escapePath(path); - return this._.request(this, "PUT", "add/" + path, + return this._.request(this, "PUT", "component/" + path, {component: component}); }, // Remove component remove: function(path, component) { path = this._.escapePath(path); - return this._.request(this, "PUT", "remove/" + path, + return this._.request(this, "DELETE", "component/" + path, {component: component}); }, - // Enable entity - enable: function(path) { + // Enable entity/component + enable: function(path, component) { path = this._.escapePath(path); - return this._.request(this, "PUT", "enable/" + path, {}); + return this._.request(this, "PUT", "toggle/" + path, { + enable: true, component: component + + }); }, - // Disable entity - disable: function(path) { + // Disable entity/component + disable: function(path, component) { path = this._.escapePath(path); - return this._.request(this, "PUT", "disable/" + path, {}); + return this._.request(this, "PUT", "toggle/" + path, { + enable: false, component: component + }); }, // Delete entity delete: function(path) { path = this._.escapePath(path); - return this._.request(this, "PUT", "delete/" + path, {}); + return this._.request(this, "DELETE", "entity/" + path, {}); }, // Update script code diff --git a/etc/v4/js/components/code-editor.vue b/etc/v4/js/components/code-editor.vue index a74e7b5..c336cea 100644 --- a/etc/v4/js/components/code-editor.vue +++ b/etc/v4/js/components/code-editor.vue @@ -176,6 +176,7 @@ onMounted(() => { editor = ace.edit("editor"); editor.setValue(value.value); editor.setOption("highlightActiveLine", false); + editor.setOption("tabSize", 2); editor.setTheme("ace/theme/flecs-script"); editor.session.setMode("ace/mode/flecs-query"); diff --git a/etc/v4/js/components/pages/entities/flecs-script.vue b/etc/v4/js/components/pages/entities/flecs-script.vue index b69b387..24584c2 100644 --- a/etc/v4/js/components/pages/entities/flecs-script.vue +++ b/etc/v4/js/components/pages/entities/flecs-script.vue @@ -57,6 +57,8 @@ function onScriptChange(editorObj) { onMounted(() => { editorObj = ace.edit("editor"); editorObj.setOption("highlightActiveLine", false); + editorObj.setOption("tabSize", 2); + editorObj.setBehavioursEnabled(true); editorObj.setTheme("ace/theme/flecs-script"); editorObj.session.setMode("ace/mode/flecs-script"); diff --git a/etc/v4/js/components/pages/queries/query-browser.vue b/etc/v4/js/components/pages/queries/query-browser.vue index 89903b6..328dcef 100644 --- a/etc/v4/js/components/pages/queries/query-browser.vue +++ b/etc/v4/js/components/pages/queries/query-browser.vue @@ -139,7 +139,7 @@ const css = computed(() => { const itemIcon = (item) => { if (item.observer) { return "bell"; - } else if (item.is_set[1]) { + } else if (!item.fields.is_set || item.fields.is_set[1]) { return "code"; } else { return "search"; @@ -150,7 +150,7 @@ const queryKind = (item) => { if (item.observer) { return "observer"; } else { - let isSystem = item.is_set[1]; + let isSystem = !item.fields.is_set || item.fields.is_set[1]; if (isSystem) { return "system"; } diff --git a/etc/v4/js/components/pages/queries/query-cpp.vue b/etc/v4/js/components/pages/queries/query-cpp.vue index 616dad1..596db74 100644 --- a/etc/v4/js/components/pages/queries/query-cpp.vue +++ b/etc/v4/js/components/pages/queries/query-cpp.vue @@ -40,7 +40,7 @@ const defaultSrc = (term) => { } const isTemplateArg = (term) => { - if (!term.has_data) { + if (!term.has_value) { return false; } if (!term.first) { diff --git a/etc/v4/js/components/pages/queries/query-expr.vue b/etc/v4/js/components/pages/queries/query-expr.vue index 88f13ad..1fe23d4 100644 --- a/etc/v4/js/components/pages/queries/query-expr.vue +++ b/etc/v4/js/components/pages/queries/query-expr.vue @@ -110,7 +110,7 @@ const skipInout = (term) => { return true; } - if ((!term.has_data && term.inout == "none")) { + if ((!term.has_value && term.inout == "none")) { return true; } diff --git a/etc/v4/js/components/pages/queries/query-list-item.vue b/etc/v4/js/components/pages/queries/query-list-item.vue index dc5b4c3..72f04f2 100644 --- a/etc/v4/js/components/pages/queries/query-list-item.vue +++ b/etc/v4/js/components/pages/queries/query-list-item.vue @@ -46,19 +46,19 @@ const docKey = "(Description,Brief)"; // (ChildOf, scope), $this ~= expr, ... const isScopedQuery = computed(() => { - return props.prop.is_set.length == 6; + return props.prop.fields.is_set.length == 6; }) const isComponent = computed(() => { - return isScopedQuery.value ? props.prop.is_set[3] : props.prop.is_set[2]; + return isScopedQuery.value ? props.prop.fields.is_set[3] : props.prop.fields.is_set[2]; }); const isRelationship = computed(() => { - return isScopedQuery.value ? props.prop.is_set[4] : props.prop.is_set[3]; + return isScopedQuery.value ? props.prop.fields.is_set[4] : props.prop.fields.is_set[3]; }); const isModule = computed(() => { - return isScopedQuery.value ? props.prop.is_set[5] : props.prop.is_set[4]; + return isScopedQuery.value ? props.prop.fields.is_set[5] : props.prop.fields.is_set[4]; }); const description = computed(() => { diff --git a/etc/v4/js/components/prop-browser.vue b/etc/v4/js/components/prop-browser.vue index 24b2533..677b643 100644 --- a/etc/v4/js/components/prop-browser.vue +++ b/etc/v4/js/components/prop-browser.vue @@ -43,9 +43,9 @@ watch(() => props.first, () => { props.conn.query(query, {try: true, rows: true, limit: 1}, (reply) => { if (reply.results) { let result = reply.results[0]; - if (result.is_set && result.is_set[1]) { + if (!result.fields.is_set || result.fields.is_set[1]) { oneof.value = result.vars.parent; - } else if (result.is_set[0]) { + } else if (!result.fields.is_set || result.fields.is_set[0]) { oneof.value = props.first; } } else { diff --git a/etc/v4/js/components/widgets/table/entity-table.vue b/etc/v4/js/components/widgets/table/entity-table.vue index be73dfc..ad4cffd 100644 --- a/etc/v4/js/components/widgets/table/entity-table.vue +++ b/etc/v4/js/components/widgets/table/entity-table.vue @@ -124,8 +124,8 @@ const tableHeaders = computed(() => { schema: field.schema, index: index++, get: (result) => { - if (!result.is_set || result.is_set[i]) { - return result.fields[i].data; + if (!result.fields.is_set || result.fields.is_set[i]) { + return result.fields.values[i]; } else { return undefined; } diff --git a/etc/v4/js/components/widgets/tree/entity-subtree.vue b/etc/v4/js/components/widgets/tree/entity-subtree.vue index f29485b..1362a6a 100644 --- a/etc/v4/js/components/widgets/tree/entity-subtree.vue +++ b/etc/v4/js/components/widgets/tree/entity-subtree.vue @@ -121,14 +121,14 @@ function updateQuery() { Object.assign(treeItem, item); treeItem.path = path; - treeItem.isModule = item.is_set[0]; - treeItem.isComponent = item.is_set[1] || item.is_set[2] || item.is_set[3]; - treeItem.isTarget = item.is_set[4]; - treeItem.isQuery = item.is_set[5]; - treeItem.isPrefab = item.is_set[6]; - treeItem.isDisabled = item.is_set[7]; - treeItem.isParent = item.is_set[8]; - treeItem.baseEntity = item.is_set[9] ? item.vars["base"] : undefined; + treeItem.isModule = item.fields.is_set[0]; + treeItem.isComponent = item.fields.is_set[1] || item.fields.is_set[2] || item.fields.is_set[3]; + treeItem.isTarget = item.fields.is_set[4]; + treeItem.isQuery = item.fields.is_set[5]; + treeItem.isPrefab = item.fields.is_set[6]; + treeItem.isDisabled = item.fields.is_set[7]; + treeItem.isParent = item.fields.is_set[8]; + treeItem.baseEntity = item.fields.is_set[9] ? item.vars["base"] : undefined; if (item.doc) { treeItem.label = item.doc.label;