Blender  V2.93
node.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "graph/node.h"
18 #include "graph/node_type.h"
19 
20 #include "util/util_foreach.h"
21 #include "util/util_md5.h"
22 #include "util/util_param.h"
23 #include "util/util_transform.h"
24 
26 
27 /* Node Type */
28 
30 {
31 }
32 
33 Node::Node(const NodeType *type_, ustring name_) : name(name_), type(type_)
34 {
35  assert(type);
36 
37  owner = nullptr;
38  tag_modified();
39 
40  /* assign non-empty name, convenient for debugging */
41  if (name.empty()) {
42  name = type->name;
43  }
44 
45  /* initialize default values */
46  foreach (const SocketType &socket, type->inputs) {
47  set_default_value(socket);
48  }
49 }
50 
52 {
53 }
54 
55 #ifndef NDEBUG
56 static bool is_socket_float3(const SocketType &socket)
57 {
58  return socket.type == SocketType::COLOR || socket.type == SocketType::POINT ||
59  socket.type == SocketType::VECTOR || socket.type == SocketType::NORMAL;
60 }
61 
62 static bool is_socket_array_float3(const SocketType &socket)
63 {
64  return socket.type == SocketType::COLOR_ARRAY || socket.type == SocketType::POINT_ARRAY ||
66 }
67 #endif
68 
69 /* set values */
70 void Node::set(const SocketType &input, bool value)
71 {
72  assert(input.type == SocketType::BOOLEAN);
73  set_if_different(input, value);
74 }
75 
76 void Node::set(const SocketType &input, int value)
77 {
78  assert((input.type == SocketType::INT || input.type == SocketType::ENUM));
79  set_if_different(input, value);
80 }
81 
82 void Node::set(const SocketType &input, uint value)
83 {
84  assert(input.type == SocketType::UINT);
85  set_if_different(input, value);
86 }
87 
88 void Node::set(const SocketType &input, float value)
89 {
90  assert(input.type == SocketType::FLOAT);
91  set_if_different(input, value);
92 }
93 
94 void Node::set(const SocketType &input, float2 value)
95 {
96  assert(input.type == SocketType::POINT2);
97  set_if_different(input, value);
98 }
99 
100 void Node::set(const SocketType &input, float3 value)
101 {
102  assert(is_socket_float3(input));
103  set_if_different(input, value);
104 }
105 
106 void Node::set(const SocketType &input, const char *value)
107 {
108  set(input, ustring(value));
109 }
110 
111 void Node::set(const SocketType &input, ustring value)
112 {
113  if (input.type == SocketType::STRING) {
114  set_if_different(input, value);
115  }
116  else if (input.type == SocketType::ENUM) {
117  const NodeEnum &enm = *input.enum_values;
118  if (enm.exists(value)) {
119  set_if_different(input, enm[value]);
120  }
121  else {
122  assert(0);
123  }
124  }
125  else {
126  assert(0);
127  }
128 }
129 
130 void Node::set(const SocketType &input, const Transform &value)
131 {
132  assert(input.type == SocketType::TRANSFORM);
133  set_if_different(input, value);
134 }
135 
136 void Node::set(const SocketType &input, Node *value)
137 {
138  assert(input.type == SocketType::NODE);
139  set_if_different(input, value);
140 }
141 
142 /* set array values */
143 void Node::set(const SocketType &input, array<bool> &value)
144 {
145  assert(input.type == SocketType::BOOLEAN_ARRAY);
146  set_if_different(input, value);
147 }
148 
149 void Node::set(const SocketType &input, array<int> &value)
150 {
151  assert(input.type == SocketType::INT_ARRAY);
152  set_if_different(input, value);
153 }
154 
155 void Node::set(const SocketType &input, array<float> &value)
156 {
157  assert(input.type == SocketType::FLOAT_ARRAY);
158  set_if_different(input, value);
159 }
160 
161 void Node::set(const SocketType &input, array<float2> &value)
162 {
163  assert(input.type == SocketType::POINT2_ARRAY);
164  set_if_different(input, value);
165 }
166 
167 void Node::set(const SocketType &input, array<float3> &value)
168 {
169  assert(is_socket_array_float3(input));
170  set_if_different(input, value);
171 }
172 
173 void Node::set(const SocketType &input, array<ustring> &value)
174 {
175  assert(input.type == SocketType::STRING_ARRAY);
176  set_if_different(input, value);
177 }
178 
179 void Node::set(const SocketType &input, array<Transform> &value)
180 {
181  assert(input.type == SocketType::TRANSFORM_ARRAY);
182  set_if_different(input, value);
183 }
184 
185 void Node::set(const SocketType &input, array<Node *> &value)
186 {
187  assert(input.type == SocketType::NODE_ARRAY);
188  set_if_different(input, value);
189 }
190 
191 /* get values */
192 bool Node::get_bool(const SocketType &input) const
193 {
194  assert(input.type == SocketType::BOOLEAN);
195  return get_socket_value<bool>(this, input);
196 }
197 
198 int Node::get_int(const SocketType &input) const
199 {
200  assert(input.type == SocketType::INT || input.type == SocketType::ENUM);
201  return get_socket_value<int>(this, input);
202 }
203 
204 uint Node::get_uint(const SocketType &input) const
205 {
206  assert(input.type == SocketType::UINT);
207  return get_socket_value<uint>(this, input);
208 }
209 
210 float Node::get_float(const SocketType &input) const
211 {
212  assert(input.type == SocketType::FLOAT);
213  return get_socket_value<float>(this, input);
214 }
215 
216 float2 Node::get_float2(const SocketType &input) const
217 {
218  assert(input.type == SocketType::POINT2);
219  return get_socket_value<float2>(this, input);
220 }
221 
222 float3 Node::get_float3(const SocketType &input) const
223 {
224  assert(is_socket_float3(input));
225  return get_socket_value<float3>(this, input);
226 }
227 
228 ustring Node::get_string(const SocketType &input) const
229 {
230  if (input.type == SocketType::STRING) {
231  return get_socket_value<ustring>(this, input);
232  }
233  else if (input.type == SocketType::ENUM) {
234  const NodeEnum &enm = *input.enum_values;
235  int intvalue = get_socket_value<int>(this, input);
236  return (enm.exists(intvalue)) ? enm[intvalue] : ustring();
237  }
238  else {
239  assert(0);
240  return ustring();
241  }
242 }
243 
245 {
246  assert(input.type == SocketType::TRANSFORM);
247  return get_socket_value<Transform>(this, input);
248 }
249 
250 Node *Node::get_node(const SocketType &input) const
251 {
252  assert(input.type == SocketType::NODE);
253  return get_socket_value<Node *>(this, input);
254 }
255 
256 /* get array values */
257 const array<bool> &Node::get_bool_array(const SocketType &input) const
258 {
259  assert(input.type == SocketType::BOOLEAN_ARRAY);
260  return get_socket_value<array<bool>>(this, input);
261 }
262 
263 const array<int> &Node::get_int_array(const SocketType &input) const
264 {
265  assert(input.type == SocketType::INT_ARRAY);
266  return get_socket_value<array<int>>(this, input);
267 }
268 
270 {
271  assert(input.type == SocketType::FLOAT_ARRAY);
272  return get_socket_value<array<float>>(this, input);
273 }
274 
276 {
277  assert(input.type == SocketType::POINT2_ARRAY);
278  return get_socket_value<array<float2>>(this, input);
279 }
280 
282 {
283  assert(is_socket_array_float3(input));
284  return get_socket_value<array<float3>>(this, input);
285 }
286 
288 {
289  assert(input.type == SocketType::STRING_ARRAY);
290  return get_socket_value<array<ustring>>(this, input);
291 }
292 
294 {
295  assert(input.type == SocketType::TRANSFORM_ARRAY);
296  return get_socket_value<array<Transform>>(this, input);
297 }
298 
300 {
301  assert(input.type == SocketType::NODE_ARRAY);
302  return get_socket_value<array<Node *>>(this, input);
303 }
304 
305 /* generic value operations */
306 
307 bool Node::has_default_value(const SocketType &input) const
308 {
309  const void *src = input.default_value;
310  void *dst = &get_socket_value<char>(this, input);
311  return memcmp(dst, src, input.size()) == 0;
312 }
313 
315 {
316  const void *src = socket.default_value;
317  void *dst = ((char *)this) + socket.struct_offset;
318  if (socket.size() > 0) {
319  memcpy(dst, src, socket.size());
320  }
321 }
322 
323 template<typename T>
324 static void copy_array(const Node *node,
325  const SocketType &socket,
326  const Node *other,
327  const SocketType &other_socket)
328 {
329  const array<T> *src = (const array<T> *)(((char *)other) + other_socket.struct_offset);
330  array<T> *dst = (array<T> *)(((char *)node) + socket.struct_offset);
331  *dst = *src;
332 }
333 
334 void Node::copy_value(const SocketType &socket, const Node &other, const SocketType &other_socket)
335 {
336  assert(socket.type == other_socket.type);
337 
338  if (socket.is_array()) {
339  switch (socket.type) {
341  copy_array<bool>(this, socket, &other, other_socket);
342  break;
344  copy_array<float>(this, socket, &other, other_socket);
345  break;
347  copy_array<int>(this, socket, &other, other_socket);
348  break;
350  copy_array<float3>(this, socket, &other, other_socket);
351  break;
353  copy_array<float3>(this, socket, &other, other_socket);
354  break;
356  copy_array<float3>(this, socket, &other, other_socket);
357  break;
359  copy_array<float3>(this, socket, &other, other_socket);
360  break;
362  copy_array<float2>(this, socket, &other, other_socket);
363  break;
365  copy_array<ustring>(this, socket, &other, other_socket);
366  break;
368  copy_array<Transform>(this, socket, &other, other_socket);
369  break;
371  copy_array<void *>(this, socket, &other, other_socket);
372  break;
373  default:
374  assert(0);
375  break;
376  }
377  }
378  else {
379  const void *src = ((char *)&other) + other_socket.struct_offset;
380  void *dst = ((char *)this) + socket.struct_offset;
381  memcpy(dst, src, socket.size());
382  }
383 }
384 
385 void Node::set_value(const SocketType &socket, const Node &other, const SocketType &other_socket)
386 {
387  assert(socket.type == other_socket.type);
388  (void)other_socket;
389 
390  if (socket.is_array()) {
391  switch (socket.type) {
393  set(socket, get_socket_value<array<bool>>(&other, socket));
394  break;
396  set(socket, get_socket_value<array<float>>(&other, socket));
397  break;
399  set(socket, get_socket_value<array<int>>(&other, socket));
400  break;
405  set(socket, get_socket_value<array<float3>>(&other, socket));
406  break;
408  set(socket, get_socket_value<array<float2>>(&other, socket));
409  break;
411  set(socket, get_socket_value<array<ustring>>(&other, socket));
412  break;
414  set(socket, get_socket_value<array<Transform>>(&other, socket));
415  break;
417  set(socket, get_socket_value<array<Node *>>(&other, socket));
418  break;
419  default:
420  assert(0);
421  break;
422  }
423  }
424  else {
425  switch (socket.type) {
426  case SocketType::BOOLEAN:
427  set(socket, get_socket_value<bool>(&other, socket));
428  break;
429  case SocketType::FLOAT:
430  set(socket, get_socket_value<float>(&other, socket));
431  break;
432  case SocketType::INT:
433  set(socket, get_socket_value<int>(&other, socket));
434  break;
435  case SocketType::UINT:
436  set(socket, get_socket_value<uint>(&other, socket));
437  break;
438  case SocketType::COLOR:
439  case SocketType::VECTOR:
440  case SocketType::POINT:
441  case SocketType::NORMAL:
442  set(socket, get_socket_value<float3>(&other, socket));
443  break;
444  case SocketType::POINT2:
445  set(socket, get_socket_value<float2>(&other, socket));
446  break;
447  case SocketType::STRING:
448  set(socket, get_socket_value<ustring>(&other, socket));
449  break;
450  case SocketType::ENUM:
451  set(socket, get_socket_value<int>(&other, socket));
452  break;
454  set(socket, get_socket_value<Transform>(&other, socket));
455  break;
456  case SocketType::NODE:
457  set(socket, get_socket_value<Node *>(&other, socket));
458  break;
459  default:
460  assert(0);
461  break;
462  }
463  }
464 }
465 
466 template<typename T>
467 static bool is_array_equal(const Node *node, const Node *other, const SocketType &socket)
468 {
469  const array<T> *a = (const array<T> *)(((char *)node) + socket.struct_offset);
470  const array<T> *b = (const array<T> *)(((char *)other) + socket.struct_offset);
471  return *a == *b;
472 }
473 
474 template<typename T>
475 static bool is_value_equal(const Node *node, const Node *other, const SocketType &socket)
476 {
477  const T *a = (const T *)(((char *)node) + socket.struct_offset);
478  const T *b = (const T *)(((char *)other) + socket.struct_offset);
479  return *a == *b;
480 }
481 
482 bool Node::equals_value(const Node &other, const SocketType &socket) const
483 {
484  switch (socket.type) {
485  case SocketType::BOOLEAN:
486  return is_value_equal<bool>(this, &other, socket);
487  case SocketType::FLOAT:
488  return is_value_equal<float>(this, &other, socket);
489  case SocketType::INT:
490  return is_value_equal<int>(this, &other, socket);
491  case SocketType::UINT:
492  return is_value_equal<uint>(this, &other, socket);
493  case SocketType::COLOR:
494  return is_value_equal<float3>(this, &other, socket);
495  case SocketType::VECTOR:
496  return is_value_equal<float3>(this, &other, socket);
497  case SocketType::POINT:
498  return is_value_equal<float3>(this, &other, socket);
499  case SocketType::NORMAL:
500  return is_value_equal<float3>(this, &other, socket);
501  case SocketType::POINT2:
502  return is_value_equal<float2>(this, &other, socket);
503  case SocketType::CLOSURE:
504  return true;
505  case SocketType::STRING:
506  return is_value_equal<ustring>(this, &other, socket);
507  case SocketType::ENUM:
508  return is_value_equal<int>(this, &other, socket);
510  return is_value_equal<Transform>(this, &other, socket);
511  case SocketType::NODE:
512  return is_value_equal<void *>(this, &other, socket);
513 
515  return is_array_equal<bool>(this, &other, socket);
517  return is_array_equal<float>(this, &other, socket);
519  return is_array_equal<int>(this, &other, socket);
521  return is_array_equal<float3>(this, &other, socket);
523  return is_array_equal<float3>(this, &other, socket);
525  return is_array_equal<float3>(this, &other, socket);
527  return is_array_equal<float3>(this, &other, socket);
529  return is_array_equal<float2>(this, &other, socket);
531  return is_array_equal<ustring>(this, &other, socket);
533  return is_array_equal<Transform>(this, &other, socket);
535  return is_array_equal<void *>(this, &other, socket);
536 
538  return true;
539  }
540 
541  return true;
542 }
543 
544 /* equals */
545 
546 bool Node::equals(const Node &other) const
547 {
548  assert(type == other.type);
549 
550  foreach (const SocketType &socket, type->inputs) {
551  if (!equals_value(other, socket))
552  return false;
553  }
554 
555  return true;
556 }
557 
558 /* Hash */
559 
560 namespace {
561 
562 template<typename T> void value_hash(const Node *node, const SocketType &socket, MD5Hash &md5)
563 {
564  md5.append(((uint8_t *)node) + socket.struct_offset, socket.size());
565 }
566 
567 void float3_hash(const Node *node, const SocketType &socket, MD5Hash &md5)
568 {
569  /* Don't compare 4th element used for padding. */
570  md5.append(((uint8_t *)node) + socket.struct_offset, sizeof(float) * 3);
571 }
572 
573 template<typename T> void array_hash(const Node *node, const SocketType &socket, MD5Hash &md5)
574 {
575  const array<T> &a = *(const array<T> *)(((char *)node) + socket.struct_offset);
576  for (size_t i = 0; i < a.size(); i++) {
577  md5.append((uint8_t *)&a[i], sizeof(T));
578  }
579 }
580 
581 void float3_array_hash(const Node *node, const SocketType &socket, MD5Hash &md5)
582 {
583  /* Don't compare 4th element used for padding. */
584  const array<float3> &a = *(const array<float3> *)(((char *)node) + socket.struct_offset);
585  for (size_t i = 0; i < a.size(); i++) {
586  md5.append((uint8_t *)&a[i], sizeof(float) * 3);
587  }
588 }
589 
590 } // namespace
591 
592 void Node::hash(MD5Hash &md5)
593 {
594  md5.append(type->name.string());
595 
596  foreach (const SocketType &socket, type->inputs) {
597  md5.append(socket.name.string());
598 
599  switch (socket.type) {
600  case SocketType::BOOLEAN:
601  value_hash<bool>(this, socket, md5);
602  break;
603  case SocketType::FLOAT:
604  value_hash<float>(this, socket, md5);
605  break;
606  case SocketType::INT:
607  value_hash<int>(this, socket, md5);
608  break;
609  case SocketType::UINT:
610  value_hash<uint>(this, socket, md5);
611  break;
612  case SocketType::COLOR:
613  float3_hash(this, socket, md5);
614  break;
615  case SocketType::VECTOR:
616  float3_hash(this, socket, md5);
617  break;
618  case SocketType::POINT:
619  float3_hash(this, socket, md5);
620  break;
621  case SocketType::NORMAL:
622  float3_hash(this, socket, md5);
623  break;
624  case SocketType::POINT2:
625  value_hash<float2>(this, socket, md5);
626  break;
627  case SocketType::CLOSURE:
628  break;
629  case SocketType::STRING:
630  value_hash<ustring>(this, socket, md5);
631  break;
632  case SocketType::ENUM:
633  value_hash<int>(this, socket, md5);
634  break;
636  value_hash<Transform>(this, socket, md5);
637  break;
638  case SocketType::NODE:
639  value_hash<void *>(this, socket, md5);
640  break;
641 
643  array_hash<bool>(this, socket, md5);
644  break;
646  array_hash<float>(this, socket, md5);
647  break;
649  array_hash<int>(this, socket, md5);
650  break;
652  float3_array_hash(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  array_hash<float2>(this, socket, md5);
665  break;
667  array_hash<ustring>(this, socket, md5);
668  break;
670  array_hash<Transform>(this, socket, md5);
671  break;
673  array_hash<void *>(this, socket, md5);
674  break;
675 
677  break;
678  }
679  }
680 }
681 
682 namespace {
683 
684 template<typename T> size_t array_size_in_bytes(const Node *node, const SocketType &socket)
685 {
686  const array<T> &a = *(const array<T> *)(((char *)node) + socket.struct_offset);
687  return a.size() * sizeof(T);
688 }
689 
690 } // namespace
691 
693 {
694  size_t total_size = 0;
695  foreach (const SocketType &socket, type->inputs) {
696  switch (socket.type) {
697  case SocketType::BOOLEAN:
698  case SocketType::FLOAT:
699  case SocketType::INT:
700  case SocketType::UINT:
701  case SocketType::COLOR:
702  case SocketType::VECTOR:
703  case SocketType::POINT:
704  case SocketType::NORMAL:
705  case SocketType::POINT2:
706  case SocketType::CLOSURE:
707  case SocketType::STRING:
708  case SocketType::ENUM:
710  case SocketType::NODE:
711  total_size += socket.size();
712  break;
713 
715  total_size += array_size_in_bytes<bool>(this, socket);
716  break;
718  total_size += array_size_in_bytes<float>(this, socket);
719  break;
721  total_size += array_size_in_bytes<int>(this, socket);
722  break;
724  total_size += array_size_in_bytes<float3>(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<float2>(this, socket);
737  break;
739  total_size += array_size_in_bytes<ustring>(this, socket);
740  break;
742  total_size += array_size_in_bytes<Transform>(this, socket);
743  break;
745  total_size += array_size_in_bytes<void *>(this, socket);
746  break;
747 
749  break;
750  }
751  }
752  return total_size;
753 }
754 
755 bool Node::is_a(const NodeType *type_)
756 {
757  for (const NodeType *base = type; base; base = base->base) {
758  if (base == type_) {
759  return true;
760  }
761  }
762  return false;
763 }
764 
766 {
767  return owner;
768 }
769 
770 void Node::set_owner(const NodeOwner *owner_)
771 {
772  assert(owner_);
773  owner = owner_;
774 }
775 
776 bool Node::socket_is_modified(const SocketType &input) const
777 {
778  return (socket_modified & input.modified_flag_bit) != 0;
779 }
780 
782 {
783  return socket_modified != 0;
784 }
785 
787 {
788  socket_modified = ~0ull;
789 }
790 
792 {
793  socket_modified = 0;
794 }
795 
796 template<typename T> void Node::set_if_different(const SocketType &input, T value)
797 {
798  if (get_socket_value<T>(this, input) == value) {
799  return;
800  }
801 
802  get_socket_value<T>(this, input) = value;
804 }
805 
806 template<typename T> void Node::set_if_different(const SocketType &input, array<T> &value)
807 {
808  if (!socket_is_modified(input)) {
809  if (get_socket_value<array<T>>(this, input) == value) {
810  return;
811  }
812  }
813 
814  get_socket_value<array<T>>(this, input).steal_data(value);
816 }
817 
819 {
820  printf("Node : %s\n", name.c_str());
821  for (auto &socket : type->inputs) {
822  if (socket_is_modified(socket)) {
823  printf("-- socket modified : %s\n", socket.name.c_str());
824  }
825  }
826 }
827 
typedef float(TangentPoint)[2]
unsigned int uint
Definition: BLI_sys_types.h:83
_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
void append(const uint8_t *data, int size)
Definition: util_md5.cpp:274
OperationNode * node
#define CCL_NAMESPACE_END
#define T
static unsigned a[3]
Definition: RandGen.cpp:92
static bool is_socket_array_float3(const SocketType &socket)
Definition: node.cpp:62
static bool is_array_equal(const Node *node, const Node *other, const SocketType &socket)
Definition: node.cpp:467
static bool is_value_equal(const Node *node, const Node *other, const SocketType &socket)
Definition: node.cpp:475
static bool is_socket_float3(const SocketType &socket)
Definition: node.cpp:56
static void copy_array(const Node *node, const SocketType &socket, const Node *other, const SocketType &other_socket)
Definition: node.cpp:324
unsigned char uint8_t
Definition: stdint.h:81
bool exists(ustring x) const
Definition: node_enum.h:39
Definition: node.h:94
virtual ~NodeOwner()
Definition: node.cpp:29
vector< SocketType, std::allocator< SocketType > > inputs
Definition: node_type.h:131
const NodeType * base
Definition: node_type.h:130
ustring name
Definition: node_type.h:128
Definition: node.h:98
bool has_default_value(const SocketType &input) const
Definition: node.cpp:307
const array< float3 > & get_float3_array(const SocketType &input) const
Definition: node.cpp:281
bool is_modified()
Definition: node.cpp:781
static T & get_socket_value(const Node *node, const SocketType &socket)
Definition: node.h:183
bool equals(const Node &other) const
Definition: node.cpp:546
const array< float > & get_float_array(const SocketType &input) const
Definition: node.cpp:269
const array< int > & get_int_array(const SocketType &input) const
Definition: node.cpp:263
const NodeOwner * owner
Definition: node.h:181
float get_float(const SocketType &input) const
Definition: node.cpp:210
Transform get_transform(const SocketType &input) const
Definition: node.cpp:244
void set(const SocketType &input, bool value)
Definition: node.cpp:70
const NodeType * type
Definition: node.h:175
void set_value(const SocketType &input, const Node &other, const SocketType &other_input)
Definition: node.cpp:385
float3 get_float3(const SocketType &input) const
Definition: node.cpp:222
void set_default_value(const SocketType &input)
Definition: node.cpp:314
const array< bool > & get_bool_array(const SocketType &input) const
Definition: node.cpp:257
void copy_value(const SocketType &input, const Node &other, const SocketType &other_input)
Definition: node.cpp:334
const array< Node * > & get_node_array(const SocketType &input) const
Definition: node.cpp:299
ustring name
Definition: node.h:174
size_t get_total_size_in_bytes() const
Definition: node.cpp:692
SocketModifiedFlags socket_modified
Definition: node.h:188
bool get_bool(const SocketType &input) const
Definition: node.cpp:192
float2 get_float2(const SocketType &input) const
Definition: node.cpp:216
void clear_modified()
Definition: node.cpp:791
const array< ustring > & get_string_array(const SocketType &input) const
Definition: node.cpp:287
const array< float2 > & get_float2_array(const SocketType &input) const
Definition: node.cpp:275
void hash(MD5Hash &md5)
Definition: node.cpp:592
bool socket_is_modified(const SocketType &input) const
Definition: node.cpp:776
ustring get_string(const SocketType &input) const
Definition: node.cpp:228
bool is_a(const NodeType *type)
Definition: node.cpp:755
void set_if_different(const SocketType &input, T value)
Definition: node.cpp:796
Node * get_node(const SocketType &input) const
Definition: node.cpp:250
virtual ~Node()=0
Definition: node.cpp:51
const NodeOwner * get_owner() const
Definition: node.cpp:765
void tag_modified()
Definition: node.cpp:786
uint get_uint(const SocketType &input) const
Definition: node.cpp:204
Node(const NodeType *type, ustring name=ustring())
Definition: node.cpp:33
int get_int(const SocketType &input) const
Definition: node.cpp:198
const array< Transform > & get_transform_array(const SocketType &input) const
Definition: node.cpp:293
bool equals_value(const Node &other, const SocketType &input) const
Definition: node.cpp:482
void print_modified_sockets() const
Definition: node.cpp:818
void set_owner(const NodeOwner *owner_)
Definition: node.cpp:770
size_t size() const
Definition: node_type.cpp:25
const void * default_value
Definition: node_type.h:88
ustring name
Definition: node_type.h:85
@ BOOLEAN_ARRAY
Definition: node_type.h:54
@ TRANSFORM_ARRAY
Definition: node_type.h:63
@ NODE_ARRAY
Definition: node_type.h:64
@ POINT2_ARRAY
Definition: node_type.h:61
@ FLOAT_ARRAY
Definition: node_type.h:55
@ NORMAL_ARRAY
Definition: node_type.h:60
@ VECTOR_ARRAY
Definition: node_type.h:58
@ POINT_ARRAY
Definition: node_type.h:59
@ STRING_ARRAY
Definition: node_type.h:62
@ COLOR_ARRAY
Definition: node_type.h:57
Type type
Definition: node_type.h:86
const NodeEnum * enum_values
Definition: node_type.h:89
SocketModifiedFlags modified_flag_bit
Definition: node_type.h:93
bool is_array() const
Definition: node_type.cpp:30
int struct_offset
Definition: node_type.h:87