Refactor: Nodes: change int to enum for bNodeSocketType.type
This eliminates the need for explicit type casts in many places. Pull Request: https://projects.blender.org/blender/blender/pulls/139710
This commit is contained in:
@@ -184,7 +184,8 @@ struct bNodeSocketType {
|
||||
ExtensionRNA ext_interface = {};
|
||||
|
||||
/* for standard socket types in C */
|
||||
int type = 0, subtype = 0;
|
||||
eNodeSocketDatatype type = eNodeSocketDatatype(0);
|
||||
int subtype = 0;
|
||||
|
||||
/* When set, bNodeSocket->limit does not have any effect anymore. */
|
||||
bool use_link_limits_of_type = false;
|
||||
|
||||
@@ -45,8 +45,7 @@ static std::unique_ptr<BakeItem> move_common_socket_value_to_bake_item(
|
||||
std::optional<StringRef> name,
|
||||
Vector<GeometryBakeItem *> &r_geometry_bake_items)
|
||||
{
|
||||
const eNodeSocketDatatype socket_type = eNodeSocketDatatype(stype.type);
|
||||
switch (socket_type) {
|
||||
switch (stype.type) {
|
||||
case SOCK_GEOMETRY: {
|
||||
GeometrySet &geometry = *static_cast<GeometrySet *>(socket_value);
|
||||
auto item = std::make_unique<GeometryBakeItem>(std::move(geometry));
|
||||
@@ -281,7 +280,7 @@ Array<std::unique_ptr<BakeItem>> move_socket_values_to_bake_items(const Span<voi
|
||||
}
|
||||
BUFFER_FOR_CPP_TYPE_VALUE(*stype->geometry_nodes_cpp_type, buffer);
|
||||
if (!copy_bake_item_to_socket_value(
|
||||
*item.value, eNodeSocketDatatype(stype->type), {}, r_attribute_map, buffer))
|
||||
*item.value, stype->type, {}, r_attribute_map, buffer))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ static void construct_interface_as_legacy_sockets(bNodeTree *ntree)
|
||||
STRNCPY(iosock->description, socket.description);
|
||||
}
|
||||
node_socket_copy_default_value_data(
|
||||
eNodeSocketDatatype(iosock->typeinfo->type), iosock->default_value, socket.socket_data);
|
||||
iosock->typeinfo->type, iosock->default_value, socket.socket_data);
|
||||
if (socket.properties) {
|
||||
iosock->prop = IDP_CopyProperty(socket.properties);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ using nodes::SocketDeclaration;
|
||||
|
||||
static bool is_field_socket_type(const bNodeSocket &socket)
|
||||
{
|
||||
return nodes::socket_type_supports_fields(eNodeSocketDatatype(socket.typeinfo->type));
|
||||
return nodes::socket_type_supports_fields(socket.typeinfo->type);
|
||||
}
|
||||
|
||||
static bool all_dangling_reroutes(const Span<const bNodeSocket *> sockets)
|
||||
@@ -514,8 +514,7 @@ static void determine_group_input_states(
|
||||
for (const int index : tree.interface_inputs().index_range()) {
|
||||
const bNodeTreeInterfaceSocket *group_input = tree.interface_inputs()[index];
|
||||
const bNodeSocketType *typeinfo = group_input->socket_typeinfo();
|
||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) :
|
||||
SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
if (!nodes::socket_type_supports_fields(type)) {
|
||||
new_inferencing_interface.inputs[index] = InputSocketFieldType::None;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ static Vector<ReferenceSetInfo> find_reference_sets(
|
||||
for (const int input_i : interface_inputs.index_range()) {
|
||||
const bNodeTreeInterfaceSocket &interface_input = *interface_inputs[input_i];
|
||||
const bNodeSocketType *stype = interface_input.socket_typeinfo();
|
||||
const eNodeSocketDatatype socket_type = stype ? eNodeSocketDatatype(stype->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype socket_type = stype ? stype->type : SOCK_CUSTOM;
|
||||
if (can_contain_reference(socket_type)) {
|
||||
reference_sets.append({ReferenceSetType::GroupInputReferenceSet, input_i});
|
||||
}
|
||||
@@ -253,7 +253,7 @@ static Vector<ReferenceSetInfo> find_reference_sets(
|
||||
for (const int output_i : interface_outputs.index_range()) {
|
||||
const bNodeTreeInterfaceSocket &interface_output = *interface_outputs[output_i];
|
||||
const bNodeSocketType *stype = interface_output.socket_typeinfo();
|
||||
const eNodeSocketDatatype socket_type = stype ? eNodeSocketDatatype(stype->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype socket_type = stype ? stype->type : SOCK_CUSTOM;
|
||||
if (can_contain_referenced_data(socket_type)) {
|
||||
r_group_output_reference_sets.append(
|
||||
reference_sets.append_and_get_index({ReferenceSetType::GroupOutputData, output_i}));
|
||||
@@ -263,7 +263,7 @@ static Vector<ReferenceSetInfo> find_reference_sets(
|
||||
for (const int input_i : interface_inputs.index_range()) {
|
||||
const bNodeTreeInterfaceSocket &interface_input = *interface_inputs[input_i];
|
||||
const bNodeSocketType *stype = interface_input.socket_typeinfo();
|
||||
const eNodeSocketDatatype socket_type = stype ? eNodeSocketDatatype(stype->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype socket_type = stype ? stype->type : SOCK_CUSTOM;
|
||||
if (can_contain_referenced_data(socket_type)) {
|
||||
for (const bNode *node : tree.group_input_nodes()) {
|
||||
const bNodeSocket &socket = node->output_socket(input_i);
|
||||
@@ -865,8 +865,7 @@ static aal::RelationsInNode get_tree_relations(
|
||||
|
||||
for (const int input_i : tree.interface_inputs().index_range()) {
|
||||
const bNodeTreeInterfaceSocket &interface_input = *tree.interface_inputs()[input_i];
|
||||
const eNodeSocketDatatype socket_type = eNodeSocketDatatype(
|
||||
interface_input.socket_typeinfo()->type);
|
||||
const eNodeSocketDatatype socket_type = interface_input.socket_typeinfo()->type;
|
||||
if (can_contain_referenced_data(socket_type)) {
|
||||
BitVector<> required_data(required_data_by_socket.group_size(), false);
|
||||
for (const bNode *input_node : tree.group_input_nodes()) {
|
||||
|
||||
@@ -106,8 +106,9 @@ static int get_internal_link_type_priority(const bNodeSocketType *from, const bN
|
||||
return 2;
|
||||
case SOCK_BOOLEAN:
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
case SOCK_VECTOR:
|
||||
switch (from->type) {
|
||||
case SOCK_VECTOR:
|
||||
@@ -118,8 +119,9 @@ static int get_internal_link_type_priority(const bNodeSocketType *from, const bN
|
||||
return 2;
|
||||
case SOCK_BOOLEAN:
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
case SOCK_FLOAT:
|
||||
switch (from->type) {
|
||||
case SOCK_FLOAT:
|
||||
@@ -132,8 +134,9 @@ static int get_internal_link_type_priority(const bNodeSocketType *from, const bN
|
||||
return 2;
|
||||
case SOCK_VECTOR:
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
case SOCK_INT:
|
||||
switch (from->type) {
|
||||
case SOCK_INT:
|
||||
@@ -146,8 +149,9 @@ static int get_internal_link_type_priority(const bNodeSocketType *from, const bN
|
||||
return 2;
|
||||
case SOCK_VECTOR:
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
case SOCK_BOOLEAN:
|
||||
switch (from->type) {
|
||||
case SOCK_BOOLEAN:
|
||||
@@ -160,8 +164,9 @@ static int get_internal_link_type_priority(const bNodeSocketType *from, const bN
|
||||
return 2;
|
||||
case SOCK_VECTOR:
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
case SOCK_ROTATION:
|
||||
switch (from->type) {
|
||||
case SOCK_ROTATION:
|
||||
@@ -170,8 +175,11 @@ static int get_internal_link_type_priority(const bNodeSocketType *from, const bN
|
||||
return 2;
|
||||
case SOCK_FLOAT:
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* The rest of the socket types only allow an internal link if both the input and output socket
|
||||
|
||||
@@ -282,8 +282,7 @@ bNodeSocket &version_node_add_socket(bNodeTree &ntree,
|
||||
BLI_addtail(&node.outputs, socket);
|
||||
}
|
||||
|
||||
node_socket_init_default_value_data(
|
||||
eNodeSocketDatatype(stype->type), stype->subtype, &socket->default_value);
|
||||
node_socket_init_default_value_data(stype->type, stype->subtype, &socket->default_value);
|
||||
|
||||
BKE_ntree_update_tag_socket_new(&ntree, socket);
|
||||
return *socket;
|
||||
|
||||
@@ -504,7 +504,7 @@ static Map<StringRef, ID *> gather_input_ids(const Main &bmain,
|
||||
return;
|
||||
}
|
||||
const std::optional<ID_Type> id_type = socket_type_to_id_type(
|
||||
eNodeSocketDatatype(input->socket_typeinfo()->type));
|
||||
input->socket_typeinfo()->type);
|
||||
if (!id_type) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3056,7 +3056,7 @@ static bool check_geometry_node_group_sockets(wmOperator *op, const bNodeTree *t
|
||||
return false;
|
||||
}
|
||||
const bke::bNodeSocketType *typeinfo = first_output->socket_typeinfo();
|
||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
if (type != SOCK_GEOMETRY) {
|
||||
BKE_report(op->reports, RPT_ERROR, "The first output must be a geometry socket");
|
||||
return false;
|
||||
|
||||
@@ -184,7 +184,7 @@ static void search_link_ops_for_asset_metadata(const bNodeTree &node_tree,
|
||||
continue;
|
||||
}
|
||||
eNodeSocketDatatype from = eNodeSocketDatatype(socket.type);
|
||||
eNodeSocketDatatype to = eNodeSocketDatatype(socket_type->type);
|
||||
eNodeSocketDatatype to = socket_type->type;
|
||||
if (socket.in_out == SOCK_OUT) {
|
||||
std::swap(from, to);
|
||||
}
|
||||
@@ -298,9 +298,8 @@ static void gather_socket_link_operations(const bContext &C,
|
||||
{
|
||||
const bke::bNodeSocketType *from_typeinfo = bke::node_socket_type_find(
|
||||
interface_socket.socket_type);
|
||||
const eNodeSocketDatatype from = from_typeinfo ? eNodeSocketDatatype(from_typeinfo->type) :
|
||||
SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype to = eNodeSocketDatatype(socket.typeinfo->type);
|
||||
const eNodeSocketDatatype from = from_typeinfo ? from_typeinfo->type : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype to = socket.typeinfo->type;
|
||||
if (node_tree.typeinfo->validate_link && !node_tree.typeinfo->validate_link(from, to)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ static const EnumPropertyItem *rna_NodeTreeInterfaceSocket_structure_type_itemf(
|
||||
|
||||
const bool is_geometry_nodes = ntree->type == NTREE_GEOMETRY;
|
||||
|
||||
const eNodeSocketDatatype socket_type = eNodeSocketDatatype(socket->socket_typeinfo()->type);
|
||||
const eNodeSocketDatatype socket_type = socket->socket_typeinfo()->type;
|
||||
const bool supports_fields = is_geometry_nodes &&
|
||||
blender::nodes::socket_type_supports_fields(socket_type);
|
||||
const bool supports_grids = is_geometry_nodes &&
|
||||
|
||||
@@ -914,7 +914,7 @@ static void check_property_socket_sync(const Object *ob,
|
||||
for (const int i : nmd->node_group->interface_inputs().index_range()) {
|
||||
const bNodeTreeInterfaceSocket *socket = nmd->node_group->interface_inputs()[i];
|
||||
const bke::bNodeSocketType *typeinfo = socket->socket_typeinfo();
|
||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
if (type == SOCK_GEOMETRY) {
|
||||
geometry_socket_count++;
|
||||
}
|
||||
@@ -947,7 +947,7 @@ static void check_property_socket_sync(const Object *ob,
|
||||
if (geometry_socket_count == 1) {
|
||||
const bNodeTreeInterfaceSocket *first_socket = nmd->node_group->interface_inputs()[0];
|
||||
const bke::bNodeSocketType *typeinfo = first_socket->socket_typeinfo();
|
||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
if (type != SOCK_GEOMETRY) {
|
||||
BKE_modifier_set_error(ob, md, "Node group's geometry input must be the first");
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ static void add_attribute_search_or_value_buttons(DrawGroupInputsContext &ctx,
|
||||
const bNodeTreeInterfaceSocket &socket)
|
||||
{
|
||||
const bke::bNodeSocketType *typeinfo = socket.socket_typeinfo();
|
||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
const std::string rna_path_attribute_name = fmt::format(
|
||||
"[\"{}{}\"]", BLI_str_escape(socket.identifier), nodes::input_attribute_name_suffix);
|
||||
|
||||
@@ -495,7 +495,7 @@ static void draw_property_for_socket(DrawGroupInputsContext &ctx,
|
||||
* information about what type of ID to select for editing the values. This is because
|
||||
* pointer IDProperties contain no information about their type. */
|
||||
const bke::bNodeSocketType *typeinfo = socket.socket_typeinfo();
|
||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
const char *name = socket.name ? IFACE_(socket.name) : "";
|
||||
switch (type) {
|
||||
case SOCK_OBJECT: {
|
||||
@@ -758,7 +758,7 @@ static bool has_output_attribute(const bNodeTree *tree)
|
||||
}
|
||||
for (const bNodeTreeInterfaceSocket *interface_socket : tree->interface_outputs()) {
|
||||
const bke::bNodeSocketType *typeinfo = interface_socket->socket_typeinfo();
|
||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
if (nodes::socket_type_has_attribute_toggle(type)) {
|
||||
return true;
|
||||
}
|
||||
@@ -787,8 +787,7 @@ static void draw_output_attributes_panel(DrawGroupInputsContext &ctx, uiLayout *
|
||||
if (ctx.tree != nullptr && !ctx.properties.is_empty()) {
|
||||
for (const bNodeTreeInterfaceSocket *socket : ctx.tree->interface_outputs()) {
|
||||
const bke::bNodeSocketType *typeinfo = socket->socket_typeinfo();
|
||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) :
|
||||
SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
if (nodes::socket_type_has_attribute_toggle(type)) {
|
||||
draw_property_for_output_socket(ctx, layout, *socket);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ std::unique_ptr<IDProperty, bke::idprop::IDPropertyDeleter> id_property_create_f
|
||||
}
|
||||
const StringRefNull identifier = socket.identifier;
|
||||
const bke::bNodeSocketType *typeinfo = socket.socket_typeinfo();
|
||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
switch (type) {
|
||||
case SOCK_FLOAT: {
|
||||
const bNodeSocketValueFloat *value = static_cast<const bNodeSocketValueFloat *>(
|
||||
@@ -362,7 +362,7 @@ static bool old_id_property_type_matches_socket_convert_to_new(
|
||||
const bool use_name_for_ids)
|
||||
{
|
||||
const bke::bNodeSocketType *typeinfo = socket.socket_typeinfo();
|
||||
const eNodeSocketDatatype type = typeinfo ? eNodeSocketDatatype(typeinfo->type) : SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
switch (type) {
|
||||
case SOCK_FLOAT:
|
||||
if (!ELEM(old_property.type, IDP_FLOAT, IDP_INT, IDP_DOUBLE)) {
|
||||
@@ -642,8 +642,7 @@ static void initialize_group_input(const bNodeTree &tree,
|
||||
{
|
||||
const bNodeTreeInterfaceSocket &io_input = *tree.interface_inputs()[input_index];
|
||||
const bke::bNodeSocketType *typeinfo = io_input.socket_typeinfo();
|
||||
const eNodeSocketDatatype socket_data_type = typeinfo ? eNodeSocketDatatype(typeinfo->type) :
|
||||
SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype socket_data_type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
const IDProperty *property = properties.lookup_key_default_as(io_input.identifier, nullptr);
|
||||
if (property == nullptr) {
|
||||
typeinfo->get_geometry_nodes_cpp_value(io_input.socket_data, r_value);
|
||||
@@ -901,8 +900,7 @@ bke::GeometrySet execute_geometry_nodes_on_geometry(const bNodeTree &btree,
|
||||
for (const int i : btree.interface_inputs().index_range()) {
|
||||
const bNodeTreeInterfaceSocket &interface_socket = *btree.interface_inputs()[i];
|
||||
const bke::bNodeSocketType *typeinfo = interface_socket.socket_typeinfo();
|
||||
const eNodeSocketDatatype socket_type = typeinfo ? eNodeSocketDatatype(typeinfo->type) :
|
||||
SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype socket_type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
if (socket_type == SOCK_GEOMETRY && i == 0) {
|
||||
param_inputs[function.inputs.main[0]] = &input_geometry;
|
||||
continue;
|
||||
@@ -982,8 +980,7 @@ void update_input_properties_from_node_tree(const bNodeTree &tree,
|
||||
const bNodeTreeInterfaceSocket &socket = *tree_inputs[i];
|
||||
const StringRefNull socket_identifier = socket.identifier;
|
||||
const bke::bNodeSocketType *typeinfo = socket.socket_typeinfo();
|
||||
const eNodeSocketDatatype socket_type = typeinfo ? eNodeSocketDatatype(typeinfo->type) :
|
||||
SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype socket_type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
IDProperty *new_prop = id_property_create_from_socket(
|
||||
socket, input_structure_types[i], use_name_for_ids)
|
||||
.release();
|
||||
@@ -1053,8 +1050,7 @@ void update_output_properties_from_node_tree(const bNodeTree &tree,
|
||||
const bNodeTreeInterfaceSocket &socket = *tree_outputs[i];
|
||||
const StringRefNull socket_identifier = socket.identifier;
|
||||
const bke::bNodeSocketType *typeinfo = socket.socket_typeinfo();
|
||||
const eNodeSocketDatatype socket_type = typeinfo ? eNodeSocketDatatype(typeinfo->type) :
|
||||
SOCK_CUSTOM;
|
||||
const eNodeSocketDatatype socket_type = typeinfo ? typeinfo->type : SOCK_CUSTOM;
|
||||
if (!socket_type_has_attribute_toggle(socket_type)) {
|
||||
continue;
|
||||
}
|
||||
@@ -1104,7 +1100,7 @@ void get_geometry_nodes_input_base_values(const bNodeTree &btree,
|
||||
if (!stype) {
|
||||
continue;
|
||||
}
|
||||
const eNodeSocketDatatype socket_type = eNodeSocketDatatype(stype->type);
|
||||
const eNodeSocketDatatype socket_type = stype->type;
|
||||
if (!stype->base_cpp_type || !stype->geometry_nodes_cpp_type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -573,8 +573,9 @@ static bool set_modifier_value(bContext &C,
|
||||
const float3 euler = float3(math::to_euler(rotation));
|
||||
return set_rna_property_float3(C, object.id, main_prop_rna_path, euler);
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<SocketValueVariant> get_logged_socket_value(geo_eval_log::GeoTreeLog &tree_log,
|
||||
|
||||
@@ -268,7 +268,7 @@ static BaseSocketDeclarationBuilder &build_interface_socket_declaration(
|
||||
|
||||
BaseSocketDeclarationBuilder *decl = nullptr;
|
||||
if (base_typeinfo) {
|
||||
datatype = eNodeSocketDatatype(base_typeinfo->type);
|
||||
datatype = base_typeinfo->type;
|
||||
switch (datatype) {
|
||||
case SOCK_FLOAT: {
|
||||
const auto &value = node_interface::get_socket_data_as<bNodeSocketValueFloat>(io_socket);
|
||||
|
||||
@@ -978,7 +978,7 @@ std::optional<ImplicitInputValueFn> get_implicit_input_value_fn(const NodeDefaul
|
||||
bool socket_type_supports_default_input_type(const bke::bNodeSocketType &socket_type,
|
||||
const NodeDefaultInputType input_type)
|
||||
{
|
||||
const eNodeSocketDatatype stype = eNodeSocketDatatype(socket_type.type);
|
||||
const eNodeSocketDatatype stype = socket_type.type;
|
||||
switch (input_type) {
|
||||
case NODE_DEFAULT_INPUT_VALUE:
|
||||
return true;
|
||||
|
||||
@@ -800,9 +800,8 @@ void node_socket_init_default_value(bNodeSocket *sock)
|
||||
return; /* already initialized */
|
||||
}
|
||||
|
||||
node_socket_init_default_value_data(eNodeSocketDatatype(sock->typeinfo->type),
|
||||
PropertySubType(sock->typeinfo->subtype),
|
||||
&sock->default_value);
|
||||
node_socket_init_default_value_data(
|
||||
sock->typeinfo->type, PropertySubType(sock->typeinfo->subtype), &sock->default_value);
|
||||
}
|
||||
|
||||
void node_socket_copy_default_value(bNodeSocket *to, const bNodeSocket *from)
|
||||
@@ -823,8 +822,7 @@ void node_socket_copy_default_value(bNodeSocket *to, const bNodeSocket *from)
|
||||
STRNCPY(to->name, from->label);
|
||||
}
|
||||
|
||||
node_socket_copy_default_value_data(
|
||||
eNodeSocketDatatype(to->typeinfo->type), to->default_value, from->default_value);
|
||||
node_socket_copy_default_value_data(to->typeinfo->type, to->default_value, from->default_value);
|
||||
|
||||
to->flag |= (from->flag & SOCK_HIDE_VALUE);
|
||||
}
|
||||
@@ -857,7 +855,7 @@ static void standard_node_socket_interface_from_socket(ID * /*id*/,
|
||||
void ED_init_standard_node_socket_type(bke::bNodeSocketType *);
|
||||
|
||||
static bke::bNodeSocketType *make_standard_socket_type(
|
||||
int type, int subtype, std::optional<int> dimensions = std::nullopt)
|
||||
const eNodeSocketDatatype type, int subtype, std::optional<int> dimensions = std::nullopt)
|
||||
{
|
||||
const StringRefNull socket_idname = *bke::node_static_socket_type(type, subtype, dimensions);
|
||||
const StringRefNull interface_idname = *bke::node_static_socket_interface_type_new(
|
||||
|
||||
Reference in New Issue
Block a user