2020-12-02 13:25:25 +01:00
|
|
|
/*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
Geometry Nodes: Make instances real on-demand
This commit makes the geometry output of the collection info usable.
The output is the geometry of a collection instance, but this commit
adds a utility to convert the instances to real geometry, used in the
background whenever it is needed, like copy on write.
The recursive nature of the "realize instances" code is essential,
because collection instances in the `InstancesComponent`, might have no
geometry sets of their own containing even more collection instances,
which might then contain object instances, etc.
Another consideration is that currently, every single instance contains
a reference to its data. This is inefficient since most of the time
there are many locations and only a few sets of unique data. So this
commit adds a `GeometryInstanceGroup` to support this future optimization.
The API for instances returns a vector of `GeometryInstanceGroup`.
This may be less efficient when there are many instances, but it makes
more complicated operations like point distribution that need to iterate
over input geometry multiple times much simpler.
Any code that needs to change data, like most of the attribute nodes,
can simply call `geometry_set_realize_instances(geometry_set)`,
which will move any geometry in the `InstancesComponent` to new "real"
geometry components.
Many nodes can support read-only access to instances in order to avoid
making them real, this will be addressed where needed in the near future.
Instances from the existing "dupli" system are not supported yet.
Differential Revision: https://developer.blender.org/D10327
2021-02-12 11:58:15 -06:00
|
|
|
#include "BLI_map.hh"
|
2021-09-28 10:17:00 +02:00
|
|
|
#include "BLI_task.hh"
|
Geometry Nodes: Make instances real on-demand
This commit makes the geometry output of the collection info usable.
The output is the geometry of a collection instance, but this commit
adds a utility to convert the instances to real geometry, used in the
background whenever it is needed, like copy on write.
The recursive nature of the "realize instances" code is essential,
because collection instances in the `InstancesComponent`, might have no
geometry sets of their own containing even more collection instances,
which might then contain object instances, etc.
Another consideration is that currently, every single instance contains
a reference to its data. This is inefficient since most of the time
there are many locations and only a few sets of unique data. So this
commit adds a `GeometryInstanceGroup` to support this future optimization.
The API for instances returns a vector of `GeometryInstanceGroup`.
This may be less efficient when there are many instances, but it makes
more complicated operations like point distribution that need to iterate
over input geometry multiple times much simpler.
Any code that needs to change data, like most of the attribute nodes,
can simply call `geometry_set_realize_instances(geometry_set)`,
which will move any geometry in the `InstancesComponent` to new "real"
geometry components.
Many nodes can support read-only access to instances in order to avoid
making them real, this will be addressed where needed in the near future.
Instances from the existing "dupli" system are not supported yet.
Differential Revision: https://developer.blender.org/D10327
2021-02-12 11:58:15 -06:00
|
|
|
|
|
|
|
|
#include "BKE_attribute.h"
|
|
|
|
|
#include "BKE_attribute_access.hh"
|
2020-12-02 13:25:25 +01:00
|
|
|
#include "BKE_geometry_set.hh"
|
|
|
|
|
#include "BKE_lib_id.h"
|
|
|
|
|
#include "BKE_mesh.h"
|
|
|
|
|
#include "BKE_mesh_wrapper.h"
|
Geometry Nodes: Make instances real on-demand
This commit makes the geometry output of the collection info usable.
The output is the geometry of a collection instance, but this commit
adds a utility to convert the instances to real geometry, used in the
background whenever it is needed, like copy on write.
The recursive nature of the "realize instances" code is essential,
because collection instances in the `InstancesComponent`, might have no
geometry sets of their own containing even more collection instances,
which might then contain object instances, etc.
Another consideration is that currently, every single instance contains
a reference to its data. This is inefficient since most of the time
there are many locations and only a few sets of unique data. So this
commit adds a `GeometryInstanceGroup` to support this future optimization.
The API for instances returns a vector of `GeometryInstanceGroup`.
This may be less efficient when there are many instances, but it makes
more complicated operations like point distribution that need to iterate
over input geometry multiple times much simpler.
Any code that needs to change data, like most of the attribute nodes,
can simply call `geometry_set_realize_instances(geometry_set)`,
which will move any geometry in the `InstancesComponent` to new "real"
geometry components.
Many nodes can support read-only access to instances in order to avoid
making them real, this will be addressed where needed in the near future.
Instances from the existing "dupli" system are not supported yet.
Differential Revision: https://developer.blender.org/D10327
2021-02-12 11:58:15 -06:00
|
|
|
#include "BKE_modifier.h"
|
2020-12-02 13:25:25 +01:00
|
|
|
#include "BKE_pointcloud.h"
|
Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.
However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.
Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.
**Limitations**
- For now, you must bring curves into the node tree with an "Object
Info" node. Changes to the curve modifier stack will come later.
- Converting to a mesh is necessary to visualize the curve data.
Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes
Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
|
|
|
#include "BKE_spline.hh"
|
2021-01-21 10:32:42 +01:00
|
|
|
#include "BKE_volume.h"
|
2020-12-02 13:25:25 +01:00
|
|
|
|
Geometry Nodes: Make instances real on-demand
This commit makes the geometry output of the collection info usable.
The output is the geometry of a collection instance, but this commit
adds a utility to convert the instances to real geometry, used in the
background whenever it is needed, like copy on write.
The recursive nature of the "realize instances" code is essential,
because collection instances in the `InstancesComponent`, might have no
geometry sets of their own containing even more collection instances,
which might then contain object instances, etc.
Another consideration is that currently, every single instance contains
a reference to its data. This is inefficient since most of the time
there are many locations and only a few sets of unique data. So this
commit adds a `GeometryInstanceGroup` to support this future optimization.
The API for instances returns a vector of `GeometryInstanceGroup`.
This may be less efficient when there are many instances, but it makes
more complicated operations like point distribution that need to iterate
over input geometry multiple times much simpler.
Any code that needs to change data, like most of the attribute nodes,
can simply call `geometry_set_realize_instances(geometry_set)`,
which will move any geometry in the `InstancesComponent` to new "real"
geometry components.
Many nodes can support read-only access to instances in order to avoid
making them real, this will be addressed where needed in the near future.
Instances from the existing "dupli" system are not supported yet.
Differential Revision: https://developer.blender.org/D10327
2021-02-12 11:58:15 -06:00
|
|
|
#include "DNA_collection_types.h"
|
2020-12-02 13:25:25 +01:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
|
2021-02-12 17:41:28 +01:00
|
|
|
#include "BLI_rand.hh"
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
using blender::float3;
|
2021-01-26 18:21:12 +01:00
|
|
|
using blender::float4x4;
|
Geometry Nodes: Make instances real on-demand
This commit makes the geometry output of the collection info usable.
The output is the geometry of a collection instance, but this commit
adds a utility to convert the instances to real geometry, used in the
background whenever it is needed, like copy on write.
The recursive nature of the "realize instances" code is essential,
because collection instances in the `InstancesComponent`, might have no
geometry sets of their own containing even more collection instances,
which might then contain object instances, etc.
Another consideration is that currently, every single instance contains
a reference to its data. This is inefficient since most of the time
there are many locations and only a few sets of unique data. So this
commit adds a `GeometryInstanceGroup` to support this future optimization.
The API for instances returns a vector of `GeometryInstanceGroup`.
This may be less efficient when there are many instances, but it makes
more complicated operations like point distribution that need to iterate
over input geometry multiple times much simpler.
Any code that needs to change data, like most of the attribute nodes,
can simply call `geometry_set_realize_instances(geometry_set)`,
which will move any geometry in the `InstancesComponent` to new "real"
geometry components.
Many nodes can support read-only access to instances in order to avoid
making them real, this will be addressed where needed in the near future.
Instances from the existing "dupli" system are not supported yet.
Differential Revision: https://developer.blender.org/D10327
2021-02-12 11:58:15 -06:00
|
|
|
using blender::Map;
|
2020-12-02 13:25:25 +01:00
|
|
|
using blender::MutableSpan;
|
|
|
|
|
using blender::Span;
|
|
|
|
|
using blender::StringRef;
|
|
|
|
|
using blender::Vector;
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Geometry Component
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
GeometryComponent::GeometryComponent(GeometryComponentType type) : type_(type)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GeometryComponent *GeometryComponent::create(GeometryComponentType component_type)
|
|
|
|
|
{
|
|
|
|
|
switch (component_type) {
|
2021-03-10 11:53:17 +01:00
|
|
|
case GEO_COMPONENT_TYPE_MESH:
|
2020-12-02 13:25:25 +01:00
|
|
|
return new MeshComponent();
|
2021-03-10 11:53:17 +01:00
|
|
|
case GEO_COMPONENT_TYPE_POINT_CLOUD:
|
2020-12-02 13:25:25 +01:00
|
|
|
return new PointCloudComponent();
|
2021-03-10 11:53:17 +01:00
|
|
|
case GEO_COMPONENT_TYPE_INSTANCES:
|
2020-12-02 13:25:25 +01:00
|
|
|
return new InstancesComponent();
|
2021-03-10 11:53:17 +01:00
|
|
|
case GEO_COMPONENT_TYPE_VOLUME:
|
2021-01-21 10:32:42 +01:00
|
|
|
return new VolumeComponent();
|
Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.
However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.
Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.
**Limitations**
- For now, you must bring curves into the node tree with an "Object
Info" node. Changes to the curve modifier stack will come later.
- Converting to a mesh is necessary to visualize the curve data.
Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes
Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
|
|
|
case GEO_COMPONENT_TYPE_CURVE:
|
|
|
|
|
return new CurveComponent();
|
2020-12-02 13:25:25 +01:00
|
|
|
}
|
2021-03-23 16:49:47 +01:00
|
|
|
BLI_assert_unreachable();
|
2020-12-02 13:25:25 +01:00
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GeometryComponent::user_add() const
|
|
|
|
|
{
|
|
|
|
|
users_.fetch_add(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GeometryComponent::user_remove() const
|
|
|
|
|
{
|
|
|
|
|
const int new_users = users_.fetch_sub(1) - 1;
|
|
|
|
|
if (new_users == 0) {
|
|
|
|
|
delete this;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GeometryComponent::is_mutable() const
|
|
|
|
|
{
|
|
|
|
|
/* If the item is shared, it is read-only. */
|
|
|
|
|
/* The user count can be 0, when this is called from the destructor. */
|
|
|
|
|
return users_ <= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GeometryComponentType GeometryComponent::type() const
|
|
|
|
|
{
|
|
|
|
|
return type_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GeometryComponent::is_empty() const
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Geometry Set
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2021-10-03 16:58:33 +02:00
|
|
|
/* The methods are defaulted here so that they are not instantiated in every translation unit. */
|
|
|
|
|
GeometrySet::GeometrySet() = default;
|
|
|
|
|
GeometrySet::GeometrySet(const GeometrySet &other) = default;
|
|
|
|
|
GeometrySet::GeometrySet(GeometrySet &&other) = default;
|
|
|
|
|
GeometrySet::~GeometrySet() = default;
|
|
|
|
|
GeometrySet &GeometrySet::operator=(const GeometrySet &other) = default;
|
|
|
|
|
GeometrySet &GeometrySet::operator=(GeometrySet &&other) = default;
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* This method can only be used when the geometry set is mutable. It returns a mutable geometry
|
|
|
|
|
* component of the given type.
|
|
|
|
|
*/
|
|
|
|
|
GeometryComponent &GeometrySet::get_component_for_write(GeometryComponentType component_type)
|
|
|
|
|
{
|
|
|
|
|
return components_.add_or_modify(
|
|
|
|
|
component_type,
|
|
|
|
|
[&](GeometryComponentPtr *value_ptr) -> GeometryComponent & {
|
|
|
|
|
/* If the component did not exist before, create a new one. */
|
|
|
|
|
new (value_ptr) GeometryComponentPtr(GeometryComponent::create(component_type));
|
|
|
|
|
return **value_ptr;
|
|
|
|
|
},
|
|
|
|
|
[&](GeometryComponentPtr *value_ptr) -> GeometryComponent & {
|
|
|
|
|
GeometryComponentPtr &value = *value_ptr;
|
|
|
|
|
if (value->is_mutable()) {
|
|
|
|
|
/* If the referenced component is already mutable, return it directly. */
|
|
|
|
|
return *value;
|
|
|
|
|
}
|
|
|
|
|
/* If the referenced component is shared, make a copy. The copy is not shared and is
|
|
|
|
|
* therefore mutable. */
|
|
|
|
|
GeometryComponent *copied_component = value->copy();
|
|
|
|
|
value = GeometryComponentPtr{copied_component};
|
|
|
|
|
return *copied_component;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get the component of the given type. Might return null if the component does not exist yet. */
|
|
|
|
|
const GeometryComponent *GeometrySet::get_component_for_read(
|
|
|
|
|
GeometryComponentType component_type) const
|
|
|
|
|
{
|
|
|
|
|
const GeometryComponentPtr *component = components_.lookup_ptr(component_type);
|
|
|
|
|
if (component != nullptr) {
|
|
|
|
|
return component->get();
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GeometrySet::has(const GeometryComponentType component_type) const
|
|
|
|
|
{
|
|
|
|
|
return components_.contains(component_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GeometrySet::remove(const GeometryComponentType component_type)
|
|
|
|
|
{
|
|
|
|
|
components_.remove(component_type);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-28 15:52:04 +02:00
|
|
|
/**
|
|
|
|
|
* Remove all geometry components with types that are not in the provided list.
|
|
|
|
|
*/
|
|
|
|
|
void GeometrySet::keep_only(const blender::Span<GeometryComponentType> component_types)
|
|
|
|
|
{
|
|
|
|
|
for (auto it = components_.keys().begin(); it != components_.keys().end(); ++it) {
|
|
|
|
|
const GeometryComponentType type = *it;
|
|
|
|
|
if (!component_types.contains(type)) {
|
|
|
|
|
components_.remove(it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
void GeometrySet::add(const GeometryComponent &component)
|
|
|
|
|
{
|
|
|
|
|
BLI_assert(!components_.contains(component.type()));
|
|
|
|
|
component.user_add();
|
|
|
|
|
GeometryComponentPtr component_ptr{const_cast<GeometryComponent *>(&component)};
|
|
|
|
|
components_.add_new(component.type(), std::move(component_ptr));
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-19 12:29:37 +01:00
|
|
|
/**
|
|
|
|
|
* Get all geometry components in this geometry set for read-only access.
|
|
|
|
|
*/
|
|
|
|
|
Vector<const GeometryComponent *> GeometrySet::get_components_for_read() const
|
|
|
|
|
{
|
|
|
|
|
Vector<const GeometryComponent *> components;
|
|
|
|
|
for (const GeometryComponentPtr &ptr : components_.values()) {
|
|
|
|
|
components.append(ptr.get());
|
|
|
|
|
}
|
|
|
|
|
return components;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
void GeometrySet::compute_boundbox_without_instances(float3 *r_min, float3 *r_max) const
|
|
|
|
|
{
|
|
|
|
|
const PointCloud *pointcloud = this->get_pointcloud_for_read();
|
|
|
|
|
if (pointcloud != nullptr) {
|
|
|
|
|
BKE_pointcloud_minmax(pointcloud, *r_min, *r_max);
|
|
|
|
|
}
|
|
|
|
|
const Mesh *mesh = this->get_mesh_for_read();
|
|
|
|
|
if (mesh != nullptr) {
|
|
|
|
|
BKE_mesh_wrapper_minmax(mesh, *r_min, *r_max);
|
|
|
|
|
}
|
2021-04-08 14:32:41 -05:00
|
|
|
const Volume *volume = this->get_volume_for_read();
|
|
|
|
|
if (volume != nullptr) {
|
|
|
|
|
BKE_volume_min_max(volume, *r_min, *r_max);
|
|
|
|
|
}
|
Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.
However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.
Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.
**Limitations**
- For now, you must bring curves into the node tree with an "Object
Info" node. Changes to the curve modifier stack will come later.
- Converting to a mesh is necessary to visualize the curve data.
Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes
Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
|
|
|
const CurveEval *curve = this->get_curve_for_read();
|
|
|
|
|
if (curve != nullptr) {
|
|
|
|
|
/* Using the evaluated positions is somewhat arbitrary, but it is probably expected. */
|
|
|
|
|
curve->bounds_min_max(*r_min, *r_max, true);
|
|
|
|
|
}
|
2020-12-02 13:25:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::ostream &operator<<(std::ostream &stream, const GeometrySet &geometry_set)
|
|
|
|
|
{
|
|
|
|
|
stream << "<GeometrySet at " << &geometry_set << ", " << geometry_set.components_.size()
|
|
|
|
|
<< " components>";
|
|
|
|
|
return stream;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-30 12:34:05 +02:00
|
|
|
/* Remove all geometry components from the geometry set. */
|
|
|
|
|
void GeometrySet::clear()
|
|
|
|
|
{
|
|
|
|
|
components_.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-08 17:35:06 +02:00
|
|
|
/* Make sure that the geometry can be cached. This does not ensure ownership of object/collection
|
|
|
|
|
* instances. */
|
|
|
|
|
void GeometrySet::ensure_owns_direct_data()
|
|
|
|
|
{
|
|
|
|
|
for (GeometryComponentType type : components_.keys()) {
|
|
|
|
|
const GeometryComponent *component = this->get_component_for_read(type);
|
|
|
|
|
if (!component->owns_direct_data()) {
|
|
|
|
|
GeometryComponent &component_for_write = this->get_component_for_write(type);
|
|
|
|
|
component_for_write.ensure_owns_direct_data();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-06 18:22:24 +02:00
|
|
|
bool GeometrySet::owns_direct_data() const
|
|
|
|
|
{
|
|
|
|
|
for (const GeometryComponentPtr &component : components_.values()) {
|
|
|
|
|
if (!component->owns_direct_data()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Returns a read-only mesh or null. */
|
|
|
|
|
const Mesh *GeometrySet::get_mesh_for_read() const
|
|
|
|
|
{
|
|
|
|
|
const MeshComponent *component = this->get_component_for_read<MeshComponent>();
|
|
|
|
|
return (component == nullptr) ? nullptr : component->get_for_read();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns true when the geometry set has a mesh component that has a mesh. */
|
|
|
|
|
bool GeometrySet::has_mesh() const
|
|
|
|
|
{
|
|
|
|
|
const MeshComponent *component = this->get_component_for_read<MeshComponent>();
|
|
|
|
|
return component != nullptr && component->has_mesh();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns a read-only point cloud of null. */
|
|
|
|
|
const PointCloud *GeometrySet::get_pointcloud_for_read() const
|
|
|
|
|
{
|
|
|
|
|
const PointCloudComponent *component = this->get_component_for_read<PointCloudComponent>();
|
|
|
|
|
return (component == nullptr) ? nullptr : component->get_for_read();
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 10:32:42 +01:00
|
|
|
/* Returns a read-only volume or null. */
|
|
|
|
|
const Volume *GeometrySet::get_volume_for_read() const
|
|
|
|
|
{
|
|
|
|
|
const VolumeComponent *component = this->get_component_for_read<VolumeComponent>();
|
|
|
|
|
return (component == nullptr) ? nullptr : component->get_for_read();
|
|
|
|
|
}
|
|
|
|
|
|
Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.
However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.
Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.
**Limitations**
- For now, you must bring curves into the node tree with an "Object
Info" node. Changes to the curve modifier stack will come later.
- Converting to a mesh is necessary to visualize the curve data.
Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes
Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
|
|
|
/* Returns a read-only curve or null. */
|
|
|
|
|
const CurveEval *GeometrySet::get_curve_for_read() const
|
|
|
|
|
{
|
|
|
|
|
const CurveComponent *component = this->get_component_for_read<CurveComponent>();
|
|
|
|
|
return (component == nullptr) ? nullptr : component->get_for_read();
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Returns true when the geometry set has a point cloud component that has a point cloud. */
|
|
|
|
|
bool GeometrySet::has_pointcloud() const
|
|
|
|
|
{
|
|
|
|
|
const PointCloudComponent *component = this->get_component_for_read<PointCloudComponent>();
|
|
|
|
|
return component != nullptr && component->has_pointcloud();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns true when the geometry set has an instances component that has at least one instance. */
|
|
|
|
|
bool GeometrySet::has_instances() const
|
|
|
|
|
{
|
|
|
|
|
const InstancesComponent *component = this->get_component_for_read<InstancesComponent>();
|
|
|
|
|
return component != nullptr && component->instances_amount() >= 1;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 10:32:42 +01:00
|
|
|
/* Returns true when the geometry set has a volume component that has a volume. */
|
|
|
|
|
bool GeometrySet::has_volume() const
|
|
|
|
|
{
|
|
|
|
|
const VolumeComponent *component = this->get_component_for_read<VolumeComponent>();
|
|
|
|
|
return component != nullptr && component->has_volume();
|
|
|
|
|
}
|
|
|
|
|
|
Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.
However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.
Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.
**Limitations**
- For now, you must bring curves into the node tree with an "Object
Info" node. Changes to the curve modifier stack will come later.
- Converting to a mesh is necessary to visualize the curve data.
Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes
Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
|
|
|
/* Returns true when the geometry set has a curve component that has a curve. */
|
|
|
|
|
bool GeometrySet::has_curve() const
|
|
|
|
|
{
|
|
|
|
|
const CurveComponent *component = this->get_component_for_read<CurveComponent>();
|
|
|
|
|
return component != nullptr && component->has_curve();
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-27 10:16:38 +02:00
|
|
|
/* Returns true when the geometry set has any data that is not an instance. */
|
|
|
|
|
bool GeometrySet::has_realized_data() const
|
|
|
|
|
{
|
|
|
|
|
if (components_.is_empty()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (components_.size() > 1) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
/* Check if the only component is an #InstancesComponent. */
|
|
|
|
|
return this->get_component_for_read<InstancesComponent>() == nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-28 11:36:28 -05:00
|
|
|
/* Return true if the geometry set has any component that isn't empty. */
|
|
|
|
|
bool GeometrySet::is_empty() const
|
|
|
|
|
{
|
|
|
|
|
if (components_.is_empty()) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return !(this->has_mesh() || this->has_curve() || this->has_pointcloud() ||
|
|
|
|
|
this->has_instances());
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Create a new geometry set that only contains the given mesh. */
|
|
|
|
|
GeometrySet GeometrySet::create_with_mesh(Mesh *mesh, GeometryOwnershipType ownership)
|
|
|
|
|
{
|
|
|
|
|
GeometrySet geometry_set;
|
|
|
|
|
MeshComponent &component = geometry_set.get_component_for_write<MeshComponent>();
|
|
|
|
|
component.replace(mesh, ownership);
|
|
|
|
|
return geometry_set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create a new geometry set that only contains the given point cloud. */
|
|
|
|
|
GeometrySet GeometrySet::create_with_pointcloud(PointCloud *pointcloud,
|
|
|
|
|
GeometryOwnershipType ownership)
|
|
|
|
|
{
|
|
|
|
|
GeometrySet geometry_set;
|
|
|
|
|
PointCloudComponent &component = geometry_set.get_component_for_write<PointCloudComponent>();
|
|
|
|
|
component.replace(pointcloud, ownership);
|
|
|
|
|
return geometry_set;
|
|
|
|
|
}
|
|
|
|
|
|
Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.
However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.
Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.
**Limitations**
- For now, you must bring curves into the node tree with an "Object
Info" node. Changes to the curve modifier stack will come later.
- Converting to a mesh is necessary to visualize the curve data.
Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes
Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
|
|
|
/* Create a new geometry set that only contains the given curve. */
|
|
|
|
|
GeometrySet GeometrySet::create_with_curve(CurveEval *curve, GeometryOwnershipType ownership)
|
|
|
|
|
{
|
|
|
|
|
GeometrySet geometry_set;
|
|
|
|
|
CurveComponent &component = geometry_set.get_component_for_write<CurveComponent>();
|
|
|
|
|
component.replace(curve, ownership);
|
|
|
|
|
return geometry_set;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Clear the existing mesh and replace it with the given one. */
|
|
|
|
|
void GeometrySet::replace_mesh(Mesh *mesh, GeometryOwnershipType ownership)
|
|
|
|
|
{
|
|
|
|
|
MeshComponent &component = this->get_component_for_write<MeshComponent>();
|
|
|
|
|
component.replace(mesh, ownership);
|
|
|
|
|
}
|
|
|
|
|
|
Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.
However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.
Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.
**Limitations**
- For now, you must bring curves into the node tree with an "Object
Info" node. Changes to the curve modifier stack will come later.
- Converting to a mesh is necessary to visualize the curve data.
Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes
Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
|
|
|
/* Clear the existing curve and replace it with the given one. */
|
|
|
|
|
void GeometrySet::replace_curve(CurveEval *curve, GeometryOwnershipType ownership)
|
|
|
|
|
{
|
|
|
|
|
CurveComponent &component = this->get_component_for_write<CurveComponent>();
|
|
|
|
|
component.replace(curve, ownership);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Clear the existing point cloud and replace with the given one. */
|
|
|
|
|
void GeometrySet::replace_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership)
|
|
|
|
|
{
|
|
|
|
|
PointCloudComponent &pointcloud_component = this->get_component_for_write<PointCloudComponent>();
|
|
|
|
|
pointcloud_component.replace(pointcloud, ownership);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-26 14:42:03 -05:00
|
|
|
/* Clear the existing volume and replace with the given one. */
|
|
|
|
|
void GeometrySet::replace_volume(Volume *volume, GeometryOwnershipType ownership)
|
|
|
|
|
{
|
|
|
|
|
VolumeComponent &volume_component = this->get_component_for_write<VolumeComponent>();
|
|
|
|
|
volume_component.replace(volume, ownership);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Returns a mutable mesh or null. No ownership is transferred. */
|
|
|
|
|
Mesh *GeometrySet::get_mesh_for_write()
|
|
|
|
|
{
|
|
|
|
|
MeshComponent &component = this->get_component_for_write<MeshComponent>();
|
|
|
|
|
return component.get_for_write();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns a mutable point cloud or null. No ownership is transferred. */
|
|
|
|
|
PointCloud *GeometrySet::get_pointcloud_for_write()
|
|
|
|
|
{
|
|
|
|
|
PointCloudComponent &component = this->get_component_for_write<PointCloudComponent>();
|
|
|
|
|
return component.get_for_write();
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 10:32:42 +01:00
|
|
|
/* Returns a mutable volume or null. No ownership is transferred. */
|
|
|
|
|
Volume *GeometrySet::get_volume_for_write()
|
|
|
|
|
{
|
|
|
|
|
VolumeComponent &component = this->get_component_for_write<VolumeComponent>();
|
|
|
|
|
return component.get_for_write();
|
|
|
|
|
}
|
|
|
|
|
|
Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.
However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.
Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.
**Limitations**
- For now, you must bring curves into the node tree with an "Object
Info" node. Changes to the curve modifier stack will come later.
- Converting to a mesh is necessary to visualize the curve data.
Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes
Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
|
|
|
/* Returns a mutable curve or null. No ownership is transferred. */
|
|
|
|
|
CurveEval *GeometrySet::get_curve_for_write()
|
|
|
|
|
{
|
|
|
|
|
CurveComponent &component = this->get_component_for_write<CurveComponent>();
|
|
|
|
|
return component.get_for_write();
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-23 17:50:33 +02:00
|
|
|
void GeometrySet::attribute_foreach(const Span<GeometryComponentType> component_types,
|
|
|
|
|
const bool include_instances,
|
|
|
|
|
const AttributeForeachCallback callback) const
|
|
|
|
|
{
|
|
|
|
|
using namespace blender;
|
|
|
|
|
using namespace blender::bke;
|
|
|
|
|
for (const GeometryComponentType component_type : component_types) {
|
|
|
|
|
if (!this->has(component_type)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
const GeometryComponent &component = *this->get_component_for_read(component_type);
|
|
|
|
|
component.attribute_foreach(
|
|
|
|
|
[&](const AttributeIDRef &attribute_id, const AttributeMetaData &meta_data) {
|
|
|
|
|
callback(attribute_id, meta_data, component);
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (include_instances && this->has_instances()) {
|
|
|
|
|
const InstancesComponent &instances = *this->get_component_for_read<InstancesComponent>();
|
|
|
|
|
instances.foreach_referenced_geometry([&](const GeometrySet &instance_geometry_set) {
|
|
|
|
|
instance_geometry_set.attribute_foreach(component_types, include_instances, callback);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GeometrySet::gather_attributes_for_propagation(
|
|
|
|
|
const Span<GeometryComponentType> component_types,
|
|
|
|
|
const GeometryComponentType dst_component_type,
|
|
|
|
|
bool include_instances,
|
|
|
|
|
blender::Map<blender::bke::AttributeIDRef, AttributeKind> &r_attributes) const
|
|
|
|
|
{
|
|
|
|
|
using namespace blender;
|
|
|
|
|
using namespace blender::bke;
|
|
|
|
|
/* Only needed right now to check if an attribute is built-in on this component type.
|
|
|
|
|
* TODO: Get rid of the dummy component. */
|
|
|
|
|
const GeometryComponent *dummy_component = GeometryComponent::create(dst_component_type);
|
|
|
|
|
this->attribute_foreach(
|
|
|
|
|
component_types,
|
|
|
|
|
include_instances,
|
|
|
|
|
[&](const AttributeIDRef &attribute_id,
|
|
|
|
|
const AttributeMetaData &meta_data,
|
|
|
|
|
const GeometryComponent &component) {
|
|
|
|
|
if (component.attribute_is_builtin(attribute_id)) {
|
|
|
|
|
if (!dummy_component->attribute_is_builtin(attribute_id)) {
|
|
|
|
|
/* Don't propagate built-in attributes that are not built-in on the destination
|
|
|
|
|
* component. */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (attribute_id.is_anonymous()) {
|
|
|
|
|
if (!BKE_anonymous_attribute_id_has_strong_references(&attribute_id.anonymous_id())) {
|
|
|
|
|
/* Don't propagate anonymous attributes that are not used anymore. */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
auto add_info = [&](AttributeKind *attribute_kind) {
|
|
|
|
|
attribute_kind->domain = meta_data.domain;
|
|
|
|
|
attribute_kind->data_type = meta_data.data_type;
|
|
|
|
|
};
|
|
|
|
|
auto modify_info = [&](AttributeKind *attribute_kind) {
|
|
|
|
|
attribute_kind->domain = bke::attribute_domain_highest_priority(
|
|
|
|
|
{attribute_kind->domain, meta_data.domain});
|
|
|
|
|
attribute_kind->data_type = bke::attribute_data_type_highest_complexity(
|
|
|
|
|
{attribute_kind->data_type, meta_data.data_type});
|
|
|
|
|
};
|
|
|
|
|
r_attributes.add_or_modify(attribute_id, add_info, modify_info);
|
|
|
|
|
});
|
|
|
|
|
delete dummy_component;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-28 10:17:00 +02:00
|
|
|
static void gather_mutable_geometry_sets(GeometrySet &geometry_set,
|
|
|
|
|
Vector<GeometrySet *> &r_geometry_sets)
|
2021-09-27 17:35:26 +02:00
|
|
|
{
|
2021-09-28 10:17:00 +02:00
|
|
|
r_geometry_sets.append(&geometry_set);
|
|
|
|
|
if (!geometry_set.has_instances()) {
|
2021-09-27 17:35:26 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* In the future this can be improved by deduplicating instance references across different
|
|
|
|
|
* instances. */
|
2021-09-28 10:17:00 +02:00
|
|
|
InstancesComponent &instances_component =
|
|
|
|
|
geometry_set.get_component_for_write<InstancesComponent>();
|
2021-09-27 17:35:26 +02:00
|
|
|
instances_component.ensure_geometry_instances();
|
|
|
|
|
for (const int handle : instances_component.references().index_range()) {
|
|
|
|
|
if (instances_component.references()[handle].type() == InstanceReference::Type::GeometrySet) {
|
|
|
|
|
GeometrySet &instance_geometry = instances_component.geometry_set_from_reference(handle);
|
2021-09-28 10:17:00 +02:00
|
|
|
gather_mutable_geometry_sets(instance_geometry, r_geometry_sets);
|
2021-09-27 17:35:26 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-28 10:17:00 +02:00
|
|
|
/**
|
|
|
|
|
* Modify every (recursive) instance separately. This is often more efficient than realizing all
|
|
|
|
|
* instances just to change the same thing on all of them.
|
|
|
|
|
*/
|
|
|
|
|
void GeometrySet::modify_geometry_sets(ForeachSubGeometryCallback callback)
|
|
|
|
|
{
|
|
|
|
|
Vector<GeometrySet *> geometry_sets;
|
|
|
|
|
gather_mutable_geometry_sets(*this, geometry_sets);
|
|
|
|
|
blender::threading::parallel_for_each(
|
|
|
|
|
geometry_sets, [&](GeometrySet *geometry_set) { callback(*geometry_set); });
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 10:32:42 +01:00
|
|
|
/** \} */
|
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name C API
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
void BKE_geometry_set_free(GeometrySet *geometry_set)
|
|
|
|
|
{
|
|
|
|
|
delete geometry_set;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-06 18:22:24 +02:00
|
|
|
bool BKE_object_has_geometry_set_instances(const Object *ob)
|
2020-12-02 13:25:25 +01:00
|
|
|
{
|
2021-09-06 18:22:24 +02:00
|
|
|
const GeometrySet *geometry_set = ob->runtime.geometry_set_eval;
|
|
|
|
|
if (geometry_set == nullptr) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (geometry_set->has_instances()) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
const bool has_mesh = geometry_set->has_mesh();
|
|
|
|
|
const bool has_pointcloud = geometry_set->has_pointcloud();
|
|
|
|
|
const bool has_volume = geometry_set->has_volume();
|
|
|
|
|
const bool has_curve = geometry_set->has_curve();
|
|
|
|
|
if (ob->type == OB_MESH) {
|
|
|
|
|
return has_pointcloud || has_volume || has_curve;
|
|
|
|
|
}
|
|
|
|
|
if (ob->type == OB_POINTCLOUD) {
|
|
|
|
|
return has_mesh || has_volume || has_curve;
|
|
|
|
|
}
|
|
|
|
|
if (ob->type == OB_VOLUME) {
|
|
|
|
|
return has_mesh || has_pointcloud || has_curve;
|
|
|
|
|
}
|
Geometry Nodes: Support modifier on curve objects
With this commit, curve objects support the geometry nodes modifier.
Curves objects now evaluate to `CurveEval` unless there was a previous
implicit conversion (tessellating modifiers, mesh modifiers, or the
settings in the curve "Geometry" panel). In the new code, curves are
only considered to be the wire edges-- any generated surface is a mesh
instead, stored in the evaluated geometry set.
The consolidation of concepts mentioned above allows remove a lot of
code that had to do with maintaining the `DispList` type temporarily
for modifiers and rendering. Instead, render engines see a separate
object for the mesh from the mesh geometry component, and when the
curve object evaluates to a curve, the `CurveEval` is always used for
drawing wire edges.
However, currently the `DispList` type is still maintained and used as
an intermediate step in implicit mesh conversion. In the future, more
uses of it could be changed to use `CurveEval` and `Mesh` instead.
This is mostly not changed behavior, it is just a formalization of
existing logic after recent fixes for 2.8 versions last year and two
years ago. Also, in the future more functionality can be converted
to nodes, removing cases of implicit conversions. For more discussion
on that topic, see T89676.
The `use_fill_deform` option is removed. It has not worked properly
since 2.62, and the choice for filling a curve before or after
deformation will work much better and be clearer with a node system.
Applying the geometry nodes modifier to generate a curve is not
implemented with this commit, so applying the modifier won't work
at all. This is a separate technical challenge, and should be solved
in a separate step.
Differential Revision: https://developer.blender.org/D11597
2021-09-11 13:54:40 -05:00
|
|
|
if (ELEM(ob->type, OB_CURVE, OB_FONT)) {
|
2021-09-06 18:22:24 +02:00
|
|
|
return has_mesh || has_pointcloud || has_volume;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2020-12-02 13:25:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|