Merge branch 'master' into blender2.8

Conflicts:
	source/blender/editors/animation/anim_deps.c
	source/blender/editors/animation/keyframing.c
	source/blender/editors/animation/keyingsets.c
	source/blender/editors/armature/pose_edit.c
	source/blender/editors/armature/pose_transform.c
	source/blender/editors/gpencil/gpencil_convert.c
	source/blender/editors/include/ED_anim_api.h
	source/blender/editors/include/ED_keyframing.h
	source/blender/editors/interface/interface_anim.c
	source/blender/editors/space_action/action_edit.c
	source/blender/editors/space_graph/graph_edit.c
	source/blender/editors/space_outliner/outliner_draw.c
	source/blender/editors/transform/transform_conversions.c
	source/blender/makesrna/intern/rna_armature.c
	source/blender/makesrna/intern/rna_pose.c
	source/blender/python/intern/bpy_rna_anim.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
	source/gameengine/Converter/KX_BlenderSceneConverter.cpp
This commit is contained in:
Bastien Montagne 2018-06-07 13:04:16 +02:00
commit 508e34d0bf
28 changed files with 139 additions and 103 deletions

View File

@ -180,11 +180,11 @@ void AnimationImporter::fcurve_is_used(FCurve *fcu)
}
void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve *>& curves, char *rna_path, int array_index, Animation *animated)
void AnimationImporter::add_fcurves_to_object(Main *bmain, Object *ob, std::vector<FCurve *>& curves, char *rna_path, int array_index, Animation *animated)
{
bAction *act;
if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID *)&ob->id, 1);
if (!ob->adt || !ob->adt->action) act = verify_adt_action(bmain, (ID *)&ob->id, 1);
else act = ob->adt->action;
std::vector<FCurve *>::iterator it;
@ -725,7 +725,7 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId& listid
}
}
void AnimationImporter::apply_matrix_curves(Object *ob, std::vector<FCurve *>& animcurves, COLLADAFW::Node *root, COLLADAFW::Node *node,
void AnimationImporter::apply_matrix_curves(Main *bmain, Object *ob, std::vector<FCurve *>& animcurves, COLLADAFW::Node *root, COLLADAFW::Node *node,
COLLADAFW::Transformation *tm)
{
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
@ -840,7 +840,7 @@ void AnimationImporter::apply_matrix_curves(Object *ob, std::vector<FCurve *>& a
add_bezt(newcu[i], fra, scale[i - 7]);
}
}
verify_adt_action((ID *)&ob->id, 1);
verify_adt_action(bmain, (ID *)&ob->id, 1);
ListBase *curves = &ob->adt->action->curves;
@ -897,18 +897,18 @@ static const double get_aspect_ratio(const COLLADAFW::Camera *camera)
return aspect;
}
static ListBase &get_animation_curves(Material *ma)
static ListBase &get_animation_curves(Main *bmain, Material *ma)
{
bAction *act;
if (!ma->adt || !ma->adt->action)
act = verify_adt_action((ID *)&ma->id, 1);
act = verify_adt_action(bmain, (ID *)&ma->id, 1);
else
act = ma->adt->action;
return act->curves;
}
void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
void AnimationImporter::translate_Animations(Main *bmain, COLLADAFW::Node *node,
std::map<COLLADAFW::UniqueId, COLLADAFW::Node *>& root_map,
std::multimap<COLLADAFW::UniqueId, Object *>& object_map,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object *> FW_object_map,
@ -941,7 +941,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path));
if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID *)&ob->id, 1);
if (!ob->adt || !ob->adt->action) act = verify_adt_action(bmain, (ID *)&ob->id, 1);
else act = ob->adt->action;
//Get the list of animation curves of the object
@ -972,12 +972,11 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
for (unsigned int j = 0; j < bindings.getCount(); j++) {
animcurves = curve_map[bindings[j].animation];
if (is_matrix) {
apply_matrix_curves(ob, animcurves, root, node, transform);
apply_matrix_curves(bmain, ob, animcurves, root, node, transform);
}
else {
else {
if (is_joint) {
add_bone_animation_sampled(ob, animcurves, root, node, transform);
add_bone_animation_sampled(bmain, ob, animcurves, root, node, transform);
}
else {
//calculate rnapaths and array index of fcurves according to transformation and animation class
@ -1005,7 +1004,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
if ((animType->light) != 0) {
Lamp *lamp = (Lamp *) ob->data;
if (!lamp->adt || !lamp->adt->action) act = verify_adt_action((ID *)&lamp->id, 1);
if (!lamp->adt || !lamp->adt->action) act = verify_adt_action(bmain, (ID *)&lamp->id, 1);
else act = lamp->adt->action;
ListBase *AnimCurves = &(act->curves);
@ -1039,7 +1038,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
if (animType->camera != 0) {
Camera *cam = (Camera *) ob->data;
if (!cam->adt || !cam->adt->action)
act = verify_adt_action((ID *)&cam->id, 1);
act = verify_adt_action(bmain, (ID *)&cam->id, 1);
else
act = cam->adt->action;
@ -1103,7 +1102,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
fprintf(stderr, "Collada: Node %s refers to undefined material\n", node->getName().c_str());
continue;
}
ListBase &AnimCurves = get_animation_curves(ma);
ListBase &AnimCurves = get_animation_curves(bmain, ma);
const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects();
COLLADAFW::EffectCommon *efc = commonEffects[0];
if ((animType->material & MATERIAL_SHININESS) != 0) {
@ -1137,7 +1136,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
delete animType;
}
void AnimationImporter::add_bone_animation_sampled(Object *ob, std::vector<FCurve *>& animcurves, COLLADAFW::Node *root, COLLADAFW::Node *node, COLLADAFW::Transformation *tm)
void AnimationImporter::add_bone_animation_sampled(Main *bmain, Object *ob, std::vector<FCurve *>& animcurves, COLLADAFW::Node *root, COLLADAFW::Node *node, COLLADAFW::Transformation *tm)
{
const char *bone_name = bc_get_joint_name(node);
char joint_path[200];
@ -1260,7 +1259,7 @@ void AnimationImporter::add_bone_animation_sampled(Object *ob, std::vector<FCurv
add_bezt(newcu[i], fra, scale[i - 7]);
}
}
verify_adt_action((ID *)&ob->id, 1);
verify_adt_action(bmain, (ID *)&ob->id, 1);
// add curves
for (int i = 0; i < totcu; i++) {
@ -1436,7 +1435,7 @@ void AnimationImporter::find_frames_old(std::vector<float> *frames, COLLADAFW::N
// prerequisites:
// animlist_map - map animlist id -> animlist
// curve_map - map anim id -> curve(s)
Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
Object *AnimationImporter::translate_animation_OLD(Main *bmain, COLLADAFW::Node *node,
std::map<COLLADAFW::UniqueId, Object *>& object_map,
std::map<COLLADAFW::UniqueId, COLLADAFW::Node *>& root_map,
COLLADAFW::Transformation::TransformationType tm_type,
@ -1659,7 +1658,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
#endif
}
verify_adt_action((ID *)&ob->id, 1);
verify_adt_action(bmain, (ID *)&ob->id, 1);
ListBase *curves = &ob->adt->action->curves;

View File

@ -87,7 +87,7 @@ private:
void fcurve_is_used(FCurve *fcu);
void add_fcurves_to_object(Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated);
void add_fcurves_to_object(Main *bmain, Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated);
int typeFlag;
@ -153,7 +153,7 @@ public:
virtual void change_eul_to_quat(Object *ob, bAction *act);
#endif
void translate_Animations(COLLADAFW::Node * Node,
void translate_Animations(Main *bmain, COLLADAFW::Node * Node,
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
std::multimap<COLLADAFW::UniqueId, Object*>& object_map,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map,
@ -161,10 +161,10 @@ public:
AnimMix* get_animation_type( const COLLADAFW::Node * node, std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map );
void apply_matrix_curves(Object *ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node,
void apply_matrix_curves(Main *bmain, Object *ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node,
COLLADAFW::Transformation * tm );
void add_bone_animation_sampled(Object *ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, COLLADAFW::Transformation * tm);
void add_bone_animation_sampled(Main *bmain, Object *ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, COLLADAFW::Transformation * tm);
void Assign_transform_animations(COLLADAFW::Transformation* transform,
const COLLADAFW::AnimationList::AnimationBinding *binding,
@ -181,7 +181,7 @@ public:
// prerequisites:
// animlist_map - map animlist id -> animlist
// curve_map - map anim id -> curve(s)
Object * translate_animation_OLD(COLLADAFW::Node *node,
Object * translate_animation_OLD(Main *bmain, COLLADAFW::Node *node,
std::map<COLLADAFW::UniqueId, Object*>& object_map,
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
COLLADAFW::Transformation::TransformationType tm_type,

View File

@ -281,7 +281,7 @@ void DocumentImporter::finish()
void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW::Node *par = NULL, Object *parob = NULL)
{
Main *bmain = CTX_data_main(mContext);
// The split in #29246, rootmap must point at actual root when
// calculating bones in apply_curves_as_matrix. - actual root is the root node.
// This has to do with inverse bind poses being world space
@ -316,7 +316,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
translate_anim_recursive(node, node, parob);
}
else {
anim_importer.translate_Animations(node, root_map, object_map, FW_object_map, uid_material_map);
anim_importer.translate_Animations(bmain, node, root_map, object_map, FW_object_map, uid_material_map);
COLLADAFW::NodePointerArray &children = node->getChildNodes();
for (i = 0; i < children.getCount(); i++) {
translate_anim_recursive(children[i], node, NULL);

View File

@ -65,6 +65,7 @@
#include "BKE_animsys.h"
#include "BKE_curve.h"
#include "BKE_key.h"
#include "BKE_main.h"
#include "BKE_nla.h"
#include "BKE_context.h"
@ -4144,6 +4145,7 @@ static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poi
/* callback for shapekey widget sliders - insert keyframes */
static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, void *kb_poin)
{
Main *bmain = CTX_data_main(C);
Key *key = (Key *)key_poin;
KeyBlock *kb = (KeyBlock *)kb_poin;
char *rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
@ -4171,7 +4173,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
if (RNA_path_resolve_property(&id_ptr, rna_path, &ptr, &prop)) {
/* find or create new F-Curve */
// XXX is the group name for this ok?
bAction *act = verify_adt_action((ID *)key, 1);
bAction *act = verify_adt_action(bmain, (ID *)key, 1);
FCurve *fcu = verify_fcurve(act, NULL, &ptr, rna_path, 0, 1);
/* set the special 'replace' flag if on a keyframe */

View File

@ -46,10 +46,10 @@
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_gpencil.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_sequencer.h"
@ -64,7 +64,7 @@
/* tags the given anim list element for refreshes (if applicable)
* due to Animation Editor editing
*/
void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale)
{
ID *id;
FCurve *fcu;
@ -97,7 +97,7 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
RNA_id_pointer_create(id, &id_ptr);
if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &ptr, &prop))
RNA_property_update_main(G.main, scene, &ptr, prop);
RNA_property_update_main(bmain, scene, &ptr, prop);
}
else {
/* in other case we do standard depsgraph update, ideally
@ -406,7 +406,7 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
if (ale->update & ANIM_UPDATE_DEPS) {
ale->update &= ~ANIM_UPDATE_DEPS;
ANIM_list_elem_update(ac->scene, ale);
ANIM_list_elem_update(ac->bmain, ac->scene, ale);
}
}
else if (ale->datatype == ALE_FCURVE) {
@ -426,13 +426,13 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
if (ale->update & ANIM_UPDATE_DEPS) {
ale->update &= ~ANIM_UPDATE_DEPS;
ANIM_list_elem_update(ac->scene, ale);
ANIM_list_elem_update(ac->bmain, ac->scene, ale);
}
}
else if (ale->datatype == ALE_NLASTRIP) {
if (ale->update & ANIM_UPDATE_DEPS) {
ale->update &= ~ANIM_UPDATE_DEPS;
ANIM_list_elem_update(ac->scene, ale);
ANIM_list_elem_update(ac->bmain, ac->scene, ale);
}
}

View File

@ -378,6 +378,7 @@ bool ANIM_animdata_context_getdata(bAnimContext *ac)
*/
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
{
Main *bmain = CTX_data_main(C);
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
SpaceLink *sl = CTX_wm_space_data(C);
@ -388,6 +389,7 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
memset(ac, 0, sizeof(bAnimContext));
/* get useful default context settings from context */
ac->bmain = bmain;
ac->scene = scene;
if (scene) {
ac->markers = ED_context_get_markers(C);
@ -1742,7 +1744,7 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, voi
bGPdata *gpd;
/* Grab all Grease Pencil datablocks directly from main, but only those that seem to be useful somewhere */
for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) {
for (gpd = ac->bmain->gpencil.first; gpd; gpd = gpd->id.next) {
/* only show if gpd is used by something... */
if (ID_REAL_USERS(gpd) < 1)
continue;
@ -1858,14 +1860,14 @@ static size_t animdata_filter_mask_data(ListBase *anim_data, Mask *mask, const i
}
/* Grab all mask data */
static size_t animdata_filter_mask(ListBase *anim_data, void *UNUSED(data), int filter_mode)
static size_t animdata_filter_mask(Main *bmain, ListBase *anim_data, void *UNUSED(data), int filter_mode)
{
Mask *mask;
size_t items = 0;
/* for now, grab mask datablocks directly from main */
// XXX: this is not good...
for (mask = G.main->mask.first; mask; mask = mask->id.next) {
for (mask = bmain->mask.first; mask; mask = mask->id.next) {
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
@ -2820,7 +2822,7 @@ static size_t animdata_filter_dopesheet_movieclips(bAnimContext *ac, ListBase *a
{
size_t items = 0;
MovieClip *clip;
for (clip = G.main->movieclip.first; clip != NULL; clip = clip->id.next) {
for (clip = ac->bmain->movieclip.first; clip != NULL; clip = clip->id.next) {
/* only show if gpd is used by something... */
if (ID_REAL_USERS(clip) < 1) {
continue;
@ -2959,7 +2961,7 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, b
}
/* Cache files level animations (frame duration and such). */
CacheFile *cache_file = G.main->cachefiles.first;
CacheFile *cache_file = ac->bmain->cachefiles.first;
for (; cache_file; cache_file = cache_file->id.next) {
items += animdata_filter_ds_cachefile(ac, anim_data, ads, cache_file, filter_mode);
}
@ -3223,7 +3225,7 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
case ANIMCONT_MASK:
{
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
items = animdata_filter_mask(anim_data, data, filter_mode);
items = animdata_filter_mask(ac->bmain, anim_data, data, filter_mode);
break;
}

View File

@ -48,6 +48,7 @@
#include "BKE_fcurve.h"
#include "BKE_report.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_deform.h"
@ -729,7 +730,8 @@ static tAnimCopybufItem *pastebuf_match_path_full(FCurve *fcu, const short from_
}
/* medium match strictness: path match only (i.e. ignore ID) */
static tAnimCopybufItem *pastebuf_match_path_property(FCurve *fcu, const short from_single, const short UNUSED(to_simple))
static tAnimCopybufItem *pastebuf_match_path_property(
Main *bmain, FCurve *fcu, const short from_single, const short UNUSED(to_simple))
{
tAnimCopybufItem *aci;
@ -742,7 +744,7 @@ static tAnimCopybufItem *pastebuf_match_path_property(FCurve *fcu, const short f
* resolve, or a bone could be renamed after copying for eg. but in normal copy & paste
* this should work out ok.
*/
if (BLI_findindex(which_libbase(G.main, aci->id_type), aci->id) == -1) {
if (BLI_findindex(which_libbase(bmain, aci->id_type), aci->id) == -1) {
/* pedantic but the ID could have been removed, and beats crashing! */
printf("paste_animedit_keys: error ID has been removed!\n");
}
@ -996,7 +998,7 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
case 1:
/* less strict, just compare property names */
aci = pastebuf_match_path_property(fcu, from_single, to_simple);
aci = pastebuf_match_path_property(ac->bmain, fcu, from_single, to_simple);
break;
case 2:

View File

@ -53,17 +53,18 @@
#include "DNA_object_types.h"
#include "DNA_rigidbody_types.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_armature.h"
#include "BKE_fcurve.h"
#include "BKE_idcode.h"
#include "BKE_nla.h"
#include "BKE_global.h"
#include "BKE_context.h"
#include "BKE_report.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_idcode.h"
#include "BKE_key.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_nla.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
@ -126,7 +127,7 @@ short ANIM_get_keyframing_flags(Scene *scene, short incl_mode)
/* Get (or add relevant data to be able to do so) the Active Action for the given
* Animation Data block, given an ID block where the Animation Data should reside.
*/
bAction *verify_adt_action(ID *id, short add)
bAction *verify_adt_action(Main *bmain, ID *id, short add)
{
AnimData *adt;
@ -148,7 +149,7 @@ bAction *verify_adt_action(ID *id, short add)
BLI_snprintf(actname, sizeof(actname), "%sAction", id->name + 2);
/* create action */
adt->action = BKE_action_add(G.main, actname);
adt->action = BKE_action_add(bmain, actname);
/* set ID-type from ID-block that this is going to be assigned to
* so that users can't accidentally break actions by assigning them
@ -158,7 +159,7 @@ bAction *verify_adt_action(ID *id, short add)
/* tag depsgraph to be rebuilt to include time dependency */
/* XXX: we probably should have bmain passed down, but that involves altering too many API's */
DEG_relations_tag_update(G.main);
DEG_relations_tag_update(bmain);
}
DEG_id_tag_update(&adt->action->id, DEG_TAG_COPY_ON_WRITE);
@ -1021,7 +1022,9 @@ bool insert_keyframe_direct(Depsgraph *depsgraph, ReportList *reports, PointerRN
*
* index of -1 keys all array indices
*/
short insert_keyframe(Depsgraph *depsgraph, ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
short insert_keyframe(
Main *bmain, Depsgraph *depsgraph, ReportList *reports, ID *id, bAction *act,
const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop = NULL;
@ -1047,7 +1050,7 @@ short insert_keyframe(Depsgraph *depsgraph, ReportList *reports, ID *id, bAction
/* if no action is provided, keyframe to the default one attached to this ID-block */
if (act == NULL) {
/* get action to add F-Curve+keyframe to */
act = verify_adt_action(id, 1);
act = verify_adt_action(bmain, id, 1);
if (act == NULL) {
BKE_reportf(reports, RPT_ERROR,
@ -1773,6 +1776,7 @@ void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
static int insert_key_button_exec(bContext *C, wmOperator *op)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
PointerRNA ptr = {{NULL}};
@ -1856,7 +1860,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
index = -1;
}
success = insert_keyframe(depsgraph, op->reports, ptr.id.data, NULL, group, path, index, cfra, ts->keyframe_type, flag);
success = insert_keyframe(bmain, depsgraph, op->reports, ptr.id.data, NULL, group, path, index, cfra, ts->keyframe_type, flag);
MEM_freeN(path);
}

View File

@ -959,6 +959,7 @@ static short keyingset_apply_keying_flags(const short base_flags, const short ov
int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ReportList *reports = CTX_wm_reports(C);
KS_Path *ksp;
@ -1039,7 +1040,7 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe
for (; i < arraylen; i++) {
/* action to take depends on mode */
if (mode == MODIFYKEY_MODE_INSERT)
success += insert_keyframe(depsgraph, reports, ksp->id, act, groupname, ksp->rna_path, i, cfra, keytype, kflag2);
success += insert_keyframe(bmain, depsgraph, reports, ksp->id, act, groupname, ksp->rna_path, i, cfra, keytype, kflag2);
else if (mode == MODIFYKEY_MODE_DELETE)
success += delete_keyframe(reports, ksp->id, act, groupname, ksp->rna_path, i, cfra, kflag2);
}

View File

@ -137,7 +137,7 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, const char *
/* called by UI for renaming a bone */
/* warning: make sure the original bone was not renamed yet! */
/* seems messy, but thats what you get with not using pointers but channel names :) */
void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *newnamep)
void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, const char *newnamep)
{
Object *ob;
char newname[MAXBONENAME];
@ -176,7 +176,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
}
/* do entire dbase - objects */
for (ob = G.main->object.first; ob; ob = ob->id.next) {
for (ob = bmain->object.first; ob; ob = ob->id.next) {
ModifierData *md;
/* we have the object using the armature */
@ -206,7 +206,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
}
/* Update any object constraints to use the new bone name */
for (cob = G.main->object.first; cob; cob = cob->id.next) {
for (cob = bmain->object.first; cob; cob = cob->id.next) {
if (cob->constraints.first)
constraint_bone_name_fix(ob, &cob->constraints, oldname, newname);
if (cob->pose) {
@ -279,7 +279,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
/* correct view locking */
{
bScreen *screen;
for (screen = G.main->screen.first; screen; screen = screen->id.next) {
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
ScrArea *sa;
/* add regions */
for (sa = screen->areabase.first; sa; sa = sa->next) {
@ -316,7 +316,7 @@ typedef struct BoneFlipNameData {
* \param bones_names: List of BoneConflict elems.
* \param do_strip_numbers: if set, try to get rid of dot-numbers at end of bone names.
*/
void ED_armature_bones_flip_names(bArmature *arm, ListBase *bones_names, const bool do_strip_numbers)
void ED_armature_bones_flip_names(Main *bmain, bArmature *arm, ListBase *bones_names, const bool do_strip_numbers)
{
ListBase bones_names_conflicts = {NULL};
BoneFlipNameData *bfn;
@ -332,7 +332,7 @@ void ED_armature_bones_flip_names(bArmature *arm, ListBase *bones_names, const b
* Bone.R, Bone.R.001, Bone.R.002, etc. */
BLI_string_flip_side_name(name_flip, name, do_strip_numbers, sizeof(name_flip));
ED_armature_bone_rename(arm, name, name_flip);
ED_armature_bone_rename(bmain, arm, name, name_flip);
if (!STREQ(name, name_flip)) {
bfn = alloca(sizeof(BoneFlipNameData));
@ -346,7 +346,7 @@ void ED_armature_bones_flip_names(bArmature *arm, ListBase *bones_names, const b
* Note that if the other bone was not selected, its name was not flipped, so conflict remains and that second
* rename simply generates a new numbered alternative name. */
for (bfn = bones_names_conflicts.first; bfn; bfn = bfn->next) {
ED_armature_bone_rename(arm, bfn->name, bfn->name_flip);
ED_armature_bone_rename(bmain, arm, bfn->name, bfn->name_flip);
}
}
@ -355,6 +355,7 @@ void ED_armature_bones_flip_names(bArmature *arm, ListBase *bones_names, const b
static int armature_flip_names_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *ob = CTX_data_edit_object(C);
bArmature *arm;
@ -374,7 +375,7 @@ static int armature_flip_names_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
ED_armature_bones_flip_names(arm, &bones_names, do_strip_numbers);
ED_armature_bones_flip_names(bmain, arm, &bones_names, do_strip_numbers);
BLI_freelistN(&bones_names);
@ -413,6 +414,7 @@ void ARMATURE_OT_flip_names(wmOperatorType *ot)
static int armature_autoside_names_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *ob = CTX_data_edit_object(C);
bArmature *arm;
char newname[MAXBONENAME];
@ -428,7 +430,7 @@ static int armature_autoside_names_exec(bContext *C, wmOperator *op)
{
BLI_strncpy(newname, ebone->name, sizeof(newname));
if (bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis]))
ED_armature_bone_rename(arm, ebone->name, newname);
ED_armature_bone_rename(bmain, arm, ebone->name, newname);
}
CTX_DATA_END;

View File

@ -411,7 +411,7 @@ int join_armature_exec(bContext *C, wmOperator *op)
/* *********************************** Separate *********************************************** */
/* Helper function for armature separating - link fixing */
static void separated_armature_fix_links(Object *origArm, Object *newArm)
static void separated_armature_fix_links(Main *bmain, Object *origArm, Object *newArm)
{
Object *ob;
bPoseChannel *pchan;
@ -423,7 +423,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
npchans = &newArm->pose->chanbase;
/* let's go through all objects in database */
for (ob = G.main->object.first; ob; ob = ob->id.next) {
for (ob = bmain->object.first; ob; ob = ob->id.next) {
/* do some object-type specific things */
if (ob->type == OB_ARMATURE) {
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
@ -628,7 +628,7 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
/* 4) fix links before depsgraph flushes */ // err... or after?
separated_armature_fix_links(oldob, newob);
separated_armature_fix_links(bmain, oldob, newob);
DEG_id_tag_update(&oldob->id, OB_RECALC_DATA); /* this is the original one */
DEG_id_tag_update(&newob->id, OB_RECALC_DATA); /* this is the separated one */

View File

@ -46,6 +46,7 @@
#include "BKE_armature.h"
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_layer.h"
@ -622,6 +623,7 @@ static void pose_copy_menu(Scene *scene)
static int pose_flip_names_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
const bool do_strip_numbers = RNA_boolean_get(op->ptr, "do_strip_numbers");
@ -636,7 +638,7 @@ static int pose_flip_names_exec(bContext *C, wmOperator *op)
}
FOREACH_PCHAN_SELECTED_IN_OBJECT_END;
ED_armature_bones_flip_names(arm, &bones_names, do_strip_numbers);
ED_armature_bones_flip_names(bmain, arm, &bones_names, do_strip_numbers);
BLI_freelistN(&bones_names);
@ -674,6 +676,7 @@ void POSE_OT_flip_names(wmOperatorType *ot)
static int pose_autoside_names_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm;
char newname[MAXBONENAME];
@ -689,7 +692,7 @@ static int pose_autoside_names_exec(bContext *C, wmOperator *op)
{
BLI_strncpy(newname, pchan->name, sizeof(newname));
if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
ED_armature_bone_rename(arm, pchan->name, newname);
ED_armature_bone_rename(bmain, arm, pchan->name, newname);
}
CTX_DATA_END;

View File

@ -48,6 +48,7 @@
#include "BKE_armature.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
#include "BKE_library.h"
#include "BKE_object.h"
@ -191,7 +192,7 @@ static int has_poselib_pose_data_for_editing_poll(bContext *C)
/* ----------------------------------- */
/* Initialize a new poselib (whether it is needed or not) */
static bAction *poselib_init_new(Object *ob)
static bAction *poselib_init_new(Main *bmain, Object *ob)
{
/* sanity checks - only for armatures */
if (ELEM(NULL, ob, ob->pose))
@ -201,19 +202,19 @@ static bAction *poselib_init_new(Object *ob)
if (ob->poselib)
id_us_min(&ob->poselib->id);
ob->poselib = BKE_action_add(G.main, "PoseLib");
ob->poselib = BKE_action_add(bmain, "PoseLib");
ob->poselib->idroot = ID_OB;
return ob->poselib;
}
/* Initialize a new poselib (checks if that needs to happen) */
static bAction *poselib_validate(Object *ob)
static bAction *poselib_validate(Main *bmain, Object *ob)
{
if (ELEM(NULL, ob, ob->pose))
return NULL;
else if (ob->poselib == NULL)
return poselib_init_new(ob);
return poselib_init_new(bmain, ob);
else
return ob->poselib;
}
@ -223,6 +224,7 @@ static bAction *poselib_validate(Object *ob)
static int poselib_new_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Object *ob = get_poselib_object(C);
/* sanity checks */
@ -230,7 +232,7 @@ static int poselib_new_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* new method here deals with the rest... */
poselib_init_new(ob);
poselib_init_new(bmain, ob);
/* notifier here might evolve? */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
@ -458,8 +460,9 @@ static int poselib_add_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U
static int poselib_add_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *ob = get_poselib_object(C);
bAction *act = poselib_validate(ob);
bAction *act = poselib_validate(bmain, ob);
bPose *pose = (ob) ? ob->pose : NULL;
TimeMarker *marker;
KeyingSet *ks;

View File

@ -66,6 +66,7 @@
#include "BKE_gpencil.h"
#include "BKE_layer.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"
@ -456,6 +457,7 @@ static void gp_stroke_path_animation_add_keyframes(Depsgraph *depsgraph, ReportL
static void gp_stroke_path_animation(bContext *C, ReportList *reports, Curve *cu, tGpTimingData *gtd)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
bAction *act;
FCurve *fcu;
@ -479,7 +481,7 @@ static void gp_stroke_path_animation(bContext *C, ReportList *reports, Curve *cu
prop = RNA_struct_find_property(&ptr, "eval_time");
/* Ensure we have an F-Curve to add keyframes to */
act = verify_adt_action((ID *)cu, true);
act = verify_adt_action(bmain, (ID *)cu, true);
fcu = verify_fcurve(act, NULL, &ptr, "eval_time", 0, true);
if (G.debug & G_DEBUG) {

View File

@ -36,6 +36,7 @@ struct ListBase;
struct AnimData;
struct bContext;
struct Main;
struct wmKeyConfig;
struct ReportList;
struct ScrArea;
@ -82,6 +83,7 @@ typedef struct bAnimContext {
struct bDopeSheet *ads; /* dopesheet data for editor (or which is being used) */
struct Depsgraph *depsgraph; /* active dependency graph */
struct Main *bmain; /* Current Main */
struct Scene *scene; /* active scene */
struct ViewLayer *view_layer; /* active scene layer */
struct Object *obact; /* active object */
@ -682,7 +684,7 @@ float ANIM_unit_mapping_get_factor(struct Scene *scene, struct ID *id, struct FC
/* --------- anim_deps.c, animation updates -------- */
void ANIM_id_update(struct Scene *scene, struct ID *id);
void ANIM_list_elem_update(struct Scene *scene, bAnimListElem *ale);
void ANIM_list_elem_update(struct Main *bmain, struct Scene *scene, bAnimListElem *ale);
/* data -> channels syncing */
void ANIM_sync_animchannels_to_data(const struct bContext *C);

View File

@ -198,8 +198,8 @@ void ED_object_vgroup_calc_from_armature(
/* if bone is already in list, pass it as param to ignore it */
void ED_armature_ebone_unique_name(struct ListBase *ebones, char *name, EditBone *bone);
void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const char *newnamep);
void ED_armature_bones_flip_names(struct bArmature *arm, struct ListBase *bones_names, const bool do_strip_numbers);
void ED_armature_bone_rename(struct Main *bmain, struct bArmature *arm, const char *oldnamep, const char *newnamep);
void ED_armature_bones_flip_names(struct Main *bmain, struct bArmature *arm, struct ListBase *bones_names, const bool do_strip_numbers);
/* low level selection functions which handle */
int ED_armature_ebone_selectflag_get(const EditBone *ebone);

View File

@ -71,7 +71,7 @@ short ANIM_get_keyframing_flags(struct Scene *scene, short incl_mode);
/* Get (or add relevant data to be able to do so) the Active Action for the given
* Animation Data block, given an ID block where the Animation Data should reside.
*/
struct bAction *verify_adt_action(struct ID *id, short add);
struct bAction *verify_adt_action(struct Main *bmain, struct ID *id, short add);
/* Get (or add relevant data to be able to do so) F-Curve from the given Action.
* This assumes that all the destinations are valid.
@ -117,7 +117,9 @@ bool insert_keyframe_direct(struct Depsgraph *depsgraph, struct ReportList *repo
* Use this to create any necessary animation data, and then insert a keyframe
* using the current value being keyframed, in the relevant place. Returns success.
*/
short insert_keyframe(struct Depsgraph *depsgraph, struct ReportList *reports, struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag);
short insert_keyframe(
struct Main *bmain, struct Depsgraph *depsgraph, struct ReportList *reports, struct ID *id, struct bAction *act,
const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag);
/* Main Keyframing API call:
* Use this to delete keyframe on current frame for relevant channel. Will perform checks just in case.

View File

@ -41,6 +41,7 @@
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_nla.h"
#include "DEG_depsgraph.h"
@ -226,6 +227,7 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
{
Main *bmain = CTX_data_main(C);
ID *id;
bAction *action;
FCurve *fcu;
@ -277,7 +279,7 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
* because a button may control all items of an array at once.
* E.g., color wheels (see T42567). */
BLI_assert((fcu->array_index == but->rnaindex) || (but->rnaindex == -1));
insert_keyframe(depsgraph, reports, id, action,
insert_keyframe(bmain, depsgraph, reports, id, action,
((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path, but->rnaindex, cfra, ts->keyframe_type, flag);

View File

@ -969,6 +969,7 @@ void CONSTRAINT_OT_childof_clear_inverse(wmOperatorType *ot)
static int followpath_path_animate_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_FOLLOWPATH);
bFollowPathConstraint *data = (con) ? (bFollowPathConstraint *)con->data : NULL;
@ -993,7 +994,7 @@ static int followpath_path_animate_exec(bContext *C, wmOperator *op)
(list_find_fcurve(&cu->adt->action->curves, "eval_time", 0) == NULL))
{
/* create F-Curve for path animation */
act = verify_adt_action(&cu->id, 1);
act = verify_adt_action(bmain, &cu->id, 1);
fcu = verify_fcurve(act, NULL, NULL, "eval_time", 0, 1);
/* standard vertical range - 1:1 = 100 frames */
@ -1018,7 +1019,7 @@ static int followpath_path_animate_exec(bContext *C, wmOperator *op)
path = RNA_path_from_ID_to_property(&ptr, prop);
/* create F-Curve for constraint */
act = verify_adt_action(&ob->id, 1);
act = verify_adt_action(bmain, &ob->id, 1);
fcu = verify_fcurve(act, NULL, NULL, path, 0, 1);
/* standard vertical range - 0.0 to 1.0 */

View File

@ -640,7 +640,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
/* if follow, add F-Curve for ctime (i.e. "eval_time") so that path-follow works */
if (partype == PAR_FOLLOW) {
/* get or create F-Curve */
bAction *act = verify_adt_action(&cu->id, 1);
bAction *act = verify_adt_action(bmain, &cu->id, 1);
FCurve *fcu = verify_fcurve(act, NULL, NULL, "eval_time", 0, 1);
/* setup dummy 'generator' modifier here to get 1-1 correspondence still working */

View File

@ -57,8 +57,9 @@
#include "BKE_fcurve.h"
#include "BKE_gpencil.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_key.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_nla.h"
#include "BKE_context.h"
#include "BKE_report.h"
@ -718,7 +719,8 @@ static void insert_action_keys(bAnimContext *ac, short mode)
* (TODO: add the full-blown PointerRNA relative parsing case here...)
*/
if (ale->id && !ale->owner) {
insert_keyframe(depsgraph, reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, ts->keyframe_type, flag);
insert_keyframe(ac->bmain, depsgraph, reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path, fcu->array_index, cfra, ts->keyframe_type, flag);
}
else {
const float curval = evaluate_fcurve(fcu, cfra);

View File

@ -54,10 +54,11 @@
#include "BLT_translation.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_nla.h"
#include "BKE_context.h"
#include "BKE_report.h"
#include "DEG_depsgraph_build.h"
@ -609,7 +610,8 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode)
* up adding the keyframes on a new F-Curve in the action data instead.
*/
if (ale->id && !ale->owner && !fcu->driver) {
insert_keyframe(depsgraph, reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, ts->keyframe_type, flag);
insert_keyframe(ac->bmain, depsgraph, reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path, fcu->array_index, cfra, ts->keyframe_type, flag);
}
else {
const float curval = evaluate_fcurve(fcu, cfra);

View File

@ -340,7 +340,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
/* restore bone name */
BLI_strncpy(newname, ebone->name, sizeof(ebone->name));
BLI_strncpy(ebone->name, oldname, sizeof(ebone->name));
ED_armature_bone_rename(obedit->data, oldname, newname);
ED_armature_bone_rename(bmain, obedit->data, oldname, newname);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
}
break;
@ -360,7 +360,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
/* restore bone name */
BLI_strncpy(newname, bone->name, sizeof(bone->name));
BLI_strncpy(bone->name, oldname, sizeof(bone->name));
ED_armature_bone_rename(arm, oldname, newname);
ED_armature_bone_rename(bmain, arm, oldname, newname);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
break;
}
@ -380,7 +380,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
/* restore bone name */
BLI_strncpy(newname, pchan->name, sizeof(pchan->name));
BLI_strncpy(pchan->name, oldname, sizeof(pchan->name));
ED_armature_bone_rename(ob->data, oldname, newname);
ED_armature_bone_rename(bmain, ob->data, oldname, newname);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
break;
}

View File

@ -5923,6 +5923,7 @@ static void clear_trans_object_base_flags(TransInfo *t)
// NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases
void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, Object *ob, int tmode)
{
Main *bmain = CTX_data_main(C);
ID *id = &ob->id;
FCurve *fcu;
@ -5955,7 +5956,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, O
if (adt && adt->action) {
for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) {
fcu->flag &= ~FCURVE_SELECTED;
insert_keyframe(depsgraph, reports, id, adt->action,
insert_keyframe(bmain, depsgraph, reports, id, adt->action,
(fcu->grp ? fcu->grp->name : NULL),
fcu->rna_path, fcu->array_index, cfra,
ts->keyframe_type, flag);
@ -6044,6 +6045,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, O
// NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases
void autokeyframe_pose_cb_func(bContext *C, Scene *scene, Object *ob, int tmode, short targetless_ik)
{
Main *bmain = CTX_data_main(C);
ID *id = &ob->id;
AnimData *adt = ob->adt;
bAction *act = (adt) ? adt->action : NULL;
@ -6097,7 +6099,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, Object *ob, int tmode,
* NOTE: this will do constraints too, but those are ok to do here too?
*/
if (pchanName && STREQ(pchanName, pchan->name)) {
insert_keyframe(depsgraph, reports, id, act,
insert_keyframe(bmain, depsgraph, reports, id, act,
((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path, fcu->array_index, cfra,
ts->keyframe_type, flag);

View File

@ -386,7 +386,7 @@ static void recalcData_actedit(TransInfo *t)
if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) {
for (ale = anim_data.first; ale; ale = ale->next) {
/* set refresh tags for objects using this animation */
ANIM_list_elem_update(t->scene, ale);
ANIM_list_elem_update(CTX_data_main(t->context), t->scene, ale);
}
}
@ -445,7 +445,7 @@ static void recalcData_graphedit(TransInfo *t)
* BUT only if realtime updates are enabled
*/
if ((sipo->flag & SIPO_NOREALTIMEUPDATES) == 0)
ANIM_list_elem_update(t->scene, ale);
ANIM_list_elem_update(CTX_data_main(t->context), t->scene, ale);
}
/* do resort and other updates? */

View File

@ -44,6 +44,7 @@
#ifdef RNA_RUNTIME
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
@ -340,7 +341,7 @@ static void rna_EditBone_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy_utf8(newname, value, sizeof(ebone->name));
BLI_strncpy(oldname, ebone->name, sizeof(ebone->name));
ED_armature_bone_rename(arm, oldname, newname);
ED_armature_bone_rename(G.main, arm, oldname, newname);
}
static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
@ -353,7 +354,7 @@ static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy_utf8(newname, value, sizeof(bone->name));
BLI_strncpy(oldname, bone->name, sizeof(bone->name));
ED_armature_bone_rename(arm, oldname, newname);
ED_armature_bone_rename(G.main, arm, oldname, newname);
}
static void rna_EditBone_layer_set(PointerRNA *ptr, const int values[])

View File

@ -106,6 +106,7 @@ const EnumPropertyItem rna_enum_color_sets_items[] = {
#include "BKE_context.h"
#include "BKE_constraint.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "DEG_depsgraph.h"
@ -291,7 +292,7 @@ static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy_utf8(newname, value, sizeof(pchan->name));
BLI_strncpy(oldname, pchan->name, sizeof(pchan->name));
ED_armature_bone_rename(ob->data, oldname, newname);
ED_armature_bone_rename(G.main, ob->data, oldname, newname);
}
static int rna_PoseChannel_has_ik_get(PointerRNA *ptr)

View File

@ -40,11 +40,12 @@
#include "ED_keyframing.h"
#include "ED_keyframes_edit.h"
#include "BKE_report.h"
#include "BKE_context.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_idcode.h"
#include "BKE_report.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
@ -272,7 +273,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
BKE_reports_init(&reports, RPT_STORE);
result = insert_keyframe(depsgraph, &reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, keytype, options);
result = insert_keyframe(G.main, depsgraph, &reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, keytype, options);
MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)