Skip to content

Commit ff58ef0

Browse files
committed
Merge branch 'master' into gh-pages
2 parents c7a91b0 + 3745031 commit ff58ef0

40 files changed

+140
-69
lines changed

css/dialogs.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,11 @@
14531453
.plugin_compatibility_issue {
14541454
color: var(--color-error);
14551455
}
1456-
.plugin_compatibility_issue > .icon {
1456+
.plugin_deprecation_note {
1457+
color: var(--color-warning);
1458+
}
1459+
.plugin_compatibility_issue > .icon,
1460+
.plugin_deprecation_note > .icon {
14571461
vertical-align: text-bottom;
14581462
}
14591463
#plugin_list > li button {
@@ -1941,6 +1945,7 @@
19411945
width: 340px;
19421946
margin-left: 45px;
19431947
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
1948+
border-radius: 5px;
19441949
}
19451950
#action_selector ul {
19461951
background-color: var(--color-bright_ui);
@@ -1950,6 +1955,7 @@
19501955
max-height: 400px;
19511956
overflow-y: auto;
19521957
overflow-x: hidden;
1958+
border-radius: 5px;
19531959
}
19541960
#action_selector > #action_selector_list > div {
19551961
background-color: var(--color-ui);

css/general.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,13 @@
417417
.toolbar_wrapper.narrow > .toolbar {
418418
width: fit-content;
419419
display: flex;
420+
flex-direction: row-reverse;
421+
justify-content: space-between;
420422
height: 100%;
421423
}
424+
body.is_mobile .toolbar_wrapper.narrow > .toolbar:not(.vertical) {
425+
width: 100%;
426+
}
422427
.toolbar_wrapper > .toolbar.no_wrap {
423428
width: fit-content;
424429
display: flex;

css/panels.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@
9898
height: calc(100% - 3px);
9999
margin-top: 3px;
100100
}
101+
body.is_mobile .panel_tab_list {
102+
flex-grow: 1;
103+
}
101104
.panel_tab_list > .panel_handle {
102105
display: flex;
103106
flex: 1 1 auto;
@@ -3126,7 +3129,6 @@ span.controller_state_section_info {
31263129
#palette_list {
31273130
padding: 2px;
31283131
min-height: 160px;
3129-
max-height: 232px;
31303132
line-height: 0;
31313133
}
31323134
#palette_list .color {

css/setup.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@layer reset, lib, base, theme, theme-override;
1+
@layer reset, lib, base, plugin, theme, theme-override;
22
@layer reset {
33
* {
44
margin: 0;

js/animations/animation.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Blockbench } from "../api";
22
import { Filesystem } from "../file_system";
33
import { openMolangEditor } from "./molang_editor";
44
import { clipboard, currentwindow, dialog, fs, ipcRenderer } from "../native_apis";
5+
import { invertMolang } from "../util/molang";
56

67
export class AnimationItem {
78
constructor() {}
@@ -215,6 +216,8 @@ export class Animation extends AnimationItem {
215216
let value = [0, 1, 2].map(axis => {
216217
return kf.getBezierLerp(kf, next_keyframe, getAxisLetter(axis), lerp);
217218
})
219+
if (channel == 'position' || channel == 'rotation') value[0] = -value[0];
220+
if (channel == 'rotation') value[1] = -value[1];
218221
interpolated_values[itimecode] = value;
219222
}
220223
// Optimize data
@@ -268,6 +271,8 @@ export class Animation extends AnimationItem {
268271
if (!timecode.includes('.')) {
269272
timecode += '.0';
270273
}
274+
rotation.array[0] = invertMolang(rotation.array[0]);
275+
rotation.array[1] = invertMolang(rotation.array[1]);
271276
bone_tag.rotation[timecode] = rotation.array;
272277
})
273278
}

js/animations/animation_mode.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ export const Animator = {
404404

405405
Animator.updateOnionSkin();
406406

407+
Billboard.all.forEach(billboard => {
408+
Billboard.preview_controller.updateFacingCamera(billboard);
409+
})
410+
407411
if (Interface.Panels.variable_placeholders.inside_vue.text.match(/^\s*preview\.texture\s*=/mi)) {
408412
let tex_index = Animator.MolangParser.variableHandler('preview.texture');
409413
let texture = Texture.all[tex_index % Texture.all.length];

js/animations/keyframe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ export class Keyframe {
330330
let previous = this.getPreviousKeyframe();
331331
if (previous && previous.interpolation == 'step') {
332332
return new oneLiner({
333-
pre: previous.getArray(1),
333+
pre: flipArray(previous.getArray(1)),
334334
post: flipArray(this.getArray()),
335335
})
336336
} else {

js/animations/timeline.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ export const Timeline = {
296296
return 1/Math.clamp(Animation.selected ? Animation.selected.snapping : settings.animation_snap.value, 1, 120);
297297
},
298298
setup() {
299-
document.getElementById('timeline_body').addEventListener('mousedown', e => {
299+
let timeline_body = Panels.timeline.node.querySelector('#timeline_body');
300+
timeline_body.addEventListener('mousedown', e => {
300301
if (e.which === 2 || (Keybinds.extra.preview_drag.keybind.isTriggered(e) && e.which !== 1)) {
301302
let pos = [e.clientX, e.clientY];
302303
let timeline = e.currentTarget;
@@ -322,7 +323,8 @@ export const Timeline = {
322323
}
323324
})
324325

325-
$('#timeline_time').on('mousedown touchstart', e => {
326+
let timeline_time = Panels.timeline.node.querySelector('#timeline_time');
327+
addEventListeners(timeline_time, 'mousedown touchstart', e => {
326328
if (e.which !== 1 && !event.changedTouches) return;
327329
if (e.target.classList.contains('timeline_marker')) return;
328330

@@ -377,7 +379,7 @@ export const Timeline = {
377379
}
378380
}
379381
})
380-
$(document).on('mousemove touchmove', e => {
382+
addEventListeners(document, 'mousemove touchmove', e => {
381383
if (Timeline.dragging_playhead) {
382384

383385
convertTouchEvent(e);
@@ -419,8 +421,8 @@ export const Timeline = {
419421
Blockbench.setCursorTooltip(Math.roundTo(time, 2));
420422
}
421423
}
422-
})
423-
.on('mouseup touchend', e => {
424+
});
425+
addEventListeners(document, 'mouseup touchend', e => {
424426
if (Timeline.dragging_playhead) {
425427
delete Timeline.dragging_playhead;
426428
Interface.removeSuggestedModifierKey('ctrl', 'modifier_actions.drag_without_snapping');
@@ -434,10 +436,11 @@ export const Timeline = {
434436
delete Timeline.dragging_onion_skin_point
435437
}
436438
Blockbench.setCursorTooltip();
437-
})
439+
});
438440

439441
//Enter Time
440-
$('#timeline_timestamp').click(e => {
442+
let timestamp = Panels.timeline.node.querySelector('#timeline_timestamp');
443+
addEventListeners(timestamp, 'click', e => {
441444
if ($('#timeline_timestamp').attr('contenteditable') == 'true') return;
442445

443446
$('#timeline_timestamp').attr('contenteditable', true).focus().select()
@@ -464,13 +467,13 @@ export const Timeline = {
464467
selection.removeAllRanges();
465468
selection.addRange(range);
466469
})
467-
.on('focusout keydown', e => {
470+
addEventListeners(timestamp, 'focusout keydown', e => {
468471
if (e.type === 'focusout' || Keybinds.extra.confirm.keybind.isTriggered(e) || Keybinds.extra.cancel.keybind.isTriggered(e)) {
469472
$('#timeline_timestamp').attr('contenteditable', false)
470473
Timeline.setTimecode(Timeline.time)
471474
}
472475
})
473-
.on('keyup', e => {
476+
addEventListeners(timestamp, 'keyup', e => {
474477
var times = $('#timeline_timestamp').text().split(':')
475478
times.forEach((t, i) => {
476479
times[i] = parseInt(t)
@@ -492,18 +495,19 @@ export const Timeline = {
492495
}
493496
})
494497
//Enter Frame
495-
$('#timeline_framenumber').click(e => {
498+
let framenumber = Panels.timeline.node.querySelector('#timeline_framenumber');
499+
framenumber.addEventListener('click', e => {
496500
if ($('#timeline_framenumber').attr('contenteditable') == 'true') return;
497501

498502
$('#timeline_framenumber').attr('contenteditable', true).trigger('focus');
499503
document.execCommand('selectAll');
500504
})
501-
.on('focusout keydown', e => {
505+
addEventListeners(framenumber, 'focusout keydown', e => {
502506
if (e.type === 'focusout' || Keybinds.extra.confirm.keybind.isTriggered(e) || Keybinds.extra.cancel.keybind.isTriggered(e)) {
503507
$('#timeline_framenumber').attr('contenteditable', false)
504508
}
505509
})
506-
.on('keyup', e => {
510+
addEventListeners(framenumber, 'keyup', e => {
507511
let frame = parseInt($('#timeline_framenumber').text())
508512
let seconds = frame * Timeline.getStep();
509513
if (Math.abs(seconds-Timeline.time) > 1e-3 ) {
@@ -512,9 +516,9 @@ export const Timeline = {
512516
}
513517
})
514518

515-
$('#timeline_vue').on('mousewheel scroll', function(e) {
516-
e.preventDefault()
517-
let event = e.originalEvent;
519+
let timeline_vue = Panels.timeline.node.querySelector('#timeline_vue');
520+
addEventListeners(timeline_vue, 'mousewheel scroll', function(event) {
521+
event.preventDefault()
518522
let body = document.getElementById('timeline_body');
519523

520524
body.scrollLeft += event.deltaX/2;
@@ -1705,7 +1709,7 @@ Interface.definePanels(() => {
17051709
<i class="icon-open-state fa" v-bind:class="{'fa-angle-right': !animator.expanded, 'fa-angle-down': animator.expanded}"></i>
17061710
</div>
17071711
<dynamic-icon v-if="animator.node" :icon="animator.node.icon.replace('fa ', '').replace(/ /g, '.')" :color="getNodeColor(animator.node)" />
1708-
<dynamic-icon v-else-if="animator.particle" :icon="wand_shine" />
1712+
<dynamic-icon v-else-if="animator.particle" :icon="'wand_shine'" />
17091713
<dynamic-icon v-else :icon="'help'" style="color: var(--color-error)" />
17101714
<span class="timeline_animator_name" v-on:click.stop="animator.clickSelect();" @mousedown="dragAnimator(animator, $event)" @touchstart="dragAnimator(animator, $event)">
17111715
{{animator.name}}

js/api.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { EventSystem } from "./util/event_system";
55
import VersionUtil from './util/version_util';
66
import { Filesystem } from "./file_system";
77
import { MessageBoxOptions } from "./interface/dialog";
8-
import { currentwindow, shell, SystemInfo } from "./native_apis";
8+
import { currentwindow, electron, shell, SystemInfo } from "./native_apis";
99

1010
declare const appVersion: string;
1111
declare let Format: ModelFormat
@@ -53,6 +53,7 @@ export const Blockbench = {
5353
events: {},
5454
openTime: new Date(),
5555
setup_successful: null as null | true,
56+
argv: isApp ? electron.process?.argv?.slice() : null,
5657
/**
5758
* @deprecated Use Undo.initEdit and Undo.finishEdit instead
5859
*/
@@ -304,9 +305,10 @@ export const Blockbench = {
304305
})
305306
},
306307
//CSS
307-
addCSS(css: string): Deletable {
308+
addCSS(css: string, layer: string = 'plugin'): Deletable {
308309
let style_node = document.createElement('style');
309-
style_node.type ='text/css';
310+
style_node.setAttribute('type', 'text/css');
311+
if (layer != '') css = `@layer ${layer} {${css}}`;
310312
style_node.appendChild(document.createTextNode(css));
311313
document.getElementsByTagName('head')[0].appendChild(style_node);
312314
function deletableStyle(node) {

js/file_system.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export namespace Filesystem {
2525
/**
2626
* The resource identifier group, used to allow the file dialog (open and save) to remember where it was last used
2727
*/
28-
type ResourceID =
28+
export type ResourceID =
2929
| string
3030
| 'texture'
3131
| 'minecraft_skin'
@@ -43,14 +43,14 @@ export namespace Filesystem {
4343

4444
// MARK: Import
4545
type ReadType = 'buffer' | 'binary' | 'text' | 'image' | 'none'
46-
interface ReadOptions {
46+
export interface ReadOptions {
4747
readtype?: ReadType | ((file: string) => ReadType)
4848
errorbox?: boolean
4949
/** File Extensions
5050
*/
5151
extensions?: string[]
5252
}
53-
interface ImportOptions extends ReadOptions {
53+
export interface ImportOptions extends ReadOptions {
5454
/** Name of the file type
5555
*/
5656
type: string
@@ -304,7 +304,7 @@ export namespace Filesystem {
304304

305305

306306
// MARK: Pick Directory
307-
interface PickDirOptions {
307+
export interface PickDirOptions {
308308
/**Location where the file dialog starts off
309309
*/
310310
startpath?: string
@@ -350,7 +350,7 @@ export namespace Filesystem {
350350
}
351351

352352
// MARK: Export
353-
interface ExportOptions extends WriteOptions {
353+
export interface ExportOptions extends WriteOptions {
354354
/**
355355
* Name of the file type
356356
*/
@@ -460,7 +460,7 @@ export namespace Filesystem {
460460

461461
// MARK: Write
462462
type WriteType = 'text' | 'buffer' | 'binary' | 'zip' | 'image'
463-
interface WriteOptions {
463+
export interface WriteOptions {
464464
content?: string | ArrayBuffer | Blob
465465
savetype?: WriteType | ((file: string) => WriteType)
466466
custom_writer?: (content: string | ArrayBuffer | Blob, file_path: string, callback?: (file_path: string) => void) => void
@@ -525,7 +525,7 @@ export namespace Filesystem {
525525

526526

527527
// MARK: Find
528-
interface FindFileOptions {
528+
export interface FindFileOptions {
529529
recursive: boolean
530530
filter_regex: RegExp
531531
priority_regex?: RegExp
@@ -599,7 +599,7 @@ export namespace Filesystem {
599599

600600

601601
// MARK: Drag & Drop
602-
interface DragHandlerOptions {
602+
export interface DragHandlerOptions {
603603
/**
604604
* Allowed file extensions
605605
*/

0 commit comments

Comments
 (0)