// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "NiagaraParameterCollectionViewModel.h" #include "NiagaraParameterViewModel.h" class UNiagaraScript; class UNiagaraGraph; class FNiagaraScriptParameterViewModel; struct FNiagaraTypeDefinition; /** A parameter collection view model for script input parameters. */ class FNiagaraScriptInputCollectionViewModel : public FNiagaraParameterCollectionViewModel, public TSharedFromThis { public: FNiagaraScriptInputCollectionViewModel(UNiagaraScript* InScript, FText InDisplayName, ENiagaraParameterEditMode InParameterEditMode); ~FNiagaraScriptInputCollectionViewModel(); /** Sets the view model to a new script. */ void SetScript(UNiagaraScript* InScript); //~ INiagaraParameterCollectionViewModel interface virtual FText GetDisplayName() const override; virtual void AddParameter(TSharedPtr ParameterType) override; virtual void DeleteSelectedParameters() override; virtual const TArray>& GetParameters() override; /** Rebuilds the parameter view models. */ virtual void RefreshParameterViewModels() override; /** Gets the parameter view model associated with a given Id.*/ TSharedPtr GetParameterViewModel(const FGuid& Id); /** Sets all parameter view models editable state to the input value.*/ void SetAllParametersEditingEnabled(bool bInEnabled); /** Sets the tooltip overrides on all parameters.*/ void SetAllParametersTooltipOverrides(const FText& Override); protected: //~ FNiagaraParameterCollectionViewModel interface. virtual bool SupportsType(const FNiagaraTypeDefinition& Type) const override; private: /** Handles when the graph for the script changes. */ void OnGraphChanged(const struct FEdGraphEditAction& InAction); /** Handles when the name on a parameter changes. */ void OnParameterNameChanged(FNiagaraVariable* ParameterVariable); /** Handles when the type on a parameter changes. */ void OnParameterTypeChanged(FNiagaraVariable* ParameterVariable); /** Handles when the default value on a parameter changes. */ void OnParameterValueChangedInternal(TSharedRef ChangedParameter); private: /** The parameter view models. */ TArray> ParameterViewModels; /** The script which provides the input parameters viewed and edited by this view model. */ TWeakObjectPtr Script; /** The graph which owns the non-compiled input parameters viewed and edited by this view model. */ TWeakObjectPtr Graph; /** The display name for the view model. */ FText DisplayName; /** The handle to the graph changed delegate. */ FDelegateHandle OnGraphChangedHandle; /** Whether or not generic numeric type parameters are supported as inputs and outputs for this script. */ bool bCanHaveNumericParameters; };