Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.c
| Show First 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | static void object_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag) | ||||
| if (ob_src->totcol) { | if (ob_src->totcol) { | ||||
| ob_dst->mat = MEM_dupallocN(ob_src->mat); | ob_dst->mat = MEM_dupallocN(ob_src->mat); | ||||
| ob_dst->matbits = MEM_dupallocN(ob_src->matbits); | ob_dst->matbits = MEM_dupallocN(ob_src->matbits); | ||||
| ob_dst->totcol = ob_src->totcol; | ob_dst->totcol = ob_src->totcol; | ||||
| } | } | ||||
| else if (ob_dst->mat != NULL || ob_dst->matbits != NULL) { | else if (ob_dst->mat != NULL || ob_dst->matbits != NULL) { | ||||
| /* This shall not be needed, but better be safe than sorry. */ | /* This shall not be needed, but better be safe than sorry. */ | ||||
| BLI_assert(!"Object copy: non-NULL material pointers with zero counter, should not happen."); | BLI_assert_msg( | ||||
| 0, "Object copy: non-NULL material pointers with zero counter, should not happen."); | |||||
| ob_dst->mat = NULL; | ob_dst->mat = NULL; | ||||
| ob_dst->matbits = NULL; | ob_dst->matbits = NULL; | ||||
| } | } | ||||
| if (ob_src->iuser) { | if (ob_src->iuser) { | ||||
| ob_dst->iuser = MEM_dupallocN(ob_src->iuser); | ob_dst->iuser = MEM_dupallocN(ob_src->iuser); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,310 Lines • ▼ Show 20 Lines | |||||
| * will be duplicated. | * will be duplicated. | ||||
| */ | */ | ||||
| bool BKE_object_modifier_stack_copy(Object *ob_dst, | bool BKE_object_modifier_stack_copy(Object *ob_dst, | ||||
| const Object *ob_src, | const Object *ob_src, | ||||
| const bool do_copy_all, | const bool do_copy_all, | ||||
| const int flag_subdata) | const int flag_subdata) | ||||
| { | { | ||||
| if ((ob_dst->type == OB_GPENCIL) != (ob_src->type == OB_GPENCIL)) { | if ((ob_dst->type == OB_GPENCIL) != (ob_src->type == OB_GPENCIL)) { | ||||
| BLI_assert(!"Trying to copy a modifier stack between a GPencil object and another type."); | BLI_assert_msg(0, | ||||
| "Trying to copy a modifier stack between a GPencil object and another type."); | |||||
| return false; | return false; | ||||
| } | } | ||||
| if (!BLI_listbase_is_empty(&ob_dst->modifiers) || | if (!BLI_listbase_is_empty(&ob_dst->modifiers) || | ||||
| !BLI_listbase_is_empty(&ob_dst->greasepencil_modifiers)) { | !BLI_listbase_is_empty(&ob_dst->greasepencil_modifiers)) { | ||||
| BLI_assert( | BLI_assert( | ||||
| !"Trying to copy a modifier stack into an object having a non-empty modifier stack."); | !"Trying to copy a modifier stack into an object having a non-empty modifier stack."); | ||||
| return false; | return false; | ||||
| ▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | static void object_update_from_subsurf_ccg(Object *object) | ||||
| * - Update mesh datablock from object evaluation, which is technically | * - Update mesh datablock from object evaluation, which is technically | ||||
| * forbidden, but there is no other place for this yet. | * forbidden, but there is no other place for this yet. | ||||
| * - Reshape to the original mesh from main database, and then copy updated | * - Reshape to the original mesh from main database, and then copy updated | ||||
| * layer to copy of that mesh (since copy of the mesh has decoupled | * layer to copy of that mesh (since copy of the mesh has decoupled | ||||
| * custom data layers). | * custom data layers). | ||||
| * | * | ||||
| * All this is defeating all the designs we need to follow to allow safe | * All this is defeating all the designs we need to follow to allow safe | ||||
| * threaded evaluation, but this is as good as we can make it within the | * threaded evaluation, but this is as good as we can make it within the | ||||
| * current sculpt//evaluated mesh design. This is also how we've survived | * current sculpt/evaluated mesh design. This is also how we've survived | ||||
| * with old DerivedMesh based solutions. So, while this is all wrong and | * with old DerivedMesh based solutions. So, while this is all wrong and | ||||
| * needs reconsideration, doesn't seem to be a big stopper for real | * needs reconsideration, doesn't seem to be a big stopper for real | ||||
| * production artists. | * production artists. | ||||
| */ | */ | ||||
| /* TODO(sergey): Solve this somehow, to be fully stable for threaded | /* TODO(sergey): Solve this somehow, to be fully stable for threaded | ||||
| * evaluation environment. | * evaluation environment. | ||||
| */ | */ | ||||
| /* NOTE: runtime.data_orig is what was before assigning mesh_eval, | /* NOTE: runtime.data_orig is what was before assigning mesh_eval, | ||||
| ▲ Show 20 Lines • Show All 1,667 Lines • ▼ Show 20 Lines | if (me_eval) { | ||||
| if (em->bm->elem_table_dirty & BM_VERT) { | if (em->bm->elem_table_dirty & BM_VERT) { | ||||
| #ifdef VPARENT_THREADING_HACK | #ifdef VPARENT_THREADING_HACK | ||||
| BLI_mutex_lock(&vparent_lock); | BLI_mutex_lock(&vparent_lock); | ||||
| if (em->bm->elem_table_dirty & BM_VERT) { | if (em->bm->elem_table_dirty & BM_VERT) { | ||||
| BM_mesh_elem_table_ensure(em->bm, BM_VERT); | BM_mesh_elem_table_ensure(em->bm, BM_VERT); | ||||
| } | } | ||||
| BLI_mutex_unlock(&vparent_lock); | BLI_mutex_unlock(&vparent_lock); | ||||
| #else | #else | ||||
| BLI_assert(!"Not safe for threading"); | BLI_assert_msg(0, "Not safe for threading"); | ||||
| BM_mesh_elem_table_ensure(em->bm, BM_VERT); | BM_mesh_elem_table_ensure(em->bm, BM_VERT); | ||||
| #endif | #endif | ||||
| } | } | ||||
| if (nr < numVerts) { | if (nr < numVerts) { | ||||
| if (me_eval && me_eval->runtime.edit_data && me_eval->runtime.edit_data->vertexCos) { | if (me_eval && me_eval->runtime.edit_data && me_eval->runtime.edit_data->vertexCos) { | ||||
| add_v3_v3(vec, me_eval->runtime.edit_data->vertexCos[nr]); | add_v3_v3(vec, me_eval->runtime.edit_data->vertexCos[nr]); | ||||
| } | } | ||||
| else { | else { | ||||
| ▲ Show 20 Lines • Show All 2,376 Lines • Show Last 20 Lines | |||||