Skip to content

Commit

Permalink
Merged PR 710: Fix manipulation started notification PR
Browse files Browse the repository at this point in the history
Fixes a few references to `Constrainable` that were still present, as well as the Release Notes.
  • Loading branch information
julianjimenez-ms committed Mar 15, 2021
1 parent 59fbf43 commit b967855
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 36 deletions.
18 changes: 6 additions & 12 deletions Docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ keywords: Unreal, Unreal Engine, UE4, HoloLens, HoloLens 2, Mixed Reality, devel
- [Improved UxtRotationAxisConstraint's interaction with UxtBoundsControl and UxtGenericManipulator](#improved-uxtrotationaxisconstraints-interaction-with-uxtboundscontrol-and-uxtgenericmanipulator)
- [UxtBoundsControlComponent's face affordances](#uxtboundscontrolcomponents-face-affordances)
- [UxtMinMaxScaleConstraint is now implicit](#uxtminmaxscaleconstraint-is-now-implicit)
- [UxtConstrainableComponent changes](#uxtconstrainablecomponent-changes)
- [Renamed to UxtManipulatorComponent](#renamed-to-uxtmanipulatorcomponent)
- [Manipulators now notify each other when they start a new manipulation](#manipulators-now-notify-each-other-when-they-start-a-new-manipulation)
- [Added UxtManipulatorComponent](#added-uxtmanipulatorcomponent)
- [Added new Bounds Control presets without constrained affordances](#added-new-bounds-control-presets-without-constrained-affordances)
- [Breaking changes](#breaking-changes)
- [UxtHandTrackingFunctionLibrary removed](#uxthandtrackingfunctionlibrary-removed)
Expand Down Expand Up @@ -109,17 +107,13 @@ Thanks to these changes, `UUxtBoundsControlComponent` is now able to interact ap

### UxtMinMaxScaleConstraint is now implicit

Instead of relying on an external component (which is easier to forget about or misconfigure), potentially leading to undesired effects such as actor mirroring, all classes inheriting from `UUxtConstrainableComponent` (which includes `UUxtBoundsControlComponent` and `UUxtGenericManipulatorComponent`) have now an implicitly applied scale constraint, configurable via editor. See [TransformConstraints.md](TransformConstraints.md) for details.
Instead of relying on an external component (which is easier to forget about or misconfigure), potentially leading to undesired effects such as actor mirroring, all classes inheriting from **UxtManipulatorComponent** (which includes **UxtBoundsControlComponent** and **UxtGenericManipulatorComponent**) have now an implicitly applied scale constraint, configurable via editor. See [TransformConstraints.md](TransformConstraints.md) for details.

### **UxtConstrainableComponent** changes
### Added **UxtManipulatorComponent**

#### Renamed to **UxtManipulatorComponent**
This is the new base class for manipulators. It contains common [constraints' logic](TransformConstraints.md) and ensures that manipulators can notify each other when they start a new manipulation by using **OnExternalManipulationStarted** and **NotifyManipulationStarted**, effectively preventing undesired effects such as jitter when two or more of them are updating the transform at the same time.

This name better conveys the meaning of the class, which will become the real base for manipulators once **UxtManipulatorComponentBase** is removed in the _0.13.0_ release.

#### Manipulators now notify each other when they start a new manipulation

With the addition of **OnExternalManipulationStarted** and **NotifyManipulationStarted** to **UxtManipulatorComponent**, any components inheriting from this class (such as **UxtBoundsControlComponent** or **UxtGenericManipulatorComponent**) now notify the rest of them in their owner when they start a new manipulation. They react to **OnExternalManipulationStarted** by releasing their manipulation, effectively preventing undesired effects such as jitter when two or more of them are updating the transform at the same time.
**NOTE**: It shouldn't be confused with **UxtManipulatorComponentBase**, which will be removed (hopefully in the _0.13.0_ release).

### Added new Bounds Control presets without constrained affordances

Expand Down Expand Up @@ -172,7 +166,7 @@ RotationConstraint->AllowedAxis = EUxtAxis::None;

### UxtMinMaxScaleConstraint

As this component has been removed and its functionality is now embedded inside `UUxtConstrainableComponent`, you need to revisit any instances of this constraint that you had. All you need to do is copy the `MinScale`, `MaxScale` and `bRelativeToInitialScale` values over to all applicable components in the actor. Please remember that, if you have `UUxtBoundsControlComponent` and `UUxtGenericManipulatorComponent` in the same actor, you now need to configure both of them separately.
As this component has been removed and its functionality is now embedded inside **UxtManipulatorComponent**, you need to revisit any instances of this constraint that you had. All you need to do is copy the `MinScale`, `MaxScale` and `bRelativeToInitialScale` values over to all applicable components in the actor. Please remember that, if you have **UxtBoundsControlComponent**s and **UxtGenericManipulatorComponent** in the same actor, you now need to configure both of them separately.

### Renamed mesh for Bounds Control's face handles

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ void UUxtManipulatorComponent::NotifyManipulationStarted()
{
continue;
}
if (auto* ConstrainableComponent = Cast<UUxtManipulatorComponent>(ChildComponent))
if (auto* OtherManipulatorComponent = Cast<UUxtManipulatorComponent>(ChildComponent))
{
ConstrainableComponent->OnExternalManipulationStarted();
OtherManipulatorComponent->OnExternalManipulationStarted();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,44 @@ class UXTOOLS_API UUxtManipulatorComponent : public UActorComponent

public:
/** Get if the component is automatically detecting constraints. */
UFUNCTION(BlueprintGetter, Category = "Uxt Constrainable")
UFUNCTION(BlueprintGetter, Category = "Uxt Manipulator")
bool GetAutoDetectConstraints() const;

/** Set if the component should automatically detect constraints. */
UFUNCTION(BlueprintSetter, Category = "Uxt Constrainable")
UFUNCTION(BlueprintSetter, Category = "Uxt Manipulator")
void SetAutoDetectConstraints(bool bNewAutoDetectConstraints);

/** Get the list of currently selected constraints. */
UFUNCTION(BlueprintGetter, Category = "Uxt Constrainable")
UFUNCTION(BlueprintGetter, Category = "Uxt Manipulator")
const TArray<FComponentReference>& GetSelectedConstraints() const;

/** Add a constraint to be applied when bAutoDetectConstraints is not set. */
UFUNCTION(BlueprintCallable, Category = "Uxt Constrainable")
UFUNCTION(BlueprintCallable, Category = "Uxt Manipulator")
void AddConstraint(const FComponentReference& NewConstraint);

/** Remove a constraint from being applied when bAutoDetectConstraints is not set. */
UFUNCTION(BlueprintCallable, Category = "Uxt Constrainable")
UFUNCTION(BlueprintCallable, Category = "Uxt Manipulator")
void RemoveConstraint(const FComponentReference& NewConstraint);

//
// Implicit scale constraint's public API

UFUNCTION(BlueprintGetter, Category = "Uxt Constrainable")
UFUNCTION(BlueprintGetter, Category = "Uxt Manipulator")
bool GetRelativeToInitialScale() const { return bRelativeToInitialScale; }

UFUNCTION(BlueprintSetter, Category = "Uxt Constrainable")
UFUNCTION(BlueprintSetter, Category = "Uxt Manipulator")
void SetRelativeToInitialScale(const bool Value);

UFUNCTION(BlueprintGetter, Category = "Uxt Constrainable")
UFUNCTION(BlueprintGetter, Category = "Uxt Manipulator")
float GetMinScale() const { return MinScale; }

UFUNCTION(BlueprintSetter, Category = "Uxt Constrainable")
UFUNCTION(BlueprintSetter, Category = "Uxt Manipulator")
void SetMinScale(const float Value);

UFUNCTION(BlueprintGetter, Category = "Uxt Constrainable")
UFUNCTION(BlueprintGetter, Category = "Uxt Manipulator")
float GetMaxScale() const { return MaxScale; }

UFUNCTION(BlueprintCallable, Category = "Uxt Constrainable")
UFUNCTION(BlueprintCallable, Category = "Uxt Manipulator")
void SetMaxScale(const float Value);

protected:
Expand All @@ -71,18 +71,18 @@ class UXTOOLS_API UUxtManipulatorComponent : public UActorComponent
#endif

/** Initialize the constraints with a target component to use for a reference transform. */
UFUNCTION(BlueprintCallable, Category = "Uxt Constrainable")
UFUNCTION(BlueprintCallable, Category = "Uxt Manipulator")
void InitializeConstraints(USceneComponent* NewTargetComponent);

/** Apply the constraints to the transform. */
UFUNCTION(BlueprintCallable, Category = "Uxt Constrainable")
UFUNCTION(BlueprintCallable, Category = "Uxt Manipulator")
void ApplyConstraints(FTransform& Transform, EUxtTransformMode TransformMode, bool bIsOneHanded, bool bIsNear) const;

/** Get notified of another component starting a new manipulation. */
UFUNCTION(BlueprintCallable, Category = "Uxt Constrainable")
UFUNCTION(BlueprintCallable, Category = "Uxt Manipulator")
virtual void OnExternalManipulationStarted() PURE_VIRTUAL(UUxtManipulatorComponent::OnExternalManipulationStarted);

/** Notifies other Constrainable components by calling @ref OnExternalManipulationStarted on them. */
/** Notifies other manipulator components by calling @ref OnExternalManipulationStarted on them. */
void NotifyManipulationStarted();

private:
Expand All @@ -102,28 +102,27 @@ class UXTOOLS_API UUxtManipulatorComponent : public UActorComponent

/** If set, all constraints present on the actor will be applied, otherwise only selected constraints will be applied. */
UPROPERTY(
EditAnywhere, Category = "Uxt Constrainable", BlueprintGetter = GetAutoDetectConstraints,
BlueprintSetter = SetAutoDetectConstraints)
EditAnywhere, Category = "Uxt Manipulator", BlueprintGetter = GetAutoDetectConstraints, BlueprintSetter = SetAutoDetectConstraints)
bool bAutoDetectConstraints = true;

/** The list of constraints to be applied if bAutoDetectConstraints is false. */
UPROPERTY(
EditAnywhere, Category = "Uxt Constrainable", BlueprintGetter = GetSelectedConstraints,
EditAnywhere, Category = "Uxt Manipulator", BlueprintGetter = GetSelectedConstraints,
meta = (/*UseComponentPicker, AllowedClasses = "UxtTransformConstraint",*/ EditCondition = "!bAutoDetectConstraints"))
TArray<FComponentReference> SelectedConstraints;

/** Whether the min/max scale values should be relative to the initial scale or absolute. */
UPROPERTY(
EditAnywhere, BlueprintGetter = GetRelativeToInitialScale, BlueprintSetter = SetRelativeToInitialScale,
Category = "Uxt Constrainable")
Category = "Uxt Manipulator")
bool bRelativeToInitialScale = true;

/** Minimum scale allowed. Will be used as relative or absolute depending on the value of @ref bRelativeToInitialScale. */
UPROPERTY(EditAnywhere, Category = "Uxt Constrainable", BlueprintGetter = GetMinScale, BlueprintSetter = SetMinScale)
UPROPERTY(EditAnywhere, Category = "Uxt Manipulator", BlueprintGetter = GetMinScale, BlueprintSetter = SetMinScale)
float MinScale = 0.2f;

/** Maximum scale allowed. Will be used as relative or absolute depending on the value of @ref bRelativeToInitialScale. */
UPROPERTY(EditAnywhere, Category = "Uxt Constrainable", BlueprintGetter = GetMaxScale, BlueprintSetter = SetMaxScale)
UPROPERTY(EditAnywhere, Category = "Uxt Manipulator", BlueprintGetter = GetMaxScale, BlueprintSetter = SetMaxScale)
float MaxScale = 2.0f;

/** The list constraints currently being applied. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void FUxtManipulatorComponentCustomization::CustomizeDetails(IDetailLayoutBuilde
}
}

IDetailCategoryBuilder& Category = DetailBuilder.EditCategory("Uxt Constrainable");
IDetailCategoryBuilder& Category = DetailBuilder.EditCategory("Uxt Manipulator");
const FText Description = FText::AsCultureInvariant("Add Constraint");
Category.AddCustomRow(Description)
.NameContent()[SNew(STextBlock).Font(IDetailLayoutBuilder::GetDetailFont()).Text(Description)]
Expand Down

0 comments on commit b967855

Please sign in to comment.