Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-05-27 17:08:40 +0300
committerHans Goudey <h.goudey@me.com>2021-05-27 17:08:40 +0300
commitac833108dbbaa5f2a6d62effe962eb289cc92291 (patch)
tree21bc3ac8a666de9ee0e8f355b6337dda649867d2 /source/blender/depsgraph
parent5621a8ed7fbcd9067c576d4066e83d9640a80c49 (diff)
Geometry Nodes: Draw curve data in the viewport
This patch adds relatively small changes to the curve draw cache implementation in order to draw the curve data in the viewport. The dependency graph iterator is also modified so that it iterates over the curve geometry component, which is presented to users as `Curve` data with a pointer to the `CurveEval` The idea with the spline data type in geometry nodes is that curve data itself is only the control points, and any evaluated data with faces is a mesh. That is mostly expected elsewhere in Blender anyway. This means it's only necessary to implement wire edge drawing of `CurveEval` data. Adding a `CurveEval` pointer to `Curve` is in line with changes I'd like to make in the future like using `CurveEval` in more places such as edit mode. An alternate solution involves converting the curve wire data to a mesh, however, that requires copying all of the data, and since avoiding it is rather simple and is in-line with future plans anyway, I think doing it this way is better. Differential Revision: https://developer.blender.org/D11351
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_iter.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
index ed002321729..df1cf8cc771 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
@@ -219,6 +219,29 @@ bool deg_iterator_components_step(BLI_Iterator *iter)
}
}
+ /* The curve component. */
+ if (data->geometry_component_id == 3) {
+ data->geometry_component_id++;
+
+ const CurveComponent *component = geometry_set->get_component_for_read<CurveComponent>();
+ if (component != nullptr) {
+ const Curve *curve = component->get_curve_for_render();
+
+ if (curve != nullptr) {
+ Object *temp_object = &data->temp_geometry_component_object;
+ *temp_object = *data->geometry_component_owner;
+ temp_object->type = OB_CURVE;
+ temp_object->data = (void *)curve;
+ /* Assign data_eval here too, because curve rendering code tries
+ * to use a mesh if it can find one in this pointer. */
+ temp_object->runtime.data_eval = (ID *)curve;
+ temp_object->runtime.select_id = data->geometry_component_owner->runtime.select_id;
+ iter->current = temp_object;
+ return true;
+ }
+ }
+ }
+
data->geometry_component_owner = nullptr;
return false;
}