Announcement

Collapse
No announcement yet.

Cannot create widget blueprint from factory

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Cannot create widget blueprint from factory

    I am trying to create a widget blueprint from the factory. For some reason the blueprint i get in the editor is a normal blueprint, with no widget designer tab(so u cannot place canvas and things like that, only have the event graph). I am using EditorUtilityWidgetBlueprintFactory as a reference and WidgetBlueprintFactory

    This is my factory cpp

    Code:
    UBaseTooltipContentWidgetFactory::UBaseTooltipContentWidgetFactory(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
    {
    bCreateNew = true;
    bEditAfterNew = true;
    //Configure the class that this factory creates
    //BlueprintType = BPTYPE_Normal;
    SupportedClass = UBaseTooltipContentWidgetBlueprint::StaticClass();
    ParentClass = UBaseTooltipContentWidget::StaticClass();
    }
    
    bool UBaseTooltipContentWidgetFactory::ShouldShowInNewMenu() const
    {
    return true;
    }
    
    uint32 UBaseTooltipContentWidgetFactory::GetMenuCategories() const
    {
    //Let's place this asset in the Blueprints category in the Editor
    return MY_QuestCategory;
    }
    
    UObject* UBaseTooltipContentWidgetFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn, FName CallingContext)
    {
    check(Class->IsChildOf(UBaseTooltipContentWidgetBlueprint::StaticClass()));
    UBaseTooltipContentWidgetBlueprint* NewBP = CastChecked<UBaseTooltipContentWidgetBlueprint>(FKismetEditorUtilities::CreateBlueprint(ParentClass, InParent, Name, BlueprintType,
    UBaseTooltipContentWidgetBlueprint::StaticClass(), UWidgetBlueprintGeneratedClass::StaticClass(), CallingContext));
    
    
    // Create a CanvasPanel to use as the default root widget
    if (NewBP->WidgetTree->RootWidget == nullptr)
    {
    UWidget* Root = NewBP->WidgetTree->ConstructWidget<UCanvasPanel>(UCanvasPanel::StaticClass());
    NewBP->WidgetTree->RootWidget = Root;
    }
    
    return NewBP;
    }
    
    UObject* UBaseTooltipContentWidgetFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn)
    {
    //Create the editor asset
    return FactoryCreateNew(Class, InParent, Name, Flags, Context, Warn, NAME_None);
    }

    This is the widget i want to be parent of the blueprint widget (its a editor widget)

    Code:
    UCLASS(Abstract, Blueprintable)
    class QUESTEDITORDEV_API UBaseTooltipContentWidget : public UEditorUtilityWidget
    {
    GENERATED_BODY()
    }

    This is the Blueprint widget i try to create (is WidgetBlueprint, i cannot make it UEditorUtilityWidgetBlueprint cuz it wont compile)

    Code:
    UCLASS()
    class QUESTEDITORDEV_API UBaseTooltipContentWidgetBlueprint : public UWidgetBlueprint
    {
    GENERATED_BODY()
    
    };

    TL DT; instead of getting a UWidgetBlueprint when i create it, i get a UBlueprint (with no widget editor) or at list i dont have the widget designer tab

    Any ideas?
    Last edited by Alfffffffffff; 12-01-2019, 09:18 AM.
    Discord: https://discordapp.com/invite/WmQ3pDR
    Youtube: https://www.youtube.com/channel/UCkQVJmcV-szXTIySHz4CILw?
    Twitch: https://www.twitch.tv/alfffffffffff
Working...
X