diff --git a/Source/InstancedMeshLineRendering/Private/GPUInstancedLineComponent.cpp b/Source/InstancedMeshLineRendering/Private/GPUInstancedLineComponent.cpp index bb26e02b63ea8129bafd159c71c1c495e23a27f8..1c9c81026d9a488c4a197b7f4aa47b9f035a3cfe 100644 --- a/Source/InstancedMeshLineRendering/Private/GPUInstancedLineComponent.cpp +++ b/Source/InstancedMeshLineRendering/Private/GPUInstancedLineComponent.cpp @@ -224,6 +224,7 @@ void UGPUInstancedLineComponent::PostInitProperties() UE_LOG(LogTemp, Display, TEXT("UGPUInstancedLineComponent::PostInitProperties IF")); } +//#pragma optimize("", off) #if WITH_EDITOR void UGPUInstancedLineComponent::PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent) @@ -291,22 +292,22 @@ void UGPUInstancedLineComponent::PostEditChangeChainProperty(FPropertyChangedCha { // Get Indices const int32 RemovedAtIndex = PropertyChangedEvent.GetArrayIndex(PropertyChangedEvent.Property->GetFName().ToString()); - const int32 LineIndex = PropertyChangedEvent.GetArrayIndex(PropertyChangedEvent.PropertyChain.GetActiveNode()->GetPrevNode()->GetValue()->GetFName().ToString()); + const int32 EditorLineIndex = PropertyChangedEvent.GetArrayIndex(PropertyChangedEvent.PropertyChain.GetActiveNode()->GetPrevNode()->GetValue()->GetFName().ToString()); check(RemovedAtIndex != INDEX_NONE); - check(LineIndex != INDEX_NONE); - + check(EditorLineIndex != INDEX_NONE); + // This isn't allowed to happen, but cannot be explicitly forbidden in the engine. For now, just hack it by inserting a point at 0,0,0. // Alternatively, just delete the line? TODO - if(EditorLines[LineIndex].Points.Num() < 2) + if(EditorLines[EditorLineIndex].Points.Num() < 2) { UE_LOG(LogTemp, Error, TEXT("UGPUInstancedLineComponent: A Line needs to consist of at least two points, trying to remove one of them doesn't work. Defaulted point inserted again!")); - EditorLines[LineIndex].Points.AddZeroed(1); - UpdatePoint(EditorLines[LineIndex].RespectiveLineId, RemovedAtIndex, EditorLines[LineIndex].Points[RemovedAtIndex].Point); + EditorLines[EditorLineIndex].Points.AddZeroed(1); + UpdatePoint(EditorLines[EditorLineIndex].RespectiveLineId, RemovedAtIndex, EditorLines[EditorLineIndex].Points[RemovedAtIndex].Point); } else { - RemovePoint(LineIndex, RemovedAtIndex); + RemovePoint(EditorLines[EditorLineIndex].RespectiveLineId, RemovedAtIndex); } } @@ -396,6 +397,7 @@ void UGPUInstancedLineComponent::PostEditChangeProperty(FPropertyChangedEvent& P Super::PostEditChangeProperty(PropertyChangedEvent); } #endif +//#pragma optimize("", on) // Doesn't do anything yet, just as a testing function to see execution order on Unreal startup. void UGPUInstancedLineComponent::PostLoad()