Example #1
0
void Node::copy_value(const SocketType& socket, const Node& other, const SocketType& other_socket)
{
	assert(socket.type == other_socket.type);

	if(socket.is_array()) {
		switch(socket.type) {
			case SocketType::BOOLEAN_ARRAY: copy_array<bool>(this, socket, &other, other_socket); break;
			case SocketType::FLOAT_ARRAY: copy_array<float>(this, socket, &other, other_socket); break;
			case SocketType::INT_ARRAY: copy_array<int>(this, socket, &other, other_socket); break;
			case SocketType::COLOR_ARRAY: copy_array<float3>(this, socket, &other, other_socket); break;
			case SocketType::VECTOR_ARRAY: copy_array<float3>(this, socket, &other, other_socket); break;
			case SocketType::POINT_ARRAY: copy_array<float3>(this, socket, &other, other_socket); break;
			case SocketType::NORMAL_ARRAY: copy_array<float3>(this, socket, &other, other_socket); break;
			case SocketType::POINT2_ARRAY: copy_array<float2>(this, socket, &other, other_socket); break;
			case SocketType::STRING_ARRAY: copy_array<ustring>(this, socket, &other, other_socket); break;
			case SocketType::TRANSFORM_ARRAY: copy_array<Transform>(this, socket, &other, other_socket); break;
			case SocketType::NODE_ARRAY: copy_array<void*>(this, socket, &other, other_socket); break;
			default: assert(0); break;
		}
	}
	else {
		const void *src = ((char*)&other) + other_socket.struct_offset;
		void *dst = ((char*)this) + socket.struct_offset;
		memcpy(dst, src, socket.size());
	}
}
Example #2
0
static void value_hash(const Node *node, const SocketType& socket, MD5Hash& md5)
{
	md5.append(((uint8_t*)node) + socket.struct_offset, socket.size());
}
Example #3
0
void Node::set_default_value(const SocketType& socket)
{
	const void *src = socket.default_value;
	void *dst = ((char*)this) + socket.struct_offset;
	memcpy(dst, src, socket.size());
}
Example #4
0
bool Node::has_default_value(const SocketType& input) const
{
	const void *src = input.default_value;
	void *dst = &get_socket_value<char>(this, input);
	return memcmp(dst, src, input.size()) == 0;
}