mirror of
https://github.com/Eragon-Brisingr/UShaderLab.git
synced 2026-09-15 14:54:36 +00:00
38 lines
1.3 KiB
C++
38 lines
1.3 KiB
C++
// Copyright UShaderLab. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Factories/Factory.h"
|
|
#include "ShaderLabMaterialInstanceFactory.generated.h"
|
|
|
|
class UMaterial;
|
|
|
|
/**
|
|
* Creates a UShaderLabMaterialInstanceConstant parented to a ShaderLab in-memory /Script base
|
|
* material. Appears in the Content Browser under "Material & Textures ▸ ShaderLab Material Instance".
|
|
*
|
|
* ShaderLab base materials are hidden templates (not pickable as assets), so this factory is the
|
|
* entry point: ConfigureProperties() pops a picker of the discovered base materials (with preview
|
|
* thumbnails). A commandlet may instead set InitialParent directly and skip the dialog.
|
|
*/
|
|
UCLASS()
|
|
class UShaderLabMaterialInstanceFactory : public UFactory
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UShaderLabMaterialInstanceFactory();
|
|
|
|
/** Parent base material for the created instance. Set by the picker, or directly by a commandlet. */
|
|
UPROPERTY()
|
|
TObjectPtr<UMaterial> InitialParent = nullptr;
|
|
|
|
//~ UFactory interface
|
|
virtual bool ConfigureProperties() override;
|
|
virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
|
|
virtual uint32 GetMenuCategories() const override;
|
|
virtual FText GetDisplayName() const override;
|
|
//~ End UFactory interface
|
|
};
|