Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 'tsnmapcalc' Flavor #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Support for 'tsnmapcalc' Flavor
Small modification that adds support for 'tsnmapcalc' flavor mostly used in road templates models, where road texture use normal map.
  • Loading branch information
Michaleczeq committed Jun 12, 2022
commit 0bf58270d1f2bb919c50faac21d2701fc3c42857
60 changes: 59 additions & 1 deletion addon/io_scs_tools/properties/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ def get_texture_types():
"""
return {'base', 'reflection', 'over', 'oclu', 'mask', 'mult', 'iamod', 'lightmap', 'paintjob',
'flakenoise', 'nmap', 'base_1', 'mult_1', 'detail', 'nmap_detail', 'layer0', 'layer1',
'sky_weather_base_a', 'sky_weather_base_b', 'sky_weather_over_a', 'sky_weather_over_b'}
'sky_weather_base_a', 'sky_weather_base_b', 'sky_weather_over_a', 'sky_weather_over_b',
'nmap_over'}

def get_id(self):
"""Gets unique ID for material within current Blend file. If ID does not exists yet it's calculated.
Expand Down Expand Up @@ -420,6 +421,12 @@ def update_shader_texture_nmap_detail(self, context):
def update_shader_texture_nmap_detail_settings(self, context):
__update_shader_texture_tobj_file__(self, context, "nmap_detail")

def update_shader_texture_nmap_over(self, context):
__update_shader_texture__(self, context, "nmap_over")

def update_shader_texture_nmap_over_settings(self, context):
__update_shader_texture_tobj_file__(self, context, "nmap_over")

def update_shader_texture_oclu(self, context):
__update_shader_texture__(self, context, "oclu")

Expand Down Expand Up @@ -1380,6 +1387,57 @@ def update_shader_texture_sky_weather_over_b_settings(self, context):
options={'HIDDEN'},
)

# TEXTURE: NMAP_OVER
shader_texture_nmap_over: StringProperty(
name="Texture NMap Over",
description="Texture Nmap Over for active Material",
default=_MAT_consts.unset_bitmap_filepath,
options={'HIDDEN'},
subtype='NONE',
update=update_shader_texture_nmap_over,
)
shader_texture_nmap_over_imported_tobj: StringProperty(
name="Imported TOBJ Path",
description="Use imported TOBJ path reference which will be exported into material (NOTE: export will not take care of any TOBJ files!)",
default="",
update=__update_look__
)
shader_texture_nmap_over_locked: BoolProperty(
name="Texture Locked",
description="Tells if texture is locked and should not be changed by user(intended for internal usage only)",
default=False
)
shader_texture_nmap_over_map_type: StringProperty(
name="Texture Map Type",
description="Stores texture mapping type and should not be changed by user(intended for internal usage only)",
default="2d"
)
shader_texture_nmap_over_settings: EnumProperty(
name="Settings",
description="TOBJ settings for this texture",
items=__get_texture_settings__(),
default=set(),
options={'ENUM_FLAG'},
update=update_shader_texture_nmap_over_settings
)
shader_texture_nmap_over_tobj_load_time: StringProperty(
name="Last TOBJ load time",
description="Time string of last loading",
default="",
)
shader_texture_nmap_over_use_imported: BoolProperty(
name="Use Imported",
description="Use custom provided path for TOBJ reference",
default=False,
update=__update_look__
)
shader_texture_nmap_over_uv: CollectionProperty(
name="Texture Nmap Over UV Sets",
description="Texture Nmap Over UV sets for active Material",
type=UVMappingItem,
options={'HIDDEN'},
)

# TEXTURE: OCCLUSION
shader_texture_oclu: StringProperty(
name="Texture Oclu",
Expand Down
27 changes: 25 additions & 2 deletions addon/io_scs_tools/shader_presets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ Shader {
Shader {
PresetName: "dif.spec.weight"
Effect: "eut2.dif.spec.weight"
Flavors: ( "NMAP_TS|NMAP_TS_UV|NMAP_TS_16|NMAP_TS_UV_16" "SHADOW" "PAINT" "TEXGEN0" "ASAFEW" "ALPHA" "DEPTH" "BLEND_OVER|BLEND_MULT|BLEND_ADD" )
Flavors: ( "NMAP_TS|NMAP_TS_UV|NMAP_TS_16|NMAP_TS_UV_16|NMAP_TS_CALC" "SHADOW" "PAINT" "TEXGEN0" "ASAFEW" "ALPHA" "DEPTH" "BLEND_OVER|BLEND_MULT|BLEND_ADD" )
Flags: 0
Attribute {
Format: FLOAT3
Expand Down Expand Up @@ -1106,7 +1106,7 @@ Shader {
Shader {
PresetName: "dif.spec.weight.weight.dif.spec.weight"
Effect: "eut2.dif.spec.weight.weight.dif.spec.weight"
Flavors: ( "SHADOW" "TEXGEN0" "TEXGEN1" "ALPHA" )
Flavors: ( "NMAP_TS_CALC_OVER" "SHADOW" "TEXGEN0" "TEXGEN1" "ALPHA" )
Flags: 0
Attribute {
Format: FLOAT3
Expand Down Expand Up @@ -2002,6 +2002,29 @@ Flavor {
TexCoord: ( 6 )
}
}
Flavor {
Type: "NMAP_TS_CALC"
Name: "tsnmapcalc"
Texture {
Tag: "texture[X]:texture_nmap"
Value: ""
TexCoord: ( 0 )
}
}
Flavor {
Type: "NMAP_TS_CALC_OVER"
Name: "tsnmapcalc"
Texture {
Tag: "texture[X]:texture_nmap"
Value: ""
TexCoord: ( 0 )
}
Texture {
Tag: "texture[X]:texture_nmap_over"
Value: ""
TexCoord: ( 1 )
}
}
Flavor {
Type: "NOCULL"
Name: "nocull"
Expand Down