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:
-rw-r--r--source/blender/blenkernel/BKE_key.h2
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/intern/key.c4
-rw-r--r--source/blender/blenkernel/intern/object.c20
-rw-r--r--source/blender/collada/ArmatureImporter.cpp5
-rw-r--r--source/blender/collada/ArmatureImporter.h2
-rw-r--r--source/blender/collada/DocumentImporter.cpp2
-rw-r--r--source/blender/editors/include/ED_object.h2
-rw-r--r--source/blender/editors/mesh/meshtools.c5
-rw-r--r--source/blender/editors/object/object_modifier.c11
-rw-r--r--source/blender/editors/object/object_shapekey.c3
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c3
12 files changed, 33 insertions, 28 deletions
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h
index 5eef44ef896..2f953e57d71 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -50,7 +50,7 @@ extern "C" {
void BKE_key_free(struct Key *sc);
void BKE_key_free_nolib(struct Key *key);
-struct Key *BKE_key_add(struct ID *id);
+struct Key *BKE_key_add(struct Main *bmain, struct ID *id);
void BKE_key_copy_data(struct Main *bmain, struct Key *key_dst, const struct Key *key_src, const int flag);
struct Key *BKE_key_copy(struct Main *bmain, const struct Key *key);
struct Key *BKE_key_copy_nolib(struct Key *key);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 9d99a0ad84b..51cfc5b0087 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -245,7 +245,7 @@ int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float *
int BKE_object_insert_ptcache(struct Object *ob);
void BKE_object_delete_ptcache(struct Object *ob, int index);
-struct KeyBlock *BKE_object_shapekey_insert(struct Object *ob, const char *name, const bool from_mix);
+struct KeyBlock *BKE_object_shapekey_insert(struct Main *bmain, struct Object *ob, const char *name, const bool from_mix);
bool BKE_object_shapekey_remove(struct Main *bmain, struct Object *ob, struct KeyBlock *kb);
bool BKE_object_shapekey_free(struct Main *bmain, struct Object *ob);
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index fd42556067e..e63f7d7cefe 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -102,12 +102,12 @@ void BKE_key_free_nolib(Key *key)
}
}
-Key *BKE_key_add(ID *id) /* common function */
+Key *BKE_key_add(Main *bmain, ID *id) /* common function */
{
Key *key;
char *el;
- key = BKE_libblock_alloc(G.main, ID_KE, "Key", 0);
+ key = BKE_libblock_alloc(bmain, ID_KE, "Key", 0);
key->type = KEY_NORMAL;
key->from = id;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 875bc442f8a..9178b889062 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2816,7 +2816,7 @@ void BKE_object_delete_ptcache(Object *ob, int index)
/* shape key utility function */
/************************* Mesh ************************/
-static KeyBlock *insert_meshkey(Object *ob, const char *name, const bool from_mix)
+static KeyBlock *insert_meshkey(Main *bmain, Object *ob, const char *name, const bool from_mix)
{
Mesh *me = ob->data;
Key *key = me->key;
@@ -2824,7 +2824,7 @@ static KeyBlock *insert_meshkey(Object *ob, const char *name, const bool from_mi
int newkey = 0;
if (key == NULL) {
- key = me->key = BKE_key_add((ID *)me);
+ key = me->key = BKE_key_add(bmain, (ID *)me);
key->type = KEY_RELATIVE;
newkey = 1;
}
@@ -2848,7 +2848,7 @@ static KeyBlock *insert_meshkey(Object *ob, const char *name, const bool from_mi
return kb;
}
/************************* Lattice ************************/
-static KeyBlock *insert_lattkey(Object *ob, const char *name, const bool from_mix)
+static KeyBlock *insert_lattkey(Main *bmain, Object *ob, const char *name, const bool from_mix)
{
Lattice *lt = ob->data;
Key *key = lt->key;
@@ -2856,7 +2856,7 @@ static KeyBlock *insert_lattkey(Object *ob, const char *name, const bool from_mi
int newkey = 0;
if (key == NULL) {
- key = lt->key = BKE_key_add((ID *)lt);
+ key = lt->key = BKE_key_add(bmain, (ID *)lt);
key->type = KEY_RELATIVE;
newkey = 1;
}
@@ -2886,7 +2886,7 @@ static KeyBlock *insert_lattkey(Object *ob, const char *name, const bool from_mi
return kb;
}
/************************* Curve ************************/
-static KeyBlock *insert_curvekey(Object *ob, const char *name, const bool from_mix)
+static KeyBlock *insert_curvekey(Main *bmain, Object *ob, const char *name, const bool from_mix)
{
Curve *cu = ob->data;
Key *key = cu->key;
@@ -2895,7 +2895,7 @@ static KeyBlock *insert_curvekey(Object *ob, const char *name, const bool from_m
int newkey = 0;
if (key == NULL) {
- key = cu->key = BKE_key_add((ID *)cu);
+ key = cu->key = BKE_key_add(bmain, (ID *)cu);
key->type = KEY_RELATIVE;
newkey = 1;
}
@@ -2926,16 +2926,16 @@ static KeyBlock *insert_curvekey(Object *ob, const char *name, const bool from_m
return kb;
}
-KeyBlock *BKE_object_shapekey_insert(Object *ob, const char *name, const bool from_mix)
+KeyBlock *BKE_object_shapekey_insert(Main *bmain, Object *ob, const char *name, const bool from_mix)
{
switch (ob->type) {
case OB_MESH:
- return insert_meshkey(ob, name, from_mix);
+ return insert_meshkey(bmain, ob, name, from_mix);
case OB_CURVE:
case OB_SURF:
- return insert_curvekey(ob, name, from_mix);
+ return insert_curvekey(bmain, ob, name, from_mix);
case OB_LATTICE:
- return insert_lattkey(ob, name, from_mix);
+ return insert_lattkey(bmain, ob, name, from_mix);
default:
return NULL;
}
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index cfb25f5d117..344a73cfa6f 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -854,8 +854,9 @@ bool ArmatureImporter::write_controller(const COLLADAFW::Controller *controller)
return true;
}
-void ArmatureImporter::make_shape_keys()
+void ArmatureImporter::make_shape_keys(bContext *C)
{
+ Main *bmain = CTX_data_main(C);
std::vector<COLLADAFW::MorphController *>::iterator mc;
float weight;
@@ -871,7 +872,7 @@ void ArmatureImporter::make_shape_keys()
Mesh *source_me = (Mesh *)source_ob->data;
//insert key to source mesh
- Key *key = source_me->key = BKE_key_add((ID *)source_me);
+ Key *key = source_me->key = BKE_key_add(bmain, (ID *)source_me);
key->type = KEY_RELATIVE;
KeyBlock *kb;
diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h
index 87a7ae73a24..b637ec89f8b 100644
--- a/source/blender/collada/ArmatureImporter.h
+++ b/source/blender/collada/ArmatureImporter.h
@@ -145,7 +145,7 @@ public:
// here we add bones to armatures, having armatures previously created in write_controller
void make_armatures(bContext *C, std::vector<Object *> &objects_to_scale);
- void make_shape_keys();
+ void make_shape_keys(bContext *C);
#if 0
// link with meshes, create vertex groups, assign weights
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index b77fdf09b20..5cbffbe4526 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -240,7 +240,7 @@ void DocumentImporter::finish()
armature_importer.set_tags_map(this->uid_tags_map);
armature_importer.make_armatures(mContext, *objects_to_scale);
- armature_importer.make_shape_keys();
+ armature_importer.make_shape_keys(mContext);
DAG_relations_tag_update(bmain);
#if 0
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index da39f558909..a8536e6f71c 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -216,7 +216,7 @@ int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, st
int ED_object_modifier_convert(
struct ReportList *reports, struct Main *bmain, struct Scene *scene,
struct Object *ob, struct ModifierData *md);
-int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene,
+int ED_object_modifier_apply(struct Main *bmain, struct ReportList *reports, struct Scene *scene,
struct Object *ob, struct ModifierData *md, int mode);
int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 6953473a792..8980e1830cf 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -366,7 +366,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
else if (haskey) {
/* add a new key-block and add to the mesh */
- key = me->key = BKE_key_add((ID *)me);
+ key = me->key = BKE_key_add(bmain, (ID *)me);
key->type = KEY_RELATIVE;
}
@@ -598,6 +598,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
int join_mesh_shapes_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
Mesh *me = (Mesh *)ob->data;
@@ -631,7 +632,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
}
if (key == NULL) {
- key = me->key = BKE_key_add((ID *)me);
+ key = me->key = BKE_key_add(bmain, (ID *)me);
key->type = KEY_RELATIVE;
/* first key added, so it was the basis. initialize it with the existing mesh */
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index a9b364651e7..824a26fe60e 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -520,7 +520,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
return 1;
}
-static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, ModifierData *md)
+static int modifier_apply_shape(Main *bmain, ReportList *reports, Scene *scene, Object *ob, ModifierData *md)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -560,7 +560,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
}
if (key == NULL) {
- key = me->key = BKE_key_add((ID *)me);
+ key = me->key = BKE_key_add(bmain, (ID *)me);
key->type = KEY_RELATIVE;
/* if that was the first key block added, then it was the basis.
* Initialize it with the mesh, and add another for the modifier */
@@ -667,7 +667,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
return 1;
}
-int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, ModifierData *md, int mode)
+int ED_object_modifier_apply(Main *bmain, ReportList *reports, Scene *scene, Object *ob, ModifierData *md, int mode)
{
int prev_mode;
@@ -695,7 +695,7 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
md->mode |= eModifierMode_Realtime;
if (mode == MODIFIER_APPLY_SHAPE) {
- if (!modifier_apply_shape(reports, scene, ob, md)) {
+ if (!modifier_apply_shape(bmain, reports, scene, ob, md)) {
md->mode = prev_mode;
return 0;
}
@@ -998,12 +998,13 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
static int modifier_apply_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
int apply_as = RNA_enum_get(op->ptr, "apply_as");
- if (!md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
+ if (!md || !ED_object_modifier_apply(bmain, op->reports, scene, ob, md, apply_as)) {
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 7d7130fdbc7..2f536f59c81 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -76,8 +76,9 @@
static void ED_object_shape_key_add(bContext *C, Object *ob, const bool from_mix)
{
+ Main *bmain = CTX_data_main(C);
KeyBlock *kb;
- if ((kb = BKE_object_shapekey_insert(ob, NULL, from_mix))) {
+ if ((kb = BKE_object_shapekey_insert(bmain, ob, NULL, from_mix))) {
Key *key = BKE_key_from_object(ob);
/* for absolute shape keys, new keys may not be added last */
ob->shapenr = BLI_findindex(&key->block, kb) + 1;
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 356355fa61c..6131b7adac8 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -228,9 +228,10 @@ static void rna_Object_free_duplilist(Object *ob)
static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports,
const char *name, int from_mix)
{
+ Main *bmain = CTX_data_main(C);
KeyBlock *kb = NULL;
- if ((kb = BKE_object_shapekey_insert(ob, name, from_mix))) {
+ if ((kb = BKE_object_shapekey_insert(bmain, ob, name, from_mix))) {
PointerRNA keyptr;
RNA_pointer_create((ID *)ob->data, &RNA_ShapeKey, kb, &keyptr);