split tilesets bigger than 4096x4096
parent
486a1f2683
commit
fdaadcd9ae
|
@ -469,11 +469,11 @@
|
||||||
{
|
{
|
||||||
"columns":18,
|
"columns":18,
|
||||||
"firstgid":321,
|
"firstgid":321,
|
||||||
"image":"imgs\/cija_32x32_expansion for Pipoya_CC0.png",
|
"image":"imgs\/cija_32x32_expansion for Pipoya_CC0_0000.png",
|
||||||
"imageheight":4256,
|
"imageheight":4096,
|
||||||
"imagewidth":576,
|
"imagewidth":576,
|
||||||
"margin":0,
|
"margin":0,
|
||||||
"name":"cija_32x32_expansion for Pipoya_CC0",
|
"name":"cija_32x32_expansion for Pipoya_CC0 (0, 0)",
|
||||||
"properties":[
|
"properties":[
|
||||||
{
|
{
|
||||||
"name":"tilesetCopyright",
|
"name":"tilesetCopyright",
|
||||||
|
@ -481,7 +481,26 @@
|
||||||
"value":"CC0"
|
"value":"CC0"
|
||||||
}],
|
}],
|
||||||
"spacing":0,
|
"spacing":0,
|
||||||
"tilecount":2394,
|
"tilecount":2304,
|
||||||
|
"tileheight":32,
|
||||||
|
"tilewidth":32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"columns":18,
|
||||||
|
"firstgid":2625,
|
||||||
|
"image":"imgs\/cija_32x32_expansion for Pipoya_CC0_0001.png",
|
||||||
|
"imageheight":160,
|
||||||
|
"imagewidth":576,
|
||||||
|
"margin":0,
|
||||||
|
"name":"cija_32x32_expansion for Pipoya_CC0 (0, 1)",
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"tilesetCopyright",
|
||||||
|
"type":"string",
|
||||||
|
"value":"CC0"
|
||||||
|
}],
|
||||||
|
"spacing":0,
|
||||||
|
"tilecount":90,
|
||||||
"tileheight":32,
|
"tileheight":32,
|
||||||
"tilewidth":32
|
"tilewidth":32
|
||||||
},
|
},
|
||||||
|
|
|
@ -455,11 +455,11 @@
|
||||||
{
|
{
|
||||||
"columns":18,
|
"columns":18,
|
||||||
"firstgid":321,
|
"firstgid":321,
|
||||||
"image":"imgs\/cija_32x32_expansion for Pipoya_CC0.png",
|
"image":"imgs\/cija_32x32_expansion for Pipoya_CC0_0000.png",
|
||||||
"imageheight":4256,
|
"imageheight":4096,
|
||||||
"imagewidth":576,
|
"imagewidth":576,
|
||||||
"margin":0,
|
"margin":0,
|
||||||
"name":"cija_32x32_expansion for Pipoya_CC0",
|
"name":"cija_32x32_expansion for Pipoya_CC0 (0, 0)",
|
||||||
"properties":[
|
"properties":[
|
||||||
{
|
{
|
||||||
"name":"tilesetCopyright",
|
"name":"tilesetCopyright",
|
||||||
|
@ -467,7 +467,26 @@
|
||||||
"value":"CC0"
|
"value":"CC0"
|
||||||
}],
|
}],
|
||||||
"spacing":0,
|
"spacing":0,
|
||||||
"tilecount":2394,
|
"tilecount":2304,
|
||||||
|
"tileheight":32,
|
||||||
|
"tilewidth":32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"columns":18,
|
||||||
|
"firstgid":2625,
|
||||||
|
"image":"imgs\/cija_32x32_expansion for Pipoya_CC0_0001.png",
|
||||||
|
"imageheight":160,
|
||||||
|
"imagewidth":576,
|
||||||
|
"margin":0,
|
||||||
|
"name":"cija_32x32_expansion for Pipoya_CC0 (0, 1)",
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"tilesetCopyright",
|
||||||
|
"type":"string",
|
||||||
|
"value":"CC0"
|
||||||
|
}],
|
||||||
|
"spacing":0,
|
||||||
|
"tilecount":90,
|
||||||
"tileheight":32,
|
"tileheight":32,
|
||||||
"tilewidth":32
|
"tilewidth":32
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,11 +18,17 @@
|
||||||
</properties>
|
</properties>
|
||||||
<image source="imgs/tilesets_deviant_milkian_1.png" width="512" height="512"/>
|
<image source="imgs/tilesets_deviant_milkian_1.png" width="512" height="512"/>
|
||||||
</tileset>
|
</tileset>
|
||||||
<tileset firstgid="321" name="cija_32x32_expansion for Pipoya_CC0" tilewidth="32" tileheight="32" tilecount="2394" columns="18">
|
<tileset firstgid="321" name="cija_32x32_expansion for Pipoya_CC0 (0, 0)" tilewidth="32" tileheight="32" tilecount="2304" columns="18">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="tilesetCopyright" value="CC0"/>
|
<property name="tilesetCopyright" value="CC0"/>
|
||||||
</properties>
|
</properties>
|
||||||
<image source="imgs/cija_32x32_expansion for Pipoya_CC0.png" width="576" height="4256"/>
|
<image source="imgs/cija_32x32_expansion for Pipoya_CC0_0000.png" width="576" height="4096"/>
|
||||||
|
</tileset>
|
||||||
|
<tileset firstgid="2625" name="cija_32x32_expansion for Pipoya_CC0 (0, 1)" tilewidth="32" tileheight="32" tilecount="90" columns="18">
|
||||||
|
<properties>
|
||||||
|
<property name="tilesetCopyright" value="CC0"/>
|
||||||
|
</properties>
|
||||||
|
<image source="imgs/cija_32x32_expansion for Pipoya_CC0_0001.png" width="576" height="160"/>
|
||||||
</tileset>
|
</tileset>
|
||||||
<tileset firstgid="2715" name="01_door" tilewidth="32" tileheight="32" tilecount="8" columns="4">
|
<tileset firstgid="2715" name="01_door" tilewidth="32" tileheight="32" tilecount="8" columns="4">
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -18,11 +18,17 @@
|
||||||
</properties>
|
</properties>
|
||||||
<image source="imgs/tilesets_deviant_milkian_1.png" width="512" height="512"/>
|
<image source="imgs/tilesets_deviant_milkian_1.png" width="512" height="512"/>
|
||||||
</tileset>
|
</tileset>
|
||||||
<tileset firstgid="321" name="cija_32x32_expansion for Pipoya_CC0" tilewidth="32" tileheight="32" tilecount="2394" columns="18">
|
<tileset firstgid="321" name="cija_32x32_expansion for Pipoya_CC0 (0, 0)" tilewidth="32" tileheight="32" tilecount="2304" columns="18">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="tilesetCopyright" value="CC0"/>
|
<property name="tilesetCopyright" value="CC0"/>
|
||||||
</properties>
|
</properties>
|
||||||
<image source="imgs/cija_32x32_expansion for Pipoya_CC0.png" width="576" height="4256"/>
|
<image source="imgs/cija_32x32_expansion for Pipoya_CC0_0000.png" width="576" height="4096"/>
|
||||||
|
</tileset>
|
||||||
|
<tileset firstgid="2625" name="cija_32x32_expansion for Pipoya_CC0 (0, 1)" tilewidth="32" tileheight="32" tilecount="90" columns="18">
|
||||||
|
<properties>
|
||||||
|
<property name="tilesetCopyright" value="CC0"/>
|
||||||
|
</properties>
|
||||||
|
<image source="imgs/cija_32x32_expansion for Pipoya_CC0_0001.png" width="576" height="160"/>
|
||||||
</tileset>
|
</tileset>
|
||||||
<tileset firstgid="2715" name="01_door" tilewidth="32" tileheight="32" tilecount="8" columns="4">
|
<tileset firstgid="2715" name="01_door" tilewidth="32" tileheight="32" tilecount="8" columns="4">
|
||||||
<properties>
|
<properties>
|
||||||
|
|
10
heizhaus.tmx
10
heizhaus.tmx
|
@ -18,11 +18,17 @@
|
||||||
</properties>
|
</properties>
|
||||||
<image source="imgs/tilesets_deviant_milkian_1.png" width="512" height="512"/>
|
<image source="imgs/tilesets_deviant_milkian_1.png" width="512" height="512"/>
|
||||||
</tileset>
|
</tileset>
|
||||||
<tileset firstgid="321" name="cija_32x32_expansion for Pipoya_CC0" tilewidth="32" tileheight="32" tilecount="2394" columns="18">
|
<tileset firstgid="321" name="cija_32x32_expansion for Pipoya_CC0 (0, 0)" tilewidth="32" tileheight="32" tilecount="2304" columns="18">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="tilesetCopyright" value="CC0"/>
|
<property name="tilesetCopyright" value="CC0"/>
|
||||||
</properties>
|
</properties>
|
||||||
<image source="imgs/cija_32x32_expansion for Pipoya_CC0.png" width="576" height="4256"/>
|
<image source="imgs/cija_32x32_expansion for Pipoya_CC0_0000.png" width="576" height="4096"/>
|
||||||
|
</tileset>
|
||||||
|
<tileset firstgid="2625" name="cija_32x32_expansion for Pipoya_CC0 (0, 1)" tilewidth="32" tileheight="32" tilecount="90" columns="18">
|
||||||
|
<properties>
|
||||||
|
<property name="tilesetCopyright" value="CC0"/>
|
||||||
|
</properties>
|
||||||
|
<image source="imgs/cija_32x32_expansion for Pipoya_CC0_0001.png" width="576" height="160"/>
|
||||||
</tileset>
|
</tileset>
|
||||||
<tileset firstgid="2715" name="01_door" tilewidth="32" tileheight="32" tilecount="8" columns="4">
|
<tileset firstgid="2715" name="01_door" tilewidth="32" tileheight="32" tilecount="8" columns="4">
|
||||||
<properties>
|
<properties>
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 618 KiB |
Binary file not shown.
After Width: | Height: | Size: 588 KiB |
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
27
main.json
27
main.json
|
@ -802,11 +802,11 @@
|
||||||
{
|
{
|
||||||
"columns":18,
|
"columns":18,
|
||||||
"firstgid":321,
|
"firstgid":321,
|
||||||
"image":"imgs\/cija_32x32_expansion for Pipoya_CC0.png",
|
"image":"imgs\/cija_32x32_expansion for Pipoya_CC0_0000.png",
|
||||||
"imageheight":4256,
|
"imageheight":4096,
|
||||||
"imagewidth":576,
|
"imagewidth":576,
|
||||||
"margin":0,
|
"margin":0,
|
||||||
"name":"cija_32x32_expansion for Pipoya_CC0",
|
"name":"cija_32x32_expansion for Pipoya_CC0 (0, 0)",
|
||||||
"properties":[
|
"properties":[
|
||||||
{
|
{
|
||||||
"name":"tilesetCopyright",
|
"name":"tilesetCopyright",
|
||||||
|
@ -814,7 +814,26 @@
|
||||||
"value":"CC0"
|
"value":"CC0"
|
||||||
}],
|
}],
|
||||||
"spacing":0,
|
"spacing":0,
|
||||||
"tilecount":2394,
|
"tilecount":2304,
|
||||||
|
"tileheight":32,
|
||||||
|
"tilewidth":32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"columns":18,
|
||||||
|
"firstgid":2625,
|
||||||
|
"image":"imgs\/cija_32x32_expansion for Pipoya_CC0_0001.png",
|
||||||
|
"imageheight":160,
|
||||||
|
"imagewidth":576,
|
||||||
|
"margin":0,
|
||||||
|
"name":"cija_32x32_expansion for Pipoya_CC0 (0, 1)",
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"tilesetCopyright",
|
||||||
|
"type":"string",
|
||||||
|
"value":"CC0"
|
||||||
|
}],
|
||||||
|
"spacing":0,
|
||||||
|
"tilecount":90,
|
||||||
"tileheight":32,
|
"tileheight":32,
|
||||||
"tilewidth":32
|
"tilewidth":32
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
from copy import copy
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
@ -164,13 +165,13 @@ def separate_collisions(map):
|
||||||
|
|
||||||
|
|
||||||
def split_tilesets(map):
|
def split_tilesets(map):
|
||||||
# we need the offset of the tileset inside the map element to insert new tilesets correctly
|
for tileset in map.findall("tileset"):
|
||||||
for offset, tileset in enumerate(map):
|
|
||||||
if tileset.tag != "tileset":
|
|
||||||
continue
|
|
||||||
image = tileset.find("image")
|
image = tileset.find("image")
|
||||||
if int(image.attrib["width"]) <= 4096 and int(image.attrib["height"]) <= 4096:
|
if int(image.attrib["width"]) <= 4096 and int(image.attrib["height"]) <= 4096:
|
||||||
continue
|
continue
|
||||||
|
if int(image.attrib["width"]) > 4096:
|
||||||
|
print("Can't split tileset '%s'. Spliting of width > 4096 not implemented." % tileset.attrib["name"])
|
||||||
|
continue
|
||||||
dosplit = input("Split tileset '%s'? [yN] " % tileset.attrib["name"])
|
dosplit = input("Split tileset '%s'? [yN] " % tileset.attrib["name"])
|
||||||
if dosplit.lower() != "y":
|
if dosplit.lower() != "y":
|
||||||
continue
|
continue
|
||||||
|
@ -201,10 +202,10 @@ def split_tilesets(map):
|
||||||
tilecount=str(tilecount),
|
tilecount=str(tilecount),
|
||||||
columns=str(columns),
|
columns=str(columns),
|
||||||
)
|
)
|
||||||
map.insert(offset + i + j, tileset_croped)
|
tileset.addprevious(tileset_croped)
|
||||||
firstgid += tilecount
|
firstgid += tilecount
|
||||||
if properties is not None:
|
if properties is not None:
|
||||||
tileset_croped.append(properties)
|
tileset_croped.append(copy(properties))
|
||||||
etree.SubElement(
|
etree.SubElement(
|
||||||
tileset_croped,
|
tileset_croped,
|
||||||
"image",
|
"image",
|
||||||
|
|
Loading…
Reference in New Issue