support for image overlays
This commit is contained in:
parent
d2a4513852
commit
36f3e39305
@ -103,50 +103,30 @@ Vue.component("item-preview-normal", {
|
|||||||
// +Y, -Y, +X, -X, +Z, -Z
|
// +Y, -Y, +X, -X, +Z, -Z
|
||||||
let tiles = this.item.tiles;
|
let tiles = this.item.tiles;
|
||||||
|
|
||||||
// TODO: optimize!
|
if (tiles.length >= 1)
|
||||||
if (tiles.length == 1){
|
this.top = mtinfo.parseimagetransforms(tiles[0]);
|
||||||
this.top.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
if (tiles.length >= 2)
|
||||||
this.bottom.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
this.bottom = mtinfo.parseimagetransforms(tiles[1]);
|
||||||
this.front.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
if (tiles.length >= 3)
|
||||||
this.back.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
this.front = mtinfo.parseimagetransforms(tiles[2]);
|
||||||
this.right.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
if (tiles.length >= 4)
|
||||||
this.left.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
this.back = mtinfo.parseimagetransforms(tiles[3]);
|
||||||
} else if (tiles.length == 2){
|
if (tiles.length >= 5)
|
||||||
this.top.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
this.right = mtinfo.parseimagetransforms(tiles[4]);
|
||||||
this.bottom.push("textures/" + mtinfo.stripimagetransforms(tiles[1]));
|
if (tiles.length >= 6)
|
||||||
this.front.push("textures/" + mtinfo.stripimagetransforms(tiles[1]));
|
this.left = mtinfo.parseimagetransforms(tiles[5]);
|
||||||
this.back.push("textures/" + mtinfo.stripimagetransforms(tiles[1]));
|
|
||||||
this.right.push("textures/" + mtinfo.stripimagetransforms(tiles[1]));
|
// populate missing tiles
|
||||||
this.left.push("textures/" + mtinfo.stripimagetransforms(tiles[1]));
|
if (this.bottom.length == 0)
|
||||||
} else if (tiles.length == 3){
|
this.bottom = this.top;
|
||||||
this.top.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
if (this.front.length == 0)
|
||||||
this.bottom.push("textures/" + mtinfo.stripimagetransforms(tiles[1]));
|
this.front = this.bottom;
|
||||||
this.front.push("textures/" + mtinfo.stripimagetransforms(tiles[2]));
|
if (this.back.length == 0)
|
||||||
this.back.push("textures/" + mtinfo.stripimagetransforms(tiles[2]));
|
this.back = this.front;
|
||||||
this.right.push("textures/" + mtinfo.stripimagetransforms(tiles[2]));
|
if (this.right.length == 0)
|
||||||
this.left.push("textures/" + mtinfo.stripimagetransforms(tiles[2]));
|
this.right = this.back;
|
||||||
} else if (tiles.length == 4){
|
if (this.left.length == 0)
|
||||||
this.top.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
this.left = this.right;
|
||||||
this.bottom.push("textures/" + mtinfo.stripimagetransforms(tiles[1]));
|
|
||||||
this.front.push("textures/" + mtinfo.stripimagetransforms(tiles[2]));
|
|
||||||
this.back.push("textures/" + mtinfo.stripimagetransforms(tiles[3]));
|
|
||||||
this.right.push("textures/" + mtinfo.stripimagetransforms(tiles[3]));
|
|
||||||
this.left.push("textures/" + mtinfo.stripimagetransforms(tiles[3]));
|
|
||||||
} else if (tiles.length == 5){
|
|
||||||
this.top.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
|
||||||
this.bottom.push("textures/" + mtinfo.stripimagetransforms(tiles[1]));
|
|
||||||
this.front.push("textures/" + mtinfo.stripimagetransforms(tiles[2]));
|
|
||||||
this.back.push("textures/" + mtinfo.stripimagetransforms(tiles[3]));
|
|
||||||
this.right.push("textures/" + mtinfo.stripimagetransforms(tiles[4]));
|
|
||||||
this.left.push("textures/" + mtinfo.stripimagetransforms(tiles[4]));
|
|
||||||
} else if (tiles.length == 6){
|
|
||||||
this.top.push("textures/" + mtinfo.stripimagetransforms(tiles[0]));
|
|
||||||
this.bottom.push("textures/" + mtinfo.stripimagetransforms(tiles[1]));
|
|
||||||
this.front.push("textures/" + mtinfo.stripimagetransforms(tiles[2]));
|
|
||||||
this.back.push("textures/" + mtinfo.stripimagetransforms(tiles[3]));
|
|
||||||
this.right.push("textures/" + mtinfo.stripimagetransforms(tiles[4]));
|
|
||||||
this.left.push("textures/" + mtinfo.stripimagetransforms(tiles[5]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -32,7 +32,7 @@ Vue.component("paged-table", {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="item in items">
|
<tr v-for="item in items" v-bind:key="item.name">
|
||||||
<slot v-bind:item="item" name="row"></slot>
|
<slot v-bind:item="item" name="row"></slot>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -9,6 +9,23 @@ mtinfo.stripimagetransforms = function(imgSrc){
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mtinfo.parseimagetransforms = function(str){
|
||||||
|
if (!str || typeof(str) != "string")
|
||||||
|
return ["textures/unknown_node.png"];
|
||||||
|
|
||||||
|
let parts = str.split("^");
|
||||||
|
return parts
|
||||||
|
.map(function(part){
|
||||||
|
if (part && part[0] == "[")
|
||||||
|
return;
|
||||||
|
// prefix
|
||||||
|
return "textures/" + part;
|
||||||
|
})
|
||||||
|
.filter(function(part){
|
||||||
|
return !!part;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
mtinfo.imageresolver = function(node){
|
mtinfo.imageresolver = function(node){
|
||||||
var imgSrc = "textures/unknown_node.png";
|
var imgSrc = "textures/unknown_node.png";
|
||||||
if (node.inventory_image){
|
if (node.inventory_image){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user