SColorGradientEditor does not trigger OnCurveChanged events

Hello; I am looking through your ramp implementation. SCurveEditor, class which is used for float ramps, seems to trigger OnCurveChanged events for the underlying curve; however SColorGradientEditor (constructed by SCurveEditor) seems to be missing calls to these (when creating and manipulating color curve keys). For the calls it does not intercept, curve manipulation events come through (like right mouse click). But for other ones, no go.

Thanks.

PS. I tagged this as 4.11, but this is present in previous versions as well.

Hello,

Which files are you looking at? We found the SCurveEditor.h and the Gradient Viewer variable which is a TSharedPtr to the SColorGradientEditor. Other than GetColorGradientVisibility, this is the only reference to Color Gradient in SCurveEditor.cpp. Let me know exactly what you are trying to accomplish?

Hello,

Basically, when you create UCurveFloat and assign it to SCurveEditor, then it uses the regular curve editor widget and does not use SColorGradientEditor TSharedPtr (well it’s created there, but it’s not used in this case). Mouse events in SCurveEditor will change the curve and will trigger OnCurveChanged calls in UCurveFloat .

SColorGradientEditor is in SColorGradientEditor.h; if you create UCurveLinearColor and assign it to SCurveEditor widget, it will use SColorGradientEditor. Mouse events in SColorGradientEditor will change the curve and will not trigger OnCurveChanged calls. I am pretty sure this is not the intention?

I am trying to get OnCurveChanged callbacks for my curve objects when they are operated on by curve editor widgets. I only get them fired for UCurveFloat but not for UCurveLinearColor .

Thanks!

Thank you for providing the additional information.

Could you provide the code that you are working with?

Sure!

and

OnCurveChanged are fired for UHoudiniAssetParameterRampCurveFloat (derivative of UCurveFloat) but not for UHoudiniAssetParameterRampCurveColor (derivative of UCurveLinearColor).

SCurveEditor does have calls to OnCurveChanged on curve key modifications and SColorGradientEditor doesn’t. Events that don’t go through to SColorGradientEditor from SCurveEditor (like right mouse click) will generate OnCurveChanged on UCurveLinearColor.

SColorGradientEditor curve modification will however call Modify for each curve key operation and will generate undo/redo transactions. My solution at the moment is to override Modify for UCurveLinearColor derivative, detect that undo transaction is in process and spin until transaction is active; once it is not active, I can take care of curve modification. Horrible solution, but that’s the only thing I could think of.

Thanks.

I apologize for the continued back and forth, this is an aspect of the engine I’m not yet familiar with. If I am following correctly, you are saying that:

A class based on UCurveFloat will trigger OnCurveChanged correct

A class based on UCurveLinearColor will not trigger

What exactly is HoudiniAssetParameterMultiparm? the HoudiniAssetParameterRamp class is based on this but I’m not sure where it derives from.

I’m also not sure I understand where SCurveEditor & SColorGradientEditor come into play. In the code you provided SCurveEditor does not mention OnCurveChanged and I’m not able to find a reference to the SColorGradientEditor class.

Would it be possible to provide steps that I can follow to setup a test locally or provide a smaller class/project that only has changes related to how you are using OnCurveChanged?

SCurveEditor has member CurveOwner (set with SCurveEditor::SetCurveOwner). Look inside SCurveEditor implementation for CurveOwner->OnCurveChanged calls. These calls are made on curve key events.

Now SCurveEditor::SetCurveOwner also forwards SetCurveOwner to
GradientViewer member (type SColorGradientEditor). That’s the TSharedPtr.

Now look inside SColorGradientEditor.cpp; none of the curve key events have CurveOwner->OnCurveChanged calls, they are not there.

So basically OnCurveChanged events are not triggered for your color ramps.

I guess that’s a bug. You are correct that UCurveFloat will trigger OnCurveChanged, since SColorGradientEditor member is not used in this case (mouse events are not routed to that widget) and are handled
by SCurveEditor, so OnCurveChanged are made.

My code just shows what I expect and a use case. Sorry for confusion. Also I appreciate the help.

Hello,

I have entered a bug report for your issue (UE-27507). Thank you for your report and for providing the necessary clarification on this issue. I will provide updates on this as they become available.

Have a great day

Awesome, thanks Sean.

The issue was claimed fixed back in 2017 on 4.18: Unreal Engine Issues and Bug Tracker (UE-27507)

Unless I am doing something wrong I still can’t get OnCurveChanged() to trigger from UCurveLinearColor, unless I am manipulating the gradient/ramp, it just won’t work from a curve.