[Bf-blender-cvs] [c19b363256a] geometry-nodes: Geometry Nodes: Support exposing string sockets to the modifier
Hans Goudey
noreply at git.blender.org
Fri Nov 27 18:21:13 CET 2020
Commit: c19b363256a733c968fe1ad56885ce9ff164dda5
Author: Hans Goudey
Date: Fri Nov 27 12:21:08 2020 -0500
Branches: geometry-nodes
https://developer.blender.org/rBc19b363256a733c968fe1ad56885ce9ff164dda5
Geometry Nodes: Support exposing string sockets to the modifier
Create a string IDProperty in the modifier initialized with the socket's
default value.
===================================================================
M source/blender/modifiers/intern/MOD_nodes.cc
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc
index 86efd086f6f..d91a7c5d78d 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -622,6 +622,28 @@ static const SocketPropertyType *get_socket_property_type(const bNodeSocket &bso
};
return &boolean_type;
}
+ case SOCK_STRING: {
+ static const SocketPropertyType string_type = {
+ [](const bNodeSocket &socket, const char *name) {
+ bNodeSocketValueString *value = (bNodeSocketValueString *)socket.default_value;
+ return IDP_NewString(
+ value->value, name, BLI_strnlen(value->value, sizeof(value->value)) + 1);
+ },
+ nullptr,
+ nullptr,
+ [](const bNodeSocket &socket, const char *name) {
+ bNodeSocketValueString *value = (bNodeSocketValueString *)socket.default_value;
+ return IDP_NewString(
+ value->value, name, BLI_strnlen(value->value, sizeof(value->value)) + 1);
+ },
+ nullptr,
+ [](const IDProperty &property) { return property.type == IDP_STRING; },
+ [](const IDProperty &property, void *r_value) {
+ new (r_value) std::string(IDP_String(&property));
+ },
+ };
+ return &string_type;
+ }
default: {
return nullptr;
}
More information about the Bf-blender-cvs
mailing list