diff --git a/amaranth/__init__.py b/amaranth/__init__.py index bd3a49d2f52ca7f8aca50ce9cdbc2044f442ebea..07efa61908a7c34c0e1d3838620b6940be037332 100644 --- a/amaranth/__init__.py +++ b/amaranth/__init__.py @@ -87,8 +87,8 @@ from amaranth.misc import ( bl_info = { "name": "Amaranth Toolset", "author": "Pablo Vazquez, Bassam Kurdali, Sergey Sharybin, Lukas Tönne, Cesar Saez, CansecoGPC", - "version": (1, 0, 7), - "blender": (2, 80, 0), + "version": (1, 0, 8), + "blender": (2, 81, 0), "location": "Everywhere!", "description": "A collection of tools and settings to improve productivity", "warning": "", diff --git a/amaranth/scene/current_blend.py b/amaranth/scene/current_blend.py index 6b984d1adaf1b131992eb349bd7efb9b27a9addd..e3f4ca9106dffefef1378d29bb7befc60e65a3f0 100644 --- a/amaranth/scene/current_blend.py +++ b/amaranth/scene/current_blend.py @@ -21,6 +21,12 @@ shows up if the file is saved. import bpy +# From space_filebrowser.py +def panel_poll_is_upper_region(region): + # The upper region is left-aligned, the lower is split into it then. + # Note that after "Flip Regions" it's right-aligned. + return region.alignment in {'LEFT', 'RIGHT'} + class AMTH_FILE_OT_directory_current_blend(bpy.types.Operator): @@ -33,19 +39,42 @@ class AMTH_FILE_OT_directory_current_blend(bpy.types.Operator): return {"FINISHED"} -def button_directory_current_blend(self, context): - if bpy.data.filepath: - self.layout.operator( - AMTH_FILE_OT_directory_current_blend.bl_idname, - text="Current Blend's Folder", - icon="APPEND_BLEND") +class FILEBROWSER_PT_amaranth(bpy.types.Panel): + bl_space_type = 'FILE_BROWSER' + bl_region_type = 'TOOLS' + bl_category = "Bookmarks" + bl_label = "Amaranth" + bl_options = {'HIDE_HEADER'} + @classmethod + def poll(cls, context): + return panel_poll_is_upper_region(context.region) -def register(): - bpy.utils.register_class(AMTH_FILE_OT_directory_current_blend) - bpy.types.FILEBROWSER_HT_header.append(button_directory_current_blend) + def draw(self, context): + layout = self.layout + layout.scale_x = 1.3 + layout.scale_y = 1.3 + + if bpy.data.filepath: + row = layout.row() + flow = row.grid_flow(row_major=False, columns=0, even_columns=False, even_rows=False, align=True) + + subrow = flow.row() + subsubrow = subrow.row(align=True) + subsubrow.operator( + AMTH_FILE_OT_directory_current_blend.bl_idname, + icon="DESKTOP") +classes = ( + AMTH_FILE_OT_directory_current_blend, + FILEBROWSER_PT_amaranth +) + +def register(): + for cls in classes: + bpy.utils.register_class(cls) + def unregister(): - bpy.utils.unregister_class(AMTH_FILE_OT_directory_current_blend) - bpy.types.FILEBROWSER_HT_header.remove(button_directory_current_blend) + for cls in classes: + bpy.utils.unregister_class(cls)