Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4635)

Issue 6854125: Rewrite of list template system (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by b.mont29
Modified:
10 years, 11 months ago
Reviewers:
mont29, ideasman42
Base URL:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Visibility:
Public.

Description

This patch frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one). It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.), which now makes lists completely independent from Panels! This UIList has a draw_item callback which allows to customize items' drawing from python, which all addons can now use. To make all this work, other changes were also necessary: * Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox. * DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not. * UILayout class has now four new functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon. Note: Is UILayout the best place for these funcs??? Probably not, but where then? WindowManager? Or even Context itself? * UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews). Note: not sure whether we should add that one to all UILayout's prop funcs?

Patch Set 1 #

Total comments: 7

Patch Set 2 : This commit refactors how template_list works. It introduces a new (py-extendable and registrable) #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+979 lines, -457 lines) Patch
release/scripts/modules/bpy_types.py View 1 1 chunk +4 lines, -0 lines 0 comments Download
release/scripts/startup/bl_ui/__init__.py View 1 1 chunk +6 lines, -0 lines 0 comments Download
release/scripts/startup/bl_ui/properties_data_armature.py View 1 2 chunks +2 lines, -2 lines 0 comments Download
release/scripts/startup/bl_ui/properties_data_mesh.py View 1 6 chunks +57 lines, -5 lines 2 comments Download
release/scripts/startup/bl_ui/properties_mask_common.py View 1 2 chunks +20 lines, -3 lines 1 comment Download
release/scripts/startup/bl_ui/properties_material.py View 1 3 chunks +22 lines, -2 lines 0 comments Download
release/scripts/startup/bl_ui/properties_particle.py View 1 5 chunks +5 lines, -5 lines 0 comments Download
release/scripts/startup/bl_ui/properties_physics_common.py View 1 1 chunk +1 line, -1 line 0 comments Download
release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py View 1 2 chunks +25 lines, -2 lines 0 comments Download
release/scripts/startup/bl_ui/properties_render.py View 1 3 chunks +20 lines, -2 lines 0 comments Download
release/scripts/startup/bl_ui/properties_scene.py View 1 3 chunks +16 lines, -3 lines 0 comments Download
release/scripts/startup/bl_ui/properties_texture.py View 1 3 chunks +19 lines, -2 lines 0 comments Download
release/scripts/startup/bl_ui/space_clip.py View 1 3 chunks +15 lines, -4 lines 0 comments Download
release/scripts/startup/bl_ui/space_view3d_toolbar.py View 1 2 chunks +4 lines, -2 lines 0 comments Download
source/blender/blenkernel/BKE_screen.h View 1 2 chunks +18 lines, -0 lines 0 comments Download
source/blender/blenloader/intern/readfile.c View 1 2 chunks +8 lines, -1 line 0 comments Download
source/blender/blenloader/intern/writefile.c View 1 2 chunks +4 lines, -0 lines 0 comments Download
source/blender/editors/include/UI_interface.h View 1 3 chunks +5 lines, -2 lines 0 comments Download
source/blender/editors/include/UI_interface_icons.h View 1 2 chunks +3 lines, -0 lines 0 comments Download
source/blender/editors/interface/interface_handlers.c View 1 2 chunks +45 lines, -42 lines 0 comments Download
source/blender/editors/interface/interface_icons.c View 1 2 chunks +39 lines, -0 lines 0 comments Download
source/blender/editors/interface/interface_intern.h View 1 1 chunk +3 lines, -0 lines 0 comments Download
source/blender/editors/interface/interface_layout.c View 1 1 chunk +4 lines, -1 line 0 comments Download
source/blender/editors/interface/interface_templates.c View 1 5 chunks +173 lines, -343 lines 2 comments Download
source/blender/editors/space_node/drawnode.c View 1 1 chunk +2 lines, -2 lines 0 comments Download
source/blender/makesdna/DNA_screen_types.h View 1 3 chunks +26 lines, -4 lines 0 comments Download
source/blender/makesrna/RNA_access.h View 1 1 chunk +1 line, -1 line 0 comments Download
source/blender/makesrna/RNA_enum_types.h View 1 1 chunk +3 lines, -0 lines 0 comments Download
source/blender/makesrna/intern/rna_dynamicpaint.c View 1 7 chunks +22 lines, -0 lines 0 comments Download
source/blender/makesrna/intern/rna_ui.c View 1 5 chunks +163 lines, -0 lines 0 comments Download
source/blender/makesrna/intern/rna_ui_api.c View 1 7 chunks +172 lines, -24 lines 4 comments Download
source/blender/python/intern/bpy_rna.c View 1 1 chunk +3 lines, -2 lines 0 comments Download
source/blender/windowmanager/WM_api.h View 1 1 chunk +7 lines, -0 lines 0 comments Download
source/blender/windowmanager/intern/wm.c View 1 1 chunk +57 lines, -1 line 0 comments Download
source/blender/windowmanager/intern/wm_init_exit.c View 1 2 chunks +2 lines, -0 lines 0 comments Download
source/blenderplayer/bad_level_call_stubs/stubs.c View 1 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 7
mont29
11 years, 2 months ago (2012-11-30 16:23:35 UTC) #1
ideasman42
Quick review... - Calling into python per item seems a bit heavy, would try avoid. ...
11 years, 2 months ago (2012-12-11 13:41:42 UTC) #2
mont29
Ok, took me some time to finalize that (hit some issues, as previous C code ...
11 years, 2 months ago (2012-12-14 18:00:04 UTC) #3
mont29
This commit refactors how template_list works. It introduces a new (py-extendable and registrable)
11 years, 2 months ago (2012-12-14 18:00:55 UTC) #4
mont29
Pff… stupid codereview! Here's the log: This commit refactors how template_list works. It introduces a ...
11 years, 2 months ago (2012-12-14 18:01:48 UTC) #5
ideasman42
generally LGTM, added some comments. https://codereview.appspot.com/6854125/diff/16001/release/scripts/startup/bl_ui/properties_data_mesh.py File release/scripts/startup/bl_ui/properties_data_mesh.py (right): https://codereview.appspot.com/6854125/diff/16001/release/scripts/startup/bl_ui/properties_data_mesh.py#newcode73 release/scripts/startup/bl_ui/properties_data_mesh.py:73: if not isinstance(item, bpy.types.ShapeKey): ...
11 years, 2 months ago (2012-12-26 11:37:00 UTC) #6
mont29
11 years, 1 month ago (2012-12-27 15:10:39 UTC) #7
Hi Campbo,

and many thanks for the review! :)

I addressed your remarks, so think it’s ready to go in trunk… Will probably
commit tomorrow, unless you get some last-moment suggestions ;)

Merry Christmas and happy new year!

Bastien

https://codereview.appspot.com/6854125/diff/16001/release/scripts/startup/bl_...
File release/scripts/startup/bl_ui/properties_data_mesh.py (right):

https://codereview.appspot.com/6854125/diff/16001/release/scripts/startup/bl_...
release/scripts/startup/bl_ui/properties_data_mesh.py:73: if not
isinstance(item, bpy.types.ShapeKey):
On 2012/12/26 11:37:00, ideasman42 wrote:
> why would the item not be a shapekey? - if theres a good reason should add
here
> as a comment.

Well, it’s only the fact that once this class is registered, anybody can (try
to) use it with any collection property… So it’s just a security check, to avoid
"crashing" the whole UI in case something is wrong.

If you think it’s over-paranoid, I’m fine with removing those checks.

https://codereview.appspot.com/6854125/diff/16001/source/blender/editors/inte...
File source/blender/editors/interface/interface_templates.c (right):

https://codereview.appspot.com/6854125/diff/16001/source/blender/editors/inte...
source/blender/editors/interface/interface_templates.c:2386: 
On 2012/12/26 11:37:00, ideasman42 wrote:
> *picky* - personally not a fan of this style of declarations; can just be int
at
> the start of each line and end with ';'

Done.

https://codereview.appspot.com/6854125/diff/16001/source/blender/makesrna/int...
File source/blender/makesrna/intern/rna_ui_api.c (right):

https://codereview.appspot.com/6854125/diff/16001/source/blender/makesrna/int...
source/blender/makesrna/intern/rna_ui_api.c:85: 
On 2012/12/26 11:37:00, ideasman42 wrote:
> All these functions can be classmethods, eg:
>   bpy.types.UILayout.enum_name(...)
> rather then 
>   layout.enum_name(...)

Done (actually, made them "static methods" ;) ).

https://codereview.appspot.com/6854125/diff/16001/source/blender/makesrna/int...
source/blender/makesrna/intern/rna_ui_api.c:167:
RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
On 2012/12/26 11:37:00, ideasman42 wrote:
> why _gettexted( version of this function?

Absolutely no reason! Probably a copy/paste glitch. ;)
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b