unreal.BlueprintGraphEditor¶
- class unreal.BlueprintGraphEditor(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
ObjectObject oriented helper for editing graphs in a blueprint object Instantiate the UBlueprintGraphEditor via CreateAndEditFunctionGraph or GetGraphEditor. Static helpers can be found in BlueprintEditorLibrary and pin specific routines are encapsulated by BlueprintGraphPin
Python Example:
import unreal
BlueprintGraphEditor = unreal.BlueprintGraphEditor
print_string = “/Script/Engine.KismetSystemLibrary.PrintString”
- def GenHelloWorld(bp):
editor = BlueprintGraphEditor.create_and_edit_function_graph(bp, “HelloWorld”) start_pin = editor.find_graph_entry_pin() start_pos = start_pin.get_owning_node().get_node_pos() print_node = editor.add_call_function_node(print_string) print_node.find_input_pin(“InString”).set_pin_value(“Generated Script”) start_pin.try_create_connection(print_node.find_execute_pin()) print_node.set_node_pos(unreal.IntPoint(start_pos.x + 160, start_pos.y))
C++ Source:
Module: BlueprintEditorLibrary
File: BlueprintGraphEditor.h
- add_branch_node() K2Node_IfThenElse¶
Creates a UK2Node_IfThenElse in the current graph
- Return type:
- add_call_function_node(function_path) K2Node_CallFunction¶
Creates a UK2Node_CallFunction in the current graph invoking the function specified by FunctionPath
- Parameters:
function_path (str)
- Return type:
- add_comment_node(comment_text, location, size=[400.000000, 200.000000]) EdGraphNode_Comment¶
Creates a comment node in the current graph at the given location with the given text and size.
- Parameters:
- Return type:
- add_comment_to_nodes(comment_text, nodes, padding=50) EdGraphNode_Comment¶
Creates a comment node that wraps the given nodes with the given padding. The comment bounds are computed from the node positions plus padding.
- Parameters:
- Return type:
- add_component_bound_event_node(component, event_name) K2Node_ComponentBoundEvent¶
Creates a UK2Node_ComponentBoundEvent in this event graph for the given component and delegate event name. Returns the existing node if one already exists. The graph must be an event graph.
- Parameters:
component (ActorComponent)
event_name (Name)
- Return type:
- add_custom_event_node(event_name) K2Node_CustomEvent¶
Creates a UK2Node_CustomEvent node if the current graph is an event graph, using the provided EventName
- Parameters:
event_name (str)
- Return type:
- add_dispatcher_event_node(dispatcher_name, declaring_class=None) K2Node_Event¶
Creates an event node in this event graph whose pins match the signature of the named dispatcher. The current graph must be an Event Graph and the Blueprint must have a valid SkeletonGeneratedClass (i.e. it must have been compiled at least once). Returns nullptr if the graph is not an Event Graph, the skeleton class is absent, or no dispatcher named DispatcherName exists on the Blueprint. When DeclaringClass is provided the dispatcher is only accepted if it is declared on exactly that class, not merely inherited through it - use this to disambiguate between sibling classes that expose a dispatcher under the same name.
- Parameters:
- Return type:
- add_get_local_variable_node(local_name) K2Node_VariableGet¶
Creates a UK2Node_VariableGet for the provided local variable identified by LocalName
- Parameters:
local_name (Name)
- Return type:
- add_get_member_variable_node(member_name, class_path='') K2Node_VariableGet¶
Creates a UK2Node_VariableGet for the member variable identified by MemberName by default this will use the current class, provided a ClassPath to work with a different class
- Parameters:
- Return type:
- add_graph_input_parameter(input_name, pin_type=[], value='') BlueprintGraphPin¶
Adds a graph input parameter with name InputName, and optional PinType and Value. Returns the added pin. By default the type will be a boolean as defined by UBlueprintEditorLibrary.
- Parameters:
input_name (Name)
pin_type (EdGraphPinType)
value (str)
- Return type:
- add_graph_output_parameter(output_name, pin_type=[]) K2Node_FunctionResult¶
Adds a graph output parameter, returning the UK2Node_FunctionResult that has the new output on it. By default the type will be a boolean as defined by UBlueprintEditorLibrary.
- Parameters:
output_name (Name)
pin_type (EdGraphPinType)
- Return type:
- add_local_variable(local_name, pin_type=[], value='') bool¶
Adds a local variable, use BlueprintEditorLibrary to specify a type. A default value can optionally be provided. By default the type will be a boolean as defined by UBlueprintEditorLibrary.
- Parameters:
local_name (Name)
pin_type (EdGraphPinType)
value (str)
- Return type:
- add_macro_node(macro_path) K2Node_MacroInstance¶
Creates a UK2Node_MacroInstance in the current graph for the provided MacroPath
- Parameters:
macro_path (str)
- Return type:
- add_member_variable(member_name, pin_type=[], value='') bool¶
Adds a member variable, use BlueprintEditorLibrary to specify a type. A default value can optionally be provided. By default the type will be a boolean as defined by UBlueprintEditorLibrary.
- Parameters:
member_name (Name)
pin_type (EdGraphPinType)
value (str)
- Return type:
- add_node_pin(node) bool¶
Adds a pin to a node that supports dynamic pin addition, such as a Switch node, Sequence node, commutative binary operator (Add, Multiply), or Make Array node. Returns true on success, false if the node type does not support adding pins.
- Parameters:
node (EdGraphNode)
- Return type:
- add_return_node() K2Node_FunctionResult¶
Creates a UK2Node_FunctionResult in the current graph
- Return type:
- add_set_local_variable_node(local_name) K2Node_VariableSet¶
Creates a UK2Node_VariableSet for the provided local variable identified by LocalName
- Parameters:
local_name (Name)
- Return type:
- add_set_member_variable_node(member_name, class_path='') K2Node_VariableSet¶
Creates a UK2Node_VariableSet for the member variable identified by MemberName by default this will use the current class, provided a ClassPath to work with a different class
- Parameters:
- Return type:
- classmethod create_and_edit_function_graph(blueprint, func_name='NewFunction') BlueprintGraphEditor¶
returns a new UBlueprintGraphEditor for a graph in InBlueprint, creating a new graph named FuncName - useful for creating new function graphs
- Parameters:
- Return type:
- create_node_from_name(node_with_category, location, context_pins, declaring_class=None) EdGraphNode¶
- Creates node from Catagory and Name. Example:
‘Development|PrintString’
‘Utilities|Operators|Add’
‘Utilities|FlowControl|Branch’
‘Math|Vector|VectorLength’
When multiple actions share the same Category|Name string , pass DeclaringClass to select the action belonging to that specific class.
- Parameters:
- Return type:
- find_event_node(event_name) K2Node_Event¶
Returns the event node associated with EventName - aka Member Name of the event. Names will not resolve against the display name, so e.g. ‘Begin Play’ is not a valid member name - instead search for ReceiveBeginPlay, the underlying BlueprintImplementableEvent
- Parameters:
event_name (Name)
- Return type:
- find_graph_entry_pin() BlueprintGraphPin¶
Returns the ‘entry’ pin for the graph, e.g. the ‘then’ pin of the entry node
- Return type:
- classmethod get_graph_editor(graph) BlueprintGraphEditor¶
returns a new UBlueprintGraphEditor for the provided graph - useful for editing graphs that already exist
- Parameters:
graph (EdGraph)
- Return type:
- classmethod get_graph_editor_by_name(blueprint, graph_name) BlueprintGraphEditor¶
returns a new UBlueprintGraphEditor for a graph in InBlueprint named GraphName - useful for editing graphs that already exist
- Parameters:
- Return type:
- get_local_variable_default_value(local_variable_name) str | None¶
Returns the default value of a local variable, unset if no variable is found.
- get_local_variable_type(local_variable_name) EdGraphPinType | None¶
Returns the type of a local variable, unset if no variable is found.
- Parameters:
local_variable_name (str)
- Return type:
Optional[EdGraphPinType]
- list_available_nodes(context_pins) Array[str]¶
List all of the nodes by name that can be added to this graph
- Parameters:
context_pins (Array[BlueprintGraphPin])
- Returns:
result (Array[str]):
- Return type:
- list_comment_nodes() Array[EdGraphNode_Comment]¶
Returns all comment nodes in the current graph.
- Return type:
- list_component_events(component) Array[Name]¶
Returns the names of all bindable delegate events on the given component.
- Parameters:
component (ActorComponent)
- Return type:
- list_nodes_with_errors() Array[K2Node]¶
Lists nodes with EMessageSeverity::Error level compiler messages
- list_nodes_with_notes() Array[K2Node]¶
Lists nodes with EMessageSeverity::Info level compiler messages
- list_nodes_with_warnings() Array[K2Node]¶
Lists nodes with EMessageSeverity::Warning level compiler messages
- remove_comment_node(comment_node) None¶
Removes a comment node from the current graph.
- Parameters:
comment_node (EdGraphNode_Comment)
- remove_graph_input_parameter(input_name) bool¶
Removes the graph input parameter specified by InputName
- remove_graph_output_parameter(output_name) bool¶
Removes the output parameter specified by OutputName, returns true if there is a variable and it is removed
- remove_local_variable(local_name) bool¶
Removes the local variable with the corresponding name, returns true if there is a variable and it is removed
- remove_member_variable(member_name) bool¶
Removes the member variable with the corresponding name, returns true if there is a variable and it is removed
- remove_node_pin(node, pin) bool¶
Removes a specific pin from a node that supports dynamic pin removal, such as a Sequence node, Switch node, commutative binary operator (Add, Multiply), or Make Array node. Returns true on success, false if the node type does not support removing pins or the pin cannot be removed (e.g. minimum pin count reached).
- Parameters:
node (EdGraphNode)
pin (BlueprintGraphPin)
- Return type:
- retarget_node_class(node, old_class, new_class) bool¶
Replaces a node’s baked-in class reference from OldClass to NewClass and reconstructs the node so its pins reflect the new type. Handles the following node kinds:
UK2Node_DynamicCast (TargetType)
UK2Node_CallFunction (FunctionReference)
UK2Node_Event (EventReference)
UK2Node_BaseMCDelegate (DelegateReference - covers all multicast delegate nodes)
Returns true if the node was retargeted or already references NewClass. Returns false if the node type is unsupported or its current class reference does not match OldClass.
- set_deprecation_message_on_function(message) None¶
Sets the graph’s deprecation message
- Parameters:
message (Text)
- set_is_call_in_editor_function(call_in_editor=True) None¶
Sets the graph’s callability in editor
- Parameters:
call_in_editor (bool)
- set_is_const_function(is_const=True) None¶
Sets the graph’s FUNC_Const flag
- Parameters:
is_const (bool)
- set_is_deprecated_function(is_deprecated=True) None¶
Sets the graph’s deprecation status
- Parameters:
is_deprecated (bool)
- set_is_pure_function(is_pure=True) None¶
Sets the graph’s FUNC_BlueprintPure flag
- Parameters:
is_pure (bool)
- set_is_thread_safe_function(is_thread_safe=True) None¶
Sets the graph’s thread safety status
- Parameters:
is_thread_safe (bool)
- set_is_unsafe_during_actor_construction_function(is_unsafe_during_actor_construction=True) None¶
Sets the graph’s construction script safety status
- Parameters:
is_unsafe_during_actor_construction (bool)