fix api url object loading, add engine workspace export

This commit is contained in:
Stewart Allen 2026-01-25 11:44:11 -05:00
commit bfc54463b9
4 changed files with 12 additions and 8 deletions

View file

@ -526,7 +526,7 @@ function settingsExport(opts = {}) {
const shot = opts.work || opts.screen ? space.screenshot() : undefined;
const work = opts.work ? codec.encode(widgets,{_json_:true}) : undefined;
const view = opts.work ? space.view.save() : undefined;
const setn = Object.clone(settings);
const setn = Object.clone(opts.engine ?? settings);
// stuff in legacy annotations for re-import
for (let w of widgets) {
setn.widget[w.id] = w.anno;
@ -539,7 +539,7 @@ function settingsExport(opts = {}) {
note: note,
work: work,
view: view,
moto: moto.id,
moto: self.moto?.id,
init: local.getItem('kiri-init'),
time: Date.now()
};

View file

@ -6,6 +6,7 @@ import { api } from './api.js';
import { MODES } from './consts.js';
import { colorSchemeRegistry } from './color/schemes.js';
import { load as file_load } from '../../load/file.js';
import { load_url as url_load } from '../../load/url.js';
import { newBounds } from '../../geo/bounds.js';
import { Packer } from './pack.js';
import { space } from '../../moto/space.js';
@ -491,7 +492,7 @@ function load_stl(url, onload, formdata, credentials, headers) {
*/
function load_url(url, options = {}) {
platform.group();
file_load.URL.load(url, options).then(objects => {
url_load(url, options).then(objects => {
let widgets = [];
for (let object of objects) {
let widget = newWidget(undefined, options.group).loadVertices(object.mesh);

View file

@ -19,7 +19,8 @@ class Engine {
filter: { FDM: "internal" },
device: conf.defaults.fdm.d, // device profile
process: conf.defaults.fdm.p, // slicing settings
widget: { [this.widget.id]: {} }
widget: { [this.widget.id]: {} },
time: Date.now()
};
this.listener = () => { };
try {
@ -51,6 +52,10 @@ class Engine {
api.platform.clear();
}
workspace() {
return api.settings.export({ engine: this.settings });
}
parse(data) {
return new Promise((accept, reject) => {
try {

View file

@ -2,11 +2,9 @@
'use strict';
import { STL } from './stl.js';
import { OBJ } from './obj.js';
import { TMF } from './3mf.js';
import { SVG } from './svg.js';
import { load_file } from './file.js';
const { STL, OBJ, TMF, SVG } = load_file;
const CDH = 'Content-Disposition';
export function load_url(url, options = {}) {