Blender  V3.3
graph/node.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #include "graph/node.h"
5 #include "graph/node_type.h"
6 
7 #include "util/foreach.h"
8 #include "util/md5.h"
9 #include "util/param.h"
10 #include "util/transform.h"
11 
13 
14 /* Node Type */
15 
17 {
18 }
19 
20 Node::Node(const NodeType *type_, ustring name_) : name(name_), type(type_)
21 {
22  assert(type);
23 
24  owner = nullptr;
25  tag_modified();
26 
27  /* assign non-empty name, convenient for debugging */
28  if (name.empty()) {
29  name = type->name;
30  }
31 
32  /* initialize default values */
33  foreach (const SocketType &socket, type->inputs) {
34  set_default_value(socket);
35  }
36 }
37 
39 {
40 }
41 
42 #ifndef NDEBUG
43 static bool is_socket_float3(const SocketType &socket)
44 {
45  return socket.type == SocketType::COLOR || socket.type == SocketType::POINT ||
46  socket.type == SocketType::VECTOR || socket.type == SocketType::NORMAL;
47 }
48 
49 static bool is_socket_array_float3(const SocketType &socket)
50 {
51  return socket.type == SocketType::COLOR_ARRAY || socket.type == SocketType::POINT_ARRAY ||
53 }
54 #endif
55 
56 /* set values */
57 void Node::set(const SocketType &input, bool value)
58 {
59  assert(input.type == SocketType::BOOLEAN);
60  set_if_different(input, value);
61 }
62 
63 void Node::set(const SocketType &input, int value)
64 {
65  assert((input.type == SocketType::INT || input.type == SocketType::ENUM));
66  set_if_different(input, value);
67 }
68 
69 void Node::set(const SocketType &input, uint value)
70 {
71  assert(input.type == SocketType::UINT);
72  set_if_different(input, value);
73 }
74 
75 void Node::set(const SocketType &input, float value)
76 {
77  assert(input.type == SocketType::FLOAT);
78  set_if_different(input, value);
79 }
80 
81 void Node::set(const SocketType &input, float2 value)
82 {
83  assert(input.type == SocketType::POINT2);
84  set_if_different(input, value);
85 }
86 
87 void Node::set(const SocketType &input, float3 value)
88 {
89  assert(is_socket_float3(input));
90  set_if_different(input, value);
91 }
92 
93 void Node::set(const SocketType &input, const char *value)
94 {
95  set(input, ustring(value));
96 }
97 
98 void Node::set(const SocketType &input, ustring value)
99 {
100  if (input.type == SocketType::STRING) {
101  set_if_different(input, value);
102  }
103  else if (input.type == SocketType::ENUM) {
104  const NodeEnum &enm = *input.enum_values;
105  if (enm.exists(value)) {
106  set_if_different(input, enm[value]);
107  }
108  else {
109  assert(0);
110  }
111  }
112  else {
113  assert(0);
114  }
115 }
116 
117 void Node::set(const SocketType &input, const Transform &value)
118 {
119  assert(input.type == SocketType::TRANSFORM);
120  set_if_different(input, value);
121 }
122 
123 void Node::set(const SocketType &input, Node *value)
124 {
125  assert(input.type == SocketType::NODE);
126  set_if_different(input, value);
127 }
128 
129 /* set array values */
130 void Node::set(const SocketType &input, array<bool> &value)
131 {
132  assert(input.type == SocketType::BOOLEAN_ARRAY);
133  set_if_different(input, value);
134 }
135 
136 void Node::set(const SocketType &input, array<int> &value)
137 {
138  assert(input.type == SocketType::INT_ARRAY);
139  set_if_different(input, value);
140 }
141 
143 {
144  assert(input.type == SocketType::FLOAT_ARRAY);
145  set_if_different(input, value);
146 }
147 
149 {
150  assert(input.type == SocketType::POINT2_ARRAY);
151  set_if_different(input, value);
152 }
153 
155 {
156  assert(is_socket_array_float3(input));
157  set_if_different(input, value);
158 }
159 
161 {
162  assert(input.type == SocketType::STRING_ARRAY);
163  set_if_different(input, value);
164 }
165 
167 {
168  assert(input.type == SocketType::TRANSFORM_ARRAY);
169  set_if_different(input, value);
170 }
171 
173 {
174  assert(input.type == SocketType::NODE_ARRAY);
175  set_if_different(input, value);
176 }
177 
178 /* get values */
179 bool Node::get_bool(const SocketType &input) const
180 {
181  assert(input.type == SocketType::BOOLEAN);
182  return get_socket_value<bool>(this, input);
183 }
184 
185 int Node::get_int(const SocketType &input) const
186 {
187  assert(input.type == SocketType::INT || input.type == SocketType::ENUM);
188  return get_socket_value<int>(this, input);
189 }
190 
192 {
193  assert(input.type == SocketType::UINT);
194  return get_socket_value<uint>(this, input);
195 }
196 
197 float Node::get_float(const SocketType &input) const
198 {
199  assert(input.type == SocketType::FLOAT);
200  return get_socket_value<float>(this, input);
201 }
202 
204 {
205  assert(input.type == SocketType::POINT2);
206  return get_socket_value<float2>(this, input);
207 }
208 
210 {
211  assert(is_socket_float3(input));
212  return get_socket_value<float3>(this, input);
213 }
214 
215 ustring Node::get_string(const SocketType &input) const
216 {
217  if (input.type == SocketType::STRING) {
218  return get_socket_value<ustring>(this, input);
219  }
220  else if (input.type == SocketType::ENUM) {
221  const NodeEnum &enm = *input.enum_values;
222  int intvalue = get_socket_value<int>(this, input);
223  return (enm.exists(intvalue)) ? enm[intvalue] : ustring();
224  }
225  else {
226  assert(0);
227  return ustring();
228  }
229 }
230 
232 {
233  assert(input.type == SocketType::TRANSFORM);
234  return get_socket_value<Transform>(this, input);
235 }
236 
238 {
239  assert(input.type == SocketType::NODE);
240  return get_socket_value<Node *>(this, input);
241 }
242 
243 /* get array values */
245 {
246  assert(input.type == SocketType::BOOLEAN_ARRAY);
247  return get_socket_value<array<bool>>(this, input);
248 }
249 
251 {
252  assert(input.type == SocketType::INT_ARRAY);
253  return get_socket_value<array<int>>(this, input);
254 }
255 
257 {
258  assert(input.type == SocketType::FLOAT_ARRAY);
259  return get_socket_value<array<float>>(this, input);
260 }
261 
263 {
264  assert(input.type == SocketType::POINT2_ARRAY);
265  return get_socket_value<array<float2>>(this, input);
266 }
267 
269 {
270  assert(is_socket_array_float3(input));
271  return get_socket_value<array<float3>>(this, input);
272 }
273 
275 {
276  assert(input.type == SocketType::STRING_ARRAY);
277  return get_socket_value<array<ustring>>(this, input);
278 }
279 
281 {
282  assert(input.type == SocketType::TRANSFORM_ARRAY);
283  return get_socket_value<array<Transform>>(this, input);
284 }
285 
287 {
288  assert(input.type == SocketType::NODE_ARRAY);
289  return get_socket_value<array<Node *>>(this, input);
290 }
291 
292 /* generic value operations */
293 
295 {
296  const void *src = input.default_value;
297  void *dst = &get_socket_value<char>(this, input);
298  return memcmp(dst, src, input.size()) == 0;
299 }
300 
302 {
303  const void *src = socket.default_value;
304  void *dst = ((char *)this) + socket.struct_offset;
305  if (socket.size() > 0) {
306  memcpy(dst, src, socket.size());
307  }
308 }
309 
310 template<typename T>
311 static void copy_array(const Node *node,
312  const SocketType &socket,
313  const Node *other,
314  const SocketType &other_socket)
315 {
316  const array<T> *src = (const array<T> *)(((char *)other) + other_socket.struct_offset);
317  array<T> *dst = (array<T> *)(((char *)node) + socket.struct_offset);
318  *dst = *src;
319 }
320 
321 void Node::copy_value(const SocketType &socket, const Node &other, const SocketType &other_socket)
322 {
323  assert(socket.type == other_socket.type);
324 
325  if (socket.is_array()) {
326  switch (socket.type) {
328  copy_array<bool>(this, socket, &other, other_socket);
329  break;
331  copy_array<float>(this, socket, &other, other_socket);
332  break;
334  copy_array<int>(this, socket, &other, other_socket);
335  break;
337  copy_array<float3>(this, socket, &other, other_socket);
338  break;
340  copy_array<float3>(this, socket, &other, other_socket);
341  break;
343  copy_array<float3>(this, socket, &other, other_socket);
344  break;
346  copy_array<float3>(this, socket, &other, other_socket);
347  break;
349  copy_array<float2>(this, socket, &other, other_socket);
350  break;
352  copy_array<ustring>(this, socket, &other, other_socket);
353  break;
355  copy_array<Transform>(this, socket, &other, other_socket);
356  break;
357  case SocketType::NODE_ARRAY: {
358  copy_array<void *>(this, socket, &other, other_socket);
359 
360  array<Node *> &node_array = get_socket_value<array<Node *>>(this, socket);
361 
362  for (Node *node : node_array) {
363  node->reference();
364  }
365 
366  break;
367  }
368  default:
369  assert(0);
370  break;
371  }
372  }
373  else {
374  const void *src = ((char *)&other) + other_socket.struct_offset;
375  void *dst = ((char *)this) + socket.struct_offset;
376  memcpy(dst, src, socket.size());
377 
378  if (socket.type == SocketType::NODE) {
379  Node *node = get_socket_value<Node *>(this, socket);
380 
381  if (node) {
382  node->reference();
383  }
384  }
385  }
386 }
387 
388 void Node::set_value(const SocketType &socket, const Node &other, const SocketType &other_socket)
389 {
390  assert(socket.type == other_socket.type);
391  (void)other_socket;
392 
393  if (socket.is_array()) {
394  switch (socket.type) {
396  set(socket, get_socket_value<array<bool>>(&other, socket));
397  break;
399  set(socket, get_socket_value<array<float>>(&other, socket));
400  break;
402  set(socket, get_socket_value<array<int>>(&other, socket));
403  break;
408  set(socket, get_socket_value<array<float3>>(&other, socket));
409  break;
411  set(socket, get_socket_value<array<float2>>(&other, socket));
412  break;
414  set(socket, get_socket_value<array<ustring>>(&other, socket));
415  break;
417  set(socket, get_socket_value<array<Transform>>(&other, socket));
418  break;
420  set(socket, get_socket_value<array<Node *>>(&other, socket));
421  break;
422  default:
423  assert(0);
424  break;
425  }
426  }
427  else {
428  switch (socket.type) {
429  case SocketType::BOOLEAN:
430  set(socket, get_socket_value<bool>(&other, socket));
431  break;
432  case SocketType::FLOAT:
433  set(socket, get_socket_value<float>(&other, socket));
434  break;
435  case SocketType::INT:
436  set(socket, get_socket_value<int>(&other, socket));
437  break;
438  case SocketType::UINT:
439  set(socket, get_socket_value<uint>(&other, socket));
440  break;
441  case SocketType::COLOR:
442  case SocketType::VECTOR:
443  case SocketType::POINT:
444  case SocketType::NORMAL:
445  set(socket, get_socket_value<float3>(&other, socket));
446  break;
447  case SocketType::POINT2:
448  set(socket, get_socket_value<float2>(&other, socket));
449  break;
450  case SocketType::STRING:
451  set(socket, get_socket_value<ustring>(&other, socket));
452  break;
453  case SocketType::ENUM:
454  set(socket, get_socket_value<int>(&other, socket));
455  break;
457  set(socket, get_socket_value<Transform>(&other, socket));
458  break;
459  case SocketType::NODE:
460  set(socket, get_socket_value<Node *>(&other, socket));
461  break;
462  default:
463  assert(0);
464  break;
465  }
466  }
467 }
468 
469 template<typename T>
470 static bool is_array_equal(const Node *node, const Node *other, const SocketType &socket)
471 {
472  const array<T> *a = (const array<T> *)(((char *)node) + socket.struct_offset);
473  const array<T> *b = (const array<T> *)(((char *)other) + socket.struct_offset);
474  return *a == *b;
475 }
476 
477 template<typename T>
478 static bool is_value_equal(const Node *node, const Node *other, const SocketType &socket)
479 {
480  const T *a = (const T *)(((char *)node) + socket.struct_offset);
481  const T *b = (const T *)(((char *)other) + socket.struct_offset);
482  return *a == *b;
483 }
484 
485 bool Node::equals_value(const Node &other, const SocketType &socket) const
486 {
487  switch (socket.type) {
488  case SocketType::BOOLEAN:
489  return is_value_equal<bool>(this, &other, socket);
490  case SocketType::FLOAT:
491  return is_value_equal<float>(this, &other, socket);
492  case SocketType::INT:
493  return is_value_equal<int>(this, &other, socket);
494  case SocketType::UINT:
495  return is_value_equal<uint>(this, &other, socket);
496  case SocketType::COLOR:
497  return is_value_equal<float3>(this, &other, socket);
498  case SocketType::VECTOR:
499  return is_value_equal<float3>(this, &other, socket);
500  case SocketType::POINT:
501  return is_value_equal<float3>(this, &other, socket);
502  case SocketType::NORMAL:
503  return is_value_equal<float3>(this, &other, socket);
504  case SocketType::POINT2:
505  return is_value_equal<float2>(this, &other, socket);
506  case SocketType::CLOSURE:
507  return true;
508  case SocketType::STRING:
509  return is_value_equal<ustring>(this, &other, socket);
510  case SocketType::ENUM:
511  return is_value_equal<int>(this, &other, socket);
513  return is_value_equal<Transform>(this, &other, socket);
514  case SocketType::NODE:
515  return is_value_equal<void *>(this, &other, socket);
516 
518  return is_array_equal<bool>(this, &other, socket);
520  return is_array_equal<float>(this, &other, socket);
522  return is_array_equal<int>(this, &other, socket);
524  return is_array_equal<float3>(this, &other, socket);
526  return is_array_equal<float3>(this, &other, socket);
528  return is_array_equal<float3>(this, &other, socket);
530  return is_array_equal<float3>(this, &other, socket);
532  return is_array_equal<float2>(this, &other, socket);
534  return is_array_equal<ustring>(this, &other, socket);
536  return is_array_equal<Transform>(this, &other, socket);
538  return is_array_equal<void *>(this, &other, socket);
539 
541  return true;
542  }
543 
544  return true;
545 }
546 
547 /* equals */
548 
549 bool Node::equals(const Node &other) const
550 {
551  assert(type == other.type);
552 
553  foreach (const SocketType &socket, type->inputs) {
554  if (!equals_value(other, socket))
555  return false;
556  }
557 
558  return true;
559 }
560 
561 /* Hash */
562 
563 namespace {
564 
565 template<typename T> void value_hash(const Node *node, const SocketType &socket, MD5Hash &md5)
566 {
567  md5.append(((uint8_t *)node) + socket.struct_offset, socket.size());
568 }
569 
570 void float3_hash(const Node *node, const SocketType &socket, MD5Hash &md5)
571 {
572  /* Don't compare 4th element used for padding. */
573  md5.append(((uint8_t *)node) + socket.struct_offset, sizeof(float) * 3);
574 }
575 
576 template<typename T> void array_hash(const Node *node, const SocketType &socket, MD5Hash &md5)
577 {
578  const array<T> &a = *(const array<T> *)(((char *)node) + socket.struct_offset);
579  for (size_t i = 0; i < a.size(); i++) {
580  md5.append((uint8_t *)&a[i], sizeof(T));
581  }
582 }
583 
584 void float3_array_hash(const Node *node, const SocketType &socket, MD5Hash &md5)
585 {
586  /* Don't compare 4th element used for padding. */
587  const array<float3> &a = *(const array<float3> *)(((char *)node) + socket.struct_offset);
588  for (size_t i = 0; i < a.size(); i++) {
589  md5.append((uint8_t *)&a[i], sizeof(float) * 3);
590  }
591 }
592 
593 } // namespace
594 
595 void Node::hash(MD5Hash &md5)
596 {
597  md5.append(type->name.string());
598 
599  foreach (const SocketType &socket, type->inputs) {
600  md5.append(socket.name.string());
601 
602  switch (socket.type) {
603  case SocketType::BOOLEAN:
604  value_hash<bool>(this, socket, md5);
605  break;
606  case SocketType::FLOAT:
607  value_hash<float>(this, socket, md5);
608  break;
609  case SocketType::INT:
610  value_hash<int>(this, socket, md5);
611  break;
612  case SocketType::UINT:
613  value_hash<uint>(this, socket, md5);
614  break;
615  case SocketType::COLOR:
616  float3_hash(this, socket, md5);
617  break;
618  case SocketType::VECTOR:
619  float3_hash(this, socket, md5);
620  break;
621  case SocketType::POINT:
622  float3_hash(this, socket, md5);
623  break;
624  case SocketType::NORMAL:
625  float3_hash(this, socket, md5);
626  break;
627  case SocketType::POINT2:
628  value_hash<float2>(this, socket, md5);
629  break;
630  case SocketType::CLOSURE:
631  break;
632  case SocketType::STRING:
633  value_hash<ustring>(this, socket, md5);
634  break;
635  case SocketType::ENUM:
636  value_hash<int>(this, socket, md5);
637  break;
639  value_hash<Transform>(this, socket, md5);
640  break;
641  case SocketType::NODE:
642  value_hash<void *>(this, socket, md5);
643  break;
644 
646  array_hash<bool>(this, socket, md5);
647  break;
649  array_hash<float>(this, socket, md5);
650  break;
652  array_hash<int>(this, socket, md5);
653  break;
655  float3_array_hash(this, socket, md5);
656  break;
658  float3_array_hash(this, socket, md5);
659  break;
661  float3_array_hash(this, socket, md5);
662  break;
664  float3_array_hash(this, socket, md5);
665  break;
667  array_hash<float2>(this, socket, md5);
668  break;
670  array_hash<ustring>(this, socket, md5);
671  break;
673  array_hash<Transform>(this, socket, md5);
674  break;
676  array_hash<void *>(this, socket, md5);
677  break;
678 
680  break;
681  }
682  }
683 }
684 
685 namespace {
686 
687 template<typename T> size_t array_size_in_bytes(const Node *node, const SocketType &socket)
688 {
689  const array<T> &a = *(const array<T> *)(((char *)node) + socket.struct_offset);
690  return a.size() * sizeof(T);
691 }
692 
693 } // namespace
694 
696 {
697  size_t total_size = 0;
698  foreach (const SocketType &socket, type->inputs) {
699  switch (socket.type) {
700  case SocketType::BOOLEAN:
701  case SocketType::FLOAT:
702  case SocketType::INT:
703  case SocketType::UINT:
704  case SocketType::COLOR:
705  case SocketType::VECTOR:
706  case SocketType::POINT:
707  case SocketType::NORMAL:
708  case SocketType::POINT2:
709  case SocketType::CLOSURE:
710  case SocketType::STRING:
711  case SocketType::ENUM:
713  case SocketType::NODE:
714  total_size += socket.size();
715  break;
716 
718  total_size += array_size_in_bytes<bool>(this, socket);
719  break;
721  total_size += array_size_in_bytes<float>(this, socket);
722  break;
724  total_size += array_size_in_bytes<int>(this, socket);
725  break;
727  total_size += array_size_in_bytes<float3>(this, socket);
728  break;
730  total_size += array_size_in_bytes<float3>(this, socket);
731  break;
733  total_size += array_size_in_bytes<float3>(this, socket);
734  break;
736  total_size += array_size_in_bytes<float3>(this, socket);
737  break;
739  total_size += array_size_in_bytes<float2>(this, socket);
740  break;
742  total_size += array_size_in_bytes<ustring>(this, socket);
743  break;
745  total_size += array_size_in_bytes<Transform>(this, socket);
746  break;
748  total_size += array_size_in_bytes<void *>(this, socket);
749  break;
750 
752  break;
753  }
754  }
755  return total_size;
756 }
757 
758 bool Node::is_a(const NodeType *type_)
759 {
760  for (const NodeType *base = type; base; base = base->base) {
761  if (base == type_) {
762  return true;
763  }
764  }
765  return false;
766 }
767 
769 {
770  return owner;
771 }
772 
773 void Node::set_owner(const NodeOwner *owner_)
774 {
775  assert(owner_);
776  owner = owner_;
777 }
778 
780 {
781  foreach (const SocketType &socket, type->inputs) {
782  if (socket.type == SocketType::NODE) {
783  Node *node = get_socket_value<Node *>(this, socket);
784 
785  if (node) {
786  node->dereference();
787  }
788  }
789  else if (socket.type == SocketType::NODE_ARRAY) {
790  const array<Node *> &nodes = get_socket_value<array<Node *>>(this, socket);
791 
792  for (Node *node : nodes) {
793  node->dereference();
794  }
795  }
796  }
797 }
798 
800 {
801  return (socket_modified & input.modified_flag_bit) != 0;
802 }
803 
804 bool Node::is_modified() const
805 {
806  return socket_modified != 0;
807 }
808 
810 {
811  socket_modified = ~0ull;
812 }
813 
815 {
816  socket_modified = 0;
817 }
818 
819 template<typename T> void Node::set_if_different(const SocketType &input, T value)
820 {
821  if (get_socket_value<T>(this, input) == value) {
822  return;
823  }
824 
825  get_socket_value<T>(this, input) = value;
826  socket_modified |= input.modified_flag_bit;
827 }
828 
830 {
831  if (get_socket_value<Node *>(this, input) == value) {
832  return;
833  }
834 
835  Node *old_node = get_socket_value<Node *>(this, input);
836  if (old_node) {
837  old_node->dereference();
838  }
839 
840  if (value) {
841  value->reference();
842  }
843 
844  get_socket_value<Node *>(this, input) = value;
845  socket_modified |= input.modified_flag_bit;
846 }
847 
848 template<typename T> void Node::set_if_different(const SocketType &input, array<T> &value)
849 {
850  if (!socket_is_modified(input)) {
851  if (get_socket_value<array<T>>(this, input) == value) {
852  return;
853  }
854  }
855 
856  get_socket_value<array<T>>(this, input).steal_data(value);
857  socket_modified |= input.modified_flag_bit;
858 }
859 
861 {
862  if (!socket_is_modified(input)) {
863  if (get_socket_value<array<Node *>>(this, input) == value) {
864  return;
865  }
866  }
867 
868  array<Node *> &old_nodes = get_socket_value<array<Node *>>(this, input);
869  for (Node *old_node : old_nodes) {
870  old_node->dereference();
871  }
872 
873  for (Node *new_node : value) {
874  new_node->reference();
875  }
876 
877  get_socket_value<array<Node *>>(this, input).steal_data(value);
878  socket_modified |= input.modified_flag_bit;
879 }
880 
882 {
883  printf("Node : %s\n", name.c_str());
884  for (auto &socket : type->inputs) {
885  if (socket_is_modified(socket)) {
886  printf("-- socket modified : %s\n", socket.name.c_str());
887  }
888  }
889 }
890 
typedef float(TangentPoint)[2]
unsigned int uint
Definition: BLI_sys_types.h:67
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Definition: md5.h:20
void append(const uint8_t *data, int size)
Definition: md5.cpp:256
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
OperationNode * node
SyclQueue void void * src
SyclQueue void void size_t num_bytes void
static bool is_socket_array_float3(const SocketType &socket)
Definition: graph/node.cpp:49
static bool is_array_equal(const Node *node, const Node *other, const SocketType &socket)
Definition: graph/node.cpp:470
static bool is_value_equal(const Node *node, const Node *other, const SocketType &socket)
Definition: graph/node.cpp:478
static bool is_socket_float3(const SocketType &socket)
Definition: graph/node.cpp:43
static void copy_array(const Node *node, const SocketType &socket, const Node *other, const SocketType &other_socket)
Definition: graph/node.cpp:311
ccl_global KernelShaderEvalInput * input
#define T
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
unsigned char uint8_t
Definition: stdint.h:78
bool exists(ustring x) const
Definition: node_enum.h:28
virtual ~NodeOwner()
Definition: graph/node.cpp:16
vector< SocketType, std::allocator< SocketType > > inputs
Definition: node_type.h:118
const NodeType * base
Definition: node_type.h:117
ustring name
Definition: node_type.h:115
bool has_default_value(const SocketType &input) const
Definition: graph/node.cpp:294
const array< float3 > & get_float3_array(const SocketType &input) const
Definition: graph/node.cpp:268
static T & get_socket_value(const Node *node, const SocketType &socket)
Definition: graph/node.h:207
bool equals(const Node &other) const
Definition: graph/node.cpp:549
const array< float > & get_float_array(const SocketType &input) const
Definition: graph/node.cpp:256
const array< int > & get_int_array(const SocketType &input) const
Definition: graph/node.cpp:250
void dereference()
Definition: graph/node.h:190
const NodeOwner * owner
Definition: graph/node.h:204
float get_float(const SocketType &input) const
Definition: graph/node.cpp:197
Transform get_transform(const SocketType &input) const
Definition: graph/node.cpp:231
void set(const SocketType &input, bool value)
Definition: graph/node.cpp:57
const NodeType * type
Definition: graph/node.h:175
void set_value(const SocketType &input, const Node &other, const SocketType &other_input)
Definition: graph/node.cpp:388
void dereference_all_used_nodes()
Definition: graph/node.cpp:779
float3 get_float3(const SocketType &input) const
Definition: graph/node.cpp:209
void set_default_value(const SocketType &input)
Definition: graph/node.cpp:301
const array< bool > & get_bool_array(const SocketType &input) const
Definition: graph/node.cpp:244
void copy_value(const SocketType &input, const Node &other, const SocketType &other_input)
Definition: graph/node.cpp:321
const array< Node * > & get_node_array(const SocketType &input) const
Definition: graph/node.cpp:286
ustring name
Definition: graph/node.h:174
size_t get_total_size_in_bytes() const
Definition: graph/node.cpp:695
SocketModifiedFlags socket_modified
Definition: graph/node.h:212
bool get_bool(const SocketType &input) const
Definition: graph/node.cpp:179
float2 get_float2(const SocketType &input) const
Definition: graph/node.cpp:203
void clear_modified()
Definition: graph/node.cpp:814
void reference()
Definition: graph/node.h:185
const array< ustring > & get_string_array(const SocketType &input) const
Definition: graph/node.cpp:274
const array< float2 > & get_float2_array(const SocketType &input) const
Definition: graph/node.cpp:262
void hash(MD5Hash &md5)
Definition: graph/node.cpp:595
bool socket_is_modified(const SocketType &input) const
Definition: graph/node.cpp:799
ustring get_string(const SocketType &input) const
Definition: graph/node.cpp:215
bool is_a(const NodeType *type)
Definition: graph/node.cpp:758
void set_if_different(const SocketType &input, T value)
Definition: graph/node.cpp:819
Node * get_node(const SocketType &input) const
Definition: graph/node.cpp:237
virtual ~Node()=0
Definition: graph/node.cpp:38
const NodeOwner * get_owner() const
Definition: graph/node.cpp:768
void tag_modified()
Definition: graph/node.cpp:809
bool is_modified() const
Definition: graph/node.cpp:804
uint get_uint(const SocketType &input) const
Definition: graph/node.cpp:191
Node(const NodeType *type, ustring name=ustring())
Definition: graph/node.cpp:20
int get_int(const SocketType &input) const
Definition: graph/node.cpp:185
const array< Transform > & get_transform_array(const SocketType &input) const
Definition: graph/node.cpp:280
bool equals_value(const Node &other, const SocketType &input) const
Definition: graph/node.cpp:485
void print_modified_sockets() const
Definition: graph/node.cpp:881
void set_owner(const NodeOwner *owner_)
Definition: graph/node.cpp:773
size_t size() const
Definition: node_type.cpp:12
const void * default_value
Definition: node_type.h:75
ustring name
Definition: node_type.h:72
@ BOOLEAN_ARRAY
Definition: node_type.h:41
@ TRANSFORM_ARRAY
Definition: node_type.h:50
@ NODE_ARRAY
Definition: node_type.h:51
@ POINT2_ARRAY
Definition: node_type.h:48
@ FLOAT_ARRAY
Definition: node_type.h:42
@ NORMAL_ARRAY
Definition: node_type.h:47
@ VECTOR_ARRAY
Definition: node_type.h:45
@ POINT_ARRAY
Definition: node_type.h:46
@ STRING_ARRAY
Definition: node_type.h:49
@ COLOR_ARRAY
Definition: node_type.h:44
Type type
Definition: node_type.h:73
bool is_array() const
Definition: node_type.cpp:17
int struct_offset
Definition: node_type.h:74