# Variables definitions SHELL=/bin/bash # Get Configuration informations from global or local config file CONFIG_FILES=global-config.mk local-config.mk include $(CONFIG_FILES) # sbsar files generation part export SBSFILES = $(wildcard $(SBS_DIR)/*.sbs) export SBSARDESTINATION = $(subst $(SBS_DIR)/, $(SBSAR_DIR)/, $(SBSFILES)) export SBSARFILES = $(SBSARDESTINATION:.sbs=.sbsar) ### RECIPE PART ### all : previews subformats previews: $(SBSARFILES) $(MAKE) -f Makefile_previews all subformats: $(SBSARFILES) $(MAKE) -f Makefile_subformats all export: $(SBSARFILES) $(MAKE) -f Makefile_export all # Recipe to make sbsar, its main PNG files and its preset textureset file $(SBSAR_DIR)/%.sbsar: $(SBS_DIR)/%.sbs @ echo $$(basename $@ ".sbsar") @ echo "Processing" $< "->" $@ @ mkdir -p $(SBSAR_DIR) @ $(MAKESBSAR) --output-path $(SBSAR_DIR) $< # Then build png imageset from sbsar # There is a png imageset for each preset of a base texture # All png are stored in a png_1024 folder @ mkdir -p $(PNG1024_DIR) @ echo "Building 1024 png imageset(s) from presets of" $@ # Get all presets from this base material @ $(eval PRESETLIST=`$(GETPRESET) --input $< | grep PRESET | sed -r 's/PRESET "(.*)"/\1/g'`) @ declare -i graphcount=0 ;\ output_list="" ;\ for line in $$($(GETOUTPUT) $<) ; do \ if [ "$$line" = "GRAPH-URL" ] ;\ then ((graphcount++)) ;\ fi ;\ if [ $$graphcount -le 1 ] ;\ then if [ "$$line" != "OUTPUT" ] && [ "$$line" != "GRAPH-URL" ] && [ "$${line:0:4}" != "pkg:" ] ;\ then output_list+=" $${line}" ;\ fi ;\ else : ;\ fi ;\ done;\ echo "output_list :"$$output_list;\ pngfiles="";\ material=$$(basename $@ ".sbsar");\ echo "material :"$$material;\ for preset in $(PRESETLIST) ; do \ echo "- Preset" $$preset; \ listitem="";\ for item in $$output_list;\ do itemfull="$(PNG1024_DIR)/$${material}_$${preset}_$${item}.png";\ listitem="$$listitem $$itemfull";\ done;\ echo "listitem :"$$listitem;\ mkdir --parents $(TEXTURESET_FOLDER);\ echo $$listitem > $(TEXTURESET_FOLDER)/$$(basename $@ ".sbsar")_$$preset;\ $(SBSRENDER) render $@ --use-preset $$preset --output-name {inputGraphUrl}\_$$preset\_{outputNodeName} --set-value \$$outputsize@10,10# --output-path $(PNG1024_DIR); \ done;\