Skip to content

Commit

Permalink
fixes adding custom nodes for 4.3 beta (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston authored Oct 22, 2024
1 parent 287dbc8 commit b4b9915
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions molecularnodes/operators/node_add_buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ def node_under_mouse(context, event):


def _add_node(node_name, context, show_options=False, material="default"):
# intended to be called upon button press in the node tree, and not for use
# in general scripting
"""
Add a node group to the node tree and set the values.
intended to be called upon button press in the node tree, and not for use in general scripting
"""

prev_context = context.area.type
context.area.type = "NODE_EDITOR"
# actually invoke the operator to add a node to the current node tree
# use_transform=True ensures it appears where the user's mouse is and is currently
# being moved so the user can place it where they wish
bpy.ops.node.add_node(
"INVOKE_DEFAULT", type="GeometryNodeGroup", use_transform=True
)
context.area.type = prev_context
node = context.active_node
node.node_tree = bpy.data.node_groups[node_name]
node.width = nodes.NODE_WIDTH
Expand Down

0 comments on commit b4b9915

Please sign in to comment.