v2.0.1
This commit is contained in:
parent
e41af39ffe
commit
5392819fe2
@ -1128,6 +1128,9 @@
|
||||
.UVEditor {
|
||||
position: relative;
|
||||
}
|
||||
.UVEditor > .toolbar {
|
||||
margin-top: 3px;
|
||||
}
|
||||
#uv_dialog_all .UVEditor {
|
||||
float: left;
|
||||
padding: 8px;
|
||||
@ -1995,57 +1998,6 @@
|
||||
content: "\f005";
|
||||
}
|
||||
|
||||
@media (max-width:790px) {
|
||||
.mode_tab {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:628px) {
|
||||
body {
|
||||
display: grid;
|
||||
grid-template-columns: 100%;
|
||||
grid-template-rows: 40px calc(100% - 66px) 26px;
|
||||
grid-template-areas:
|
||||
"mode_bar"
|
||||
"main"
|
||||
"status_bar";
|
||||
}
|
||||
.mobile_only {
|
||||
display: block;
|
||||
}
|
||||
.dialog {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
#mobile_tab_bar {
|
||||
grid-area: mode_bar;
|
||||
height: 40px;
|
||||
background-color: var(--color-ui);
|
||||
}
|
||||
.mobile_mode_tab {
|
||||
height: 40px;
|
||||
width: 25%;
|
||||
float: left;
|
||||
padding-top: 8px;
|
||||
cursor: default;
|
||||
text-align: center;
|
||||
color: var(--color-text);
|
||||
}
|
||||
.mobile_mode_tab:hover {
|
||||
color: var(--color-light);
|
||||
}
|
||||
.mobile_mode_tab.open {
|
||||
background-color: var(--color-selected);
|
||||
color: var(--color-light);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#cubes_list > div > ul > li > ul > li:last-child {
|
||||
margin-bottom: 180px;
|
||||
|
24
index.html
24
index.html
@ -64,8 +64,22 @@
|
||||
<script src="js/plugin_loader.js"></script>
|
||||
<script>if (window.module) module = window.module;</script>
|
||||
|
||||
<div id="post_model" class="web_only post_data" hidden></div>
|
||||
<div id="post_textures" class="web_only post_data" hidden></div>
|
||||
<div id="post_model" class="web_only post_data" hidden><?php
|
||||
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||
$model = $_POST['model'];
|
||||
if ($model != "text") {
|
||||
echo $model;
|
||||
}
|
||||
}
|
||||
?></div>
|
||||
<div id="post_textures" class="web_only post_data" hidden><?php
|
||||
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||
$textures = $_POST['textures'];
|
||||
if ($textures != "text") {
|
||||
echo $textures;
|
||||
}
|
||||
}
|
||||
?></div>
|
||||
<div style="display: none;"></div>
|
||||
<!---->
|
||||
<div id="blackout" onclick="$('.dialog#'+open_dialog).find('.cancel_btn:not([disabled])').click()"></div>
|
||||
@ -854,12 +868,6 @@
|
||||
{{ Prop.fps }} FPS
|
||||
</div>
|
||||
</div>
|
||||
<div class="mobile_only" id="mobile_tab_bar">
|
||||
<div class="tl mobile_mode_tab open" id="mobile_tab_preview" onclick="setMobileTab('preview')">mobile_tab.preview</div>
|
||||
<div class="tl mobile_mode_tab" id="mobile_tab_textures" onclick="setMobileTab('textures')">mobile_tab.textures</div>
|
||||
<div class="tl mobile_mode_tab" id="mobile_tab_elements" onclick="setMobileTab('elements')">mobile_tab.elements</div>
|
||||
<div class="tl mobile_mode_tab" id="mobile_tab_menu" onclick="setMobileTab('menu')">mobile_tab.menu</div>
|
||||
</div>
|
||||
<script>
|
||||
initCanvas()
|
||||
colorSettingsSetup()
|
||||
|
24
index.php
24
index.php
@ -64,22 +64,8 @@
|
||||
<script src="js/plugin_loader.js"></script>
|
||||
<script>if (window.module) module = window.module;</script>
|
||||
|
||||
<div id="post_model" class="web_only post_data" hidden><?php
|
||||
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||
$model = $_POST['model'];
|
||||
if ($model != "text") {
|
||||
echo $model;
|
||||
}
|
||||
}
|
||||
?></div>
|
||||
<div id="post_textures" class="web_only post_data" hidden><?php
|
||||
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||
$textures = $_POST['textures'];
|
||||
if ($textures != "text") {
|
||||
echo $textures;
|
||||
}
|
||||
}
|
||||
?></div>
|
||||
<div id="post_model" class="web_only post_data" hidden></div>
|
||||
<div id="post_textures" class="web_only post_data" hidden></div>
|
||||
<div style="display: none;"></div>
|
||||
<!---->
|
||||
<div id="blackout" onclick="$('.dialog#'+open_dialog).find('.cancel_btn:not([disabled])').click()"></div>
|
||||
@ -868,12 +854,6 @@
|
||||
{{ Prop.fps }} FPS
|
||||
</div>
|
||||
</div>
|
||||
<div class="mobile_only" id="mobile_tab_bar">
|
||||
<div class="tl mobile_mode_tab open" id="mobile_tab_preview" onclick="setMobileTab('preview')">mobile_tab.preview</div>
|
||||
<div class="tl mobile_mode_tab" id="mobile_tab_textures" onclick="setMobileTab('textures')">mobile_tab.textures</div>
|
||||
<div class="tl mobile_mode_tab" id="mobile_tab_elements" onclick="setMobileTab('elements')">mobile_tab.elements</div>
|
||||
<div class="tl mobile_mode_tab" id="mobile_tab_menu" onclick="setMobileTab('menu')">mobile_tab.menu</div>
|
||||
</div>
|
||||
<script>
|
||||
initCanvas()
|
||||
colorSettingsSetup()
|
||||
|
@ -204,9 +204,7 @@ class Tool extends Action {
|
||||
if (Toolbox.selected && Toolbox.selected.onUnselect && typeof Toolbox.selected.onUnselect == 'function') {
|
||||
Toolbox.selected.onUnselect()
|
||||
}
|
||||
$('.tool.sel').removeClass('sel')
|
||||
Toolbox.selected = this;
|
||||
$('.tool.'+this.id).addClass('sel')
|
||||
|
||||
if (this.transformerMode) {
|
||||
Transformer.setMode(this.transformerMode)
|
||||
@ -223,6 +221,8 @@ class Tool extends Action {
|
||||
}
|
||||
$('#preview').css('cursor', (this.cursor ? this.cursor : 'default'))
|
||||
updateSelection()
|
||||
$('.tool.sel').removeClass('sel')
|
||||
$('.tool.'+this.id).addClass('sel')
|
||||
|
||||
if (typeof this.onSelect == 'function') {
|
||||
this.onSelect()
|
||||
@ -578,7 +578,6 @@ class ColorPicker extends Widget {
|
||||
})
|
||||
}
|
||||
change(color) {
|
||||
this.set( color )
|
||||
if (this.onChange) {
|
||||
this.onChange()
|
||||
}
|
||||
@ -591,7 +590,7 @@ class ColorPicker extends Widget {
|
||||
}
|
||||
set(color) {
|
||||
this.value = new tinycolor(color)
|
||||
this.jq.spectrum('set', this.value.toHexString())
|
||||
this.jq.spectrum('set', this.value.toHex8String())
|
||||
return this;
|
||||
}
|
||||
get() {
|
||||
@ -1514,13 +1513,26 @@ var BARS = {
|
||||
id: 'import_layout',
|
||||
icon: 'folder',
|
||||
category: 'blockbench',
|
||||
click: function () {importLayout()}
|
||||
click: function () {
|
||||
Blockbench.import({
|
||||
extensions: ['bbstyle', 'js'],
|
||||
type: 'Blockbench Style'
|
||||
}, function(files) {
|
||||
applyBBStyle(files[0].content)
|
||||
})
|
||||
}
|
||||
})
|
||||
new Action({
|
||||
id: 'export_layout',
|
||||
icon: 'style',
|
||||
category: 'blockbench',
|
||||
click: function () {exportLayout()}
|
||||
click: function () {
|
||||
Blockbench.export({
|
||||
type: 'Blockbench Style',
|
||||
extensions: ['bbstyle'],
|
||||
content: autoStringify(app_colors)
|
||||
})
|
||||
}
|
||||
})
|
||||
new Action({
|
||||
id: 'reset_layout',
|
||||
@ -1896,7 +1908,7 @@ var BARS = {
|
||||
icon: 'border_clear',
|
||||
category: 'view',
|
||||
keybind: new Keybind({key: 90}),
|
||||
condition: () => Toolbox.selected.allowWireframe,
|
||||
condition: () => Toolbox && Toolbox.selected && Toolbox.selected.allowWireframe,
|
||||
click: function () {toggleWireframe()}
|
||||
})
|
||||
|
||||
@ -2568,7 +2580,7 @@ class Menu {
|
||||
entry = s.menu_node
|
||||
if (BARS.condition(s.condition)) {
|
||||
parent.append(entry)
|
||||
$(entry).mouseenter(function(e) {
|
||||
$(entry).on('mouseenter mousedown', function(e) {
|
||||
scope.hover(this, e)
|
||||
})
|
||||
}
|
||||
@ -2642,9 +2654,16 @@ class Menu {
|
||||
ctxmenu.css('left', offset_left+'px')
|
||||
ctxmenu.css('top', offset_top +'px')
|
||||
|
||||
ctxmenu.click(function() {
|
||||
scope.hide()
|
||||
$(this.node).filter(':not(.tx)').addClass('tx').click(function(ev) {
|
||||
if (
|
||||
ev.target.className.includes('parent') ||
|
||||
(ev.target.parentNode && ev.target.parentNode.className.includes('parent'))
|
||||
) {} else {
|
||||
scope.hide()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
if (this.type === 'bar_menu') {
|
||||
MenuBar.open = this
|
||||
$(this.label).addClass('opened')
|
||||
|
@ -225,7 +225,7 @@ class API {
|
||||
name: options.type ? options.type : options.extensions[0],
|
||||
extensions: options.extensions
|
||||
}],
|
||||
properties: properties,
|
||||
properties: properties.length?properties:undefined,
|
||||
defaultPath: options.startpath
|
||||
},
|
||||
function (fileNames) {
|
||||
|
22
js/app.js
22
js/app.js
@ -413,9 +413,9 @@ function saveFile(props) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFileEntity(content, fileName) {
|
||||
Prop.file_path = fileName
|
||||
fs.readFile(fileName, 'utf-8', function (errx, data) {
|
||||
function writeFileEntity(content, filepath) {
|
||||
Prop.file_path = filepath
|
||||
fs.readFile(filepath, 'utf-8', function (errx, data) {
|
||||
var obj = {}
|
||||
if (!errx) {
|
||||
try {
|
||||
@ -435,8 +435,8 @@ function writeFileEntity(content, fileName) {
|
||||
noLink: false
|
||||
})
|
||||
if (answer === 0) {
|
||||
var backup_file_name = pathToName(fileName, true) + ' backup ' + new Date().toLocaleString().split(':').join('_')
|
||||
backup_file_name = fileName.replace(pathToName(fileName, false), backup_file_name)
|
||||
var backup_file_name = pathToName(filepath, true) + ' backup ' + new Date().toLocaleString().split(':').join('_')
|
||||
backup_file_name = filepath.replace(pathToName(filepath, false), backup_file_name)
|
||||
fs.writeFile(backup_file_name, data, function (err2) {
|
||||
if (err2) {
|
||||
console.log('Error saving backup model: ', err2)
|
||||
@ -483,17 +483,17 @@ function writeFileEntity(content, fileName) {
|
||||
})
|
||||
})
|
||||
}
|
||||
function writeFileObj(content, fileName) {
|
||||
if (fileName === undefined) {
|
||||
function writeFileObj(content, filepath) {
|
||||
if (filepath === undefined) {
|
||||
return;
|
||||
}
|
||||
var content = buildOBJModel(pathToName(fileName, false))
|
||||
var content = buildOBJModel(pathToName(filepath, false))
|
||||
|
||||
//OBJECT
|
||||
fs.writeFile(fileName, content.obj, function (err) {})
|
||||
fs.writeFile(filepath, content.obj, function (err) {})
|
||||
|
||||
//MATERIAL
|
||||
fs.writeFile(fileName.split('.obj').join('.mtl'), content.mtl, function (err) {})
|
||||
fs.writeFile(filepath.split('.obj').join('.mtl'), content.mtl, function (err) {})
|
||||
|
||||
//IMAGES
|
||||
if (settings.obj_textures.value === true) {
|
||||
@ -506,7 +506,7 @@ function writeFileObj(content, fileName) {
|
||||
var native_image_instance = nativeImage.createFromDataURL(texture.source)
|
||||
}
|
||||
var image = native_image_instance.toPNG()
|
||||
var image_path = fileName.split(osfs)
|
||||
var image_path = filepath.split(osfs)
|
||||
image_path.pop()
|
||||
image_path = image_path.join(osfs) + osfs + texture.name
|
||||
if (image_path.substr(-4) !== '.png') {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const appVersion = '2.0.0'
|
||||
const appVersion = '2.0.1'
|
||||
var osfs = '/'
|
||||
var File, i;
|
||||
const elements = [];
|
||||
@ -736,7 +736,11 @@ TextureAnimator = {
|
||||
var update = false
|
||||
for (var face in obj.faces) {
|
||||
if (update === false) {
|
||||
update = (obj.faces.hasOwnProperty(face) && animated_tex.includes(obj.faces[face].texture.replace(/^#/, '')))
|
||||
update = (
|
||||
obj.faces.hasOwnProperty(face) &&
|
||||
typeof obj.faces[face].texture === 'string' &&
|
||||
animated_tex.includes(obj.faces[face].texture.replace(/^#/, ''))
|
||||
)
|
||||
}
|
||||
}
|
||||
if (update) {
|
||||
|
@ -543,11 +543,6 @@ function updateUIColor() {
|
||||
}
|
||||
|
||||
//BBLayout
|
||||
function importLayout() {
|
||||
Blockbench.import('bbstyle', function(content) {
|
||||
applyBBStyle(content)
|
||||
})
|
||||
}
|
||||
function applyBBStyle(data) {
|
||||
if (typeof data === 'string') {
|
||||
try {
|
||||
@ -566,9 +561,6 @@ function applyBBStyle(data) {
|
||||
}
|
||||
updateUIColor()
|
||||
}
|
||||
function exportLayout() {
|
||||
Blockbench.export(autoStringify(app_colors), 'layout', 'bbstyle')
|
||||
}
|
||||
|
||||
//UI Edit
|
||||
function setProgressBar(id, val, time) {
|
||||
@ -622,28 +614,3 @@ var splashScreen = {
|
||||
})
|
||||
}
|
||||
Promise.all([splashScreen.p_doc, splashScreen.p_force]).then(splashScreen.attempt)
|
||||
|
||||
//Mobile
|
||||
function setMobileTab(mode) {
|
||||
$('.mobile_mode_tab').removeClass('open')
|
||||
$('#mobile_tab_'+mode).addClass('open')
|
||||
//
|
||||
$('.sidebar').css('grid-area', '')
|
||||
$('#preview').css('grid-area', '')
|
||||
$('header').css('grid-area', '')
|
||||
switch (mode) {
|
||||
case 'preview':
|
||||
$('#preview').css('grid-area', 'main')
|
||||
break;
|
||||
case 'textures':
|
||||
$('#left_bar').css('grid-area', 'main')
|
||||
break;
|
||||
case 'elements':
|
||||
$('#right_bar').css('grid-area', 'main')
|
||||
break;
|
||||
case 'menu':
|
||||
$('header').css('grid-area', 'main')
|
||||
break;
|
||||
}
|
||||
resizeWindow()
|
||||
}
|
@ -356,8 +356,7 @@ class BBPainter {
|
||||
updateSelection()
|
||||
}
|
||||
addBitmapFromDialog() {
|
||||
var color = Painter.background_color.get().toRgb()
|
||||
color = Jimp.rgbaToInt(color.r, color.g, color.b, color.a*255)
|
||||
var color = Painter.background_color.get()
|
||||
|
||||
Painter.addBitmap({
|
||||
res: limitNumber(parseInt($('.dialog#add_bitmap input#bitmap_resolution').val()), 1, 2048),
|
||||
@ -376,7 +375,7 @@ class BBPainter {
|
||||
options.res = 16
|
||||
}
|
||||
if (options.color === undefined) {
|
||||
options.color = 0xffffffff
|
||||
options.color = new tinycolor().toRgb()
|
||||
}
|
||||
var texture = new Texture({
|
||||
mode: 'bitmap',
|
||||
@ -407,7 +406,7 @@ class BBPainter {
|
||||
}
|
||||
}
|
||||
generateBlank(height, width, color, cb) {
|
||||
new Jimp(height, width, color, function(err, image) {
|
||||
new Jimp(height, width, color.toInteger(), function(err, image) {
|
||||
image.getBase64("image/png", function(a, dataUrl){
|
||||
cb(dataUrl)
|
||||
})
|
||||
@ -525,9 +524,13 @@ class BBPainter {
|
||||
//Size
|
||||
var max_size = Math.max(max_x_pos, line_y_pos)
|
||||
max_size = Math.ceil(max_size/16)*16//getNextPower(max_size, 16)
|
||||
|
||||
if (background_color.getAlpha() != 0) {
|
||||
background_color = background_color.toInteger()
|
||||
}
|
||||
|
||||
function drawTemplateRectangle(image, border_color, color, coords) {
|
||||
if (background_color != 0) {
|
||||
if (typeof background_color === 'number') {
|
||||
border_color = background_color
|
||||
color = undefined
|
||||
}
|
||||
|
15
js/uv.js
15
js/uv.js
@ -313,11 +313,12 @@ class UVEditor {
|
||||
this.setSize(this.size)
|
||||
return this;
|
||||
}
|
||||
getBrushCoordinates(event) {
|
||||
getBrushCoordinates(event, tex) {
|
||||
var scope = this;
|
||||
var multiplier = tex ? tex.res/Project.texture_width : 1
|
||||
return {
|
||||
x: Math.floor(event.offsetX/scope.getPixelSize()),
|
||||
y: Math.floor(event.offsetY/scope.getPixelSize())
|
||||
x: Math.floor(event.offsetX/scope.getPixelSize()*multiplier),
|
||||
y: Math.floor(event.offsetY/scope.getPixelSize()*multiplier)
|
||||
}
|
||||
}
|
||||
startBrush(event) {
|
||||
@ -326,8 +327,8 @@ class UVEditor {
|
||||
|
||||
var texture = scope.getTexture()
|
||||
if (texture) {
|
||||
var x = scope.getBrushCoordinates(event).x
|
||||
var y = scope.getBrushCoordinates(event).y
|
||||
var x = scope.getBrushCoordinates(event, texture).x
|
||||
var y = scope.getBrushCoordinates(event, texture).y
|
||||
Painter.startBrush(texture, x, y, undefined, event)
|
||||
}
|
||||
if (event.altKey === false && texture && texture.mode !== 'link') {
|
||||
@ -341,8 +342,8 @@ class UVEditor {
|
||||
if (!texture) {
|
||||
Blockbench.showQuickMessage('message.untextured')
|
||||
} else {
|
||||
var x = scope.getBrushCoordinates(event).x
|
||||
var y = scope.getBrushCoordinates(event).y
|
||||
var x = scope.getBrushCoordinates(event, texture).x
|
||||
var y = scope.getBrushCoordinates(event, texture).y
|
||||
Painter.useBrush(texture, x, y)
|
||||
}
|
||||
}
|
||||
|
@ -744,5 +744,6 @@
|
||||
"message.image_editor_missing.message": "Wähle die Programmdatei deines Bildbearbeitungsprogramms",
|
||||
"message.image_editor_missing.detail": "Blockbench konnte kein Bildbearbeitungsprogramm auf deinem Computer finden. Wähle die Programmdatei eines Bildbearbeitungsprogramms aus.",
|
||||
"action.update_autouv": "Auto UV berechnen",
|
||||
"category.uv": "UV",
|
||||
"action.update_autouv.desc": "Berechnet das automatische UV Mapping für die ausgewählten Elemente neu"
|
||||
}
|
@ -366,6 +366,7 @@
|
||||
"category.view": "View",
|
||||
"category.display": "Display Settings",
|
||||
"category.textures": "Textures",
|
||||
"category.uv": "UV",
|
||||
"category.misc": "Miscellaneous",
|
||||
|
||||
"keybind.preview_select": "Select",
|
||||
|
@ -744,5 +744,6 @@
|
||||
"message.image_editor_missing.message": "Selecciona el archivo ejecutable de tu editor de imágenes.",
|
||||
"message.image_editor_missing.detail": "Blockbench no pudo encontrar un editor de imágenes en tu ordenador. Selecciona el archivo ejecutable de tu editor de imágenes preferido.",
|
||||
"action.update_autouv": "Actualizar Auto UV",
|
||||
"category.uv": "UV",
|
||||
"action.update_autouv.desc": "Actualiza el mapeado del auto UV en los cubos seleccionados"
|
||||
}
|
@ -744,5 +744,6 @@
|
||||
"message.image_editor_missing.message": "使用可能な画像エディタファイルを選択します",
|
||||
"message.image_editor_missing.detail": "Blockbenchは使用可能な画像ファイルを見つけることが出来ませんでした。",
|
||||
"action.update_autouv": "自動UVを更新",
|
||||
"category.uv": "UV",
|
||||
"action.update_autouv.desc": "選択したキューブの自動UVを更新する"
|
||||
}
|
@ -744,5 +744,6 @@
|
||||
"message.image_editor_missing.message": "Selecteer het executeerbare bestand van je afbeeldingsbewerker.",
|
||||
"message.image_editor_missing.detail": "Blockbench kon geen afbeelding editor vinden op jouw computer. Selecteer het executeerbare bestand van jouw gewenste afbeeldingsbewerker.",
|
||||
"action.update_autouv": "Update Auto UV",
|
||||
"category.uv": "UV",
|
||||
"action.update_autouv.desc": "Update de auto UV van de geselecteerde"
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Blockbench",
|
||||
"description": "Minecraft Block Model Editor",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "JannisX11",
|
||||
|
Loading…
x
Reference in New Issue
Block a user