Blender  V3.3
Classes | Macros | Functions | Variables
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_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_scene_types.h"
#include "BLI_edgehash.h"
#include "BLI_index_range.hh"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_DerivedMesh.h"
#include "BKE_curves.hh"
#include "BKE_deform.h"
#include "BKE_displist.h"
#include "BKE_editmesh.h"
#include "BKE_geometry_set.hh"
#include "BKE_key.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mball.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_mesh_wrapper.h"
#include "BKE_modifier.h"
#include "BKE_curve.h"
#include "BKE_object.h"
#include "BKE_pointcloud.h"
#include "BKE_curve_to_mesh.hh"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"

Go to the source code of this file.

Classes

struct  EdgeLink
 
struct  VertLink
 

Macros

#define ASSERT_IS_VALID_MESH(mesh)
 

Functions

void BKE_mesh_from_metaball (ListBase *lb, Mesh *me)
 
static void make_edges_mdata_extend (MEdge **r_alledge, int *r_totedge, const MPoly *mpoly, MLoop *mloop, const int totpoly)
 
static int mesh_nurbs_displist_to_mdata (const Curve *cu, const ListBase *dispbase, MVert **r_allvert, int *r_totvert, MEdge **r_alledge, int *r_totedge, MLoop **r_allloop, MPoly **r_allpoly, MLoopUV **r_alluv, int *r_totloop, int *r_totpoly)
 
static void mesh_copy_texture_space_from_curve_type (const Curve *cu, Mesh *me)
 
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 *me, ListBase *nurblist, const int edge_users_test)
 
void BKE_mesh_to_curve (Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob)
 
void BKE_pointcloud_from_mesh (Mesh *me, PointCloud *pointcloud)
 
void BKE_mesh_to_pointcloud (Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob)
 
void BKE_mesh_from_pointcloud (const PointCloud *pointcloud, Mesh *me)
 
void BKE_mesh_edges_set_draw_render (Mesh *mesh)
 
void BKE_pointcloud_to_mesh (Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(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, Mesh *mesh)
 
static Meshmesh_new_from_mesh_object_with_layers (Depsgraph *depsgraph, Object *object, const bool preserve_origindex)
 
static Meshmesh_new_from_mesh_object (Depsgraph *depsgraph, Object *object, const bool preserve_all_data_layers, const bool preserve_origindex)
 
MeshBKE_mesh_new_from_object (Depsgraph *depsgraph, Object *object, const bool preserve_all_data_layers, const bool preserve_origindex)
 
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 add_shapekey_layers (Mesh *mesh_dest, Mesh *mesh_src)
 
MeshBKE_mesh_create_derived_for_modifier (struct Depsgraph *depsgraph, Scene *scene, Object *ob_eval, ModifierData *md_eval, const bool use_virtual_modifiers, const bool build_shapekey_layers)
 
static void shapekey_layers_to_keyblocks (Mesh *mesh_src, Mesh *mesh_dst, int actshape_uid)
 
void BKE_mesh_nomain_to_mesh (Mesh *mesh_src, Mesh *mesh_dst, Object *ob, const CustomData_MeshMasks *mask, bool take_ownership)
 
void BKE_mesh_nomain_to_meshkey (Mesh *mesh_src, Mesh *mesh_dst, KeyBlock *kb)
 

Variables

static CLG_LogRef LOG = {"bke.mesh_convert"}
 

Macro Definition Documentation

◆ ASSERT_IS_VALID_MESH

#define ASSERT_IS_VALID_MESH (   mesh)

Definition at line 67 of file mesh_convert.cc.

Function Documentation

◆ add_shapekey_layers()

static void add_shapekey_layers ( Mesh mesh_dest,
Mesh mesh_src 
)
static

◆ appendPolyLineVert()

static void appendPolyLineVert ( ListBase lb,
uint  index 
)
static

Definition at line 575 of file mesh_convert.cc.

References BLI_addtail(), and VertLink::index.

Referenced by BKE_mesh_to_curve_nurblist().

◆ BKE_mesh_create_derived_for_modifier()

Mesh* BKE_mesh_create_derived_for_modifier ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object ob_eval,
struct ModifierData md_eval,
bool  use_virtual_modifiers,
bool  build_shapekey_layers 
)

◆ BKE_mesh_edges_set_draw_render()

void BKE_mesh_edges_set_draw_render ( struct Mesh me)

Needed after converting a mesh with subsurf optimal display to mesh.

Definition at line 826 of file mesh_convert.cc.

References MEdge::flag, ME_EDGEDRAW, ME_EDGERENDER, Mesh::medge, mesh, and Mesh::totedge.

Referenced by object_convert_exec().

◆ BKE_mesh_from_metaball()

void BKE_mesh_from_metaball ( ListBase lb,
Mesh me 
)

◆ BKE_mesh_from_pointcloud()

void BKE_mesh_from_pointcloud ( const PointCloud pointcloud,
Mesh me 
)

◆ BKE_mesh_new_from_object()

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

Create new mesh from the given object at its current state. The owner of this mesh is unknown, it is up to the caller to decide.

If preserve_all_data_layers is truth 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 truth, and is ignored otherwise.

Definition at line 1102 of file mesh_convert.cc.

References BLI_assert, depsgraph, Mesh::edit_mesh, 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, Object::type, and ID::us.

Referenced by bake(), 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(), lineart_object_load_single_instance(), and blender::io::obj::OBJMesh::OBJMesh().

◆ BKE_mesh_new_from_object_to_bmain()

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

◆ BKE_mesh_new_nomain_from_curve()

Mesh* BKE_mesh_new_nomain_from_curve ( const Object ob)

◆ 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,
const CustomData_MeshMasks mask,
bool  take_ownership 
)

◆ BKE_mesh_nomain_to_meshkey()

void BKE_mesh_nomain_to_meshkey ( Mesh mesh_src,
Mesh mesh_dst,
KeyBlock kb 
)

◆ BKE_mesh_to_curve()

void BKE_mesh_to_curve ( Main bmain,
Depsgraph depsgraph,
Scene UNUSEDscene,
Object ob 
)

◆ BKE_mesh_to_curve_nurblist()

void BKE_mesh_to_curve_nurblist ( const Mesh me,
ListBase nurblist,
const int  edge_users_test 
)

◆ BKE_mesh_to_pointcloud()

void BKE_mesh_to_pointcloud ( Main bmain,
Depsgraph depsgraph,
Scene UNUSEDscene,
Object ob 
)

◆ BKE_pointcloud_from_mesh()

void BKE_pointcloud_from_mesh ( Mesh me,
PointCloud pointcloud 
)

◆ BKE_pointcloud_to_mesh()

void BKE_pointcloud_to_mesh ( Main bmain,
Depsgraph depsgraph,
Scene UNUSEDscene,
Object ob 
)

◆ curve_to_mesh_eval_ensure()

static void curve_to_mesh_eval_ensure ( Object object)
static

Populate object->runtime.curve_cache which is then used to create the mesh.

Definition at line 911 of file mesh_convert.cc.

References Curve::bevobj, BKE_displist_make_curveTypes(), BKE_object_runtime_free_data(), BKE_object_runtime_reset(), BLI_assert, BLI_listbase_clear(), curve, data, GS, ID_CU_LEGACY, Object::modifiers, and Curve::taperobj.

Referenced by mesh_new_from_curve_type_object().

◆ foreach_libblock_make_original_callback()

static int foreach_libblock_make_original_callback ( LibraryIDLinkCallbackData cb_data)
static

◆ foreach_libblock_make_usercounts_callback()

static int foreach_libblock_make_usercounts_callback ( LibraryIDLinkCallbackData cb_data)
static

◆ get_evaluated_curves_from_object()

static const Curves* get_evaluated_curves_from_object ( const Object object)
static

◆ make_edges_mdata_extend()

static void make_edges_mdata_extend ( MEdge **  r_alledge,
int *  r_totedge,
const MPoly mpoly,
MLoop mloop,
const int  totpoly 
)
static

◆ mesh_copy_texture_space_from_curve_type()

static void mesh_copy_texture_space_from_curve_type ( const Curve cu,
Mesh me 
)
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 479 of file mesh_convert.cc.

References BKE_mesh_texspace_calc(), copy_v3_v3(), CU_AUTOSPACE, Curve::loc, Mesh::loc, Curve::size, Mesh::size, Curve::texflag, and Mesh::texflag.

Referenced by BKE_mesh_new_nomain_from_curve_displist().

◆ mesh_new_from_curve_type_object()

static Mesh* mesh_new_from_curve_type_object ( const Object object)
static

◆ mesh_new_from_evaluated_curve_type_object()

static Mesh* mesh_new_from_evaluated_curve_type_object ( const Object evaluated_object)
static

◆ mesh_new_from_mball_object()

static Mesh* mesh_new_from_mball_object ( Object object)
static

◆ mesh_new_from_mesh()

static Mesh* mesh_new_from_mesh ( Object object,
Mesh mesh 
)
static

◆ mesh_new_from_mesh_object()

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

◆ mesh_new_from_mesh_object_with_layers()

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

◆ mesh_nurbs_displist_to_mdata()

static int mesh_nurbs_displist_to_mdata ( const Curve cu,
const ListBase dispbase,
MVert **  r_allvert,
int *  r_totvert,
MEdge **  r_alledge,
int *  r_totedge,
MLoop **  r_allloop,
MPoly **  r_allpoly,
MLoopUV **  r_alluv,
int *  r_totloop,
int *  r_totpoly 
)
static

◆ object_for_curve_to_mesh_create()

static Object* object_for_curve_to_mesh_create ( const Object object)
static

◆ object_for_curve_to_mesh_free()

static void object_for_curve_to_mesh_free ( Object temp_object)
static

◆ prependPolyLineVert()

static void prependPolyLineVert ( ListBase lb,
uint  index 
)
static

Definition at line 568 of file mesh_convert.cc.

References BLI_addhead(), and VertLink::index.

Referenced by BKE_mesh_to_curve_nurblist().

◆ shapekey_layers_to_keyblocks()

static void shapekey_layers_to_keyblocks ( Mesh mesh_src,
Mesh mesh_dst,
int  actshape_uid 
)
static

Variable Documentation

◆ LOG

CLG_LogRef LOG = {"bke.mesh_convert"}
static