|
|
|
@ -48,14 +48,12 @@ const EnumPropertyItem rna_enum_node_socket_type_items[] = {
|
|
|
|
|
|
|
|
|
|
# include "ED_node.hh"
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
extern FunctionRNA rna_NodeSocket_draw_func;
|
|
|
|
|
extern FunctionRNA rna_NodeSocket_draw_color_func;
|
|
|
|
|
extern FunctionRNA rna_NodeSocketInterface_draw_func;
|
|
|
|
|
extern FunctionRNA rna_NodeSocketInterface_draw_color_func;
|
|
|
|
|
extern FunctionRNA rna_NodeSocketInterface_init_socket_func;
|
|
|
|
|
extern FunctionRNA rna_NodeSocketInterface_from_socket_func;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ******** Node Socket ******** */
|
|
|
|
|
|
|
|
|
@ -558,8 +556,9 @@ static void rna_NodeSocketInterfaceStandard_draw_color(ID *id,
|
|
|
|
|
RNA_pointer_create(id, &RNA_NodeSocketInterface, sock, &ptr);
|
|
|
|
|
sock->typeinfo->interface_draw_color(C, &ptr, r_color);
|
|
|
|
|
}
|
|
|
|
|
/* ******** Node Socket Subtypes ******** */
|
|
|
|
|
|
|
|
|
|
static void rna_NodeSocketStandard_float_range(
|
|
|
|
|
void rna_NodeSocketStandard_float_range(
|
|
|
|
|
PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
|
|
|
|
|
{
|
|
|
|
|
bNodeSocket *sock = static_cast<bNodeSocket *>(ptr->data);
|
|
|
|
@ -576,7 +575,7 @@ static void rna_NodeSocketStandard_float_range(
|
|
|
|
|
*softmax = dval->max;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_NodeSocketStandard_int_range(
|
|
|
|
|
void rna_NodeSocketStandard_int_range(
|
|
|
|
|
PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
|
|
|
|
|
{
|
|
|
|
|
bNodeSocket *sock = static_cast<bNodeSocket *>(ptr->data);
|
|
|
|
@ -593,7 +592,7 @@ static void rna_NodeSocketStandard_int_range(
|
|
|
|
|
*softmax = dval->max;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_NodeSocketStandard_vector_range(
|
|
|
|
|
void rna_NodeSocketStandard_vector_range(
|
|
|
|
|
PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
|
|
|
|
|
{
|
|
|
|
|
bNodeSocket *sock = static_cast<bNodeSocket *>(ptr->data);
|
|
|
|
@ -623,8 +622,6 @@ static void rna_NodeSocketStandard_value_and_relation_update(bContext *C, Pointe
|
|
|
|
|
DEG_relations_tag_update(bmain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ******** Node Socket Subtypes ******** */
|
|
|
|
|
|
|
|
|
|
bool rna_NodeSocketMaterial_default_value_poll(PointerRNA * /*ptr*/, PointerRNA value)
|
|
|
|
|
{
|
|
|
|
|
/* Do not show grease pencil materials for now. */
|
|
|
|
@ -939,6 +936,93 @@ static void rna_def_node_socket_interface(BlenderRNA *brna)
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_standard(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
/* XXX Workaround: Registered functions are not exposed in python by bpy,
|
|
|
|
|
* it expects them to be registered from python and use the native implementation.
|
|
|
|
|
* However, the standard socket types below are not registering these functions from python,
|
|
|
|
|
* so in order to call them in py scripts we need to overload and
|
|
|
|
|
* replace them with plain C callbacks.
|
|
|
|
|
* These types provide a usable basis for socket types defined in C.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "NodeSocketStandard", "NodeSocket");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeSocket");
|
|
|
|
|
|
|
|
|
|
/* draw socket */
|
|
|
|
|
func = RNA_def_function(srna, "draw", "rna_NodeSocketStandard_draw");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
|
|
|
|
RNA_def_function_ui_description(func, "Draw socket");
|
|
|
|
|
parm = RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(parm, "UILayout");
|
|
|
|
|
RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(parm, "Node");
|
|
|
|
|
RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
|
parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties");
|
|
|
|
|
// RNA_def_property_string_default(parm, "");
|
|
|
|
|
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "draw_color", "rna_NodeSocketStandard_draw_color");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
|
|
|
|
RNA_def_function_ui_description(func, "Color of the socket icon");
|
|
|
|
|
parm = RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(parm, "Node");
|
|
|
|
|
RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
|
parm = RNA_def_float_array(
|
|
|
|
|
func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
|
|
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
|
|
|
|
|
|
/* Note: Legacy socket interface below.
|
|
|
|
|
* The new interface RNA is defined in a separate file,
|
|
|
|
|
* the NodeSocketInterface struct will be replaced. */
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "NodeSocketInterfaceStandard", "NodeSocketInterface");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeSocket");
|
|
|
|
|
|
|
|
|
|
/* for easier type comparison in python */
|
|
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, nullptr, "typeinfo->type");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_node_socket_type_items);
|
|
|
|
|
RNA_def_property_enum_default(prop, SOCK_FLOAT);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Type", "Data type");
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "draw", "rna_NodeSocketInterfaceStandard_draw");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
|
|
|
|
RNA_def_function_ui_description(func, "Draw template settings");
|
|
|
|
|
parm = RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(parm, "UILayout");
|
|
|
|
|
RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "draw_color", "rna_NodeSocketInterfaceStandard_draw_color");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
|
|
|
|
RNA_def_function_ui_description(func, "Color of the socket icon");
|
|
|
|
|
parm = RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_float_array(
|
|
|
|
|
func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
|
|
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_float(BlenderRNA *brna,
|
|
|
|
|
const char *idname,
|
|
|
|
|
const char *interface_idname,
|
|
|
|
@ -1525,167 +1609,684 @@ static void rna_def_node_socket_material(BlenderRNA *brna,
|
|
|
|
|
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_standard_types(BlenderRNA *brna)
|
|
|
|
|
/* Common functions for all builtin socket interface types. */
|
|
|
|
|
static void rna_def_node_tree_interface_socket_builtin(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
/* XXX Workaround: Registered functions are not exposed in python by bpy,
|
|
|
|
|
* it expects them to be registered from python and use the native implementation.
|
|
|
|
|
* However, the standard socket types below are not registering these functions from python,
|
|
|
|
|
* so in order to call them in py scripts we need to overload and
|
|
|
|
|
* replace them with plain C callbacks.
|
|
|
|
|
* These types provide a usable basis for socket types defined in C.
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
/* Override for functions, invoking the typeinfo callback directly
|
|
|
|
|
* instead of expecting an existing RNA registered function implementation.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *parm, *prop;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
|
|
|
|
|
static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "NodeSocketStandard", "NodeSocket");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeSocket");
|
|
|
|
|
|
|
|
|
|
/* draw socket */
|
|
|
|
|
func = RNA_def_function(srna, "draw", "rna_NodeSocketStandard_draw");
|
|
|
|
|
func = RNA_def_function(srna, "draw", "rna_NodeTreeInterfaceSocket_draw_builtin");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
|
|
|
|
RNA_def_function_ui_description(func, "Draw socket");
|
|
|
|
|
RNA_def_function_ui_description(func, "Draw interface socket settings");
|
|
|
|
|
parm = RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(parm, "UILayout");
|
|
|
|
|
RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(parm, "Node");
|
|
|
|
|
RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
|
parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties");
|
|
|
|
|
// RNA_def_property_string_default(parm, "");
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "init_socket", "rna_NodeTreeInterfaceSocket_init_socket_builtin");
|
|
|
|
|
RNA_def_function_ui_description(func, "Initialize a node socket instance");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_ALLOW_WRITE);
|
|
|
|
|
parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the socket to initialize");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Socket to initialize");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_string(
|
|
|
|
|
func, "data_path", nullptr, 0, "Data Path", "Path to specialized socket data");
|
|
|
|
|
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "draw_color", "rna_NodeSocketStandard_draw_color");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
|
|
|
|
RNA_def_function_ui_description(func, "Color of the socket icon");
|
|
|
|
|
parm = RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
func = RNA_def_function(srna, "from_socket", "rna_NodeTreeInterfaceSocket_from_socket_builtin");
|
|
|
|
|
RNA_def_function_ui_description(func, "Setup template parameters from an existing socket");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_ALLOW_WRITE);
|
|
|
|
|
parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the original socket");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(parm, "Node");
|
|
|
|
|
RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
|
parm = RNA_def_float_array(
|
|
|
|
|
func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
|
|
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "NodeSocketInterfaceStandard", "NodeSocketInterface");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeSocket");
|
|
|
|
|
|
|
|
|
|
/* for easier type comparison in python */
|
|
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, nullptr, "typeinfo->type");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_node_socket_type_items);
|
|
|
|
|
RNA_def_property_enum_default(prop, SOCK_FLOAT);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Type", "Data type");
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "draw", "rna_NodeSocketInterfaceStandard_draw");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
|
|
|
|
RNA_def_function_ui_description(func, "Draw template settings");
|
|
|
|
|
parm = RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(parm, "UILayout");
|
|
|
|
|
RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
|
|
|
|
|
parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Original socket");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "draw_color", "rna_NodeSocketInterfaceStandard_draw_color");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
|
|
|
|
RNA_def_function_ui_description(func, "Color of the socket icon");
|
|
|
|
|
parm = RNA_def_pointer(func, "context", "Context", "", "");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
|
|
|
|
parm = RNA_def_float_array(
|
|
|
|
|
func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
|
|
|
|
|
RNA_def_function_output(func, parm);
|
|
|
|
|
static void rna_def_node_socket_interface_float(BlenderRNA *brna,
|
|
|
|
|
const char *identifier,
|
|
|
|
|
PropertySubType subtype)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
float value_default;
|
|
|
|
|
|
|
|
|
|
/* XXX These types should eventually be registered at runtime.
|
|
|
|
|
* Then use the nodeStaticSocketType and nodeStaticSocketInterfaceType functions
|
|
|
|
|
* to get the idname strings from int type and subtype
|
|
|
|
|
* (see node_socket.cc, register_standard_node_socket_types).
|
|
|
|
|
*/
|
|
|
|
|
/* choose sensible common default based on subtype */
|
|
|
|
|
switch (subtype) {
|
|
|
|
|
case PROP_FACTOR:
|
|
|
|
|
value_default = 1.0f;
|
|
|
|
|
break;
|
|
|
|
|
case PROP_PERCENTAGE:
|
|
|
|
|
value_default = 100.0f;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
value_default = 0.0f;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_float(brna, "NodeSocketFloat", "NodeSocketInterfaceFloat", PROP_NONE);
|
|
|
|
|
rna_def_node_socket_float(
|
|
|
|
|
brna, "NodeSocketFloatUnsigned", "NodeSocketInterfaceFloatUnsigned", PROP_UNSIGNED);
|
|
|
|
|
rna_def_node_socket_float(
|
|
|
|
|
brna, "NodeSocketFloatPercentage", "NodeSocketInterfaceFloatPercentage", PROP_PERCENTAGE);
|
|
|
|
|
rna_def_node_socket_float(
|
|
|
|
|
brna, "NodeSocketFloatFactor", "NodeSocketInterfaceFloatFactor", PROP_FACTOR);
|
|
|
|
|
rna_def_node_socket_float(
|
|
|
|
|
brna, "NodeSocketFloatAngle", "NodeSocketInterfaceFloatAngle", PROP_ANGLE);
|
|
|
|
|
rna_def_node_socket_float(
|
|
|
|
|
brna, "NodeSocketFloatTime", "NodeSocketInterfaceFloatTime", PROP_TIME);
|
|
|
|
|
rna_def_node_socket_float(brna,
|
|
|
|
|
"NodeSocketFloatTimeAbsolute",
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Float Node Socket Interface", "Floating-point number socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueFloat", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
|
|
|
|
|
RNA_def_property_float_sdna(prop, nullptr, "value");
|
|
|
|
|
RNA_def_property_float_default(prop, value_default);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_float_funcs(
|
|
|
|
|
prop, nullptr, nullptr, "rna_NodeTreeInterfaceSocketFloat_default_value_range");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "min_value", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, nullptr, "min");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "max_value", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, nullptr, "max");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeTreeInterfaceSocket", nullptr);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_int(BlenderRNA *brna,
|
|
|
|
|
const char *identifier,
|
|
|
|
|
PropertySubType subtype)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Integer Node Socket Interface", "Integer number socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueInt", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_INT, subtype);
|
|
|
|
|
RNA_def_property_int_sdna(prop, nullptr, "value");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_int_funcs(
|
|
|
|
|
prop, nullptr, nullptr, "rna_NodeTreeInterfaceSocketInt_default_value_range");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "min_value", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, nullptr, "min");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "max_value", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_int_sdna(prop, nullptr, "max");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeTreeInterfaceSocket", nullptr);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_bool(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Boolean Node Socket Interface", "Boolean value socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueBoolean", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, nullptr, "value", 1);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeTreeInterfaceSocket", nullptr);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_rotation(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Rotation Node Socket Interface", "Rotation value socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueRotation", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_EULER);
|
|
|
|
|
RNA_def_property_float_sdna(prop, nullptr, "value_euler");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeTreeInterfaceSocket", nullptr);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_vector(BlenderRNA *brna,
|
|
|
|
|
const char *identifier,
|
|
|
|
|
PropertySubType subtype)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Vector Node Socket Interface", "3D vector socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueVector", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
|
|
|
|
|
RNA_def_property_float_sdna(prop, nullptr, "value");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_float_funcs(
|
|
|
|
|
prop, nullptr, nullptr, "rna_NodeTreeInterfaceSocketVector_default_value_range");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "min_value", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, nullptr, "min");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "max_value", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, nullptr, "max");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeTreeInterfaceSocket", nullptr);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_color(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Color Node Socket Interface", "RGBA color socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueRGBA", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, nullptr, "value");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeTreeInterfaceSocket", nullptr);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_string(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "String Node Socket Interface", "String socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, nullptr, "value");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeTreeInterfaceSocket", nullptr);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_shader(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Shader Node Socket Interface", "Shader socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_object(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Object Node Socket Interface", "Object socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueObject", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, nullptr, "value");
|
|
|
|
|
RNA_def_property_struct_type(prop, "Object");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
|
|
|
|
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_image(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Image Node Socket Interface", "Image socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueImage", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, nullptr, "value");
|
|
|
|
|
RNA_def_property_struct_type(prop, "Image");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
|
|
|
|
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_geometry(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Geometry Node Socket Interface", "Geometry socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_collection(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Collection Node Socket Interface", "Collection socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueCollection", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, nullptr, "value");
|
|
|
|
|
RNA_def_property_struct_type(prop, "Collection");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
|
|
|
|
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_texture(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Texture Node Socket Interface", "Texture socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueTexture", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, nullptr, "value");
|
|
|
|
|
RNA_def_property_struct_type(prop, "Texture");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
|
|
|
|
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_node_socket_interface_material(BlenderRNA *brna, const char *identifier)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, identifier, "NodeTreeInterfaceSocket");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Material Node Socket Interface", "Material socket of a node");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bNodeTreeInterfaceSocket");
|
|
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bNodeSocketValueMaterial", "socket_data");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "default_value", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, nullptr, "value");
|
|
|
|
|
RNA_def_property_struct_type(prop, "Material");
|
|
|
|
|
RNA_def_property_pointer_funcs(
|
|
|
|
|
prop, nullptr, nullptr, nullptr, "rna_NodeTreeInterfaceSocketMaterial_default_value_poll");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
|
|
|
|
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeTreeInterfaceSocket_value_update");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
|
|
|
|
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
|
|
|
|
|
|
|
|
|
rna_def_node_tree_interface_socket_builtin(srna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Info for generating static subtypes. */
|
|
|
|
|
struct bNodeSocketStaticTypeInfo {
|
|
|
|
|
const char *socket_identifier;
|
|
|
|
|
const char *interface_identifier_legacy;
|
|
|
|
|
const char *interface_identifier;
|
|
|
|
|
eNodeSocketDatatype type;
|
|
|
|
|
PropertySubType subtype;
|
|
|
|
|
const char *label;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Note: Socket and interface subtypes could be defined from a single central list,
|
|
|
|
|
* but makesrna cannot have a dependency on BKE, so this list would have to live in RNA itself,
|
|
|
|
|
* with BKE etc. accessing the RNA API to get the subtypes info. */
|
|
|
|
|
static const bNodeSocketStaticTypeInfo node_socket_subtypes[] = {
|
|
|
|
|
{"NodeSocketFloat",
|
|
|
|
|
"NodeSocketInterfaceFloat",
|
|
|
|
|
"NodeTreeInterfaceSocketFloat",
|
|
|
|
|
SOCK_FLOAT,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketFloatUnsigned",
|
|
|
|
|
"NodeSocketInterfaceFloatUnsigned",
|
|
|
|
|
"NodeTreeInterfaceSocketFloatUnsigned",
|
|
|
|
|
SOCK_FLOAT,
|
|
|
|
|
PROP_UNSIGNED},
|
|
|
|
|
{"NodeSocketFloatPercentage",
|
|
|
|
|
"NodeSocketInterfaceFloatPercentage",
|
|
|
|
|
"NodeTreeInterfaceSocketFloatPercentage",
|
|
|
|
|
SOCK_FLOAT,
|
|
|
|
|
PROP_PERCENTAGE},
|
|
|
|
|
{"NodeSocketFloatFactor",
|
|
|
|
|
"NodeSocketInterfaceFloatFactor",
|
|
|
|
|
"NodeTreeInterfaceSocketFloatFactor",
|
|
|
|
|
SOCK_FLOAT,
|
|
|
|
|
PROP_FACTOR},
|
|
|
|
|
{"NodeSocketFloatAngle",
|
|
|
|
|
"NodeSocketInterfaceFloatAngle",
|
|
|
|
|
"NodeTreeInterfaceSocketFloatAngle",
|
|
|
|
|
SOCK_FLOAT,
|
|
|
|
|
PROP_ANGLE},
|
|
|
|
|
{"NodeSocketFloatTime",
|
|
|
|
|
"NodeSocketInterfaceFloatTime",
|
|
|
|
|
"NodeTreeInterfaceSocketFloatTime",
|
|
|
|
|
SOCK_FLOAT,
|
|
|
|
|
PROP_TIME},
|
|
|
|
|
{"NodeSocketFloatTimeAbsolute",
|
|
|
|
|
"NodeSocketInterfaceFloatTimeAbsolute",
|
|
|
|
|
PROP_TIME_ABSOLUTE);
|
|
|
|
|
rna_def_node_socket_float(
|
|
|
|
|
brna, "NodeSocketFloatDistance", "NodeSocketInterfaceFloatDistance", PROP_DISTANCE);
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_int(brna, "NodeSocketInt", "NodeSocketInterfaceInt", PROP_NONE);
|
|
|
|
|
rna_def_node_socket_int(
|
|
|
|
|
brna, "NodeSocketIntUnsigned", "NodeSocketInterfaceIntUnsigned", PROP_UNSIGNED);
|
|
|
|
|
rna_def_node_socket_int(
|
|
|
|
|
brna, "NodeSocketIntPercentage", "NodeSocketInterfaceIntPercentage", PROP_PERCENTAGE);
|
|
|
|
|
rna_def_node_socket_int(
|
|
|
|
|
brna, "NodeSocketIntFactor", "NodeSocketInterfaceIntFactor", PROP_FACTOR);
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_bool(brna, "NodeSocketBool", "NodeSocketInterfaceBool");
|
|
|
|
|
rna_def_node_socket_rotation(brna, "NodeSocketRotation", "NodeSocketInterfaceRotation");
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_vector(brna, "NodeSocketVector", "NodeSocketInterfaceVector", PROP_NONE);
|
|
|
|
|
rna_def_node_socket_vector(brna,
|
|
|
|
|
"NodeSocketVectorTranslation",
|
|
|
|
|
"NodeTreeInterfaceSocketFloatTimeAbsolute",
|
|
|
|
|
SOCK_FLOAT,
|
|
|
|
|
PROP_TIME_ABSOLUTE},
|
|
|
|
|
{"NodeSocketFloatDistance",
|
|
|
|
|
"NodeSocketInterfaceFloatDistance",
|
|
|
|
|
"NodeTreeInterfaceSocketFloatDistance",
|
|
|
|
|
SOCK_FLOAT,
|
|
|
|
|
PROP_DISTANCE},
|
|
|
|
|
{"NodeSocketInt", "NodeSocketInterfaceInt", "NodeTreeInterfaceSocketInt", SOCK_INT, PROP_NONE},
|
|
|
|
|
{"NodeSocketIntUnsigned",
|
|
|
|
|
"NodeSocketInterfaceIntUnsigned",
|
|
|
|
|
"NodeTreeInterfaceSocketIntUnsigned",
|
|
|
|
|
SOCK_INT,
|
|
|
|
|
PROP_UNSIGNED},
|
|
|
|
|
{"NodeSocketIntPercentage",
|
|
|
|
|
"NodeSocketInterfaceIntPercentage",
|
|
|
|
|
"NodeTreeInterfaceSocketIntPercentage",
|
|
|
|
|
SOCK_INT,
|
|
|
|
|
PROP_PERCENTAGE},
|
|
|
|
|
{"NodeSocketIntFactor",
|
|
|
|
|
"NodeSocketInterfaceIntFactor",
|
|
|
|
|
"NodeTreeInterfaceSocketIntFactor",
|
|
|
|
|
SOCK_INT,
|
|
|
|
|
PROP_FACTOR},
|
|
|
|
|
{"NodeSocketBool",
|
|
|
|
|
"NodeSocketInterfaceBool",
|
|
|
|
|
"NodeTreeInterfaceSocketBool",
|
|
|
|
|
SOCK_BOOLEAN,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketRotation",
|
|
|
|
|
"NodeSocketInterfaceRotation",
|
|
|
|
|
"NodeTreeInterfaceSocketRotation",
|
|
|
|
|
SOCK_ROTATION,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketVector",
|
|
|
|
|
"NodeSocketInterfaceVector",
|
|
|
|
|
"NodeTreeInterfaceSocketVector",
|
|
|
|
|
SOCK_VECTOR,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketVectorTranslation",
|
|
|
|
|
"NodeSocketInterfaceVectorTranslation",
|
|
|
|
|
PROP_TRANSLATION);
|
|
|
|
|
rna_def_node_socket_vector(
|
|
|
|
|
brna, "NodeSocketVectorDirection", "NodeSocketInterfaceVectorDirection", PROP_DIRECTION);
|
|
|
|
|
rna_def_node_socket_vector(
|
|
|
|
|
brna, "NodeSocketVectorVelocity", "NodeSocketInterfaceVectorVelocity", PROP_VELOCITY);
|
|
|
|
|
rna_def_node_socket_vector(brna,
|
|
|
|
|
"NodeSocketVectorAcceleration",
|
|
|
|
|
"NodeTreeInterfaceSocketVectorTranslation",
|
|
|
|
|
SOCK_VECTOR,
|
|
|
|
|
PROP_TRANSLATION},
|
|
|
|
|
{"NodeSocketVectorDirection",
|
|
|
|
|
"NodeSocketInterfaceVectorDirection",
|
|
|
|
|
"NodeTreeInterfaceSocketVectorDirection",
|
|
|
|
|
SOCK_VECTOR,
|
|
|
|
|
PROP_DIRECTION},
|
|
|
|
|
{"NodeSocketVectorVelocity",
|
|
|
|
|
"NodeSocketInterfaceVectorVelocity",
|
|
|
|
|
"NodeTreeInterfaceSocketVectorVelocity",
|
|
|
|
|
SOCK_VECTOR,
|
|
|
|
|
PROP_VELOCITY},
|
|
|
|
|
{"NodeSocketVectorAcceleration",
|
|
|
|
|
"NodeSocketInterfaceVectorAcceleration",
|
|
|
|
|
PROP_ACCELERATION);
|
|
|
|
|
rna_def_node_socket_vector(
|
|
|
|
|
brna, "NodeSocketVectorEuler", "NodeSocketInterfaceVectorEuler", PROP_EULER);
|
|
|
|
|
rna_def_node_socket_vector(
|
|
|
|
|
brna, "NodeSocketVectorXYZ", "NodeSocketInterfaceVectorXYZ", PROP_XYZ);
|
|
|
|
|
"NodeTreeInterfaceSocketVectorAcceleration",
|
|
|
|
|
SOCK_VECTOR,
|
|
|
|
|
PROP_ACCELERATION},
|
|
|
|
|
{"NodeSocketVectorEuler",
|
|
|
|
|
"NodeSocketInterfaceVectorEuler",
|
|
|
|
|
"NodeTreeInterfaceSocketVectorEuler",
|
|
|
|
|
SOCK_VECTOR,
|
|
|
|
|
PROP_EULER},
|
|
|
|
|
{"NodeSocketVectorXYZ",
|
|
|
|
|
"NodeSocketInterfaceVectorXYZ",
|
|
|
|
|
"NodeTreeInterfaceSocketVectorXYZ",
|
|
|
|
|
SOCK_VECTOR,
|
|
|
|
|
PROP_XYZ},
|
|
|
|
|
{"NodeSocketColor",
|
|
|
|
|
"NodeSocketInterfaceColor",
|
|
|
|
|
"NodeTreeInterfaceSocketColor",
|
|
|
|
|
SOCK_RGBA,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketString",
|
|
|
|
|
"NodeSocketInterfaceString",
|
|
|
|
|
"NodeTreeInterfaceSocketString",
|
|
|
|
|
SOCK_STRING,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketShader",
|
|
|
|
|
"NodeSocketInterfaceShader",
|
|
|
|
|
"NodeTreeInterfaceSocketShader",
|
|
|
|
|
SOCK_SHADER,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketObject",
|
|
|
|
|
"NodeSocketInterfaceObject",
|
|
|
|
|
"NodeTreeInterfaceSocketObject",
|
|
|
|
|
SOCK_OBJECT,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketImage",
|
|
|
|
|
"NodeSocketInterfaceImage",
|
|
|
|
|
"NodeTreeInterfaceSocketImage",
|
|
|
|
|
SOCK_IMAGE,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketGeometry",
|
|
|
|
|
"NodeSocketInterfaceGeometry",
|
|
|
|
|
"NodeTreeInterfaceSocketGeometry",
|
|
|
|
|
SOCK_GEOMETRY,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketCollection",
|
|
|
|
|
"NodeSocketInterfaceCollection",
|
|
|
|
|
"NodeTreeInterfaceSocketCollection",
|
|
|
|
|
SOCK_COLLECTION,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketTexture",
|
|
|
|
|
"NodeSocketInterfaceTexture",
|
|
|
|
|
"NodeTreeInterfaceSocketTexture",
|
|
|
|
|
SOCK_TEXTURE,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
{"NodeSocketMaterial",
|
|
|
|
|
"NodeSocketInterfaceMaterial",
|
|
|
|
|
"NodeTreeInterfaceSocketMaterial",
|
|
|
|
|
SOCK_MATERIAL,
|
|
|
|
|
PROP_NONE},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_color(brna, "NodeSocketColor", "NodeSocketInterfaceColor");
|
|
|
|
|
static void rna_def_node_socket_subtypes(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
for (const bNodeSocketStaticTypeInfo &info : node_socket_subtypes) {
|
|
|
|
|
const char *identifier = info.socket_identifier;
|
|
|
|
|
const char *interface_identifier = info.interface_identifier_legacy;
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_string(brna, "NodeSocketString", "NodeSocketInterfaceString");
|
|
|
|
|
switch (info.type) {
|
|
|
|
|
case SOCK_FLOAT:
|
|
|
|
|
rna_def_node_socket_float(brna, identifier, interface_identifier, info.subtype);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_INT:
|
|
|
|
|
rna_def_node_socket_int(brna, identifier, interface_identifier, info.subtype);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_BOOLEAN:
|
|
|
|
|
rna_def_node_socket_bool(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_ROTATION:
|
|
|
|
|
rna_def_node_socket_rotation(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_VECTOR:
|
|
|
|
|
rna_def_node_socket_vector(brna, identifier, interface_identifier, info.subtype);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_RGBA:
|
|
|
|
|
rna_def_node_socket_color(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_STRING:
|
|
|
|
|
rna_def_node_socket_string(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_SHADER:
|
|
|
|
|
rna_def_node_socket_shader(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_OBJECT:
|
|
|
|
|
rna_def_node_socket_object(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_IMAGE:
|
|
|
|
|
rna_def_node_socket_image(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_GEOMETRY:
|
|
|
|
|
rna_def_node_socket_geometry(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_COLLECTION:
|
|
|
|
|
rna_def_node_socket_collection(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_TEXTURE:
|
|
|
|
|
rna_def_node_socket_texture(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_MATERIAL:
|
|
|
|
|
rna_def_node_socket_material(brna, identifier, interface_identifier);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_shader(brna, "NodeSocketShader", "NodeSocketInterfaceShader");
|
|
|
|
|
case SOCK_CUSTOM:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_virtual(brna, "NodeSocketVirtual");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_object(brna, "NodeSocketObject", "NodeSocketInterfaceObject");
|
|
|
|
|
/* Note: interface items are defined outside this file.
|
|
|
|
|
* The subtypes must be defined after the base type, so this function
|
|
|
|
|
* is called from the interface rna file to ensure correct order. */
|
|
|
|
|
void rna_def_node_socket_interface_subtypes(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
for (const bNodeSocketStaticTypeInfo &info : node_socket_subtypes) {
|
|
|
|
|
const char *identifier = info.interface_identifier;
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_image(brna, "NodeSocketImage", "NodeSocketInterfaceImage");
|
|
|
|
|
switch (info.type) {
|
|
|
|
|
case SOCK_FLOAT:
|
|
|
|
|
rna_def_node_socket_interface_float(brna, identifier, info.subtype);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_INT:
|
|
|
|
|
rna_def_node_socket_interface_int(brna, identifier, info.subtype);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_BOOLEAN:
|
|
|
|
|
rna_def_node_socket_interface_bool(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_ROTATION:
|
|
|
|
|
rna_def_node_socket_interface_rotation(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_VECTOR:
|
|
|
|
|
rna_def_node_socket_interface_vector(brna, identifier, info.subtype);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_RGBA:
|
|
|
|
|
rna_def_node_socket_interface_color(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_STRING:
|
|
|
|
|
rna_def_node_socket_interface_string(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_SHADER:
|
|
|
|
|
rna_def_node_socket_interface_shader(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_OBJECT:
|
|
|
|
|
rna_def_node_socket_interface_object(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_IMAGE:
|
|
|
|
|
rna_def_node_socket_interface_image(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_GEOMETRY:
|
|
|
|
|
rna_def_node_socket_interface_geometry(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_COLLECTION:
|
|
|
|
|
rna_def_node_socket_interface_collection(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_TEXTURE:
|
|
|
|
|
rna_def_node_socket_interface_texture(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
case SOCK_MATERIAL:
|
|
|
|
|
rna_def_node_socket_interface_material(brna, identifier);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_geometry(brna, "NodeSocketGeometry", "NodeSocketInterfaceGeometry");
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_collection(brna, "NodeSocketCollection", "NodeSocketInterfaceCollection");
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_texture(brna, "NodeSocketTexture", "NodeSocketInterfaceTexture");
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_material(brna, "NodeSocketMaterial", "NodeSocketInterfaceMaterial");
|
|
|
|
|
case SOCK_CUSTOM:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RNA_def_node_socket_subtypes(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
rna_def_node_socket(brna);
|
|
|
|
|
rna_def_node_socket_interface(brna);
|
|
|
|
|
rna_def_node_socket_standard(brna);
|
|
|
|
|
|
|
|
|
|
rna_def_node_socket_standard_types(brna);
|
|
|
|
|
rna_def_node_socket_subtypes(brna);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|