Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed Feb 16, 2024
2 parents 4b55f28 + a56fe01 commit c9dc685
Show file tree
Hide file tree
Showing 26 changed files with 609 additions and 91 deletions.
4 changes: 4 additions & 0 deletions css/dialogs.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
.dialog_bar > label {
width: var(--max_label_width);
}
.dialog_bar > .molang_input {
width: calc(100% - var(--max_label_width));
}
/*.dialog_bar::after {
content: "";
clear: both;
Expand Down Expand Up @@ -1493,6 +1496,7 @@ dialog#edit_bedrock_binding > .dialog_wrapper > .dialog_content {
color: var(--color-subtle_text);
margin-left: auto;
cursor: inherit;
overflow-wrap: anywhere;
}


Expand Down
1 change: 1 addition & 0 deletions css/panels.css
Original file line number Diff line number Diff line change
Expand Up @@ -2677,6 +2677,7 @@ span.controller_state_section_info {
padding: 2px;
min-height: 160px;
max-height: 232px;
line-height: 0;
}
#palette_list .color {
display: inline-block;
Expand Down
5 changes: 3 additions & 2 deletions js/animations/animation_controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ class AnimationControllerState {
if (this.transitions.length) {
object.transitions = this.transitions.map(transition => {
let state = this.controller.states.find(s => s.uuid == transition.target);
return new oneLiner({[state ? state.name : 'missing_state']: transition.condition})
let condition = transition.condition.replace(/\n/g, '');
return new oneLiner({[state ? state.name : 'missing_state']: condition})
})
}
if (this.blend_transition) object.blend_transition = this.blend_transition;
Expand Down Expand Up @@ -1723,7 +1724,7 @@ Interface.definePanels(() => {
</ul>
<div class="controller_state_input_bar">
<label>${tl('animation_controllers.state.blend_transition')}</label>
<numeric-input style="width: 70px;" v-model.number="state.blend_transition" min="0" step="0.05" />
<numeric-input style="width: 70px;" v-model.number="state.blend_transition" :min="0" :step="0.05" />
</div>
<div class="controller_state_input_bar">
<label :for="state.uuid + '_shortest_path'">${tl('animation_controllers.state.shortest_path')}</label>
Expand Down
9 changes: 5 additions & 4 deletions js/display_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -2016,7 +2016,7 @@ BARS.defineActions(function() {
"position": [4, 12, -2],
"size": [4, 12, 4],
"origin": [5, 22, 0],
"rotation": [-1, 0, 3],
"rotation": [15, 0, 0],
"faces": {
"north": {"uv": [44, 20, 48, 32]},
"east": {"uv": [40, 20, 44, 32]},
Expand All @@ -2031,7 +2031,7 @@ BARS.defineActions(function() {
"position": [3.75, 11.75, -2.25],
"size": [4.5, 12.5, 4.5],
"origin": [5, 22, 0],
"rotation": [-1, 0, 3],
"rotation": [15, 0, 0],
"faces": {
"north": {"uv": [44, 36, 48, 48]},
"east": {"uv": [40, 36, 44, 48]},
Expand Down Expand Up @@ -2079,7 +2079,7 @@ BARS.defineActions(function() {
"position": [4, 11.5, -2],
"size": [3, 12, 4],
"origin": [5, 21.5, 0],
"rotation": [-1, 0, 3],
"rotation": [15, 0, 0],
"faces": {
"north": {"uv": [44,20,47,32]},
"east": {"uv": [40,20,44,32]},
Expand All @@ -2094,7 +2094,7 @@ BARS.defineActions(function() {
"position": [3.75, 11.25, -2.25],
"size": [3.5, 12.5, 4.5],
"origin": [5, 21.5, 0],
"rotation": [-1, 0, 3],
"rotation": [15, 0, 0],
"faces": {
"north": {"uv": [44,36,47,48]},
"east": {"uv": [40,36,44,48]},
Expand Down Expand Up @@ -2193,6 +2193,7 @@ BARS.defineActions(function() {

window.player_attachable_reference_model = player_attachable_reference_model;
player_attachable_reference_model.updateArmVariant = player_preview_model.updateArmVariant;
player_attachable_reference_model.updateArmVariant();

let camera_preset_1st = {
name: tl('action.bedrock_animation_mode.attachable_first'),
Expand Down
7 changes: 6 additions & 1 deletion js/interface/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,12 @@ class Toolbar {
if (arr.equals(this.default_children)) {
delete BARS.stored[this.id];
}
localStorage.setItem('toolbars', JSON.stringify(BARS.stored))
// Temporary fix
try {
localStorage.setItem('toolbars', JSON.stringify(BARS.stored))
} catch (err) {
localStorage.removeItem('backup_model');
}
return this;
}
reset() {
Expand Down
2 changes: 1 addition & 1 deletion js/interface/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ window.Dialog = class Dialog {
handle.append(title);

let jq_dialog = $(this.object);
this.max_label_width = 0;
this.max_label_width = 140;
this.uses_wide_inputs = false;

let wrapper = document.createElement('div');
Expand Down
2 changes: 1 addition & 1 deletion js/interface/menu_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ const MenuBar = {
'open_dev_tools',
{name: 'Error Log', condition: () => window.ErrorLog.length, icon: 'error', color: 'red', keybind: {toString: () => window.ErrorLog.length.toString()}, click() {
let lines = window.ErrorLog.slice(0, 64).map((error) => {
return Interface.createElement('p', {}, `${error.message}\n - In .${error.file.split(location.origin).join('')} : ${error.line}`);
return Interface.createElement('p', {style: 'word-break: break-word;'}, `${error.message}\n - In .${error.file.split(location.origin).join('')} : ${error.line}`);
})
new Dialog({
id: 'error_log',
Expand Down
7 changes: 6 additions & 1 deletion js/interface/vue_components.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ Vue.component('numeric-input', {
<input class="dark_bordered focusable_input" :value="string_value" @input="change($event.target.value)" inputmode="decimal" lang="en" @focusout="resolve($event)" @dblclick="resolve($event)">
<div class="tool numeric_input_slider" @mousedown="slide($event)" @touchstart="slide($event)"><i class="material-icons">code</i></div>
</div>
`
`,
mounted() {
if (typeof this.min == 'string') console.warn('Argument "min" should be set as a numeric property via "v-bind:"')
if (typeof this.max == 'string') console.warn('Argument "max" should be set as a numeric property via "v-bind:"')
if (typeof this.step == 'string') console.warn('Argument "step" should be set as a numeric property via "v-bind:"')
}
})
Vue.component('dynamic-icon', {
props: {
Expand Down
3 changes: 2 additions & 1 deletion js/io/codec.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class Codec extends EventSystem {
}
async export() {
if (Object.keys(this.export_options).length) {
await this.promptExportOptions();
let result = await this.promptExportOptions();
if (result === null) return;
}
Blockbench.export({
resource_id: 'model',
Expand Down
3 changes: 2 additions & 1 deletion js/io/formats/fbx.js
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,8 @@ var codec = new Codec('fbx', {
},
async export() {
if (Object.keys(this.export_options).length) {
await this.promptExportOptions();
let result = await this.promptExportOptions();
if (result === null) return;
}
var scope = this;
if (isApp) {
Expand Down
3 changes: 2 additions & 1 deletion js/io/formats/gltf.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ var codec = new Codec('gltf', {
}
},
async export() {
await this.promptExportOptions();
let options = await this.promptExportOptions();
if (options === null) return;
let content = await this.compile();
await new Promise(r => setTimeout(r, 20));
Blockbench.export({
Expand Down
13 changes: 10 additions & 3 deletions js/io/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,12 @@ async function loadImages(files, event) {
if (img.naturalHeight == img.naturalWidth && [64, 128].includes(img.naturalWidth)) {
options.minecraft_skin = 'format.skin';
}
if (Project && !Format.image_editor && Condition(Panels.textures.condition)) {
options.texture = 'action.import_texture';
if (Project && Condition(Panels.textures.condition)) {
if (Format.image_editor) {
options.texture = 'message.load_images.add_image';
} else {
options.texture = 'action.import_texture';
}
}
if (Project && (!Project.box_uv || Format.optional_box_uv)) {
options.extrude_with_cubes = 'dialog.extrude.title';
Expand All @@ -138,9 +142,12 @@ async function loadImages(files, event) {
if (method == 'texture') {
let new_textures = [];
Undo.initEdit({textures: new_textures});
files.forEach(function(f) {
files.forEach(function(f, i) {
let tex = new Texture().fromFile(f).add().fillParticle();
new_textures.push(tex);
if (Format.image_editor && i == 0) {
tex.select();
}
});
Undo.finishEdit('Add texture');

Expand Down
8 changes: 5 additions & 3 deletions js/outliner/cube.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,9 +748,11 @@ class Cube extends OutlinerElement {
} else if (scope.autouv === 1) {

function calcAutoUV(face, size) {
var sx = scope.faces[face].uv[0]
var sy = scope.faces[face].uv[1]
var rot = scope.faces[face].rotation
size[0] = Math.abs(size[0]);
size[1] = Math.abs(size[1]);
var sx = scope.faces[face].uv[0];
var sy = scope.faces[face].uv[1];
var rot = scope.faces[face].rotation;

//Match To Rotation
if (rot === 90 || rot === 270) {
Expand Down
1 change: 0 additions & 1 deletion js/outliner/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ class Group extends OutlinerNode {
return array;
}
showContextMenu(event) {
Prop.active_panel = 'outliner'
if (this.locked) return this;
if (Group.selected != this) this.select(event);
this.menu.open(event, this)
Expand Down
1 change: 0 additions & 1 deletion js/outliner/outliner.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ class OutlinerElement extends OutlinerNode {
return this;
}
showContextMenu(event) {
Prop.active_panel = 'outliner'
if (this.locked) return this;
if (!this.selected) {
this.select()
Expand Down
17 changes: 11 additions & 6 deletions js/plugin_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ class Plugin {
this.unload()
this.tags.empty();
this.dependencies.empty();
Plugins.all.remove(this)
Plugins.all.remove(this);
this.details = null;

if (this.source == 'file') {
this.loadFromFile({path: this.path}, false)
Expand Down Expand Up @@ -791,10 +792,14 @@ async function loadInstalledPlugins() {
}

} else if (plugin.source == 'url') {
var instance = new Plugin(plugin.id, {disabled: plugin.disabled});
install_promises.push(instance.loadFromURL(plugin.path, false));
load_counter++;
console.log(`🧩🌐 Loaded plugin "${plugin.id || plugin.path}" from URL`);
if (plugin.path) {
var instance = new Plugin(plugin.id, {disabled: plugin.disabled});
install_promises.push(instance.loadFromURL(plugin.path, false));
load_counter++;
console.log(`🧩🌐 Loaded plugin "${plugin.id || plugin.path}" from URL`);
} else {
Plugins.installed.remove(plugin);
}

} else {
if (Plugins.all.find(p => p.id == plugin.id)) {
Expand Down Expand Up @@ -1300,7 +1305,7 @@ BARS.defineActions(function() {
</tr>
<tr v-if="selected_plugin.details.website">
<td>Website</td>
<td>{{ selected_plugin.details.website }}</td>
<td><a :href="selected_plugin.details.website" :title="selected_plugin.details.website">{{ reduceLink(selected_plugin.details.website) }}</a></td>
</tr>
<tr v-if="selected_plugin.details.repository">
<td>Plugin source</td>
Expand Down
4 changes: 2 additions & 2 deletions js/predicate_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,11 @@ const PredicateOverrideEditor = {
<select-input v-model="generator.type" :options="available_predicate_options" @input="updateGeneratorType()" />
<label>${tl('dialog.predicate_overrides.variants')}</label>
<numeric-input v-model.number="generator.variants" min="1" step="1" style="width: 70px;" />
<numeric-input v-model.number="generator.variants" :min="1" :step="1" style="width: 70px;" />
<template v-if="generator.type == 'custom_model_data'">
<label>${tl('dialog.predicate_overrides.start_value')}</label>
<numeric-input v-model.number="generator.start_value" min="0" step="1" style="width: 45px;" />
<numeric-input v-model.number="generator.start_value" :min="0" :step="1" style="width: 45px;" />
</template>
<label>${tl('dialog.predicate_overrides.model')}</label>
Expand Down
Loading

0 comments on commit c9dc685

Please sign in to comment.