Geometry Nodes: move type conversions to blenkernel
The type conversions do not depend on other files in the nodes module. Furthermore we want to use the conversions in the geometry module without creating a dependency to the nodes module there.
This commit is contained in:
parent
2309fa20af
commit
a8e0fe6a54
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "FN_multi_function.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
namespace blender::bke {
|
||||
|
||||
using fn::CPPType;
|
||||
|
||||
|
@ -79,4 +79,4 @@ class DataTypeConversions {
|
|||
|
||||
const DataTypeConversions &get_implicit_type_conversions();
|
||||
|
||||
} // namespace blender::nodes
|
||||
} // namespace blender::bke
|
|
@ -226,6 +226,7 @@ set(SRC
|
|||
intern/multires_versioning.c
|
||||
intern/nla.c
|
||||
intern/node.cc
|
||||
intern/type_conversions.cc
|
||||
intern/object.cc
|
||||
intern/object_deform.c
|
||||
intern/object_dupli.cc
|
||||
|
@ -456,6 +457,7 @@ set(SRC
|
|||
BKE_text_suggestions.h
|
||||
BKE_texture.h
|
||||
BKE_tracking.h
|
||||
BKE_type_conversions.hh
|
||||
BKE_undo_system.h
|
||||
BKE_unit.h
|
||||
BKE_vfont.h
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "BKE_geometry_set.hh"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_pointcloud.h"
|
||||
#include "BKE_type_conversions.hh"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
@ -36,8 +37,6 @@
|
|||
|
||||
#include "CLG_log.h"
|
||||
|
||||
#include "NOD_type_conversions.hh"
|
||||
|
||||
#include "attribute_access_intern.hh"
|
||||
|
||||
static CLG_LogRef LOG = {"bke.attribute_access"};
|
||||
|
@ -766,8 +765,8 @@ GVArray CustomDataAttributes::get_for_read(const AttributeIDRef &attribute_id,
|
|||
if (attribute->type() == *type) {
|
||||
return GVArray::ForSpan(*attribute);
|
||||
}
|
||||
const blender::nodes::DataTypeConversions &conversions =
|
||||
blender::nodes::get_implicit_type_conversions();
|
||||
const blender::bke::DataTypeConversions &conversions =
|
||||
blender::bke::get_implicit_type_conversions();
|
||||
return conversions.try_convert(GVArray::ForSpan(*attribute), *type);
|
||||
}
|
||||
|
||||
|
@ -1112,8 +1111,8 @@ std::optional<AttributeMetaData> GeometryComponent::attribute_get_meta_data(
|
|||
static blender::fn::GVArray try_adapt_data_type(blender::fn::GVArray varray,
|
||||
const blender::fn::CPPType &to_type)
|
||||
{
|
||||
const blender::nodes::DataTypeConversions &conversions =
|
||||
blender::nodes::get_implicit_type_conversions();
|
||||
const blender::bke::DataTypeConversions &conversions =
|
||||
blender::bke::get_implicit_type_conversions();
|
||||
return conversions.try_convert(std::move(varray), to_type);
|
||||
}
|
||||
|
||||
|
@ -1178,8 +1177,8 @@ blender::bke::ReadAttributeLookup GeometryComponent::attribute_try_get_for_read(
|
|||
if (attribute.varray.type() == *type) {
|
||||
return attribute;
|
||||
}
|
||||
const blender::nodes::DataTypeConversions &conversions =
|
||||
blender::nodes::get_implicit_type_conversions();
|
||||
const blender::bke::DataTypeConversions &conversions =
|
||||
blender::bke::get_implicit_type_conversions();
|
||||
return {conversions.try_convert(std::move(attribute.varray), *type), attribute.domain};
|
||||
}
|
||||
|
||||
|
@ -1299,7 +1298,7 @@ static OutputAttribute create_output_attribute(GeometryComponent &component,
|
|||
|
||||
const CPPType *cpp_type = custom_data_type_to_cpp_type(data_type);
|
||||
BLI_assert(cpp_type != nullptr);
|
||||
const nodes::DataTypeConversions &conversions = nodes::get_implicit_type_conversions();
|
||||
const DataTypeConversions &conversions = get_implicit_type_conversions();
|
||||
|
||||
if (component.attribute_is_builtin(attribute_id)) {
|
||||
const StringRef attribute_name = attribute_id.name();
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "NOD_type_conversions.hh"
|
||||
#include "BKE_type_conversions.hh"
|
||||
|
||||
#include "FN_multi_function_builder.hh"
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
#include "BLI_float2.hh"
|
||||
#include "BLI_float3.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
namespace blender::bke {
|
||||
|
||||
using fn::MFDataType;
|
||||
|
||||
|
@ -344,4 +344,4 @@ fn::GVMutableArray DataTypeConversions::try_convert(fn::GVMutableArray varray,
|
|||
std::move(varray), to_type, *this);
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
} // namespace blender::bke
|
|
@ -16,9 +16,10 @@
|
|||
|
||||
#include "MOD_nodes_evaluator.hh"
|
||||
|
||||
#include "BKE_type_conversions.hh"
|
||||
|
||||
#include "NOD_geometry_exec.hh"
|
||||
#include "NOD_socket_declarations.hh"
|
||||
#include "NOD_type_conversions.hh"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
|
@ -449,7 +450,7 @@ class GeometryNodesEvaluator {
|
|||
TaskPool *task_pool_ = nullptr;
|
||||
|
||||
GeometryNodesEvaluationParams ¶ms_;
|
||||
const blender::nodes::DataTypeConversions &conversions_;
|
||||
const blender::bke::DataTypeConversions &conversions_;
|
||||
|
||||
friend NodeParamsProvider;
|
||||
|
||||
|
@ -457,7 +458,7 @@ class GeometryNodesEvaluator {
|
|||
GeometryNodesEvaluator(GeometryNodesEvaluationParams ¶ms)
|
||||
: outer_allocator_(params.allocator),
|
||||
params_(params),
|
||||
conversions_(blender::nodes::get_implicit_type_conversions())
|
||||
conversions_(blender::bke::get_implicit_type_conversions())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -288,7 +288,6 @@ set(SRC
|
|||
intern/node_socket_declarations.cc
|
||||
intern/node_tree_ref.cc
|
||||
intern/node_util.c
|
||||
intern/type_conversions.cc
|
||||
|
||||
composite/node_composite_util.hh
|
||||
function/node_function_util.hh
|
||||
|
@ -312,7 +311,6 @@ set(SRC
|
|||
NOD_socket_declarations_geometry.hh
|
||||
NOD_static_types.h
|
||||
NOD_texture.h
|
||||
NOD_type_conversions.hh
|
||||
intern/node_common.h
|
||||
intern/node_exec.h
|
||||
intern/node_util.h
|
||||
|
|
|
@ -19,12 +19,11 @@
|
|||
#include "BKE_mesh_runtime.h"
|
||||
#include "BKE_pointcloud.h"
|
||||
#include "BKE_spline.hh"
|
||||
#include "BKE_type_conversions.hh"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
||||
#include "NOD_type_conversions.hh"
|
||||
|
||||
#include "node_geometry_util.hh"
|
||||
|
||||
namespace blender::nodes::node_geo_join_geometry_cc {
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "BKE_type_conversions.hh"
|
||||
|
||||
#include "NOD_geometry_exec.hh"
|
||||
#include "NOD_type_conversions.hh"
|
||||
|
||||
#include "node_geometry_util.hh"
|
||||
|
||||
|
@ -149,7 +150,7 @@ GVArray GeoNodeExecParams::get_input_attribute(const StringRef name,
|
|||
}
|
||||
return GVArray::ForSingle(*cpp_type, domain_size, default_value);
|
||||
}
|
||||
const DataTypeConversions &conversions = get_implicit_type_conversions();
|
||||
const bke::DataTypeConversions &conversions = bke::get_implicit_type_conversions();
|
||||
if (found_socket->type == SOCK_FLOAT) {
|
||||
const float value = this->get_input<float>(found_socket->identifier);
|
||||
BUFFER_FOR_CPP_TYPE_VALUE(*cpp_type, buffer);
|
||||
|
|
Loading…
Reference in New Issue