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

Issue 12440043: Patch: generic node socket display in the Node Editor

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 8 months ago by sjoerd_de_vries
Modified:
10 years, 8 months ago
Reviewers:
lukas.toenne1, bf-codereview
Base URL:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Visibility:
Public.

Description

Summary: This patch enables generic node socket drawing, independent of whether the socket is input or output. This enables label display and property editing for all sockets. Generic node sockets can be enabled for custom Node types by enabling "bl_generic_sockets". Custom NodeSocket types within these Nodes can have their labels hidden if "bl_hide_label" is enabled, and can be drawn on the same row as the next socket if "bl_shared_row" is enabled. This allows input socket and output socket to be drawn at the same position. Current situation: Input and output sockets, while having the same bNodeSocket type, are treated differently in drawing, calling either nodesocket->typeinfo->drawinputfunc or drawoutputfunc. The default value of drawoutputfunc draws the label, but does not call draw() on the socket in the property panel. For drawinputfunc, the behavior is reversed. Patch: This patch implements a generic nodesocket draw function, for both inputs and outputs. When "bl_generic_sockets" is enabled in a custom Node definition, both its drawinputfunc and drawoutputfunc are set to the generic draw function. The generic draw function always calls the panel draw() function, and it always displays the label. However, label drawing can be disabled for a particular custom NodeSocket typr by specifying "bl_hide_label" as True in the NodeSocket definition. In addition, a NodeSocket can be drawn on the same line as the socket that comes after, by enabling "bl_shared_row" in the NodeSocket definition. (The drawing implementation of same-row sockets is in the patch https://codereview.appspot.com/12437043/) Internally, SOCKTYPE_HIDE_LABEL and SOCKTYPE_SHARED_ROW are defined as mask bits in NodeSocket->typeinfo->flag, and NODETYPE_GENERIC as a mask bit in Node->typeinfo->flag. In existing code, Node->typeinfo->flag (16 bits) was mixed up with the NODE_PREVIEW mask bit for Node->flag (32 bits). This mixing-up was removed by defining a new NODETYPE_PREVIEW mask bit. The actual value of the mask bit was kept the same.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+51 lines, -7 lines) Patch
source/blender/blenkernel/BKE_node.h View 1 chunk +1 line, -0 lines 0 comments Download
source/blender/blenkernel/intern/node.c View 2 chunks +2 lines, -2 lines 0 comments Download
source/blender/editors/space_node/drawnode.c View 2 chunks +15 lines, -2 lines 0 comments Download
source/blender/editors/space_node/node_draw.c View 1 chunk +1 line, -1 line 0 comments Download
source/blender/editors/space_node/node_edit.c View 2 chunks +2 lines, -2 lines 0 comments Download
source/blender/makesdna/DNA_node_types.h View 2 chunks +18 lines, -0 lines 0 comments Download
source/blender/makesrna/intern/rna_nodetree.c View 2 chunks +12 lines, -0 lines 0 comments Download

Messages

Total messages: 1
sjoerd_de_vries
10 years, 8 months ago (2013-08-04 17:21:33 UTC) #1

          
Sign in to reply to this message.

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