Download

Editor move/scale/rotate widgets for subobjects?

I have a class for an object that has some box components that I declare like this:

UPROPERTY(EditAnywhere, NonTransactional, meta = (Category = "Default", OverrideNativeName = "Box1"))
UBoxComponent* box1;

I create the boxes in the class’s constructor with CreateDefaultSubobject calls, and when I drag and drop the object into the scene I see the boxes as sub objects of the root scene node. I want to be able to move/scale/rotate these boxes independently in the main editor. Right now they sit at fixed offsets from the root scene node, and there’s only one widget that they all get moved/rotated/scaled at the same time by. Can I make them independently adjustable in the main editor?

They’re not individually selectable? What happens if you double-click one in the viewport or click one in the details panel, then transform?

Nope. Can’t individually adjust them.

https://i.imgur.com/SFkcg3E.png

Let’s see your actor’s constructor? And the other box Uproperty declarations if there’s more than one (sounds like that’s the case)

Sure, the AActor derived class has these declarations:

UPROPERTY(EditAnywhere, NonTransactional, meta = (Category = "Default", OverrideNativeName = "DefaultSceneRoot"))
USceneComponent* defaultSceneRoot;

UPROPERTY(EditAnywhere, NonTransactional, meta = (Category = "Default", OverrideNativeName = "Box1"))
UBoxComponent* box1;

UPROPERTY(EditAnywhere, NonTransactional, meta = (Category = "Default", OverrideNativeName = "Box2"))
UBoxComponent* box2;

And the constructor initializes them like this:

PrimaryActorTick.bCanEverTick = false;
SetActorHiddenInGame(true);
this->bIsEditorOnlyActor = true;

defaultSceneRoot = CreateDefaultSubobject<USceneComponent>(TEXT("DefaultSceneRoot"));
defaultSceneRoot->CreationMethod = EComponentCreationMethod::Native;
defaultSceneRoot->SetCanEverAffectNavigation(false);
RootComponent = defaultSceneRoot;

box1 = CreateDefaultSubobject<UBoxComponent>(TEXT("Box1"));
box1->CreationMethod = EComponentCreationMethod::Native;
box1->AttachToComponent(defaultSceneRoot, FAttachmentTransformRules::KeepRelativeTransform);
box1->SetGenerateOverlapEvents(false);
box1->SetCanEverAffectNavigation(false);
box1->SetCollisionProfileName(FName(TEXT("NoCollision")));
box1->SetWorldLocation({100, 100, 0});

box2 = CreateDefaultSubobject<UBoxComponent>(TEXT("Box2"));
box2->CreationMethod = EComponentCreationMethod::Native;
box2->AttachToComponent(defaultSceneRoot, FAttachmentTransformRules::KeepRelativeTransform);
box2->SetGenerateOverlapEvents(false);
box2->SetCanEverAffectNavigation(false);
box2->SetCollisionProfileName(FName(TEXT("NoCollision")));
box2->SetWorldLocation({ 100, -100, 0 });

I only get an adjustment widget on that defaultSceneRoot component…