FMaterialCachedExpressionData::UpdateForExpressions iterates on all expressions, even for those that are not enabled in a material instance or not even connected to output.
This will enable features (such as WPO) that wouldn’t be used since the connection may be on a disconnected path, so this can be create performance issues and debugging headache.
I see a specific comment in IsGBufferLayoutSupportedForMaterial: “FMaterialShaderParameters::bHasVertexPositionOffsetConnected means that the material *could* have WPO”.
So I think this is not really clear, for your commenter too.
In other parts, UMaterial::IsPropertyConnected is considered as “is property used and different from the usual default”, such as FMaterialResource::IsNonmetal (the connected constant may be a 1 on Metallic pin).
Steps to Reproduce
Create a new material. Create a SetMaterialAttributes node (leave it disconnected from material output) with WorldPositionOutput pin and connect to it a Time node.
UMaterial::HasVertexPositionOffsetConnected returns true, even if WorldPositionOutput is not connected to output.
Apologies for the delay. I’ve verified this issue still exists in latest and created the following issue which should be visible soon for tracking https://issues.unrealengine.com/issue/UE\-393669
In 5.8 the already bugged IsPropertyConnected code became worser thanks to the additional “checks” made in FMaterialCachedExpressionData::DoPostAnalyzeChecks. I Initially thought that the issue is the new r.Material.PedanticErrorChecksEnabled, but the bug following FOR does not check for its value. If a material used a static switch with a material attributes on a branch but a non material attributes on the other it is not considered an error as a mismathed typed connection: but it forces all material attributes to be “used” and “connected”. the static switch can be unconnected to the graph, since the code just iterates on every nodes.