19 using fn::FieldCPPType;
22 using fn::ValueOrFieldCPPType;
25 : input_geometry_log_(
std::move(logger.input_geometry_log_)),
26 output_geometry_log_(
std::move(logger.output_geometry_log_))
35 logger_allocators_.append(std::move(local_logger.allocator_));
42 logged_values_.append(std::move(value_of_sockets.
value));
45 SocketLog &socket_log = this->lookup_or_add_socket_log(log_by_tree_context, socket);
46 socket_log.value_ = value_log;
50 for (
NodeWithWarning &node_with_warning : local_logger.node_warnings_) {
51 NodeLog &node_log = this->lookup_or_add_node_log(log_by_tree_context,
52 node_with_warning.
node);
53 node_log.warnings_.append(node_with_warning.
warning);
57 NodeLog &node_log = this->lookup_or_add_node_log(log_by_tree_context,
58 node_with_exec_time.
node);
59 node_log.exec_time_ = node_with_exec_time.
exec_time;
63 NodeLog &node_log = this->lookup_or_add_node_log(log_by_tree_context, debug_message.
node);
68 local_logger.used_named_attributes_) {
69 NodeLog &node_log = this->lookup_or_add_node_log(log_by_tree_context,
70 node_with_attribute_name.
node);
71 node_log.used_named_attributes_.append(std::move(node_with_attribute_name.
attribute));
76 TreeLog &ModifierLog::lookup_or_add_tree_log(LogByTreeContext &log_by_tree_context,
79 TreeLog *tree_log = log_by_tree_context.lookup_default(&tree_context,
nullptr);
80 if (tree_log !=
nullptr) {
85 if (parent_context ==
nullptr) {
86 return *root_tree_logs_.get();
88 TreeLog &parent_log = this->lookup_or_add_tree_log(log_by_tree_context, *parent_context);
90 tree_log = owned_tree_log.get();
91 log_by_tree_context.add_new(&tree_context, tree_log);
92 parent_log.child_logs_.add_new(tree_context.
parent_node()->
name(), std::move(owned_tree_log));
96 NodeLog &ModifierLog::lookup_or_add_node_log(LogByTreeContext &log_by_tree_context, DNode
node)
98 TreeLog &tree_log = this->lookup_or_add_tree_log(log_by_tree_context, *
node.context());
99 NodeLog &node_log = *tree_log.node_logs_.lookup_or_add_cb(
node->name(), [&]() {
100 destruct_ptr<NodeLog> node_log = allocator_.construct<NodeLog>();
101 node_log->input_logs_.resize(node->inputs().size());
102 node_log->output_logs_.resize(node->outputs().size());
108 SocketLog &ModifierLog::lookup_or_add_socket_log(LogByTreeContext &log_by_tree_context,
111 NodeLog &node_log = this->lookup_or_add_node_log(log_by_tree_context, socket.node());
112 MutableSpan<SocketLog> socket_logs = socket->is_input() ? node_log.input_logs_ :
113 node_log.output_logs_;
114 SocketLog &socket_log = socket_logs[socket->index()];
120 if (root_tree_logs_) {
121 root_tree_logs_->foreach_node_log(fn);
127 return input_geometry_log_.get();
131 return output_geometry_log_.get();
137 if (node_log ==
nullptr) {
140 return node_log->get();
151 if (tree_log ==
nullptr) {
154 return tree_log->get();
159 for (
auto node_log : node_logs_.items()) {
163 for (
auto child : child_logs_.items()) {
164 child.value->foreach_node_log(fn);
172 if (index >= socket_logs.
size()) {
175 return &socket_logs[index];
191 if (field_input_nodes) {
192 field_inputs.
extend(field_input_nodes->deduplicated_nodes.begin(),
193 field_input_nodes->deduplicated_nodes.end());
198 const int index_a = (int)a.category();
199 const int index_b = (int)b.category();
200 if (index_a == index_b) {
201 return a.socket_inspection_name().size() < b.socket_inspection_name().size();
203 return index_a < index_b;
206 for (
const FieldInput &field_input : field_inputs) {
207 input_tooltips_.append(field_input.socket_inspection_name());
210 if (log_full_field) {
211 field_ = std::move(field);
215 GeometryValueLog::GeometryValueLog(
const GeometrySet &geometry_set,
bool log_full_geometry)
235 this->attributes_.append({attribute_id.name(), meta_data.domain, meta_data.data_type});
240 component_types_.append(
component->type());
244 MeshInfo &info = this->mesh_info.emplace();
252 CurveInfo &info = this->curve_info.emplace();
258 PointCloudInfo &info = this->pointcloud_info.emplace();
264 InstancesInfo &info = this->instances_info.emplace();
271 if (
const bke::CurvesEditHints *curve_edit_hints =
273 EditDataInfo &info = this->edit_data_info.emplace();
274 info.has_deform_matrices = curve_edit_hints->deform_mats.has_value();
275 info.has_deformed_positions = curve_edit_hints->positions.has_value();
284 if (log_full_geometry) {
285 full_geometry_ = std::make_unique<GeometrySet>(geometry_set);
286 full_geometry_->ensure_owns_direct_data();
294 for (
const SocketLog &socket_log : input_logs_) {
295 const ValueLog *value_log = socket_log.value();
310 if (snode.
id ==
nullptr) {
330 const ModifierLog *eval_log = ModifierLog::find_root_by_node_editor_context(snode);
331 if (eval_log ==
nullptr) {
338 TreeLog *current = eval_log->root_tree_logs_.get();
341 if (tree_log ==
nullptr) {
344 current = tree_log->get();
352 const TreeLog *tree_log = ModifierLog::find_tree_by_node_editor_context(snode);
353 if (tree_log ==
nullptr) {
362 const TreeLog *tree_log = ModifierLog::find_tree_by_node_editor_context(snode);
363 if (tree_log ==
nullptr) {
373 const NodeLog *node_log = ModifierLog::find_node_by_node_editor_context(snode,
node);
374 if (node_log ==
nullptr) {
380 const NodeLog *ModifierLog::find_node_by_spreadsheet_editor_context(
384 if (context_path.
size() <= 2) {
403 if (
object ==
nullptr) {
417 if (eval_log ==
nullptr) {
424 if (tree_log ==
nullptr) {
435 Span<DSocket> copied_sockets = allocator_->construct_array_copy(sockets);
437 bool log_full_geometry =
false;
438 for (
const DSocket &socket : sockets) {
439 if (main_logger_->log_full_sockets_.contains(socket)) {
440 log_full_geometry =
true;
447 geometry_set, log_full_geometry);
448 values_.append({copied_sockets, std::move(value_log)});
452 const void *value_or_field = value.
get();
453 if (value_or_field_type->is_field(value_or_field)) {
454 GField field = *value_or_field_type->get_field_ptr(value_or_field);
455 bool log_full_field =
false;
459 log_full_field =
true;
461 if (!log_full_field) {
462 for (
const DSocket &socket : sockets) {
463 if (main_logger_->log_full_sockets_.contains(socket)) {
464 log_full_field =
true;
470 std::move(field), log_full_field);
471 values_.append({copied_sockets, std::move(value_log)});
474 const CPPType &base_type = value_or_field_type->base_type();
475 const void *value = value_or_field_type->get_value_ptr(value_or_field);
480 values_.append({copied_sockets, std::move(value_log)});
484 void *
buffer = allocator_->allocate(
type.size(),
type.alignment());
488 values_.append({copied_sockets, std::move(value_log)});
500 node_warnings_.append({
node, {
type, std::move(message)}});
503 void LocalGeoLogger::log_execution_time(
DNode node, std::chrono::microseconds exec_time)
505 node_exec_times_.append({
node, exec_time});
508 void LocalGeoLogger::log_used_named_attribute(
DNode node,
509 std::string attribute_name,
512 used_named_attributes_.append({
node, {std::move(attribute_name), usage}});
515 void LocalGeoLogger::log_debug_message(
DNode node, std::string message)
517 node_debug_messages_.append({
node, std::move(message)});
Low-level operations for curves.
@ GEO_COMPONENT_TYPE_MESH
@ GEO_COMPONENT_TYPE_POINT_CLOUD
@ GEO_COMPONENT_TYPE_INSTANCES
@ GEO_COMPONENT_TYPE_EDIT
@ GEO_COMPONENT_TYPE_CURVE
@ GEO_COMPONENT_TYPE_VOLUME
#define LISTBASE_FOREACH(type, var, list)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static uint8 component(Color32 c, uint i)
@ SPREADSHEET_CONTEXT_OBJECT
@ SPREADSHEET_CONTEXT_MODIFIER
@ SPREADSHEET_CONTEXT_NODE
_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
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
void sort(btMatrix3x3 &U, btVector3 &sigma, btMatrix3x3 &V, int t)
Helper function of 3X3 SVD for sorting singular values.
std::unique_ptr< blender::bke::CurvesEditHints > curves_edit_hints_
int attribute_domain_size(eAttrDomain domain) const
int instances_num() const
void copy_construct(const void *src, void *dst) const
int64_t alignment() const
const CPPType * type() const
destruct_ptr< T > construct(Args &&...args)
constexpr Span drop_back(int64_t n) const
constexpr const T & last(const int64_t n=0) const
constexpr int64_t size() const
void append(const T &value)
Span< T > as_span() const
void extend(Span< T > array)
bool depends_on_input() const
const std::shared_ptr< const FieldInputs > & field_inputs() const
const FieldNode & node() const
const DTreeContext * parent_context() const
const NodeRef * parent_node() const
StringRefNull name() const
GFieldValueLog(fn::GField field, bool log_full_field)
const fn::GField & field() const
const TreeLog & root_tree() const
ModifierLog(GeoLogger &logger)
void foreach_node_log(FunctionRef< void(const NodeLog &)> fn) const
const GeometryValueLog * input_geometry_log() const
const GeometryValueLog * output_geometry_log() const
const SocketLog * lookup_socket_log(eNodeSocketInOut in_out, int index) const
const TreeLog * lookup_child_log(StringRef node_name) const
void foreach_node_log(FunctionRef< void(const NodeLog &)> fn) const
const NodeLog * lookup_node_log(StringRef node_name) const
ccl_global float * buffer
static const char * modifier_name[LS_MODIFIER_NUM]
std::unique_ptr< T, DestructValueAtAddress< T > > destruct_ptr
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void attribute_foreach(blender::Span< GeometryComponentType > component_types, bool include_instances, AttributeForeachCallback callback) const
struct bNodeTree * node_group
struct bNodeTree * nodetree
std::chrono::microseconds exec_time
UsedNamedAttribute attribute
destruct_ptr< ValueLog > value