|
Blender V5.0
|
#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 | |
| struct | EdgeLink |
| struct | VertLink |
| class | StringRefNull |
Typedefs | |
| using | float3 |
Functions | |
| static Mesh * | mesh_nurbs_displist_to_mesh (const Curve *cu, const ListBase *dispbase) |
| static void | mesh_copy_texture_space_from_curve_type (const Curve *cu, Mesh *mesh) |
| Mesh * | BKE_mesh_new_nomain_from_curve_displist (const Object *ob, const ListBase *dispbase) |
| Mesh * | BKE_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 Object * | object_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 Curves * | get_evaluated_curves_from_object (const Object *object) |
| static Mesh * | mesh_new_from_evaluated_curve_type_object (const Object *evaluated_object) |
| static Mesh * | mesh_new_from_curve_type_object (const Object *object) |
| static Mesh * | mesh_new_from_mball_object (Object *object) |
| static Mesh * | mesh_new_from_mesh (Object *object, const Mesh *mesh, const bool ensure_subdivision) |
| static Mesh * | mesh_new_from_mesh_object_with_layers (Depsgraph *depsgraph, Object *object, const bool preserve_origindex, const bool ensure_subdivision) |
| static Mesh * | mesh_new_from_mesh_object (Depsgraph *depsgraph, Object *object, const bool preserve_all_data_layers, const bool preserve_origindex, const bool use_subdivision) |
| Mesh * | BKE_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) |
| Mesh * | BKE_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 KeyBlock * | keyblock_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"} |
| using blender::float3 |
Definition at line 619 of file BLI_math_vector_types.hh.
Definition at line 366 of file mesh_convert.cc.
References BLI_addtail(), VertLink::index, and MEM_callocN().
Referenced by BKE_mesh_to_curve_nurblist().
| 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.
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().
| Mesh * BKE_mesh_new_from_object_to_bmain | ( | Main * | bmain, |
| Depsgraph * | depsgraph, | ||
| Object * | object, | ||
| bool | preserve_all_data_layers ) |
This is a version of BKE_mesh_new_from_object() which stores mesh in the given main database. However, that function enforces object type to be a geometry one, and ensures a mesh is always generated, be it empty.
Definition at line 950 of file mesh_convert.cc.
References BKE_library_foreach_ID_link(), BKE_mesh_add(), BKE_mesh_new_from_object(), BKE_mesh_nomain_to_mesh(), BLI_assert, depsgraph, ELEM, foreach_libblock_make_original_callback(), foreach_libblock_make_usercounts_callback(), Mesh::id, id_us_min(), IDWALK_NOP, Mesh::mat, OB_CURVES_LEGACY, OB_FONT, OB_MBALL, OB_MESH, OB_SURF, Mesh::totcol, and ID::us.
Referenced by blender::ed::object::convert_mball_to_mesh(), and blender::ed::object::object_data_convert_curve_to_mesh().
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().
Definition at line 326 of file mesh_convert.cc.
References Object::data, Curve::mat, MEM_dupallocN(), mesh_copy_texture_space_from_curve_type(), mesh_nurbs_displist_to_mesh(), and Curve::totcol.
Referenced by BKE_mesh_new_nomain_from_curve(), and curve_calc_modifiers_post().
| 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.
| process_shape_keys | Whether 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().
Definition at line 1150 of file mesh_convert.cc.
References BLI_assert, blender::MutableSpan< T >::copy_from(), KeyBlock::data, Key::elemsize, Mesh::id, ID_TAG_NO_MAIN, Mesh::key, MEM_freeN(), MEM_malloc_arrayN(), ID::tag, KeyBlock::totelem, and Mesh::verts_num.
Referenced by blender::ed::object::modifier_apply_shape().
Definition at line 505 of file mesh_convert.cc.
References BKE_curve_add(), BKE_mesh_to_curve_nurblist(), BKE_object_free_derived_caches(), BKE_object_get_evaluated_mesh_no_subsurf(), CU_3D, Object::data, DEG_get_evaluated(), depsgraph, ListBase::first, Curve::flag, Object::id, id_us_min(), ID::name, Curve::nurb, OB_CURVES_LEGACY, and Object::type.
Referenced by blender::ed::object::convert_mesh_to_curves_legacy().
| void BKE_mesh_to_curve_nurblist | ( | const Mesh * | mesh, |
| ListBase * | nurblist, | ||
| const int | edge_users_test ) |
Definition at line 373 of file mesh_convert.cc.
References appendPolyLineVert(), BLI_addtail(), BLI_freelinkN(), BLI_freelistN(), Nurb::bp, copy_v3_v3(), CU_NURB_CYCLIC, CU_NURB_ENDPOINT, EdgeLink::edge, BPoint::f1, ListBase::first, Nurb::flagu, i, VertLink::index, blender::offset_indices::OffsetIndices< T >::index_range(), blender::Span< T >::index_range(), ListBase::last, MEM_calloc_arrayN(), MEM_callocN(), MEM_freeN(), VertLink::next, Nurb::orderu, Nurb::pntsu, Nurb::pntsv, prependPolyLineVert(), EdgeLink::prev, BPoint::radius, Nurb::resolu, SELECT, blender::Span< T >::size(), blender::Span< T >::slice(), BPoint::vec, and BPoint::weight.
Referenced by BKE_mesh_to_curve(), and knifeproject_poly_from_object().
Definition at line 535 of file mesh_convert.cc.
References Geometry::attributes, BKE_id_materials_copy(), BKE_object_free_derived_caches(), BKE_object_get_evaluated_mesh(), BKE_pointcloud_add(), BLI_assert, copy_attributes(), Object::data, DEG_get_evaluated(), depsgraph, Object::id, id_us_min(), ID::name, OB_MESH, OB_POINTCLOUD, blender::bke::Point, PointCloud::totpoint, Object::type, and Mesh::verts_num.
Referenced by blender::ed::object::convert_mesh_to_pointcloud().
Definition at line 566 of file mesh_convert.cc.
References BKE_id_materials_copy(), BKE_mesh_add(), BKE_object_free_derived_caches(), BLI_assert, copy_attributes(), Object::data, DEG_get_evaluated(), depsgraph, Object::id, id_us_min(), ID::name, OB_MESH, OB_POINTCLOUD, blender::bke::object_get_evaluated_geometry_set(), blender::bke::Point, and Object::type.
Referenced by blender::ed::object::convert_pointcloud_to_mesh().
Definition at line 1015 of file mesh_convert.cc.
References Mesh::runtime.
Referenced by BKE_mesh_nomain_to_mesh(), and blender::geometry::mesh_copy_selection_keep_verts().
Definition at line 1007 of file mesh_convert.cc.
References Mesh::runtime.
Referenced by BKE_mesh_nomain_to_mesh(), blender::geometry::mesh_copy_selection_keep_edges(), and blender::geometry::mesh_triangulate().
Definition at line 1023 of file mesh_convert.cc.
Referenced by BKE_mesh_nomain_to_mesh(), blender::geometry::mesh_copy_selection_keep_edges(), and blender::geometry::mesh_copy_selection_keep_verts().
|
static |
Populate object->runtime->curve_cache which is then used to create the mesh.
Definition at line 652 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(), data, GS, ID_CU_LEGACY, Object::modifiers, name, Object::runtime, and Curve::taperobj.
Referenced by mesh_new_from_curve_type_object().
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().
|
static |
Definition at line 920 of file mesh_convert.cc.
References DEG_get_original(), LibraryIDLinkCallbackData::id_pointer, and IDWALK_RET_NOP.
Referenced by BKE_mesh_new_from_object_to_bmain().
|
static |
Definition at line 931 of file mesh_convert.cc.
References LibraryIDLinkCallbackData::cb_flag, LibraryIDLinkCallbackData::id_pointer, id_us_ensure_real(), id_us_plus(), IDWALK_CB_USER, IDWALK_CB_USER_ONE, and IDWALK_RET_NOP.
Referenced by BKE_mesh_new_from_object_to_bmain().
Definition at line 704 of file mesh_convert.cc.
Referenced by mesh_new_from_evaluated_curve_type_object().
|
static |
Definition at line 1030 of file mesh_convert.cc.
References BKE_keyblock_add(), BKE_keyblock_find_uid(), name, and KeyBlock::uid.
Referenced by move_shapekey_layers_to_keyblocks().
Copy evaluated texture space from curve to mesh.
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().
Definition at line 723 of file mesh_convert.cc.
References BKE_id_free(), curve_to_mesh_eval_ensure(), Object::data, DEG_is_evaluated(), Curve::editfont, Curve::editnurb, GS, ID_CU_LEGACY, mesh_new_from_evaluated_curve_type_object(), ID::name, object_for_curve_to_mesh_create(), and object_for_curve_to_mesh_free().
Referenced by BKE_mesh_new_from_object().
Definition at line 712 of file mesh_convert.cc.
References BKE_mesh_copy_for_eval(), BKE_object_get_evaluated_mesh(), blender::bke::curve_to_wire_mesh(), and get_evaluated_curves_from_object().
Referenced by mesh_new_from_curve_type_object().
Definition at line 757 of file mesh_convert.cc.
References BKE_id_new_nomain(), BKE_mesh_copy_for_eval(), BKE_object_get_evaluated_mesh(), and DEG_is_evaluated().
Referenced by BKE_mesh_new_from_object().
|
static |
Definition at line 776 of file mesh_convert.cc.
References BKE_id_copy_ex(), BKE_mesh_wrapper_ensure_mdata(), BKE_mesh_wrapper_ensure_subdivision(), Mesh::id, LIB_ID_CREATE_NO_MAIN, LIB_ID_CREATE_NO_USER_REFCOUNT, ME_WRAPPER_TYPE_BMESH, ID::name, and STRNCPY().
Referenced by mesh_new_from_mesh_object(), and mesh_new_from_mesh_object_with_layers().
|
static |
Definition at line 848 of file mesh_convert.cc.
References BKE_object_get_editmesh_eval_final(), depsgraph, GS, ID_ME, mesh_new_from_mesh(), mesh_new_from_mesh_object_with_layers(), and Mesh::runtime.
Referenced by BKE_mesh_new_from_object().
|
static |
Definition at line 795 of file mesh_convert.cc.
References BKE_id_free(), BKE_mesh_wrapper_ensure_subdivision(), BLI_assert, CD_MASK_MESH, CD_MASK_ORIGINDEX, Object::data, DEG_get_evaluated_scene(), DEG_is_original(), depsgraph, mask(), blender::bke::mesh_create_eval_final(), mesh_new_from_mesh(), result, and Object::runtime.
Referenced by mesh_new_from_mesh_object().
Definition at line 65 of file mesh_convert.cc.
References b, BKE_mesh_new_nomain(), copy_v3_v3(), blender::bke::Corner, CU_DO_2DFILL, CU_SMOOTH, data, DATA_, DL_CYCL_U, DL_CYCL_V, DL_INDEX3, DL_POLY, DL_SEGM, DL_SURF, ELEM, blender::bke::Face, blender::bke::SpanAttributeWriter< T >::finish(), i, LISTBASE_FOREACH, blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_only_span(), blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_span(), blender::bke::mesh_calc_edges(), OB_SURF, Curve::ob_type, blender::bke::SpanAttributeWriter< T >::span, and v.
Referenced by BKE_mesh_new_nomain_from_curve_displist().
|
static |
Definition at line 1051 of file mesh_convert.cc.
References Key::block, CD_SHAPEKEY, CLOG_ERROR, blender::MutableSpan< T >::copy_from(), CustomData_get_layer_index_n(), CustomData_number_of_layers(), CustomDataLayer::data, KeyBlock::data, i, keyblock_ensure_from_uid(), CustomData::layers, LISTBASE_FOREACH, LOG, MEM_calloc_arrayN(), MEM_malloc_arrayN(), MEM_SAFE_FREE, CustomDataLayer::name, KeyBlock::totelem, CustomDataLayer::uid, and KeyBlock::uid.
Referenced by BKE_mesh_nomain_to_mesh().
Definition at line 595 of file mesh_convert.cc.
References BKE_curve_texspace_calc(), BKE_id_copy_ex(), BKE_object_free_modifiers(), Object::data, Curve::editfont, Curve::editnurb, LIB_ID_COPY_LOCALIZE, LIB_ID_COPY_SET_COPIED_ON_WRITE, and LIB_ID_CREATE_NO_USER_REFCOUNT.
Referenced by mesh_new_from_curve_type_object().
|
static |
Definition at line 627 of file mesh_convert.cc.
References BKE_id_free(), Object::data, Curve::editfont, Curve::editnurb, GS, ID_CU_LEGACY, ID::name, and Object::runtime.
Referenced by mesh_new_from_curve_type_object().
Definition at line 359 of file mesh_convert.cc.
References BLI_addhead(), VertLink::index, and MEM_callocN().
Referenced by BKE_mesh_to_curve_nurblist().
|
static |
Definition at line 63 of file mesh_convert.cc.