2021-12-15 20:55:20 +00:00
|
|
|
# Variables definitions
|
|
|
|
SHELL=/bin/bash
|
|
|
|
|
2021-12-17 21:45:16 +00:00
|
|
|
# Get Configuration informations from global or local config file
|
2021-12-20 21:50:52 +00:00
|
|
|
LOCAL_CONFIG = $(wildcard local-config.mk)
|
|
|
|
CONFIG_FILES = global-config.mk $(LOCAL_CONFIG)
|
2021-12-17 21:45:16 +00:00
|
|
|
include $(CONFIG_FILES)
|
2021-12-15 20:55:20 +00:00
|
|
|
|
|
|
|
# sbsar files generation part
|
2021-12-17 21:45:16 +00:00
|
|
|
|
2021-12-15 20:55:20 +00:00
|
|
|
export SBSFILES = $(wildcard $(SBS_DIR)/*.sbs)
|
|
|
|
export SBSARDESTINATION = $(subst $(SBS_DIR)/, $(SBSAR_DIR)/, $(SBSFILES))
|
|
|
|
export SBSARFILES = $(SBSARDESTINATION:.sbs=.sbsar)
|
|
|
|
|
2021-12-15 21:15:57 +00:00
|
|
|
### RECIPE PART ###
|
|
|
|
|
2021-12-15 20:55:20 +00:00
|
|
|
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;\
|
2021-12-27 12:15:08 +00:00
|
|
|
echo "Cleaning old entries from the material :"$$material;\
|
|
|
|
rm -Rf $(PNG1024_DIR)/$${material}*;\
|
|
|
|
rm -Rf $(PNG512_DIR)/$${material}*;\
|
|
|
|
rm -Rf $(PNG256_DIR)/$${material}*;\
|
2021-12-15 20:55:20 +00:00
|
|
|
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;\
|
|
|
|
|