Begin port to GPv3 - change GP type

This commit is contained in:
pullusb
2024-11-11 15:35:39 +01:00
parent 98ed92afe2
commit f5a78601b6
22 changed files with 96 additions and 96 deletions
+12 -12
View File
@@ -372,24 +372,24 @@ def create_gp_palette(gp_data_block,info) :
def get_gp_objects(selection=True):
'''return selected objects or only the active one'''
if not bpy.context.active_object or bpy.context.active_object.type != 'GPENCIL':
if not bpy.context.active_object or bpy.context.active_object.type != 'GREASEPENCIL':
print('No active GP object')
return []
active = bpy.context.active_object
if selection:
selection = [o for o in bpy.context.selected_objects if o.type == 'GPENCIL']
selection = [o for o in bpy.context.selected_objects if o.type == 'GREASEPENCIL']
if not active in selection:
selection += [active]
return selection
if bpy.context.active_object and bpy.context.active_object.type == 'GPENCIL':
if bpy.context.active_object and bpy.context.active_object.type == 'GREASEPENCIL':
return [active]
return []
def get_gp_datas(selection=True):
'''return selected objects or only the active one'''
if not bpy.context.active_object or bpy.context.active_object.type != 'GPENCIL':
if not bpy.context.active_object or bpy.context.active_object.type != 'GREASEPENCIL':
print('No active GP object')
return []
@@ -397,15 +397,15 @@ def get_gp_datas(selection=True):
if selection:
selected = []
for o in bpy.context.selected_objects:
if o.type == 'GPENCIL':
if o.type == 'GREASEPENCIL':
if o.data not in selected:
selected.append(o.data)
# selected = [o.data for o in bpy.context.selected_objects if o.type == 'GPENCIL']
# selected = [o.data for o in bpy.context.selected_objects if o.type == 'GREASEPENCIL']
if not active_data in selected:
selected += [active_data]
return selected
if bpy.context.active_object and bpy.context.active_object.type == 'GPENCIL':
if bpy.context.active_object and bpy.context.active_object.type == 'GREASEPENCIL':
return [active_data]
print('EOL. No active GP object')
@@ -1206,7 +1206,7 @@ def all_anim_enabled(objects) -> bool:
if fcu.mute:
return False
if o.type in ('GPENCIL', 'CAMERA'):
if o.type in ('GREASEPENCIL', 'CAMERA'):
if o.data.animation_data and o.data.animation_data.action:
## Check if object data attributes fcurves are muted
for fcu in o.animation_data.action.fcurves:
@@ -1219,7 +1219,7 @@ def all_anim_enabled(objects) -> bool:
def all_object_modifier_enabled(objects) -> bool:
'''Return False if one modifier of one object has GP modifier disabled in viewport but enabled in render'''
for o in objects:
if o.type != 'GPENCIL':
if o.type != 'GREASEPENCIL':
continue
for m in o.grease_pencil_modifiers:
if m.show_render and not m.show_viewport:
@@ -1247,7 +1247,7 @@ def has_fully_enabled_anim(o):
if fcu.mute:
return False
if o.type in ('GPENCIL', 'CAMERA'):
if o.type in ('GREASEPENCIL', 'CAMERA'):
if o.data.animation_data and o.data.animation_data.action:
## Check if object data attributes fcurves are muted
for fcu in o.animation_data.action.fcurves:
@@ -1292,7 +1292,7 @@ def anim_status(objects) -> tuple((str, str)):
on_count += 1
count += 1
if o.type in ('GPENCIL', 'CAMERA'):
if o.type in ('GREASEPENCIL', 'CAMERA'):
datablock = o.data
if datablock.animation_data is None:
continue
@@ -1320,7 +1320,7 @@ def gp_modifier_status(objects) -> tuple((str, str)):
'''return icons on/off tuple'''
on_count = off_count = count = 0
for o in objects:
if o.type != 'GPENCIL':
if o.type != 'GREASEPENCIL':
continue
## Skip hided object
if o.hide_get() and o.hide_render: