MCPcopy Create free account
hub / github.com/blender/cycles / xml_write_node

Function xml_write_node

src/graph/node_xml.cpp:235–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235xml_node xml_write_node(Node *node, xml_node xml_root)
236{
237 xml_node xml_node = xml_root.append_child(node->type->name.c_str());
238
239 xml_node.append_attribute("name") = node->name.c_str();
240
241 for (const SocketType &socket : node->type->inputs) {
242 if (socket.type == SocketType::CLOSURE || socket.type == SocketType::UNDEFINED) {
243 continue;
244 }
245 if (socket.flags & SocketType::INTERNAL) {
246 continue;
247 }
248 if (node->has_default_value(socket)) {
249 continue;
250 }
251
252 xml_attribute attr = xml_node.append_attribute(socket.name.c_str());
253
254 switch (socket.type) {
255 case SocketType::BOOLEAN: {
256 attr = xml_write_boolean(node->get_bool(socket));
257 break;
258 }
259 case SocketType::BOOLEAN_ARRAY: {
260 std::stringstream ss;
261 const array<bool> &value = node->get_bool_array(socket);
262 for (size_t i = 0; i < value.size(); i++) {
263 ss << xml_write_boolean(value[i]);
264 if (i != value.size() - 1) {
265 ss << " ";
266 }
267 }
268 attr = ss.str().c_str();
269 break;
270 }
271 case SocketType::FLOAT: {
272 attr = (double)node->get_float(socket);
273 break;
274 }
275 case SocketType::FLOAT_ARRAY: {
276 std::stringstream ss;
277 const array<float> &value = node->get_float_array(socket);
278 for (size_t i = 0; i < value.size(); i++) {
279 ss << value[i];
280 if (i != value.size() - 1) {
281 ss << " ";
282 }
283 }
284 attr = ss.str().c_str();
285 break;
286 }
287 case SocketType::INT: {
288 attr = node->get_int(socket);
289 break;
290 }
291 case SocketType::UINT: {
292 attr = node->get_uint(socket);

Callers

nothing calls this directly

Calls 14

xml_write_booleanFunction · 0.85
string_printfFunction · 0.85
has_default_valueMethod · 0.80
get_boolMethod · 0.80
get_floatMethod · 0.80
get_intMethod · 0.80
get_uintMethod · 0.80
get_uint64Method · 0.80
get_float3Method · 0.80
get_float2Method · 0.80
get_stringMethod · 0.80
get_transformMethod · 0.80

Tested by

no test coverage detected