parent
771a481262
commit
f6be9c056d
|
@ -14,6 +14,10 @@ Activate / deactivate layer opacity according to prefix
|
||||||
Activate / deactivate all masks using MA layers
|
Activate / deactivate all masks using MA layers
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
1.4.0
|
||||||
|
|
||||||
|
- added: split selection to scenes individually
|
||||||
|
|
||||||
1.3.6
|
1.3.6
|
||||||
|
|
||||||
- added: scene resolution in json crop pixels information, per objects
|
- 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'})
|
mode : bpy.props.StringProperty(default='ALL', options={'SKIP_SAVE'})
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
err = fn.split_object_to_scene()
|
if self.mode == 'ALL':
|
||||||
if err:
|
print('split selected object in separated scene')
|
||||||
self.report({'ERROR'}, err)
|
err = fn.split_object_to_scene()
|
||||||
return {"CANCELLED"}
|
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"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
classes=(
|
classes=(
|
||||||
GPEXP_OT_add_layer_to_render,
|
GPEXP_OT_add_layer_to_render,
|
||||||
GPEXP_OT_add_objects_to_render,
|
GPEXP_OT_add_objects_to_render,
|
||||||
|
|
|
@ -2,8 +2,8 @@ bl_info = {
|
||||||
"name": "GP Render",
|
"name": "GP Render",
|
||||||
"description": "Organise export of gp layers through compositor output",
|
"description": "Organise export of gp layers through compositor output",
|
||||||
"author": "Samuel Bernou",
|
"author": "Samuel Bernou",
|
||||||
"version": (1, 3, 6),
|
"version": (1, 4, 0),
|
||||||
"blender": (2, 93, 0),
|
"blender": (3, 0, 0),
|
||||||
"location": "View3D",
|
"location": "View3D",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
"doc_url": "https://gitlab.com/autour-de-minuit/blender/gp_render",
|
"doc_url": "https://gitlab.com/autour-de-minuit/blender/gp_render",
|
||||||
|
|
10
fn.py
10
fn.py
|
@ -1512,12 +1512,14 @@ 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):
|
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)
|
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'''
|
'''Create a new scene from object selection'''
|
||||||
|
|
||||||
active = bpy.context.object
|
if not scene_name:
|
||||||
scene_name = active.name
|
active = bpy.context.object
|
||||||
objs = [o for o in bpy.context.selected_objects]
|
scene_name = active.name
|
||||||
|
if not objs:
|
||||||
|
objs = [o for o in bpy.context.selected_objects]
|
||||||
|
|
||||||
if bpy.data.scenes.get(scene_name):
|
if bpy.data.scenes.get(scene_name):
|
||||||
print(f'Scene "{scene_name}" Already Exists')
|
print(f'Scene "{scene_name}" Already Exists')
|
||||||
|
|
4
ui.py
4
ui.py
|
@ -139,7 +139,9 @@ class GPEXP_PT_gp_node_ui(Panel):
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.label(text='Scenes:')
|
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 = layout.row(align=True)
|
||||||
row.operator('gp.set_crop_from_selection', icon='CON_OBJECTSOLVER', text='Autoset Crop')
|
row.operator('gp.set_crop_from_selection', icon='CON_OBJECTSOLVER', text='Autoset Crop')
|
||||||
|
|
Loading…
Reference in New Issue