Cleanup: remove moar G.main usages.

Notes:
* Really need to address RNA setters case, end up adding way too much
G.main here these days... :/
* Added Main pointer into bAnimContext, helps a lot in anim code ;)
This commit is contained in:
Bastien Montagne 2018-06-07 12:47:00 +02:00
parent 16017178b2
commit b3a7a75a26
31 changed files with 149 additions and 113 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

@ -285,7 +285,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
@ -320,7 +320,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"
@ -4107,6 +4108,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);
@ -4133,7 +4135,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,11 +46,11 @@
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_fcurve.h"
#include "BKE_gpencil.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_fcurve.h"
#include "BKE_gpencil.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_sequencer.h"
@ -63,7 +63,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;
@ -93,7 +93,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
@ -402,7 +402,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) {
@ -422,13 +422,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

@ -365,6 +365,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);
@ -375,6 +376,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);
@ -1726,7 +1728,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;
@ -1842,14 +1844,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;
@ -2831,7 +2833,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;
@ -2969,7 +2971,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);
}
@ -3233,7 +3235,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,18 +53,19 @@
#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_context.h"
#include "BKE_depsgraph.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_idcode.h"
#include "BKE_key.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_nla.h"
#include "BKE_report.h"
#include "ED_anim_api.h"
#include "ED_keyframing.h"
@ -123,7 +124,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;
@ -145,7 +146,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
@ -155,7 +156,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 */
DAG_relations_tag_update(G.main);
DAG_relations_tag_update(bmain);
}
/* return the action */
@ -1006,7 +1007,9 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr
*
* index of -1 keys all array indices
*/
short insert_keyframe(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, 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;
@ -1032,7 +1035,7 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
/* 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,
@ -1757,6 +1760,7 @@ void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
static int insert_key_button_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
PointerRNA ptr = {{NULL}};
@ -1817,7 +1821,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
index = -1;
}
success = insert_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index, cfra, ts->keyframe_type, flag);
success = insert_keyframe(bmain, op->reports, ptr.id.data, NULL, NULL, path, index, cfra, ts->keyframe_type, flag);
MEM_freeN(path);
}

View File

@ -957,6 +957,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)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ReportList *reports = CTX_wm_reports(C);
KS_Path *ksp;
@ -1037,7 +1038,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(reports, ksp->id, act, groupname, ksp->rna_path, i, cfra, keytype, kflag2);
success += insert_keyframe(bmain, 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

@ -136,7 +136,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];
@ -175,7 +175,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 */
@ -205,7 +205,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) {
@ -278,7 +278,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) {
@ -315,7 +315,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;
@ -331,7 +331,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));
@ -345,7 +345,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);
}
}
@ -354,6 +354,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;
@ -373,7 +374,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);
@ -412,6 +413,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];
@ -427,7 +429,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

@ -408,7 +408,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;
@ -420,7 +420,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) {
@ -620,7 +620,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);
DAG_id_tag_update(&oldob->id, OB_RECALC_DATA); /* this is the original one */
DAG_id_tag_update(&newob->id, OB_RECALC_DATA); /* this is the separated one */

View File

@ -44,6 +44,7 @@
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_depsgraph.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
@ -604,6 +605,7 @@ static void pose_copy_menu(Scene *scene)
static int pose_flip_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;
@ -623,7 +625,7 @@ static int pose_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);
@ -659,6 +661,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];
@ -674,7 +677,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

@ -49,6 +49,7 @@
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
#include "BKE_library.h"
#include "BKE_object.h"
@ -190,7 +191,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))
@ -200,19 +201,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;
}
@ -222,6 +223,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 */
@ -229,7 +231,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);
@ -457,8 +459,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

@ -70,12 +70,12 @@
/* Pose Apply */
/* helper for apply_armature_pose2bones - fixes parenting of objects that are bone-parented to armature */
static void applyarmature_fix_boneparents(Scene *scene, Object *armob)
static void applyarmature_fix_boneparents(Main *bmain, Scene *scene, Object *armob)
{
Object workob, *ob;
/* 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) {
/* if parent is bone in this armature, apply corrections */
if ((ob->parent == armob) && (ob->partype == PARBONE)) {
/* apply current transform from parent (not yet destroyed),
@ -193,7 +193,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
BKE_pose_where_is(scene, ob);
/* fix parenting of objects which are bone-parented */
applyarmature_fix_boneparents(scene, ob);
applyarmature_fix_boneparents(bmain, scene, ob);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);

View File

@ -63,6 +63,7 @@
#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"
@ -450,6 +451,7 @@ static void gp_stroke_path_animation_add_keyframes(ReportList *reports, PointerR
static void gp_stroke_path_animation(bContext *C, ReportList *reports, Curve *cu, tGpTimingData *gtd)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
bAction *act;
FCurve *fcu;
@ -473,7 +475,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;
@ -81,6 +82,7 @@ typedef struct bAnimContext {
struct bDopeSheet *ads; /* dopesheet data for editor (or which is being used) */
struct Main *bmain; /* Current Main */
struct Scene *scene; /* active scene */
struct Object *obact; /* active object */
ListBase *markers; /* active set of markers */
@ -672,7 +674,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

@ -178,8 +178,8 @@ void ED_object_vgroup_calc_from_armature(struct ReportList *reports, struct Scen
/* 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

@ -69,7 +69,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.
@ -115,7 +115,9 @@ bool insert_keyframe_direct(struct ReportList *reports, struct PointerRNA ptr, s
* 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 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 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

@ -42,6 +42,7 @@
#include "BKE_depsgraph.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_nla.h"
#include "ED_keyframing.h"
@ -224,6 +225,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;
@ -272,7 +274,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(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
insert_keyframe(bmain, reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path, but->rnaindex, cfra, ts->keyframe_type, flag);
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);

View File

@ -960,6 +960,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;
@ -984,7 +985,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 */
@ -1009,7 +1010,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

@ -633,7 +633,7 @@ bool ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* 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"
@ -707,7 +708,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(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, 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,11 +54,12 @@
#include "BLT_translation.h"
#include "BKE_context.h"
#include "BKE_depsgraph.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 "UI_view2d.h"
@ -607,7 +608,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(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, 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

@ -213,7 +213,7 @@ static void restrictbutton_recursive_child(bContext *C, Scene *scene, Object *ob
eInsertKeyFlags key_flag = ANIM_get_keyframing_flags(scene, 1);
fcu->flag &= ~FCURVE_SELECTED;
insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
insert_keyframe(bmain, reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path, fcu->array_index, CFRA, ts->keyframe_type, key_flag);
/* Assuming this is not necessary here, since 'ancestor' object button will do it anyway. */
/* WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); */
@ -527,7 +527,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, OBACT);
}
break;
@ -546,7 +546,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(ob->data, oldname, newname);
ED_armature_bone_rename(bmain, ob->data, oldname, newname);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
break;
}
@ -565,7 +565,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, ob);
break;
}

View File

@ -5782,6 +5782,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, View3D *v3d, Object *ob, int tmode)
{
Main *bmain = CTX_data_main(C);
ID *id = &ob->id;
FCurve *fcu;
@ -5813,7 +5814,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
if (adt && adt->action) {
for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) {
fcu->flag &= ~FCURVE_SELECTED;
insert_keyframe(reports, id, adt->action,
insert_keyframe(bmain, reports, id, adt->action,
(fcu->grp ? fcu->grp->name : NULL),
fcu->rna_path, fcu->array_index, cfra,
ts->keyframe_type, flag);
@ -5898,6 +5899,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
// 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, View3D *v3d, 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;
@ -5950,7 +5952,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
* NOTE: this will do constraints too, but those are ok to do here too?
*/
if (pchanName && STREQ(pchanName, pchan->name)) {
insert_keyframe(reports, id, act,
insert_keyframe(bmain, reports, id, act,
((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path, fcu->array_index, cfra,
ts->keyframe_type, flag);

View File

@ -374,7 +374,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), scene, ale);
}
}
@ -432,7 +432,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

@ -45,6 +45,7 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
@ -314,7 +315,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)
@ -327,7 +328,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

@ -107,6 +107,7 @@ const EnumPropertyItem rna_enum_color_sets_items[] = {
#include "BKE_context.h"
#include "BKE_constraint.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "ED_object.h"
@ -286,7 +287,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"
@ -270,7 +271,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
BKE_reports_init(&reports, RPT_STORE);
result = insert_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, keytype, options);
result = insert_keyframe(G.main, &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)

View File

@ -357,7 +357,7 @@ void WM_keyconfig_update(struct wmWindowManager *wm) RET_NONE
int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event) RET_ZERO
void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *reference) RET_NONE
void WM_main_add_notifier(unsigned int type, void *reference) RET_NONE
void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const char *newnamep) RET_NONE
void ED_armature_bone_rename(struct Main *bmain, struct bArmature *arm, const char *oldnamep, const char *newnamep) RET_NONE
void ED_armature_transform(struct Main *bmain, struct bArmature *arm, float mat[4][4], const bool do_props) RET_NONE
struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, struct wmOperator *op) RET_NULL
struct wmTimer *WM_event_add_timer(struct wmWindowManager *wm, struct wmWindow *win, int event_type, double timestep) RET_NULL
@ -704,9 +704,9 @@ void WM_operator_py_idname(char *to, const char *from) RET_NONE
bool WM_operator_py_idname_ok_or_report(struct ReportList *reports, const char *classname, const char *idname) RET_ZERO
int WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width, int height) RET_ZERO
void update_autoflags_fcurve(struct FCurve *fcu, struct bContext *C, struct ReportList *reports, struct PointerRNA *ptr) RET_NONE
short insert_keyframe(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) RET_ZERO
short insert_keyframe(struct Main *bmain, 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) RET_ZERO
short delete_keyframe(struct ReportList *reports, struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, eInsertKeyFlags flag) RET_ZERO
struct bAction *verify_adt_action(struct ID *id, short add) RET_NULL
struct bAction *verify_adt_action(struct Main *bmain, struct ID *id, short add) RET_NULL
char *WM_operator_pystring_ex(struct bContext *C, struct wmOperator *op, const bool all_args, const bool macro_args, struct wmOperatorType *ot, struct PointerRNA *opptr) RET_NULL
char *WM_operator_pystring(struct bContext *C, struct wmOperator *op, const bool all_args, const bool macro_args) RET_NULL
struct wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value) RET_NULL

View File

@ -630,8 +630,8 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
mat3_to_compatible_eul(blenderObject->rot, blenderObject->rot, tmat);
insert_keyframe(NULL, &blenderObject->id, NULL, NULL, "location", -1, (float)frameNumber, BEZT_KEYTYPE_JITTER, INSERTKEY_FAST);
insert_keyframe(NULL, &blenderObject->id, NULL, NULL, "rotation_euler", -1, (float)frameNumber, BEZT_KEYTYPE_JITTER, INSERTKEY_FAST);
insert_keyframe(G.main, NULL, &blenderObject->id, NULL, NULL, "location", -1, (float)frameNumber, BEZT_KEYTYPE_JITTER, INSERTKEY_FAST);
insert_keyframe(G.main, NULL, &blenderObject->id, NULL, NULL, "rotation_euler", -1, (float)frameNumber, BEZT_KEYTYPE_JITTER, INSERTKEY_FAST);
#if 0
const MT_Point3& position = gameObj->NodeGetWorldPosition();
@ -726,7 +726,7 @@ void KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo()
if (gameObj->IsRecordAnimation()) {
Object *blenderObject = gameObj->GetBlenderObject();
if (blenderObject && blenderObject->adt) {
bAction *act = verify_adt_action(&blenderObject->id, false);
bAction *act = verify_adt_action(G.main, &blenderObject->id, false);
FCurve *fcu;
if (!act) {