merge with/from trunk at r35190

This commit is contained in:
2011-02-27 06:19:40 +00:00
3230 changed files with 145269 additions and 212767 deletions

View File

@@ -1,4 +1,4 @@
/**
/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "DNA_curve_types.h"
#include "DNA_key_types.h"
@@ -53,6 +54,7 @@
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_curve.h"
#include "BLO_sys_types.h" // for intptr_t support
@@ -100,8 +102,25 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
BLI_remlink(&key->block, kb);
key->totkey--;
if(key->refkey== kb)
if(key->refkey== kb) {
key->refkey= key->block.first;
if(key->refkey) {
/* apply new basis key on original data */
switch(ob->type) {
case OB_MESH:
key_to_mesh(key->refkey, ob->data);
break;
case OB_CURVE:
case OB_SURF:
key_to_curve(key->refkey, ob->data, BKE_curve_nurbs(ob->data));
break;
case OB_LATTICE:
key_to_latt(key->refkey, ob->data);
break;
}
}
}
if(kb->data) MEM_freeN(kb->data);
MEM_freeN(kb);
@@ -137,13 +156,13 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
free_libblock_us(&(bmain->key), key);
}
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
return 1;
}
static int ED_object_shape_key_mirror(bContext *C, Scene *scene, Object *ob)
static int object_shape_key_mirror(bContext *C, Object *ob)
{
KeyBlock *kb;
Key *key;
@@ -165,10 +184,10 @@ static int ED_object_shape_key_mirror(bContext *C, Scene *scene, Object *ob)
Mesh *me= ob->data;
MVert *mv;
mesh_octree_table(ob, NULL, NULL, 's');
//BMESH_TODO mesh_octree_table(ob, NULL, NULL, 's');
for(i1=0, mv=me->mvert; i1<me->totvert; i1++, mv++) {
i2= mesh_get_x_mirror_vert(ob, i1);
i2= -1; //BMESH_TODO mesh_get_x_mirror_vert(ob, i1);
if(i2==i1) {
fp1= ((float *)kb->data) + i1*3;
fp1[0] = -fp1[0];
@@ -191,14 +210,14 @@ static int ED_object_shape_key_mirror(bContext *C, Scene *scene, Object *ob)
}
}
mesh_octree_table(ob, NULL, NULL, 'e');
//BMESH_TODO mesh_octree_table(ob, NULL, NULL, 'e');
}
/* todo, other types? */
MEM_freeN(tag_elem);
}
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
return 1;
@@ -235,8 +254,8 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Add Shape Key";
ot->name= "Add shape key to the object.";
ot->idname= "OBJECT_OT_shape_key_add";
ot->description= "Add shape key to the object";
/* api callbacks */
ot->poll= shape_key_mode_poll;
@@ -249,7 +268,7 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "from_mix", 1, "From Mix", "Create the new shape key from the existing mix of keys.");
}
static int shape_key_remove_exec(bContext *C, wmOperator *op)
static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
@@ -263,8 +282,8 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Remove Shape Key";
ot->name= "Remove shape key from the object.";
ot->idname= "OBJECT_OT_shape_key_remove";
ot->description= "Remove shape key from the object";
/* api callbacks */
ot->poll= shape_key_mode_poll;
@@ -274,7 +293,7 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int shape_key_clear_exec(bContext *C, wmOperator *op)
static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Key *key= ob_get_key(ob);
@@ -286,7 +305,7 @@ static int shape_key_clear_exec(bContext *C, wmOperator *op)
for(kb=key->block.first; kb; kb=kb->next)
kb->curval= 0.0f;
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
return OPERATOR_FINISHED;
@@ -307,12 +326,11 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int shape_key_mirror_exec(bContext *C, wmOperator *op)
static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
if(!ED_object_shape_key_mirror(C, scene, ob))
if(!object_shape_key_mirror(C, ob))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -375,7 +393,7 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
}
}
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
return OPERATOR_FINISHED;