How to specify brush shape and dimensions via code for a custom volume (or BSP)

I have a custom trigger volume class derived from ‘AVolume’, say ‘ACustomVolume’.

I have no problems using this class in the level if I use the ‘place actor’ editor tool to place these - I get a nice default cube shape with x/y/z exposed and can change the volume using the brush builder dropdown.

Now I’ve created a blueprint subclass of this (say ‘BP_Custom_Volume’) with some added functionality but if I drop this blueprint actor into the level the default shape does not get created. Nothing happens even if I manually setup a cubebuilder from the dropdown and specify x/y/z from the details panel.

Obviously there’s some magic happening when a (non-blueprint) volume class is dropped into the level that automatically generates the default builder and I need to make this happen in my custom class, but after digging through the source code quite a bit (Brush.cpp/EditorBrushBuilder.cpp/Model.cpp/etc) I think I can safely say I’m stuck :frowning:

Below is a snippet of code I found on the Answers hub; I’ve tried calling it in many different ways (custom UFunction called from Blueprint construction script/PostEditChangeProperty override/etc) but it doesn’t seem to do anything.


	UCubeBuilder* cubeBuilder = Cast<UCubeBuilder>(GEditor->FindBrushBuilder(UCubeBuilder::StaticClass()));
	cubeBuilder->X = 1000;
	cubeBuilder->Y = 1000;
	cubeBuilder->Z = 200;
	cubeBuilder->Build(World, this);

	GEditor->Exec(World, TEXT("BRUSH ADDED"));
	GEditorModeTools().MapChangeNotify();

To summarize - I need a way to setup my custom Brush actor’s default shape and extents (example to a cube sized 100,100,100) just as the Editor does to any ‘pure’ brush actor (C++ based Volume OR BSP) that is placed into a level.

A quick update - I’ve confirmed that the code snippet above works for pure C++ based custom volumes. i.e If I simply drag my ‘ACustomVolume’ base class to my level I can call the code snippet above in a ‘PostEditChangeProperty’ block I do have control over the geometry.

So to vastly simplify the original question - Is it impossible for custom Volumes (or any Brush actor) to have blueprint subclasses and still be able to build/render the brush geometry properly?

If so, I’ll have to port the blueprint part of my custom volume straight to C++ - I wish I could avoid this as I find Blueprints super-handy in quickly adding additional functionality to a class while letting C++ do the heavy lifting.

Hey VSZ,

as this thread is posted long time ago: but did you find a way to use these brush settings in Blueprints ? I want to use the BSP/Brush-functionality for defining custom shape triggers. But din´t find a way to build a actor in c++, make blueprints out of it so the designer can simply edit the trigger in the editor.

Greetings

@VSZ I know it’s quite late but were you able to solve it? I have also faced a similar problem spawning AProceduralFoliageVolume and not being able to create bounding box programmatically. The Spawner is created with 0,0,0 bounds.