[Tooldev] Custom component that responds to mouse clicks in the *Editor*?

Hey all,

Looking for any guidance the community can provide here. I need to make a custom ActorComponent that can respond to mouse clicks in the editor. Not at runtime, but for artists in the editor. The end goal is to be able to make something similar to a HISM Component, but one where you can click on the individual instances and edit them. For now though starting small I just want to start with being able to get the component to respond to mouse clicks.

I figured that the spline component works in a manner similar to what I want as not only does it respond to being selected in a generic sense, but it specifically responds to points being clicked on and then manipulated, including keys like the DEL key. However, looking at the code for the SplineComponent I could see absolutely nothing to do with mouse or input handling in there :frowning:

You’ll need to look into the FComponentVisualizer class.
See here for the spline component (you’ll need linked github account): https://github.com/EpicGames/UnrealEngine/blob/97c8d3ef55e869e17ef149903eae2a33101381c9/Engine/Source/Editor/ComponentVisualizers/Public/SplineComponentVisualizer.h

Oh interesting. so the visualizer connects the user interaction in the editor with the underlying component?

Yeah essentially. I haven’t written one yet. I think it basically provides a cut down version of a full on editor mode (such as landscape/foliage/etc).
A lot of the more complex built in components use them.