diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-26 18:53:40 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-26 18:53:40 +0400 |
commit | 52216889c0802a730f7c57160d978af12e2ff5aa (patch) | |
tree | e65afaec5b26ae8f2e70c714cdabd0caa68c6755 /source | |
parent | 4800d7fc3456eca2bca65ddd50c8baa16683695a (diff) |
Remove unused function NewBooleanMesh
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/modifiers/intern/MOD_boolean_util.c | 108 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_boolean_util.h | 6 |
2 files changed, 3 insertions, 111 deletions
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 98fab9c06ff..9c8109c7856 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -266,44 +266,6 @@ static void FaceIt_Construct( output->it = it; } -static Object *AddNewBlenderMesh(Scene *scene, Base *base) -{ - /* This little function adds a new mesh object to the blender object list - * It uses ob to duplicate data as this seems to be easier than creating - * a new one. This new oject contains no faces nor vertices. */ - Mesh *old_me; - Base *basen; - Object *ob_new; - - /* now create a new blender object. - * duplicating all the settings from the previous object - * to the new one. */ - ob_new = BKE_object_copy(base->object); - - /* Ok we don't want to use the actual data from the - * last object, the above function incremented the - * number of users, so decrement it here. */ - old_me = ob_new->data; - old_me->id.us--; - - /* Now create a new base to add into the linked list of - * vase objects. */ - - basen = MEM_mallocN(sizeof(Base), "duplibase"); - *basen = *base; - BLI_addhead(&scene->base, basen); /* addhead: anders oneindige lus */ - basen->object = ob_new; - basen->flag &= ~SELECT; - - /* Initialize the mesh data associated with this object. */ - ob_new->data = BKE_mesh_add(G.main, "Mesh"); - - /* Finally assign the object type. */ - ob_new->type = OB_MESH; - - return ob_new; -} - static void InterpCSGFace( DerivedMesh *dm, DerivedMesh *orig_dm, int index, int orig_index, int nr, float mapmat[4][4]) @@ -509,9 +471,9 @@ static void FreeMeshDescriptors( FaceIt_Destruct(face_it); } -static DerivedMesh *NewBooleanDerivedMesh_intern( +DerivedMesh *NewBooleanDerivedMesh( DerivedMesh *dm, struct Object *ob, DerivedMesh *dm_select, struct Object *ob_select, - int int_op_type, Material **mat, int *totmat) + int int_op_type) { float inv_mat[4][4]; @@ -567,7 +529,7 @@ static DerivedMesh *NewBooleanDerivedMesh_intern( /* iterate through results of operation and insert * into new object */ result = ConvertCSGDescriptorsToDerivedMesh( - &fd_o, &vd_o, inv_mat, map_mat, mat, totmat, dm_select, ob_select, dm, ob); + &fd_o, &vd_o, inv_mat, map_mat, NULL, NULL, dm_select, ob_select, dm, ob); /* free up the memory */ CSG_FreeVertexDescriptor(&vd_o); @@ -584,67 +546,3 @@ static DerivedMesh *NewBooleanDerivedMesh_intern( return result; } - -int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type) -{ - Mesh *me_new; - int a, maxmat, totmat = 0; - Object *ob_new, *ob, *ob_select; - Material **mat; - DerivedMesh *result; - DerivedMesh *dm_select; - DerivedMesh *dm; - - ob = base->object; - ob_select = base_select->object; - - dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); - dm_select = mesh_create_derived_view(scene, ob_select, 0); // no modifiers in editmode ?? - - maxmat = ob->totcol + ob_select->totcol; - mat = (Material **)MEM_mallocN(sizeof(Material *) * maxmat, "NewBooleanMeshMat"); - - /* put some checks in for nice user feedback */ - if (dm == NULL || dm_select == NULL) { - return 0; - } - - if (!dm->getNumTessFaces(dm) || !dm_select->getNumTessFaces(dm_select)) { - MEM_freeN(mat); - return -1; - } - - result = NewBooleanDerivedMesh_intern(dm, ob, dm_select, ob_select, int_op_type, mat, &totmat); - - if (result == NULL) { - MEM_freeN(mat); - return 0; - } - - /* create a new blender mesh object - using 'base' as a template */ - ob_new = AddNewBlenderMesh(scene, base_select); - me_new = ob_new->data; - - DM_to_mesh(result, me_new, ob_new, CD_MASK_MESH); - result->release(result); - - dm->release(dm); - dm_select->release(dm_select); - - /* add materials to object */ - for (a = 0; a < totmat; a++) - assign_material(ob_new, mat[a], a + 1, BKE_MAT_ASSIGN_USERPREF); - - MEM_freeN(mat); - - /* update dag */ - DAG_id_tag_update(&ob_new->id, OB_RECALC_DATA); - - return 1; -} - -DerivedMesh *NewBooleanDerivedMesh(DerivedMesh *dm, struct Object *ob, DerivedMesh *dm_select, struct Object *ob_select, - int int_op_type) -{ - return NewBooleanDerivedMesh_intern(dm, ob, dm_select, ob_select, int_op_type, NULL, NULL); -} diff --git a/source/blender/modifiers/intern/MOD_boolean_util.h b/source/blender/modifiers/intern/MOD_boolean_util.h index 209db60f0c9..04d76d45652 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.h +++ b/source/blender/modifiers/intern/MOD_boolean_util.h @@ -39,12 +39,6 @@ struct Base; struct DerivedMesh; /* Performs a boolean between two mesh objects, it is assumed that both objects - * are in fact a mesh object. On success returns 1 and creates a new mesh object - * into blender data structures. On failure returns 0 and reports an error. */ -int NewBooleanMesh(struct Scene *scene, struct Base *base, struct Base *base_select, int op); - - -/* Performs a boolean between two mesh objects, it is assumed that both objects * are in fact mesh object. On success returns a DerivedMesh. On failure * returns NULL and reports an error. */ |