Update BYONDTools to the packaged version (which has movement support).

This commit is contained in:
Rob Nelson
2014-05-19 23:16:35 -07:00
parent 3adcecb480
commit 79b788a9b7
6 changed files with 55 additions and 24 deletions

View File

@@ -1,2 +1,2 @@
python tools/ByondTools/src/DMITool.py compare-all ../vg-station/icons/ icons/ compare_report_fail.txt
call dmi compare-all ../vg-station/icons/ icons/ compare_report_fail.txt
pause

View File

@@ -1,2 +1,2 @@
python tools/ByondTools/src/DMITool.py compare-all ../tgstation/icons/ icons/ compare_report_tg.txt
call dmi compare-all ../tgstation/icons/ icons/ compare_report_tg.txt
pause

View File

@@ -1,2 +1,2 @@
python tools/ByondTools/src/DMITool.py get-dmi-data %1 %1.txt
call dmi get-dmi-data %1 %1.txt
pause

View File

@@ -19,7 +19,7 @@ filed a bug report: http://www.byond.com/forum/?post=1507331
They closed it with "Not a Bug".
So, here we are. The only way to edit DMIs that big
is with third-party tools like OpenBYOND.
is with third-party tools like BYONDTools.
How to Compile
--------------

View File

@@ -1,22 +1,49 @@
#!/usr/bin/env python
'''
Created on Feb 28, 2014
Run within icons/mob/in-hand.
@author: Rob
Usage:
$ cd icons/mob/in-hands
$ python ss13_makeinhands.py
ss13_makeinhands.py - Generates a large DMI from several smaller DMIs.
Specifically used for making icons/mob/items_(left|right)hand.dmi
Copyright 2013 Rob "N3X15" Nelson <nexis@7chan.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'''
import os, sys, logging
ToBuild={
ToBuild = {
# ' file to build': 'directory to pull from/',
'../items_lefthand.dmi': 'left/',
'../items_righthand.dmi': 'right/'
}
# Tell Python where to find OpenBYOND.
# Tell Python where to find BYONDTools.
# Assuming we're in icons/mob/in-hand
sys.path.append('../../../tools/OpenBYOND/src')
sys.path.append('../../../tools/BYONDTools') # For byond
sys.path.append('../../../tools/BYONDTools/scripts') # For dmi
from com.byond.DMI import DMI
from DMITool import compare_all
from byond.DMI import DMI
from dmi import compare_all
def buildDMI(directory, output):
dmi = DMI(output)
@@ -24,29 +51,33 @@ def buildDMI(directory, output):
for root, _, files in os.walk(directory):
for filename in files:
if filename.endswith('.dmi') and not filename.endswith('.new.dmi'):
filepath = os.path.join(root,filename)
logging.info('Adding {0}...'.format(filename,output))
filepath = os.path.join(root, filename)
logging.info('Adding {0}...'.format(filename, output))
subdmi = DMI(filepath)
subdmi.loadAll()
if subdmi.icon_height!=32 or subdmi.icon_width!=32:
if subdmi.icon_height != 32 or subdmi.icon_width != 32:
logging.warn('Skipping {0} - Invalid icon size.'.format(filepath))
changes = 0
for state_name in subdmi.states:
if state_name in dmi.states:
logging.warn('Skipping state {0}:{1} - State exists.'.format(filepath,state_name))
logging.warn('Skipping state {0}:{1} - State exists.'.format(filepath, subdmi.states[state_name].displayName()))
continue
dmi.states[state_name]=subdmi.states[state_name]
dmi.states[state_name] = subdmi.states[state_name]
changes += 1
logging.info('Added {0} states.'.format(changes))
#save
logging.info('Saving {0} states to {1}...'.format(len(dmi.states),output))
# save
logging.info('Saving {0} states to {1}...'.format(len(dmi.states), output))
dmi.save(output)
if __name__ == '__main__':
logging.basicConfig(
format='%(asctime)s [%(levelname)-8s]: %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p',
level=logging.INFO)
format='%(asctime)s [%(levelname)-8s]: %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p',
level=logging.INFO # ,
# filename='logs/main.log',
# filemode='w'
)
# Cheating, but useful for checking for unsync'd stuff
compare_all('left/','right/','in-hand_sync_report.txt',None,newfile_theirs=False,newfile_mine=False)
compare_all('left/', 'right/', 'in-hand_sync_report.txt', None, newfile_theirs=False, newfile_mine=False, check_changed=False)
for output, input_dir in ToBuild.items():
buildDMI(input_dir,output)
buildDMI(input_dir, output)