231 return (enm.
exists(intvalue)) ? enm[intvalue] : ustring();
302 const void *src =
input.default_value;
304 return memcmp(dst, src,
input.packed_size()) == 0;
309 const void *src =
input.default_value;
310 void *dst = ((
char *)
this) +
input.struct_offset;
311 if (
input.packed_size() > 0) {
312 memcpy(dst, src,
input.packed_size());
332 switch (socket.
type) {
368 for (
Node *node : node_array) {
380 const void *src = ((
char *)&other) + other_socket.
struct_offset;
400 switch (socket.
type) {
434 switch (socket.
type) {
496 switch (socket.
type) {
592 for (
size_t i = 0;
i < a.
size();
i++) {
593 md5.
append((uint8_t *)&a[
i],
sizeof(
T));
601 for (
size_t i = 0;
i < a.
size();
i++) {
602 md5.
append((uint8_t *)&a[
i],
sizeof(
float) * 3);
615 switch (socket.
type) {
617 value_hash<bool>(
this, socket, md5);
620 value_hash<float>(
this, socket, md5);
623 value_hash<int>(
this, socket, md5);
626 value_hash<uint>(
this, socket, md5);
629 value_hash<uint64_t>(
this, socket, md5);
632 float3_hash(
this, socket, md5);
635 float3_hash(
this, socket, md5);
638 float3_hash(
this, socket, md5);
641 float3_hash(
this, socket, md5);
644 value_hash<float2>(
this, socket, md5);
649 value_hash<ustring>(
this, socket, md5);
652 value_hash<int>(
this, socket, md5);
655 value_hash<Transform>(
this, socket, md5);
658 value_hash<void *>(
this, socket, md5);
662 array_hash<bool>(
this, socket, md5);
665 array_hash<float>(
this, socket, md5);
668 array_hash<int>(
this, socket, md5);
671 float3_array_hash(
this, socket, md5);
674 float3_array_hash(
this, socket, md5);
677 float3_array_hash(
this, socket, md5);
680 float3_array_hash(
this, socket, md5);
683 array_hash<float2>(
this, socket, md5);
686 array_hash<ustring>(
this, socket, md5);
689 array_hash<Transform>(
this, socket, md5);
692 array_hash<void *>(
this, socket, md5);
704template<
typename T>
size_t array_size_in_bytes(
const Node *node,
const SocketType &socket)
707 return a.
size() *
sizeof(
T);
714 size_t total_size = 0;
716 switch (socket.
type) {
736 total_size += array_size_in_bytes<bool>(
this, socket);
739 total_size += array_size_in_bytes<float>(
this, socket);
742 total_size += array_size_in_bytes<int>(
this, socket);
745 total_size += array_size_in_bytes<float3>(
this, socket);
748 total_size += array_size_in_bytes<float3>(
this, socket);
751 total_size += array_size_in_bytes<float3>(
this, socket);
754 total_size += array_size_in_bytes<float3>(
this, socket);
757 total_size += array_size_in_bytes<float2>(
this, socket);
760 total_size += array_size_in_bytes<ustring>(
this, socket);
763 total_size += array_size_in_bytes<Transform>(
this, socket);
766 total_size += array_size_in_bytes<void *>(
this, socket);
779 for (
const NodeType *base =
type; base; base = base->base) {
811 for (
Node *node : nodes) {
888 for (
Node *old_node : old_nodes) {
889 old_node->dereference();
892 for (
Node *new_node : value) {
893 new_node->reference();
903 for (
const auto &socket :
type->inputs) {
905 printf(
"-- socket modified : %s\n", socket.
name.c_str());
unsigned long long int uint64_t
void append(const uint8_t *data, const int nbytes)
#define CCL_NAMESPACE_END
#define assert(assertion)
static bool is_socket_array_float3(const SocketType &socket)
static bool is_array_equal(const Node *node, const Node *other, const SocketType &socket)
static bool is_value_equal(const Node *node, const Node *other, const SocketType &socket)
static bool is_socket_float3(const SocketType &socket)
static void copy_array(const Node *node, const SocketType &socket, const Node *other, const SocketType &other_socket)
bool exists(ustring x) const
bool has_default_value(const SocketType &input) const
const array< float3 > & get_float3_array(const SocketType &input) const
bool equals(const Node &other) const
const array< float > & get_float_array(const SocketType &input) const
const array< int > & get_int_array(const SocketType &input) const
float get_float(const SocketType &input) const
Transform get_transform(const SocketType &input) const
void set(const SocketType &input, bool value)
uint64_t get_uint64(const SocketType &input) const
void dereference_all_used_nodes()
float3 get_float3(const SocketType &input) const
void set_default_value(const SocketType &input)
static T & get_socket_value(const Node *node, const SocketType &socket)
const array< bool > & get_bool_array(const SocketType &input) const
const array< Node * > & get_node_array(const SocketType &input) const
void set_value(const SocketType &socket, const Node &other, const SocketType &other_socket)
size_t get_total_size_in_bytes() const
void copy_value(const SocketType &socket, const Node &other, const SocketType &other_socket)
SocketModifiedFlags socket_modified
bool get_bool(const SocketType &input) const
float2 get_float2(const SocketType &input) const
bool equals_value(const Node &other, const SocketType &socket) const
const array< ustring > & get_string_array(const SocketType &input) const
const array< float2 > & get_float2_array(const SocketType &input) const
bool socket_is_modified(const SocketType &input) const
ustring get_string(const SocketType &input) const
bool is_a(const NodeType *type)
void set_if_different(const SocketType &input, T value)
Node * get_node(const SocketType &input) const
const NodeOwner * get_owner() const
uint get_uint(const SocketType &input) const
Node(const NodeType *type, ustring name=ustring())
int get_int(const SocketType &input) const
const array< Transform > & get_transform_array(const SocketType &input) const
void print_modified_sockets() const
void set_owner(const NodeOwner *owner_)
size_t storage_size() const
size_t packed_size() const