[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49366] branches/asset-browser: == assetbrowser ==
Andrea Weikert
elubie at gmx.net
Sun Jul 29 21:20:46 CEST 2012
Revision: 49366
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49366
Author: elubie
Date: 2012-07-29 19:20:45 +0000 (Sun, 29 Jul 2012)
Log Message:
-----------
== assetbrowser ==
* fix for column flow layout: height was only correctly calculated for first column
* simplified drawing code, for now draw the whole list in python, not only the items in the list
NOTE:
still not sure if the layout engine is fit to support the kind of layout needed for asset manager and also the selection is not solved yet.
Modified Paths:
--------------
branches/asset-browser/release/scripts/startup/bl_ui/space_asset.py
branches/asset-browser/source/blender/editors/interface/interface_layout.c
branches/asset-browser/source/blender/editors/screen/area.c
branches/asset-browser/source/blender/makesdna/DNA_space_types.h
Modified: branches/asset-browser/release/scripts/startup/bl_ui/space_asset.py
===================================================================
--- branches/asset-browser/release/scripts/startup/bl_ui/space_asset.py 2012-07-29 19:11:00 UTC (rev 49365)
+++ branches/asset-browser/release/scripts/startup/bl_ui/space_asset.py 2012-07-29 19:20:45 UTC (rev 49366)
@@ -56,7 +56,14 @@
return True
def draw(self, context):
- pass
+ layout = self.layout
+ col_flow = layout.column_flow()
+
+ for ac in context.blend_data.asset_collections:
+ for af in ac.asset_files:
+ for asset in af.assets:
+ col_flow.label(text=asset.name, icon=self.icon_for_group(asset.group))
+
def icon_for_group(self, group):
icon = 'NONE'
@@ -87,11 +94,7 @@
return icon
def draw_item(self, context, entry, group):
- print(entry)
- layout = self.layout
- sasset = context.space_data
- col = layout.column(align=True)
- col.label(text=entry, icon=self.icon_for_group(group))
+ pass
class AssetCollectionsPanel(bpy.types.Panel):
bl_space_type = "ASSET_BROWSER"
Modified: branches/asset-browser/source/blender/editors/interface/interface_layout.c
===================================================================
--- branches/asset-browser/source/blender/editors/interface/interface_layout.c 2012-07-29 19:11:00 UTC (rev 49365)
+++ branches/asset-browser/source/blender/editors/interface/interface_layout.c 2012-07-29 19:20:45 UTC (rev 49366)
@@ -1961,6 +1961,7 @@
maxw = 0;
y = 0;
col++;
+ emh = 0; /* needs to be reset when next column starts to correctly calculate height of 2nd and next columns */
}
}
@@ -2011,6 +2012,7 @@
x += itemw + style->columnspace;
y = litem->y;
col++;
+ emy = 0; /* needs to be reset when next column starts to correctly calculate height of 2nd and next columns */
}
}
Modified: branches/asset-browser/source/blender/editors/screen/area.c
===================================================================
--- branches/asset-browser/source/blender/editors/screen/area.c 2012-07-29 19:11:00 UTC (rev 49365)
+++ branches/asset-browser/source/blender/editors/screen/area.c 2012-07-29 19:20:45 UTC (rev 49366)
@@ -1760,24 +1760,13 @@
bAssetFile *af;
int item=0;
uiLayout *colL;
- uiLayout *rowL;
- uiLayout *mainL;
block= uiBeginBlock(C, ar, ilt->idname, UI_EMBOSS);
itemList= uiBeginItemList(sa, ar, block, ilt, NULL);
- layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, ar->v2d.tot.ymax- ar->v2d.tot.ymin - 4, 1, style);
- mainL= uiLayoutRow(layout, 0);
- colL = uiLayoutColumn(mainL, 0);
- item=0;
- for (af = ac->asset_files.first; af; af= af->next) {
- for (asset= af->assets.first; asset; asset= asset->next, item++) {
- if(ilt->draw_item) {
- rowL = uiLayoutRow(colL, 0);
- itemList->type= ilt;
- itemList->layout= rowL;
- ilt->draw_item(C, asset->name, asset->group, itemList);
- }
- }
- }
+ layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, headery, ar->v2d.tot.xmax - ar->v2d.tot.xmin, UI_UNIT_Y, style);
+ itemList->type= ilt;
+ itemList->layout= layout;
+ ilt->draw(C, itemList);
+
uiBlockLayoutResolve(block, &xco, &yco);
/* for view2d */
Modified: branches/asset-browser/source/blender/makesdna/DNA_space_types.h
===================================================================
--- branches/asset-browser/source/blender/makesdna/DNA_space_types.h 2012-07-29 19:11:00 UTC (rev 49365)
+++ branches/asset-browser/source/blender/makesdna/DNA_space_types.h 2012-07-29 19:20:45 UTC (rev 49366)
@@ -1119,8 +1119,7 @@
SPACE_CONSOLE = 18,
SPACE_USERPREF = 19,
SPACE_CLIP = 20,
-
- SPACE_ASSET,
+ SPACE_ASSET = 21,
SPACEICONMAX = SPACE_ASSET
} eSpace_Type;
More information about the Bf-blender-cvs
mailing list