diff --git a/Source/RWTHVRToolkit/Public/Interaction/Interactables/IntenSelect/IntenSelectableCylinderScoring.h b/Source/RWTHVRToolkit/Public/Interaction/Interactables/IntenSelect/IntenSelectableCylinderScoring.h index e78391b2e95259f96cf49b74f6aad0def2d9729a..658626b44159e53b3c3e3fa8dbe68e8952925f1a 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 447a1ee5bbea9f3449b2591271db6eb4233cd1c5..7a77b74e67202fa90191d7d537dfd33c9a1c986f 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 68b87f259445bda1073bc8f055d70433df6f4a6f..97e3f43c8bf5d83c7866c1ab3b87b9998bca8c91 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 450c040fe4fcab52c261241e73d05047ca7c8d75..7dc319633ee56cc884feb3bb1a01737483afcfc2 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 a0f3d65899d58dd14691b3ba532365b25d893c2d..6a5c4514610b7e234da2aabcbb12190969b3b107 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 bf5799f50f5df41310f58e6fd4c1e4aeed17e197..305b49b132f927b23622eef3e762c62f07ec0795 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 3136547d2541363787a98fabc20c9c04c015c881..077c97102bb94e0f40be3f9f8fcb180820346cf7 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 f6059cf7901d8b70257a5fe380da18cc332e6a9e..db203cd61f332a740ebf81ddf33fe82e3b063a4b 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 6b9797e5644dfe96107d78f2c394234c74f9e920..507cac5b50179e734cdc754f033ee0be6dd0f366 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: