85 lines
2.2 KiB
Python
85 lines
2.2 KiB
Python
|
|
import bpy
|
|
|
|
|
|
class CSHELF_MT_text_editor(bpy.types.Menu):
|
|
bl_label = "Shelves"
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
layout.operator("customshelf.add_script", text='Add Script', icon="FILE_NEW")
|
|
|
|
|
|
|
|
|
|
"""
|
|
class CustomShelfPanel(bpy.types.Panel):
|
|
bl_label = "Custom Shelf"
|
|
bl_category = "SHELF"
|
|
bl_space_type = 'VIEW_3D'
|
|
bl_region_type = 'TOOLS'
|
|
# bl_context = "posemode"
|
|
|
|
|
|
def draw_header(self, context):
|
|
view = context.space_data
|
|
layout = self.layout
|
|
row=layout.row(align=True)
|
|
row.operator("customshelf.refresh", \
|
|
text='',emboss=False,icon= "FILE_REFRESH")
|
|
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
window = context.window
|
|
scene = context.scene
|
|
rd = scene.render
|
|
|
|
shelves = bpy.context.scene.CustomShelf.folders
|
|
|
|
for key,value in sorted(shelves.items()) :
|
|
if key.startswith(('_','-')) :
|
|
continue
|
|
|
|
box = layout.box()
|
|
#box.alignment='EXPAND'
|
|
box_col = box.column(align =False)
|
|
|
|
if value['expand'] == True :
|
|
expandIcon = 'TRIA_DOWN'
|
|
else :
|
|
expandIcon = 'TRIA_RIGHT'
|
|
|
|
row = box_col.row(align = True)
|
|
|
|
row.operator("customshelf.expand",text=key.upper(), icon = expandIcon,emboss=False).folder = key
|
|
|
|
#subrow = row.row(align = True)
|
|
#subrow.alignment = 'CENTER'
|
|
#subrow.label(key.upper())
|
|
|
|
#col.separator()
|
|
if value['expand'] == True :
|
|
|
|
#text =' '.join([' ' for a in range(0,len(key))])
|
|
#row.prop(context.scene.CustomShelf,key,emboss = False,text=' ')
|
|
|
|
|
|
for script,settings in sorted(value['scripts'].items()) :
|
|
if script.startswith(('_','-')) :
|
|
continue
|
|
#print(s[1])
|
|
func = box_col.operator("customshelf.run_function", \
|
|
text=script,icon = settings['icon'])
|
|
func.path = settings['path']
|
|
|
|
|
|
#box_col.separator()
|
|
|
|
|
|
#layout.separator()
|
|
#col.separator()
|
|
|
|
"""
|