unreal.InterchangeBaseNodeContainer

class unreal.InterchangeBaseNodeContainer(outer: Object | None = None, name: Name | str = 'None')

Bases: Object

The Interchange UInterchangeBaseNode graph is a format used to feed factories and writers when they import, reimport, and export an asset or scene.

This container holds a flat list of all nodes that have been translated from the source data. Translators fill this container, and the import/export managers read it to execute the import/export process.

C++ Source:

  • Module: InterchangeCore

  • File: InterchangeBaseNodeContainer.h

Editor Properties: (see get_editor_property/set_editor_property)

  • nodes (Map[str, InterchangeBaseNode]): [Read-Only] Flat List of the nodes. Since the nodes are variable size, we store a pointer.

add_node(node) str

Add a node to the container. The node is added into a TMap. return:: return the node unique ID of the added item. If the node already exist it will return the existing ID. Return InvalidNodeUid if the node cannot be added.

Parameters:

node (InterchangeBaseNode) – a pointer on the node you want to add

Return type:

str

clear_node_parent_uid(node_unique_id) bool

Remove the node’s ParentUid, making it into a top-level node

Parameters:

node_unique_id (str)

Return type:

bool

compute_children_cache() None

Fill the cache of children UIDs to optimize the GetNodeChildrenUids call.

get_factory_node(node_unique_id) InterchangeFactoryBaseNode

Get a factory node pointer.

Parameters:

node_unique_id (str)

Return type:

InterchangeFactoryBaseNode

get_is_ancestor(node_unique_id, ancestor_uid) bool

Checks if ParentNodeUID is an ancestor.

Parameters:
  • node_unique_id (str)

  • ancestor_uid (str)

Return type:

bool

get_node(node_unique_id) InterchangeBaseNode

Get a node pointer. Once added to the container, nodes are considered const.

Parameters:

node_unique_id (str)

Return type:

InterchangeBaseNode

get_node_children(node_unique_id, child_index) InterchangeBaseNode

Get the nth const child of the node

Parameters:
  • node_unique_id (str)

  • child_index (int32)

Return type:

InterchangeBaseNode

get_node_children_count(node_unique_id) int32

Get the number of children the node has.

Parameters:

node_unique_id (str)

Return type:

int32

get_node_children_uids(node_unique_id) Array[str]

Get the UIDs of all the node’s children.

Parameters:

node_unique_id (str)

Return type:

Array[str]

get_nodes(class_node) Array[str]

Return all nodes that are of the ClassNode type.

Parameters:

class_node (type(Class))

Returns:

out_nodes (Array[str]):

Return type:

Array[str]

get_roots() Array[str]

Return all nodes that do not have any parent.

Returns:

root_nodes (Array[str]):

Return type:

Array[str]

is_node_uid_valid(node_unique_id) bool

Return true if the node unique ID exists in the container.

Parameters:

node_unique_id (str)

Return type:

bool

load_from_file(filename) None

Serialize the node container from the specified file.

Parameters:

filename (str)

remove_node(node_unique_id) None

Removes node from Nodes map with the given NodeUniqueID.

Parameters:

node_unique_id (str)

replace_node(node_unique_id, new_node) None

Replace Node

Parameters:
reset() None

Empty the container.

reset_children_cache() None

Reset the cache of children UIDs.

save_to_file(filename) None

Serialize the node container into the specified file.

Parameters:

filename (str)

set_namespace(namespace, target_class) None

Set a namespace to all node of the target class in this container. A valid node namespace is prefix to the unique ID in UInterchangeBaseNode::GetUniqueId(). After adding the namespace this function will find any string attribute in all the node that reference the node unique ID and replace the attribute value with the new unique id. The last step is to remap the node container with the new Ids. Note: Changing all node namespace wont work since some node class use a combinaison of the unique ID in there attributes and we cannot change those attribute in a generic way.

Parameters:
  • namespace (str) – Is the new namespace you want to set. Pass an empty string to remove an existing namespace.

  • target_class (type(Class)) – Optional, this parameter represent the node class we want to apply the namespace on. If null all node will be tagged with the namespace

set_node_desired_child_index(node_unique_id, new_node_desired_child_index) bool

Set the desired child index of the node.

Parameters:
  • node_unique_id (str)

  • new_node_desired_child_index (int32)

Return type:

bool

set_node_parent_uid(node_unique_id, new_parent_node_uid) bool

Set the ParentUid of the node.

Parameters:
  • node_unique_id (str)

  • new_parent_node_uid (str)

Return type:

bool