UCubeGridTool

Tool that allows for blocky boolean operations on an orientable power-of-two grid.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

MeshModelingToolsExp

Header

/Engine/Plugins/Experimental/MeshModelingToolsetExp/Source/MeshModelingToolsExp/Public/CubeGridTool.h

Include

#include "CubeGridTool.h"

Syntax

UCLASS()
class UCubeGridTool :
    public UInteractiveTool,
    public IClickDragBehaviorTarget,
    public IHoverBehaviorTarget,
    public UE::Geometry::IDynamicMeshOperatorFactory,
    public IInteractiveToolNestedAcceptCancelAPI

Remarks

Tool that allows for blocky boolean operations on an orientable power-of-two grid.

Variables

Name Description

Protected variable

bool

 

bAdjustSelectionOnPreviewUpdate

Protected variable

bool

 

bBlockUntilPreviewUpdate

Protected variable

bool

 

bChangeSideToggle

Protected variable

bool

 

bChangesMade

Used to see if we need to update the asset that we've been modifying.

Protected variable

bool

 

bHaveHoveredSelection

Protected variable

bool

 

bHaveSelection

Protected variable

bool

 

bInGizmoDrag

Protected variable

bool

 

bMouseDragShouldPushPull

Protected variable

bool

 

bPreviewMayDiffer

Protected variable

bool

 

bPreviousHaveSelection

Protected variable

bool

 

bSelectionToggle

Protected variable

bool

 

bSlideToggle

Protected variable

bool

 

bWaitingToApplyPreview

Protected variable

FViewCameraStat...

 

CameraState

Protected variable UProperty

TObjectPtr< UCl...

 

ClickDragBehavior

Protected variable

TSharedPtr< con...

 

ComputeStartMesh

Safe inputs for the background compute to use, untouched by undo/redo/other CurrentMesh updates.

Protected variable

bool[4]

 

CornerSelectedFlags

Used in corner push/pull mode.

Protected variable

UE::Geometry::F...

 

CornersGeometrySet

Protected variable UProperty

TObjectPtr< ULo...

 

CtrlMiddleClickBehavior

Protected variable

TSharedPtr< FCu...

 

CubeGrid

Protected variable

int32

 

CurrentExtrudeAmount

Protected variable

TSharedPtr< UE:...

 

CurrentMesh

Protected variable

UE::Geometry::F...

 

CurrentMeshTransform

Protected variable

double

 

DragProjectedStartParam

Protected variable

FRay3d

 

DragProjectionAxis

Protected variable UProperty

TObjectPtr< UCu...

 

DuringActivityActions

Protected variable

int32

 

GridFrameOrientationWatcherIdx

Protected variable

int32

 

GridFrameOriginWatcherIdx

Protected variable UProperty

TObjectPtr< UCo...

 

GridGizmo

Protected variable UProperty

TObjectPtr< UDr...

 

GridGizmoAlignmentMechanic

Protected variable UProperty

TObjectPtr< UTr...

 

GridGizmoTransformProxy

Protected variable UProperty

TObjectPtr< UMo...

 

HoverBehavior

Protected variable

UE::Geometry::F...

 

HoveredSelectionBox

Protected variable

TSharedPtr< TAr...

 

LastOpChangedTids

Protected variable UProperty

TObjectPtr< UPr...

 

LineSets

Protected variable UProperty

TObjectPtr< UNe...

 

MaterialProperties

Protected variable

TSharedPtr< UE:...

 

MeshSpatial

Protected variable UProperty

TObjectPtr< ULo...

 

MiddleClickDragBehavior

Protected variable

FVector3d

 

MiddleClickDragStart

Protected variable

EMode

 

Mode

Important state. Could refactor things into tool activities (like PolyEdit) someday.

Protected variable

EMouseState

 

MouseState

Protected variable UProperty

TObjectPtr< UCr...

 

OutputTypeProperties

Protected variable

ECubeGridToolAc...

 

PendingAction

Protected variable

uint8

 

PowerOfTwoPrevious

Protected variable

bool[4]

 

PreDragCornerSelectedFlags

Protected variable UProperty

TObjectPtr< UMe...

 

Preview

Protected variable

FSelection

 

PreviousSelection

Protected variable

FToolDataVisual...

 

SelectedCornerRenderer

Protected variable

FSelection

 

Selection

Protected variable UProperty

TObjectPtr< UCu...

 

Settings

Properties, etc.

Protected variable UProperty

TObjectPtr< UTo...

 

Target

Existing asset to modify, if one was selected.

Protected variable

TObjectPtr< UWo...

 

TargetWorld

Where to make the preview, new mesh, etc.

Protected variable UProperty

TObjectPtr< UCu...

 

ToolActions

Functions

Name Description

Protected function

void

 

ApplyAction

(
    ECubeGridToolAction ActionType
)

Protected function

void

 

ApplyCornerMode

(
    bool bDontWaitForTick
)

Protected function

void

 

ApplyFlipSelection()

Protected function

void

 

ApplyPreview()

Protected function

void

 

ApplyPushPull

(
    int32 NumBlocks
)

Protected function

void

 

ApplySlide

(
    int32 NumBlocks
)

Protected function

void

 

AttemptToSelectCorner

(
    const FRay3d& WorldRay
)

Protected function

FInputRayHit

 

CanBeginMiddleClickDrag

(
    const FInputDeviceRay& ClickPos
)

Protected function

void

 

CancelCornerMode()

Protected function

void

 

ClearHover()

Public function Virtual

void

 

ClearSelection

(
    bool bEmitChange
)

Protected function

void

 

EndSelectionChange()

Protected function

bool

 

GetHitGridFace

(
    const FRay& WorldRay,
    UE::Geometry::FCubeGrid::FCubeFace ...
)

Protected function

void

 

GridGizmoMoved

(
    UTransformProxy* Proxy,
    FTransform Transform
)

Protected function

void

 

InvalidatePreview

(
    bool bUpdateCornerLineSet
)

Public function Virtual Const

bool

 

IsInDefaultMode()

Protected function

void

 

OnCtrlMiddleClick

(
    const FInputDeviceRay& ClickPos
)

Protected function

void

 

OnMiddleClickDrag

(
    const FInputDeviceRay& DragPos
)

Protected function

void

 

PrepForSelectionChange()

Protected function

FInputRayHit

 

RayCastSelectionPlane

(
    const FRay3d& WorldRay,
    FVector3d& HitPointOut
)

Public function Virtual

void

 

RequestAction

(
    ECubeGridToolAction ActionType
)

Public function Virtual

void

 

RevertToDefaultMode()

Protected function

void

 

SetPowerOfTwoClamped

(
    int32 PowerOfTwo
)

Parameter is signed on purpose so we can give negatives.

Public function Virtual

void

 

SetSelection

(
    const FSelection& Selection,
    bool bEmitChange
)

Public function Virtual

void

 

SetTarget

(
    TObjectPtr< UToolTarget > TargetIn
)

Public function Virtual

void

 

SetWorld

(
    UWorld* World
)

Protected function

void

 

SlideSelection

(
    int32 ExtrudeAmount,
    bool bEmitChange
)

Protected function

void

 

StartCornerMode()

Protected function

void

 

UpdateComputeInputs()

Protected function

void

 

UpdateCornerGeometrySet()

Protected function

void

 

UpdateCornerModeLineSet()

Protected function

void

 

UpdateGizmoVisibility

(
    bool bVisible
)

Protected function

void

 

UpdateGridLineSet()

Protected function

bool

 

UpdateHover

(
    const FRay& WorldRay
)

Protected function

void

 

UpdateHoverLineSet

(
    bool bHaveHover,
    const UE::Geometry::FAxisAlignedBox...
)

Protected function

void

 

UpdateSelectionLineSet()

Public function Virtual

void

 

UpdateUsingMeshChange

(
    const UE::Geometry::FDynamicMeshCha...,
    bool bRevert
)

Used by undo/redo.

Overridden from UInteractiveTool

Name Description

Public function Virtual

void

 

OnPropertyModified

(
    UObject* PropertySet,
    FProperty* Property
)

Automatically called by UInteractiveToolPropertySet.OnModified delegate to notify Tool of child property set changes

Public function Virtual

void

 

OnTick

(
    float DeltaTime
)

Action support/system

Public function Virtual

void

 

RegisterActions

(
    FInteractiveToolActionSet& ActionS...
)

Override this function to register the set of Actions this Tool supports, using FInteractiveToolActionSet::RegisterAction.

Public function Virtual

void

 

Render

(
    IToolsContextRenderAPI* Render...
)

Allow the Tool to do any custom drawing (ie via PDI/RHI)

Public function Virtual

void

 

Setup()

Called by ToolManager to initialize the Tool after ToolBuilder::BuildTool() has been called

Public function Virtual

void

 

Shutdown

(
    EToolShutdownType ShutdownType
)

Called by ToolManager to shut down the Tool

Overridden from IClickDragBehaviorTarget

Name Description

Public function Virtual

FInputRayHit

 

CanBeginClickDragSequence

(
    const FInputDeviceRay& PressPos
)

IClickDragBehaviorTarget.

Public function Virtual

void

 

OnClickDrag

(
    const FInputDeviceRay& DragPos
)

Notify Target that input position has changed

Public function Virtual

void

 

OnClickPress

(
    const FInputDeviceRay& PressPos
)

Notify Target that click press ocurred

Public function Virtual

void

 

OnClickRelease

(
    const FInputDeviceRay& ReleasePos
)

Notify Target that click release occurred

Public function Virtual

void

 

OnTerminateDragSequence()

Notify Target that click-drag sequence has been explicitly terminated (eg by escape key)

Overridden from IModifierToggleBehaviorTarget

Name Description

Public function Virtual

void

 

OnUpdateModifierState

(
    int ModifierID,
    bool bIsOn
)

Notify target of current modifier state

Overridden from IHoverBehaviorTarget

Name Description

Public function Virtual

FInputRayHit

 

BeginHoverSequenceHitTest

(
    const FInputDeviceRay& PressPos
)

IHoverBehaviorTarget.

Public function Virtual

void

 

OnBeginHover

(
    const FInputDeviceRay& DevicePos
)

Initialize hover sequence at given position

Public function Virtual

void

 

OnEndHover()

Terminate active hover sequence

Public function Virtual

bool

 

OnUpdateHover

(
    const FInputDeviceRay& DevicePos
)

Update active hover sequence with new input position

Overridden from IDynamicMeshOperatorFactory

Name Description

Public function Virtual

TUniquePtr< ...

 

MakeNewOperator()

IDynamicMeshOperatorFactory API.

Overridden from IInteractiveToolNestedAcceptCancelAPI

Name Description

Public function Virtual

bool

 

CanCurrentlyNestedAccept()

Public function Virtual

bool

 

CanCurrentlyNestedCancel()

Public function Virtual

bool

 

ExecuteNestedAcceptCommand()

Called by Editor levels to tell the implementor (eg Tool) to execute a nested Accept action

Public function Virtual

bool

 

ExecuteNestedCancelCommand()

Called by Editor levels to tell the implementor (eg Tool) to execute a nested Cancel action

Public function Virtual

bool

 

SupportsNestedAcceptCommand()

Public function Virtual

bool

 

SupportsNestedCancelCommand()

IInteractiveToolNestedAcceptCancelAPI.

Classes

Name

Description

Public struct

FSelection

Enums

Name

Description

Protected enum

EMode

Protected enum

EMouseState

Typedefs

Name

Description

FCubeGrid

Constants

Name

Description

CtrlModifierID

ShiftModifierID