2021-08-23 14:50:00 +02:00
|
|
|
# from . import addon_updater_ops
|
2023-03-09 17:53:40 +01:00
|
|
|
from .utils import (get_addon_prefs,
|
|
|
|
anim_status,
|
|
|
|
gp_modifier_status,
|
|
|
|
)
|
2021-01-10 16:47:17 +01:00
|
|
|
import bpy
|
|
|
|
from pathlib import Path
|
2021-12-04 13:57:32 +01:00
|
|
|
from bpy.types import Panel
|
2021-01-10 16:47:17 +01:00
|
|
|
|
2023-03-09 14:52:58 +01:00
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
## UI in properties
|
|
|
|
|
|
|
|
### dataprop_panel not used --> transferred to sidebar
|
|
|
|
"""
|
2021-12-04 13:57:32 +01:00
|
|
|
class GPTB_PT_dataprop_panel(Panel):
|
2021-01-10 16:47:17 +01:00
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
# bl_space_type = 'VIEW_3D'
|
|
|
|
# bl_region_type = 'UI'
|
|
|
|
# bl_category = "Tool"
|
|
|
|
# bl_idname = "ADDONID_PT_panel_name"# identifier, if ommited, takes the name of the class.
|
|
|
|
bl_label = "Pseudo color"# title
|
2024-11-11 17:27:57 +01:00
|
|
|
bl_parent_id = "DATA_PT_grease_pencil_layers"#subpanel of this ID
|
2021-01-10 16:47:17 +01:00
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
settings = context.scene.gptoolprops
|
|
|
|
|
|
|
|
col = layout.column(align = True)
|
|
|
|
row = col.split(align=False, factor=0.63)
|
|
|
|
row.prop(settings, 'autotint_offset')
|
|
|
|
row.prop(settings, 'autotint_namespace')
|
|
|
|
|
|
|
|
col.operator("gp.auto_tint_gp_layers", icon = "COLOR").reset = False
|
|
|
|
col.operator("gp.auto_tint_gp_layers", text = "Reset tint", icon = "COLOR").reset = True
|
|
|
|
"""
|
|
|
|
|
|
|
|
## UI in Gpencil sidebar menu
|
|
|
|
|
2021-12-04 13:57:32 +01:00
|
|
|
class GPTB_PT_sidebar_panel(Panel):
|
2021-10-20 13:56:01 +02:00
|
|
|
bl_label = "GP Toolbox"
|
2021-01-10 16:47:17 +01:00
|
|
|
bl_space_type = "VIEW_3D"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
# layout.use_property_split = True
|
2021-08-23 14:50:00 +02:00
|
|
|
prefs = get_addon_prefs()
|
2021-01-10 16:47:17 +01:00
|
|
|
rd = context.scene.render
|
|
|
|
# check for update
|
2021-08-23 14:50:00 +02:00
|
|
|
# addon_updater_ops.check_for_update_background()
|
2021-01-10 16:47:17 +01:00
|
|
|
|
|
|
|
# layout.label(text='View options:')
|
2021-10-20 13:56:01 +02:00
|
|
|
col = layout.column()
|
2022-10-07 02:20:28 +02:00
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
## flip X cam
|
2022-10-07 02:20:28 +02:00
|
|
|
# layout.label(text='! Flipped !')
|
2024-06-04 14:33:31 +02:00
|
|
|
|
|
|
|
row = col.row(align=True)
|
|
|
|
row.prop(context.scene.tool_settings, 'gpencil_stroke_placement_view3d', text='')
|
|
|
|
row.prop(context.scene.tool_settings.gpencil_sculpt, 'lock_axis', text='')
|
|
|
|
|
2022-10-07 02:20:28 +02:00
|
|
|
row = col.row(align=True)
|
2021-01-10 16:47:17 +01:00
|
|
|
|
2022-10-07 02:20:28 +02:00
|
|
|
row.operator('view3d.camera_mirror_flipx', text = 'Mirror Flip', icon = 'MOD_MIRROR')# ARROW_LEFTRIGHT
|
|
|
|
if context.scene.camera and context.scene.camera.scale.x < 0:
|
2021-01-10 16:47:17 +01:00
|
|
|
row.label(text='',icon='LOOP_BACK')
|
|
|
|
|
|
|
|
## draw/manipulation camera
|
|
|
|
if context.scene.camera and context.scene.camera.name.startswith(('draw', 'obj')):
|
|
|
|
row = col.row(align=True)
|
|
|
|
row.operator('gp.draw_cam_switch', text = 'Main cam', icon = 'OUTLINER_OB_CAMERA')
|
|
|
|
row.label(text='',icon='LOOP_BACK')
|
|
|
|
if context.scene.camera.name.startswith('draw'):
|
|
|
|
col.operator('gp.reset_cam_rot', text='reset rotation')#.swapmethod ? = CAM
|
|
|
|
else:
|
|
|
|
col.operator('gp.set_view_as_cam', text='set view')#.swapmethod ? = CAM
|
|
|
|
|
|
|
|
else:
|
|
|
|
row = col.row(align=True)
|
|
|
|
row.operator('gp.draw_cam_switch', text = 'Draw cam', icon = 'CON_CAMERASOLVER').cam_mode = 'draw'
|
|
|
|
row.operator('gp.draw_cam_switch', text = 'Object cam', icon = 'CON_CAMERASOLVER').cam_mode = 'object'
|
|
|
|
col.label(text='In main camera', icon = 'OUTLINER_OB_CAMERA')
|
|
|
|
|
|
|
|
# layout.operator('gp.overlay_presets', text = 'Toggle overlays', icon = 'OVERLAY')
|
|
|
|
|
|
|
|
if context.scene.camera:
|
|
|
|
row = layout.row(align=True)# .split(factor=0.5)
|
|
|
|
row.label(text='Passepartout')
|
2021-06-05 01:20:35 +02:00
|
|
|
if context.scene.camera.name == 'draw_cam':
|
|
|
|
row.prop(context.scene.gptoolprops, 'drawcam_passepartout', text='', icon ='OBJECT_HIDDEN')
|
|
|
|
else:
|
|
|
|
row.prop(context.scene.camera.data, 'show_passepartout', text='', icon ='OBJECT_HIDDEN')
|
2021-01-10 16:47:17 +01:00
|
|
|
row.prop(context.scene.camera.data, 'passepartout_alpha', text='')
|
2023-02-14 18:49:48 +01:00
|
|
|
# row = layout.row(align=True)
|
|
|
|
# row.operator('view3d.view_camera_frame_fit', text = 'Custom fit', icon = 'ZOOM_PREVIOUS') # FULLSCREEN_EXIT
|
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
row = layout.row(align=True)
|
2021-06-05 01:20:35 +02:00
|
|
|
row.operator('view3d.zoom_camera_1_to_1', text = 'Zoom 1:1', icon = 'ZOOM_PREVIOUS') # FULLSCREEN_EXIT
|
2021-01-10 16:47:17 +01:00
|
|
|
row.operator('view3d.view_center_camera', text = 'Zoom fit', icon = 'FULLSCREEN_ENTER')
|
|
|
|
|
|
|
|
## background images/videos
|
|
|
|
if context.scene.camera.data.background_images:
|
|
|
|
layout.separator()
|
|
|
|
icon_bg = 'RESTRICT_VIEW_OFF' if context.scene.camera.data.show_background_images else 'RESTRICT_VIEW_ON'# IMAGE_BACKGROUND#IMAGE_PLANE
|
|
|
|
# icon_bg = 'TRIA_DOWN' if context.scene.camera.data.show_background_images else 'IMAGE_BACKGROUND'
|
|
|
|
box = layout.box()
|
|
|
|
box.prop(context.scene.camera.data, 'show_background_images', text='Ref in cam', icon=icon_bg)
|
|
|
|
if context.scene.camera.data.show_background_images:
|
|
|
|
# box = layout.box()
|
|
|
|
for bg_img in context.scene.camera.data.background_images:
|
|
|
|
if bg_img.source == 'IMAGE' and bg_img.image:
|
|
|
|
row = box.row(align=True)
|
2021-03-31 01:38:17 +02:00
|
|
|
row.prop(bg_img, 'show_background_image', text='', icon='IMAGE_RGB')
|
|
|
|
row.prop(bg_img, 'alpha', text=bg_img.image.name) # options={'HIDDEN'}
|
|
|
|
# row.label(icon='IMAGE_RGB')
|
|
|
|
# icon = 'HIDE_OFF' if bg_img.show_background_image else 'HIDE_ON'
|
|
|
|
# row.prop(bg_img, 'show_background_image', text='', icon=icon)
|
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
if bg_img.source == 'MOVIE_CLIP' and bg_img.clip:
|
|
|
|
row = box.row(align=True)
|
2021-03-31 01:38:17 +02:00
|
|
|
row.prop(bg_img, 'show_background_image', text='', icon='FILE_MOVIE')
|
|
|
|
row.prop(bg_img, 'alpha', text=bg_img.clip.name) # options={'HIDDEN'}
|
|
|
|
# row.label(icon='FILE_MOVIE')
|
|
|
|
# icon = 'HIDE_OFF' if bg_img.show_background_image else 'HIDE_ON'
|
|
|
|
# row.prop(bg_img, 'show_background_image', text='', icon=icon)
|
2021-01-10 16:47:17 +01:00
|
|
|
|
|
|
|
else:
|
|
|
|
layout.label(text='No camera !', icon = 'ERROR')
|
|
|
|
|
2021-06-05 01:20:35 +02:00
|
|
|
## Straight line ops from official greasepencil_tools addon if enabled.
|
|
|
|
# if any(x in context.preferences.addons.keys() for x in ('greasepencil_tools', 'greasepencil-addon')): # check enabled addons
|
2021-06-06 21:30:46 +02:00
|
|
|
if hasattr(bpy.types, 'GP_OT_straight_stroke'): # check if operator exists : bpy.ops.gp.straight_stroke.idname()
|
2022-10-07 02:20:28 +02:00
|
|
|
layout.operator(bpy.types.GP_OT_straight_stroke.bl_idname, icon ="CURVE_PATH")
|
2021-06-05 01:20:35 +02:00
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
## Options
|
2021-10-20 13:56:01 +02:00
|
|
|
col = layout.column()
|
|
|
|
col.label(text = 'Options:')
|
2021-05-02 23:14:38 +02:00
|
|
|
|
|
|
|
## Kf Jump filter
|
2021-10-20 13:56:01 +02:00
|
|
|
col.prop(context.scene.gptoolprops, 'keyframe_type', text='Jump On') # Keyframe Jump
|
2021-06-05 01:20:35 +02:00
|
|
|
# col.prop(context.space_data.overlay, 'use_gpencil_onion_skin') # not often used
|
2021-01-10 16:47:17 +01:00
|
|
|
|
2024-11-11 15:35:39 +01:00
|
|
|
if context.object and context.object.type == 'GREASEPENCIL':
|
2021-06-05 01:20:35 +02:00
|
|
|
# col.prop(context.object.data, 'use_autolock_layers') # not often used
|
2022-09-28 11:10:32 +02:00
|
|
|
col.prop(context.object, 'show_in_front') # text='In Front'
|
2021-01-10 16:47:17 +01:00
|
|
|
|
|
|
|
## rename datablock temporary layout
|
|
|
|
if context.object.name != context.object.data.name:
|
2021-05-09 01:26:37 +02:00
|
|
|
box = col.box()
|
2021-01-10 16:47:17 +01:00
|
|
|
box.label(text='different name for object and data:', icon='INFO')
|
|
|
|
row = box.row(align=False)
|
|
|
|
row.operator('gp.rename_data_from_obj').rename_all = False
|
|
|
|
row.operator('gp.rename_data_from_obj', text='Rename all').rename_all = True
|
|
|
|
|
|
|
|
## Check base palette
|
2021-08-23 14:50:00 +02:00
|
|
|
if prefs.warn_base_palette and prefs.palette_path:
|
|
|
|
if not all(x in [m.name for m in context.object.data.materials if m] for x in ("line", "invisible")):
|
|
|
|
box = col.box()
|
|
|
|
box.label(text='Missing base material setup', icon='INFO')
|
|
|
|
box.operator('gp.load_default_palette')
|
2021-05-04 23:17:19 +02:00
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
else:
|
2021-05-09 01:26:37 +02:00
|
|
|
col.label(text='No GP object selected')
|
2021-01-10 16:47:17 +01:00
|
|
|
|
2024-11-12 19:06:57 +01:00
|
|
|
|
|
|
|
## Gpv3: not more edit line (use Curve lines)
|
|
|
|
# col.prop(context.scene.gptoolprops, 'edit_lines_opacity')
|
2021-06-05 01:20:35 +02:00
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
# Mention update as notice
|
2021-08-23 14:50:00 +02:00
|
|
|
# addon_updater_ops.update_notice_box_ui(self, context)
|
2021-01-10 16:47:17 +01:00
|
|
|
|
|
|
|
# row = layout.row(align=False)
|
|
|
|
# row.label(text='arrow choice')
|
|
|
|
# row.operator("my_operator.multi_op", text='', icon='TRIA_LEFT').left = 1
|
|
|
|
# row.operator("my_operator.multi_op", text='', icon='TRIA_RIGHT').left = 0
|
|
|
|
|
2021-12-04 13:57:32 +01:00
|
|
|
class GPTB_PT_anim_manager(Panel):
|
2021-10-20 13:56:01 +02:00
|
|
|
bl_label = "Animation Manager"
|
2021-01-10 16:47:17 +01:00
|
|
|
bl_space_type = "VIEW_3D"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
bl_parent_id = "GPTB_PT_sidebar_panel"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
# def draw_header(self,context):
|
|
|
|
# self.layout.prop(context.scene.camera.data, "show_background_images", text="")
|
|
|
|
|
2023-03-09 17:53:40 +01:00
|
|
|
def get_object_by_types(self, context) -> dict:
|
|
|
|
# import time
|
|
|
|
# t0 = time.perf_counter()
|
|
|
|
|
2024-11-11 15:35:39 +01:00
|
|
|
# objs = [o for o in context.scene.objects if o.type not in ('GREASEPENCIL', 'CAMERA')]
|
|
|
|
# gps = [o for o in context.scene.objects if o.type == 'GREASEPENCIL']
|
2023-03-09 17:53:40 +01:00
|
|
|
# cams = [o for o in context.scene.objects if o.type == 'CAMERA']
|
|
|
|
objs = []
|
|
|
|
gps = []
|
|
|
|
cams = []
|
|
|
|
for o in context.scene.objects:
|
2024-11-11 15:35:39 +01:00
|
|
|
if o.type not in ('GREASEPENCIL', 'CAMERA'):
|
2023-03-09 17:53:40 +01:00
|
|
|
objs.append(o)
|
2024-11-11 15:35:39 +01:00
|
|
|
elif o.type == 'GREASEPENCIL':
|
2023-03-09 17:53:40 +01:00
|
|
|
gps.append(o)
|
|
|
|
elif o.type == 'CAMERA':
|
|
|
|
cams.append(o)
|
|
|
|
|
|
|
|
# print(f'{time.perf_counter() - t0:.8f}s')
|
|
|
|
|
2024-11-11 15:35:39 +01:00
|
|
|
return {'OBJECT': objs, 'GREASEPENCIL': gps, 'CAMERA': cams}
|
2023-03-09 17:53:40 +01:00
|
|
|
|
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
2021-10-20 13:56:01 +02:00
|
|
|
col = layout.column()
|
2021-01-10 16:47:17 +01:00
|
|
|
## Animation enable disable anim (shift click to select) OP_helpers.GPTB_OT_toggle_mute_animation
|
2023-03-09 17:53:40 +01:00
|
|
|
|
|
|
|
obj_types = self.get_object_by_types(context)
|
2022-06-23 15:43:25 +02:00
|
|
|
|
2023-03-09 14:52:58 +01:00
|
|
|
col.operator('gp.list_disabled_anims')
|
2022-06-23 15:43:25 +02:00
|
|
|
|
2023-03-09 17:53:40 +01:00
|
|
|
## Show Enable / Disable anims
|
2024-11-11 15:35:39 +01:00
|
|
|
for cat, cat_type in [('Obj anims:', 'OBJECT'), ('Cam anims:', 'CAMERA'), ('Gp anims:', 'GREASEPENCIL')]:
|
2023-03-09 17:53:40 +01:00
|
|
|
on_icon, off_icon = anim_status(obj_types[cat_type])
|
|
|
|
|
2023-03-09 14:52:58 +01:00
|
|
|
subcol = col.column()
|
2023-03-09 17:53:40 +01:00
|
|
|
# subcol.alert = off_icon == 'LAYER_ACTIVE' # Turn red
|
2023-03-09 14:52:58 +01:00
|
|
|
row = subcol.row(align=True)
|
|
|
|
row.label(text=cat)
|
2023-03-09 17:53:40 +01:00
|
|
|
|
|
|
|
ops = row.operator('gp.toggle_mute_animation', text='ON', icon=on_icon)
|
2023-03-09 14:52:58 +01:00
|
|
|
ops.mode = cat_type
|
|
|
|
ops.mute = False
|
2022-06-23 15:43:25 +02:00
|
|
|
|
2023-03-09 17:53:40 +01:00
|
|
|
ops = row.operator('gp.toggle_mute_animation', text='OFF', icon=off_icon)
|
2023-03-09 14:52:58 +01:00
|
|
|
ops.mode = cat_type
|
|
|
|
ops.mute = True
|
2022-06-23 15:43:25 +02:00
|
|
|
|
2021-10-20 21:17:37 +02:00
|
|
|
## GP modifiers
|
2023-03-09 14:52:58 +01:00
|
|
|
subcol = col.column()
|
2023-03-09 17:53:40 +01:00
|
|
|
|
2023-03-09 14:52:58 +01:00
|
|
|
row = subcol.row(align=True)
|
2021-10-20 21:17:37 +02:00
|
|
|
row.label(text='Gp modifiers:')
|
2024-11-11 15:35:39 +01:00
|
|
|
on_icon, off_icon = gp_modifier_status(obj_types['GREASEPENCIL'])
|
2023-03-09 17:53:40 +01:00
|
|
|
# subcol.alert = off_icon == 'LAYER_ACTIVE' # Turn red
|
|
|
|
row.operator('gp.toggle_hide_gp_modifier', text='ON', icon=on_icon).show = True
|
|
|
|
row.operator('gp.toggle_hide_gp_modifier', text='OFF', icon=off_icon).show = False
|
2021-01-10 16:47:17 +01:00
|
|
|
|
2024-01-24 17:54:14 +01:00
|
|
|
## Step Select Frames
|
|
|
|
col.operator('gptb.step_select_frames')
|
|
|
|
|
2022-11-04 18:45:37 +01:00
|
|
|
## Follow curve path
|
2023-03-09 14:52:58 +01:00
|
|
|
col = col.column()
|
2022-11-04 18:45:37 +01:00
|
|
|
row = col.row(align=True)
|
2022-11-09 18:59:22 +01:00
|
|
|
|
2022-11-15 18:36:21 +01:00
|
|
|
if context.object:
|
|
|
|
if context.object.type == 'CURVE' and context.mode in ('OBJECT', 'EDIT_CURVE'):
|
|
|
|
row.operator('object.object_from_curve', text='Back To Object', icon='LOOP_BACK')
|
2022-11-09 18:59:22 +01:00
|
|
|
|
2022-11-15 18:36:21 +01:00
|
|
|
elif (follow_const := context.object.constraints.get('Follow Path')) and follow_const.target:
|
|
|
|
row.operator('object.edit_curve', text='Edit Curve', icon='OUTLINER_DATA_CURVE')
|
|
|
|
row.operator('object.remove_follow_path', text='', icon='X')
|
|
|
|
col.label(text=f'{context.object.name} -> {follow_const.target.name}', icon='CON_FOLLOWPATH')
|
|
|
|
if follow_const.use_fixed_location:
|
|
|
|
col.prop(follow_const, 'offset_factor')
|
|
|
|
else:
|
|
|
|
col.prop(follow_const, 'offset')
|
|
|
|
if context.object.location.length != 0: # context.object.location[:] != (0,0,0):
|
|
|
|
col.operator('object.location_clear', text='Offseted Location! Reset', icon='ERROR')
|
|
|
|
# ? Check if object location is animated ? (can be intentional...)
|
2022-11-09 18:59:22 +01:00
|
|
|
|
2022-11-15 18:36:21 +01:00
|
|
|
else:
|
|
|
|
col.operator('object.create_follow_path_curve', text='Create Follow Curve', icon='CURVE_BEZCURVE')
|
2022-11-09 18:59:22 +01:00
|
|
|
|
2022-11-04 18:45:37 +01:00
|
|
|
|
2021-10-20 13:56:01 +02:00
|
|
|
## This can go in an extra category...
|
|
|
|
col = layout.column()
|
|
|
|
col.use_property_split = False
|
|
|
|
text, icon = ('Cursor Follow On', 'PIVOT_CURSOR') if context.scene.gptoolprops.cursor_follow else ('Cursor Follow Off', 'CURSOR')
|
|
|
|
col.prop(context.scene.gptoolprops, 'cursor_follow', text=text, icon=icon)
|
2023-03-09 14:52:58 +01:00
|
|
|
|
2021-10-20 13:56:01 +02:00
|
|
|
|
2021-12-04 13:57:32 +01:00
|
|
|
class GPTB_PT_toolbox_playblast(Panel):
|
2021-06-05 01:20:35 +02:00
|
|
|
bl_label = "Playblast"
|
|
|
|
bl_space_type = "VIEW_3D"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
bl_parent_id = "GPTB_PT_sidebar_panel"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
rd = context.scene.render
|
|
|
|
row = layout.row(align=False) # split(factor=0.6)
|
|
|
|
percent = context.scene.gptoolprops.resolution_percentage
|
|
|
|
row.label(text = f'{rd.resolution_x * percent // 100} x {rd.resolution_y * percent // 100}')
|
|
|
|
row.prop(context.scene.gptoolprops, 'resolution_percentage', text='')
|
|
|
|
# row.prop(rd, 'resolution_percentage', text='') # real percent scene percentage
|
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.operator('render.thread_playblast', text = 'Playblast', icon = 'RENDER_ANIMATION')# non blocking background render playblast
|
|
|
|
# row.operator('render.playblast_anim', text = 'Playblast', icon = 'RENDER_ANIMATION').use_view = False # old (but robust) blocking playblast
|
|
|
|
row.operator('render.playblast_anim', text = 'Viewport').use_view = True
|
|
|
|
|
2021-12-04 13:57:32 +01:00
|
|
|
class GPTB_PT_tint_layers(Panel):
|
2021-10-20 13:56:01 +02:00
|
|
|
bl_label = "Tint Layers"
|
2021-01-10 16:47:17 +01:00
|
|
|
bl_space_type = "VIEW_3D"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
bl_parent_id = "GPTB_PT_sidebar_panel"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
# def draw_header(self,context):
|
|
|
|
# self.layout.prop(context.scene.camera.data, "show_background_images", text="")
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
## pseudo color layers
|
|
|
|
# layout.separator()
|
|
|
|
col = layout.column(align = True)
|
2022-10-13 00:09:12 +02:00
|
|
|
# row = col.split(align=False, factor=0.63)
|
|
|
|
# row = col.row()
|
|
|
|
col.prop(context.scene.gptoolprops, 'autotint_offset', text='Hue Offset')
|
|
|
|
col.prop(context.scene.gptoolprops, 'autotint_namespace')
|
2021-01-10 16:47:17 +01:00
|
|
|
|
|
|
|
col.operator("gp.auto_tint_gp_layers", icon = "COLOR").reset = False
|
|
|
|
col.operator("gp.auto_tint_gp_layers", text = "Reset tint", icon = "COLOR").reset = True
|
|
|
|
|
2021-10-20 13:56:01 +02:00
|
|
|
|
2021-12-04 13:57:32 +01:00
|
|
|
class GPTB_PT_checker(Panel):
|
2021-10-20 13:56:01 +02:00
|
|
|
bl_label = "Checker"
|
2021-01-10 16:47:17 +01:00
|
|
|
bl_space_type = "VIEW_3D"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
bl_parent_id = "GPTB_PT_sidebar_panel"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
# def draw_header(self,context):
|
|
|
|
# self.layout.prop(context.scene.camera.data, "show_background_images", text="")
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2021-10-20 13:56:01 +02:00
|
|
|
col = layout.column()
|
|
|
|
row = col.row(align=True)
|
|
|
|
## realign / reproject
|
|
|
|
row.operator('gp.realign', icon='AXIS_FRONT')
|
|
|
|
## move in depth
|
|
|
|
row.operator('object.depth_proportional_move', text='Depth move', icon='TRANSFORM_ORIGINS')
|
2021-01-10 16:47:17 +01:00
|
|
|
|
2021-10-20 13:56:01 +02:00
|
|
|
## col.operator('gp.batch_reproject_all_frames') # text=Batch Reproject # added to context menu
|
|
|
|
## check drawing alignement
|
|
|
|
col.operator('gp.check_canvas_alignement', icon='DRIVER_ROTATIONAL_DIFFERENCE')
|
2021-01-10 16:47:17 +01:00
|
|
|
|
2021-10-20 13:56:01 +02:00
|
|
|
## File checker
|
|
|
|
row = col.row(align=True)
|
|
|
|
row.operator('gp.file_checker', text = 'Check file', icon = 'SCENE_DATA')
|
|
|
|
row.operator('gp.links_checker', text = 'Check links', icon = 'UNLINKED')
|
|
|
|
|
|
|
|
|
2021-12-04 13:57:32 +01:00
|
|
|
class GPTB_PT_color(Panel):
|
2021-10-20 13:56:01 +02:00
|
|
|
bl_label = "Color"
|
|
|
|
bl_space_type = "VIEW_3D"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
bl_parent_id = "GPTB_PT_sidebar_panel"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
2021-06-05 01:20:35 +02:00
|
|
|
|
2021-10-20 13:56:01 +02:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2021-11-25 17:00:09 +01:00
|
|
|
col = layout.column()
|
2021-10-20 13:56:01 +02:00
|
|
|
## Create empty frame on layer
|
2021-12-04 13:57:32 +01:00
|
|
|
|
|
|
|
# Material panel as a pop-up (would work if palette dir is separated)
|
|
|
|
# col.operator("wm.call_panel", text="Link Materials Palette", icon='COLOR').name = "GPTB_PT_palettes_linker_ui"
|
2021-11-25 17:00:09 +01:00
|
|
|
col.operator('gp.create_empty_frames', icon='DECORATE_KEYFRAME')
|
2021-12-04 13:57:32 +01:00
|
|
|
# col.operator("wm.call_panel", text="Link Material Palette", icon='COLOR').name = "GPTB_PT_palettes_list_popup"
|
2021-01-10 16:47:17 +01:00
|
|
|
|
2021-10-20 13:56:01 +02:00
|
|
|
""" # unused : added in Animation Manager
|
2021-12-04 13:57:32 +01:00
|
|
|
class GPTB_PT_extra(Panel):
|
2021-10-20 13:56:01 +02:00
|
|
|
bl_label = "Extra"
|
|
|
|
bl_space_type = "VIEW_3D"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
bl_parent_id = "GPTB_PT_sidebar_panel"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
col = layout.column()
|
|
|
|
text, icon = ('Cursor Follow On', 'PIVOT_CURSOR') if context.scene.gptoolprops.cursor_follow else ('Cursor Follow Off', 'CURSOR')
|
|
|
|
col.prop(context.scene.gptoolprops, 'cursor_follow', text=text, icon=icon)
|
|
|
|
"""
|
2021-01-10 16:47:17 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
## unused -- (integrated in sidebar_panel)
|
2021-12-04 13:57:32 +01:00
|
|
|
class GPTB_PT_cam_ref_panel(Panel):
|
2021-01-10 16:47:17 +01:00
|
|
|
bl_label = "Background imgs"
|
|
|
|
bl_space_type = "VIEW_3D"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
bl_parent_id = "GPTB_PT_sidebar_panel"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
return context.scene.camera
|
|
|
|
|
|
|
|
def draw_header(self,context):
|
|
|
|
self.layout.prop(context.scene.camera.data, "show_background_images", text="")
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
|
|
|
|
if context.scene.camera.data.show_background_images:
|
|
|
|
for bg_img in context.scene.camera.data.background_images:
|
|
|
|
if bg_img.image:
|
|
|
|
row = layout.row(align=False)
|
|
|
|
row.label(text=bg_img.image.name, icon='IMAGE_RGB')
|
|
|
|
row.prop(bg_img, 'show_background_image', text='')# options={'HIDDEN'}
|
|
|
|
"""
|
|
|
|
|
|
|
|
def palette_manager_menu(self, context):
|
|
|
|
"""Palette menu to append in existing menu"""
|
|
|
|
# GPENCIL_MT_material_context_menu
|
|
|
|
layout = self.layout
|
2024-11-11 15:47:33 +01:00
|
|
|
# {'EDIT_GREASE_PENCIL', 'PAINT_GREASE_PENCIL','SCULPT_GREASE_PENCIL','WEIGHT_GREASE_PENCIL', 'VERTEX_GPENCIL'}
|
2021-01-10 16:47:17 +01:00
|
|
|
layout.separator()
|
|
|
|
prefs = get_addon_prefs()
|
|
|
|
|
2021-03-16 22:52:26 +01:00
|
|
|
layout.operator("gp.copy_active_to_selected_palette", text='Append Materials To Selected', icon='MATERIAL')
|
2021-12-04 13:57:32 +01:00
|
|
|
layout.operator("gp.clean_material_stack", text='Clean material Stack', icon='NODE_MATERIAL')
|
|
|
|
layout.separator()
|
|
|
|
layout.operator("wm.call_panel", text="Pop Palette Linker", icon='COLOR').name = "GPTB_PT_palettes_list_popup"
|
|
|
|
layout.operator("gp.load_blend_palette", text='Load Mats From Single Blend', icon='RESTRICT_COLOR_ON').filepath = prefs.palette_path
|
|
|
|
layout.separator()
|
2021-01-10 16:47:17 +01:00
|
|
|
layout.operator("gp.load_palette", text='Load json Palette', icon='IMPORT').filepath = prefs.palette_path
|
|
|
|
layout.operator("gp.save_palette", text='Save json Palette', icon='EXPORT').filepath = prefs.palette_path
|
2024-05-30 18:33:05 +02:00
|
|
|
layout.separator()
|
|
|
|
layout.operator("gp.move_material_to_layer", text='Move Material To Layer', icon='MATERIAL')
|
2021-01-10 16:47:17 +01:00
|
|
|
|
|
|
|
|
2021-10-28 14:33:37 +02:00
|
|
|
def expose_use_channel_color_pref(self, context):
|
|
|
|
# add in GreasePencilLayerDisplayPanel (gp dopesheet View > Display)
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = False
|
|
|
|
layout.label(text='Use Channel Colors (User preferences):')
|
|
|
|
layout.prop(context.preferences.edit, 'use_anim_channel_group_colors')
|
|
|
|
|
2021-12-04 13:57:32 +01:00
|
|
|
|
|
|
|
#--- Palette Linker Panels
|
|
|
|
|
|
|
|
def palettes_path_ui(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
scn = bpy.context.scene
|
|
|
|
pl_prop = scn.bl_palettes_props
|
|
|
|
col= layout.column()
|
|
|
|
prefs = get_addon_prefs()
|
|
|
|
## Here put the path thing (only to use a non-library)
|
|
|
|
|
|
|
|
# maybe in submenu...
|
|
|
|
row = col.row()
|
|
|
|
# expand_icon = 'TRIA_DOWN' if pl_prop.show_path else 'TRIA_RIGHT'
|
|
|
|
# row.prop(pl_prop, 'show_path', text='', icon=expand_icon, emboss=False)
|
|
|
|
row.prop(pl_prop, 'use_project_path', text='Use Project Palettes')
|
|
|
|
# row.operator("gp.palettes_reload_blends", icon="FILE_REFRESH", text="")
|
|
|
|
|
|
|
|
if pl_prop.use_project_path:
|
|
|
|
## gp toolbox addon prefs path
|
|
|
|
if not prefs.palette_path:
|
|
|
|
col.label(text='GP toolbox Palette Directory Needed', icon='INFO')
|
|
|
|
col.operator('gptb.open_addon_prefs', icon='PREFERENCES')
|
|
|
|
|
|
|
|
# if not prefs.palette_path: # or pl_prop.show_path
|
|
|
|
# col.prop(prefs, 'palette_path', text='Project Dir')
|
|
|
|
#col.label(text='(saved with preferences)')
|
|
|
|
else:
|
|
|
|
## local path
|
|
|
|
if not pl_prop.custom_dir:
|
|
|
|
col.label(text='Need to specify directory')
|
|
|
|
col.prop(pl_prop, 'custom_dir', text='Custom Dir')
|
|
|
|
# if not pl_prop.custom_dir or pl_prop.show_path:
|
|
|
|
# col.prop(pl_prop, 'custom_dir', text='Custom Dir')
|
2022-01-18 22:53:08 +01:00
|
|
|
|
|
|
|
# col.operator('gptb.palette_version_update', text='Update Palette Version') # when update is ready
|
2021-12-04 13:57:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
def palettes_lists_ui(self, context, popup=False):
|
|
|
|
layout = self.layout
|
|
|
|
scn = bpy.context.scene
|
|
|
|
pl_prop = scn.bl_palettes_props
|
|
|
|
col= layout.column()
|
|
|
|
row=col.row()
|
|
|
|
# refresh button
|
|
|
|
txt = 'Project Palettes' if pl_prop.use_project_path else 'Custom Palettes'
|
|
|
|
row.label(text=txt)
|
|
|
|
row.operator("gp.palettes_reload_blends", icon="FILE_REFRESH", text="")
|
|
|
|
|
|
|
|
col= layout.column()
|
|
|
|
row = col.row()
|
|
|
|
|
|
|
|
if popup:
|
|
|
|
blends_minimum_row = 5
|
|
|
|
objects_minimum_row = 25
|
|
|
|
else:
|
|
|
|
blends_minimum_row = 2
|
|
|
|
objects_minimum_row = 4
|
|
|
|
row.template_list("GPTB_UL_blend_list", "", pl_prop, "blends", pl_prop, "bl_idx",
|
|
|
|
rows=blends_minimum_row)
|
|
|
|
# side panel
|
|
|
|
# subcol = row.column(align=True)
|
|
|
|
# subcol.operator("gp.palettes_reload_blends", icon="FILE_REFRESH", text="")
|
|
|
|
|
|
|
|
## Show object UI list only once blend Uilist is filled ?
|
|
|
|
if not len(pl_prop.blends) or (len(pl_prop.blends) == 1 and not bool(pl_prop.blends[0].blend_path)):
|
|
|
|
col.label(text='Select blend refresh available objects')
|
|
|
|
|
|
|
|
row = col.row()
|
|
|
|
row.template_list("GPTB_UL_object_list", "", pl_prop, "objects", pl_prop, "ob_idx",
|
|
|
|
rows=objects_minimum_row)
|
|
|
|
|
|
|
|
## Show link button in the border of the UI list ?
|
|
|
|
# col.prop(pl_prop, 'import_type')
|
|
|
|
split = col.split(align=True, factor=0.4)
|
|
|
|
split.prop(pl_prop, 'import_type', text='')
|
|
|
|
|
|
|
|
split.enabled = len(pl_prop.objects) and bool(pl_prop.objects[pl_prop.ob_idx].path)
|
|
|
|
split.operator('gp.import_obj_palette', text='Palette')
|
|
|
|
|
|
|
|
# button to launch link with combined props (active only if the two items are valids)
|
|
|
|
# str(Path(self.blends) / 'Object' / self.objects
|
|
|
|
|
|
|
|
|
|
|
|
class GPTB_PT_palettes_linker_main_ui(Panel):
|
|
|
|
bl_space_type = 'TOPBAR' # dummy
|
|
|
|
bl_region_type = 'HEADER'
|
|
|
|
# bl_space_type = "VIEW_3D"
|
|
|
|
# bl_region_type = "UI"
|
|
|
|
# bl_category = "Gpencil"
|
|
|
|
bl_label = "Palettes Mat Linker"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
## link button for tests
|
|
|
|
# layout.operator('gp.import_obj_palette', text='Palette')
|
|
|
|
|
|
|
|
# Subpanel are appended to this main UI
|
|
|
|
|
|
|
|
## Or just as One fat panel
|
|
|
|
# palettes_path_ui(self, context)
|
|
|
|
# palettes_lists_ui(self, context)
|
|
|
|
|
|
|
|
class GPTB_PT_palettes_path_ui(Panel):
|
|
|
|
bl_space_type = "VIEW_3D"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
bl_label = "Palettes Source" # Source Path
|
|
|
|
# bl_parent_id = "GPTB_PT_palettes_linker_main_ui"
|
|
|
|
bl_parent_id = "GPTB_PT_color"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
palettes_path_ui(self, context)
|
|
|
|
# layout.label()
|
|
|
|
|
|
|
|
# pop-up version of object lists
|
|
|
|
class GPTB_PT_palettes_list_popup(Panel):
|
|
|
|
bl_space_type = 'TOPBAR' # dummy
|
|
|
|
bl_region_type = 'HEADER'
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
bl_label = "Palettes Lists"
|
|
|
|
bl_ui_units_x = 18
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
palettes_lists_ui(self, context, popup=True)
|
|
|
|
|
|
|
|
class GPTB_PT_palettes_list_ui(Panel):
|
|
|
|
bl_space_type = "VIEW_3D"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "Gpencil"
|
|
|
|
bl_label = "Palettes Lists"
|
|
|
|
bl_parent_id = "GPTB_PT_color"
|
|
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
|
|
|
|
def draw_header(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
# layout.label(text="My Select Panel")
|
|
|
|
layout.operator("wm.call_panel", text="", icon='COLOR').name = "GPTB_PT_palettes_list_popup"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
palettes_lists_ui(self, context, popup=False)
|
|
|
|
|
|
|
|
|
|
|
|
## bl 3+ UI
|
2021-11-25 17:00:09 +01:00
|
|
|
def asset_browser_ui(self, context):
|
|
|
|
'''Only shows in blender >= 3.0.0'''
|
|
|
|
|
|
|
|
layout = self.layout
|
|
|
|
asset_file_handle = context.asset_file_handle
|
|
|
|
if asset_file_handle is None:
|
|
|
|
# layout.label(text="No asset selected", icon='INFO')
|
|
|
|
layout.label(text='No object/material selected', icon='INFO')
|
|
|
|
return
|
|
|
|
if asset_file_handle.id_type not in ('OBJECT', 'MATERIAL'):
|
|
|
|
layout.label(text='No object/material selected', icon='INFO')
|
|
|
|
return
|
|
|
|
|
|
|
|
layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = False
|
|
|
|
|
|
|
|
asset_library_ref = context.asset_library_ref
|
|
|
|
## Path to blend
|
|
|
|
asset_lib_path = bpy.types.AssetHandle.get_full_library_path(asset_file_handle, asset_library_ref)
|
|
|
|
path_to_obj = Path(asset_lib_path) / 'Objects' / asset_file_handle.name
|
|
|
|
|
|
|
|
## respect header choice ?
|
|
|
|
## import_type in (LINK, APPEND, APPEND_REUSE)
|
|
|
|
imp_type = context.space_data.params.import_type
|
|
|
|
if imp_type == 'APPEND':
|
|
|
|
imp_txt = 'Append'
|
|
|
|
elif imp_type == 'APPEND_REUSE':
|
|
|
|
imp_txt = 'Append (Reuse)'
|
|
|
|
else:
|
|
|
|
imp_txt = 'Link'
|
|
|
|
|
|
|
|
if asset_file_handle.id_type == 'MATERIAL':
|
|
|
|
layout.label(text=f'From Mat: {asset_file_handle.name}')
|
|
|
|
if asset_file_handle.id_type == 'OBJECT':
|
|
|
|
layout.label(text=f'From Obj: {asset_file_handle.name}')
|
|
|
|
layout.label(text=f'{imp_txt} Materials To GP Object')
|
|
|
|
layout.operator('gp.palette_linker', text=f'{imp_txt} Materials To GP Object') ## ops
|
|
|
|
|
|
|
|
# layout.label(text='Link Materials to GP Object')
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-17 23:26:48 +01:00
|
|
|
# Put back pop-over UI for Grease Pencil stroke interpolation tools native pop hover panel from 2.92
|
|
|
|
class GPTB_PT_tools_grease_pencil_interpolate(Panel):
|
|
|
|
bl_space_type = 'VIEW_3D'
|
|
|
|
bl_region_type = 'HEADER'
|
|
|
|
bl_label = "Interpolate"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
if context.gpencil_data is None:
|
|
|
|
return False
|
|
|
|
|
|
|
|
gpd = context.gpencil_data
|
|
|
|
valid_mode = bool(gpd.use_stroke_edit_mode or gpd.is_stroke_paint_mode)
|
|
|
|
return bool(context.editable_gpencil_strokes) and valid_mode
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2022-01-18 22:53:08 +01:00
|
|
|
layout.use_property_split = True
|
|
|
|
# settings = context.tool_settings.gpencil_interpolate # old 2.92 global settings
|
|
|
|
## access active tool settings
|
|
|
|
# settings = context.workspace.tools[0].operator_properties('gpencil.interpolate')
|
2024-11-11 15:47:33 +01:00
|
|
|
settings = context.workspace.tools.from_space_view3d_mode('PAINT_GREASE_PENCIL').operator_properties('gpencil.interpolate')
|
2022-01-18 22:53:08 +01:00
|
|
|
|
|
|
|
## custom curve access (still in gp interpolate tools)
|
|
|
|
interpolate_settings = context.tool_settings.gpencil_interpolate
|
|
|
|
# ex : interpolate_settings.interpolation_curve.curves[0].points[1].location
|
|
|
|
|
2021-12-17 23:26:48 +01:00
|
|
|
|
|
|
|
col = layout.column(align=True)
|
|
|
|
col.label(text="Interpolate Strokes")
|
|
|
|
col.operator("gpencil.interpolate", text="Interpolate")
|
|
|
|
col.operator("gpencil.interpolate_sequence", text="Sequence")
|
|
|
|
col.operator("gpencil.interpolate_reverse", text="Remove Breakdowns")
|
|
|
|
|
|
|
|
col = layout.column(align=True)
|
|
|
|
col.label(text="Options:")
|
2022-01-18 22:53:08 +01:00
|
|
|
# col.prop(settings, "interpolate_all_layers") # now the enum "layers"
|
2021-12-17 23:26:48 +01:00
|
|
|
gpd = context.gpencil_data
|
|
|
|
if gpd.use_stroke_edit_mode:
|
|
|
|
col.prop(settings, "interpolate_selected_only")
|
2022-01-18 22:53:08 +01:00
|
|
|
col.prop(settings, "layers")
|
|
|
|
col.prop(settings, "flip")
|
|
|
|
col.prop(settings, "smooth_factor")
|
|
|
|
col.prop(settings, "smooth_steps")
|
2021-12-17 23:26:48 +01:00
|
|
|
|
2022-01-18 22:53:08 +01:00
|
|
|
|
|
|
|
'''## Sequence Options
|
|
|
|
seq_settings = context.window_manager.operators.get('GPENCIL_OT_interpolate_sequence')
|
2021-12-17 23:26:48 +01:00
|
|
|
col = layout.column(align=True)
|
|
|
|
col.label(text="Sequence Options:")
|
2022-01-18 22:53:08 +01:00
|
|
|
if not seq_settings:
|
|
|
|
# col.label(text='Launch Interpolate Sequence Once')
|
|
|
|
# col.operator('gpencil.interpolate_sequence',text='Interpolate Sequence Once')
|
|
|
|
col.label(text='Interpolate sequence', icon='INFO')
|
|
|
|
col.label(text='must be launched')
|
|
|
|
col.label(text="once per session")
|
|
|
|
col.label(text="to expose it's properties")
|
|
|
|
return
|
|
|
|
|
|
|
|
col.prop(seq_settings, "step")
|
|
|
|
col.prop(seq_settings, "layers")
|
|
|
|
col.prop(seq_settings, "interpolate_selected_only")
|
|
|
|
col.prop(seq_settings, "flip")
|
|
|
|
col.prop(seq_settings, "smooth_factor")
|
|
|
|
col.prop(seq_settings, "smooth_steps")
|
|
|
|
col.prop(seq_settings, "type")
|
|
|
|
if seq_settings.type == 'CUSTOM':
|
2021-12-17 23:26:48 +01:00
|
|
|
# TODO: Options for loading/saving curve presets?
|
2022-01-18 22:53:08 +01:00
|
|
|
col.template_curve_mapping(interpolate_settings, "interpolation_curve", brush=True,
|
2021-12-17 23:26:48 +01:00
|
|
|
use_negative_slope=True)
|
2022-01-18 22:53:08 +01:00
|
|
|
elif seq_settings.type != 'LINEAR':
|
|
|
|
col.prop(seq_settings, "easing")
|
2021-12-17 23:26:48 +01:00
|
|
|
|
2022-01-18 22:53:08 +01:00
|
|
|
if seq_settings.type == 'BACK':
|
|
|
|
layout.prop(seq_settings, "back")
|
|
|
|
elif seq_settings.type == 'ELASTIC':
|
2021-12-17 23:26:48 +01:00
|
|
|
sub = layout.column(align=True)
|
2022-01-18 22:53:08 +01:00
|
|
|
sub.prop(seq_settings, "amplitude")
|
|
|
|
sub.prop(seq_settings, "period")
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
## recreate property group from operator options
|
|
|
|
# inspect context.window_manager.operators['GPENCIL_OT_interpolate_sequence']
|
|
|
|
# separate options from single interpolation and sequence interpolation
|
|
|
|
|
|
|
|
# class GPTB_PG_interpolate_sequence_prop(bpy.types.PropertyGroup):
|
|
|
|
# interpolate_selected_only : BoolProperty(
|
|
|
|
# name="Selected Only",
|
|
|
|
# description="",
|
|
|
|
# default=True,
|
|
|
|
# options={'HIDDEN'})
|
2021-12-17 23:26:48 +01:00
|
|
|
|
|
|
|
def interpolate_header_ui(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
obj = context.active_object
|
|
|
|
|
2024-11-11 15:35:39 +01:00
|
|
|
if obj and obj.type == 'GREASEPENCIL' and context.gpencil_data:
|
2021-12-17 23:26:48 +01:00
|
|
|
gpd = context.gpencil_data
|
|
|
|
else:
|
|
|
|
return
|
|
|
|
|
|
|
|
if gpd.use_stroke_edit_mode or gpd.is_stroke_paint_mode:
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.popover(
|
|
|
|
panel="GPTB_PT_tools_grease_pencil_interpolate",
|
|
|
|
text="Interpolate",
|
|
|
|
)
|
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
classes = (
|
|
|
|
GPTB_PT_sidebar_panel,
|
2021-10-20 13:56:01 +02:00
|
|
|
GPTB_PT_checker,
|
2021-01-10 16:47:17 +01:00
|
|
|
GPTB_PT_anim_manager,
|
2021-10-20 13:56:01 +02:00
|
|
|
GPTB_PT_color,
|
2021-01-10 16:47:17 +01:00
|
|
|
GPTB_PT_tint_layers,
|
2021-10-20 13:56:01 +02:00
|
|
|
GPTB_PT_toolbox_playblast,
|
2021-12-17 23:26:48 +01:00
|
|
|
# GPTB_PT_tools_grease_pencil_interpolate, # WIP
|
2021-12-04 13:57:32 +01:00
|
|
|
|
|
|
|
# palettes linker
|
|
|
|
GPTB_PT_palettes_linker_main_ui, # main panel
|
|
|
|
GPTB_PT_palettes_list_popup, # popup (dummy region)
|
|
|
|
GPTB_PT_palettes_path_ui, # subpanels
|
|
|
|
GPTB_PT_palettes_list_ui, # subpanels
|
2021-10-20 13:56:01 +02:00
|
|
|
# GPTB_PT_extra,
|
2021-12-17 23:26:48 +01:00
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
def register():
|
|
|
|
for cls in classes:
|
|
|
|
bpy.utils.register_class(cls)
|
|
|
|
bpy.types.GPENCIL_MT_material_context_menu.append(palette_manager_menu)
|
2024-11-11 17:27:57 +01:00
|
|
|
bpy.types.DOPESHEET_PT_grease_pencil_mode.append(expose_use_channel_color_pref)
|
|
|
|
# bpy.types.GPENCIL_MT_material_context_menu.append(palette_manager_menu)
|
|
|
|
# bpy.types.DOPESHEET_PT_gpencil_layer_display.append(expose_use_channel_color_pref)
|
|
|
|
|
2021-12-17 23:26:48 +01:00
|
|
|
# bpy.types.VIEW3D_HT_header.append(interpolate_header_ui) # WIP
|
2021-01-10 16:47:17 +01:00
|
|
|
|
2021-11-25 17:00:09 +01:00
|
|
|
# if bpy.app.version >= (3,0,0):
|
|
|
|
# bpy.types.ASSETBROWSER_PT_metadata.append(asset_browser_ui)
|
|
|
|
|
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
def unregister():
|
2021-12-17 23:26:48 +01:00
|
|
|
# bpy.types.VIEW3D_HT_header.remove(interpolate_header_ui) # WIP
|
2024-11-11 17:27:57 +01:00
|
|
|
|
|
|
|
bpy.types.DOPESHEET_PT_grease_pencil_mode.remove(expose_use_channel_color_pref)
|
2021-01-10 16:47:17 +01:00
|
|
|
bpy.types.GPENCIL_MT_material_context_menu.remove(palette_manager_menu)
|
2024-11-11 17:27:57 +01:00
|
|
|
# bpy.types.DOPESHEET_PT_gpencil_layer_display.remove(expose_use_channel_color_pref)
|
|
|
|
# bpy.types.GPENCIL_MT_material_context_menu.remove(palette_manager_menu)
|
|
|
|
|
|
|
|
|
2021-11-25 17:00:09 +01:00
|
|
|
# if bpy.app.version >= (3,0,0):
|
|
|
|
# bpy.types.ASSETBROWSER_PT_metadata.remove(asset_browser_ui)
|
|
|
|
|
2021-01-10 16:47:17 +01:00
|
|
|
for cls in reversed(classes):
|
|
|
|
bpy.utils.unregister_class(cls)
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
## direct panel def append (no submenu with arrow)
|
|
|
|
## need to use append and remove in register/unregister
|
|
|
|
# bpy.types.DATA_PT_gpencil_layers.append(UI_tools.GPdata_toolbox_panel)
|
|
|
|
# bpy.types.DATA_PT_gpencil_layers.remove(UI_tools.GPdata_toolbox_panel)
|
|
|
|
|
|
|
|
def GPdata_toolbox_panel(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
settings = context.scene.gptoolprops
|
|
|
|
|
|
|
|
col = layout.column(align = True)
|
|
|
|
col.prop(settings, 'autotint_offset')
|
|
|
|
col.operator("gp.auto_tint_gp_layers", icon = "COLOR").reset = False
|
|
|
|
col.operator("gp.auto_tint_gp_layers", text = "Reset tint", icon = "COLOR").reset = True
|
2021-12-04 13:57:32 +01:00
|
|
|
"""
|