fix: reset draw cam rotation

1.7.8

- fix: reset rotation in draw cam mode keep view in the same place (counter camera rotation)
- code: initial enhancement for palette linking
This commit is contained in:
Pullusb
2021-11-25 17:00:09 +01:00
parent 9389faed22
commit 78b70c8fca
7 changed files with 506 additions and 9 deletions
+52 -1
View File
@@ -308,8 +308,10 @@ class GPTB_PT_color(bpy.types.Panel):
def draw(self, context):
layout = self.layout
col = layout.column()
## Create empty frame on layer
layout.operator('gp.create_empty_frames', icon='DECORATE_KEYFRAME')
col.operator('gp.palette_linker', text=f'Link Materials Palette TO Object', icon='COLOR') ## ops
col.operator('gp.create_empty_frames', icon='DECORATE_KEYFRAME')
""" # unused : added in Animation Manager
class GPTB_PT_extra(bpy.types.Panel):
@@ -378,6 +380,48 @@ def expose_use_channel_color_pref(self, context):
layout.label(text='Use Channel Colors (User preferences):')
layout.prop(context.preferences.edit, 'use_anim_channel_group_colors')
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')
classes = (
GPTB_PT_sidebar_panel,
GPTB_PT_checker,
@@ -394,9 +438,16 @@ def register():
bpy.types.GPENCIL_MT_material_context_menu.append(palette_manager_menu)
bpy.types.DOPESHEET_PT_gpencil_layer_display.append(expose_use_channel_color_pref)
# if bpy.app.version >= (3,0,0):
# bpy.types.ASSETBROWSER_PT_metadata.append(asset_browser_ui)
def unregister():
bpy.types.DOPESHEET_PT_gpencil_layer_display.remove(expose_use_channel_color_pref)
bpy.types.GPENCIL_MT_material_context_menu.remove(palette_manager_menu)
# if bpy.app.version >= (3,0,0):
# bpy.types.ASSETBROWSER_PT_metadata.remove(asset_browser_ui)
for cls in reversed(classes):
bpy.utils.unregister_class(cls)