Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_animation.c
| Show First 20 Lines • Show All 579 Lines • ▼ Show 20 Lines | if (data_path[0] == '\0') { | ||||
| BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument"); | BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* Returns NULL if not found. */ | /* Returns NULL if not found. */ | ||||
| return list_find_fcurve(&adt->drivers, data_path, index); | return list_find_fcurve(&adt->drivers, data_path, index); | ||||
| } | } | ||||
| bool rna_AnimaData_override_apply( | |||||
| PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage, | |||||
| PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *UNUSED(prop_storage), | |||||
| const int len_dst, const int len_src, const int len_storage, | |||||
| IDOverrideStaticPropertyOperation *opop) | |||||
| { | |||||
| BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0); | |||||
| BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE && "Unsupported RNA override operation on animdata pointer"); | |||||
| /* AnimData is a special case, since you cannot edit/replace it, it's either existent or not. */ | |||||
| AnimData *adt_dst = RNA_property_pointer_get(ptr_dst, prop_dst).data; | |||||
| AnimData *adt_src = RNA_property_pointer_get(ptr_src, prop_src).data; | |||||
| if (adt_dst == NULL && adt_src != NULL) { | |||||
| /* Copy anim data from reference into final local ID. */ | |||||
| BKE_animdata_copy_id(NULL, ptr_dst->id.data, ptr_src->id.data, false); | |||||
| return true; | |||||
| } | |||||
| else if (adt_dst != NULL && adt_src == NULL) { | |||||
| /* Override has cleared/removed anim data from its reference. */ | |||||
| BKE_animdata_free(ptr_dst->id.data, true); | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| } | |||||
| #else | #else | ||||
| /* helper function for Keying Set -> keying settings */ | /* helper function for Keying Set -> keying settings */ | ||||
| static void rna_def_common_keying_flags(StructRNA *srna, short reg) | static void rna_def_common_keying_flags(StructRNA *srna, short reg) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| /* override scene/userpref defaults? */ | /* override scene/userpref defaults? */ | ||||
| ▲ Show 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | |||||
| void rna_def_animdata_common(StructRNA *srna) | void rna_def_animdata_common(StructRNA *srna) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| prop = RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "adt"); | RNA_def_property_pointer_sdna(prop, NULL, "adt"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_flag(prop, PROP_OVERRIDABLE); | |||||
| RNA_def_property_override_funcs(prop, NULL, NULL, "rna_AnimaData_override_apply"); | |||||
| RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this data-block"); | RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this data-block"); | ||||
| } | } | ||||
| static void rna_def_animdata(BlenderRNA *brna) | static void rna_def_animdata(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| srna = RNA_def_struct(brna, "AnimData", NULL); | srna = RNA_def_struct(brna, "AnimData", NULL); | ||||
| RNA_def_struct_ui_text(srna, "Animation Data", "Animation data for data-block"); | RNA_def_struct_ui_text(srna, "Animation Data", "Animation data for data-block"); | ||||
| RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA); | RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA); | ||||
| /* NLA */ | /* NLA */ | ||||
| prop = RNA_def_property(srna, "nla_tracks", PROP_COLLECTION, PROP_NONE); | prop = RNA_def_property(srna, "nla_tracks", PROP_COLLECTION, PROP_NONE); | ||||
| RNA_def_property_collection_sdna(prop, NULL, "nla_tracks", NULL); | RNA_def_property_collection_sdna(prop, NULL, "nla_tracks", NULL); | ||||
| RNA_def_property_struct_type(prop, "NlaTrack"); | RNA_def_property_struct_type(prop, "NlaTrack"); | ||||
| RNA_def_property_ui_text(prop, "NLA Tracks", "NLA Tracks (i.e. Animation Layers)"); | RNA_def_property_ui_text(prop, "NLA Tracks", "NLA Tracks (i.e. Animation Layers)"); | ||||
| rna_api_animdata_nla_tracks(brna, prop); | rna_api_animdata_nla_tracks(brna, prop); | ||||
| /* Active Action */ | /* Active Action */ | ||||
| prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); | ||||
| /* this flag as well as the dynamic test must be defined for this to be editable... */ | /* this flag as well as the dynamic test must be defined for this to be editable... */ | ||||
| RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); | RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT | PROP_OVERRIDABLE); | ||||
| RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll"); | RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll"); | ||||
| RNA_def_property_editable_func(prop, "rna_AnimData_action_editable"); | RNA_def_property_editable_func(prop, "rna_AnimData_action_editable"); | ||||
| RNA_def_property_ui_text(prop, "Action", "Active Action for this data-block"); | RNA_def_property_ui_text(prop, "Action", "Active Action for this data-block"); | ||||
| RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_AnimData_update"); | RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_AnimData_update"); | ||||
| /* Active Action Settings */ | /* Active Action Settings */ | ||||
| prop = RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "act_extendmode"); | RNA_def_property_enum_sdna(prop, NULL, "act_extendmode"); | ||||
| ▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines | |||||