mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-02-17 16:20:13 +08:00
Support unhandled fields and render_type in java block
This commit is contained in:
parent
f1d00ec8b3
commit
d065d3f206
@ -101,6 +101,7 @@ class ModelFormat {
|
||||
Undo.history.empty();
|
||||
Undo.index = 0;
|
||||
Project.export_path = '';
|
||||
Project.unhandled_root_fields = {};
|
||||
|
||||
var old_format = Format;
|
||||
this.select();
|
||||
|
@ -201,6 +201,9 @@ var codec = new Codec('java_block', {
|
||||
if (checkExport('ambientocclusion', Project.ambientocclusion === false)) {
|
||||
blockmodel.ambientocclusion = false
|
||||
}
|
||||
if (Project.unhandled_root_fields.render_type) {
|
||||
blockmodel.render_type = Project.unhandled_root_fields.render_type;
|
||||
}
|
||||
if (Project.texture_width !== 16 || Project.texture_height !== 16) {
|
||||
blockmodel.texture_size = [Project.texture_width, Project.texture_height]
|
||||
}
|
||||
@ -244,6 +247,9 @@ var codec = new Codec('java_block', {
|
||||
blockmodel.groups = groups
|
||||
}
|
||||
}
|
||||
for (let key in Project.unhandled_root_fields) {
|
||||
if (blockmodel[key] === undefined) blockmodel[key] = Project.unhandled_root_fields[key];
|
||||
}
|
||||
this.dispatchEvent('compile', {model: blockmodel, options});
|
||||
if (options.raw) {
|
||||
return blockmodel
|
||||
@ -489,6 +495,13 @@ var codec = new Codec('java_block', {
|
||||
if (model.gui_light === 'front') {
|
||||
Project.front_gui_light = true;
|
||||
}
|
||||
let supported_fields = new Set(['textures', 'elements', 'groups', 'parent', 'display', '__comment', 'credit', 'texture_size', 'overrides', 'ambientocclusion', 'gui_light']);
|
||||
for (let key in model) {
|
||||
if (!supported_fields.has(key)) {
|
||||
Project.unhandled_root_fields[key] = model[key];
|
||||
}
|
||||
}
|
||||
|
||||
this.dispatchEvent('parsed', {model});
|
||||
if (add) {
|
||||
Undo.finishEdit('Add block model')
|
||||
|
@ -468,6 +468,10 @@ new Property(ModelProject, 'array', 'timeline_setups', {
|
||||
exposed: false,
|
||||
condition: () => Format.animation_mode,
|
||||
});
|
||||
new Property(ModelProject, 'object', 'unhandled_root_fields', {
|
||||
exposed: false,
|
||||
default: {}
|
||||
});
|
||||
|
||||
|
||||
ModelProject.all = [];
|
||||
|
Loading…
Reference in New Issue
Block a user