~widelands-media-dev/widelands-media/cleanup-world

« back to all changes in this revision

Viewing changes to graphics/tools/Graphics Tools (Java)/Readme

  • Committer: Benedikt Straub
  • Date: 2018-07-23 07:29:09 UTC
  • mfrom: (209.1.11 widelands-media)
  • Revision ID: benedikt-straub@web.de-20180723072909-90dkwk0pmktk5kzm
Included new frisian graphics

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
This directory contains three commandline tools written in Java to simplify bringing your Blender renders into the game.
 
1
This directory contains four commandline tools written in Java to simplify bringing your Blender renders into the game.
2
2
 
3
3
GraphicsMoveAndResize is a tool that scales all frames of an animation down to the desired in-game resolution and saves 
4
4
    the result in the appropriate subdirectory of the Widelands datadir.
5
5
GraphicsAutoClipAnimations is a tool that removes unused edge space from all frames of an animation and adjusts the hotspot 
6
6
    in the animation’s init.lua file, if desired.
7
7
GraphicsRendersRename is a convenience tool to re-enumerate a batch of files to make them usable for GraphicsMoveAndResize.
 
8
MenuIcons creates the menu icon for a building from any animation frame.
8
9
 
9
10
Note that GraphicsMoveAndResize is optimised for tribe-related objects, especially buildings, workers, and tribe-specific 
10
11
immovables. It has an advantage over many commonly used scaling programs insofar as these programs will often be faster 
126
127
            java GraphicsAutoClipAnimations ~/widelands-repo/widelands/data/tribes/workers/<workername> walk_ 2
127
128
        and all images whose name begins with "walk_" will be treated like they were a single animation.
128
129
        Do not forget the underscore after "walk" if your worker also has walkload_* animations…
 
130
    MenuIcons
 
131
        Choose which image will become the menu icon, and there you are.
 
132
        Arguments (mandatory order):
 
133
        – The directory of the building, e.g. ~/wl-repo/widelands/data/tribes/buildings/warehouses/frisians/port
 
134
        – The name of the animation, e.g. "idle".
 
135
        – The frame of the animation, e.g. "0". Leading zeroes can be ignored.
 
136
        – Icon size in pixels, e.g. "30". Only one number, because icons are always square.
129
137
 
130
138
Full usage example:
131
139
This linux shell script will freshly scale and clip all frisian small and medium productionsites animations 
134
142
  #!/bin/bash
135
143
  for bld in ~/widelands-repo/widelands/data/tribes/buildings/productionsites/frisians/* 
136
144
  do 
137
 
      if [ ${bld##*/} = "farm" ]
138
 
      then 
139
 
          echo "Ignoring the farm"
140
 
      elif [ ${bld##*/} = "reindeer_farm" ]
141
 
      then 
142
 
          echo "Ignoring the reindeer farm"
143
 
      else 
144
 
          for anim in "idle" "unoccupied" "working" "empty"
145
 
          do 
146
 
              java GraphicsMoveAndResize ~/widelands-repo/widelands-media/graphics/tribes/ ~/widelands-debug/widelands/data/tribes/ frisians buildings/productionsites ${bld##*/} $anim true true 0.162 false
147
 
              java GraphicsAutoClipAnimations ~/widelands-repo/widelands/data/tribes/buildings/productionsites/frisians/${bld##*/} $anim 1 hotspot=62,94 yes 
148
 
          done
149
 
      fi
 
145
      for anim in "idle" "unoccupied" "working" "empty"
 
146
      do 
 
147
          java GraphicsMoveAndResize ~/widelands-repo/widelands-media/graphics/tribes/ ~/widelands-debug/widelands/data/tribes/ frisians buildings/productionsites ${bld##*/} $anim true true 0.162 false
 
148
          java GraphicsAutoClipAnimations $bld $anim 1 hotspot=62,94 yes 
 
149
      done
 
150
      java MenuIcons $bld idle 0 30
150
151
  done
151
152
 
152
 
Or you can fit it all into a single line which can be pasted directly into a shell:
153
 
 
154
 
for bld in ~/widelands-repo/widelands/data/tribes/buildings/productionsites/frisians/*; do if [ ${bld##*/} = "farm" ]; then echo "Ignoring the farm" ; elif [ ${bld##*/} = "reindeer_farm" ] ; then echo "Ignoring the reindeer farm" ; else for anim in "idle" "unoccupied" "working" ; do java GraphicsMoveAndResize ~/widelands-repo/widelands-media/graphics/tribes/ ~/widelands-repo/widelands/data/tribes/ frisians buildings/productionsites ${bld##*/} $anim true true 0.162 false; java GraphicsAutoClipAnimations ~/widelands-repo/widelands/data/tribes/buildings/productionsites/frisians/${bld##*/} $anim 1 hotspot=62,94 yes; done; fi; done
155
 
 
 
153
Or you can fit it all into a single line which can be pasted directly into a shell.
156
154
Note than your shell might not wait for one command to finish working before starting the next one. In this case, 
157
155
GraphicsAutoClipAnimations may print error messages because GraphicsMoveAndResize isn’t done yet. If you get such errors,
158
156
first let one for loop GraphicsMoveAndResize all images, then let another for loop GraphicsAutoClipAnimations the results.
 
157
Note also that you should delete existing images before running GraphicsMoveAndResize if not all files will be overwritten.