Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2011-09-07 19:34:04 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2011-09-07 19:34:04 +0400
commitdbd6658d737b1592a633ddf6397be14e50e434d9 (patch)
tree57081721d70622a3c3141909b258f9bce8a5b1e3 /source/blender/editors/object
parentb5bd86e5907c3fa98546dabeda9703dfb15862f4 (diff)
parent884fc84793be1c5fdd6643ad267331381f8e1c6b (diff)
svn merge -r 37306:39975 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/CMakeLists.txt4
-rw-r--r--source/blender/editors/object/SConscript2
-rw-r--r--source/blender/editors/object/object_add.c109
-rw-r--r--source/blender/editors/object/object_bake.c46
-rw-r--r--source/blender/editors/object/object_constraint.c12
-rw-r--r--source/blender/editors/object/object_edit.c137
-rw-r--r--source/blender/editors/object/object_hook.c30
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_modifier.c48
-rw-r--r--source/blender/editors/object/object_ops.c1
-rw-r--r--source/blender/editors/object/object_relations.c43
-rw-r--r--source/blender/editors/object/object_select.c40
-rw-r--r--source/blender/editors/object/object_transform.c15
13 files changed, 263 insertions, 225 deletions
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 3e9025be127..de74a0321c7 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -22,16 +22,16 @@
set(INC
../include
../../blenkernel
- ../../blenloader
../../blenlib
+ ../../blenloader
../../gpu
../../ikplugin
../../imbuf
../../makesdna
../../makesrna
../../python
- ../../windowmanager
../../render/extern/include
+ ../../windowmanager
../../../../intern/guardedalloc
../../../../extern/recastnavigation/Recast/Include
)
diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript
index 5460e3fa7fb..900c96044a5 100644
--- a/source/blender/editors/object/SConscript
+++ b/source/blender/editors/object/SConscript
@@ -11,7 +11,7 @@ incs += ' #extern/recastnavigation/Recast/Include'
defs = []
-if env['OURPLATFORM'] == 'linux2':
+if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index c5236a38970..fa529374bf7 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -35,15 +35,18 @@
#include "MEM_guardedalloc.h"
+#include "DNA_anim_types.h"
#include "DNA_curve_types.h"
#include "DNA_group_types.h"
#include "DNA_lamp_types.h"
+#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_fluidsim.h"
#include "DNA_object_force.h"
#include "DNA_scene_types.h"
+#include "DNA_speaker_types.h"
#include "DNA_vfont_types.h"
#include "BLI_math.h"
@@ -63,15 +66,18 @@
#include "BKE_group.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
+#include "BKE_key.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mball.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
+#include "BKE_nla.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_report.h"
#include "BKE_sca.h"
+#include "BKE_speaker.h"
#include "BKE_texture.h"
#include "RNA_access.h"
@@ -182,7 +188,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
}
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);
+ RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f);
prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -270,8 +276,10 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa
RNA_boolean_set(op->ptr, "view_align", view_align);
}
- if (view_align)
+ if (view_align) {
ED_object_rotation_from_view(C, rot);
+ RNA_float_set_array(op->ptr, "rotation", rot);
+ }
else
RNA_float_get_array(op->ptr, "rotation", rot);
@@ -764,6 +772,61 @@ static int group_instance_add_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+static int object_speaker_add_exec(bContext *C, wmOperator *op)
+{
+ Object *ob;
+ int enter_editmode;
+ unsigned int layer;
+ float loc[3], rot[3];
+ Scene *scene = CTX_data_scene(C);
+
+ object_add_generic_invoke_options(C, op);
+ if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+ return OPERATOR_CANCELLED;
+
+ ob= ED_object_add_type(C, OB_SPEAKER, loc, rot, FALSE, layer);
+
+ /* to make it easier to start using this immediately in NLA, a default sound clip is created
+ * ready to be moved around to retime the sound and/or make new sound clips
+ */
+ {
+ /* create new data for NLA hierarchy */
+ AnimData *adt = BKE_id_add_animdata(&ob->id);
+ NlaTrack *nlt = add_nlatrack(adt, NULL);
+ NlaStrip *strip = add_nla_soundstrip(CTX_data_scene(C), ob->data);
+ strip->start = CFRA;
+ strip->end += strip->start;
+
+ /* hook them up */
+ BKE_nlatrack_add_strip(nlt, strip);
+
+ /* auto-name the strip, and give the track an interesting name */
+ strcpy(nlt->name, "SoundTrack");
+ BKE_nlastrip_validate_name(adt, strip);
+
+ WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_speaker_add(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Add Speaker";
+ ot->description = "Add a speaker object to the scene";
+ ot->idname= "OBJECT_OT_speaker_add";
+
+ /* api callbacks */
+ ot->exec= object_speaker_add_exec;
+ ot->poll= ED_operator_objectmode;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ ED_object_add_generic_props(ot, TRUE);
+}
+
/* only used as menu */
void OBJECT_OT_group_instance_add(wmOperatorType *ot)
{
@@ -806,14 +869,14 @@ static int object_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
- int islamp= 0;
+ /* int islamp= 0; */ /* UNUSED */
if(CTX_data_edit_object(C))
return OPERATOR_CANCELLED;
CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
- if(base->object->type==OB_LAMP) islamp= 1;
+ /* if(base->object->type==OB_LAMP) islamp= 1; */
/* deselect object -- it could be used in other scenes */
base->object->flag &= ~SELECT;
@@ -823,8 +886,6 @@ static int object_delete_exec(bContext *C, wmOperator *UNUSED(op))
}
CTX_DATA_END;
- if(islamp) reshadeall_displist(scene); /* only frees displist */
-
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
@@ -1439,28 +1500,6 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
/* duplicates using userflags */
-#if 0 // XXX old animation system
- if(dupflag & USER_DUP_IPO) {
- bConstraintChannel *chan;
- id= (ID *)obn->ipo;
-
- if(id) {
- ID_NEW_US( obn->ipo)
- else obn->ipo= copy_ipo(obn->ipo);
- id->us--;
- }
- /* Handle constraint ipos */
- for (chan=obn->constraintChannels.first; chan; chan=chan->next){
- id= (ID *)chan->ipo;
- if(id) {
- ID_NEW_US( chan->ipo)
- else chan->ipo= copy_ipo(chan->ipo);
- id->us--;
- }
- }
- }
-#endif // XXX old animation system
-
if(dupflag & USER_DUP_ACT) {
BKE_copy_animdata_id_action(&obn->id);
}
@@ -1602,12 +1641,26 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
id->us--;
}
break;
+ case OB_SPEAKER:
+ if(dupflag!=0) {
+ ID_NEW_US2(obn->data )
+ else {
+ obn->data= copy_speaker(obn->data);
+ didit= 1;
+ }
+ id->us--;
+ }
+ break;
+
}
/* check if obdata is copied */
if(didit) {
+ Key *key = ob_get_key(obn);
+
if(dupflag & USER_DUP_ACT) {
BKE_copy_animdata_id_action((ID *)obn->data);
+ if(key) BKE_copy_animdata_id_action((ID*)key);
}
if(dupflag & USER_DUP_MAT) {
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 565c5810cff..07c006a7995 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -159,7 +159,7 @@ typedef struct {
static void multiresbake_get_normal(const MResolvePixelData *data, float norm[], const int face_num, const int vert_index)
{
unsigned int indices[]= {data->mface[face_num].v1, data->mface[face_num].v2,
- data->mface[face_num].v3, data->mface[face_num].v4};
+ data->mface[face_num].v3, data->mface[face_num].v4};
const int smoothnormal= (data->mface[face_num].flag & ME_SMOOTH);
if(!smoothnormal) { /* flat */
@@ -636,14 +636,14 @@ static void apply_heights_data(void *bake_data)
if(ibuf->rect_float) {
float *rrgbf= ibuf->rect_float + i*4;
- if(max-min > 1e-5) height= (heights[i]-min)/(max-min);
+ if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
else height= 0;
rrgbf[0]=rrgbf[1]=rrgbf[2]= height;
} else {
char *rrgb= (char*)ibuf->rect + i*4;
- if(max-min > 1e-5) height= (heights[i]-min)/(max-min);
+ if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
else height= 0;
rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height);
@@ -852,37 +852,18 @@ static void finish_images(MultiresBakeRender *bkr)
for(link= bkr->image.first; link; link= link->next) {
Image *ima= (Image*)link->data;
- int i;
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
if(ibuf->x<=0 || ibuf->y<=0)
continue;
- /* Margin */
- if(bkr->bake_filter) {
- char *temprect;
+ RE_bake_ibuf_filter(ibuf, (char *)ibuf->userdata, bkr->bake_filter);
- /* extend the mask +2 pixels from the image,
- * this is so colors dont blend in from outside */
-
- for(i=0; i<bkr->bake_filter; i++)
- IMB_mask_filter_extend((char *)ibuf->userdata, ibuf->x, ibuf->y);
-
- temprect = MEM_dupallocN(ibuf->userdata);
-
- /* expand twice to clear this many pixels, so they blend back in */
- IMB_mask_filter_extend(temprect, ibuf->x, ibuf->y);
- IMB_mask_filter_extend(temprect, ibuf->x, ibuf->y);
-
- /* clear all pixels in the margin */
- IMB_mask_clear(ibuf, temprect, FILTER_MASK_MARGIN);
- MEM_freeN(temprect);
+ ibuf->userflags|= IB_BITMAPDIRTY;
- for(i= 0; i<bkr->bake_filter; i++)
- IMB_filter_extend(ibuf, (char *)ibuf->userdata);
- }
+ if(ibuf->rect_float)
+ ibuf->userflags|= IB_RECT_INVALID;
- ibuf->userflags|= IB_BITMAPDIRTY;
if(ibuf->mipmap[0]) {
ibuf->userflags|= IB_MIPMAP_INVALID;
imb_freemipmapImBuf(ibuf);
@@ -989,9 +970,10 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0);
Mesh *me= (Mesh*)ob->data;
- *lvl= mmd->lvl;
+ if(ob->mode==OB_MODE_SCULPT) *lvl= mmd->sculptlvl;
+ else *lvl= mmd->lvl;
- if(mmd->lvl==0) {
+ if(*lvl==0) {
DerivedMesh *tmp_dm= CDDM_from_mesh(me, ob);
dm= CDDM_copy(tmp_dm);
tmp_dm->release(tmp_dm);
@@ -999,7 +981,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
MultiresModifierData tmp_mmd= *mmd;
DerivedMesh *cddm= CDDM_from_mesh(me, ob);
- tmp_mmd.lvl= mmd->lvl;
+ tmp_mmd.lvl= *lvl;
dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0, 0);
cddm->release(cddm);
}
@@ -1028,7 +1010,8 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
static void clear_images(MTFace *mtface, int totface)
{
int a;
- float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f};
+ const float vec_alpha[4]= {0.0f, 0.0f, 0.0f, 0.0f};
+ const float vec_solid[4]= {0.0f, 0.0f, 0.0f, 1.0f};
for(a= 0; a<totface; a++)
mtface[a].tpage->id.flag&= ~LIB_DOIT;
@@ -1039,7 +1022,7 @@ static void clear_images(MTFace *mtface, int totface)
if((ima->id.flag&LIB_DOIT)==0) {
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- IMB_rectfill(ibuf, vec);
+ IMB_rectfill(ibuf, (ibuf->depth == 32) ? vec_alpha : vec_solid);
ima->id.flag|= LIB_DOIT;
}
}
@@ -1332,7 +1315,6 @@ static void finish_bake_internal(BakeRender *bkr)
/* freed when baking is done, but if its canceled we need to free here */
if (ibuf->userdata) {
- printf("freed\n");
MEM_freeN(ibuf->userdata);
ibuf->userdata= NULL;
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 450bd70a568..2055c906b41 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -567,7 +567,8 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
}
con = constraints_findByName(list, constraint_name);
- printf("constraint found = %p, %s\n", (void *)con, (con)?con->name:"<Not found>");
+ //if (G.f & G_DEBUG)
+ //printf("constraint found = %p, %s\n", (void *)con, (con)?con->name:"<Not found>");
if (con && (type != 0) && (con->type != type))
con = NULL;
@@ -1114,14 +1115,19 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
{
/* if we're not handling the object we're copying from, copy all constraints over */
- if (obact != ob)
+ if (obact != ob) {
copy_constraints(&ob->constraints, &obact->constraints, TRUE);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ }
}
CTX_DATA_END;
/* force depsgraph to get recalculated since new relationships added */
DAG_scene_sort(bmain, scene); /* sort order of objects */
-
+
+ /* notifiers for updates */
+ WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, NULL);
+
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 527b97a6082..79cbfb6574b 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -721,7 +721,7 @@ static void spot_interactive(Object *ob, int mode)
}
#endif
-static void special_editmenu(Scene *scene, View3D *v3d)
+static void UNUSED_FUNCTION(special_editmenu)(Scene *scene, View3D *v3d)
{
// XXX static short numcuts= 2;
Object *ob= OBACT;
@@ -1049,109 +1049,6 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
}
}
-static void copymenu_modifiers(Main *bmain, Scene *scene, View3D *v3d, Object *ob)
-{
- Base *base;
- int i, event;
- char str[512];
- const char *errorstr= NULL;
-
- strcpy(str, "Copy Modifiers %t");
-
- sprintf(str+strlen(str), "|All%%x%d|%%l", NUM_MODIFIER_TYPES);
-
- for (i=eModifierType_None+1; i<NUM_MODIFIER_TYPES; i++) {
- ModifierTypeInfo *mti = modifierType_getInfo(i);
-
- if(ELEM3(i, eModifierType_Hook, eModifierType_Softbody, eModifierType_ParticleInstance)) continue;
-
- if(i == eModifierType_Collision)
- continue;
-
- if ( (mti->flags&eModifierTypeFlag_AcceptsCVs) ||
- (ob->type==OB_MESH && (mti->flags&eModifierTypeFlag_AcceptsMesh))) {
- sprintf(str+strlen(str), "|%s%%x%d", mti->name, i);
- }
- }
-
- event = pupmenu(str);
- if(event<=0) return;
-
- for (base= FIRSTBASE; base; base= base->next) {
- if(base->object != ob) {
- if(TESTBASELIB(v3d, base)) {
-
- base->object->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
-
- if (base->object->type==ob->type) {
- /* copy all */
- if (event==NUM_MODIFIER_TYPES) {
- ModifierData *md;
- object_free_modifiers(base->object);
-
- for (md=ob->modifiers.first; md; md=md->next) {
- ModifierData *nmd = NULL;
-
- if(ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_ParticleInstance)) continue;
-
- if(md->type == eModifierType_Collision)
- continue;
-
- nmd = modifier_new(md->type);
- modifier_copyData(md, nmd);
- BLI_addtail(&base->object->modifiers, nmd);
- modifier_unique_name(&base->object->modifiers, nmd);
- }
-
- copy_object_particlesystems(base->object, ob);
- copy_object_softbody(base->object, ob);
- } else {
- /* copy specific types */
- ModifierData *md, *mdn;
-
- /* remove all with type 'event' */
- for (md=base->object->modifiers.first; md; md=mdn) {
- mdn= md->next;
- if(md->type==event) {
- BLI_remlink(&base->object->modifiers, md);
- modifier_free(md);
- }
- }
-
- /* copy all with type 'event' */
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type==event) {
-
- mdn = modifier_new(event);
- BLI_addtail(&base->object->modifiers, mdn);
- modifier_unique_name(&base->object->modifiers, mdn);
-
- modifier_copyData(md, mdn);
- }
- }
-
- if(event == eModifierType_ParticleSystem) {
- object_free_particlesystems(base->object);
- copy_object_particlesystems(base->object, ob);
- }
- else if(event == eModifierType_Softbody) {
- object_free_softbody(base->object);
- copy_object_softbody(base->object, ob);
- }
- }
- }
- else
- errorstr= "Did not copy modifiers to other Object types";
- }
- }
- }
-
-// if(errorstr) notice(errorstr);
-
- DAG_scene_sort(bmain, scene);
-
-}
-
/* both pointers should exist */
static void copy_texture_space(Object *to, Object *ob)
{
@@ -1196,6 +1093,7 @@ static void copy_texture_space(Object *to, Object *ob)
}
+/* UNUSED, keep incase we want to copy functionality for use elsewhere */
static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
{
Object *ob;
@@ -1221,7 +1119,8 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
return;
}
else if(event==24) {
- copymenu_modifiers(bmain, scene, v3d, ob);
+ /* moved to object_link_modifiers */
+ /* copymenu_modifiers(bmain, scene, v3d, ob); */
return;
}
@@ -1444,7 +1343,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
DAG_ids_flush_update(bmain, 0);
}
-static void copy_attr_menu(Main *bmain, Scene *scene, View3D *v3d)
+static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v3d)
{
Object *ob;
short event;
@@ -1512,6 +1411,8 @@ static int forcefield_toggle_exec(bContext *C, wmOperator *UNUSED(op))
else
ob->pd->forcefield = 0;
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
+
return OPERATOR_FINISHED;
}
@@ -1689,7 +1590,7 @@ void OBJECT_OT_shade_flat(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Shade Flat";
- ot->description= "Display faces 'smooth' (using vertext normals)";
+ ot->description= "Display faces 'flat'";
ot->idname= "OBJECT_OT_shade_flat";
/* api callbacks */
@@ -1704,7 +1605,7 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Shade Smooth";
- ot->description= "Display faces 'flat'";
+ ot->description= "Display faces 'smooth' (using vertex normals)";
ot->idname= "OBJECT_OT_shade_smooth";
/* api callbacks */
@@ -1717,7 +1618,7 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot)
/* ********************** */
-static void image_aspect(Scene *scene, View3D *v3d)
+static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
{
/* all selected objects with an image map: scale in image aspect */
Base *base;
@@ -1792,7 +1693,7 @@ static int vergbaseco(const void *a1, const void *a2)
}
-static void auto_timeoffs(Scene *scene, View3D *v3d)
+static void UNUSED_FUNCTION(auto_timeoffs)(Scene *scene, View3D *v3d)
{
Base *base, **basesort, **bs;
float start, delta;
@@ -1833,7 +1734,7 @@ static void auto_timeoffs(Scene *scene, View3D *v3d)
}
-static void ofs_timeoffs(Scene *scene, View3D *v3d)
+static void UNUSED_FUNCTION(ofs_timeoffs)(Scene *scene, View3D *v3d)
{
float offset=0.0f;
@@ -1852,7 +1753,7 @@ static void ofs_timeoffs(Scene *scene, View3D *v3d)
}
-static void rand_timeoffs(Scene *scene, View3D *v3d)
+static void UNUSED_FUNCTION(rand_timeoffs)(Scene *scene, View3D *v3d)
{
Base *base;
float rand_ofs=0.0f;
@@ -2162,16 +2063,20 @@ static int game_property_copy_exec(bContext *C, wmOperator *op)
} CTX_DATA_END;
}
}
- else if (ELEM(type, COPY_PROPERTIES_REPLACE, COPY_PROPERTIES_MERGE)) {
+
+ else {
CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
if (ob != ob_iter) {
if (ob->data != ob_iter->data){
- if (type == 2) {/* merge */
+ if (type == COPY_PROPERTIES_REPLACE)
+ copy_properties( &ob_iter->prop, &ob->prop );
+
+ /* merge - the default when calling with no argument */
+ else {
for(prop = ob->prop.first; prop; prop= prop->next ) {
set_ob_property(ob_iter, prop);
}
- } else /* replace */
- copy_properties( &ob_iter->prop, &ob->prop );
+ }
}
}
}
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 2d547da41f6..bb32869469a 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -56,6 +56,7 @@
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"
+#include "BKE_deform.h"
#include "RNA_define.h"
#include "RNA_access.h"
@@ -85,7 +86,7 @@ static int return_editmesh_indexar(EditMesh *em, int *tot, int **indexar, float
*indexar= index= MEM_mallocN(4*totvert, "hook indexar");
*tot= totvert;
nr= 0;
- cent[0]= cent[1]= cent[2]= 0.0;
+ zero_v3(cent);
for(eve= em->verts.first; eve; eve= eve->next) {
if(eve->f & SELECT) {
@@ -102,30 +103,29 @@ static int return_editmesh_indexar(EditMesh *em, int *tot, int **indexar, float
static int return_editmesh_vgroup(Object *obedit, EditMesh *em, char *name, float *cent)
{
- MDeformVert *dvert;
- EditVert *eve;
- int i, totvert=0;
-
- cent[0]= cent[1]= cent[2]= 0.0;
-
+ zero_v3(cent);
+
if(obedit->actdef) {
-
+ const int defgrp_index= obedit->actdef-1;
+ int totvert=0;
+
+ MDeformVert *dvert;
+ EditVert *eve;
+
/* find the vertices */
for(eve= em->verts.first; eve; eve= eve->next) {
dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
if(dvert) {
- for(i=0; i<dvert->totweight; i++){
- if(dvert->dw[i].def_nr == (obedit->actdef-1)) {
- totvert++;
- add_v3_v3(cent, eve->co);
- }
+ if(defvert_find_weight(dvert, defgrp_index) > 0.0f) {
+ add_v3_v3(cent, eve->co);
+ totvert++;
}
}
}
if(totvert) {
- bDeformGroup *defGroup = BLI_findlink(&obedit->defbase, obedit->actdef-1);
- strcpy(name, defGroup->name);
+ bDeformGroup *dg = BLI_findlink(&obedit->defbase, defgrp_index);
+ BLI_strncpy(name, dg->name, sizeof(dg->name));
mul_v3_fl(cent, 1.0f/(float)totvert);
return 1;
}
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 2ff1b2d399c..3da0723ec18 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -116,6 +116,7 @@ void OBJECT_OT_armature_add(struct wmOperatorType *ot);
void OBJECT_OT_lamp_add(struct wmOperatorType *ot);
void OBJECT_OT_effector_add(struct wmOperatorType *ot);
void OBJECT_OT_camera_add(struct wmOperatorType *ot);
+void OBJECT_OT_speaker_add(struct wmOperatorType *ot);
void OBJECT_OT_group_instance_add(struct wmOperatorType *ot);
void OBJECT_OT_duplicates_make_real(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 5996037cd2d..8813b0027cd 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -399,6 +399,15 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, ModifierData *md)
{
+ ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+
+ md->scene= scene;
+
+ if (mti->isDisabled && mti->isDisabled(md, 0)) {
+ BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply");
+ return 0;
+ }
+
if (ob->type==OB_MESH) {
DerivedMesh *dm;
Mesh *me= ob->data;
@@ -442,7 +451,9 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
{
ModifierTypeInfo *mti= modifierType_getInfo(md->type);
- if (!(md->mode&eModifierMode_Realtime) || (mti->isDisabled && mti->isDisabled(md, 0))) {
+ md->scene= scene;
+
+ if (mti->isDisabled && mti->isDisabled(md, 0)) {
BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply");
return 0;
}
@@ -484,7 +495,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
CustomData_free_layer_active(&me->fdata, CD_MDISPS, me->totface);
}
}
- }
+ }
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu;
int numVerts;
@@ -530,6 +541,8 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, ModifierData *md, int mode)
{
+ int prev_mode;
+
if (scene->obedit) {
BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in editmode");
return 0;
@@ -541,12 +554,20 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
if (md!=ob->modifiers.first)
BKE_report(reports, RPT_INFO, "Applied modifier was not first, result may not be as expected.");
+ /* allow apply of a not-realtime modifier, by first re-enabling realtime. */
+ prev_mode= md->mode;
+ md->mode |= eModifierMode_Realtime;
+
if (mode == MODIFIER_APPLY_SHAPE) {
- if (!modifier_apply_shape(reports, scene, ob, md))
+ if (!modifier_apply_shape(reports, scene, ob, md)) {
+ md->mode= prev_mode;
return 0;
+ }
} else {
- if (!modifier_apply_obdata(reports, scene, ob, md))
+ if (!modifier_apply_obdata(reports, scene, ob, md)) {
+ md->mode= prev_mode;
return 0;
+ }
}
BLI_remlink(&ob->modifiers, md);
@@ -1045,7 +1066,12 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
if (!mmd)
return OPERATOR_CANCELLED;
-
+
+ if(mmd->lvl==0) {
+ BKE_report(op->reports, RPT_ERROR, "Reshape can work only with higher levels of subdivisions.");
+ return OPERATOR_CANCELLED;
+ }
+
CTX_DATA_BEGIN(C, Object*, selob, selected_editable_objects) {
if(selob->type == OB_MESH && selob != ob) {
secondob= selob;
@@ -1259,16 +1285,22 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
if(mmd->bindcagecos) {
- if(mmd->bindweights) MEM_freeN(mmd->bindweights);
- if(mmd->bindcagecos) MEM_freeN(mmd->bindcagecos);
+ MEM_freeN(mmd->bindcagecos);
if(mmd->dyngrid) MEM_freeN(mmd->dyngrid);
if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
+ if(mmd->bindinfluences) MEM_freeN(mmd->bindinfluences);
+ if(mmd->bindoffsets) MEM_freeN(mmd->bindoffsets);
if(mmd->dynverts) MEM_freeN(mmd->dynverts);
- mmd->bindweights= NULL;
+ if(mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
+ if(mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
+
mmd->bindcagecos= NULL;
mmd->dyngrid= NULL;
mmd->dyninfluences= NULL;
+ mmd->bindoffsets= NULL;
mmd->dynverts= NULL;
+ mmd->bindweights= NULL; /* deprecated */
+ mmd->bindcos= NULL; /* deprecated */
mmd->totvert= 0;
mmd->totcagevert= 0;
mmd->totinfluence= 0;
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index b7989ba5dd8..29d536c1dab 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -117,6 +117,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_armature_add);
WM_operatortype_append(OBJECT_OT_lamp_add);
WM_operatortype_append(OBJECT_OT_camera_add);
+ WM_operatortype_append(OBJECT_OT_speaker_add);
WM_operatortype_append(OBJECT_OT_add);
WM_operatortype_append(OBJECT_OT_add_named);
WM_operatortype_append(OBJECT_OT_effector_add);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index f7158e4b4ec..e9418ca9f9f 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -45,6 +45,7 @@
#include "DNA_meta_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
+#include "DNA_speaker_types.h"
#include "DNA_world_types.h"
#include "DNA_object_types.h"
@@ -75,6 +76,7 @@
#include "BKE_report.h"
#include "BKE_sca.h"
#include "BKE_scene.h"
+#include "BKE_speaker.h"
#include "BKE_texture.h"
#include "WM_api.h"
@@ -446,6 +448,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
return OPERATOR_FINISHED;
}
@@ -970,8 +973,8 @@ static int track_set_exec(bContext *C, wmOperator *op)
data->tar = obact;
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
- /* Lamp and Camera track differently by default */
- if (ob->type == OB_LAMP || ob->type == OB_CAMERA)
+ /* Lamp, Camera and Speaker track differently by default */
+ if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER)
data->trackflag = TRACK_nZ;
}
}
@@ -989,8 +992,8 @@ static int track_set_exec(bContext *C, wmOperator *op)
data->tar = obact;
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
- /* Lamp and Camera track differently by default */
- if (ob->type == OB_LAMP || ob->type == OB_CAMERA) {
+ /* Lamp, Camera and Speaker track differently by default */
+ if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) {
data->reserved1 = TRACK_nZ;
data->reserved2 = UP_Y;
}
@@ -1010,8 +1013,8 @@ static int track_set_exec(bContext *C, wmOperator *op)
data->tar = obact;
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
- /* Lamp and Camera track differently by default */
- if (ob->type == OB_LAMP || ob->type == OB_CAMERA) {
+ /* Lamp, Camera and Speaker track differently by default */
+ if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) {
data->trackflag = TRACK_nZ;
data->lockflag = LOCK_Y;
}
@@ -1095,7 +1098,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
View3D *v3d= CTX_wm_view3d(C);
unsigned int lay, local;
- int islamp= 0;
+ /* int islamp= 0; */ /* UNUSED */
lay= move_to_layer_init(C, op);
lay &= 0xFFFFFF;
@@ -1111,7 +1114,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
base->object->lay= lay;
base->object->flag &= ~SELECT;
base->flag &= ~SELECT;
- if(base->object->type==OB_LAMP) islamp= 1;
+ /* if(base->object->type==OB_LAMP) islamp= 1; */
}
CTX_DATA_END;
}
@@ -1123,12 +1126,10 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
local= base->lay & 0xFF000000;
base->lay= lay + local;
base->object->lay= lay;
- if(base->object->type==OB_LAMP) islamp= 1;
+ /* if(base->object->type==OB_LAMP) islamp= 1; */
}
CTX_DATA_END;
}
-
- if(islamp) reshadeall_displist(scene); /* only frees */
/* warning, active object may be hidden now */
@@ -1320,7 +1321,7 @@ void OBJECT_OT_make_links_scene(wmOperatorType *ot)
/* identifiers */
ot->name= "Link Objects to Scene";
- ot->description = "Make linked data local to each object";
+ ot->description = "Link selection to another scene";
ot->idname= "OBJECT_OT_make_links_scene";
/* api callbacks */
@@ -1403,6 +1404,20 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
set_sca_new_poins();
}
+/* not an especially efficient function, only added so the single user
+ * button can be functional.*/
+void ED_object_single_user(Scene *scene, Object *ob)
+{
+ Base *base;
+
+ for(base= FIRSTBASE; base; base= base->next) {
+ if(base->object == ob) base->flag |= OB_DONE;
+ else base->flag &= ~OB_DONE;
+ }
+
+ single_object_users(scene, NULL, OB_DONE);
+}
+
static void new_id_matar(Material **matar, int totcol)
{
ID *id;
@@ -1482,6 +1497,9 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
ob->data= copy_armature(ob->data);
armature_rebuild_pose(ob, ob->data);
break;
+ case OB_SPEAKER:
+ ob->data= copy_speaker(ob->data);
+ break;
default:
if (G.f & G_DEBUG)
printf("ERROR single_obdata_users: can't copy %s\n", id->name);
@@ -1661,6 +1679,7 @@ void ED_object_single_users(Main *bmain, Scene *scene, int full)
if(full) {
single_obdata_users(bmain, scene, 0);
+ single_object_action_users(scene, 0);
single_mat_users_expand(bmain);
single_tex_users_expand(bmain);
}
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index a3bd399a60c..cb1fc7541d0 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -37,6 +37,7 @@
#include "MEM_guardedalloc.h"
+#include "DNA_anim_types.h"
#include "DNA_group_types.h"
#include "DNA_material_types.h"
#include "DNA_modifier_types.h"
@@ -65,6 +66,7 @@
#include "ED_object.h"
#include "ED_screen.h"
+#include "ED_keyframing.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -363,6 +365,7 @@ static EnumPropertyItem prop_select_grouped_types[] = {
{9, "PASS", 0, "Pass", "Render pass Index"},
{10, "COLOR", 0, "Color", "Object Color"},
{11, "PROPERTIES", 0, "Properties", "Game Properties"},
+ {12, "KEYINGSET", 0, "Keying Set", "Objects included in active Keying Set"},
{0, NULL, 0, NULL, NULL}
};
@@ -574,6 +577,42 @@ static short select_grouped_gameprops(bContext *C, Object *ob)
return changed;
}
+static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
+{
+ KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C));
+ short changed = 0;
+
+ /* firstly, validate KeyingSet */
+ if ((ks == NULL) || (ANIM_validate_keyingset(C, NULL, ks) != 0))
+ return 0;
+
+ /* select each object that Keying Set refers to */
+ // TODO: perhaps to be more in line with the rest of these, we should only take objects
+ // if the passed in object is included in this too
+ CTX_DATA_BEGIN(C, Base*, base, selectable_bases)
+ {
+ /* only check for this object if it isn't selected already, to limit time wasted */
+ if ((base->flag & SELECT) == 0) {
+ KS_Path *ksp;
+
+ /* this is the slow way... we could end up with > 500 items here,
+ * with none matching, but end up doing this on 1000 objects...
+ */
+ for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
+ /* if id matches, select then stop looping (match found) */
+ if (ksp->id == (ID *)base->object) {
+ ED_base_object_select(base, BA_SELECT);
+ changed = 1;
+ break;
+ }
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ return changed;
+}
+
static int object_select_grouped_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
@@ -608,6 +647,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
else if(nr==9) changed |= select_grouped_index_object(C, ob);
else if(nr==10) changed |= select_grouped_color(C, ob);
else if(nr==11) changed |= select_grouped_gameprops(C, ob);
+ else if(nr==12) changed |= select_grouped_keyingset(C, ob);
if (changed) {
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index f7c6ff99bde..78f3537bea9 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -246,7 +246,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
}
/* tag for updates */
- ob->recalc |= OB_RECALC_OB;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
}
CTX_DATA_END;
@@ -341,7 +341,8 @@ static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
negate_v3_v3(v3, v1);
mul_m3_v3(mat, v3);
}
- ob->recalc |= OB_RECALC_OB;
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
CTX_DATA_END;
@@ -871,7 +872,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
(ob->dup_group==ob_other->dup_group && (ob->transflag|ob_other->transflag) & OB_DUPLIGROUP) )
) {
ob_other->flag |= OB_DONE;
- ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA;
+ DAG_id_tag_update(&ob_other->id, OB_RECALC_OB|OB_RECALC_DATA);
copy_v3_v3(centn, cent);
mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */
@@ -890,11 +891,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- for (tob= bmain->object.first; tob; tob= tob->id.next) {
- if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) {
- tob->recalc= OB_RECALC_OB|OB_RECALC_DATA;
- }
- }
+ for (tob= bmain->object.first; tob; tob= tob->id.next)
+ if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
+ DAG_id_tag_update(&tob->id, OB_RECALC_OB|OB_RECALC_DATA);
if (tot_change) {
DAG_ids_flush_update(bmain, 0);