0
$\begingroup$

Is there any way to execute a geomtry nodes tool while in the uv editor? Currently it only works while the mouse is over in the 3d view. Like this:

bpy.ops.geometry.execute_node_group(name="Unwrap In Place", session_uid=8431)

But I whant to be able to execute it when pressing a button while in the uv editor as well, currently nothing happense, and I have verfied that there is nothing wrong with the tool since it works if the button is placed in the 3d viewport n panel.

$\endgroup$

1 Answer 1

0
$\begingroup$
    context_override = context.copy()
    context_override["area"].type = 'VIEW_3D'
    bpy.ops.geometry.execute_node_group(asset_library_type='LOCAL', asset_library_identifier="", relative_asset_identifier="NodeTree\\Unwrap In Place Tool")
    bpy.context.area.ui_type = 'UV'

Or solves it

    areas = bpy.context.screen.areas
    area = [a for a in areas if a.type == 'VIEW_3D'][0]

    with bpy.context.temp_override(area=area):
        bpy.ops.geometry.execute_node_group(asset_library_type='LOCAL', asset_library_identifier="", relative_asset_identifier="NodeTree\\Unwrap In Place Tool")
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .