diff --git a/Makefile b/Makefile index bb2ed0c..12ab220 100644 --- a/Makefile +++ b/Makefile @@ -58,26 +58,14 @@ $(SBSAR_DIR)/%.sbsar: $(SBS_DIR)/%.sbs # There is a png imageset for each preset of a base texture # All png are stored in a png_1024 folder @ mkdir -p $(PNG1024_DIR) -# Get all presets for the graph - @ $(eval PRESETLIST=`$(GETPRESET) --input $< | grep PRESET | sed -r 's/PRESET "(.*)"/\1/g'`) # Get graph outputs list - @ declare -i graphcount=0 ;\ - output_list="" ;\ - for line in $$($(GETOUTPUT) $<) ; do \ - if [ "$$line" = "GRAPH-URL" ] ;\ - then ((graphcount++)) ;\ - fi ;\ - if [ $$graphcount -le 1 ] ;\ - then if [ "$$line" != "OUTPUT" ] && [ "$$line" != "GRAPH-URL" ] && [ "$${line:0:4}" != "pkg:" ] ;\ - then output_list+=" $${line}" ;\ - fi ;\ - else : ;\ - fi ;\ - done;\ - echo " - Graph output_list :"$$output_list;\ + @ outputs=$$(xmlstarlet sel -t -m "//content/graph[1]/graphOutputs/graphoutput/identifier" -o " " -v "@v" $<) ;\ + echo " - Graph OUTPUTS : $$outputs";\ echo "Building 1024 png imageset(s) from presets of" $@ ;\ pngfiles="";\ - for preset in $(PRESETLIST) ; do \ + presetlist=$$(xmlstarlet sel -t -m "//content/graph[1]/sbspresets/sbspreset/label" -o " " -v "@v" $<);\ + echo " presetlist: " $$presetlist ; \ + for preset in $$presetlist ; do \ echo "- Preset" $$preset; \ material=$$(basename -s .sbsar $@);\ echo "material :"$$material;\ @@ -87,7 +75,7 @@ $(SBSAR_DIR)/%.sbsar: $(SBS_DIR)/%.sbs rm -Rf $(PNG512_DIR)/$$obsolete* ;\ rm -Rf $(PNG256_DIR)/$$obsolete* ;\ listitem="";\ - for item in $$output_list;\ + for item in $$outputs;\ do itemfull="$(PNG1024_DIR)/$${material}_$${preset}_$${item}.png";\ listitem="$$listitem $$itemfull";\ done;\ diff --git a/README.md b/README.md index 7a143b9..0ad7225 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,13 @@ This repository use [Git LFS](https://git-lfs.github.com/). +## Structure of sbs files + +Your preset should be written without any space in their label. + +For now, the script export only the first graph of each file. + + ## Organisation of a factory ### Configuration of the Makefile @@ -34,7 +41,7 @@ Theses are the places where the script will generate the final png files. It wil #### 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 by 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. @@ -52,10 +59,12 @@ The path to the json file used to manage all the metadata linked to texturesets ### Configuration of the json file +You have to fill this file to tell the system where it should export the result (the png textures and the blender file used for the preview render) + - `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 +- `type` is the subfolder name in `BLENDFILES_FOLDER` in the `local-config.mk` file the blender files used to generate the previews are stored - `format` is the format of the texture, square or rectangular, it must be either "10,10" for normal 1024x1024 files, "9,10" for 512x1024 and "10,9" for 1024x512 -- `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. +- `destination_1024` is the folders names list where to copy the generated textures 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 textures 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 textures files in 256x256, it can be left with an empty field if non-relevant. diff --git a/example/logo/YKtextures.png b/example/logo/YKtextures.png deleted file mode 100644 index 04d20f4..0000000 --- a/example/logo/YKtextures.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1f57ea0c1190f8fd9c4df24cf59c8322427e73181fe059915fe8a4f8cb2a06ab -size 11441 diff --git a/example/logo/yk.png b/example/logo/yk.png new file mode 100644 index 0000000..f3f0ea2 --- /dev/null +++ b/example/logo/yk.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71157ea6d12a7dfe58b72d306dce3eae565b38b0c60903e41db31c3fd45c35d3 +size 19744 diff --git a/example/logo/yk.png~ b/example/logo/yk.png~ new file mode 100644 index 0000000..6cc085a Binary files /dev/null and b/example/logo/yk.png~ differ diff --git a/example/material_list.json b/example/material_list.json index af6c43a..4cb604a 100644 --- a/example/material_list.json +++ b/example/material_list.json @@ -1,6 +1,15 @@ [ { - "name":"texture_factory_test_preset0", + "name":"texture_factory_test_Preset_numero_1", + "description":"Texture factory testing material", + "type":"bhonr", + "format":"10,10", + "destination_1024":["build/export/project_A"], + "destination_512":["build/export/project_B_512"], + "destination_256":[""] + }, + { + "name":"texture_factory_test_Preset_numero_2", "description":"Texture factory testing material", "type":"bhonr", "format":"10,10", diff --git a/example/sbs/texture_factory_test.sbs b/example/sbs/texture_factory_test.sbs index 456f5b7..1711248 100644 --- a/example/sbs/texture_factory_test.sbs +++ b/example/sbs/texture_factory_test.sbs @@ -1 +1 @@ - + diff --git a/global-config.mk b/global-config.mk index 6a20cad..804faef 100644 --- a/global-config.mk +++ b/global-config.mk @@ -3,10 +3,10 @@ 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_DIR)/utilities/" -export GETPRESET=sbsmutator info --print-presets -export GETOUTPUT=sbsmutator info --print-outputs -export SBSRENDER=sbsrender +# TODO:was used to add --includes "~/.local/share/Steam/steamapps/common/Substance 3D Designer 2023/resources/packages/" --includes "$(SBS_DIR)/utilities/" +# but it seems obsolete, check how to add other dependencies integrated if needed +export MAKESBSAR=~/.local/share/Steam/steamapps/common/Substance\ 3D\ Designer\ 2023/sbscooker --quiet --output-name {inputName} +export SBSRENDER=~/.local/share/Steam/steamapps/common/Substance\ 3D\ Designer\ 2023/sbsrender # texturesets files export TEXTURESET_FOLDER := build/texturesets @@ -21,10 +21,10 @@ export PNG256_DIR := build/png_256 # Blender related export BLENDFILES_FOLDER := example/blenderfiles -export BLENDEREXEC := /opt/blender/blender +export BLENDEREXEC := /home/yann/Documents/3D/blender_builds/current_stable/blender # Logo file -export LOGO := example/logo/YKtextures.png +export LOGO := example/logo/yk.png # Destination preview folder export PREVIEW_FOLDER := build/previews