Merge branch 'master' into blender2.8

Conflicts:
	source/blender/collada/DocumentImporter.cpp
	source/blender/editors/include/ED_object.h
	source/blender/editors/object/object_modifier.c
This commit is contained in:
Bastien Montagne 2018-06-12 12:58:31 +02:00
commit 43eebdfebd
Notes: blender-bot 2023-02-14 09:44:56 +01:00
Referenced by issue #55565, RenderDoc fails to launch 2.8 with BadDrawable error
12 changed files with 34 additions and 28 deletions

View File

@ -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);

View File

@ -279,7 +279,7 @@ struct Mesh *BKE_object_get_original_mesh(struct Object *object);
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);

View File

@ -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;

View File

@ -2969,7 +2969,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;
@ -2977,7 +2977,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;
}
@ -3001,7 +3001,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;
@ -3009,7 +3009,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;
}
@ -3039,7 +3039,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;
@ -3048,7 +3048,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;
}
@ -3079,16 +3079,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;
}

View File

@ -856,8 +856,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;
@ -873,7 +874,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;

View File

@ -146,7 +146,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

View File

@ -244,7 +244,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);
DEG_relations_tag_update(bmain);
#if 0

View File

@ -245,7 +245,7 @@ int ED_object_modifier_convert(
struct ReportList *reports, struct Main *bmain, struct Scene *scene,
struct ViewLayer *view_layer, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_apply(
struct ReportList *reports, struct Depsgraph *depsgraph, struct Scene *scene,
struct Main *bmain, struct ReportList *reports, struct Depsgraph *depsgraph, 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);

View File

@ -373,7 +373,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;
}
@ -605,6 +605,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);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
@ -639,7 +640,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 */

View File

@ -524,7 +524,8 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
return 1;
}
static int modifier_apply_shape(ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, ModifierData *md)
static int modifier_apply_shape(
Main *bmain, ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, ModifierData *md)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@ -564,7 +565,7 @@ static int modifier_apply_shape(ReportList *reports, Depsgraph *depsgraph, Scene
}
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 */
@ -673,7 +674,7 @@ static int modifier_apply_obdata(ReportList *reports, Depsgraph *depsgraph, Scen
}
int ED_object_modifier_apply(
ReportList *reports, Depsgraph *depsgraph,
Main *bmain, ReportList *reports, Depsgraph *depsgraph,
Scene *scene, Object *ob, ModifierData *md, int mode)
{
int prev_mode;
@ -702,7 +703,7 @@ int ED_object_modifier_apply(
md->mode |= eModifierMode_Realtime;
if (mode == MODIFIER_APPLY_SHAPE) {
if (!modifier_apply_shape(reports, depsgraph, scene, ob, md)) {
if (!modifier_apply_shape(bmain, reports, depsgraph, scene, ob, md)) {
md->mode = prev_mode;
return 0;
}
@ -1017,13 +1018,14 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
static int modifier_apply_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Depsgraph *depsgraph = CTX_data_depsgraph(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, depsgraph, scene, ob, md, apply_as)) {
if (!md || !ED_object_modifier_apply(bmain, op->reports, depsgraph, scene, ob, md, apply_as)) {
return OPERATOR_CANCELLED;
}

View File

@ -78,8 +78,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;

View File

@ -211,9 +211,10 @@ static Mesh *rna_Object_to_mesh(
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);