From d78ca642d1b0e93a756654876f5ccbdbf8d2d726 Mon Sep 17 00:00:00 2001 From: yannk Date: Fri, 17 Dec 2021 23:40:45 +0100 Subject: [PATCH 1/6] Untrack example files --- .gitignore | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 727729c..de0f8b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,11 @@ -.autosave build/ -*.png~ -blenderfiles/textures/* *.blend[0-9]* # Ignore local configuration file local-config.mk + +# Ignore examples files which will be modified/replaced/deplaced hereafter locally by users +blenderfiles/ +sbs/ +logo/ +material_list.json From d25452193dbf2f201f075b16bd7691e533128a73 Mon Sep 17 00:00:00 2001 From: yannk Date: Mon, 20 Dec 2021 22:46:43 +0100 Subject: [PATCH 2/6] No more need to exclude example files from tracking as there will be replaced for actual use --- .gitignore | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitignore b/.gitignore index de0f8b8..21529c2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,3 @@ build/ # Ignore local configuration file local-config.mk - -# Ignore examples files which will be modified/replaced/deplaced hereafter locally by users -blenderfiles/ -sbs/ -logo/ -material_list.json From a5279d4c738c44fa59f0306fb1a9a8e5fbb541a5 Mon Sep 17 00:00:00 2001 From: yannk Date: Mon, 20 Dec 2021 22:48:46 +0100 Subject: [PATCH 3/6] Adding autosave untracking for sbs files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 21529c2..e80f25f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ build/ # Ignore local configuration file local-config.mk + +# Ignore sbs autosave files +.autosave From c338370d7c4ee12427d94457471f3ebeb9f6e4c9 Mon Sep 17 00:00:00 2001 From: yannk Date: Mon, 20 Dec 2021 22:49:31 +0100 Subject: [PATCH 4/6] Moving example files to specific folder --- {blenderfiles => example/blenderfiles}/bhonr/preview_01.blend | 0 {blenderfiles => example/blenderfiles}/master/preview_01.blend | 0 {logo => example/logo}/YKtextures.png | 0 material_list.json => example/material_list.json | 0 {sbs => example/sbs}/texture_factory_test.sbs | 0 {sbs => example/sbs}/texture_factory_test_preset0.sbsprs | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {blenderfiles => example/blenderfiles}/bhonr/preview_01.blend (100%) rename {blenderfiles => example/blenderfiles}/master/preview_01.blend (100%) rename {logo => example/logo}/YKtextures.png (100%) rename material_list.json => example/material_list.json (100%) rename {sbs => example/sbs}/texture_factory_test.sbs (100%) rename {sbs => example/sbs}/texture_factory_test_preset0.sbsprs (100%) diff --git a/blenderfiles/bhonr/preview_01.blend b/example/blenderfiles/bhonr/preview_01.blend similarity index 100% rename from blenderfiles/bhonr/preview_01.blend rename to example/blenderfiles/bhonr/preview_01.blend diff --git a/blenderfiles/master/preview_01.blend b/example/blenderfiles/master/preview_01.blend similarity index 100% rename from blenderfiles/master/preview_01.blend rename to example/blenderfiles/master/preview_01.blend diff --git a/logo/YKtextures.png b/example/logo/YKtextures.png similarity index 100% rename from logo/YKtextures.png rename to example/logo/YKtextures.png diff --git a/material_list.json b/example/material_list.json similarity index 100% rename from material_list.json rename to example/material_list.json diff --git a/sbs/texture_factory_test.sbs b/example/sbs/texture_factory_test.sbs similarity index 100% rename from sbs/texture_factory_test.sbs rename to example/sbs/texture_factory_test.sbs diff --git a/sbs/texture_factory_test_preset0.sbsprs b/example/sbs/texture_factory_test_preset0.sbsprs similarity index 100% rename from sbs/texture_factory_test_preset0.sbsprs rename to example/sbs/texture_factory_test_preset0.sbsprs From eb122125460d8a9fa7e961cf891934acf9ee4083 Mon Sep 17 00:00:00 2001 From: yannk Date: Mon, 20 Dec 2021 22:50:52 +0100 Subject: [PATCH 5/6] Using variable source folder for scripts, used by default in global-config.mk, and replaced in production by proper content folder --- Makefile | 3 ++- Makefile_previews | 24 ++++++++++++++---------- README.md | 10 +++++----- global-config.mk | 18 +++++++++--------- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 2a0b8d0..51fb513 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,8 @@ SHELL=/bin/bash # Get Configuration informations from global or local config file -CONFIG_FILES=global-config.mk local-config.mk +LOCAL_CONFIG = $(wildcard local-config.mk) +CONFIG_FILES = global-config.mk $(LOCAL_CONFIG) include $(CONFIG_FILES) # sbsar files generation part diff --git a/Makefile_previews b/Makefile_previews index 66432f3..61f4499 100644 --- a/Makefile_previews +++ b/Makefile_previews @@ -1,5 +1,5 @@ TEXTURESETS := $(foreach file, $(TEXTURESET_FOLDER), $(basename $(notdir $(wildcard $(TEXTURESET_FOLDER)/*)))) -BLENDFILES := $(foreach file, $(BLENDFILES_FOLDER), $(basename $(notdir $(wildcard $(BLENDFILES_FOLDER)/*.blend)))) +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))) @@ -9,6 +9,9 @@ RENDERS := $(foreach file, $(BLENDFILES_SUFFIX), $(addprefix %, $(file))) RENDERS := $(foreach file, $(RENDERS), $(addsuffix .png, $(file))) RENDERS := $(foreach file, $(RENDERS), $(addprefix $(PREVIEW_FOLDER)/, $(file))) +test: + echo "TARGET: $(TARGET)" + all: $(TARGET) $(RENDERS): $(TEXTURESET_FOLDER)/% @@ -20,29 +23,30 @@ $(RENDERS): $(TEXTURESET_FOLDER)/% for file in $$pngset ;\ do basename=$$(basename "$$file");\ newname=$$(echo $$basename | sed -r 's/.*($(TEXTURES_NAMES))/\\\1/' | sed -r 's/\\//');\ - mkdir --parents blenderfiles/textures;\ + mkdir --parents $(BLENDFILES_FOLDER)/textures;\ echo "Copying "$$file ;\ - cp $$file blenderfiles/textures/$$newname ; done ;\ + cp $$file $(BLENDFILES_FOLDER)/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' ' ') ;\ + blender_render_files=$$(ls $(BLENDFILES_FOLDER)/$$rendertype/*.blend | sed -r 's|$(BLENDFILES_FOLDER)/.*/||' | 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 :"$(PREVIEW_FOLDER)"/"$$destination;\ - blendfile=$$(echo "blenderfiles/"$$rendertype"/"$$blendname".blend");\ + blendfile=$$(echo "$(BLENDFILES_FOLDER)/"$$rendertype"/"$$blendname".blend");\ echo "blendfile :" $$blendfile;\ - mkdir --parents render;\ + mkdir --parents $(BLENDFILES_FOLDER)/render;\ + temp_render_dir=$$(realpath $(BLENDFILES_FOLDER)/render);\ echo "Rendering "$(PREVIEW_FOLDER)/$$destination;\ - $(BLENDEREXEC) -b $$blendfile --render-output //../../render/render##.png -f 1 --addons > /dev/null 2>&1;\ + $(BLENDEREXEC) -b $$blendfile --render-output $$temp_render_dir/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;\ + composite -compose atop -gravity southeast -dissolve 90% $(LOGO) $(BLENDFILES_FOLDER)/render/render01.png $(PREVIEW_FOLDER)/$$destination;\ done # Clean the subfolder with temp textures - @ rm -Rf blenderfiles/textures + @ rm -Rf $(BLENDFILES_FOLDER)/textures # Clean the temp render folder - @ rm -Rf render + @ rm -Rf $(BLENDFILES_FOLDER)/render diff --git a/README.md b/README.md index fdf7f10..ab5955f 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,20 @@ This repository use [Git LFS](https://git-lfs.github.com/). ### Configuration of the Makefile -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. +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 and concerns only example files included with the script. Moreover is handled by git for new versions and any changes you make would be erased by new pull of the script. To specify dedicated values 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. You will have to do it at least to take in charge your persnal data and not the `example` content given. Simply write either the absolute or the relative path from your Makefile script situation for any information needed. -## Executables used - -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 in the `SBS_DIR` variables content. You must write down also the place where the script will write the generated sbsar. +## 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. + ## Texturesets files This files will be used only internally by the script to check the texturesets it handles. diff --git a/global-config.mk b/global-config.mk index 6838f2c..6a20cad 100644 --- a/global-config.mk +++ b/global-config.mk @@ -1,13 +1,13 @@ +# sbsar files generation part +export SBS_DIR=example/sbs +export SBSAR_DIR=build/sbsar + # executables used -export MAKESBSAR=sbscooker --quiet --output-name {inputName} --includes "/opt/Allegorithmic/Substance_Automation_Toolkit/resources/packages/" --includes "sbs/utilities/" +export MAKESBSAR=sbscooker --quiet --output-name {inputName} --includes "/opt/Allegorithmic/Substance_Automation_Toolkit/resources/packages/" --includes "$(SBS_DIR)/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 @@ -20,14 +20,14 @@ export PNG512_DIR := build/png_512 export PNG256_DIR := build/png_256 # Blender related -export BLENDFILES_FOLDER := blenderfiles/master -export BLENDEREXEC := blender +export BLENDFILES_FOLDER := example/blenderfiles +export BLENDEREXEC := /opt/blender/blender # Logo file -export LOGO := logo/YKtextures.png +export LOGO := example/logo/YKtextures.png # Destination preview folder export PREVIEW_FOLDER := build/previews # Material list -export MATERIALLIST := material_list.json +export MATERIALLIST := example/material_list.json From 8ddd3d1cce36a43f8daa0046658689e2967d642f Mon Sep 17 00:00:00 2001 From: yannk Date: Mon, 20 Dec 2021 22:53:04 +0100 Subject: [PATCH 6/6] Explaining how to populate local-config.mk file properly from global-config.mk - Close #6 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab5955f..edf7f2b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This repository use [Git LFS](https://git-lfs.github.com/). ### Configuration of the Makefile -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 and concerns only example files included with the script. Moreover is handled by git for new versions and any changes you make would be erased by new pull of the script. To specify dedicated values 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. You will have to do it at least to take in charge your persnal data and not the `example` content given. +The file `global-config.mk` contains configuration informations about paths to sources, executables and to the building destinations. It details all the variables which can be set. Be aware that it shouldn’t be modified, as it can receive new variables in the future needed for the script to work and concerns only example files included with the script. Moreover it is handled by git for new versions and any changes you make would be erased by new pull of the script. To specify dedicated values to any variable, you should copy its line definition to a new file in 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. You will have to do it at least to take in charge your personal data and not the `example` content given. Simply write either the absolute or the relative path from your Makefile script situation for any information needed.