2021-12-15 20:55:20 +00:00
|
|
|
TEXTURESETS := $(foreach file, $(TEXTURESET_FOLDER), $(basename $(notdir $(wildcard $(TEXTURESET_FOLDER)/*))))
|
|
|
|
BLENDFILES := $(foreach file, $(BLENDFILES_FOLDER), $(basename $(notdir $(wildcard $(BLENDFILES_FOLDER)/*.blend))))
|
|
|
|
BLENDFILES_SUFFIX := $(foreach file, $(BLENDFILES), $(addsuffix $(file), _))
|
|
|
|
TARGET := $(foreach file, $(TEXTURESETS), $(addprefix $(file), $(BLENDFILES_SUFFIX)))
|
|
|
|
TARGET := $(foreach file, $(TARGET), $(addsuffix .png, $(file)))
|
|
|
|
TARGET := $(foreach file, $(TARGET), $(addprefix $(BUILD_FOLDER)/, $(file)))
|
|
|
|
|
|
|
|
RENDERS := $(foreach file, $(BLENDFILES_SUFFIX), $(addprefix %, $(file)))
|
|
|
|
RENDERS := $(foreach file, $(RENDERS), $(addsuffix .png, $(file)))
|
|
|
|
RENDERS := $(foreach file, $(RENDERS), $(addprefix $(BUILD_FOLDER)/, $(file)))
|
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
$(RENDERS): $(TEXTURESET_FOLDER)/%
|
|
|
|
@ echo "RENDERS :" $(RENDERS)
|
|
|
|
@ echo "BLENDFILES :" $(BLENDFILES)
|
|
|
|
@ echo "Prerequisite :" $<
|
|
|
|
@ pngset=`cat $<`;\
|
|
|
|
echo "pngset :" $$pngset ;\
|
|
|
|
for file in $$pngset ;\
|
|
|
|
do basename=$$(basename "$$file");\
|
2021-12-15 22:20:51 +00:00
|
|
|
newname=$$(echo $$basename | sed -r 's/.*($(TEXTURES_NAMES))/\\\1/' | sed -r 's/\\//');\
|
2021-12-15 20:55:20 +00:00
|
|
|
mkdir --parents blenderfiles/textures;\
|
|
|
|
echo "Copying "$$file ;\
|
|
|
|
cp $$file blenderfiles/textures/$$newname ; done ;\
|
|
|
|
presetname=$$(echo $$(basename $< ".png") | sed -r 's/(.*_[0-9]{2})_.*/\\\1/' | sed -r 's/\\//');\
|
|
|
|
echo "presetname :"$$presetname;\
|
|
|
|
echo "MATERIALLIST :"$(MATERIALLIST);\
|
|
|
|
rendertype=$$(cat $(MATERIALLIST) | jq -r --arg folder "$$presetname" '.[] | select(.name==$$folder) | .type');\
|
|
|
|
echo "foldername :" $$rendertype;\
|
|
|
|
blender_render_files=$$(ls blenderfiles/$$rendertype/*.blend | sed -r 's/blenderfiles\/.*\///' | sed -r 's/\.blend//' | tr '\n' ' ') ;\
|
|
|
|
echo "blender_render_files :"$$blender_render_files;\
|
|
|
|
for blendname in $$blender_render_files;\
|
|
|
|
do echo "blendname :" $$blendname;\
|
|
|
|
destination=$$(echo $$presetname"_"$$blendname.png);\
|
|
|
|
echo "destination :"$(BUILD_FOLDER)"/"$$destination;\
|
|
|
|
blendfile=$$(echo "blenderfiles/"$$rendertype"/"$$blendname".blend");\
|
|
|
|
echo "blendfile :" $$blendfile;\
|
|
|
|
mkdir --parents render;\
|
|
|
|
echo "Rendering "$(BUILD_FOLDER)/$$destination;\
|
|
|
|
$(BLENDEREXEC) -b $$blendfile --render-output //../../render/render##.png -f 1 --addons > nul 2>&1;\
|
|
|
|
mkdir --parents $(BUILD_FOLDER);\
|
|
|
|
composite -compose atop -gravity southeast -dissolve 90% $(LOGO) render/render01.png $(BUILD_FOLDER)/$$destination;\
|
|
|
|
done
|
|
|
|
# Clean the subfolder with temp textures
|
|
|
|
@ rm -Rf blenderfiles/textures
|
2021-12-15 22:20:51 +00:00
|
|
|
# Clean the temp render folder
|
|
|
|
@ rm -Rf render
|