fix copyright properties

This commit is contained in:
Thomas Lindner 2021-12-26 16:31:15 +01:00
parent f2112b26c5
commit de7bd04829
7 changed files with 130 additions and 0 deletions

View file

@ -392,6 +392,12 @@
"nextlayerid":39,
"nextobjectid":2,
"orientation":"orthogonal",
"properties":[
{
"name":"mapCopyright",
"type":"string",
"value":"CC0"
}],
"renderorder":"right-down",
"tiledversion":"1.3.1",
"tileheight":32,
@ -7107,6 +7113,12 @@
"imagewidth":128,
"margin":0,
"name":"nopslide",
"properties":[
{
"name":"tilesetCopyright",
"type":"string",
"value":"CC0"
}],
"spacing":0,
"tilecount":16,
"tileheight":32,

View file

@ -388,6 +388,12 @@
"nextlayerid":37,
"nextobjectid":1,
"orientation":"orthogonal",
"properties":[
{
"name":"mapCopyright",
"type":"string",
"value":"CC0"
}],
"renderorder":"right-down",
"tiledversion":"1.3.1",
"tileheight":32,

View file

@ -3,6 +3,9 @@
<editorsettings>
<export target="basement.json" format="json"/>
</editorsettings>
<properties>
<property name="mapCopyright" value="CC0"/>
</properties>
<tileset firstgid="1" name="floortileset" tilewidth="32" tileheight="32" tilecount="64" columns="8">
<properties>
<property name="tilesetCopyright" value="CC0"/>
@ -3671,6 +3674,9 @@
<image source="imgs/minideko.png" width="224" height="416"/>
</tileset>
<tileset firstgid="3395" name="nopslide" tilewidth="32" tileheight="32" tilecount="16" columns="4">
<properties>
<property name="tilesetCopyright" value="CC0"/>
</properties>
<image source="imgs/nopslide.png" width="128" height="128"/>
</tileset>
<layer id="4" name="start" width="100" height="50">

View file

@ -3,6 +3,9 @@
<editorsettings>
<export target="first-floor.json" format="json"/>
</editorsettings>
<properties>
<property name="mapCopyright" value="CC0"/>
</properties>
<tileset firstgid="1" name="floortileset" tilewidth="32" tileheight="32" tilecount="64" columns="8">
<properties>
<property name="tilesetCopyright" value="CC0"/>

View file

@ -3694,18 +3694,33 @@
<image source="imgs/minideko.png" width="224" height="416"/>
</tileset>
<tileset firstgid="3395" name="worldExit" tilewidth="32" tileheight="32" tilecount="4" columns="2">
<properties>
<property name="tilesetCopyright" value="CC0"/>
</properties>
<image source="world-tiles/rc3-2021/worldExit.png" width="64" height="64"/>
</tileset>
<tileset firstgid="3399" name="023_Fairydust" tilewidth="32" tileheight="32" tilecount="8" columns="2">
<properties>
<property name="tilesetCopyright" value="CC0"/>
</properties>
<image source="world-tiles/community/cert/imgs/misc/023_Fairydust.png" width="64" height="128"/>
</tileset>
<tileset firstgid="3407" name="wintiles" tilewidth="32" tileheight="32" tilecount="1024" columns="16">
<properties>
<property name="tilesetCopyright" value="CC0"/>
</properties>
<image source="world-tiles/community/cert/imgs/tilesheets/wintiles.png" width="512" height="2048"/>
</tileset>
<tileset firstgid="4431" name="cija_32x32_basic_CC0" tilewidth="32" tileheight="32" tilecount="600" columns="20">
<properties>
<property name="tilesetCopyright" value="CC0"/>
</properties>
<image source="world-tiles/community/bytewerk/cija_32x32_basic_CC0.png" width="640" height="960"/>
</tileset>
<tileset firstgid="5031" name="nopslide" tilewidth="32" tileheight="32" tilecount="16" columns="4">
<properties>
<property name="tilesetCopyright" value="CC0"/>
</properties>
<image source="imgs/nopslide.png" width="128" height="128"/>
</tileset>
<layer id="4" name="start" width="100" height="50">

View file

@ -7518,6 +7518,12 @@
"imagewidth":64,
"margin":0,
"name":"worldExit",
"properties":[
{
"name":"tilesetCopyright",
"type":"string",
"value":"CC0"
}],
"spacing":0,
"tilecount":4,
"tileheight":32,
@ -7531,6 +7537,12 @@
"imagewidth":64,
"margin":0,
"name":"023_Fairydust",
"properties":[
{
"name":"tilesetCopyright",
"type":"string",
"value":"CC0"
}],
"spacing":0,
"tilecount":8,
"tileheight":32,
@ -7544,6 +7556,12 @@
"imagewidth":512,
"margin":0,
"name":"wintiles",
"properties":[
{
"name":"tilesetCopyright",
"type":"string",
"value":"CC0"
}],
"spacing":0,
"tilecount":1024,
"tileheight":32,
@ -7557,6 +7575,12 @@
"imagewidth":640,
"margin":0,
"name":"cija_32x32_basic_CC0",
"properties":[
{
"name":"tilesetCopyright",
"type":"string",
"value":"CC0"
}],
"spacing":0,
"tilecount":600,
"tileheight":32,
@ -7570,6 +7594,12 @@
"imagewidth":128,
"margin":0,
"name":"nopslide",
"properties":[
{
"name":"tilesetCopyright",
"type":"string",
"value":"CC0"
}],
"spacing":0,
"tilecount":16,
"tileheight":32,

58
mapcleanup.py Executable file
View file

@ -0,0 +1,58 @@
#!/usr/bin/env python3
import argparse
import sys
import xml.etree.ElementTree as ET
def main():
parser = argparse.ArgumentParser(description="Cleanup rc3.world maps")
parser.add_argument("map", help="map in .tmx format")
parser.add_argument("-o", "--output", help="where to write modified map")
parser.add_argument(
"-i",
"--in-place",
help="replace map with modified version",
action="store_true",
)
parser.add_argument(
"--fix-copyright",
help="add mapCopyright/tilesetCopyright properties",
action="store_true",
)
args = parser.parse_args()
if not args.output and not args.in_place:
print("Output unspecified.", file=sys.stderr)
sys.exit(1)
tree = ET.parse(args.map)
map = tree.getroot()
if args.fix_copyright:
fix_copyright(map)
tree.write(args.output or args.map, xml_declaration=False)
def fix_copyright(map):
if map.find("properties/property[@name='mapCopyright']") is None:
license = input("Map license? [CC0] ") or "CC0"
properties = map.find("properties")
if properties is None:
properties = ET.SubElement(map, "properties")
ET.SubElement(properties, "property", name="mapCopyright", value=license)
for tileset in map.findall("tileset"):
if tileset.find("properties/property[@name='tilesetCopyright']") is None:
license = (
input("Tileset '%s' license? [CC0] " % tileset.attrib["name"]) or "CC0"
)
properties = tileset.find("properties")
if properties is None:
properties = ET.SubElement(tileset, "properties")
ET.SubElement(
properties, "property", name="tilesetCopyright", value=license
)
if __name__ == "__main__":
main()