[Bf-codereview] Patch: customizing the order of socket display in Node Editor nodes (issue 12437043)

sjdv1982 at gmail.com sjdv1982 at gmail.com
Sun Aug 4 18:17:19 CEST 2013


Reviewers: lukas.toenne1, bf-codereview_blender.org,

Description:
The display of node elements in the Node Editor is currently hardcoded.
Beginning from the top, first all output sockets are rendered, then the
preview rect, then the button rect, and finally all input sockets.

The current patch adds an integer "row" property to NodeSocket, that
allows custom socket ordering.
Starting at the lowest encountered row index, all inputs and then all
outputs with that row index are rendered. If row==0 (default row value),
the preview rect and the button rect are rendered in between,
maintaining current behavior.

Row range is currently clamped from -127 to 127, but this is essentially
arbitrary (the row is stored as a short). However, extreme values should
be disallowed, due to the "for(row=min;row<max;row++)" loop becoming
inefficient for extreme ranges.

Repetitive code sections have been put into separate functions declared
"inline", for efficiency and to indicate that they are for internal use
within the file.

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

Affected files:
   source/blender/editors/space_node/node_draw.c
   source/blender/makesdna/DNA_node_types.h
   source/blender/makesrna/intern/rna_nodetree.c




More information about the Bf-codereview mailing list