Blender V5.0
mesh_convert.cc File Reference
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_curve_types.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_scene_types.h"
#include "BLI_index_range.hh"
#include "BLI_listbase.h"
#include "BLI_span.hh"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
#include "BKE_curves.hh"
#include "BKE_deform.hh"
#include "BKE_displist.h"
#include "BKE_editmesh.hh"
#include "BKE_geometry_set.hh"
#include "BKE_geometry_set_instances.hh"
#include "BKE_key.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_main.hh"
#include "BKE_material.hh"
#include "BKE_mball.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_runtime.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_modifier.hh"
#include "BKE_object_types.hh"
#include "BKE_curve.hh"
#include "BKE_object.hh"
#include "BKE_pointcloud.hh"
#include "BKE_curve_to_mesh.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"

Go to the source code of this file.

Classes

class  StringRefNull

Typedefs

using float3

Functions

static Meshmesh_nurbs_displist_to_mesh (const Curve *cu, const ListBase *dispbase)
static void mesh_copy_texture_space_from_curve_type (const Curve *cu, Mesh *mesh)
MeshBKE_mesh_new_nomain_from_curve_displist (const Object *ob, const ListBase *dispbase)
MeshBKE_mesh_new_nomain_from_curve (const Object *ob)
static void prependPolyLineVert (ListBase *lb, uint index)
static void appendPolyLineVert (ListBase *lb, uint index)
void BKE_mesh_to_curve_nurblist (const Mesh *mesh, ListBase *nurblist, const int edge_users_test)
void BKE_mesh_to_curve (Main *bmain, Depsgraph *depsgraph, Scene *, Object *ob)
void BKE_mesh_to_pointcloud (Main *bmain, Depsgraph *depsgraph, Scene *, Object *ob)
void BKE_pointcloud_to_mesh (Main *bmain, Depsgraph *depsgraph, Scene *, Object *ob)
static Objectobject_for_curve_to_mesh_create (const Object *object)
static void object_for_curve_to_mesh_free (Object *temp_object)
static void curve_to_mesh_eval_ensure (Object &object)
static const Curvesget_evaluated_curves_from_object (const Object *object)
static Meshmesh_new_from_evaluated_curve_type_object (const Object *evaluated_object)
static Meshmesh_new_from_curve_type_object (const Object *object)
static Meshmesh_new_from_mball_object (Object *object)
static Meshmesh_new_from_mesh (Object *object, const Mesh *mesh, const bool ensure_subdivision)
static Meshmesh_new_from_mesh_object_with_layers (Depsgraph *depsgraph, Object *object, const bool preserve_origindex, const bool ensure_subdivision)
static Meshmesh_new_from_mesh_object (Depsgraph *depsgraph, Object *object, const bool preserve_all_data_layers, const bool preserve_origindex, const bool use_subdivision)
MeshBKE_mesh_new_from_object (Depsgraph *depsgraph, Object *object, const bool preserve_all_data_layers, const bool preserve_origindex, const bool ensure_subdivision)
static int foreach_libblock_make_original_callback (LibraryIDLinkCallbackData *cb_data)
static int foreach_libblock_make_usercounts_callback (LibraryIDLinkCallbackData *cb_data)
MeshBKE_mesh_new_from_object_to_bmain (Main *bmain, Depsgraph *depsgraph, Object *object, bool preserve_all_data_layers)
static void copy_loose_vert_hint (const Mesh &src, Mesh &dst)
static void copy_loose_edge_hint (const Mesh &src, Mesh &dst)
static void copy_overlapping_hint (const Mesh &src, Mesh &dst)
static KeyBlockkeyblock_ensure_from_uid (Key &key, const int uid, const StringRefNull name)
static int find_object_active_key_uid (const Key &key, const Object &object)
static void move_shapekey_layers_to_keyblocks (const Mesh &mesh, const CustomData &custom_data, Key &key_dst, const int actshape_uid)
void BKE_mesh_nomain_to_mesh (Mesh *mesh_src, Mesh *mesh_dst, Object *ob, bool process_shape_keys)
void BKE_mesh_nomain_to_meshkey (Mesh *mesh_src, Mesh *mesh_dst, KeyBlock *kb)

Variables

static CLG_LogRef LOG = {"geom.mesh.convert"}

Typedef Documentation

◆ float3

Definition at line 619 of file BLI_math_vector_types.hh.

Function Documentation

◆ appendPolyLineVert()

void appendPolyLineVert ( ListBase * lb,
uint index )
static

Definition at line 366 of file mesh_convert.cc.

References BLI_addtail(), VertLink::index, and MEM_callocN().

Referenced by BKE_mesh_to_curve_nurblist().

◆ BKE_mesh_new_from_object()

Mesh * BKE_mesh_new_from_object ( Depsgraph * depsgraph,
Object * object,
bool preserve_all_data_layers,
bool preserve_origindex,
bool ensure_subdivision )

Create new mesh from the given object at its current state. The caller owns the result mesh.

If preserve_all_data_layers is true then the modifier stack is re-evaluated to ensure it preserves all possible custom data layers.

Note
Dependency graph argument is required when preserve_all_data_layers is true, and is ignored otherwise.

Definition at line 874 of file mesh_convert.cc.

References BLI_assert, depsgraph, Mesh::id, mesh_new_from_curve_type_object(), mesh_new_from_mball_object(), mesh_new_from_mesh_object(), OB_CURVES_LEGACY, OB_FONT, OB_MBALL, OB_MESH, OB_SURF, Mesh::runtime, and ID::us.

Referenced by blender::ed::object::bake(), blender::ed::object::bake_mesh_new_from_object(), BKE_mesh_new_from_object_to_bmain(), BKE_object_to_mesh(), bpy_bmesh_from_object(), blender::io::alembic::ABCMetaballWriter::get_export_mesh(), blender::io::usd::USDMetaballWriter::get_export_mesh(), blender::io::usd::USDTextWriter::get_export_mesh(), lineart_object_load_single_instance(), object_copy_mesh_data(), and blender::io::obj::OBJMesh::OBJMesh().

◆ BKE_mesh_new_from_object_to_bmain()

Mesh * BKE_mesh_new_from_object_to_bmain ( Main * bmain,
Depsgraph * depsgraph,
Object * object,
bool preserve_all_data_layers )

◆ BKE_mesh_new_nomain_from_curve()

Mesh * BKE_mesh_new_nomain_from_curve ( const Object * ob)

These functions construct a new Mesh, contrary to BKE_mesh_to_curve_nurblist which modifies ob itself.

Definition at line 338 of file mesh_convert.cc.

References BKE_mesh_new_nomain_from_curve_displist(), and Object::runtime.

Referenced by blender::io::alembic::ABCCurveMeshWriter::get_export_mesh(), and knifeproject_poly_from_object().

◆ BKE_mesh_new_nomain_from_curve_displist()

Mesh * BKE_mesh_new_nomain_from_curve_displist ( const Object * ob,
const ListBase * dispbase )

◆ BKE_mesh_nomain_to_mesh()

void BKE_mesh_nomain_to_mesh ( Mesh * mesh_src,
Mesh * mesh_dst,
Object * ob,
bool process_shape_keys = true )

Move data from a mesh outside of the main data-base into a mesh in the data-base. Takes ownership of the source mesh.

Parameters
process_shape_keysWhether to move CD_SHAPEKEY layers to the destination mesh. If there are no such layers and the number of vertices changed, the shape key data will be lost. If this parameter is false, the caller is expected to handle shape keys itself.

Definition at line 1085 of file mesh_convert.cc.

References Mesh::active_color_attribute, BKE_id_free(), BKE_mesh_clear_geometry_and_metadata(), BKE_mesh_copy_parameters(), BLI_assert, CD_MASK_MESH, CD_SHAPEKEY, CLOG_WARN, copy_loose_edge_hint(), copy_loose_vert_hint(), copy_overlapping_hint(), Mesh::corner_data, Mesh::corners_num, CustomData_has_layer(), CustomData_init_from(), Object::data, Mesh::default_color_attribute, Mesh::edge_data, Mesh::edges_num, Mesh::face_data, Mesh::face_offset_indices, Mesh::faces_num, find_object_active_key_uid(), Key::id, Mesh::id, ID_TAG_NO_MAIN, id_us_min(), Mesh::key, LOG, mask(), move_shapekey_layers_to_keyblocks(), ID::name, Mesh::runtime, ID::tag, Mesh::vert_data, Mesh::vertex_group_names, and Mesh::verts_num.

Referenced by blender::ed::sculpt_paint::trim::apply_join_operation(), blender::ed::sculpt_paint::trim::apply_trim(), BKE_mesh_new_from_object_to_bmain(), blender::ed::object::convert_curves_to_mesh(), blender::ed::object::convert_grease_pencil_to_mesh(), blender::ed::object::convert_mesh_to_mesh(), blender::ed::object::convert_psys_to_mesh(), blender::io::obj::MeshFromGeometry::create_mesh_object(), blender::bke::tests::ArmatureDeformTestBase::create_test_mesh_object(), geometry_extract_apply(), blender::io::ply::importer_main(), blender::io::stl::importer_main(), blender::ed::mesh::join_objects_exec(), blender::ed::object::modifier_apply_obdata(), multiresModifier_rebuild_subdiv(), paint_mask_slice_exec(), blender::ed::object::quadriflow_start_job(), blender::io::usd::USDMeshReader::read_object_data(), blender::io::usd::USDShapeReader::read_object_data(), blender::io::alembic::AbcMeshReader::readObjectData(), blender::io::alembic::AbcSubDReader::readObjectData(), blender::ed::geometry::store_result_geometry(), blender::ed::sculpt_paint::store_sculpt_entire_mesh(), and blender::ed::object::voxel_remesh_exec().

◆ BKE_mesh_nomain_to_meshkey()

◆ BKE_mesh_to_curve()

◆ BKE_mesh_to_curve_nurblist()

◆ BKE_mesh_to_pointcloud()

◆ BKE_pointcloud_to_mesh()

◆ copy_loose_edge_hint()

void copy_loose_edge_hint ( const Mesh & src,
Mesh & dst )
static

◆ copy_loose_vert_hint()

void copy_loose_vert_hint ( const Mesh & src,
Mesh & dst )
static

◆ copy_overlapping_hint()

void copy_overlapping_hint ( const Mesh & src,
Mesh & dst )
static

◆ curve_to_mesh_eval_ensure()

void curve_to_mesh_eval_ensure ( Object & object)
static

◆ find_object_active_key_uid()

int find_object_active_key_uid ( const Key & key,
const Object & object )
static

Definition at line 1040 of file mesh_convert.cc.

References BLI_findlink(), Key::block, CLOG_ERROR, LOG, and KeyBlock::uid.

Referenced by BKE_mesh_nomain_to_mesh().

◆ foreach_libblock_make_original_callback()

int foreach_libblock_make_original_callback ( LibraryIDLinkCallbackData * cb_data)
static

◆ foreach_libblock_make_usercounts_callback()

◆ get_evaluated_curves_from_object()

const Curves * get_evaluated_curves_from_object ( const Object * object)
static

Definition at line 704 of file mesh_convert.cc.

Referenced by mesh_new_from_evaluated_curve_type_object().

◆ keyblock_ensure_from_uid()

KeyBlock * keyblock_ensure_from_uid ( Key & key,
const int uid,
const StringRefNull name )
static

◆ mesh_copy_texture_space_from_curve_type()

void mesh_copy_texture_space_from_curve_type ( const Curve * cu,
Mesh * mesh )
static

Copy evaluated texture space from curve to mesh.

Note
We disable auto texture space feature since that will cause texture space to evaluate differently for curve and mesh, since curves use control points and handles to calculate the bounding box, and mesh uses the tessellated curve.

Definition at line 318 of file mesh_convert.cc.

References BKE_mesh_texspace_calc(), copy_v3_v3(), CU_TEXSPACE_FLAG_AUTO, Curve::texspace_flag, Curve::texspace_location, and Curve::texspace_size.

Referenced by BKE_mesh_new_nomain_from_curve_displist().

◆ mesh_new_from_curve_type_object()

◆ mesh_new_from_evaluated_curve_type_object()

Mesh * mesh_new_from_evaluated_curve_type_object ( const Object * evaluated_object)
static

◆ mesh_new_from_mball_object()

Mesh * mesh_new_from_mball_object ( Object * object)
static

◆ mesh_new_from_mesh()

◆ mesh_new_from_mesh_object()

Mesh * mesh_new_from_mesh_object ( Depsgraph * depsgraph,
Object * object,
const bool preserve_all_data_layers,
const bool preserve_origindex,
const bool use_subdivision )
static

◆ mesh_new_from_mesh_object_with_layers()

Mesh * mesh_new_from_mesh_object_with_layers ( Depsgraph * depsgraph,
Object * object,
const bool preserve_origindex,
const bool ensure_subdivision )
static

◆ mesh_nurbs_displist_to_mesh()

◆ move_shapekey_layers_to_keyblocks()

◆ object_for_curve_to_mesh_create()

◆ object_for_curve_to_mesh_free()

void object_for_curve_to_mesh_free ( Object * temp_object)
static

◆ prependPolyLineVert()

void prependPolyLineVert ( ListBase * lb,
uint index )
static

Definition at line 359 of file mesh_convert.cc.

References BLI_addhead(), VertLink::index, and MEM_callocN().

Referenced by BKE_mesh_to_curve_nurblist().

Variable Documentation

◆ LOG

CLG_LogRef LOG = {"geom.mesh.convert"}
static

Definition at line 63 of file mesh_convert.cc.