[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45549] branches/asset-browser: Asset Browser / User Interface:
Thomas Dinges
blender at dingto.org
Wed Apr 11 22:58:56 CEST 2012
Revision: 45549
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45549
Author: dingto
Date: 2012-04-11 20:58:56 +0000 (Wed, 11 Apr 2012)
Log Message:
-----------
Asset Browser / User Interface:
* Some code cleanup, removed non used code.
* Made UI layouts more compact and a bit better looking.
* Add missing tooltips.
Modified Paths:
--------------
branches/asset-browser/release/scripts/startup/bl_operators/asset_collection.py
branches/asset-browser/release/scripts/startup/bl_ui/space_asset.py
branches/asset-browser/source/blender/editors/space_asset/space_asset.c
Modified: branches/asset-browser/release/scripts/startup/bl_operators/asset_collection.py
===================================================================
--- branches/asset-browser/release/scripts/startup/bl_operators/asset_collection.py 2012-04-11 20:46:50 UTC (rev 45548)
+++ branches/asset-browser/release/scripts/startup/bl_operators/asset_collection.py 2012-04-11 20:58:56 UTC (rev 45549)
@@ -8,7 +8,7 @@
class AddAssetCollectionOperator(Operator):
- '''Tooltip'''
+ '''Add a new asset collection'''
bl_idname = "asset_collection.add"
bl_label = "Add Asset Collection"
@@ -21,7 +21,7 @@
return {'FINISHED'}
class RemoveAssetCollectionOperator(Operator):
- '''Tooltip'''
+ '''Remove selected asset colletion'''
bl_idname = "asset_collection.remove"
bl_label = "Remove Asset Collection"
Modified: branches/asset-browser/release/scripts/startup/bl_ui/space_asset.py
===================================================================
--- branches/asset-browser/release/scripts/startup/bl_ui/space_asset.py 2012-04-11 20:46:50 UTC (rev 45548)
+++ branches/asset-browser/release/scripts/startup/bl_ui/space_asset.py 2012-04-11 20:58:56 UTC (rev 45549)
@@ -26,6 +26,7 @@
def draw(self, context):
layout = self.layout
+
print("draw space asset")
window = context.window
scene = context.scene
@@ -35,13 +36,21 @@
row.template_header()
layout.separator()
+
+
+class NODE_MT_view(Menu):
+ bl_label = "View"
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("asset.properties", icon='MENU_PANEL')
+
class AssetItemList(bpy.types.ItemList):
- bl_label = "Asset Item List"
- bl_idname = "ASSET_IL_assets"
bl_space_type = "ASSET_BROWSER"
bl_region_type = "WINDOW"
-
+ bl_label = "Asset Item List"
+
@classmethod
def poll(cls, context):
return True
@@ -57,33 +66,25 @@
col.label(text=labeltext)
class AssetCollectionsPanel(bpy.types.Panel):
+ bl_space_type = "ASSET_BROWSER"
+ bl_region_type = "UI"
bl_label = "Asset Collections"
- bl_idname = "ASSET_PT_collections"
- bl_space_type = "ASSET_BROWSER"
- bl_region_type = "TOOLS"
- bl_context = "object"
- @classmethod
- def poll(cls, context):
- return True
-
def draw(self, context):
layout = self.layout
sasset = context.space_data
- col = layout.column(align=True)
- col.label(text="Asset Collections:")
- col.template_list(bpy.data, 'asset_collections', sasset, 'active_collection', rows=5)
- sub = col.row()
- sub.operator("asset_collection.add")
- sub.operator("asset_collection.remove")
+ row = layout.row()
+ row.template_list(bpy.data, 'asset_collections', sasset, 'active_collection', rows=5)
+
+ col = row.column(align=True)
+ col.operator("asset_collection.add", icon='ZOOMIN', text="")
+ col.operator("asset_collection.remove", icon='ZOOMOUT', text="")
class AssetFilesPanel(bpy.types.Panel):
+ bl_space_type = "ASSET_BROWSER"
+ bl_region_type = "UI"
bl_label = "Asset Files"
- bl_idname = "ASSET_PT_files"
- bl_space_type = "ASSET_BROWSER"
- bl_region_type = "TOOLS"
- bl_context = "object"
@classmethod
def poll(cls, context):
@@ -93,22 +94,21 @@
def draw(self, context):
layout = self.layout
+
sasset = context.space_data
ac = bpy.data.asset_collections[sasset.active_collection]
- col = layout.column(align=True)
- col.label(text="Asset Files:")
- col.template_list(ac, 'asset_files', ac, 'active_file', rows=5)
- sub = col.row()
- sub.operator("asset_collection.add_file")
- sub.operator("asset_collection.remove_file")
+ row = layout.row()
+ row.template_list(ac, 'asset_files', ac, 'active_file', rows=5)
+
+ col = row.column(align=True)
+ col.operator("asset_collection.add_file", icon='ZOOMIN', text="")
+ col.operator("asset_collection.remove_file", icon='ZOOMOUT', text="")
class AssetDirsPanel(bpy.types.Panel):
- bl_label = "Asset Dirs"
- bl_idname = "ASSET_PT_dirs"
bl_space_type = "ASSET_BROWSER"
- bl_region_type = "TOOLS"
- bl_context = "object"
+ bl_region_type = "UI"
+ bl_label = "Asset Directories"
@classmethod
def poll(cls, context):
@@ -118,16 +118,17 @@
def draw(self, context):
layout = self.layout
+
sasset = context.space_data
ac = bpy.data.asset_collections[sasset.active_collection]
- col = layout.column(align=True)
- col.label(text="Asset Dirs:")
- col.template_list(ac, 'asset_dirs', ac, 'active_dir', rows=5)
- sub = col.row()
- sub.operator("asset_collection.add_directory")
- sub.operator("asset_collection.remove_directory")
+ row = layout.row()
+ row.template_list(ac, 'asset_dirs', ac, 'active_dir', rows=5)
+ col = row.column(align=True)
+ col.operator("asset_collection.add_directory", icon='ZOOMIN', text="")
+ col.operator("asset_collection.remove_directory", icon='ZOOMOUT', text="")
+
if __name__ == "__main__": # only for live edit.
print("registered space library")
bpy.utils.register_module(__name__)
Modified: branches/asset-browser/source/blender/editors/space_asset/space_asset.c
===================================================================
--- branches/asset-browser/source/blender/editors/space_asset/space_asset.c 2012-04-11 20:46:50 UTC (rev 45548)
+++ branches/asset-browser/source/blender/editors/space_asset/space_asset.c 2012-04-11 20:58:56 UTC (rev 45549)
@@ -68,9 +68,9 @@
ar->alignment= RGN_ALIGN_BOTTOM;
/* tools region */
- ar= MEM_callocN(sizeof(ARegion), "tools area for asset browser");
+ ar= MEM_callocN(sizeof(ARegion), "ui area for asset browser");
BLI_addtail(&sasset->regionbase, ar);
- ar->regiontype= RGN_TYPE_TOOLS;
+ ar->regiontype= RGN_TYPE_UI;
ar->alignment= RGN_ALIGN_LEFT;
@@ -184,20 +184,20 @@
{
}
-/* --- tools area --- */
+/* --- UI area --- */
/* add handlers, stuff you only do once or on area/region changes */
-static void assetbrowser_tools_region_init(wmWindowManager *wm, ARegion *ar)
+static void assetbrowser_ui_region_init(wmWindowManager *wm, ARegion *ar)
{
ED_region_panels_init(wm, ar);
}
-static void assetbrowser_tools_region_draw(const bContext *C, ARegion *ar)
+static void assetbrowser_ui_region_draw(const bContext *C, ARegion *ar)
{
ED_region_panels(C, ar, 1, NULL, -1);
}
-static void assetbrowser_tools_region_listener(ARegion *ar, wmNotifier *wmn)
+static void assetbrowser_ui_region_listener(ARegion *ar, wmNotifier *wmn)
{
}
@@ -254,12 +254,12 @@
/* regions: tools (asset collections) */
art= MEM_callocN(sizeof(ARegionType), "spacetype asset region");
- art->regionid = RGN_TYPE_TOOLS;
+ art->regionid = RGN_TYPE_UI;
art->prefsizex= 240;
art->keymapflag= ED_KEYMAP_UI;
- art->listener= assetbrowser_tools_region_listener;
- art->init= assetbrowser_tools_region_init;
- art->draw= assetbrowser_tools_region_draw;
+ art->listener= assetbrowser_ui_region_listener;
+ art->init= assetbrowser_ui_region_init;
+ art->draw= assetbrowser_ui_region_draw;
BLI_addhead(&st->regiontypes, art);
// file_panels_register(art);
More information about the Bf-blender-cvs
mailing list