Merge branch '2-create-configuration-files-for-the-script' into 'main'
Resolve "Create configuration files for the script" Closes #2 See merge request yannk/textures-factory!1
This commit is contained in:
commit
901d2681b8
5 changed files with 51 additions and 46 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -17,3 +17,6 @@ render/
|
|||
*copyrighted*/
|
||||
blenderfiles/textures/*
|
||||
*.blend[0-9]*
|
||||
|
||||
# Ignore local configuration file
|
||||
local-config.mk
|
||||
|
|
37
Makefile
37
Makefile
|
@ -1,45 +1,16 @@
|
|||
# Variables definitions
|
||||
SHELL=/bin/bash
|
||||
|
||||
# executables used
|
||||
export MAKESBSAR=sbscooker --quiet --output-name {inputName} --includes "/opt/Allegorithmic/Substance_Automation_Toolkit/resources/packages/" --includes "sbs/utilities/"
|
||||
export GETPRESET=sbsmutator info --print-presets
|
||||
export GETOUTPUT=sbsmutator info --print-outputs
|
||||
export SBSRENDER=sbsrender
|
||||
# Get Configuration informations from global or local config file
|
||||
CONFIG_FILES=global-config.mk local-config.mk
|
||||
include $(CONFIG_FILES)
|
||||
|
||||
# sbsar files generation part
|
||||
export SBS_DIR=sbs
|
||||
export SBSAR_DIR=sbsar
|
||||
## Auto definitions - do not change
|
||||
|
||||
export SBSFILES = $(wildcard $(SBS_DIR)/*.sbs)
|
||||
export SBSARDESTINATION = $(subst $(SBS_DIR)/, $(SBSAR_DIR)/, $(SBSFILES))
|
||||
export SBSARFILES = $(SBSARDESTINATION:.sbs=.sbsar)
|
||||
|
||||
# texturesets files
|
||||
export TEXTURESET_FOLDER := texturesets
|
||||
|
||||
# texture names possible
|
||||
export TEXTURES_NAMES := basecolor|normal|metallic|roughness|opacity|height
|
||||
|
||||
# png files folders
|
||||
export PNG1024_DIR := png_1024
|
||||
export PNG512_DIR := png_512
|
||||
export PNG256_DIR := png_256
|
||||
|
||||
# Blender related
|
||||
export BLENDFILES_FOLDER := blenderfiles/master
|
||||
export BLENDEREXEC := /home/yann/Documents/3D/blender_builds/daily/blender-3.1.0-alpha+daily.644eb68524b9/blender
|
||||
|
||||
# Logo file
|
||||
export LOGO := logo/YKtextures.png
|
||||
|
||||
# Destination preview folder
|
||||
export BUILD_FOLDER := build
|
||||
|
||||
# Material list
|
||||
export MATERIALLIST := material_list.json
|
||||
|
||||
|
||||
### RECIPE PART ###
|
||||
|
||||
all : previews subformats
|
||||
|
|
|
@ -3,11 +3,11 @@ BLENDFILES := $(foreach file, $(BLENDFILES_FOLDER), $(basename $(notdir $(wildca
|
|||
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)))
|
||||
TARGET := $(foreach file, $(TARGET), $(addprefix $(PREVIEW_FOLDER)/, $(file)))
|
||||
|
||||
RENDERS := $(foreach file, $(BLENDFILES_SUFFIX), $(addprefix %, $(file)))
|
||||
RENDERS := $(foreach file, $(RENDERS), $(addsuffix .png, $(file)))
|
||||
RENDERS := $(foreach file, $(RENDERS), $(addprefix $(BUILD_FOLDER)/, $(file)))
|
||||
RENDERS := $(foreach file, $(RENDERS), $(addprefix $(PREVIEW_FOLDER)/, $(file)))
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
|
@ -33,14 +33,14 @@ $(RENDERS): $(TEXTURESET_FOLDER)/%
|
|||
for blendname in $$blender_render_files;\
|
||||
do echo "blendname :" $$blendname;\
|
||||
destination=$$(echo $$presetname"_"$$blendname.png);\
|
||||
echo "destination :"$(BUILD_FOLDER)"/"$$destination;\
|
||||
echo "destination :"$(PREVIEW_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;\
|
||||
echo "Rendering "$(PREVIEW_FOLDER)/$$destination;\
|
||||
$(BLENDEREXEC) -b $$blendfile --render-output //../../render/render##.png -f 1 --addons > /dev/null 2>&1;\
|
||||
mkdir --parents $(PREVIEW_FOLDER);\
|
||||
composite -compose atop -gravity southeast -dissolve 90% $(LOGO) render/render01.png $(PREVIEW_FOLDER)/$$destination;\
|
||||
done
|
||||
# Clean the subfolder with temp textures
|
||||
@ rm -Rf blenderfiles/textures
|
||||
|
|
10
README.md
10
README.md
|
@ -6,11 +6,9 @@ This repository use [Git LFS](https://git-lfs.github.com/).
|
|||
|
||||
### Configuration of the Makefile
|
||||
|
||||
The beginning of the Makefile contains all the variables and configuration needed.
|
||||
The file `global-config.mk` contain configuration informations about paths to sources, executables and to the building destinations. It details all the variables which can be set but shouldn’t be modified, as it can receive new variables in the future needed for the script to work. Moreover is handled by git for new versions and any changes you make would be erased by new pull of the script. If you want to specify a dedicated value to any variable, you should copy its line definition to a new file inf the same folder, called `local-config.mk`. Like this, you will keep your local configuration files in the future with new versions of the script.
|
||||
|
||||
# Variables definitions
|
||||
|
||||
The very first one shouldn’t be changed, as it will check the proper shell is used to execute the script.
|
||||
Simply write either the absolute or the relative path from your Makefile script situation for any information needed.
|
||||
|
||||
## Executables used
|
||||
|
||||
|
@ -18,13 +16,13 @@ These are the adress of the substance automation toolkit binaries.
|
|||
|
||||
## Sbsar files generation part
|
||||
|
||||
You need to define a sbs source folder where the script will check for new content. It must be indicated in the corresponding place there. Simply write either the absolute or the relative path from your Makefile script situation for 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.
|
||||
|
||||
## Texturesets files
|
||||
|
||||
You can leave the folder indicated here, as it 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
|
||||
|
||||
|
|
33
global-config.mk
Normal file
33
global-config.mk
Normal file
|
@ -0,0 +1,33 @@
|
|||
# executables used
|
||||
export MAKESBSAR=sbscooker --quiet --output-name {inputName} --includes "/opt/Allegorithmic/Substance_Automation_Toolkit/resources/packages/" --includes "sbs/utilities/"
|
||||
export GETPRESET=sbsmutator info --print-presets
|
||||
export GETOUTPUT=sbsmutator info --print-outputs
|
||||
export SBSRENDER=sbsrender
|
||||
|
||||
# sbsar files generation part
|
||||
export SBS_DIR=sbs
|
||||
export SBSAR_DIR=build/sbsar
|
||||
|
||||
# texturesets files
|
||||
export TEXTURESET_FOLDER := build/texturesets
|
||||
|
||||
# texture names possible
|
||||
export TEXTURES_NAMES := basecolor|normal|metallic|roughness|opacity|height
|
||||
|
||||
# png files folders
|
||||
export PNG1024_DIR := build/png_1024
|
||||
export PNG512_DIR := build/png_512
|
||||
export PNG256_DIR := build/png_256
|
||||
|
||||
# Blender related
|
||||
export BLENDFILES_FOLDER := blenderfiles/master
|
||||
export BLENDEREXEC := blender
|
||||
|
||||
# Logo file
|
||||
export LOGO := logo/YKtextures.png
|
||||
|
||||
# Destination preview folder
|
||||
export PREVIEW_FOLDER := build/previews
|
||||
|
||||
# Material list
|
||||
export MATERIALLIST := material_list.json
|
Loading…
Reference in a new issue