Skip to content

Commit

Permalink
Merge branch 'next' into layers-new
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed Nov 4, 2023
2 parents 6310ee6 + 46f1130 commit a5753c2
Show file tree
Hide file tree
Showing 25 changed files with 467 additions and 97 deletions.
34 changes: 32 additions & 2 deletions css/dialogs.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@
.dialog_bar > label {
width: var(--max_label_width);
}
.dialog_bar::after {
/*.dialog_bar::after {
content: "";
clear: both;
display: block;
}
}*/
.dialog_bar.narrow {
min-height: 30px;
}
Expand Down Expand Up @@ -372,6 +372,10 @@
grid-area: buttons;
margin-top: 0px;
margin-bottom: 12px;
display: flex;
flex-wrap: wrap;
justify-content: right;
gap: 3px;
}

.dialog_sidebar .dialog_sidebar_pages {
Expand Down Expand Up @@ -1456,6 +1460,32 @@ dialog#edit_bedrock_binding > .dialog_wrapper > .dialog_content {
#plugin_browser_page .settings_list {
padding: 4px 20px;
}
#plugin_browser_page .features_list {
padding: 4px 20px;
}
li.plugin_feature_entry {
display: flex;
gap: 8px;
padding-left: 4px;
min-height: 28px;
align-items: center;
}
li.plugin_feature_entry.clickable {
cursor: pointer;
}
li.plugin_feature_entry.clickable:hover {
color: var(--color-light);
}
li.plugin_feature_entry label {
white-space: nowrap;
cursor: inherit;
}
li.plugin_feature_entry > .description,
li.plugin_feature_entry > .extra_info {
color: var(--color-subtle_text);
margin-left: auto;
cursor: inherit;
}


#plugin_browser_start_page > img {
Expand Down
3 changes: 3 additions & 0 deletions css/panels.css
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,9 @@
stroke-width: 0;
pointer-events: initial;
}
.keyframe .keyframe_waveform > polygon:hover {
fill: var(--color-accent);
}

#timeline_graph_editor {
position: absolute;
Expand Down
14 changes: 14 additions & 0 deletions js/animations/keyframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,23 @@ class KeyframeDataPoint {
if (data.values) {
Object.assign(data, data.values)
}
let file_value_before = this.file;
for (var key in KeyframeDataPoint.properties) {
KeyframeDataPoint.properties[key].merge(this, data)
}
if (isApp && data.file && !file_value_before) {
if (this.keyframe.channel == 'sound' && !Timeline.waveforms[this.file]) {
Timeline.visualizeAudioFile(this.file);
} else if (this.keyframe.channel == 'particle') {
try {
Blockbench.read([this.file], {}, (files) => {
Animator.loadParticleEmitter(this.file, files[0].content);
})
} catch (err) {
console.log('Could not load particle effect for', this.file)
}
}
}
}
getUndoCopy() {
var copy = {}
Expand Down
2 changes: 1 addition & 1 deletion js/interface/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BarItem extends EventSystem {
this.keybind.setAction(this.id)
this.work_in_dialog = data.work_in_dialog === true
this.uses = 0;
Keybinds.actions.push(this)
Keybinds.actions.push(this);
}
}
conditionMet() {
Expand Down
2 changes: 0 additions & 2 deletions js/interface/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,6 @@ window.Dialog = class Dialog {
let button_bar = $('<div class="dialog_bar button_bar"></div>');

buttons.forEach((button, i) => {
if (i) button_bar.append('&nbsp;')
button_bar.append(button)
})

Expand Down Expand Up @@ -1038,7 +1037,6 @@ window.MessageBox = class MessageBox extends Dialog {
let button_bar = $('<div class="dialog_bar button_bar"></div>');

buttons.forEach((button, i) => {
if (i) button_bar.append('&nbsp;')
button_bar.append(button)
})

Expand Down
1 change: 1 addition & 0 deletions js/interface/menu_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ const MenuBar = {
new MenuSeparator('media'),
'screenshot_model',
'screenshot_app',
'advanced_screenshot',
'record_model_gif',
'timelapse',
])
Expand Down
1 change: 1 addition & 0 deletions js/interface/panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Panel extends EventSystem {
this.condition = data.condition;
this.display_condition = data.display_condition;
this.previous_slot = 'left_bar';
this.plugin = data.plugin || (typeof Plugins != 'undefined' ? Plugins.currently_loading : '');

this.growable = data.growable;

Expand Down
6 changes: 5 additions & 1 deletion js/interface/start_screen.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const StartScreen = {
loaders: {}
loaders: {},
open() {
Interface.tab_bar.openNewTab();
}
};

function addStartScreenSection(id, data) {
Expand Down Expand Up @@ -542,6 +545,7 @@ class ModelLoader {
this.show_on_start_screen = true;
this.confidential = options.confidential || false;
this.condition = options.condition;
this.plugin = options.plugin || (typeof Plugins != 'undefined' ? Plugins.currently_loading : '');

this.format_page = options.format_page;
this.onFormatPage = options.onFormatPage;
Expand Down
1 change: 1 addition & 0 deletions js/io/codec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Codec extends EventSystem {
this.format = data.format;
this.load_filter = data.load_filter;
this.export_action = data.export_action;
this.plugin = data.plugin || (typeof Plugins != 'undefined' ? Plugins.currently_loading : '');
}
getExportOptions() {
let options = {};
Expand Down
1 change: 1 addition & 0 deletions js/io/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class ModelFormat {
this.show_in_new_list = true;
this.can_convert_to = true;
this.confidential = false;
this.plugin = data.plugin || (typeof Plugins != 'undefined' ? Plugins.currently_loading : '');

for (let id in ModelFormat.properties) {
ModelFormat.properties[id].reset(this);
Expand Down
12 changes: 6 additions & 6 deletions js/io/formats/bbmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,10 @@ var codec = new Codec('project', {
}
if (!copy.box_uv) {
let tex = copy.faces[face].getTexture();
copy.faces[face].uv[0] *= (tex ? tex.getUVWidth() : Project.texture_width) / width;
copy.faces[face].uv[2] *= (tex ? tex.getUVWidth() : Project.texture_width) / width;
copy.faces[face].uv[1] *= (tex ? tex.getUVHeight() : Project.texture_height) / height;
copy.faces[face].uv[3] *= (tex ? tex.getUVHeight() : Project.texture_height) / height;
copy.faces[face].uv[0] *= (Project.getUVWidth(tex)) / width;
copy.faces[face].uv[2] *= (Project.getUVWidth(tex)) / width;
copy.faces[face].uv[1] *= (Project.getUVHeight(tex)) / height;
copy.faces[face].uv[3] *= (Project.getUVHeight(tex)) / height;
}
}
} else if (copy instanceof Mesh) {
Expand All @@ -560,8 +560,8 @@ var codec = new Codec('project', {
}
for (let vkey in copy.faces[fkey].uv) {
let tex = copy.faces[fkey].getTexture();
copy.faces[fkey].uv[vkey][0] *= (tex ? tex.getUVWidth() : Project.texture_width) / width;
copy.faces[fkey].uv[vkey][1] *= (tex ? tex.getUVHeight() : Project.texture_height) / height;
copy.faces[fkey].uv[vkey][0] *= Project.getUVWidth(tex) / width;
copy.faces[fkey].uv[vkey][1] *= Project.getUVHeight(tex) / height;
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions js/io/formats/fbx.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ var codec = new Codec('fbx', {
textures.push(tex);

vertices.forEach(vkey => {
uv.push(face.uv[vkey][0] / Project.texture_width, 1 - face.uv[vkey][1] / Project.texture_height);
uv.push(face.uv[vkey][0] / Project.getUVWidth(tex), 1 - face.uv[vkey][1] / Project.getUVHeight(tex));
})

normals.push(...face.getNormal(true));
Expand Down Expand Up @@ -407,10 +407,10 @@ var codec = new Codec('fbx', {
normals.push(...cube_face_normals[fkey]);

let uv_outputs = [
[face.uv[0] / Project.texture_width, 1 - face.uv[3] / Project.texture_height],
[face.uv[2] / Project.texture_width, 1 - face.uv[3] / Project.texture_height],
[face.uv[2] / Project.texture_width, 1 - face.uv[1] / Project.texture_height],
[face.uv[0] / Project.texture_width, 1 - face.uv[1] / Project.texture_height],
[face.uv[0] / Project.getUVWidth(texture), 1 - face.uv[3] / Project.getUVHeight(texture)],
[face.uv[2] / Project.getUVWidth(texture), 1 - face.uv[3] / Project.getUVHeight(texture)],
[face.uv[2] / Project.getUVWidth(texture), 1 - face.uv[1] / Project.getUVHeight(texture)],
[face.uv[0] / Project.getUVWidth(texture), 1 - face.uv[1] / Project.getUVHeight(texture)],
];
var rot = face.rotation || 0;
while (rot > 0) {
Expand Down
10 changes: 8 additions & 2 deletions js/io/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ class ModelProject {
let data = recent_projects.find(p => p.path == path);
return data;
}
getUVWidth(texture = 0) {
return (texture && Format.per_texture_uv_size) ? texture.uv_width : this.texture_width;
}
getUVHeight(texture = 0) {
return (texture && Format.per_texture_uv_size) ? texture.uv_height : this.texture_height;
}
openSettings() {
if (this.selected) BarItems.project_window.click();
}
Expand Down Expand Up @@ -603,7 +609,7 @@ function setProjectResolution(width, height, modify_uv) {
modify_uv = false;
}

let textures = Project.per_texture_uv_size ? Texture.all : undefined;
let textures = Format.per_texture_uv_size ? Texture.all : undefined;

Undo.initEdit({uv_mode: true, elements: Cube.all, uv_only: true, textures});

Expand Down Expand Up @@ -991,7 +997,7 @@ BARS.defineActions(function() {
Project.texture_height != texture_height
) {
// Adjust UV Mapping if resolution changed
if (!Project.box_uv && !box_uv &&
if (!Project.box_uv && !box_uv && !Format.per_texture_uv_size &&
(Project.texture_width != texture_width || Project.texture_height != texture_height)
) {
save = Undo.initEdit({elements: [...Cube.all, ...Mesh.all], uv_only: true, uv_mode: true})
Expand Down
2 changes: 2 additions & 0 deletions js/modeling/scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ const ModelScaler = {
element_aspects: {geometry: true, transform: true},
groups: ModelScaler.getScaleGroups(),
group_aspects: {transform: true},
selection: true
})
if (save === true) {
Undo.finishEdit('Scale model')
Expand Down Expand Up @@ -189,6 +190,7 @@ const ModelScaler = {
element_aspects: {geometry: true, transform: true},
groups: ModelScaler.getScaleGroups(),
group_aspects: {transform: true},
selection: true
})
},
setPivot(mode) {
Expand Down
4 changes: 2 additions & 2 deletions js/outliner/cube.js
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ new NodePreviewController(Cube, {

} else if (Format.single_texture) {
let tex = Texture.getDefault();
mesh.material = tex ? tex.getMaterial() : Canvas.emptyMaterials[element.color];
mesh.material = tex ? tex.getMaterial() : Canvas.emptyMaterials[element.color % Canvas.emptyMaterials.length];

} else {
var materials = []
Expand All @@ -1089,7 +1089,7 @@ new NodePreviewController(Cube, {
if (tex && tex.uuid) {
materials.push(Project.materials[tex.uuid])
} else {
materials.push(Canvas.emptyMaterials[element.color])
materials.push(Canvas.emptyMaterials[element.color % Canvas.emptyMaterials.length])
}
}
})
Expand Down
Loading

0 comments on commit a5753c2

Please sign in to comment.