AssetGenerator: restore static switch handling for UE 5.6 - #19
Open
UresiiZo wants to merge 1 commit into
Open
Conversation
UE 5.2 moved static switch parameters into editor-only data and the handling in UMaterialInstanceGenerator was commented out. UE 5.6 moved them back to the runtime set (FStaticParameterSetRuntimeData), so the node spawning and the up-to-date comparison can be restored: - EnsureStaticSwitchNodesPresent: restored with 5.6 field locations; existing parameters are also collected from cached expression data so function-based parameters in real parents are not duplicated; modified parent packages are now saved via GetAdditionalPackagesToSave. - IsSimpleAssetUpToDate: restored the static parameter comparison, ignoring ExpressionGUID (rewritten by PostLoad against stub parents) and non-overridden entries (trimmed by UpdateStaticPermutation). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restores the static switch parameter handling in
UMaterialInstanceGeneratorthat was disabled in "Fix deprecated usages for UE5.2" (7fb42af), updated for the UE 5.6 API.Why it can come back in 5.6
UE 5.2 moved static switch parameters into
FStaticParameterSetEditorOnlyDataand deprecated the old field, which is why the code was commented out. In UE 5.6 they moved back into the runtime base struct —FStaticParameterSetRuntimeData::StaticSwitchParameters(seeEngine/Source/Runtime/Engine/Public/StaticParameterSet.h; the editor-only copy is nowStaticSwitchParameters_DEPRECATED). Static component masks are still editor-only data.What was broken while it was commented out
IsSimpleAssetUpToDatereturnedtruewithout comparing static switches, so a MaterialInstance whose stored switch set diverged from the dump was never refreshed. Measured on a full Satisfactory 1.1 dump (18,544 packages): aMaterialInstanceConstant-whitelisted re-run with the comparison restored flagged and corrected 337 material instances with stale/missing switch data (e.g.MI_FactoryBaked_BFmissing itsbIsBuildEffect=trueoverride).Changes
EnsureStaticSwitchNodesPresent: restored both loops using the 5.6 field locations (runtimeStaticSwitchParameters, editor-onlyStaticComponentMaskParameters). Two additions over the pre-5.2 code:GetAllParameterInfoOfType(cached expression data) as well as top-level expressions. Real materials keep switches inside material function calls, where a top-level scan cannot see them — without this the generator spawns duplicate parameters into non-stub parents.PopulateSimpleAssetWithDatarecords the parent package inModifiedParentPackages, saved via aGetAdditionalPackagesToSaveoverride. The parent asset was already saved during its own generation pass, so without this the spawned nodes are silently lost (same failure class as AssetGenerator: save simple assets (MaterialInstance, MPC, PhysMat, DataAsset...) after data population - 5.6.1 regression #18).IsSimpleAssetUpToDate: restored the comparison with two deliberate differences from the pre-5.2operator==version:ExpressionGUIDis ignored. The dump GUID belongs to the original game material, while stub parents re-create parameter expressions with fresh GUIDs andUMaterialInstance::PostLoad(UpdateParameterSet) rewrites the instance-side GUIDs to match; comparing GUIDs would flag such assets "not up to date" on every run.UpdateStaticPermutationtrims them on apply.Testing
FactoryEditor Win64 Development.MI_WallSetConcrete_8x4/MI_Pillar_01(dump switch overrides present): both judged up to date once their stored values match the dump — no churn on repeat runs.MaterialInstanceConstantre-run: 337 instances refreshed once, converging to up-to-date afterwards; read-back via editor Python confirms the corrected instances resolve the dumped switch values (e.g. 19 switches onMI_RailingsincludingCanBePainted=True).MM_Grass_Mastergained its child'sEmissiveswitch parameter and was re-saved throughGetAdditionalPackagesToSave); parents whose cached data already exposes the switches (function-based parameters) are left untouched.🤖 Generated with Claude Code