diff options
author | Nick Samarin <nicks1987@bigmir.net> | 2010-10-03 20:28:28 +0400 |
---|---|---|
committer | Nick Samarin <nicks1987@bigmir.net> | 2010-10-03 20:28:28 +0400 |
commit | 90ab716cd5214b23f98fa7bc31b5df002a198fa7 (patch) | |
tree | 8427f09c85826fbdb8187e1868c6bc95f8a20e5c /source/blender/editors/object | |
parent | ee0f4e8d76f603a9f3a5f6b037ad4b98084cda42 (diff) | |
parent | cfc4399ab3dfd2ec3346ec087e835664e04b1599 (diff) |
synched with trunk at revision 32129
Diffstat (limited to 'source/blender/editors/object')
18 files changed, 202 insertions, 184 deletions
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 56f144ce63c..b16b50f10ba 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -42,7 +42,7 @@ IF(NOT WITH_PYTHON) ENDIF(NOT WITH_PYTHON) IF(WIN32) - SET(INC ${INC} ${PTHREADS_INC}) + LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) BLENDERLIB(bf_editor_object "${SRC}" "${INC}") diff --git a/source/blender/editors/object/Makefile b/source/blender/editors/object/Makefile index 7c081355ed5..4694653b115 100644 --- a/source/blender/editors/object/Makefile +++ b/source/blender/editors/object/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2007 Blender Foundation # All rights reserved. diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript index f4a476474e4..d4e6cec6986 100644 --- a/source/blender/editors/object/SConscript +++ b/source/blender/editors/object/SConscript @@ -19,6 +19,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] if not env['WITH_BF_PYTHON']: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') env.BlenderLib ( 'bf_editors_object', sources, Split(incs), defs, libtype=['core'], priority=[35] ) diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 67cae8d4155..40b7df72f1c 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -49,12 +49,10 @@ #include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_curve.h" -#include "BKE_customdata.h" #include "BKE_depsgraph.h" #include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_effect.h" -#include "BKE_global.h" #include "BKE_group.h" #include "BKE_lattice.h" #include "BKE_library.h" @@ -67,9 +65,7 @@ #include "BKE_particle.h" #include "BKE_report.h" #include "BKE_sca.h" -#include "BKE_scene.h" #include "BKE_texture.h" -#include "BKE_utildefines.h" #include "RNA_access.h" #include "RNA_define.h" @@ -180,10 +176,10 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) RNA_def_property_flag(prop, PROP_HIDDEN); } - RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX); + RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX); RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -FLT_MAX, FLT_MAX); - prop = RNA_def_boolean_layer_member(ot->srna, "layer", 20, NULL, "Layer", ""); + prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", ""); RNA_def_property_flag(prop, PROP_HIDDEN); } @@ -200,7 +196,7 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op) RNA_float_set_array(op->ptr, "location", loc); } - if(!RNA_property_is_set(op->ptr, "layer")) { + if(!RNA_property_is_set(op->ptr, "layers")) { View3D *v3d = CTX_wm_view3d(C); Scene *scene = CTX_data_scene(C); int a, values[20], layer; @@ -218,7 +214,7 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op) values[a]= (layer & (1<<a)); } - RNA_boolean_set_array(op->ptr, "layer", values); + RNA_boolean_set_array(op->ptr, "layers", values); } } @@ -239,8 +235,8 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa *enter_editmode = TRUE; } - if(RNA_property_is_set(op->ptr, "layer")) { - RNA_boolean_get_array(op->ptr, "layer", layer_values); + if(RNA_property_is_set(op->ptr, "layers")) { + RNA_boolean_get_array(op->ptr, "layers", layer_values); *layer= 0; for(a=0; a<20; a++) { if(layer_values[a]) @@ -260,7 +256,9 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa if(v3d && v3d->localvd) *layer |= v3d->lay; - if (RNA_property_is_set(op->ptr, "view_align")) + if(RNA_property_is_set(op->ptr, "rotation")) + view_align = FALSE; + else if (RNA_property_is_set(op->ptr, "view_align")) view_align = RNA_boolean_get(op->ptr, "view_align"); else view_align = U.flag & USER_ADD_VIEWALIGNED; @@ -307,6 +305,8 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot, int en if(enter_editmode) ED_object_enter_editmode(C, EM_IGNORE_LAYER); + WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene); + return ob; } @@ -495,7 +495,7 @@ void OBJECT_OT_camera_add(wmOperatorType *ot) static EnumPropertyItem prop_metaball_types[]= { {MB_BALL, "MBALL_BALL", ICON_META_BALL, "Meta Ball", ""}, - {MB_TUBE, "MBALL_TUBE", ICON_META_TUBE, "Meta Tube", ""}, + {MB_TUBE, "MBALL_CAPSULE", ICON_META_CAPSULE, "Meta Capsule", ""}, {MB_PLANE, "MBALL_PLANE", ICON_META_PLANE, "Meta Plane", ""}, {MB_CUBE, "MBALL_CUBE", ICON_META_CUBE, "Meta Cube", ""}, {MB_ELIPSOID, "MBALL_ELLIPSOID", ICON_META_ELLIPSOID, "Meta Ellipsoid", ""}, @@ -505,7 +505,6 @@ static EnumPropertyItem prop_metaball_types[]= { static int object_metaball_add_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); - MetaBall *mball; MetaElem *elem; int newob= 0; int enter_editmode; @@ -527,9 +526,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op) ED_object_new_primitive_matrix(C, obedit, loc, rot, mat); elem= (MetaElem*)add_metaball_primitive(C, mat, RNA_enum_get(op->ptr, "type"), newob); - mball= (MetaBall*)obedit->data; - BLI_addtail(mball->editelems, elem); - + /* userdef */ if (newob && !enter_editmode) { ED_object_exit_editmode(C, EM_FREEDATA); @@ -830,7 +827,8 @@ static int object_delete_exec(bContext *C, wmOperator *op) DAG_scene_sort(bmain, scene); DAG_ids_flush_update(bmain, 0); - WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C)); + WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene); + WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 6261c33a6f7..f81e73faf73 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -48,8 +48,7 @@ #include "BKE_global.h" #include "BKE_image.h" #include "BKE_main.h" -#include "BKE_object.h" -#include "BKE_utildefines.h" +#include "BKE_multires.h" #include "BKE_report.h" #include "RE_pipeline.h" @@ -65,6 +64,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "ED_object.h" /* ****************** render BAKING ********************** */ @@ -139,6 +139,12 @@ static void init_bake_internal(BakeRender *bkr, bContext *C) { Scene *scene= CTX_data_scene(C); + /* flush multires changes (for sculpt) */ + multires_force_render_update(CTX_data_active_object(C)); + + /* get editmode results */ + ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */ + bkr->sa= biggest_image_area(CTX_wm_screen(C)); /* can be NULL */ bkr->main= CTX_data_main(C); bkr->scene= scene; @@ -227,11 +233,11 @@ static void bake_update(void *bkv) static void bake_freejob(void *bkv) { BakeRender *bkr= bkv; - BLI_end_threads(&bkr->threads); finish_bake_internal(bkr); - if(bkr->tot==0) BKE_report(bkr->reports, RPT_ERROR, "No Images found to bake to"); + if(bkr->tot==0) BKE_report(bkr->reports, RPT_ERROR, "No valid images found to bake to"); MEM_freeN(bkr); + G.rendering = 0; } /* catch esc */ @@ -254,6 +260,10 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_eve { Scene *scene= CTX_data_scene(C); + /* only one render job at a time */ + if(WM_jobs_test(CTX_wm_manager(C), scene)) + return OPERATOR_CANCELLED; + if(test_bake_internal(C, op->reports)==0) { return OPERATOR_CANCELLED; } @@ -271,6 +281,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_eve WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL); G.afbreek= 0; + G.rendering = 1; WM_jobs_start(CTX_wm_manager(C), steve); @@ -324,7 +335,7 @@ static int bake_image_exec(bContext *C, wmOperator *op) } BLI_end_threads(&threads); - if(bkr.tot==0) BKE_report(op->reports, RPT_ERROR, "No Images found to bake to"); + if(bkr.tot==0) BKE_report(op->reports, RPT_ERROR, "No valid images found to bake to"); finish_bake_internal(&bkr); } diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index ee1c7df0409..f5d87df10a1 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -51,7 +51,6 @@ #include "BKE_main.h" #include "BKE_object.h" #include "BKE_report.h" -#include "BKE_utildefines.h" #include "BIK_api.h" #ifndef DISABLE_PYTHON @@ -806,8 +805,10 @@ static int constraint_delete_exec (bContext *C, wmOperator *op) /* there's no active constraint now, so make sure this is the case */ constraints_set_active(lb, NULL); + ED_object_constraint_update(ob); /* needed to set the flags on posebones correctly */ + /* notifiers */ - WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob); + WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, ob); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 18da264336e..78404959dff 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -34,7 +34,11 @@ #include "MEM_guardedalloc.h" -#include "IMB_imbuf_types.h" +#include "BLI_blenlib.h" +#include "BLI_math.h" +#include "BLI_editVert.h" +#include "BLI_ghash.h" +#include "BLI_rand.h" #include "DNA_armature_types.h" #include "DNA_curve_types.h" @@ -43,57 +47,38 @@ #include "DNA_material_types.h" #include "DNA_meta_types.h" #include "DNA_property_types.h" +#include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "DNA_meshdata_types.h" #include "DNA_vfont_types.h" -#include "BLI_blenlib.h" -#include "BLI_math.h" -#include "BLI_editVert.h" -#include "BLI_ghash.h" -#include "BLI_rand.h" +#include "IMB_imbuf_types.h" -#include "BKE_action.h" #include "BKE_anim.h" -#include "BKE_armature.h" #include "BKE_constraint.h" #include "BKE_context.h" -#include "BKE_customdata.h" -#include "BKE_blender.h" -#include "BKE_cloth.h" #include "BKE_curve.h" -#include "BKE_displist.h" #include "BKE_depsgraph.h" -#include "BKE_DerivedMesh.h" -#include "BKE_effect.h" #include "BKE_font.h" -#include "BKE_global.h" -#include "BKE_group.h" #include "BKE_image.h" -#include "BKE_key.h" -#include "BKE_lattice.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_mball.h" #include "BKE_mesh.h" -#include "BKE_nla.h" #include "BKE_object.h" #include "BKE_paint.h" -#include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_property.h" -#include "BKE_report.h" #include "BKE_sca.h" -#include "BKE_scene.h" #include "BKE_softbody.h" -#include "BKE_subsurf.h" -#include "BKE_texture.h" -#include "BKE_utildefines.h" #include "BKE_modifier.h" #include "ED_armature.h" #include "ED_curve.h" #include "ED_mesh.h" #include "ED_mball.h" +#include "ED_lattice.h" #include "ED_object.h" #include "ED_screen.h" #include "ED_util.h" @@ -954,14 +939,15 @@ void special_editmenu(Scene *scene, View3D *v3d) static float weight= 1.0f; { // XXX // XXX if(fbutton(&weight, 0.0f, 1.0f, 10, 10, "Set Weight")) { - int a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw; - BPoint *bp= lt->editlatt->def; + Lattice *editlt= lt->editlatt->latt; + int a= editlt->pntsu*editlt->pntsv*editlt->pntsw; + BPoint *bp= editlt->def; while(a--) { if(bp->f1 & SELECT) bp->weight= weight; bp++; - } + } } } diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index b0a6c6471a2..f000485466f 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -29,7 +29,6 @@ #include <string.h> -#include "MEM_guardedalloc.h" #include "BLI_blenlib.h" @@ -39,11 +38,9 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" -#include "BKE_global.h" #include "BKE_group.h" #include "BKE_main.h" #include "BKE_report.h" -#include "BKE_scene.h" #include "ED_screen.h" diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index fefefae586c..75e22d5356f 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -43,7 +43,6 @@ #include "BKE_action.h" #include "BKE_context.h" -#include "BKE_customdata.h" #include "BKE_depsgraph.h" #include "BKE_main.h" #include "BKE_mesh.h" @@ -51,7 +50,6 @@ #include "BKE_object.h" #include "BKE_report.h" #include "BKE_scene.h" -#include "BKE_utildefines.h" #include "RNA_define.h" #include "RNA_access.h" @@ -193,13 +191,14 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar static void select_editlattice_hook(Object *obedit, HookModifierData *hmd) { - Lattice *lt= obedit->data; + Lattice *lt= obedit->data, *editlt; BPoint *bp; int index=0, nr=0, a; - + + editlt= lt->editlatt->latt; /* count */ - a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw; - bp= lt->editlatt->def; + a= editlt->pntsu*editlt->pntsv*editlt->pntsw; + bp= editlt->def; while(a--) { if(hmd->indexar[index]==nr) { bp->f1 |= SELECT; @@ -315,7 +314,7 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char case OB_LATTICE: { Lattice *lt= obedit->data; - return return_editlattice_indexar(lt->editlatt, tot, indexar, cent_r); + return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r); } default: return 0; diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 38777722605..4dc5532e975 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -131,11 +131,6 @@ void OBJECT_OT_hook_reset(struct wmOperatorType *ot); void OBJECT_OT_hook_recenter(struct wmOperatorType *ot); /* object_lattice.c */ -void free_editLatt(struct Object *ob); -void make_editLatt(struct Object *obedit); -void load_editLatt(struct Object *obedit); -void remake_editLatt(struct Object *obedit); - void LATTICE_OT_select_all(struct wmOperatorType *ot); void LATTICE_OT_make_regular(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 52f779748fa..9f82a1209cf 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -45,7 +45,8 @@ #include "BKE_key.h" #include "BKE_lattice.h" #include "BKE_mesh.h" -#include "BKE_utildefines.h" + +#include "BLI_listbase.h" #include "ED_screen.h" #include "ED_view3d.h" @@ -63,12 +64,16 @@ void free_editLatt(Object *ob) Lattice *lt= ob->data; if(lt->editlatt) { - if(lt->editlatt->def) - MEM_freeN(lt->editlatt->def); - if(lt->editlatt->dvert) - free_dverts(lt->editlatt->dvert, lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw); - + Lattice *editlt= lt->editlatt->latt; + + if(editlt->def) + MEM_freeN(editlt->def); + if(editlt->dvert) + free_dverts(editlt->dvert, editlt->pntsu*editlt->pntsv*editlt->pntsw); + + MEM_freeN(editlt); MEM_freeN(lt->editlatt); + lt->editlatt= NULL; } } @@ -77,47 +82,51 @@ void make_editLatt(Object *obedit) { Lattice *lt= obedit->data; KeyBlock *actkey; - + free_editLatt(obedit); - + lt= obedit->data; actkey= ob_get_keyblock(obedit); if(actkey) key_to_latt(actkey, lt); - lt->editlatt= MEM_dupallocN(lt); - lt->editlatt->def= MEM_dupallocN(lt->def); - + lt->editlatt= MEM_callocN(sizeof(EditLatt), "editlatt"); + lt->editlatt->latt= MEM_dupallocN(lt); + lt->editlatt->latt->def= MEM_dupallocN(lt->def); + if(lt->dvert) { int tot= lt->pntsu*lt->pntsv*lt->pntsw; - lt->editlatt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert"); - copy_dverts(lt->editlatt->dvert, lt->dvert, tot); + lt->editlatt->latt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert"); + copy_dverts(lt->editlatt->latt->dvert, lt->dvert, tot); } + + if(lt->key) lt->editlatt->shapenr= obedit->shapenr; } void load_editLatt(Object *obedit) { - Lattice *lt; + Lattice *lt, *editlt; KeyBlock *actkey; BPoint *bp; float *fp; int tot; - + lt= obedit->data; - - actkey= ob_get_keyblock(obedit); + editlt= lt->editlatt->latt; + + if(lt->editlatt->shapenr) { + actkey= BLI_findlink(<->key->block, lt->editlatt->shapenr-1); - if(actkey) { /* active key: vertices */ - tot= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw; + tot= editlt->pntsu*editlt->pntsv*editlt->pntsw; if(actkey->data) MEM_freeN(actkey->data); fp=actkey->data= MEM_callocN(lt->key->elemsize*tot, "actkey->data"); actkey->totelem= tot; - - bp= lt->editlatt->def; + + bp= editlt->def; while(tot--) { VECCOPY(fp, bp->vec); fp+= 3; @@ -126,30 +135,30 @@ void load_editLatt(Object *obedit) } else { MEM_freeN(lt->def); - - lt->def= MEM_dupallocN(lt->editlatt->def); - lt->flag= lt->editlatt->flag; + lt->def= MEM_dupallocN(editlt->def); - lt->pntsu= lt->editlatt->pntsu; - lt->pntsv= lt->editlatt->pntsv; - lt->pntsw= lt->editlatt->pntsw; + lt->flag= editlt->flag; + + lt->pntsu= editlt->pntsu; + lt->pntsv= editlt->pntsv; + lt->pntsw= editlt->pntsw; - lt->typeu= lt->editlatt->typeu; - lt->typev= lt->editlatt->typev; - lt->typew= lt->editlatt->typew; + lt->typeu= editlt->typeu; + lt->typev= editlt->typev; + lt->typew= editlt->typew; } - + if(lt->dvert) { free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw); lt->dvert= NULL; } - - if(lt->editlatt->dvert) { + + if(editlt->dvert) { int tot= lt->pntsu*lt->pntsv*lt->pntsw; - + lt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert"); - copy_dverts(lt->dvert, lt->editlatt->dvert, tot); + copy_dverts(lt->dvert, editlt->dvert, tot); } } @@ -161,9 +170,9 @@ void ED_setflagsLatt(Object *obedit, int flag) BPoint *bp; int a; - bp= lt->editlatt->def; + bp= lt->editlatt->latt->def; - a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw; + a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw; while(a--) { if(bp->hide==0) { @@ -184,8 +193,8 @@ int select_all_exec(bContext *C, wmOperator *op) if (action == SEL_TOGGLE) { action = SEL_SELECT; - bp= lt->editlatt->def; - a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw; + bp= lt->editlatt->latt->def; + a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw; while(a--) { if(bp->hide==0) { @@ -206,8 +215,8 @@ int select_all_exec(bContext *C, wmOperator *op) ED_setflagsLatt(obedit, 0); break; case SEL_INVERT: - bp= lt->editlatt->def; - a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw; + bp= lt->editlatt->latt->def; + a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw; while(a--) { if(bp->hide==0) { @@ -257,7 +266,7 @@ int make_regular_exec(bContext *C, wmOperator *op) if(ob) { lt= ob->data; - resizelattice(lt->editlatt, lt->pntsu, lt->pntsv, lt->pntsw, NULL); + resizelattice(lt->editlatt->latt, lt->pntsu, lt->pntsv, lt->pntsw, NULL); } else { ob= CTX_data_active_object(C); @@ -355,21 +364,21 @@ typedef struct UndoLattice { static void undoLatt_to_editLatt(void *data, void *edata) { UndoLattice *ult= (UndoLattice*)data; - Lattice *editlatt= (Lattice *)edata; - int a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw; + EditLatt *editlatt= (EditLatt *)edata; + int a= editlatt->latt->pntsu*editlatt->latt->pntsv*editlatt->latt->pntsw; - memcpy(editlatt->def, ult->def, a*sizeof(BPoint)); + memcpy(editlatt->latt->def, ult->def, a*sizeof(BPoint)); } static void *editLatt_to_undoLatt(void *edata) { UndoLattice *ult= MEM_callocN(sizeof(UndoLattice), "UndoLattice"); - Lattice *editlatt= (Lattice *)edata; + EditLatt *editlatt= (EditLatt *)edata; - ult->def= MEM_dupallocN(editlatt->def); - ult->pntsu= editlatt->pntsu; - ult->pntsv= editlatt->pntsv; - ult->pntsw= editlatt->pntsw; + ult->def= MEM_dupallocN(editlatt->latt->def); + ult->pntsu= editlatt->latt->pntsu; + ult->pntsv= editlatt->latt->pntsv; + ult->pntsw= editlatt->latt->pntsw; return ult; } @@ -385,11 +394,11 @@ static void free_undoLatt(void *data) static int validate_undoLatt(void *data, void *edata) { UndoLattice *ult= (UndoLattice*)data; - Lattice *editlatt= (Lattice *)edata; + EditLatt *editlatt= (EditLatt *)edata; - return (ult->pntsu == editlatt->pntsu && - ult->pntsv == editlatt->pntsv && - ult->pntsw == editlatt->pntsw); + return (ult->pntsu == editlatt->latt->pntsu && + ult->pntsv == editlatt->latt->pntsv && + ult->pntsw == editlatt->latt->pntsw); } static void *get_editlatt(bContext *C) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index a54ed9bd239..7cf24d5d07d 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -43,7 +43,6 @@ #include "BLI_string.h" #include "BLI_path_util.h" -#include "BKE_action.h" #include "BKE_curve.h" #include "BKE_context.h" #include "BKE_depsgraph.h" @@ -61,7 +60,6 @@ #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_softbody.h" -#include "BKE_utildefines.h" #include "RNA_access.h" #include "RNA_define.h" @@ -144,6 +142,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) { ModifierData *obmd; + int sort_depsgraph = 0; /* It seems on rapid delete it is possible to * get called twice on same modifier, so make @@ -176,13 +175,13 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob if(ob->pd) ob->pd->deflect= 0; - DAG_scene_sort(bmain, scene); + sort_depsgraph = 1; } else if(md->type == eModifierType_Surface) { if(ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE) ob->pd->shape = PFIELD_SHAPE_PLANE; - DAG_scene_sort(bmain, scene); + sort_depsgraph = 1; } else if(md->type == eModifierType_Smoke) { ob->dt = OB_TEXTURE; @@ -199,6 +198,10 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + /* sorting has to be done after the update so that dynamic systems can react properly */ + if(sort_depsgraph) + DAG_scene_sort(bmain, scene); + return 1; } @@ -455,6 +458,21 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, BKE_report(reports, RPT_ERROR, "Cannot apply modifier for this object type"); return 0; } + + /* lattice modifier can be applied to particle system too */ + if(ob->particlesystem.first) { + + ParticleSystem *psys = ob->particlesystem.first; + + for(; psys; psys=psys->next) { + + if(psys->part->type != PART_HAIR) + continue; + + psys_apply_hair_lattice(scene, ob, psys); + } + } + return 1; } diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index ddbc0dd133a..ef68d5507d3 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -29,7 +29,6 @@ #include <stdlib.h> #include <math.h> -#include "MEM_guardedalloc.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -38,8 +37,6 @@ #include "BLI_blenlib.h" #include "BKE_context.h" -#include "BKE_global.h" -#include "BKE_utildefines.h" #include "RNA_access.h" #include "RNA_define.h" @@ -393,25 +390,25 @@ void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keym if(do_pet) { /* context ops */ kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_enum", OKEY, KM_PRESS, KM_SHIFT, 0); - RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing_falloff"); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit_falloff"); // Object mode if (do_pet == 1) { kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0); - RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing_objects"); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_proportional_edit_objects"); } else { // Edit mode kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0); - RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing"); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit"); RNA_string_set(kmi->ptr, "value_1", "DISABLED"); RNA_string_set(kmi->ptr, "value_2", "ENABLED"); /* for modes/object types that allow 'connected' mode, add the Alt O key */ if (do_pet == 3) { kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, KM_ALT, 0); - RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing"); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit"); RNA_string_set(kmi->ptr, "value_1", "DISABLED"); RNA_string_set(kmi->ptr, "value_2", "CONNECTED"); } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index ceba2ad3997..2a0289ca8b3 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -69,7 +69,6 @@ #include "BKE_sca.h" #include "BKE_scene.h" #include "BKE_texture.h" -#include "BKE_utildefines.h" #include "WM_api.h" #include "WM_types.h" @@ -173,8 +172,8 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) else if(obedit->type==OB_LATTICE) { Lattice *lt= obedit->data; - a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw; - bp= lt->editlatt->def; + a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw; + bp= lt->editlatt->latt->def; while(a--) { if(bp->f1 & SELECT) { if(v1==0) v1= nr; @@ -422,6 +421,9 @@ static int parent_clear_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { + if(ob->parent == NULL) + continue; + if(type == 0) { ob->parent= NULL; } @@ -570,8 +572,8 @@ static int parent_set_exec(bContext *C, wmOperator *op) Object workob; /* apply transformation of previous parenting */ - object_apply_mat4(ob, ob->obmat); - + /* object_apply_mat4(ob, ob->obmat); */ /* removed because of bug [#23577] */ + /* set the parent (except for follow-path constraint option) */ if(partype != PAR_PATH_CONST) ob->parent= par; @@ -1033,7 +1035,7 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op) int values[20], a; unsigned int lay= 0; - if(!RNA_property_is_set(op->ptr, "layer")) { + if(!RNA_property_is_set(op->ptr, "layers")) { CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { lay |= base->lay; } @@ -1042,10 +1044,10 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op) for(a=0; a<20; a++) values[a]= (lay & (1<<a)); - RNA_boolean_set_array(op->ptr, "layer", values); + RNA_boolean_set_array(op->ptr, "layers", values); } else { - RNA_boolean_get_array(op->ptr, "layer", values); + RNA_boolean_get_array(op->ptr, "layers", values); for(a=0; a<20; a++) if(values[a]) @@ -1110,6 +1112,8 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) /* warning, active object may be hidden now */ WM_event_add_notifier(C, NC_SCENE|NC_OBJECT|ND_DRAW, scene); /* is NC_SCENE needed ? */ + WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene); + DAG_scene_sort(bmain, scene); return OPERATOR_FINISHED; @@ -1131,7 +1135,7 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_boolean_layer_member(ot->srna, "layer", 20, NULL, "Layer", ""); + RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", ""); } /************************** Link to Scene Operator *****************************/ @@ -1888,7 +1892,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - ot->prop= RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); + ot->prop= RNA_def_enum(ot->srna, "type", type_items, SELECT, "Type", ""); RNA_def_boolean(ot->srna, "object", 0, "Object", "Make single user objects"); RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data"); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 3c86c135914..fa9a97f4e74 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -44,7 +44,6 @@ #include "BLI_string.h" #include "BKE_context.h" -#include "BKE_depsgraph.h" #include "BKE_group.h" #include "BKE_main.h" #include "BKE_material.h" @@ -52,7 +51,6 @@ #include "BKE_property.h" #include "BKE_report.h" #include "BKE_scene.h" -#include "BKE_utildefines.h" #include "BKE_deform.h" #include "WM_api.h" @@ -637,7 +635,7 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op) short extend; extend= RNA_boolean_get(op->ptr, "extend"); - layernum = RNA_int_get(op->ptr, "layer"); + layernum = RNA_int_get(op->ptr, "layers"); if (extend == 0) { CTX_DATA_BEGIN(C, Base*, base, visible_bases) { @@ -675,7 +673,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first."); - RNA_def_int(ot->srna, "layer", 1, 1, 20, "Layer", "", 1, 20); + RNA_def_int(ot->srna, "layers", 1, 1, 20, "Layer", "", 1, 20); } /************************** Select Inverse *************************/ diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 2a0fca19be4..7b1ab933e28 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -47,18 +47,12 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" -#include "BKE_action.h" #include "BKE_context.h" -#include "BKE_curve.h" #include "BKE_depsgraph.h" -#include "BKE_global.h" -#include "BKE_ipo.h" #include "BKE_key.h" #include "BKE_library.h" #include "BKE_main.h" -#include "BKE_mesh.h" #include "BKE_object.h" -#include "BKE_utildefines.h" #include "BLO_sys_types.h" // for intptr_t support diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index ba9a03194ac..5214676331c 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -43,12 +43,10 @@ #include "BKE_context.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" -#include "BKE_global.h" #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_object.h" #include "BKE_report.h" -#include "BKE_utildefines.h" #include "RNA_define.h" #include "RNA_access.h" @@ -57,7 +55,6 @@ #include "WM_types.h" #include "ED_armature.h" -#include "ED_curve.h" #include "ED_keyframing.h" #include "ED_mesh.h" #include "ED_screen.h" @@ -71,7 +68,16 @@ static int object_location_clear_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location"); + KeyingSet *ks; + + /* get KeyingSet to use + * - use the active KeyingSet if defined (and user wants to use it for all autokeying), + * or otherwise key transforms only + */ + if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) + ks = ANIM_scene_get_active_keyingset(scene); + else + ks = ANIM_builtin_keyingset_get_named(NULL, "Location"); /* clear location of selected objects if not in weight-paint mode */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -130,7 +136,16 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); + KeyingSet *ks; + + /* get KeyingSet to use + * - use the active KeyingSet if defined (and user wants to use it for all autokeying), + * or otherwise key transforms only + */ + if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) + ks = ANIM_scene_get_active_keyingset(scene); + else + ks = ANIM_builtin_keyingset_get_named(NULL, "Rotation"); /* clear rotation of selected objects if not in weight-paint mode */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -273,7 +288,16 @@ static int object_scale_clear_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); - KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Scaling"); + KeyingSet *ks; + + /* get KeyingSet to use + * - use the active KeyingSet if defined (and user wants to use it for all autokeying), + * or otherwise key transforms only + */ + if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) + ks = ANIM_scene_get_active_keyingset(scene); + else + ks = ANIM_builtin_keyingset_get_named(NULL, "Scaling"); /* clear scales of selected objects if not in weight-paint mode */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index ff48e7e349a..76af8feda82 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -50,13 +50,8 @@ #include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_depsgraph.h" -#include "BKE_DerivedMesh.h" -#include "BKE_displist.h" #include "BKE_global.h" -#include "BKE_lattice.h" #include "BKE_mesh.h" -#include "BKE_paint.h" -#include "BKE_utildefines.h" #include "BKE_report.h" #include "RNA_access.h" @@ -78,7 +73,7 @@ static Lattice *vgroup_edit_lattice(Object *ob) { if(ob->type==OB_LATTICE) { Lattice *lt= ob->data; - return (lt->editlatt)? lt->editlatt: lt; + return (lt->editlatt)? lt->editlatt->latt: lt; } return NULL; @@ -88,7 +83,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, char *name) { bDeformGroup *defgroup; - if(!ob) + if(!ob || !ELEM(ob->type, OB_MESH, OB_LATTICE)) return NULL; defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup"); @@ -174,7 +169,7 @@ int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_tot) int i=0; Lattice *lt= (Lattice *)id; - lt= (lt->editlatt)? lt->editlatt: lt; + lt= (lt->editlatt)? lt->editlatt->latt: lt; *dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw; *dvert_arr= MEM_mallocN(sizeof(void*)*(*dvert_tot), "vgroup parray from me"); @@ -208,7 +203,7 @@ int ED_vgroup_give_array(ID *id, MDeformVert **dvert_arr, int *dvert_tot) case ID_LT: { Lattice *lt= (Lattice *)id; - lt= (lt->editlatt)? lt->editlatt: lt; + lt= (lt->editlatt)? lt->editlatt->latt: lt; *dvert_arr= lt->dvert; *dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw; return TRUE; @@ -537,18 +532,8 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum) } void ED_vgroup_select_by_name(Object *ob, char *name) -{ - bDeformGroup *curdef; - int actdef= 1; - - for(curdef = ob->defbase.first; curdef; curdef=curdef->next, actdef++){ - if(!strcmp(curdef->name, name)) { - ob->actdef= actdef; - return; - } - } - - ob->actdef= 0; // this signals on painting to create a new one, if a bone in posemode is selected */ +{ /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */ + ob->actdef= defgroup_name_index(ob, name) + 1; } /********************** Operator Implementations *********************/ @@ -1356,7 +1341,7 @@ static void vgroup_assign_verts(Object *ob, float weight) EditMesh *em = BKE_mesh_get_editmesh(me); if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) - EM_add_data_layer(em, &em->vdata, CD_MDEFORMVERT); + EM_add_data_layer(em, &em->vdata, CD_MDEFORMVERT, NULL); /* Go through the list of editverts and assign them */ for(eve=em->verts.first; eve; eve=eve->next){ @@ -2082,6 +2067,8 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op) vgroup_remap_update_users(ob, sort_map_update); ob->actdef= sort_map_update[ob->actdef]; + + MEM_freeN(sort_map_update); return OPERATOR_FINISHED; } @@ -2091,7 +2078,7 @@ static int vgroup_sort(void *def_a_ptr, void *def_b_ptr) bDeformGroup *def_a= (bDeformGroup *)def_a_ptr; bDeformGroup *def_b= (bDeformGroup *)def_b_ptr; - return strcmp(def_a->name, def_b->name); + return BLI_natstrcmp(def_a->name, def_b->name); } static int vertex_group_sort_exec(bContext *C, wmOperator *op) |