diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-07 14:04:16 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-07 14:04:16 +0300 |
commit | 508e34d0bf68c837c3b0ece72faaab809df52506 (patch) | |
tree | aeeafa9c1b853dacd38056bb5bf825c04863b481 /source/blender/editors/animation | |
parent | 4e014727f6ed1652fd922ba25ec00b0f9df694f9 (diff) | |
parent | b3a7a75a266de6765d8c04953c0dabce3c30c359 (diff) |
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
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_deps.c | 14 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 14 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_general.c | 8 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 26 | ||||
-rw-r--r-- | source/blender/editors/animation/keyingsets.c | 3 |
6 files changed, 40 insertions, 29 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 5d5d8f10a88..e4213a8d907 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -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 */ diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index cfdbe87c8a1..adb5a10c19d 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -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); } } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 6f748725790..8892fed025a 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -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; } diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index f8af504f1ed..a6ed6643257 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -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: diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index e6f2f087ede..6f2360767c0 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -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_context.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 "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); } diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index a4204715678..5bf23a53819 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -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); } |