To rename a new group you can after creating first get out of the group
# Get out of group
bpy.ops.node.group_edit( get_override('NODE_EDITOR') )
Then name the active node which is the group
groupname = bpy.context.active_object.active_material.node_tree.nodes.active
Then if needed get "back in the group"
bpy.ops.node.group_edit( get_override('NODE_EDITOR') )
The override function:
def get_override(area_type):
for window in bpy.context.window_manager.windows:
screen = window.screen
for area in screen.areas:
if area.type == area_type:
for region in area.regions:
if region.type == 'WINDOW':
override = {'window': window,
'screen': screen,
'area': area,
'region': region,
'blend_data': bpy.context.blend_data}
return override
bpy.data.node_groups.new(name, type)but realize there may be cases where this isnt a drop-in replacement. – ideasman42 Dec 09 '13 at 23:59bpy.data.node_groups[-1]is not returning the last created node group. – gandalf3 Dec 10 '13 at 00:46bpy.data.node_groups.newworks for me, thanks. @CoDEmanX I assigned the variable right after creating the nodegroup, but it still wasn't the right nodegroup. – gandalf3 Dec 10 '13 at 08:17