Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2011-02-16 09:18:20 +0300
committerJoshua Leung <aligorith@gmail.com>2011-02-16 09:18:20 +0300
commit437bdbc96cd80dadb8517ae94dd5e9f5e3e4bf70 (patch)
tree0e7ceeb988d6f4311900ff3427fdcac4fa642bb2 /source/blender/makesrna/intern/rna_action.c
parent7748860aeb6dc653f529fbe1c030df3674c9fac4 (diff)
PoseLib Bugfixes, Cleanups, and Missing Operators
* All the various index-related issues should finally be sorted now. It seems you cannot just partially implement some of these active index getter/setters... * Standardised the call used by PoseLib operators to get the Object from which they get the active PoseLib data from * PoseLib operators which require some existing data to work now use a poll() which checks for this * Added back the operator used to make standard actions into ones usable by PoseLib * Added a dummy operator for the apply active pose button which really just calls the same backend functions as "Browse Interactive", but which has a nicer frontend (naming + description) for the purpose of being used in this way * Also, removed some useless code from here
Diffstat (limited to 'source/blender/makesrna/intern/rna_action.c')
-rw-r--r--source/blender/makesrna/intern/rna_action.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 6cfd122d08e..954fe5f851a 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -141,7 +141,7 @@ static TimeMarker *rna_Action_pose_markers_new(bAction *act, ReportList *reports
static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, TimeMarker *marker)
{
if (!BLI_remlink_safe(&act->markers, marker)) {
- BKE_reportf(reports, RPT_ERROR, "TimelineMarker '%s' not found in action '%s'", marker->name, act->id.name+2);
+ BKE_reportf(reports, RPT_ERROR, "TimelineMarker '%s' not found in Action '%s'", marker->name, act->id.name+2);
return;
}
@@ -149,15 +149,41 @@ static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, Ti
MEM_freeN(marker);
}
+static PointerRNA rna_Action_active_pose_marker_get(PointerRNA *ptr)
+{
+ bAction *act= (bAction*)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_TimelineMarker, BLI_findlink(&act->markers, act->active_marker-1));
+}
+
+static void rna_Action_active_pose_marker_set(PointerRNA *ptr, PointerRNA value)
+{
+ bAction *act= (bAction*)ptr->data;
+ act->active_marker= BLI_findindex(&act->markers, value.data) + 1;
+}
+
+static int rna_Action_active_pose_marker_index_get(PointerRNA *ptr)
+{
+ bAction *act= (bAction*)ptr->data;
+ return MAX2(act->active_marker-1, 0);
+}
+
+static void rna_Action_active_pose_marker_index_set(PointerRNA *ptr, int value)
+{
+ bAction *act= (bAction*)ptr->data;
+ act->active_marker= value+1;
+}
+
static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min, int *max)
{
- bAction *act= (bAction *)ptr->data;
+ bAction *act= (bAction*)ptr->data;
*min= 0;
*max= BLI_countlist(&act->markers)-1;
*max= MAX2(0, *max);
}
+
+
static void rna_Action_frame_range_get(PointerRNA *ptr,float *values)
{
calc_action_range(ptr->id.data, values, values+1, 1);
@@ -456,9 +482,15 @@ static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove.");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "TimelineMarker");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_Action_active_pose_marker_get", "rna_Action_active_pose_marker_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Pose Marker", "Active pose marker for this Action");
+
prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "active_marker");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Action_active_pose_marker_index_range");
+ RNA_def_property_int_funcs(prop, "rna_Action_active_pose_marker_index_get", "rna_Action_active_pose_marker_index_set", "rna_Action_active_pose_marker_index_range");
RNA_def_property_ui_text(prop, "Active Pose Marker Index", "Index of active pose marker");
}