How to setup an actor for an in Editor use?

Hi,

I’m currently creating a little custom actor that I would like to use inside the editor to enhance a bit the visuals of my environments. The idea was to create some settings to directly control the material on this actor. My current setup is to use the TickActor function to dynamically change the material even inside the editor, but it seems that it’s not working. Probably a wrong setup on my side. I’m curious about was would be the best setup for something like this.

Also, I was wondering if it was possible to hide some some panels and put my own category on top of everything like what it was in UE3 ?

Also what would be the best way to hide the material of this mesh ? The material is created during the constructor of the object and even without the UPROPERTY() function the material slot if visible.

UCLASS(placeable, config=Game)
class AEXILAtmosphericSphere : public AActor
{
	GENERATED_UCLASS_BODY()

	//OVERRIDES
	virtual void Tick( float DeltaSeconds ) OVERRIDE;
	
	virtual void TickActor( float DeltaTime, enum ELevelTick TickType, FActorTickFunction& ThisTickFunction ) OVERRIDE;
	
	public:
		UFUNCTION(BlueprintCallable, Category="aEXIL")
		virtual void SetAtmosphericColor(FColor NewColor, float NewBrightness, float NewPower);
		
		UFUNCTION(BlueprintCallable, Category="aEXIL")
		virtual void SetAtmosphericOpacity(float NewOpacity, float NewDepth, float NewBlend, float NewPower);

	//settings
		UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="aEXIL")
		FColor BaseColor;
		
		UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="aEXIL")
		float ColorBrightness;
		
		UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="aEXIL")
		float ColorPower;
		
		UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="aEXIL")
		float OpacityDistanceDepth;
		
		UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="aEXIL")
		float OpacityDistanceBlend;
		
		UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="aEXIL")
		float OpacityDistancePower;
		
		UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="aEXIL")
		float Opacity;
	
	protected:
	
	//mesh + material
		UPROPERTY(BlueprintReadOnly, Category="aEXIL")
		class UMaterialInstanceDynamic* MI;
		
		TSubobjectPtr Mesh;
};

Okay, TickActor is working, I had to delete and recreate a new actor in the editor to get the changes. My other questions are still up however. :slight_smile:

You seem to be on an older build. We recently made a fix in CL 1767788 that prevents displaying the materials for components on actors which are not exposed as editable properties by the actor. If you are able to get that change, it should fix your problem. The material category is a customization and cannot be hidden using hideCategories.

Understood. :slight_smile:
I decided to stay on the build 1711197 until the new build (which is coming soon I believe). I didn’t wanted to reinstall rocket as I thought the build 1767788 was more or less a fix for the Internet crash problem.

Hi Fabrice -

The best way to hide properties like that is to use the HideCategories metadata on the class. For example:

UCLASS(hidecategories=StaticMeshActor)

Should hide all the mesh component properties of that actor, preventing people from setting the material directly.

Hope that helps!

Thanks, I was able to hide some categories, but not all. The one I wanted to hide (Materials) is still visible unfortunately.

UCLASS(placeable, config=Game, hidecategories=(Materials, Collision, Actor, StaticMeshActor, Layers, Rendering, CodeView, Input))
class AEXILAtmosphericSphere : public AActor

Also, I met a new problem : if I close and reload my map, my material doesn’t update anymore. It seems that the Material Instance link is broken somewhere. Any idea how I could keep it ?

My current setup is like this :

AEXILAtmosphericSphere::AEXILAtmosphericSphere(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	//scene component
	TSubobjectPtr SceneComp = PCIP.CreateDefaultSubobject(this, TEXT("SceneComp"));
	Components.Add(SceneComp);
	RootComponent = SceneComp;

	
	//mesh
	static ConstructorHelpers::FObjectFinder ScMesh(TEXT("StaticMesh'/Game/res_editor/mesh/sphere_subd_x16.sphere_subd_x16'"));
	
	Mesh = PCIP.CreateDefaultSubobject(this, TEXT("Mesh"));
	Mesh->StaticMesh = ScMesh.Object;
	Mesh->RelativeScale3D = FVector(5.0f, 5.0f, 5.0f);
	Mesh->AttachParent = SceneComp;
	Components.Add(Mesh);
	
	
	//material
	static ConstructorHelpers::FObjectFinder Mat(TEXT("MaterialInstanceConstant'/Game/res_editor/mat/inst_atmopsheric.inst_atmopsheric'"));

	MI = UMaterialInstanceDynamic::Create( Mat.Object, this );
	Mesh->SetMaterial(0, MI);
}

Hey Fabrice, we’re looking into the Hide Category issue you were describing. For the new problem about your material not updating, would you be able to create a new post about it? That should help us assign certain issues to where they belong to help get faster responses.

Thanks!

No problem, I will do it right now. :slight_smile:

Regarding the hiding, here is a screenshot of my editor regarding the “hidecategories” that I’m using (and already detailed above). You can see the categories still remaining :