You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Editor UI: Added SetNodePosition(...) to GraphSchema, called when Straighthen pin connections.
Control Rig: Override GraphSchema::SetNodePosition(...) to use RigVMController to perform the set action, UEdGraph is updated through URigVMController::Notify(...) #jira UE-95907 #rb helge.mathee [CL 14576697 by jack cai in ue5-main branch]
This commit is contained in:
@@ -267,6 +267,20 @@ bool UControlRigGraphSchema::IsStructEditable(UStruct* InStruct) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void UControlRigGraphSchema::SetNodePosition(UEdGraphNode* Node, const FVector2D& Position) const
|
||||
{
|
||||
if (UControlRigGraphNode* RigNode = Cast<UControlRigGraphNode>(Node))
|
||||
{
|
||||
UBlueprint* Blueprint = FBlueprintEditorUtils::FindBlueprintForNodeChecked(RigNode);
|
||||
UControlRigBlueprint* RigBlueprint = Cast<UControlRigBlueprint>(Blueprint);
|
||||
if (RigBlueprint != nullptr)
|
||||
{
|
||||
RigBlueprint->Controller->SetNodePosition(RigNode->GetModelNode(), Position, true, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UControlRigGraphNode* UControlRigGraphSchema::CreateGraphNode(UControlRigGraph* InGraph, const FName& InPropertyName) const
|
||||
{
|
||||
const bool bSelectNewNode = true;
|
||||
|
||||
@@ -76,6 +76,7 @@ public:
|
||||
virtual bool RequestVariableDropOnPanel(UEdGraph* InGraph, FProperty* InVariableToDrop, const FVector2D& InDropPosition, const FVector2D& InScreenPosition) override;
|
||||
virtual bool RequestVariableDropOnPin(UEdGraph* InGraph, FProperty* InVariableToDrop, UEdGraphPin* InPin, const FVector2D& InDropPosition, const FVector2D& InScreenPosition) override;
|
||||
virtual bool IsStructEditable(UStruct* InStruct) const;
|
||||
virtual void SetNodePosition(UEdGraphNode* Node, const FVector2D& Position) const override;
|
||||
|
||||
/** Create a graph node for a rig */
|
||||
UControlRigGraphNode* CreateGraphNode(UControlRigGraph* InGraph, const FName& InPropertyName) const;
|
||||
|
||||
@@ -1255,9 +1255,15 @@ private:
|
||||
AlignmentDelta += (Node->NodePosY + Pins.SrcPin->GetNodeOffset().Y) - (NodeToPins.Key->NodePosY + Pins.DstPin->GetNodeOffset().Y);
|
||||
}
|
||||
|
||||
NodeToPins.Key->Modify();
|
||||
NodeToPins.Key->NodePosY += AlignmentDelta / NodeToPins.Value.Num();
|
||||
UEdGraph* GraphObj = NodeToPins.Key->GetGraph();
|
||||
|
||||
check(GraphObj);
|
||||
|
||||
const UEdGraphSchema* Schema = GraphObj->GetSchema();
|
||||
|
||||
float NewNodePosY = NodeToPins.Key->NodePosY + (AlignmentDelta / NodeToPins.Value.Num());
|
||||
Schema->SetNodePosition(NodeToPins.Key, FVector2D(NodeToPins.Key->NodePosX, NewNodePosY));
|
||||
|
||||
VisitedNodes.Add(Node);
|
||||
VisitedNodes.Add(NodeToPins.Key);
|
||||
|
||||
|
||||
@@ -911,6 +911,13 @@ class ENGINE_API UEdGraphSchema : public UObject
|
||||
*/
|
||||
virtual UEdGraphNode* CreateSubstituteNode(UEdGraphNode* Node, const UEdGraph* Graph, FObjectInstancingGraph* InstanceGraph, TSet<FName>& InOutExtraNames) const { return nullptr; }
|
||||
|
||||
/**
|
||||
* Sets a node's position.
|
||||
*
|
||||
* @param Node The node to set
|
||||
* @param Position The target position
|
||||
*/
|
||||
virtual void SetNodePosition(UEdGraphNode* Node, const FVector2D& Position) const;
|
||||
|
||||
/**
|
||||
* Returns the currently selected graph node count
|
||||
|
||||
@@ -785,6 +785,14 @@ void UEdGraphSchema::ReconstructNode(UEdGraphNode& TargetNode, bool bIsBatchRequ
|
||||
#endif //#if WITH_EDITOR
|
||||
}
|
||||
|
||||
void UEdGraphSchema::SetNodePosition(UEdGraphNode* Node, const FVector2D& Position) const
|
||||
{
|
||||
check(Node);
|
||||
Node->Modify();
|
||||
Node->NodePosX = Position.X;
|
||||
Node->NodePosY = Position.Y;
|
||||
}
|
||||
|
||||
void UEdGraphSchema::GetGraphDisplayInformation(const UEdGraph& Graph, /*out*/ FGraphDisplayInfo& DisplayInfo) const
|
||||
{
|
||||
DisplayInfo.PlainName = FText::FromString( Graph.GetName() );
|
||||
|
||||
Reference in New Issue
Block a user