Merge branch '4-use-material-list-to-define-blender-preview-render-files' into 'main'

Resolve "Use Material list to define blender preview render files"

Closes #4

See merge request yannk/textures-factory!3
This commit is contained in:
yannk 2021-12-22 00:23:19 +01:00
commit 69488b37c9

View file

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