Close #1605 Keep track of model credit field

This commit is contained in:
JannisX11 2022-10-13 23:56:50 +02:00
parent a049e23913
commit 1d8e134267
5 changed files with 15 additions and 8 deletions

View File

@ -192,8 +192,8 @@ var codec = new Codec('java_block', {
}
var blockmodel = {}
if (checkExport('comment', settings.credit.value)) {
blockmodel.credit = settings.credit.value
if (checkExport('comment', Project.credit || settings.credit.value)) {
blockmodel.credit = Project.credit || settings.credit.value
}
if (checkExport('parent', Project.parent != '')) {
blockmodel.parent = Project.parent
@ -271,6 +271,7 @@ var codec = new Codec('java_block', {
}
//Load
if (typeof (model.credit || model.__comment) == 'string') Project.credit = (model.credit || model.__comment);
if (model.texture_size instanceof Array && !add) {
Project.texture_width = Math.clamp(parseInt(model.texture_size[0]), 1, Infinity)
Project.texture_height = Math.clamp(parseInt(model.texture_size[1]), 1, Infinity)

View File

@ -14,8 +14,8 @@ var codec = new Codec('optifine_entity', {
compile(options) {
if (options === undefined) options = {}
var entitymodel = {}
if (settings.credit.value) {
entitymodel.credit = settings.credit.value
if (Project.credit || settings.credit.value) {
entitymodel.credit = Project.credit || settings.credit.value
}
var geo_code = 'geometry.'+Project.geometry_name
if (Texture.getDefault()) {
@ -188,6 +188,7 @@ var codec = new Codec('optifine_entity', {
return new Texture().fromPath(texture_path).add(false);
}
if (typeof model.credit == 'string') Project.credit = model.credit;
if (model.textureSize) {
Project.texture_width = parseInt(model.textureSize[0])||16;
Project.texture_height = parseInt(model.textureSize[1])||16;

View File

@ -16,8 +16,8 @@ var part_codec = new Codec('optifine_part', {
}
jpm.textureSize = [Project.texture_width, Project.texture_height]
if (settings.credit.value) {
jpm.credit = settings.credit.value
if (Project.credit || settings.credit.value) {
jpm.credit = Project.credit || settings.credit.value
}
var submodels = []
@ -90,6 +90,7 @@ var part_codec = new Codec('optifine_part', {
Undo.initEdit({elements: new_cubes, outliner: true, uv_mode: true})
}
if (typeof model.credit == 'string') Project.credit = model.credit;
var resolution = model.textureSize;
if (resolution.length == 2) {
Project.texture_width = parseInt(resolution[0])||0;

View File

@ -392,6 +392,10 @@ new Property(ModelProject, 'string', 'modded_entity_version', {
return options;
}
});
new Property(ModelProject, 'string', 'credit', {
label: 'dialog.project.credit',
condition: () => Project.credit && Project.credit !== settings.credit.value
});
new Property(ModelProject, 'boolean', 'modded_entity_flip_y', {
label: 'dialog.project.modded_entity_flip_y',
default: true,
@ -768,7 +772,7 @@ BARS.defineActions(function() {
for (var key in ModelProject.properties) {
let property = ModelProject.properties[key];
if (property.exposed == false || !Condition(property.condition)) continue;
if (property.exposed === false || !Condition(property.condition)) continue;
let entry = form[property.name] = {
label: property.label,

View File

@ -352,7 +352,7 @@
"dialog.project.name": "File Name",
"dialog.project.parent": "Parent Model",
"dialog.project.geoname": "Model Identifier",
"dialog.project.openparent": "Open Parent",
"dialog.project.credit": "Credit",
"dialog.project.modded_entity_version": "Export Version",
"dialog.project.modded_entity_flip_y": "Flip Y Axis",
"dialog.project.ao": "Ambient Occlusion",