[Bf-codereview] string socket type (issue 6827049)

lukas.toenne at gmail.com lukas.toenne at gmail.com
Tue Nov 6 11:57:07 CET 2012


About node_add_input_from_template:
This is used to initialize a socket value from the static C templates.
Since we don't have any string values in these templates so far and
don't use them for existing node types by default, setting it to "" is
just fine.

Cycles will need a string value in ShaderInput, next to the "float3
value" used to store input constants for regular numeric sockets. It
won't be stored on the stack (i wouldn't suggest adding that), so
strings cannot be outputs and should only be used as option buttons on
nodes (without a circle to connect). The default string value can then
be passed in OSL nodes to the shader parameter.


https://codereview.appspot.com/6827049/diff/1/source/blender/editors/space_node/node_templates.c
File source/blender/editors/space_node/node_templates.c (right):

https://codereview.appspot.com/6827049/diff/1/source/blender/editors/space_node/node_templates.c#newcode510
source/blender/editors/space_node/node_templates.c:510: if (sock->link
|| sock->type == SOCK_SHADER || (sock->flag & SOCK_HIDE_VALUE)) {//brb
leftover?

https://codereview.appspot.com/6827049/diff/1/source/blender/nodes/intern/node_socket.c
File source/blender/nodes/intern/node_socket.c (right):

https://codereview.appspot.com/6827049/diff/1/source/blender/nodes/intern/node_socket.c#newcode161
source/blender/nodes/intern/node_socket.c:161: /******************
SHADER ******************/
should be STRING

https://codereview.appspot.com/6827049/diff/1/source/blender/nodes/intern/node_socket.c#newcode213
source/blender/nodes/intern/node_socket.c:213:
MEM_freeN(sock_string->value);
value is just an array, MEM_freeN is not needed and won't work here. The
data is freed together with default_value below.

https://codereview.appspot.com/6827049/


More information about the Bf-codereview mailing list