2022-12-24 15:30:32 +01:00
|
|
|
|
|
|
|
import bpy
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
from bpy.types import (
|
|
|
|
Context,
|
|
|
|
Header,
|
|
|
|
Menu,
|
|
|
|
Panel,
|
|
|
|
UIList,
|
|
|
|
WindowManager,
|
|
|
|
WorkSpace,
|
|
|
|
)
|
|
|
|
|
|
|
|
from bpy_extras import asset_utils
|
|
|
|
from asset_library.common.bl_utils import get_object_libraries, get_addon_prefs
|
2022-12-30 23:36:09 +01:00
|
|
|
from asset_library.common.functions import get_active_library
|
2022-12-24 15:30:32 +01:00
|
|
|
|
|
|
|
|
2022-12-30 23:36:09 +01:00
|
|
|
def draw_context_menu(layout):
|
2022-12-24 15:30:32 +01:00
|
|
|
#asset = context.active_file
|
2022-12-30 23:36:09 +01:00
|
|
|
layout.operator_context = "INVOKE_DEFAULT"
|
|
|
|
lib = get_active_library()
|
|
|
|
filepath = lib.adapter.get_active_asset_path()
|
2022-12-24 15:30:32 +01:00
|
|
|
|
|
|
|
layout.operator("assetlib.open_blend_file", text="Open Blend File")#.filepath = asset.asset_data['filepath']
|
2022-12-30 23:36:09 +01:00
|
|
|
op = layout.operator("wm.link", text="Link")
|
|
|
|
op.filepath = str(filepath)
|
|
|
|
|
|
|
|
op = layout.operator("wm.append", text="Append")
|
|
|
|
op.filepath = str(filepath)
|
2022-12-24 15:30:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
def draw_header(layout):
|
|
|
|
'''Draw the header of the Asset Browser Window'''
|
|
|
|
|
|
|
|
layout.separator()
|
|
|
|
#layout.operator("actionlib.store_anim_pose", text='Add Action', icon='FILE_NEW')
|