parent
771a481262
commit
f6be9c056d
|
@ -14,6 +14,10 @@ Activate / deactivate layer opacity according to prefix
|
|||
Activate / deactivate all masks using MA layers
|
||||
-->
|
||||
|
||||
1.4.0
|
||||
|
||||
- added: split selection to scenes individually
|
||||
|
||||
1.3.6
|
||||
|
||||
- added: scene resolution in json crop pixels information, per objects
|
||||
|
|
|
@ -92,14 +92,32 @@ class GPEXP_OT_split_to_scene(bpy.types.Operator):
|
|||
mode : bpy.props.StringProperty(default='ALL', options={'SKIP_SAVE'})
|
||||
|
||||
def execute(self, context):
|
||||
if self.mode == 'ALL':
|
||||
print('split selected object in separated scene')
|
||||
err = fn.split_object_to_scene()
|
||||
if err:
|
||||
self.report({'ERROR'}, err)
|
||||
return {"CANCELLED"}
|
||||
|
||||
elif self.mode == 'INDIVIDUAL':
|
||||
print('split selected object individually in separated scenes')
|
||||
errors = []
|
||||
selected_objs = [o for o in context.selected_objects]
|
||||
scn = context.scene
|
||||
for o in reversed(selected_objs):
|
||||
err = fn.split_object_to_scene(objs=[o], scene_name=o.name)
|
||||
if err:
|
||||
errors.append(err)
|
||||
|
||||
## Reset to current scene (function use ops and go to new scene)
|
||||
context.window.scene = scn
|
||||
|
||||
if errors:
|
||||
fn.show_message_box(errors, 'Error Log')
|
||||
return {"CANCELLED"}
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
classes=(
|
||||
GPEXP_OT_add_layer_to_render,
|
||||
GPEXP_OT_add_objects_to_render,
|
||||
|
|
|
@ -2,8 +2,8 @@ bl_info = {
|
|||
"name": "GP Render",
|
||||
"description": "Organise export of gp layers through compositor output",
|
||||
"author": "Samuel Bernou",
|
||||
"version": (1, 3, 6),
|
||||
"blender": (2, 93, 0),
|
||||
"version": (1, 4, 0),
|
||||
"blender": (3, 0, 0),
|
||||
"location": "View3D",
|
||||
"warning": "",
|
||||
"doc_url": "https://gitlab.com/autour-de-minuit/blender/gp_render",
|
||||
|
|
4
fn.py
4
fn.py
|
@ -1512,11 +1512,13 @@ def remove_scene_nodes_by_obj_names(scn, name_list, negative=False):
|
|||
if (n.parent and n.parent.label in name_list) or (n.type == 'FRAME' and n.label in name_list):
|
||||
scn.node_tree.nodes.remove(n)
|
||||
|
||||
def split_object_to_scene():
|
||||
def split_object_to_scene(objs=None, scene_name=None):
|
||||
'''Create a new scene from object selection'''
|
||||
|
||||
if not scene_name:
|
||||
active = bpy.context.object
|
||||
scene_name = active.name
|
||||
if not objs:
|
||||
objs = [o for o in bpy.context.selected_objects]
|
||||
|
||||
if bpy.data.scenes.get(scene_name):
|
||||
|
|
4
ui.py
4
ui.py
|
@ -139,7 +139,9 @@ class GPEXP_PT_gp_node_ui(Panel):
|
|||
|
||||
layout.separator()
|
||||
layout.label(text='Scenes:')
|
||||
layout.operator('gp.split_to_scene', icon='DUPLICATE', text='Split Selected Obj To Scene')
|
||||
row = layout.row(align=True)
|
||||
row.operator('gp.split_to_scene', icon='DUPLICATE', text='Split Selection To Scene').mode = 'ALL'
|
||||
row.operator('gp.split_to_scene', text='Split Individually').mode = 'INDIVIDUAL'
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator('gp.set_crop_from_selection', icon='CON_OBJECTSOLVER', text='Autoset Crop')
|
||||
|
|
Loading…
Reference in New Issue