Description

https://udn.unrealengine.com/s/case/5004z00001n9LsOAAU/custom-primitive-data-on-bp-inst
ance-not-taking-affect-while-in-editor

Original Repo is from 4.27, however, it still happens in 5.2.
This is happening because the Instance Data system does not update the field
UPrimitiveComponent::CustomPrimitiveDataInternal from the data in
UPrimitiveComponent::CustomPrimitiveData (the editable field) when the component is
loaded.
To fix this issue, a call to UPrimitiveComponent::ResetCustomPrimitiveData() can be added to
FPrimitiveComponentInstanceData::ApplyToComponent(...), right before calling
MarkRenderStateDirty()
For Example:
void
FPrimitiveComponentInstanceData::ApplyToComponent(UActorComponent*
Component, const ECacheApplyPhase CacheApplyPhase)
{
...
if (Component->IsRegistered() && ((VisibilityId != INDEX_NONE)

SavedProperties.Num() > 0)) { PrimitiveComponent->ResetCustomPrimitiveData(); //This Line can be added. Component->MarkRenderStateDirty(); }

 

Since ResetCustomPrimitiveData() is a protected function, it will either need to be made
public, or FPrimitiveComponentInstanceData be made a friend of UPrimitiveComponent.
Callstack (If applicable, using -onethread ideally):
Please also provide any relevant project zip files, images, videos, log files etc alongside

Steps to Reproduce

Download the Licensee Repo from:
https://udn.unrealengine.com/s/contentdocument/0694z00000PmTwiAAF
Repo requires Unreal Engine source, attempting to generate project files or open
without results in a failure.
2. Once the project is open, open the map CPDTest and edit the Rendering->Custom
Primitive Data Defaults [0] field on the black cube Static Mesh Component by sliding
the slider.
While sliding the slider, the cube is the correct color. When the slider is released, it
reverts to black, no matter the value.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-182495 in the post.

7
Login to Vote

Fixed
ComponentUE - Rendering Architecture
Affects Versions5.2
Target Fix5.4
Fix Commit28189893
Main Commit28189914
CreatedApr 5, 2023
ResolvedSep 25, 2023
UpdatedOct 16, 2023
View Jira Issue