Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/anim_data.c
| Show First 20 Lines • Show All 670 Lines • ▼ Show 20 Lines | void BKE_animdata_transfer_by_basepath(Main *bmain, ID *srcID, ID *dstID, ListBase *basepaths) | ||||
| if (srcAdt->drivers.first) { | if (srcAdt->drivers.first) { | ||||
| LISTBASE_FOREACH (const AnimationBasePathChange *, basepath_change, basepaths) { | LISTBASE_FOREACH (const AnimationBasePathChange *, basepath_change, basepaths) { | ||||
| animdata_move_drivers_by_basepath( | animdata_move_drivers_by_basepath( | ||||
| srcAdt, dstAdt, basepath_change->src_basepath, basepath_change->dst_basepath); | srcAdt, dstAdt, basepath_change->src_basepath, basepath_change->dst_basepath); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| char *BKE_animdata_driver_path_hack(bContext *C, | |||||
| PointerRNA *ptr, | |||||
| PropertyRNA *prop, | |||||
| char *base_path) | |||||
| { | |||||
| ID *id = ptr->owner_id; | |||||
| ScrArea *area = CTX_wm_area(C); | |||||
| /* get standard path which may be extended */ | |||||
| char *basepath = base_path ? base_path : RNA_path_from_ID_to_property(ptr, prop); | |||||
| char *path = basepath; /* in case no remapping is needed */ | |||||
| /* Remapping will only be performed in the Properties Editor, as only this | |||||
| * restricts the subspace of options to the 'active' data (a manageable state) | |||||
| */ | |||||
| /* TODO: watch out for pinned context? */ | |||||
| if ((area) && (area->spacetype == SPACE_PROPERTIES)) { | |||||
| Object *ob = CTX_data_active_object(C); | |||||
| if (ob && id) { | |||||
| /* TODO: after material textures were removed, this function serves | |||||
| * no purpose anymore, but could be used again so was not removed. */ | |||||
| /* fix RNA pointer, as we've now changed the ID root by changing the paths */ | |||||
| if (basepath != path) { | |||||
| /* rebase provided pointer so that it starts from object... */ | |||||
| RNA_pointer_create(&ob->id, ptr->type, ptr->data, ptr); | |||||
| } | |||||
| } | |||||
| } | |||||
| /* the path should now have been corrected for use */ | |||||
| return path; | |||||
| } | |||||
| /* Path Validation -------------------------------------------- */ | /* Path Validation -------------------------------------------- */ | ||||
| /* Check if a given RNA Path is valid, by tracing it from the given ID, | /* Check if a given RNA Path is valid, by tracing it from the given ID, | ||||
| * and seeing if we can resolve it. */ | * and seeing if we can resolve it. */ | ||||
| static bool check_rna_path_is_valid(ID *owner_id, const char *path) | static bool check_rna_path_is_valid(ID *owner_id, const char *path) | ||||
| { | { | ||||
| PointerRNA id_ptr, ptr; | PointerRNA id_ptr, ptr; | ||||
| PropertyRNA *prop = NULL; | PropertyRNA *prop = NULL; | ||||
| ▲ Show 20 Lines • Show All 829 Lines • Show Last 20 Lines | |||||