Nodes: add geometry socket type
We still have to pick a color for this socket. Ref T81848.
This commit is contained in:
parent
1d6284a6d5
commit
69f57550bc
|
@ -281,6 +281,7 @@ static void library_foreach_node_socket(LibraryForeachIDData *data, bNodeSocket
|
||||||
case __SOCK_MESH:
|
case __SOCK_MESH:
|
||||||
case SOCK_CUSTOM:
|
case SOCK_CUSTOM:
|
||||||
case SOCK_SHADER:
|
case SOCK_SHADER:
|
||||||
|
case SOCK_GEOMETRY:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,6 +374,7 @@ static void write_node_socket_default_value(BlendWriter *writer, bNodeSocket *so
|
||||||
case __SOCK_MESH:
|
case __SOCK_MESH:
|
||||||
case SOCK_CUSTOM:
|
case SOCK_CUSTOM:
|
||||||
case SOCK_SHADER:
|
case SOCK_SHADER:
|
||||||
|
case SOCK_GEOMETRY:
|
||||||
BLI_assert(false);
|
BLI_assert(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -714,6 +716,7 @@ static void lib_link_node_socket(BlendLibReader *reader, Library *lib, bNodeSock
|
||||||
case __SOCK_MESH:
|
case __SOCK_MESH:
|
||||||
case SOCK_CUSTOM:
|
case SOCK_CUSTOM:
|
||||||
case SOCK_SHADER:
|
case SOCK_SHADER:
|
||||||
|
case SOCK_GEOMETRY:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -792,6 +795,7 @@ static void expand_node_socket(BlendExpander *expander, bNodeSocket *sock)
|
||||||
case __SOCK_MESH:
|
case __SOCK_MESH:
|
||||||
case SOCK_CUSTOM:
|
case SOCK_CUSTOM:
|
||||||
case SOCK_SHADER:
|
case SOCK_SHADER:
|
||||||
|
case SOCK_GEOMETRY:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1348,6 +1352,7 @@ static void socket_id_user_increment(bNodeSocket *sock)
|
||||||
case __SOCK_MESH:
|
case __SOCK_MESH:
|
||||||
case SOCK_CUSTOM:
|
case SOCK_CUSTOM:
|
||||||
case SOCK_SHADER:
|
case SOCK_SHADER:
|
||||||
|
case SOCK_GEOMETRY:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1374,6 +1379,7 @@ static void socket_id_user_decrement(bNodeSocket *sock)
|
||||||
case __SOCK_MESH:
|
case __SOCK_MESH:
|
||||||
case SOCK_CUSTOM:
|
case SOCK_CUSTOM:
|
||||||
case SOCK_SHADER:
|
case SOCK_SHADER:
|
||||||
|
case SOCK_GEOMETRY:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1501,6 +1507,8 @@ const char *nodeStaticSocketType(int type, int subtype)
|
||||||
return "NodeSocketObject";
|
return "NodeSocketObject";
|
||||||
case SOCK_IMAGE:
|
case SOCK_IMAGE:
|
||||||
return "NodeSocketImage";
|
return "NodeSocketImage";
|
||||||
|
case SOCK_GEOMETRY:
|
||||||
|
return "NodeSocketGeometry";
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1566,6 +1574,8 @@ const char *nodeStaticSocketInterfaceType(int type, int subtype)
|
||||||
return "NodeSocketInterfaceObject";
|
return "NodeSocketInterfaceObject";
|
||||||
case SOCK_IMAGE:
|
case SOCK_IMAGE:
|
||||||
return "NodeSocketInterfaceImage";
|
return "NodeSocketInterfaceImage";
|
||||||
|
case SOCK_GEOMETRY:
|
||||||
|
return "NodeSocketInterfaceGeometry";
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3333,6 +3333,7 @@ static const float std_node_socket_colors[][4] = {
|
||||||
{0.39, 0.39, 0.39, 1.0}, /* SOCK_STRING */
|
{0.39, 0.39, 0.39, 1.0}, /* SOCK_STRING */
|
||||||
{0.40, 0.10, 0.10, 1.0}, /* SOCK_OBJECT */
|
{0.40, 0.10, 0.10, 1.0}, /* SOCK_OBJECT */
|
||||||
{0.10, 0.40, 0.10, 1.0}, /* SOCK_IMAGE */
|
{0.10, 0.40, 0.10, 1.0}, /* SOCK_IMAGE */
|
||||||
|
{0.00, 0.00, 0.00, 1.0}, /* SOCK_GEOMETRY, TODO: Choose color. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* common color callbacks for standard types */
|
/* common color callbacks for standard types */
|
||||||
|
|
|
@ -159,6 +159,7 @@ typedef enum eNodeSocketDatatype {
|
||||||
SOCK_STRING = 7,
|
SOCK_STRING = 7,
|
||||||
SOCK_OBJECT = 8,
|
SOCK_OBJECT = 8,
|
||||||
SOCK_IMAGE = 9,
|
SOCK_IMAGE = 9,
|
||||||
|
SOCK_GEOMETRY = 10,
|
||||||
} eNodeSocketDatatype;
|
} eNodeSocketDatatype;
|
||||||
|
|
||||||
/* socket shape */
|
/* socket shape */
|
||||||
|
|
|
@ -84,6 +84,7 @@ static const EnumPropertyItem node_socket_type_items[] = {
|
||||||
{SOCK_SHADER, "SHADER", 0, "Shader", ""},
|
{SOCK_SHADER, "SHADER", 0, "Shader", ""},
|
||||||
{SOCK_OBJECT, "OBJECT", 0, "Object", ""},
|
{SOCK_OBJECT, "OBJECT", 0, "Object", ""},
|
||||||
{SOCK_IMAGE, "IMAGE", 0, "Image", ""},
|
{SOCK_IMAGE, "IMAGE", 0, "Image", ""},
|
||||||
|
{SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""},
|
||||||
{0, NULL, 0, NULL, NULL},
|
{0, NULL, 0, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,6 +97,7 @@ static const EnumPropertyItem node_socket_data_type_items[] = {
|
||||||
{SOCK_RGBA, "RGBA", 0, "Color", ""},
|
{SOCK_RGBA, "RGBA", 0, "Color", ""},
|
||||||
{SOCK_OBJECT, "OBJECT", 0, "Object", ""},
|
{SOCK_OBJECT, "OBJECT", 0, "Object", ""},
|
||||||
{SOCK_IMAGE, "IMAGE", 0, "Image", ""},
|
{SOCK_IMAGE, "IMAGE", 0, "Image", ""},
|
||||||
|
{SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""},
|
||||||
{0, NULL, 0, NULL, NULL},
|
{0, NULL, 0, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8829,6 +8831,21 @@ static void rna_def_node_socket_image(BlenderRNA *brna,
|
||||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rna_def_node_socket_geometry(BlenderRNA *brna,
|
||||||
|
const char *identifier,
|
||||||
|
const char *interface_idname)
|
||||||
|
{
|
||||||
|
StructRNA *srna;
|
||||||
|
|
||||||
|
srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
|
||||||
|
RNA_def_struct_ui_text(srna, "Geometry Node Socket", "Geometry socket of a node");
|
||||||
|
RNA_def_struct_sdna(srna, "bNodeSocket");
|
||||||
|
|
||||||
|
srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
|
||||||
|
RNA_def_struct_ui_text(srna, "Geometry Node Socket Interface", "Geometry socket of a node");
|
||||||
|
RNA_def_struct_sdna(srna, "bNodeSocket");
|
||||||
|
}
|
||||||
|
|
||||||
static void rna_def_node_socket_standard_types(BlenderRNA *brna)
|
static void rna_def_node_socket_standard_types(BlenderRNA *brna)
|
||||||
{
|
{
|
||||||
/* XXX Workaround: Registered functions are not exposed in python by bpy,
|
/* XXX Workaround: Registered functions are not exposed in python by bpy,
|
||||||
|
@ -8967,6 +8984,8 @@ static void rna_def_node_socket_standard_types(BlenderRNA *brna)
|
||||||
rna_def_node_socket_object(brna, "NodeSocketObject", "NodeSocketInterfaceObject");
|
rna_def_node_socket_object(brna, "NodeSocketObject", "NodeSocketInterfaceObject");
|
||||||
|
|
||||||
rna_def_node_socket_image(brna, "NodeSocketImage", "NodeSocketInterfaceImage");
|
rna_def_node_socket_image(brna, "NodeSocketImage", "NodeSocketInterfaceImage");
|
||||||
|
|
||||||
|
rna_def_node_socket_geometry(brna, "NodeSocketGeometry", "NodeSocketInterfaceGeometry");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_def_internal_node(BlenderRNA *brna)
|
static void rna_def_internal_node(BlenderRNA *brna)
|
||||||
|
|
|
@ -672,6 +672,12 @@ static bNodeSocketType *make_socket_type_object()
|
||||||
return socktype;
|
return socktype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bNodeSocketType *make_socket_type_geometry()
|
||||||
|
{
|
||||||
|
bNodeSocketType *socktype = make_standard_socket_type(SOCK_GEOMETRY, PROP_NONE);
|
||||||
|
return socktype;
|
||||||
|
}
|
||||||
|
|
||||||
void register_standard_node_socket_types(void)
|
void register_standard_node_socket_types(void)
|
||||||
{
|
{
|
||||||
/* draw callbacks are set in drawnode.c to avoid bad-level calls */
|
/* draw callbacks are set in drawnode.c to avoid bad-level calls */
|
||||||
|
@ -708,5 +714,7 @@ void register_standard_node_socket_types(void)
|
||||||
|
|
||||||
nodeRegisterSocketType(make_standard_socket_type(SOCK_IMAGE, PROP_NONE));
|
nodeRegisterSocketType(make_standard_socket_type(SOCK_IMAGE, PROP_NONE));
|
||||||
|
|
||||||
|
nodeRegisterSocketType(make_socket_type_geometry());
|
||||||
|
|
||||||
nodeRegisterSocketType(make_socket_type_virtual());
|
nodeRegisterSocketType(make_socket_type_virtual());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue