diff options
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 5 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 65 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 98 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 15 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 12 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 70 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 45 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_select.c | 12 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_anim_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 221 |
15 files changed, 269 insertions, 298 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 46f569a5310..c617ca33e8a 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -730,11 +730,6 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i /* set value - only for animatable numerical values */ if (RNA_property_animateable(&new_ptr, prop)) { - /* convert to radians */ - if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION) { - value *= M_PI/180.0; - } - switch (RNA_property_type(prop)) { case PROP_BOOLEAN: @@ -1471,11 +1466,6 @@ void nladata_flush_channels (ListBase *channels) int array_index= nec->index; float value= nec->value; - /* convert to radians */ - if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION) { - value *= M_PI/180.0; - } - /* write values - see animsys_write_rna_setting() to sync the code */ switch (RNA_property_type(prop)) { diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index e5d2cf3fee5..28de10a64f9 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -816,11 +816,6 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar) default: break; } - - /* degrees to radians (since curves are stored in degrees, but drivers need radians) */ - if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION) { - value *= 180.0/M_PI; - } } else { if (G.f & G_DEBUG) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 141fcce96ac..46051555a81 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6459,50 +6459,10 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype) } } -static void do_version_fcurves_radians_degrees_250(ListBase *lb, char *propname) -{ - FCurve *fcu; - FModifier *fcm; - int i; - - for (fcu=lb->first; fcu; fcu=fcu->next) { - if (strstr(fcu->rna_path, propname)) { - if (fcu->bezt) { - for (i=0; i<fcu->totvert; i++) { - BezTriple *bt = fcu->bezt+i; - - bt->vec[0][1] *= 180.0/M_PI; - bt->vec[1][1] *= 180.0/M_PI; - bt->vec[2][1] *= 180.0/M_PI; - } - } - else if (fcu->fpt) { - for (i=0; i<fcu->totvert; i++) { - FPoint *fpt = fcu->fpt+i; - - fpt->vec[1] *= 180.0/M_PI; - } - } - - for (fcm= fcu->modifiers.first; fcm; fcm= fcm->next) { - if (fcm->type == FMODIFIER_TYPE_GENERATOR) { - FMod_Generator *data= (FMod_Generator *)fcm->data; - - for (i=0; i<data->arraysize; i++) - data->coefficients[i] *= 180/M_PI; - } - } - - fcu->flag |= FCURVE_ROTATION_DEGREES; - } - } -} - static void do_version_constraints_radians_degrees_250(ListBase *lb) { bConstraint *con; - /* fcurves for this are not converted, assumption is these were unlikely to be used */ for (con=lb->first; con; con=con->next) { if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) { bRigidBodyJointConstraint *data = con->data; @@ -10578,25 +10538,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } - - /* put 2.50 compatibility code here until next subversion bump */ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 13)) { /* NOTE: if you do more conversion, be sure to do it outside of this and increase subversion again, otherwise it will not be correct */ Object *ob; - bAction *act; /* convert degrees to radians for internal use */ for (ob=main->object.first; ob; ob=ob->id.next) { - AnimData *adt = BKE_animdata_from_id((ID *)ob); bPoseChannel *pchan; - if (adt) { - do_version_fcurves_radians_degrees_250(&adt->drivers, "rotation_euler"); - do_version_fcurves_radians_degrees_250(&adt->drivers, "delta_rotation_euler"); - do_version_fcurves_radians_degrees_250(&adt->drivers, "pole_angle"); - } - do_version_constraints_radians_degrees_250(&ob->constraints); if (ob->pose) { @@ -10612,18 +10562,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - - /* convert fcurve values to be stored in degrees */ - for (act = main->action.first; act; act=act->id.next) { - /* convert over named properties with PROP_UNIT_ROTATION time of this change */ - do_version_fcurves_radians_degrees_250(&act->curves, "rotation_euler"); - do_version_fcurves_radians_degrees_250(&act->curves, "delta_rotation_euler"); - do_version_fcurves_radians_degrees_250(&act->curves, "pole_angle"); - } + } + + /* put 2.50 compatibility code here until next subversion bump */ + if (1) { + } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ - /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ + /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */ /* don't forget to set version number in blender.c! */ } diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 6b1933a791f..b99aefebfe7 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -62,6 +62,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "RNA_access.h" + #include "BIF_gl.h" #include "BIF_glutil.h" @@ -237,6 +239,7 @@ void ANIM_draw_previewrange (const bContext *C, View2D *v2d) /* NLA-MAPPING UTILITIES (required for drawing and also editing keyframes) */ /* Obtain the AnimData block providing NLA-mapping for the given channel (if applicable) */ +// TODO: do not supply return this if the animdata tells us that there is no mapping to perform AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale) { /* sanity checks */ @@ -252,11 +255,6 @@ AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale) /* ------------------- */ -typedef struct NlaMappingApplyBackup { - struct NlaMappingBackup *next, *prev; - BezTriple bezt; -} NlaMappingApplyBackup; - /* helper function for ANIM_nla_mapping_apply_fcurve() -> "restore", i.e. mapping points back to action-time */ static short bezt_nlamapping_restore(BeztEditData *bed, BezTriple *bezt) { @@ -322,3 +320,93 @@ void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, s } /* *************************************************** */ +/* UNITS CONVERSION MAPPING (required for drawing and editing keyframes) */ + +/* Get unit conversion factor for given ID + F-Curve */ +float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short restore) +{ + /* sanity checks */ + if (id && fcu && fcu->rna_path) + { + PointerRNA ptr, id_ptr; + PropertyRNA *prop; + + /* get RNA property that F-Curve affects */ + RNA_id_pointer_create(id, &id_ptr); + if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) + { + /* rotations: radians <-> degrees? */ + if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION) + { + /* if the radians flag is not set, default to using degrees which need conversions */ + if ((scene) && (scene->unit.flag & USER_UNIT_ROT_RADIANS) == 0) { + if (restore) + return M_PI / 180.0f; /* degrees to radians */ + else + return 180.0f / M_PI; /* radians to degrees */ + } + } + + // TODO: other rotation types here as necessary + } + } + + /* no mapping needs to occur... */ + return 1.0f; +} + +/* ----------------------- */ + +/* helper function for ANIM_unit_mapping_apply_fcurve -> mapping callback for unit mapping */ +static short bezt_unit_mapping_apply (BeztEditData *bed, BezTriple *bezt) +{ + /* mapping factor is stored in f1, only_keys option is stored in i1 */ + short only_keys= (short)bed->i1; + float fac= bed->f1; + + /* adjust BezTriple handles only if allowed to */ + if (only_keys == 0) { + bezt->vec[0][1] *= fac; + bezt->vec[2][1] *= fac; + } + + bezt->vec[1][1] *= fac; + + return 0; +} + +/* Apply/Unapply units conversions to keyframes */ +void ANIM_unit_mapping_apply_fcurve (Scene *scene, ID *id, FCurve *fcu, short restore, short only_keys) +{ + BeztEditData bed; + float fac; + + /* calculate mapping factor, and abort if nothing to change */ + fac= ANIM_unit_mapping_get_factor(scene, id, fcu, restore); + if (fac == 1.0f) + return; + + /* init edit data + * - mapping factor is stored in f1 + * - only_keys is stored in 'i1' + */ + memset(&bed, 0, sizeof(BeztEditData)); + bed.f1= (float)fac; + bed.i1= (int)only_keys; + + /* apply to F-Curve */ + ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, bezt_unit_mapping_apply, NULL); + + // FIXME: loop here for samples should be generalised + if (fcu->fpt) { + FPoint *fpt; + int i; + + for (i=0, fpt=fcu->fpt; i < fcu->totvert; i++, fpt++) { + /* apply unit mapping */ + fpt->vec[1] *= fac; + } + } +} + +/* *************************************************** */ diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 1ad3c0dd587..c11a7197dee 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -783,11 +783,6 @@ short insert_keyframe_direct (PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, fl curval= setting_get_rna_value(&ptr, prop, fcu->array_index); } - /* convert to degrees */ - if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION) { - curval *= 180.0/M_PI; - } - /* only insert keyframes where they are needed */ if (flag & INSERTKEY_NEEDED) { short insert_mode; @@ -900,10 +895,6 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_ } } - /* mark the curve if it's a new rotation curve */ - if ((fcu->totvert == 0) && (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION)) - fcu->flag |= FCURVE_ROTATION_DEGREES; - /* insert keyframe */ ret += insert_keyframe_direct(ptr, prop, fcu, cfra, flag); } @@ -926,6 +917,12 @@ short delete_keyframe (ID *id, bAction *act, const char group[], const char rna_ AnimData *adt= BKE_animdata_from_id(id); FCurve *fcu = NULL; + /* sanity checks */ + if ELEM(NULL, id, adt) { + printf("ERROR: no ID-block and/or AnimData to delete keyframe from \n"); + break; + } + /* get F-Curve * Note: here is one of the places where we don't want new Action + F-Curve added! * so 'add' var must be 0 diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 02430fea3ef..5b5733a3d43 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -73,6 +73,7 @@ typedef struct bAnimContext { struct Scene *scene; /* active scene */ struct Object *obact; /* active object */ ListBase *markers; /* active set of markers */ + ListBase *reports; /* pointer to current reports list */ // XXX not yet used } bAnimContext; /* Main Data container types */ @@ -448,7 +449,7 @@ int getname_anim_fcurve(char *name, struct ID *id, struct FCurve *fcu); /* Automatically determine a color for the nth F-Curve */ void getcolor_fcurve_rainbow(int cur, int tot, float *out); -/* ------------- NLA-Mapping ----------------------- */ +/* ----------------- NLA-Mapping ----------------------- */ /* anim_draw.c */ /* Obtain the AnimData block providing NLA-scaling for the given channel if applicable */ @@ -463,6 +464,15 @@ void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, sho // NOTE: defined in space_nla/nla_edit.c, not in animation/ void ED_nla_postop_refresh(bAnimContext *ac); +/* ------------- Unit Conversion Mappings ------------- */ +/* anim_draw.c */ + +/* Get unit conversion factor for given ID + F-Curve */ +float ANIM_unit_mapping_get_factor(struct Scene *scene, struct ID *id, struct FCurve *fcu, short restore); + +/* Apply/Unapply units conversions to keyframes */ +void ANIM_unit_mapping_apply_fcurve(struct Scene *scene, struct ID *id, struct FCurve *fcu, short restore, short only_keys); + /* ------------- Utility macros ----------------------- */ /* provide access to Keyframe Type info in BezTriple diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index ef559615e2b..bc9e7239f01 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4022,7 +4022,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) WM_keymap_verify_item(keymap, "SCREEN_OT_area_split", EVT_ACTIONZONE_AREA, 0, 0, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_area_join", EVT_ACTIONZONE_AREA, 0, 0, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_area_dupli", EVT_ACTIONZONE_AREA, 0, KM_SHIFT, 0); - WM_keymap_verify_item(keymap, "SCREEN_OT_area_swap", EVT_ACTIONZONE_AREA, 0, KM_ALT, 0); + WM_keymap_verify_item(keymap, "SCREEN_OT_area_swap", EVT_ACTIONZONE_AREA, 0, KM_CTRL, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_region_scale", EVT_ACTIONZONE_REGION, 0, 0, 0); /* area move after action zones */ WM_keymap_verify_item(keymap, "SCREEN_OT_area_move", LEFTMOUSE, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index f94ff80c509..72ec45845c2 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -1224,6 +1224,7 @@ static void snap_action_keys(bAnimContext *ac, short mode) else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); } + BLI_freelistN(&anim_data); } @@ -1277,7 +1278,6 @@ void ACTION_OT_snap (wmOperatorType *ot) /* defines for mirror keyframes tool */ EnumPropertyItem prop_actkeys_mirror_types[] = { {ACTKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current frame", ""}, - {ACTKEYS_MIRROR_YAXIS, "YAXIS", 0, "By Times over Time=0", ""}, // XXX this is probably better suited to the graph editor only, where we can see the effects {ACTKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0", ""}, {ACTKEYS_MIRROR_MARKER, "MARKER", 0, "By Times over First Selected Marker", ""}, {0, NULL, 0, NULL, NULL} @@ -1341,6 +1341,7 @@ static void mirror_action_keys(bAnimContext *ac, short mode) else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); } + BLI_freelistN(&anim_data); } diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 9681d20c13b..553e52ae27e 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -163,7 +163,7 @@ static void draw_fcurve_modifier_controls_envelope (FCurve *fcu, FModifier *fcm, /* Points ---------------- */ /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_vertices_keyframes (FCurve *fcu, View2D *v2d, short edit, short sel) +static void draw_fcurve_vertices_keyframes (bAnimContext *ac, FCurve *fcu, View2D *v2d, short edit, short sel) { BezTriple *bezt= fcu->bezt; const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin); @@ -235,7 +235,7 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys } /* helper func - draw handle vertices only for an F-Curve (if it is not protected) */ -static void draw_fcurve_vertices_handles (SpaceIpo *sipo, FCurve *fcu, View2D *v2d, short sel) +static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCurve *fcu, View2D *v2d, short sel) { BezTriple *bezt= fcu->bezt; BezTriple *prevbezt = NULL; @@ -300,7 +300,7 @@ static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel) } -void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu) +void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu) { View2D *v2d= &ar->v2d; @@ -318,18 +318,18 @@ void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu) (sipo->flag & SIPO_NOHANDLES)==0 && (fcu->totvert > 1)) { set_fcurve_vertex_color(sipo, fcu, 0); - draw_fcurve_vertices_handles(sipo, fcu, v2d, 0); + draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 0); set_fcurve_vertex_color(sipo, fcu, 1); - draw_fcurve_vertices_handles(sipo, fcu, v2d, 1); + draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 1); } /* draw keyframes over the handles */ set_fcurve_vertex_color(sipo, fcu, 0); - draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0); + draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0); set_fcurve_vertex_color(sipo, fcu, 1); - draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); + draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); glPointSize(1.0f); } @@ -337,7 +337,7 @@ void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu) /* Handles ---------------- */ /* draw lines for F-Curve handles only (this is only done in EditMode) */ -static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu) +static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu) { extern unsigned int nurbcol[]; int sel, b; @@ -458,7 +458,7 @@ static void draw_fcurve_sample_control (float x, float y, float xscale, float ys } /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_samples (SpaceIpo *sipo, ARegion *ar, FCurve *fcu) +static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu) { FPoint *first, *last; float hsize, xscale, yscale; @@ -497,16 +497,19 @@ static void draw_fcurve_samples (SpaceIpo *sipo, ARegion *ar, FCurve *fcu) #define MINGRIDSTEP 35 /* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */ -static void draw_fcurve_curve (FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DGrid *grid) +static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DGrid *grid) { ChannelDriver *driver; float samplefreq, ctime; float stime, etime; + float unitFac; /* disable any drivers temporarily */ driver= fcu->driver; fcu->driver= NULL; + /* compute unit correction factor */ + unitFac= ANIM_unit_mapping_get_factor(ac->scene, id, fcu, 0); /* Note about sampling frequency: * Ideally, this is chosen such that we have 1-2 pixels = 1 segment @@ -532,11 +535,14 @@ static void draw_fcurve_curve (FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DG etime= v2d->cur.xmax; - /* at each sampling interval, add a new vertex */ + /* at each sampling interval, add a new vertex + * - apply the unit correction factor to the calculated values so that + * the displayed values appear correctly in the viewport + */ glBegin(GL_LINE_STRIP); for (ctime= stime; ctime <= etime; ctime += samplefreq) - glVertex2f( ctime, evaluate_fcurve(fcu, ctime) ); + glVertex2f( ctime, evaluate_fcurve(fcu, ctime)*unitFac ); glEnd(); @@ -545,7 +551,7 @@ static void draw_fcurve_curve (FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DG } /* helper func - draw a samples-based F-Curve */ -static void draw_fcurve_curve_samples (FCurve *fcu, View2D *v2d) +static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d) { FPoint *prevfpt= fcu->fpt; FPoint *fpt= prevfpt + 1; @@ -554,6 +560,9 @@ static void draw_fcurve_curve_samples (FCurve *fcu, View2D *v2d) glBegin(GL_LINE_STRIP); + /* apply unit mapping */ + ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 0, 0); + /* extrapolate to left? - left-side of view comes before first keyframe? */ if (prevfpt->vec[0] > v2d->cur.xmin) { v[0]= v2d->cur.xmin; @@ -612,11 +621,14 @@ static void draw_fcurve_curve_samples (FCurve *fcu, View2D *v2d) glVertex2fv(v); } + /* unapply unit mapping */ + ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 1, 0); + glEnd(); } /* helper func - draw one repeat of an F-Curve */ -static void draw_fcurve_curve_bezts (FCurve *fcu, View2D *v2d, View2DGrid *grid) +static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid) { BezTriple *prevbezt= fcu->bezt; BezTriple *bezt= prevbezt+1; @@ -628,6 +640,9 @@ static void draw_fcurve_curve_bezts (FCurve *fcu, View2D *v2d, View2DGrid *grid) glBegin(GL_LINE_STRIP); + /* apply unit mapping */ + ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 0, 0); + /* extrapolate to left? */ if (prevbezt->vec[1][0] > v2d->cur.xmin) { /* left-side of view comes before first keyframe, so need to extend as not cyclic */ @@ -759,12 +774,17 @@ static void draw_fcurve_curve_bezts (FCurve *fcu, View2D *v2d, View2DGrid *grid) glVertex2fv(v1); } + /* unapply unit mapping */ + ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 1, 0); + glEnd(); } /* Public Curve-Drawing API ---------------- */ -/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve) */ +/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve) + * NOTE: unit mapping has already been applied to the values, so do not try and apply again + */ void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid) { FCurve *fcu; @@ -786,7 +806,7 @@ void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, Vie glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], 0.5f); /* simply draw the stored samples */ - draw_fcurve_curve_samples(fcu, &ar->v2d); + draw_fcurve_curve_samples(ac, NULL, fcu, &ar->v2d); } /* restore settings */ @@ -859,14 +879,14 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* draw a curve affected by modifiers or only allowed to have integer values * by sampling it at various small-intervals over the visible region */ - draw_fcurve_curve(fcu, sipo, &ar->v2d, grid); + draw_fcurve_curve(ac, ale->id, fcu, sipo, &ar->v2d, grid); } else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { /* just draw curve based on defined data (i.e. no modifiers) */ if (fcu->bezt) - draw_fcurve_curve_bezts(fcu, &ar->v2d, grid); + draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d, grid); else if (fcu->fpt) - draw_fcurve_curve_samples(fcu, &ar->v2d); + draw_fcurve_curve_samples(ac, ale->id, fcu, &ar->v2d); } /* restore settings */ @@ -891,18 +911,24 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri } } else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { + /* apply unit mapping */ + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, fcu, 0, 0); + if (fcu->bezt) { /* only draw handles/vertices on keyframes */ glEnable(GL_BLEND); - draw_fcurve_handles(sipo, ar, fcu); + draw_fcurve_handles(ac, sipo, ar, fcu); glDisable(GL_BLEND); - draw_fcurve_vertices(sipo, ar, fcu); + draw_fcurve_vertices(ac, sipo, ar, fcu); } else { /* samples: only draw two indicators at either end as indicators */ - draw_fcurve_samples(sipo, ar, fcu); + draw_fcurve_samples(ac, sipo, ar, fcu); } + + /* unapply unit mapping */ + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, fcu, 1, 0); } } diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index b3532963c3b..9842d2ae9ae 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -121,15 +121,22 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo AnimData *adt= ANIM_nla_mapping_get(ac, ale); FCurve *fcu= (FCurve *)ale->key_data; float txmin, txmax, tymin, tymax; + float unitFac; - /* get range and apply necessary scaling before */ + /* get range */ calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax); + /* apply NLA scaling */ if (adt) { txmin= BKE_nla_tweakedit_remap(adt, txmin, NLATIME_CONVERT_MAP); txmax= BKE_nla_tweakedit_remap(adt, txmax, NLATIME_CONVERT_MAP); } + /* apply unit corrections */ + unitFac= ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0); + tymin *= unitFac; + tymax *= unitFac; + /* try to set cur using these values, if they're more extreme than previously set values */ if ((xmin) && (txmin < *xmin)) *xmin= txmin; if ((xmax) && (txmax > *xmax)) *xmax= txmax; @@ -280,11 +287,15 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end) AnimData *adt= ANIM_nla_mapping_get(ac, ale); ChannelDriver *driver= fcu->driver; FPoint *fpt; + float unitFac; int cfra; /* disable driver so that it don't muck up the sampling process */ fcu->driver= NULL; + /* calculate unit-mapping factor */ + unitFac= ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0); + /* create samples, but store them in a new curve * - we cannot use fcurve_store_samples() as that will only overwrite the original curve */ @@ -508,6 +519,7 @@ static int graphkeys_click_insert_exec (bContext *C, wmOperator *op) bAnimContext ac; bAnimListElem *ale; AnimData *adt; + FCurve *fcu; float frame, val; /* get animation context */ @@ -520,7 +532,8 @@ static int graphkeys_click_insert_exec (bContext *C, wmOperator *op) if (ale) MEM_freeN(ale); return OPERATOR_CANCELLED; } - + fcu = ale->data; + /* get frame and value from props */ frame= RNA_float_get(op->ptr, "frame"); val= RNA_float_get(op->ptr, "value"); @@ -529,8 +542,11 @@ static int graphkeys_click_insert_exec (bContext *C, wmOperator *op) adt= ANIM_nla_mapping_get(&ac, ale); frame= BKE_nla_tweakedit_remap(adt, frame, NLATIME_CONVERT_UNMAP); + /* apply inverse unit-mapping to value to get correct value for F-Curves */ + val *= ANIM_unit_mapping_get_factor(ac.scene, ale->id, fcu, 1); + /* insert keyframe on the specified frame + value */ - insert_vert_fcurve((FCurve *)ale->data, frame, val, 0); + insert_vert_fcurve(fcu, frame, val, 0); /* free temp data */ MEM_freeN(ale); @@ -1002,7 +1018,7 @@ void GRAPH_OT_bake (wmOperatorType *ot) * which provides the necessary info for baking the sound */ typedef struct tSoundBakeInfo { - float* samples; + float *samples; int length; int cfra; } tSoundBakeInfo; @@ -1075,7 +1091,7 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op) /* loop through all selected F-Curves, replacing its data with the sound samples */ for (ale= anim_data.first; ale; ale= ale->next) { FCurve *fcu= (FCurve *)ale->key_data; - + /* sample the sound */ fcurve_store_samples(fcu, &sbi, start, end, fcurve_samplingcb_sound); } @@ -1557,6 +1573,9 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *op) for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(&ac, ale); + /* apply unit corrections */ + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, 0, 1); + if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); @@ -1565,6 +1584,8 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *op) else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); + /* unapply unit corrections */ + ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, 1, 1); } BLI_freelistN(&anim_data); @@ -1645,6 +1666,9 @@ static void snap_graph_keys(bAnimContext *ac, short mode) for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(ac, ale); + /* apply unit corrections */ + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0, 0); + if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); @@ -1652,7 +1676,11 @@ static void snap_graph_keys(bAnimContext *ac, short mode) } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); + + /* apply unit corrections */ + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 1, 0); } + BLI_freelistN(&anim_data); } @@ -1762,6 +1790,9 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(ac, ale); + /* apply unit corrections */ + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0, 1); + if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); @@ -1769,7 +1800,11 @@ static void mirror_graph_keys(bAnimContext *ac, short mode) } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, edit_cb, calchandles_fcurve); + + /* unapply unit corrections */ + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 1, 1); } + BLI_freelistN(&anim_data); } diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index d6b7e809617..8ab39bc41ba 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -247,6 +247,9 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho AnimData *adt= ANIM_nla_mapping_get(ac, ale); FCurve *fcu= (FCurve *)ale->key_data; + /* apply unit corrections */ + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0, 1); + /* apply NLA mapping to all the keyframes, since it's easier than trying to * guess when a callback might use something different */ @@ -282,6 +285,9 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho /* un-apply NLA mapping from all the keyframes */ if (adt) ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); + + /* unapply unit corrections */ + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0, 1); } /* cleanup */ @@ -602,6 +608,9 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc FCurve *fcu= (FCurve *)ale->key_data; AnimData *adt= ANIM_nla_mapping_get(ac, ale); + /* apply unit corrections */ + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0, 0); + /* try to progressively get closer to the right point... */ if (fcu->bezt) { BezTriple *bezt1=fcu->bezt, *prevbezt=NULL; @@ -668,6 +677,9 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc if (adt) ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } + + /* unapply unit corrections */ + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 1, 0); } /* free channels */ diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 8230c7b46d0..acee06e487e 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -445,8 +445,6 @@ typedef enum eFCurve_Flags { FCURVE_INT_VALUES = (1<<11), /* curve can only have certain discrete-number values (no interpolation at all, for enums/booleans) */ FCURVE_DISCRETE_VALUES = (1<<12), - /* curve represents a rotation value stored internally in the curve in degrees */ - FCURVE_ROTATION_DEGREES = (1<<13), } eFCurve_Flags; diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 17d6436eeae..5b62db08a80 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -255,6 +255,7 @@ extern StructRNA RNA_KeyboardSensor; extern StructRNA RNA_KeyConfig; extern StructRNA RNA_KeyingSet; extern StructRNA RNA_KeyingSetPath; +extern StructRNA RNA_Keyframe; extern StructRNA RNA_KeyMap; extern StructRNA RNA_KeyMapItem; extern StructRNA RNA_KinematicConstraint; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 652352c0ecb..edbe2edff0c 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -415,12 +415,6 @@ static void rna_def_beztriple(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "ipo"); - RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items); - RNA_def_property_ui_text(prop, "Interpolation", "(For F-Curves Only) Interpolation to use for segment of curve starting from current BezTriple."); - //RNA_def_property_update(prop, 0, "rna_Curve_update_data"); // this should be an F-Curve update call instead... - /* Vector values */ prop= RNA_def_property(srna, "handle1", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_array(prop, 3); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index f77894222d5..4ff89b84877 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -234,155 +234,52 @@ static void rna_DriverVariable_type_set(PointerRNA *ptr, int value) /* ****************************** */ -static int rna_fpoint_is_rotation(ID *id, FPoint *fpt) +static void rna_FKeyframe_handle1_get(PointerRNA *ptr, float *values) { - bAction *act = (bAction *)id; - FCurve *fcu; - int found=0; - - for (fcu=act->curves.first; fcu; fcu=fcu->next) { - if (fcu->fpt) { - /* the following check works because - * the fpoints are always allocated in contiguous blocks */ - if (fpt >= fcu->fpt && fpt < fcu->fpt+fcu->totvert) { - found=1; - break; - } - } - } - - if (!found) - return 0; - - return (fcu->flag & FCURVE_ROTATION_DEGREES); -} - - -static void rna_FPoint_vec_get(PointerRNA *ptr, float *values) -{ - ID *id = (ID *)ptr->id.data; - FPoint *fpt= (FPoint*)ptr->data; - - values[0]= fpt->vec[0]; - - if (rna_fpoint_is_rotation(id, fpt)) - values[1]= fpt->vec[1] * M_PI/180.0; - else - values[1]= fpt->vec[1]; -} - -static void rna_FPoint_vec_set(PointerRNA *ptr, const float *values) -{ - ID *id = (ID *)ptr->id.data; - FPoint *fpt= (FPoint*)ptr->data; - - fpt->vec[0] = values[0]; - - if (rna_fpoint_is_rotation(id, fpt)) - fpt->vec[1]= values[1] * 180.0 / M_PI; - else - fpt->vec[1]= values[1]; -} - -static int rna_beztriple_is_rotation(ID *id, BezTriple *bt) -{ - bAction *act = (bAction *)id; - FCurve *fcu; - int found=0; - - for (fcu=act->curves.first; fcu; fcu=fcu->next) { - if (fcu->bezt) { - /* the following check works because - * the beztriples are always allocated in contiguous blocks */ - if (bt >= fcu->bezt && bt < fcu->bezt+fcu->totvert) { - found=1; - break; - } - } - } - - if (!found) - return 0; + BezTriple *bezt= (BezTriple*)ptr->data; - return (fcu->flag & FCURVE_ROTATION_DEGREES); + values[0]= bezt->vec[0][0]; + values[1]= bezt->vec[0][1]; } -static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values) +static void rna_FKeyframe_handle1_set(PointerRNA *ptr, const float *values) { - ID *id = (ID *)ptr->id.data; - BezTriple *bt= (BezTriple*)ptr->data; - - values[0]= bt->vec[0][0]; + BezTriple *bezt= (BezTriple*)ptr->data; - if (rna_beztriple_is_rotation(id, bt)) - values[1]= bt->vec[0][1] * M_PI/180.0; - else - values[1]= bt->vec[0][1]; + bezt->vec[0][0]= values[0]; + bezt->vec[0][1]= values[1]; } -static void rna_BezTriple_handle1_set(PointerRNA *ptr, const float *values) +static void rna_FKeyframe_handle2_get(PointerRNA *ptr, float *values) { - ID *id = (ID *)ptr->id.data; - BezTriple *bt= (BezTriple*)ptr->data; - - bt->vec[0][0]= values[0]; + BezTriple *bezt= (BezTriple*)ptr->data; - if (rna_beztriple_is_rotation(id, bt)) - bt->vec[0][1]= values[1] * 180.0 / M_PI; - else - bt->vec[0][1]= values[1]; + values[0]= bezt->vec[2][0]; + values[1]= bezt->vec[2][1]; } -static void rna_BezTriple_handle2_get(PointerRNA *ptr, float *values) +static void rna_FKeyframe_handle2_set(PointerRNA *ptr, const float *values) { - ID *id = (ID *)ptr->id.data; - BezTriple *bt= (BezTriple*)ptr->data; - - values[0]= bt->vec[2][0]; + BezTriple *bezt= (BezTriple*)ptr->data; - if (rna_beztriple_is_rotation(id, bt)) - values[1]= bt->vec[2][1] * M_PI/180.0; - else - values[1]= bt->vec[2][1]; -} - -static void rna_BezTriple_handle2_set(PointerRNA *ptr, const float *values) -{ - ID *id = (ID *)ptr->id.data; - BezTriple *bt= (BezTriple*)ptr->data; - - bt->vec[2][0]= values[0]; - - if (rna_beztriple_is_rotation(id, bt)) - bt->vec[2][1]= values[1] * 180.0 / M_PI; - else - bt->vec[2][1]= values[1]; + bezt->vec[2][0]= values[0]; + bezt->vec[2][1]= values[1]; } -static void rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, float *values) +static void rna_FKeyframe_ctrlpoint_get(PointerRNA *ptr, float *values) { - ID *id = (ID *)ptr->id.data; - BezTriple *bt= (BezTriple*)ptr->data; - - values[0]= bt->vec[1][0]; + BezTriple *bezt= (BezTriple*)ptr->data; - if (rna_beztriple_is_rotation(id, bt)) - values[1]= bt->vec[1][1] * M_PI/180.0; - else - values[1]= bt->vec[1][1]; + values[0]= bezt->vec[1][0]; + values[1]= bezt->vec[1][1]; } -static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values) +static void rna_FKeyframe_ctrlpoint_set(PointerRNA *ptr, const float *values) { - ID *id = (ID *)ptr->id.data; - BezTriple *bt= (BezTriple*)ptr->data; + BezTriple *bezt= (BezTriple*)ptr->data; - bt->vec[1][0]= values[0]; - - if (rna_beztriple_is_rotation(id, bt)) - bt->vec[1][1]= values[1] * 180.0 / M_PI; - else - bt->vec[1][1]= values[1]; + bezt->vec[1][0]= values[0]; + bezt->vec[1][1]= values[1]; } /* ****************************** */ @@ -1064,103 +961,83 @@ static void rna_def_fpoint(BlenderRNA *brna) /* Vector value */ prop= RNA_def_property(srna, "point", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "vec"); RNA_def_property_array(prop, 2); - RNA_def_property_float_funcs(prop, "rna_FPoint_vec_get", "rna_FPoint_vec_set", NULL); RNA_def_property_ui_text(prop, "Point", "Point coordinates"); } /* duplicate of BezTriple in rna_curve.c - * but with F-Curve specific options updates/functionality */ -static void rna_def_fcurvebeztriple(BlenderRNA *brna) + * but with F-Curve specific options updates/functionality + */ +static void rna_def_fkeyframe(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem beztriple_handle_type_items[] = { - {HD_FREE, "FREE", 0, "Free", ""}, - {HD_AUTO, "AUTO", 0, "Auto", ""}, - {HD_VECT, "VECTOR", 0, "Vector", ""}, - {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, - {HD_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped", ""}, - {0, NULL, 0, NULL, NULL}}; - - static EnumPropertyItem beztriple_interpolation_mode_items[] = { - {BEZT_IPO_CONST, "CONSTANT", 0, "Constant", ""}, - {BEZT_IPO_LIN, "LINEAR", 0, "Linear", ""}, - {BEZT_IPO_BEZ, "BEZIER", 0, "Bezier", ""}, - {0, NULL, 0, NULL, NULL}}; - - srna= RNA_def_struct(brna, "FCurveBezierSplinePoint", NULL); + srna= RNA_def_struct(brna, "Keyframe", NULL); RNA_def_struct_sdna(srna, "BezTriple"); - RNA_def_struct_ui_text(srna, "FCurve Bezier Curve Point", "Bezier curve point with two handles, used in F-Curves."); + RNA_def_struct_ui_text(srna, "Keyframe", "Bezier curve point with two handles defining a Keyframe on an F-Curve."); /* Boolean values */ prop= RNA_def_property(srna, "selected_handle1", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "f1", 0); RNA_def_property_ui_text(prop, "Handle 1 selected", "Handle 1 selection status"); - RNA_def_property_update(prop, 0, NULL); + //RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "selected_handle2", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "f3", 0); RNA_def_property_ui_text(prop, "Handle 2 selected", "Handle 2 selection status"); - RNA_def_property_update(prop, 0, NULL); + //RNA_def_property_update(prop, 0, NULL); - prop= RNA_def_property(srna, "selected_control_point", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "f2", 0); - RNA_def_property_ui_text(prop, "Control Point selected", "Control point selection status"); - RNA_def_property_update(prop, 0, NULL); - - prop= RNA_def_property(srna, "hidden", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "hide", 0); - RNA_def_property_ui_text(prop, "Hidden", "Visibility status"); - RNA_def_property_update(prop, 0, NULL); + RNA_def_property_ui_text(prop, "Selected", "Control point selection status"); + //RNA_def_property_update(prop, 0, NULL); /* Enums */ prop= RNA_def_property(srna, "handle1_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "h1"); RNA_def_property_enum_items(prop, beztriple_handle_type_items); RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle types"); - RNA_def_property_update(prop, 0, NULL); + //RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "handle2_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "h2"); RNA_def_property_enum_items(prop, beztriple_handle_type_items); RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types"); - RNA_def_property_update(prop, 0, NULL); + //RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ipo"); RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items); - RNA_def_property_ui_text(prop, "Interpolation", "(For F-Curves Only) Interpolation to use for segment of curve starting from current BezTriple."); + RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method to use for segment of the curve from this Keyframe until the next Keyframe."); //RNA_def_property_update(prop, 0, "rna_Curve_update_data"); // this should be an F-Curve update call instead... - prop= RNA_def_property(srna, "keyframe_type", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "hide"); RNA_def_property_enum_items(prop, beztriple_keyframe_type_items); - RNA_def_property_ui_text(prop, "Keyframe Type", "(For F-Curves only) The type of keyframe this control point defines."); + RNA_def_property_ui_text(prop, "Type", "The type of keyframe."); //RNA_def_property_update(prop, 0, "rna_Curve_update_data"); // this should be an F-Curve update call instead... /* Vector values */ prop= RNA_def_property(srna, "handle1", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_array(prop, 2); - RNA_def_property_float_funcs(prop, "rna_BezTriple_handle1_get", "rna_BezTriple_handle1_set", NULL); + RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle1_get", "rna_FKeyframe_handle1_set", NULL); RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle"); - RNA_def_property_update(prop, 0, NULL); + //RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_array(prop, 2); - RNA_def_property_float_funcs(prop, "rna_BezTriple_ctrlpoint_get", "rna_BezTriple_ctrlpoint_set", NULL); + RNA_def_property_float_funcs(prop, "rna_FKeyframe_ctrlpoint_get", "rna_FKeyframe_ctrlpoint_set", NULL); RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point"); - RNA_def_property_update(prop, 0, NULL); + //RNA_def_property_update(prop, 0, NULL); prop= RNA_def_property(srna, "handle2", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_array(prop, 2); - RNA_def_property_float_funcs(prop, "rna_BezTriple_handle2_get", "rna_BezTriple_handle2_set", NULL); + RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle2_get", "rna_FKeyframe_handle2_set", NULL); RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle"); - RNA_def_property_update(prop, 0, NULL); - - /* Number values */ + //RNA_def_property_update(prop, 0, NULL); } @@ -1273,7 +1150,7 @@ static void rna_def_fcurve(BlenderRNA *brna) prop= RNA_def_property(srna, "keyframe_points", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "bezt", "totvert"); - RNA_def_property_struct_type(prop, "FCurveBezierSplinePoint"); + RNA_def_property_struct_type(prop, "Keyframe"); RNA_def_property_ui_text(prop, "Keyframes", "User-editable keyframes"); prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE); @@ -1287,9 +1164,9 @@ static void rna_def_fcurve(BlenderRNA *brna) void RNA_def_fcurve(BlenderRNA *brna) { - rna_def_fcurvebeztriple(brna); rna_def_fcurve(brna); - rna_def_fpoint(brna); + rna_def_fkeyframe(brna); + rna_def_fpoint(brna); rna_def_drivertarget(brna); rna_def_drivervar(brna); |