Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mesh_convert.cc
| Show First 20 Lines • Show All 895 Lines • ▼ Show 20 Lines | static Object *object_for_curve_to_mesh_create(const Object *object) | ||||
| /* Temporarily set edit so we get updates from edit mode, but also because for text data-blocks | /* Temporarily set edit so we get updates from edit mode, but also because for text data-blocks | ||||
| * copying it while in edit mode gives invalid data structures. */ | * copying it while in edit mode gives invalid data structures. */ | ||||
| temp_curve->editfont = curve->editfont; | temp_curve->editfont = curve->editfont; | ||||
| temp_curve->editnurb = curve->editnurb; | temp_curve->editnurb = curve->editnurb; | ||||
| return temp_object; | return temp_object; | ||||
| } | } | ||||
| static void object_for_curve_to_mesh_free(Object *temp_object) | |||||
| { | |||||
| /* Clear edit mode pointers that were explicitly copied to the temporary curve. */ | |||||
| ID *final_object_data = static_cast<ID *>(temp_object->data); | |||||
| if (GS(final_object_data->name) == ID_CU) { | |||||
| Curve &curve = *reinterpret_cast<Curve *>(final_object_data); | |||||
| curve.editfont = nullptr; | |||||
| curve.editnurb = nullptr; | |||||
| } | |||||
| BKE_id_free(nullptr, temp_object->data); | |||||
| BKE_id_free(nullptr, temp_object); | |||||
| } | |||||
| /** | /** | ||||
| * Populate `object->runtime.curve_cache` which is then used to create the mesh. | * Populate `object->runtime.curve_cache` which is then used to create the mesh. | ||||
| */ | */ | ||||
| static void curve_to_mesh_eval_ensure(Object &object) | static void curve_to_mesh_eval_ensure(Object &object) | ||||
| { | { | ||||
| BLI_assert(GS(static_cast<ID *>(object.data)->name) == ID_CU); | BLI_assert(GS(static_cast<ID *>(object.data)->name) == ID_CU); | ||||
| Curve &curve = *static_cast<Curve *>(object.data); | Curve &curve = *static_cast<Curve *>(object.data); | ||||
| /* Clear all modifiers for the bevel object. | /* Clear all modifiers for the bevel object. | ||||
| ▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | static Mesh *mesh_new_from_curve_type_object(const Object *object) | ||||
| /* If evaluating the curve replaced object data with different data, free the original data. */ | /* If evaluating the curve replaced object data with different data, free the original data. */ | ||||
| if (temp_data != temp_object->data) { | if (temp_data != temp_object->data) { | ||||
| BKE_id_free(nullptr, temp_data); | BKE_id_free(nullptr, temp_data); | ||||
| } | } | ||||
| Mesh *mesh = mesh_new_from_evaluated_curve_type_object(temp_object); | Mesh *mesh = mesh_new_from_evaluated_curve_type_object(temp_object); | ||||
| BKE_id_free(nullptr, temp_object->data); | object_for_curve_to_mesh_free(temp_object); | ||||
| BKE_id_free(nullptr, temp_object); | |||||
| return mesh; | return mesh; | ||||
| } | } | ||||
| static Mesh *mesh_new_from_mball_object(Object *object) | static Mesh *mesh_new_from_mball_object(Object *object) | ||||
| { | { | ||||
| MetaBall *mball = (MetaBall *)object->data; | MetaBall *mball = (MetaBall *)object->data; | ||||
| ▲ Show 20 Lines • Show All 615 Lines • Show Last 20 Lines | |||||