From 536a4bdfa2bb677aaff22230a4069dfcf9501bc9 Mon Sep 17 00:00:00 2001 From: Timon Roemer <t.roemer@vis.rwth-aachen.de> Date: Tue, 12 Mar 2024 10:32:18 +0100 Subject: [PATCH] Removes Debugging in Editor --- .../IntenSelectableCylinderScoring.h | 11 +++++ ...IntenSelectableCircleScoringVisualizer.cpp | 6 +-- .../IntenSelectableCubeScoringVisualizer.cpp | 6 +-- ...tenSelectableCylinderScoringVisualizer.cpp | 44 ++++++++++--------- .../IntenSelectableLineScoringVisualizer.cpp | 6 +-- ...nSelectableMultiPointScoringVisualizer.cpp | 10 ++--- ...ectableMultiRectangleScoringVisualizer.cpp | 2 +- ...IntenSelectableSphereScoringVisualizer.cpp | 6 +-- ...IntenSelectableCylinderScoringVisualizer.h | 1 + 9 files changed, 54 insertions(+), 38 deletions(-) diff --git a/Source/RWTHVRToolkit/Public/Interaction/Interactables/IntenSelect/IntenSelectableCylinderScoring.h b/Source/RWTHVRToolkit/Public/Interaction/Interactables/IntenSelect/IntenSelectableCylinderScoring.h index e78391b2..658626b4 100644 --- a/Source/RWTHVRToolkit/Public/Interaction/Interactables/IntenSelect/IntenSelectableCylinderScoring.h +++ b/Source/RWTHVRToolkit/Public/Interaction/Interactables/IntenSelect/IntenSelectableCylinderScoring.h @@ -19,6 +19,17 @@ protected: public: UIntenSelectableCylinderScoring(); + virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override + { + Super::PostEditChangeProperty(PropertyChangedEvent); + + // Check if the property changed is MyMonitoredProperty + if (PropertyChangedEvent.Property && PropertyChangedEvent.Property->GetName() == TEXT("LinePoints")) + { + + } + } + UPROPERTY(EditAnywhere) bool DrawDebug = true; diff --git a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCircleScoringVisualizer.cpp b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCircleScoringVisualizer.cpp index 447a1ee5..7a77b74e 100644 --- a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCircleScoringVisualizer.cpp +++ b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCircleScoringVisualizer.cpp @@ -60,7 +60,7 @@ bool FIntenSelectableCircleScoringVisualizer::VisProxyHandleClick(FEditorViewpor { bool bEditing = false; - UE_LOG(LogTemp, Warning, TEXT("Handling Click")); + //UE_LOG(LogTemp, Warning, TEXT("Handling Click")); if (VisProxy && VisProxy->Component.IsValid()) { @@ -126,7 +126,7 @@ bool FIntenSelectableCircleScoringVisualizer::HandleInputDelta(FEditorViewportCl if (CurrentSelectionIndex != INDEX_NONE) { - UE_LOG(LogTemp, Warning, TEXT("Current Selection! %s"), *DeltaTranslate.ToString()); + //UE_LOG(LogTemp, Warning, TEXT("Current Selection! %s"), *DeltaTranslate.ToString()); if(CurrentSelectionIndex == 0) { @@ -153,7 +153,7 @@ bool FIntenSelectableCircleScoringVisualizer::HandleInputDelta(FEditorViewportCl NotifyPropertiesModified(GetEditedScoringComponent(), Properties, EPropertyChangeType::ValueSet); }else { - UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); + //UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); } return bHandled; diff --git a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCubeScoringVisualizer.cpp b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCubeScoringVisualizer.cpp index 68b87f25..97e3f43c 100644 --- a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCubeScoringVisualizer.cpp +++ b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCubeScoringVisualizer.cpp @@ -49,7 +49,7 @@ bool FIntenSelectableCubeScoringVisualizer::VisProxyHandleClick(FEditorViewportC { bool bEditing = false; - UE_LOG(LogTemp, Warning, TEXT("Handling Click")); + //UE_LOG(LogTemp, Warning, TEXT("Handling Click")); if (VisProxy && VisProxy->Component.IsValid()) { @@ -108,7 +108,7 @@ bool FIntenSelectableCubeScoringVisualizer::HandleInputDelta(FEditorViewportClie if (CurrentSelectionIndex != INDEX_NONE) { - UE_LOG(LogTemp, Warning, TEXT("Current Selection! %s"), *DeltaTranslate.ToString()); + //UE_LOG(LogTemp, Warning, TEXT("Current Selection! %s"), *DeltaTranslate.ToString()); const FVector LocalCenter = GetEditedScoringComponent()->GetComponentLocation(); const FVector NewCenter = LocalCenter + DeltaTranslate; @@ -125,7 +125,7 @@ bool FIntenSelectableCubeScoringVisualizer::HandleInputDelta(FEditorViewportClie bHandled = true; }else { - UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); + //UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); } return bHandled; diff --git a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCylinderScoringVisualizer.cpp b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCylinderScoringVisualizer.cpp index 450c040f..7dc31963 100644 --- a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCylinderScoringVisualizer.cpp +++ b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableCylinderScoringVisualizer.cpp @@ -1,5 +1,4 @@ #include "Interaction/IntenSelectableCylinderScoringVisualizer.h" - #include "ActorEditorUtils.h" #include "SceneManagement.h" @@ -50,7 +49,7 @@ bool FIntenSelectableCylinderScoringVisualizer::VisProxyHandleClick(FEditorViewp { bool bEditing = false; - UE_LOG(LogTemp, Warning, TEXT("Handling Click")); + //UE_LOG(LogTemp, Warning, TEXT("Handling Click")); if (VisProxy && VisProxy->Component.IsValid()) { @@ -91,8 +90,6 @@ void FIntenSelectableCylinderScoringVisualizer::DrawVisualization(const UActorCo PDI->SetHitProxy(nullptr); } - PDI->SetHitProxy(new FCylinderPointProxy(Component, INDEX_NONE)); - const FVector Start = ComponentCasted->GetComponentTransform().TransformPositionNoScale(ComponentCasted->LinePoints[0]); const FVector End = ComponentCasted->GetComponentTransform().TransformPositionNoScale(ComponentCasted->LinePoints[1]); PDI->DrawLine(Start, End, FColor::Green, SDPG_World); @@ -100,7 +97,6 @@ void FIntenSelectableCylinderScoringVisualizer::DrawVisualization(const UActorCo const float Dist = (End-Start).Size(); DrawCylinder(PDI, Start, End, ComponentCasted->Radius,20 , &DebugMaterial, 0); - PDI->SetHitProxy(nullptr); } } @@ -133,31 +129,39 @@ bool FIntenSelectableCylinderScoringVisualizer::HandleInputDelta(FEditorViewport if (CurrentCylinderSelectionIndex != INDEX_NONE) { ScoringComponent->Modify(); - - UE_LOG(LogTemp, Warning, TEXT("Current Delta: %s"), *DeltaTranslate.ToString()); - UE_LOG(LogTemp, Warning, TEXT("Current Index: %d"), CurrentCylinderSelectionIndex); - + const FVector WorldSelection = ScoringComponent->GetComponentTransform().TransformPositionNoScale(ScoringComponent->LinePoints[CurrentCylinderSelectionIndex]); const FVector NewWorldPos = ScoringComponent->GetComponentTransform().InverseTransformPositionNoScale(WorldSelection + DeltaTranslate); ScoringComponent->LinePoints[CurrentCylinderSelectionIndex] += DeltaTranslate; - UE_LOG(LogTemp, Warning, TEXT("Component: %s"), *(ScoringComponent->LinePoints[CurrentCylinderSelectionIndex]).ToString()); - - ScoringComponent->MarkRenderStateDirty(); - GEditor->RedrawLevelEditingViewports(true); + //UE_LOG(LogTemp, Warning, TEXT("Component: %s"), *(ScoringComponent->LinePoints[CurrentCylinderSelectionIndex]).ToString()); - const FVector Average = (ScoringComponent->LinePoints[0] + ScoringComponent->LinePoints[1])/ 2; - const FVector ShiftToMiddle = Average; - - ScoringComponent->SetWorldLocation(ScoringComponent->GetComponentTransform().TransformPositionNoScale(Average)); - ScoringComponent->LinePoints[0] -= ShiftToMiddle; - ScoringComponent->LinePoints[1] -= ShiftToMiddle; TArray<FProperty*> Properties; Properties.Add(PointsProperty); Properties.Add(RadiusProperty); NotifyPropertiesModified(ScoringComponent, Properties, EPropertyChangeType::ValueSet); + + /* + const FVector Average = (ScoringComponent->LinePoints[0] + ScoringComponent->LinePoints[1]) / 2; + + ScoringComponent->SetWorldLocation(ScoringComponent->GetComponentTransform().TransformPositionNoScale(Average)); + ScoringComponent->LinePoints[0] -= Average; + ScoringComponent->LinePoints[1] -= Average; + + ScoringComponent->MarkRenderStateDirty(); + GEditor->RedrawLevelEditingViewports(true); + + ScoringComponent->PostEditChange(); + GEditor->NoteActorMovement(); + + // If you're modifying an actor's component, it might be a good idea to also mark the actor as modified + ScoringComponent->GetOwner()->Modify(); + ScoringComponent->GetOwner()->PostEditChange(); + + // If the component's package might be unsaved, mark it dirty to ensure changes aren't lost + ScoringComponent->GetOuter()->MarkPackageDirty();*/ GEditor->RedrawLevelEditingViewports(true); @@ -171,7 +175,7 @@ bool FIntenSelectableCylinderScoringVisualizer::HandleInputDelta(FEditorViewport ScoringComponent->MarkRenderStateDirty(); GEditor->RedrawLevelEditingViewports(true); - UE_LOG(LogTemp, Warning, TEXT("Cylinder Selected!")); + //UE_LOG(LogTemp, Warning, TEXT("Cylinder Selected!")); return false; } diff --git a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableLineScoringVisualizer.cpp b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableLineScoringVisualizer.cpp index a0f3d658..6a5c4514 100644 --- a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableLineScoringVisualizer.cpp +++ b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableLineScoringVisualizer.cpp @@ -48,7 +48,7 @@ bool FIntenSelectableLineScoringVisualizer::VisProxyHandleClick(FEditorViewportC { bool bEditing = false; - UE_LOG(LogTemp, Warning, TEXT("Handling Click")); + //UE_LOG(LogTemp, Warning, TEXT("Handling Click")); if (VisProxy && VisProxy->Component.IsValid()) { @@ -133,7 +133,7 @@ bool FIntenSelectableLineScoringVisualizer::HandleInputDelta(FEditorViewportClie ScoringComponent->AddWorldRotation(DeltaRotate); }else { - UE_LOG(LogTemp, Warning, TEXT("Current Selection! %s"), *DeltaTranslate.ToString()); + //UE_LOG(LogTemp, Warning, TEXT("Current Selection! %s"), *DeltaTranslate.ToString()); const FVector WorldSelection = ScoringComponent->GetComponentTransform().TransformPositionNoScale(GetEditedScoringComponent()->LinePoints[CurrentLineSelectionIndex]); const FVector NewWorldPos = ScoringComponent->GetComponentTransform().InverseTransformPositionNoScale(WorldSelection + DeltaTranslate); @@ -159,7 +159,7 @@ bool FIntenSelectableLineScoringVisualizer::HandleInputDelta(FEditorViewportClie }else { - UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); + //UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); } return bHandled; diff --git a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableMultiPointScoringVisualizer.cpp b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableMultiPointScoringVisualizer.cpp index bf5799f5..305b49b1 100644 --- a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableMultiPointScoringVisualizer.cpp +++ b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableMultiPointScoringVisualizer.cpp @@ -54,17 +54,17 @@ bool FIntenSelectableMultiPointScoringVisualizer::VisProxyHandleClick(FEditorVie FMultiPointProxy* Proxy = (FMultiPointProxy*)VisProxy; CurrentSelectionIndex = Proxy->TargetIndex; - UE_LOG(LogTemp, Warning, TEXT("Handling Click %i"), CurrentSelectionIndex); + //UE_LOG(LogTemp, Warning, TEXT("Handling Click %i"), CurrentSelectionIndex); }else { CurrentSelectionIndex = INDEX_NONE; - UE_LOG(LogTemp, Warning, TEXT("Handling Click => no selection")); + //UE_LOG(LogTemp, Warning, TEXT("Handling Click => no selection")); } } else { CurrentSelectionIndex = INDEX_NONE; - UE_LOG(LogTemp, Warning, TEXT("Handling Click => no selection")); + //UE_LOG(LogTemp, Warning, TEXT("Handling Click => no selection")); } @@ -112,7 +112,7 @@ bool FIntenSelectableMultiPointScoringVisualizer::HandleInputDelta(FEditorViewpo const FVector NewWorldPos = ScoringComponent->GetComponentTransform().InverseTransformPosition(WorldSelection + DeltaTranslate); ScoringComponent->PointsToSelect[CurrentSelectionIndex] = NewWorldPos; - UE_LOG(LogTemp, Warning, TEXT("New Pos: %s"), *ScoringComponent->PointsToSelect[CurrentSelectionIndex].ToString()); + //UE_LOG(LogTemp, Warning, TEXT("New Pos: %s"), *ScoringComponent->PointsToSelect[CurrentSelectionIndex].ToString()); ScoringComponent->MarkRenderStateDirty(); bHandled = true; @@ -125,7 +125,7 @@ bool FIntenSelectableMultiPointScoringVisualizer::HandleInputDelta(FEditorViewpo }else { - UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); + //UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); } return bHandled; diff --git a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableMultiRectangleScoringVisualizer.cpp b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableMultiRectangleScoringVisualizer.cpp index 3136547d..077c9710 100644 --- a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableMultiRectangleScoringVisualizer.cpp +++ b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableMultiRectangleScoringVisualizer.cpp @@ -241,7 +241,7 @@ bool FIntenSelectableRectangleScoringVisualizer::HandleInputDelta(FEditorViewpor return bHandled; }else { - UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); + //UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); } return false; diff --git a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableSphereScoringVisualizer.cpp b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableSphereScoringVisualizer.cpp index f6059cf7..db203cd6 100644 --- a/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableSphereScoringVisualizer.cpp +++ b/Source/RWTHVRToolkitEditor/Private/Interaction/IntenSelectableSphereScoringVisualizer.cpp @@ -43,7 +43,7 @@ bool FIntenSelectableSphereScoringVisualizer::VisProxyHandleClick(FEditorViewpor { bool bEditing = false; - UE_LOG(LogTemp, Warning, TEXT("Handling Click")); + //UE_LOG(LogTemp, Warning, TEXT("Handling Click")); if (VisProxy && VisProxy->Component.IsValid()) { @@ -104,7 +104,7 @@ bool FIntenSelectableSphereScoringVisualizer::HandleInputDelta(FEditorViewportCl if (true || CurrentSelectionIndex != INDEX_NONE) { - UE_LOG(LogTemp, Warning, TEXT("Current Selection! %s"), *DeltaTranslate.ToString()); + //UE_LOG(LogTemp, Warning, TEXT("Current Selection! %s"), *DeltaTranslate.ToString()); if((true || CurrentSelectionIndex == 0 )&& GetEditedComponent()) { @@ -143,7 +143,7 @@ bool FIntenSelectableSphereScoringVisualizer::HandleInputDelta(FEditorViewportCl } }else { - UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); + //UE_LOG(LogTemp, Warning, TEXT("No Current Selection!")); } return bHandled; diff --git a/Source/RWTHVRToolkitEditor/Public/Interaction/IntenSelectableCylinderScoringVisualizer.h b/Source/RWTHVRToolkitEditor/Public/Interaction/IntenSelectableCylinderScoringVisualizer.h index 6b9797e5..507cac5b 100644 --- a/Source/RWTHVRToolkitEditor/Public/Interaction/IntenSelectableCylinderScoringVisualizer.h +++ b/Source/RWTHVRToolkitEditor/Public/Interaction/IntenSelectableCylinderScoringVisualizer.h @@ -52,6 +52,7 @@ private: FColoredMaterialRenderProxy DebugMaterial; FProperty* RadiusProperty; FProperty* PointsProperty; + FProperty* LocationProperty; FComponentPropertyPath ScoringBehaviourPropertyPath; public: -- GitLab