diff options
Diffstat (limited to 'source/blender/editors/mesh/meshtools.c')
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index bcc00e0640a..35e1a0975e5 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -44,7 +44,6 @@ #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "DNA_view3d_types.h" #include "BLI_math.h" #include "BLI_blenlib.h" @@ -54,20 +53,15 @@ #include "BLI_threads.h" -#include "BKE_blender.h" #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_deform.h" #include "BKE_DerivedMesh.h" -#include "BKE_customdata.h" -#include "BKE_global.h" -#include "BKE_image.h" #include "BKE_key.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_material.h" -#include "BKE_object.h" -#include "BKE_utildefines.h" #include "BKE_report.h" #include "BKE_tessmesh.h" @@ -93,6 +87,7 @@ return 0 if no join is made (error) and 1 of the join is done */ int join_mesh_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); Material **matar, *ma; @@ -195,12 +190,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* Join this object's vertex groups to the base one's */ for(dg=base->object->defbase.first; dg; dg=dg->next) { /* See if this group exists in the object (if it doesn't, add it to the end) */ - for(odg=ob->defbase.first; odg; odg=odg->next) { - if(!strcmp(odg->name, dg->name)) { - break; - } - } - if(!odg) { + if(!defgroup_find_name(ob, dg->name)) { odg = MEM_callocN(sizeof(bDeformGroup), "join deformGroup"); memcpy(odg, dg, sizeof(bDeformGroup)); BLI_addtail(&ob->defbase, odg); @@ -492,7 +482,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* free base, now that data is merged */ if(base->object != ob) - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(bmain, scene, base); } } CTX_DATA_END; @@ -558,17 +548,17 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* free it's ipo too - both are not actually freed from memory yet as ID-blocks */ if(nkey->ipo) { free_ipo(nkey->ipo); - BLI_remlink(&G.main->ipo, nkey->ipo); + BLI_remlink(&bmain->ipo, nkey->ipo); MEM_freeN(nkey->ipo); } #endif free_key(nkey); - BLI_remlink(&G.main->key, nkey); + BLI_remlink(&bmain->key, nkey); MEM_freeN(nkey); } - DAG_scene_sort(scene); // removed objects, need to rebuild dag before editmode call + DAG_scene_sort(bmain, scene); // removed objects, need to rebuild dag before editmode call ED_object_enter_editmode(C, EM_WAITCURSOR); ED_object_exit_editmode(C, EM_FREEDATA|EM_WAITCURSOR|EM_DO_UNDO); |