Adding recipe variable construction for preview building - Now the previews are made according to the content of the folder named in the json file for each texture set - No more need of master blender file

This commit is contained in:
yannk 2021-12-22 00:16:54 +01:00
parent 9d6cd597c6
commit 6ebc0d5fd0

View file

@ -1,32 +1,30 @@
TEXTURESETS := $(foreach file, $(TEXTURESET_FOLDER), $(basename $(notdir $(wildcard $(TEXTURESET_FOLDER)/*))))
RENDER_FOLDER = $(shell cat $(MATERIALLIST) | jq -r --arg folder "$(SET)" '.[] | select(.name==$$folder) | .type')
# Build list of destination filenames of previews
RENDER_FILES = $(foreach RENDER, $(basename $(notdir $(wildcard $(BLENDFILES_FOLDER)/$(shell cat $(MATERIALLIST) | jq -r --arg folder "$(SET)" '.[] | select(.name==$$folder) | .type')/*.blend))), $(SET)_$(RENDER))
RENDER_LIST := $(foreach SET, $(TEXTURESETS), $(RENDER_FILES))
BLENDFILES := $(foreach file, $(BLENDFILES_FOLDER)/master, $(basename $(notdir $(wildcard $(BLENDFILES_FOLDER)/master/*.blend))))
BLENDFILES_SUFFIX := $(foreach file, $(BLENDFILES), $(addsuffix $(file), _))
TARGET := $(foreach file, $(TEXTURESETS), $(addprefix $(file), $(BLENDFILES_SUFFIX)))
TARGET := $(foreach file, $(TARGET), $(addsuffix .png, $(file)))
# Add them png suffix and destination path
TARGET := $(foreach file, $(RENDER_LIST), $(addsuffix .png, $(file)))
TARGET := $(foreach file, $(TARGET), $(addprefix $(PREVIEW_FOLDER)/, $(file)))
RENDERS := $(foreach file, $(BLENDFILES_SUFFIX), $(addprefix %, $(file)))
RENDERS := $(foreach file, $(RENDERS), $(addsuffix .png, $(file)))
# Build list of corresponding recipe filenames
RECIPE_RENDERS = $(foreach RECIPE_RENDER, $(basename $(notdir $(wildcard $(BLENDFILES_FOLDER)/$(shell cat $(MATERIALLIST) | jq -r --arg folder "$(TEX_SET)" '.[] | select(.name==$$folder) | .type')/*.blend))), %_$(RECIPE_RENDER))
RECIPE_RENDERS_LIST := $(foreach TEX_SET, $(TEXTURESETS), $(RECIPE_RENDERS))
# Add them png suffix and destination path
RENDERS := $(foreach file, $(RECIPE_RENDERS_LIST), $(addsuffix .png, $(file)))
RENDERS := $(foreach file, $(RENDERS), $(addprefix $(PREVIEW_FOLDER)/, $(file)))
all: $(TARGET)
$(RENDERS): $(TEXTURESET_FOLDER)/%
all: $(TARGET)
@ echo "RENDER_LIST : $(RENDER_LIST)"
@ echo "RENDER_FILES : $(RENDER_FILES)"
@ echo "RENDERS :" $(RENDERS)
@ echo "BLENDFILES :" $(BLENDFILES)
@ echo "BLENDFILES_SUFFIX :" $(BLENDFILES_SUFFIX)
@ echo "RECIPE_RENDERS :" $(RECIPE_RENDERS)
@ echo "RECIPE_RENDERS_LIST :" $(RECIPE_RENDERS_LIST)
@ echo "TARGET : $(TARGET)"
@ echo "TEXTURESETS : $(TEXTURESETS)"
$(RENDERS): $(TEXTURESET_FOLDER)/%
@ echo "Prerequisite :" $<
@ pngset=`cat $<`;\
echo "pngset :" $$pngset ;\