add widget metadata display

This commit is contained in:
Stewart Allen 2020-11-25 09:10:00 -05:00
commit 4d174169fe
5 changed files with 56 additions and 16 deletions

View file

@ -11,13 +11,14 @@
* drag knife support
* all
* 2d image to 3d part
* memory optimization (worker and client proactive cleanup)
* circular fit/layout when no-layout to prevent collisions
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix
* `F` 2D image import
* `F` detect and report slow framerates
* `F` implement an in-app bug reporting system
* `F` right click / context menu (object deletion, etc)
* `P` improve decimation speed by avoiding in/out of Point?
* `P` duplicate objects should share same slice data unless rotated or scaled
* `P` worker state cache cleanup and organization
@ -25,16 +26,16 @@
# FDM
* `B` sparse infill should follow polys between intersect points
* `B` expand > 0 producing artifacts with manual supports
* `B` fix adaptive slicing with multi-extruder
* `B` fix supports with grouped parts
* `B` sparse infill should follow polys between intersect points
* `B` multi-extruder rendering of raft fails to offset the rest of the print
* `B` multi-extruder purge blocks fail to generate properly for rafts
* `F` control layer start position
* `F` redo auto supports to use poly faces rather than deltas
* `F` control for size of purge block (with 0=disabled)
* `F` add separate fill speed control
* `F` manual support addition / control
* `F` control layer start position
* `F` polishing and other non-planar work
* `F` gradient infill https://www.youtube.com/watch?v=hq53gsYREHU&feature=emb_logo
* `F` feather sharp tips by reducing extrusion in area of overlap

View file

@ -67,6 +67,7 @@
const feature = {
seed: true,
meta: true, // show selected widget metadata
controls: true, // show or not side menus
drop_group: undefined, // optional array to group multi drop
drop_layout: true, // layout on new drop
@ -1154,10 +1155,27 @@
let selcount = platform.selected_count();
let extruders = settings.device.extruders;
let menu_show = selcount ? 'flex': '';
$('winfo').style.display = 'none';
if (selcount) {
UI.scale.classList.add('lt-enabled');
UI.rotate.classList.add('lt-enabled');
UI.nozzle.classList.add('lt-enabled');
if (feature.meta && selcount === 1) {
let sel = selection.widgets()[0];
let name = sel.meta.file || sel.meta.url;
if (name) {
name = name
.toLowerCase()
.replace(/_/g,' ')
.replace(/.stl/,'');
let sp = name.indexOf('/');
if (sp >= 0) {
name = name.substring(sp + 1);
}
$('winfo').style.display = 'flex';
$('winfo').innerHTML = `${sel.meta.vertices}<br>${name}`;
}
}
} else {
UI.scale.classList.remove('lt-enabled');
UI.rotate.classList.remove('lt-enabled');
@ -1210,6 +1228,7 @@
ajax(url, function(vertices) {
vertices = js2o(vertices).toFloat32();
let widget = newWidget().loadVertices(vertices);
widget.meta.url = url;
platform.add(widget);
if (onload) onload(vertices, widget);
});
@ -1220,7 +1239,7 @@
new MOTO.STL().load(url, function(vertices, filename) {
if (vertices) {
let widget = newWidget().loadVertices(vertices);
widget.filename = filename;
widget.meta.file = filename;
platform.add(widget);
if (onload) {
onload(vertices, widget);

View file

@ -113,7 +113,7 @@
}
// rotation stack (for undo)
this.roto = [];
// added meshes
// added meshes (supports, tabs, etc)
this.adds = [];
// THREE Mesh and points
this.mesh = null;
@ -154,8 +154,13 @@
load_time: 0,
progress: 0
};
this.saved = false;
this.support = false; // is synthesized support widget
this.meta = {
url: null,
file: null,
saved: false
};
// if this is a synthesized support widget
this.support = false;
}
/** ******************************************************************
@ -164,7 +169,9 @@
Widget.loadFromCatalog = function(filename, ondone) {
KIRI.catalog.getFile(filename, function(data) {
ondone(newWidget().loadVertices(data));
let widget = newWidget().loadVertices(data);
widget.meta.file = filename;
ondone(widget);
});
};
@ -175,8 +182,9 @@
track = data.track || undefined,
group = data.group || id,
widget = newWidget(id, Group.forid(group)),
meta = data.meta || widget.meta,
ptr = widget.loadVertices(vertices);
widget.saved = time();
widget.meta = meta;
// restore widget position if specified
if (move && track && track.pos) {
widget.track = track;
@ -200,7 +208,8 @@
PRO.saveToCatalog = function(filename) {
let widget = this;
let time = UTIL.time();
widget.filename = filename;
widget.meta.file = filename;
widget.meta.save = time;
KIRI.catalog.putFile(filename, this.getGeoVertices(), function(vertices) {
if (vertices && vertices.length) {
console.log("saving decimated mesh ["+vertices.length+"] time ["+(UTIL.time()-time)+"]");
@ -213,11 +222,12 @@
PRO.saveState = function(ondone) {
let widget = this;
KIRI.odb.put('ws-save-'+this.id, {
geo:widget.getGeoVertices(),
track:widget.track,
group:this.group.id
geo: widget.getGeoVertices(),
track: widget.track,
group: this.group.id,
meta: this.meta
}, function(result) {
widget.saved = time();
widget.meta.saved = time();
if (ondone) ondone();
});
};
@ -233,10 +243,12 @@
this.mesh.geometry.computeFaceNormals();
this.mesh.geometry.computeVertexNormals();
this.points = null;
this.meta.vertices = vertices.length / 3;
return this;
} else {
let geometry = new THREE.BufferGeometry();
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
this.meta.vertices = vertices.length / 3;
return this.loadGeometry(geometry);
}
};

View file

@ -1142,8 +1142,15 @@ th, tr, td, label {
}
#fps {
position: fixed;
right: 5px;
bottom: 5px;
font-size: 10px;
bottom: 5px;
right: 5px;
color: #000;
}
#winfo {
position: fixed;
font-size: 10px;
bottom: 5px;
left: 5px;
color: #000;
}

View file

@ -389,6 +389,7 @@
<button id="gotit" class="f-col j-center">got it</button>
</div>
<div id="fps" class="noshow"></div>
<div id="winfo" class="noshow"></div>
</div>
</body>
</html>