Skip to content

Commit

Permalink
Dock glow/dirty glass updates for boron content
Browse files Browse the repository at this point in the history
  • Loading branch information
bvbohnen committed Apr 24, 2023
1 parent 567694c commit 251e9b3
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Support/steam_versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"sn_extra_game_options": "1.14",
"sn_better_target_monitor": "2.1",
"sn_mod_support_apis": "1.88",
"sn_remove_dock_glow": "1.3",
"sn_remove_dock_glow": "1.4",
"sn_quiet_target_range_clicks": "1.1",
"sn_remove_blinking_lights": "1.5",
"sn_remove_dirty_glass": "1.6",
"sn_remove_dirty_glass": "1.7",
"sn_remove_highway_blobs": "0.1",
"sn_start_with_seta": "1.1",
"sn_debug_info": "1.1",
Expand Down
2 changes: 1 addition & 1 deletion extensions/extensions.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>f6c389ca-f38e-4609-9962-215729e29106</ProjectGuid>
<ProjectHome>.</ProjectHome>
<StartupFile>sn_sector_travel_rebalance\Customizer_Script.py</StartupFile>
<StartupFile>sn_remove_dock_glow\Customizer_Script.py</StartupFile>
<SearchPath>..\..\X4_Customizer</SearchPath>
<WorkingDirectory>.</WorkingDirectory>
<OutputPath>.</OutputPath>
Expand Down
94 changes: 78 additions & 16 deletions extensions/sn_remove_dirty_glass/Customizer_Script.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
from copy import deepcopy
from lxml import etree
from lxml.etree import Element
from pathlib import Path
this_dir = Path(__file__).resolve().parent

Expand Down Expand Up @@ -214,18 +215,24 @@ def Clean_Dirty_Glass():
# ]

for mat_name in [
'cockpit_glass_inside_01',

# 02 version only used on an argon bridge, and seems less
# developed.
'cockpit_glass_inside_02',

#'cockpit_glass_outside_01',
#'cockpit_glass_outside_02',
'p1_window_trim_01',
'p1_window_trim_02', # Only used in a couple l/xl bridges.
# p1_window_trim_03 - diffuse map added in 3.10hf1b1, no mat entry yet.
'cockpit_glass_inside_01',

# 02 version only used on an argon bridge, and seems less
# developed.
'cockpit_glass_inside_02',

#'cockpit_glass_outside_01',
#'cockpit_glass_outside_02',
'p1_window_trim_01',
'p1_window_trim_02', # Only used in a couple l/xl bridges.
# p1_window_trim_03 - diffuse map added in 3.10hf1b1, no mat entry yet.

# Boron dlc adds new dirty glass textures.
'gen_p2_cockpitglassinside_01',
'fx_p2_windowtrim_01',
#'gen_p2_glassinterior_01',
]:

mat_node = xml_root.xpath(".//material[@name='{}']".format(mat_name))
assert len(mat_node) == 1
mat_node = mat_node[0]
Expand Down Expand Up @@ -263,22 +270,77 @@ def Clean_Dirty_Glass():
# As of 5.0 beta, this no longer works; makes the entire mat
# hazy white. (This remains true if the below color alpha
# change is also applied.)
# This is still needed to support pre-5.0 versions.
# -Removed
#for bitmap in mat_node.xpath("./properties/property[@type='BitMap']"):
# bitmap.set('value', r'assets\textures\fx\transparent_diff')
# Update: for 6.0, this is needed to clean up the trim on
# the boron ships (which is otherwise unaffected by Str
# changes below for some unknown reason). Some reports exist
# of it breaking during 6.0b5, but couldn't be confirmed on
# 6.0 release. For now, just apply to boron trim.
if mat_name == 'fx_p2_windowtrim_01':
for bitmap in mat_node.xpath("./properties/property[@type='BitMap']"):
bitmap.set('value', r'assets\textures\fx\transparent_diff')

# Try changing the Color alpha to clear instead of 255.
# -no effect
#for color in mat_node.xpath("./properties/property[@type='Color']"):
# color.set('a', '0')

# Try changing the "...Str" values (strength?) to 0.
# Change the "...Str" values (strength?) to 0.
# Note: non-0 Str values are new in 5.0.
for color in mat_node.xpath("./properties/property[@type='Float']"):
if color.get('name').endswith('Str'):
color.set('value', '0')

# On reviewing the glass shader, there are some Str fields not
# present in the material library entries which can potentially
# bet set to 0.
# Look up all Str fields in the ogl file, and set them to 0 here.
# (Maybe unecessary.)
if 0:
shader_fields = {
'p1_glass.fx':[
'smoothStr',
'metalStr',
'diffuseStr',
'diffuse_detailStr',
'diffuse_paintStr',
'normalStr',
'normal_detailStr',
'color_glowStr',
'color_dirtStr',
'environmentStr',
'envi_lightStr',
],
'P1_complex_surface_translucent.fx':[
'smoothStr',
'metalStr',
'diffuseStr',
'diffuse_detailStr',
'diffuse_paintStr',
'normalStr',
'normal_detailStr',
'color_glowStr',
'color_dirtStr',
'environmentStr',
'patternStr',
'translucencyStr',
],
}
for shader, fields in shader_fields.items():
if mat_node.get('shader') != shader:
continue
properties_node = mat_node.xpath("./properties")[0]
for field in fields:
# Skip if node already present.
if mat_node.xpath(f"./properties/property[@name='{field}']"):
continue
# Add the node, with suitable attributes.
new_node = Element('property',
name = field,
type = 'Float',
value = '0')
properties_node.append(new_node)


material_file.Update_Root(xml_root)

return
Expand Down
4 changes: 3 additions & 1 deletion extensions/sn_remove_dirty_glass/change_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ Change Log
* 1.5
- Improved compatibility with various dlc combinations.
* 1.6
- Removed pre-5.0 legacy support due to possible 6.0 conflicts.
- Removed pre-5.0 legacy support due to possible 6.0 conflicts.
* 1.7
- Added support for boron ships.
2 changes: 2 additions & 0 deletions extensions/sn_remove_dirty_glass/content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@
<text description=" " language="82"/>
<text description=" " language="86"/>
<text description=" " language="88"/>

<dependency id="ego_dlc_boron" optional="true"></dependency>
</content>
7 changes: 6 additions & 1 deletion extensions/sn_remove_dock_glow/Customizer_Script.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,14 @@ def Remove_Dock_Glow():
being above some threshold.
'''
# Find every "dockarea" file (expecting arg and bor versions).
dock_files = Load_Files('*dockarea_*_m_station*.xml')
dock_files = Load_Files('*dockarea*.xml')

for game_file in dock_files:
# Ignore if there was a loading error (occurs from an empty xml
# 'dockarea_gen_xl_venturer_01_macro.xml').
if game_file.load_error:
continue

xml_root = game_file.Get_Root()

results = xml_root.xpath(".//connection[parts/part/@name='fx_glow']")
Expand Down
4 changes: 3 additions & 1 deletion extensions/sn_remove_dock_glow/change_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ Change Log
* 1.2
- Added some safety against game version changes.
* 1.3
- Added support for boron docks.
- Added support for boron docks.
* 1.4
- Supporting even more boron docks.

0 comments on commit 251e9b3

Please sign in to comment.