Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_action.c
| Show First 20 Lines • Show All 240 Lines • ▼ Show 20 Lines | static void rna_Action_active_pose_marker_index_range( | ||||
| PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) | PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) | ||||
| { | { | ||||
| bAction *act = (bAction *)ptr->data; | bAction *act = (bAction *)ptr->data; | ||||
| *min = 0; | *min = 0; | ||||
| *max = max_ii(0, BLI_listbase_count(&act->markers) - 1); | *max = max_ii(0, BLI_listbase_count(&act->markers) - 1); | ||||
| } | } | ||||
| static void rna_Action_frame_range_get(PointerRNA *ptr, float *values) | static void rna_Action_frame_range_get(PointerRNA *ptr, float *r_values) | ||||
| { | |||||
| BKE_action_get_frame_range((bAction *)ptr->owner_id, &r_values[0], &r_values[1]); | |||||
| } | |||||
| static void rna_Action_frame_range_set(PointerRNA *ptr, const float *values) | |||||
| { | |||||
| bAction *data = (bAction *)ptr->owner_id; | |||||
| data->flag |= ACT_FRAME_RANGE; | |||||
| data->frame_start = values[0]; | |||||
| data->frame_end = values[1]; | |||||
| CLAMP_MIN(data->frame_end, data->frame_start); | |||||
| } | |||||
| static void rna_Action_curve_frame_range_get(PointerRNA *ptr, float *values) | |||||
| { /* don't include modifiers because they too easily can have very large | { /* don't include modifiers because they too easily can have very large | ||||
| * ranges: MINAFRAMEF to MAXFRAMEF. */ | * ranges: MINAFRAMEF to MAXFRAMEF. */ | ||||
| calc_action_range((bAction *)ptr->owner_id, values, values + 1, false); | calc_action_range((bAction *)ptr->owner_id, values, values + 1, false); | ||||
| } | } | ||||
| static void rna_Action_use_frame_range_set(PointerRNA *ptr, bool value) | |||||
| { | |||||
| bAction *data = (bAction *)ptr->owner_id; | |||||
| if (value) { | |||||
| /* If the frame range is blank, initialize it by scanning F-Curves. */ | |||||
| if ((data->frame_start == data->frame_end) && (data->frame_start == 0)) { | |||||
| calc_action_range(data, &data->frame_start, &data->frame_end, false); | |||||
| } | |||||
| data->flag |= ACT_FRAME_RANGE; | |||||
| } | |||||
| else { | |||||
| data->flag &= ~ACT_FRAME_RANGE; | |||||
| } | |||||
| } | |||||
| static void rna_Action_start_frame_set(PointerRNA *ptr, float value) | |||||
| { | |||||
| bAction *data = (bAction *)ptr->owner_id; | |||||
| data->frame_start = value; | |||||
| CLAMP_MIN(data->frame_end, data->frame_start); | |||||
| } | |||||
| static void rna_Action_end_frame_set(PointerRNA *ptr, float value) | |||||
| { | |||||
| bAction *data = (bAction *)ptr->owner_id; | |||||
| data->frame_end = value; | |||||
| CLAMP_MAX(data->frame_start, data->frame_end); | |||||
| } | |||||
| /* Used to check if an action (value pointer) | /* Used to check if an action (value pointer) | ||||
| * is suitable to be assigned to the ID-block that is ptr. */ | * is suitable to be assigned to the ID-block that is ptr. */ | ||||
| bool rna_Action_id_poll(PointerRNA *ptr, PointerRNA value) | bool rna_Action_id_poll(PointerRNA *ptr, PointerRNA value) | ||||
| { | { | ||||
| ID *srcId = ptr->owner_id; | ID *srcId = ptr->owner_id; | ||||
| bAction *act = (bAction *)value.owner_id; | bAction *act = (bAction *)value.owner_id; | ||||
| if (act) { | if (act) { | ||||
| ▲ Show 20 Lines • Show All 566 Lines • ▼ Show 20 Lines | static void rna_def_action(BlenderRNA *brna) | ||||
| /* Use lib exception so the list isn't grayed out; | /* Use lib exception so the list isn't grayed out; | ||||
| * adding/removing is still banned though, see T45689. */ | * adding/removing is still banned though, see T45689. */ | ||||
| RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); | RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Pose Markers", "Markers specific to this action, for labeling poses"); | prop, "Pose Markers", "Markers specific to this action, for labeling poses"); | ||||
| rna_def_action_pose_markers(brna, prop); | rna_def_action_pose_markers(brna, prop); | ||||
| /* properties */ | /* properties */ | ||||
| prop = RNA_def_float_vector(srna, | prop = RNA_def_property(srna, "use_frame_range", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_FRAME_RANGE); | |||||
| RNA_def_property_boolean_funcs(prop, NULL, "rna_Action_use_frame_range_set"); | |||||
| RNA_def_property_ui_text( | |||||
| prop, | |||||
| "Manual Frame Range", | |||||
| "Manually specify the intended playback frame range for the action " | |||||
| "(this range is used by some tools, but does not affect animation evaluation)"); | |||||
| RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); | |||||
| prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CYCLIC); | |||||
| RNA_def_property_ui_text( | |||||
| prop, | |||||
| "Cyclic Animation", | |||||
| "The action is intended to be used as a cycle looping over its manually set " | |||||
| "playback frame range (enabling this doesn't automatically make it loop)"); | |||||
| RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); | |||||
| prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "frame_start"); | |||||
| RNA_def_property_float_funcs(prop, NULL, "rna_Action_start_frame_set", NULL); | |||||
| RNA_def_property_ui_range(prop, MINFRAME, MAXFRAME, 100, 0); | |||||
| RNA_def_property_ui_text( | |||||
| prop, "Start Frame", "The start frame of the manually set intended playback range"); | |||||
| RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); | |||||
| prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "frame_end"); | |||||
| RNA_def_property_float_funcs(prop, NULL, "rna_Action_end_frame_set", NULL); | |||||
| RNA_def_property_ui_range(prop, MINFRAME, MAXFRAME, 100, 0); | |||||
| RNA_def_property_ui_text( | |||||
| prop, "End Frame", "The end frame of the manually set intended playback range"); | |||||
| RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); | |||||
| prop = RNA_def_float_vector( | |||||
| srna, | |||||
| "frame_range", | "frame_range", | ||||
| 2, | 2, | ||||
| NULL, | NULL, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| "Frame Range", | "Frame Range", | ||||
| "The final frame range of all F-Curves within this action", | "The intended playback frame range of this action, using the manually set range " | ||||
| "if available, or the combined frame range of all F-Curves within this action " | |||||
| "if not (assigning sets the manual frame range)", | |||||
| 0, | |||||
| 0); | |||||
| RNA_def_property_float_funcs( | |||||
| prop, "rna_Action_frame_range_get", "rna_Action_frame_range_set", NULL); | |||||
| RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); | |||||
| prop = RNA_def_float_vector(srna, | |||||
| "curve_frame_range", | |||||
| 2, | |||||
| NULL, | |||||
| 0, | |||||
| 0, | |||||
| "Curve Frame Range", | |||||
| "The combined frame range of all F-Curves within this action", | |||||
| 0, | 0, | ||||
| 0); | 0); | ||||
| RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get", NULL, NULL); | RNA_def_property_float_funcs(prop, "rna_Action_curve_frame_range_get", NULL, NULL); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| /* special "type" limiter - should not really be edited in general, | /* special "type" limiter - should not really be edited in general, | ||||
| * but is still available/editable in 'emergencies' */ | * but is still available/editable in 'emergencies' */ | ||||
| prop = RNA_def_property(srna, "id_root", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "id_root", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "idroot"); | RNA_def_property_enum_sdna(prop, NULL, "idroot"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_id_type_items); | RNA_def_property_enum_items(prop, rna_enum_id_type_items); | ||||
| RNA_def_property_ui_text(prop, | RNA_def_property_ui_text(prop, | ||||
| Show All 19 Lines | |||||