[Bf-codereview] Extended UILayout for node drawing (issue 14433064)

lukas.toenne at gmail.com lukas.toenne at gmail.com
Mon Oct 14 15:50:38 CEST 2013


Reviewers: bf-codereview_blender.org,

Description:
This patch extends the draw_buttons function of nodes to integrate
sockets into the general layout system and allow more flexible
placement.
(Example: http://www.pasteall.org/pic/60728)

UINodeLayout is a slightly extended variant of the usual UILayout type.
It has an additional function "node_socket", which creates a (column)
sublayout and draws an input/output socket connector on the node in the
vertical middle of the layout.

Using the new layout is optional: any socket that is not handled in
draw_buttons is drawn as before in the standard
outputs/preview/buttons/inputs order (from top to bottom).

Later this layout system could be used for more advanced features, like:
* Vertical node layouts, placing sockets on the top/bottom node border.
* Automatic disabling of sockets which are not drawn, removing the need
for extra update functions.

The uiLayout struct is currently internal to interface_layout.c. In
order to access the node pointer in the layout context and allow sockets
to retrieve placement info it is necessary to make these accessible in
node_layout.c. The layout C structs have therefore been moved into their
own header file, intended only for layout implementation.

To read the geometry of a layout after resolving but before freeing
block layouts, the uiBlockLayoutResolve function now has 2 parts (only
for internal layout use).

Please review this at https://codereview.appspot.com/14433064/

Affected files (+637, -397 lines):
   source/blender/blenkernel/BKE_node.h
   source/blender/editors/include/ED_node.h
   source/blender/editors/interface/CMakeLists.txt
   source/blender/editors/interface/interface_draw.c
   source/blender/editors/interface/interface_layout.c
   source/blender/editors/interface/interface_layout.h
   source/blender/editors/interface/interface_templates.c
   source/blender/editors/interface/interface_widgets.c
   source/blender/editors/space_node/CMakeLists.txt
   source/blender/editors/space_node/drawnode.c
   source/blender/editors/space_node/node_draw.c
   source/blender/editors/space_node/node_intern.h
   source/blender/editors/space_node/node_layout.c
   source/blender/makesdna/DNA_node_types.h
   source/blender/makesrna/intern/rna_internal.h
   source/blender/makesrna/intern/rna_nodetree.c
   source/blender/makesrna/intern/rna_ui.c
   source/blender/makesrna/intern/rna_ui_api.c




More information about the Bf-codereview mailing list