Skip to content

Conversation

@Michaleczeq
Copy link

Small modification that adds support for 'tsnmapcalc' flavor mostly used in road templates models, where road texture use normal map.

Small modification that adds support for 'tsnmapcalc' flavor mostly used in road templates models, where road texture use normal map.
Fast fix that add tsnmapcalc to Shader Editor
theHarven pushed a commit to theHarven/BlenderTools that referenced this pull request Feb 18, 2024
* Added support for "dif.spec.amod.dif.spec" shader. It's not perfect, but it should be enough to work with models. (Col_alpha: 0.25 = full Base, 0.0/0.5 = Full Over. Idk why it's divided that way.)
* Added condition to allow aliasing materials with "tsnmap" flavor, like it is made in "/material/terrain/" dir.
* Fixed aux[0] and aux[1] (changed from float2 to float4 - texgen_X_rot and unused/nmap rot? idk)
Added support for custom unloading/loading locators in "Spawn Point" -> "Custom" setting.

Custom (un)loading settings allow you, to set parking difficulty, max trailer lenght and trailer type like "Company" tool in ME.
* Fixed error when you try import old .pip file, without "Flags" attribute inside "SpawnPoint".
* Custom spawn point fixes (now unload/load is separeted from parking difficulty)
* Added visual colored shape showing depot place, size and difficulty
* BGL module was replaced by GPU in one place
* Some blf.size fixes (removed unnecessary arg)
* Fixed upside-down reflection in env shaders
* Updated .bin file with new shaders (eut2.interior)
* Small fix of comments in amod shader
* First implementation of "eut2.interior.lit" and "eut2.interior.curtain.lit" shaders (there is also "eut2.interior.spatial.lit", but SCS not use it anywhere now).
It's without "interrior mapping" effect, but allow to create new models with that shaders.
Because ConverterPIX not support new attributes from mat, after import from .scs, you MUST open .pit file, and replace all:
interior_unit_room_dimensions --> aux[0]
interior_atlas_dimensions --> aux[1]
interior_glass_color --> aux[2]
* Fixed "amod" shader - changed "decal_blending_factors" attribute to "aux" (and removed old properties)
* Added support for "Decal blending factors" attributes in material tab
* Updated "amod" nodes to better reflect that shader in blender
* Corrected TexGen description in shader_presets.txt
* Added support for old tg0 (aux[0]) and tg1 (aux[1]) float2 values
* Changed tool version (added ".1" to version number)
 to distinguish my edits from official SCS version. Author is also added.
* Reverted "upside-down" envmap fix (caused problems elsewhere)
* Fixed wrong order of “envmap” and “shadow” flavors in lamp shader
* Fixed problems with exporting models with "interior" shader (missing UV1 in model data) by adding "Material Mapping" setting below attributes (need more testing)
* Added "Interior Window Tool" in sidebar, which allows you to enable/disable glass reflection effect on interior shader (by changing UV tile). It's possible, that other shaders with "glass" reflections also support that.
* Added support for "anim" flavor in "lamp" shader
* Added support for "dif.spec.mult.dif.iamod.dif.add.env" shader
- Fixed "aux[5]" in "eut2.building.asafew.a.lvcol.day" shader.
- Added support for "baked" shader (with flavors).
- Changed "Specular Color" input in "add_env" node from required to optional (because "baked" shader don't use it)
- Fixed problem with imported
- Added parts starting with "_col" to collisions
- Added automatic replace for outdated "window.day/night" shaders to "window.lit".
- Added missing flavors in some "building" shaders
- Added support for "building.add.env.lvcol.day"
* Added new effects in supported_effects.bin.
* Fixed "paint" flavor in "baked" shader (added mask_1 and preview of "Base Paint Color").
* Renamed some stuff in "interior" shader files.
* Renamed some new flavors in "shader_presets.txt" to better reflect them.
* Sorted flavor entries in "shader_presets.txt" alphabetically for better orientation.
* Some bgl module replaces
* Fixed unselectable tsnmap flavors in  truckpaint.
A huge amount of edits needed to update BT to newer version (4.1.1 max) of Blender:
* Updated camera settings (removed "cycles" to correspond to bpy.types.Camera changes)
* Updated colorspace_settings ("Linear" (removed) -> "Linear Rec.709")
* Updated node groups (replaced removed inputs/outputs with interface)
* Some code tweaks in spec_texture_calc_ng.py
* Removed forced sRGB color space instead Linear in amod and baked shaders (Blender 4.x now support more DDS dxgi formats, and it's not broken anymore)
* Renamed "bindcode" to "texture" in open_gl/core.py to not mislead
* Updated pim import (https://developer.blender.org/docs/release_notes/4.1/python_api/#mesh). More tests are required, cause I don't known if that changes are correctly made.
* Replaced old ShaderNodeMixRGB with ShaderNodeMix
* Some code tweaks (interface.new_socket entries was written in one line instead multi line) for better visualization
* Added parts ended with "_c" to collisions (used e.g. in curves)
* Added "_FACTOR" used in "piko.alldir" flavor to possible piece stream entries in pim files (not used in code for now)
* Removed remnants of "use_auto_smooth", "auto_smooth_angle" and "calc_normals_split" removed in Blender 4.1.

Btw. As they wrote:
"The Mesh auto_smooth property has been replaced by a modifier node group asset."
I completly don't know if due to this and other changes with Mesh, it should be removed as in this fix, or done in other way.
Someone with more knowledge should look at this.
Change that I forget to do in last fix...
* Fixed not updated node inputs in airbrush/colormask flavors
- Fixed "Unexpected 'KeyError' accured during import" error, when importing models with empty parts. Mostly with models, where in pim file is unused "defaultpart" (like in /vehicle/truck/renault_magnum_2009/truck.pmg).
- Fixed "Settings in TOBJ file not saved; content is malformed ..." error, when texture other than ".tobj" is used (caused by blender local dirs starting with "//" instead abs path)
Updated shaders to Blender 4.2
* Added force replacer for old flavors (tsnmap16 and tsnmapuv16)
* Added code for auto-fixes when unofficial version will change
* Added support for "dif.spec.weight.add.env.nofresnel" shader
* Tweaks in "baked" shader
* Tweaks in "dif.spec.amod.dif.spec" shader
* Added "/umatlib" to aliasing dirs
* Added button to fix normals in "interior" shader
* Added some new texture types used by "sky" shader
* Updated supported_effects.bin (removed old flavors)
* Added support for "piko.alldir" flavor. BT can now import and export it properly, and it will not cause "Unable to map attribute (v.factor)" error in game. "Factor" vertex color is responsible for a slight change in mesh size/vertex position up to about 100m from the camera (IDK how it exactly works). Since it's added as "Factor" vertex color, user can change values by themselves and adjust it if needed (RGB = XYZ axis move, A is a duplicate of Z, idk if game use it).
* "sky" shader tweaks - replaced old default values that indicated to removed/moved textures and added new ones that were missing (shader still is WIP and flavors/shader code must be updated to work correctly)
* Fixed problems with tsnmap flavors in "dif.spec.weight" shader (removed remains of unused flavors)
* Added some missing information in collision description in Visibility Tool (new collision prefixes/suffixes)
* Added partial support for aliasing materials using "effect" format
* Fixed error that cause, that textures couldn't be aliased (excluded base texture to not cause problems when file name will be different than in mat file)
* Added more support for aliasing materials in 'effect' format. Now tool can convert new attribute names to old format
* Added aliasing for TOBJ settings (only with 'effect' materials, as this format store this data in .mat files)
* Fixed error when exporting models without vfcol data (no piko.alldir effect in model from root)
* Added "water" to aliasable shaders (because it's in "umatlib")
* Some additional info about nmaps in aliasing info
* Fixed error when you try to load aliased effect material with additional texture type not used in your shader
* Changes in utils/path.py functions - added new functions for material handling (some old changed to be universal)
This reverts some changes in commit 0c1fe80.
It's because I know more now how aliasing works, and that code no more have sens.
Also removed umatlib and water from aliased dirs/shaders
* Fixed error during export (due to 4.4)
* Fixed error during using of Wrap Tool (due to 4.4)
* Fixed log errors when creating/importing first root locator
* (updated info about blender & tool versions)
* Added env_factor to truckpaint and glass shaders (some SCS models use it)
* Fixed export through file -> export
* Added support for "oinv" (inverted opacity) for "dif.spec.add.env" shader.
* Added partial support for "tsnmapuv2" for "dif.spec.weight.add.env" shader. Flavor can be created and exported, but it will not be properly displayed in blender.
* Added possibility to create "FriendlyTag" for "textures" in shader_presets.txt. Thanks to that, it's now possible to create custom names for texture labels e.g. instead of "Mask 1" it can be named "Lamp Mask" etc.
* Added custom texture labels to some shaders thanks to "FriendlyTags".
Updated sky shader to works with new attributes.
(Not ideal but still better than nothing)
* Added support for "billboard" shader.
* Some new FriendlyTags in old shaders and tg0 update
* Added support for "nmap" flavor in "dif.lum.spec" shader
* Added some data for future "heightmap" flavor support
* Added support for "eut2.dif.spec.add.env.over.dif.opac" shader.
* Added support for "dif.spec.amod.dif.spec.add.env" flavor
* Added support for "opasrc01" flavor in "dif_spec_mult_dif_spec"
* Fresnel attribute values are now displayed on one line instead of 2.
* Added support for "attr" flavor for "dif", "dif.spec" and "dif.spec.mult.dif.spec"
* Added support for "opasrc01" flavor for "dif.spec.mult.dif.spec.add.env"
* Added support for "tsnmapcalc" flavor for "dif.anim"
* Some changes in blocking flavor buttons in material tab - now if flavor can't be used, only that flavor will be grayed, instead of the whole row.
* Added support for "dif.spec.over.dif.opac.add.env" shader
* Added support for "dif.spec.weight.mask.dif.spec.weight" shader (idk if material preview is correct because scs not used that shader yet)
* Added support for "attr" flavor in "dif.spec.oclu", "dif.spec.over.dif.opac" and "dif.spec.weight" shaders
* Fixed "tg1" flavor in "dif_spec_add_env_over_dif_opac" and "dif_spec_oclu"  shaders
* Added support for "dif.spec.weight.mult2.mask2" shader (idk if material preview is correct because scs not used that shader yet)
* Added support for "a" flavor for "fakeshadow".
* Added preview for "nocull" flavor in "fakeshadow" and "shadowonly"
* Added support for "attr" flavor in "dif.weight.dif"
* Fixed Shininnes preview in "dif.spec.weight.mult2.weight2" shader
* Fixed flavors order i "shadowonly" shader
* Added support for "interior.spatial" shader
* Added code to remove outdated "env_factor" attribute from "glass" and "truckpaint" shaders before model will be imported.
* Added support for "sun.bounce", "sun.direct" and "sun.lucent" flavors in "flare" shader.
* Added support for "tsnmap" flavor in "glass" shader
* Added support for "leaves" shader (preview still needs to be done correctly).
* Added support for "light" shader (same as light_tex but without texture).
* Added support for "particle" shader.
* Added new flavors to "light.tex" shader (lsbounce/lsdirect/lslucent).
* Added new flavors to "unlit.vcol.tex" shader (lsbounce/lsdirect/lslucent).
* Added new flavors to "water" shader (stream, tostream/towater, mirror).
* Replaced few icons next to shader names in shader list.
* Small change in unofficial tool version detection.
* Fixed alpha in light.tex shader.
* Fixed errors about unsupported attributes i some shaders.
* Fixed error in "water" shader, when scale is set to 0.
* Changes in tool versioning (changed "MAJOR.MINOR.BUILD_HASH" format to "MAJOR.MINOR.PATH_UNOFFICIAL")
* Fixed "over" flavor preview in "dif.lum" shadersa
* Replaced deprecated shader nodes
* Changed FriendlyTag for Luminance to better represent attribute from the newer material format
* "Fixed" some errors in console (skipped unnecessary code update to decrease errors count - setters in getters)
* Fixed "SCS Blender Tools" ui window Y position (now it detects header panel and doesn't cover data)
* Added support for Vulkan backend (unfortunately line width of locators can't be changed on Vulkan)
* Tweaks in some checkboxes layout in locators - Due to problems with readability at different panel sizes (e.g. "Parti..." instead of "Partial Activation" etc.), checkboxes are now displayed on separate lines.
* Added new "Trailer" tab to settings where you can change colors for trailer (un)loading zones
* Added preview of trailer type to (un)loading zones (with possibility to disable it in settings). Shapes represent models visible in ME (g_debug_parking)
* Added trailer preview also for older Spawn Points associated with (un)loading zones.
* Tweaks in UI - checkboxes now have labels
* Fixes in unofficial version detection
*
* Renamed new settings from "Trailer" to "Spawn Points" those setting tab.
* Added zone preview for Owned Trailer and Service Station spawn points
* Changed color settings for Spawn Points tab from RGB to RGBA. Now users can turn off specific zone color by setting Alpha to 0.
* Fixed icons not loading on Vulkan
* Restored previous versioning system for unofficial versions.
* Updated minimum required Blender version to 4.5 (LTS recommended)
* Added support for new UV Tile (5) in Lamp System + changes in 4th tile
* Changed error text when texture attribute is not set (From "Texture doesn't exists" to "Texture is missing")
* Tweaks in custom icons interval time (icons should break less often)
* Updated to Blender 5.0 (thanks to crisan21)
* Changed button order in Lamp UV Tool (from front-rear-middle, to front-middle-rear)
* Added 2 new settings to control automatic activation of parts (by default ON) when added, or when new variant is created.
* Added auto remover for "diffuse_secondary" material attribute (not supported in current material format)
* Fixed "defaultpart" part that was always being added to every imported root
* Added "is_dynamic_road" and "is_terrain_material" to list of ignored attributes (not working in current legacy material format)
* Tweaks in global nmap flavor (removed B channel support and forced 2-channel group node)
* Added preview for "tsnmapuv2" flavor
* Added preview for "tsnmapcalc" flavor (for dual texture)
* Added few new FriendlyTags for nmaps
* Fixed an issue where the currently assigned part was not displayed correctly
* Fixed Preview Model not working correctly with some paths
* Fixed Preview Model not reloading preview if type was changed
* Tweaks in Factor vcol for piko.alldir - changed default 0.0 color to 0.5
* Changed version + forced material reload
* Increased reload_icons interval a little bit (for faster systems to prevent not loading icons on first start)
* Fixed auto selecting currently assigned part
* Added interactive icons to SCS Parts to inform which part the object is assigned to. Clicking on such an icon will act as an Assign button.
commit f362a53
Author: Michał <[email protected]>
Date:   Sat Dec 20 05:12:58 2025 +0100

    Changes in SCS Part

    * Changed version + forced material reload
    * Increased reload_icons interval a little bit (for faster systems to prevent not loading icons on first start)
    * Fixed auto selecting currently assigned part
    * Added interactive icons to SCS Parts to inform which part the object is assigned to. Clicking on such an icon will act as an Assign button.

commit abecf6a
Author: Michał <[email protected]>
Date:   Fri Dec 19 05:45:41 2025 +0100

    preview model fix + other fixes

    * Fixed Preview Model not working correctly with some paths
    * Fixed Preview Model not reloading preview if type was changed
    * Tweaks in Factor vcol for piko.alldir - changed default 0.0 color to 0.5

commit 760af2b
Author: Michał <[email protected]>
Date:   Wed Dec 17 21:20:29 2025 +0100

    Fixes in nmaps and parts

    * Added "is_dynamic_road" and "is_terrain_material" to list of ignored attributes (not working in current legacy material format)
    * Tweaks in global nmap flavor (removed B channel support and forced 2-channel group node)
    * Added preview for "tsnmapuv2" flavor
    * Added preview for "tsnmapcalc" flavor (for dual texture)
    * Added few new FriendlyTags for nmaps
    * Fixed an issue where the currently assigned part was not displayed correctly

commit ae74365
Author: Michał <[email protected]>
Date:   Sun Nov 30 08:08:22 2025 +0100

    New options for parts and some fixes

    * Added 2 new settings to control automatic activation of parts (by default ON) when added, or when new variant is created.
    * Added auto remover for "diffuse_secondary" material attribute (not supported in current material format)
    * Fixed "defaultpart" part that was always being added to every imported root

commit 95a6855
Author: Michał <[email protected]>
Date:   Tue Nov 25 01:09:11 2025 +0100

    Update to Blender 5.0

    * Updated to Blender 5.0 (thanks to crisan21)
    * Changed button order in Lamp UV Tool (from front-rear-middle, to front-middle-rear)

commit 229c423
Author: Michał <[email protected]>
Date:   Sat Sep 27 04:07:42 2025 +0200

    Lamp System update + small tweaks

    * Updated minimum required Blender version to 4.5 (LTS recommended)
    * Added support for new UV Tile (5) in Lamp System + changes in 4th tile
    * Changed error text when texture attribute is not set (From "Texture doesn't exists" to "Texture is missing")
    * Tweaks in custom icons interval time (icons should break less often)
* Fixed error when importing/exporting .pia files
* Replaced old context property "user_properties" by "properties"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant