Merge branch '1-modularize-final-destination' into 'main'

Resolve "Modularize final destination"

Closes #1

See merge request yannk/textures-factory!5
This commit is contained in:
yannk 2021-12-28 16:55:37 +01:00
commit 40a3eb42f0
4 changed files with 65 additions and 17 deletions

View file

@ -17,7 +17,7 @@ export TEXTURES := $(wildcard $(TEXTURESET_FOLDER)/*)
### RECIPE PART ### ### RECIPE PART ###
all : previews subformats del_obsolete all : previews del_obsolete export
previews: $(SBSARFILES) previews: $(SBSARFILES)
$(MAKE) -f Makefile_previews all $(MAKE) -f Makefile_previews all
@ -46,7 +46,7 @@ del_obsolete: $(SBS_DIR)
fi ;\ fi ;\
done done
export: $(SBSARFILES) export: $(SBSARFILES) | subformats
$(MAKE) -f Makefile_export all $(MAKE) -f Makefile_export all
# Recipe to make sbsar, its main PNG files and its preset textureset file # Recipe to make sbsar, its main PNG files and its preset textureset file

View file

@ -1,7 +1,44 @@
# Variables définitions # Variables définitions
SRC := $(wildcard $(PNG1024_DIR)/*.png) TEXTURE_LIST := $(notdir $(wildcard $(TEXTURESET_FOLDER)/*))
all: # Build list of destination filenames for 1024 files
echo "MATERIALLIST :"$(MATERIALLIST);\ SRC_1024 := $(wildcard $(PNG1024_DIR)/*.png)
rendertype=$$(cat $(MATERIALLIST) | jq -r --arg folder "$$presetname" '.[] | select(.name==$$folder) | .type');\ EACH_DEST_1024 = $(foreach DEST, $(shell cat $(MATERIALLIST) | jq -r --arg folder "$(TEXTURENAME)" '.[] | select(.name==$$folder) | .destination_1024 | join(" ")'), $(subst $(PNG1024_DIR)/, $(DEST)/, $(SRC_1024)))
DEST_1024 := $(foreach TEXTURENAME, $(TEXTURE_LIST), $(EACH_DEST_1024))
REQUIR_1024 := $(PNG1024_DIR)/%.png
EACH_REQUIR_1024 = $(foreach DEST, $(shell cat $(MATERIALLIST) | jq -r --arg folder "$(TEXTURENAME)" '.[] | select(.name==$$folder) | .destination_1024 | join(" ")'), $(subst $(PNG1024_DIR)/, $(DEST)/, $(REQUIR_1024)))
TARGET_1024 := $(foreach TEXTURENAME, $(TEXTURE_LIST), $(EACH_REQUIR_1024))
# Build list of destination filenames for 512 files
SRC_512 := $(wildcard $(PNG512_DIR)/*.png)
EACH_DEST_512 = $(foreach DEST, $(shell cat $(MATERIALLIST) | jq -r --arg folder "$(TEXTURENAME)" '.[] | select(.name==$$folder) | .destination_512 | join(" ")'), $(subst $(PNG512_DIR)/, $(DEST)/, $(SRC_512)))
DEST_512 := $(foreach TEXTURENAME, $(TEXTURE_LIST), $(EACH_DEST_512))
REQUIR_512 := $(PNG512_DIR)/%.png
EACH_REQUIR_512 = $(foreach DEST, $(shell cat $(MATERIALLIST) | jq -r --arg folder "$(TEXTURENAME)" '.[] | select(.name==$$folder) | .destination_512 | join(" ")'), $(subst $(PNG512_DIR)/, $(DEST)/, $(REQUIR_512)))
TARGET_512 := $(foreach TEXTURENAME, $(TEXTURE_LIST), $(EACH_REQUIR_512))
# Build list of destination filenames for 256 files
SRC_256 := $(wildcard $(PNG256_DIR)/*.png)
EACH_DEST_256 = $(foreach DEST, $(shell cat $(MATERIALLIST) | jq -r --arg folder "$(TEXTURENAME)" '.[] | select(.name==$$folder) | .destination_256 | join(" ")'), $(subst $(PNG256_DIR)/, $(DEST)/, $(SRC_256)))
DEST_256 := $(foreach TEXTURENAME, $(TEXTURE_LIST), $(EACH_DEST_256))
REQUIR_256 := $(PNG256_DIR)/%.png
EACH_REQUIR_256 = $(foreach DEST, $(shell cat $(MATERIALLIST) | jq -r --arg folder "$(TEXTURENAME)" '.[] | select(.name==$$folder) | .destination_256 | join(" ")'), $(subst $(PNG256_DIR)/, $(DEST)/, $(REQUIR_256)))
TARGET_256 := $(foreach TEXTURENAME, $(TEXTURE_LIST), $(EACH_REQUIR_256))
all: $(DEST_1024) $(DEST_512) $(DEST_256)
$(DEST_1024): */%.png: $(REQUIR_1024)
@ [ -d $$(dirname $@) ] || mkdir -p $$(dirname $@)
@ echo "EXPORT : Processing $(PNG1024_DIR)/$(@F) -> $@"
@ cp $(PNG1024_DIR)/$(@F) $@
$(DEST_512): */%.png: $(REQUIR_512)
@ [ -d $$(dirname $@) ] || mkdir -p $$(dirname $@)
@ echo "EXPORT : Processing $(PNG512_DIR)/$(@F) -> $@"
@ cp $(PNG512_DIR)/$(@F) $@
$(DEST_256): */%.png: $(REQUIR_256)
@ [ -d $$(dirname $@) ] || mkdir -p $$(dirname $@)
@ echo "EXPORT : Processing $(PNG256_DIR)/$(@F) -> $@"
@ cp $(PNG256_DIR)/$(@F) $@

View file

@ -10,42 +10,51 @@ The file `global-config.mk` contains configuration informations about paths to s
Simply write either the absolute or the relative path from your Makefile script situation for any information needed. Simply write either the absolute or the relative path from your Makefile script situation for any information needed.
## Sbsar files generation part #### Sbsar files generation part
You need to define a sbs source folder where the script will check for new content in the `SBS_DIR` variables content. You need to define a sbs source folder where the script will check for new content in the `SBS_DIR` variables content.
You must write down also the place where the script will write the generated sbsar. You must write down also the place where the script will write the generated sbsar.
## Executables used #### Executables used
These are the adress of the substance automation toolkit binaries. Note you can use former variables defined sooner in the file, like it is done in the `--includes` section of MAKESBSAR. These are the adress of the substance automation toolkit binaries. Note you can use former variables defined sooner in the file, like it is done in the `--includes` section of MAKESBSAR.
## Texturesets files #### Texturesets files
This files will be used only internally by the script to check the texturesets it handles. This files will be used only internally by the script to check the texturesets it handles.
# Texture names possible #### Texture names possible
This variable is needed to recognize the files created as bitmaps from the substance source, it must include all the identifiers used in all the graphs, separated by a pipe and no space. It is used as regexp rule in the script. This variable is needed to recognize the files created as bitmaps from the substance source, it must include all the identifiers used in all the graphs, separated by a pipe and no space. It is used as regexp rule in the script.
## Png files folders #### Png files folders
Theses are the places where the script will generate the final png files. It will be the main repository used as reference to fill hereafter all the targets needed in any package needed. Theses are the places where the script will generate the final png files. It will be the main repository used as reference to fill hereafter all the targets needed in any package needed.
## Blender related #### Blender related
You have to define also a blender file directory where you will store the files used to generate previews of texturesets. They will be handled vie the `material_list.json` file indicated in the following section. They will have to be organized a special way to function, see later. You have to define also a blender file directory where you will store the files used to generate previews of texturesets. They will be handled vie the `material_list.json` file indicated in the following section. They will have to be organized a special way to function, see later.
The `BLENDEREXEC` variable is the path to the binary used to generate the preview. It must be compatible with the version used to save the renders files. The `BLENDEREXEC` variable is the path to the binary used to generate the preview. It must be compatible with the version used to save the renders files.
## Logo file #### Logo file
Indicate any logo you would need as watermark in any of the content. Indicate any logo you would need as watermark in any of the content.
# Destination preview folder #### Destination preview folder
Where you will save the renders of the previews of each textureset generated by Blender. Where you will save the renders of the previews of each textureset generated by Blender.
# Material list #### Material list
The path to the json file used to manage all the metadata linked to texturesets and proper management of the content generated by the script. It must comply to a specific organisation and content to work properly. The path to the json file used to manage all the metadata linked to texturesets and proper management of the content generated by the script. It must comply to a specific organisation and content to work properly.
### Configuration of the json file
- « `name` » is the mundane texture name
- « `description` » is the description of the texture
- « `type` » is the subfolder name in `BLENDFILES_FOLDER` in the `local-config.mk` file the blender files used to generate the rpeviews are stored
- « `destination_1024` » is the folders names list where to copy the generated textrues files in 1024x1024, it can be left with an empty field if non-relevant.
- « `destination_512` » is the folders names list where to copy the generated textrues files in 512x512, it can be left with an empty field if non-relevant.
- « `destination_256` » is the folders names list where to copy the generated textrues files in 256x256, it can be left with an empty field if non-relevant.

View file

@ -1,8 +1,10 @@
[ [
{ {
"name":"texture_factory_test_preset0", "name":"texture_factory_test_preset0",
"description":"Texturefacotry testing material", "description":"Texture factory testing material",
"type":"bhonr", "type":"bhonr",
"khanat texture folder":"ground" "destination_1024":["build/export/project_A","build/export/project_B/1024"],
"destination_512":["build/export/project_B/512"],
"destination_256":[""]
} }
] ]