add timeline op for editing indexed timelines
This commit is contained in:
parent
889dce3051
commit
0a5e578c43
3 changed files with 40 additions and 18 deletions
|
|
@ -65,6 +65,9 @@ CAM.init = function(kiri, api) {
|
|||
}
|
||||
|
||||
function setAnimationStyle(settings) {
|
||||
if (!isCamMode) {
|
||||
return;
|
||||
}
|
||||
isIndexed = settings.process.camStockIndexed;
|
||||
animVer = isIndexed ? 1 : 0;
|
||||
updateStock();
|
||||
|
|
@ -74,6 +77,17 @@ CAM.init = function(kiri, api) {
|
|||
}
|
||||
api.platform.update_top_z();
|
||||
$('cam-index').style.display = isIndexed ? '' : 'none';
|
||||
// add or remove clock op depending on indexing
|
||||
const cp = current.process;
|
||||
if (!cp.ops) {
|
||||
return;
|
||||
}
|
||||
const clockOp = cp.ops.filter(op => op.type === '|')[0];
|
||||
if (isIndexed && !clockOp) {
|
||||
func.opAdd(popOp['|'].new());
|
||||
} else if (!isIndexed && clockOp) {
|
||||
func.opDel(clockOp);
|
||||
}
|
||||
}
|
||||
|
||||
// wire up animate button in ui
|
||||
|
|
@ -356,7 +370,9 @@ CAM.init = function(kiri, api) {
|
|||
api.event.on("cam.op.render", func.opRender = () => {
|
||||
// $('camops').style.display = isCamMode && isArrange ? 'flex' : '';
|
||||
let oplist = current.process.ops;
|
||||
if (!(isCamMode && oplist)) return;
|
||||
if (!(isCamMode && oplist)) {
|
||||
return;
|
||||
}
|
||||
oplist = oplist.filter(rec => !Array.isArray(rec));
|
||||
let mark = Date.now();
|
||||
let html = [];
|
||||
|
|
@ -364,9 +380,12 @@ CAM.init = function(kiri, api) {
|
|||
let bind = {};
|
||||
let scale = API.view.unit_scale();
|
||||
oplist.forEach((rec,i) => {
|
||||
let clock = rec.clock = rec.type === '|';
|
||||
let label = clock ? '<i class="fa-regular fa-clock"></i>' : rec.type;
|
||||
html.appendAll([
|
||||
`<div id="${mark+i}" class="draggable">`,
|
||||
`<label class="label">${rec.type}</label>`,
|
||||
`<label class="label">${label}</label>`,
|
||||
clock ? '' :
|
||||
`<label id="${mark+i}-x" class="del"><i class="fa-regular fa-circle-xmark"></i></label>`,
|
||||
`</div>`
|
||||
]);
|
||||
|
|
@ -378,6 +397,7 @@ CAM.init = function(kiri, api) {
|
|||
let unpop = null;
|
||||
// drag and drop re-ordering
|
||||
for (let [id, rec] of Object.entries(bind)) {
|
||||
if (!rec.clock)
|
||||
$(`${id}-x`).onmousedown = (ev) => {
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
|
|
@ -416,8 +436,10 @@ CAM.init = function(kiri, api) {
|
|||
popped = true;
|
||||
poprec.use(rec);
|
||||
hoveredOp = el;
|
||||
el.appendChild(poprec.div);
|
||||
poprec.addNote();
|
||||
if (!rec.clock) {
|
||||
el.appendChild(poprec.div);
|
||||
poprec.addNote();
|
||||
}
|
||||
// option click event appears latent
|
||||
// and overides the sticky settings
|
||||
setTimeout(() => {
|
||||
|
|
@ -1372,6 +1394,8 @@ CAM.init = function(kiri, api) {
|
|||
}).inputs = {
|
||||
disable: UC.newRow([ UC.newButton(LANG.disable, editDisable) ], {class:"ext-buttons f-row"}),
|
||||
};
|
||||
|
||||
createPopOp('|', {}).inputs = {};
|
||||
};
|
||||
|
||||
function createPopOp(type, map) {
|
||||
|
|
|
|||
|
|
@ -148,6 +148,9 @@ CAM.slice = function(settings, widget, onupdate, ondone) {
|
|||
sliceAll.appendAll(slices);
|
||||
if (axisIndex !== undefined) {
|
||||
console.log({post_axis_index: slices});
|
||||
for (let slice of slices) {
|
||||
slice.axisIndex = axisIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -256,20 +256,15 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
return el;
|
||||
}
|
||||
|
||||
// function onLayerToggle() {
|
||||
// api.conf.update();
|
||||
// api.show.slices();
|
||||
// }
|
||||
|
||||
function onBooleanClick() {
|
||||
// prevent hiding elements in device editor on clicks
|
||||
// if (!api.modal.visible()) {
|
||||
uc.refresh();
|
||||
// }
|
||||
function onBooleanClick(el) {
|
||||
uc.refresh();
|
||||
api.conf.update();
|
||||
DOC.activeElement.blur();
|
||||
api.event.emit("boolean.click");
|
||||
updateLaserState();
|
||||
if (el === ui.camStockIndexed) {
|
||||
api.space.set_focus();
|
||||
}
|
||||
}
|
||||
|
||||
function onButtonClick(ev) {
|
||||
|
|
@ -2780,10 +2775,10 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
$('view-top').onclick = space.view.top;
|
||||
$('view-home').onclick = space.view.home;
|
||||
$('view-clear').onclick = api.platform.clear;
|
||||
$('mode-fdm').onclick = () => { api.mode.set('FDM') };
|
||||
$('mode-sla').onclick = () => { api.mode.set('SLA') };
|
||||
$('mode-cam').onclick = () => { api.mode.set('CAM') };
|
||||
$('mode-laser').onclick = () => { api.mode.set('LASER') };
|
||||
$('mode-fdm').onclick = () => { api.mode.set('FDM'); api.space.set_focus() };
|
||||
$('mode-sla').onclick = () => { api.mode.set('SLA'); api.space.set_focus() };
|
||||
$('mode-cam').onclick = () => { api.mode.set('CAM'); api.space.set_focus() };
|
||||
$('mode-laser').onclick = () => { api.mode.set('LASER'); api.space.set_focus() };
|
||||
$('unrotate').onclick = () => {
|
||||
api.widgets.for(w => w.unrotate());
|
||||
api.selection.update_info();
|
||||
|
|
|
|||
Loading…
Reference in a new issue