You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
140 lines
4.2 KiB
C++
140 lines
4.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "ControlRigBlueprint.h"
|
|
#include "EdGraph/EdGraph.h"
|
|
#include "Graph/ControlRigGraphNode.h"
|
|
#include "Rigs/RigHierarchy.h"
|
|
#include "Rigs/RigHierarchyController.h"
|
|
#include "RigVMModel/RigVMGraph.h"
|
|
#include "RigVMCore/RigVM.h"
|
|
#include "EdGraph/RigVMEdGraph.h"
|
|
#include "ControlRigGraph.generated.h"
|
|
|
|
class UControlRigBlueprint;
|
|
class UControlRigGraphSchema;
|
|
class UControlRig;
|
|
class URigVMController;
|
|
struct FRigCurveContainer;
|
|
|
|
UCLASS()
|
|
class CONTROLRIGDEVELOPER_API UControlRigGraph : public URigVMEdGraph
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UControlRigGraph();
|
|
|
|
/** Set up this graph */
|
|
virtual void InitializeFromBlueprint(URigVMBlueprint* InBlueprint) override;
|
|
|
|
virtual bool HandleModifiedEvent_Internal(ERigVMGraphNotifType InNotifType, URigVMGraph* InGraph, UObject* InSubject) override;
|
|
|
|
#if WITH_EDITOR
|
|
|
|
const TArray<TSharedPtr<FString>>* GetBoneNameList(URigVMPin* InPin = nullptr) const
|
|
{
|
|
return GetElementNameList(ERigElementType::Bone);
|
|
}
|
|
const TArray<TSharedPtr<FString>>* GetControlNameList(URigVMPin* InPin = nullptr) const
|
|
{
|
|
return GetElementNameList(ERigElementType::Control);
|
|
}
|
|
const TArray<TSharedPtr<FString>>* GetControlNameListWithoutAnimationChannels(URigVMPin* InPin = nullptr) const
|
|
{
|
|
return &ControlNameListWithoutAnimationChannels;
|
|
}
|
|
const TArray<TSharedPtr<FString>>* GetNullNameList(URigVMPin* InPin = nullptr) const
|
|
{
|
|
return GetElementNameList(ERigElementType::Null);
|
|
}
|
|
const TArray<TSharedPtr<FString>>* GetCurveNameList(URigVMPin* InPin = nullptr) const
|
|
{
|
|
return GetElementNameList(ERigElementType::Curve);
|
|
}
|
|
|
|
virtual const TArray<TSharedPtr<FString>>* GetNameListForWidget(const FString& InWidgetName) const override;
|
|
|
|
void CacheNameLists(URigHierarchy* InHierarchy, const FRigVMDrawContainer* DrawContainer, TArray<TSoftObjectPtr<UControlRigShapeLibrary>> ShapeLibraries);
|
|
const TArray<TSharedPtr<FString>>* GetElementNameList(ERigElementType InElementType = ERigElementType::Bone) const;
|
|
const TArray<TSharedPtr<FString>>* GetElementNameList(URigVMPin* InPin = nullptr) const;
|
|
const TArray<TSharedPtr<FString>> GetSelectedElementsNameList() const;
|
|
const TArray<TSharedPtr<FString>>* GetDrawingNameList(URigVMPin* InPin = nullptr) const;
|
|
const TArray<TSharedPtr<FString>>* GetShapeNameList(URigVMPin* InPin = nullptr) const;
|
|
|
|
FReply HandleGetSelectedClicked(URigVMEdGraph* InEdGraph, URigVMPin* InPin, FString InDefaultValue);
|
|
FReply HandleBrowseClicked(URigVMEdGraph* InEdGraph, URigVMPin* InPin, FString InDefaultValue);
|
|
|
|
private:
|
|
|
|
template<class T>
|
|
static bool IncludeElementInNameList(const T* InElement)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
template<class T>
|
|
void CacheNameListForHierarchy(URigHierarchy* InHierarchy, TArray<TSharedPtr<FString>>& OutNameList, bool bFilter = true)
|
|
{
|
|
TArray<FString> Names;
|
|
for (auto Element : *InHierarchy)
|
|
{
|
|
if(Element->IsA<T>())
|
|
{
|
|
if(!bFilter || IncludeElementInNameList<T>(Cast<T>(Element)))
|
|
{
|
|
Names.Add(Element->GetName().ToString());
|
|
}
|
|
}
|
|
}
|
|
Names.Sort();
|
|
|
|
OutNameList.Reset();
|
|
OutNameList.Add(MakeShared<FString>(FName(NAME_None).ToString()));
|
|
for (const FString& Name : Names)
|
|
{
|
|
OutNameList.Add(MakeShared<FString>(Name));
|
|
}
|
|
}
|
|
|
|
template<class T>
|
|
void CacheNameList(const T& ElementList, TArray<TSharedPtr<FString>>& OutNameList)
|
|
{
|
|
TArray<FString> Names;
|
|
for (auto Element : ElementList)
|
|
{
|
|
Names.Add(Element.Name.ToString());
|
|
}
|
|
Names.Sort();
|
|
|
|
OutNameList.Reset();
|
|
OutNameList.Add(MakeShared<FString>(FName(NAME_None).ToString()));
|
|
for (const FString& Name : Names)
|
|
{
|
|
OutNameList.Add(MakeShared<FString>(Name));
|
|
}
|
|
}
|
|
|
|
TMap<ERigElementType, TArray<TSharedPtr<FString>>> ElementNameLists;
|
|
TArray<TSharedPtr<FString>> ControlNameListWithoutAnimationChannels;
|
|
TArray<TSharedPtr<FString>> DrawingNameList;
|
|
TArray<TSharedPtr<FString>> ShapeNameList;
|
|
int32 LastHierarchyTopologyVersion;
|
|
|
|
static TArray<TSharedPtr<FString>> EmptyElementNameList;
|
|
|
|
#endif
|
|
|
|
friend class UControlRigGraphNode;
|
|
friend class FControlRigEditor;
|
|
friend class SRigVMGraphNode;
|
|
friend class UControlRigBlueprint;
|
|
};
|
|
|
|
template<>
|
|
inline bool UControlRigGraph::IncludeElementInNameList<FRigControlElement>(const FRigControlElement* InElement)
|
|
{
|
|
return !InElement->IsAnimationChannel();
|
|
}
|