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:
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c14
-rw-r--r--source/blender/blenkernel/intern/ipo.c11
-rw-r--r--source/blender/blenkernel/intern/object.c16
-rw-r--r--source/blender/makesdna/DNA_curve_types.h5
-rw-r--r--source/blender/makesrna/intern/rna_curve.c6
5 files changed, 39 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 2efb4f2b2d3..7a6706b7c5a 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1341,10 +1341,22 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
EVAL_ANIM_IDS(main->camera.first, ADT_RECALC_ANIM);
/* shapekeys */
+ // TODO: we probably need the same hack as for curves (ctime-hack)
EVAL_ANIM_IDS(main->key.first, ADT_RECALC_ANIM);
/* curves */
- // TODO...
+ /* we need to perform a special hack here to ensure that the ctime
+ * value of the curve gets set in case there's no animation for that
+ * - it needs to be set before animation is evaluated just so that
+ * animation can successfully override...
+ */
+ for (id= main->curve.first; id; id= id->next) {
+ AnimData *adt= BKE_animdata_from_id(id);
+ Curve *cu= (Curve *)id;
+
+ cu->ctime= ctime;
+ BKE_animsys_evaluate_animdata(id, adt, ctime, ADT_RECALC_ANIM);
+ }
/* meshes */
// TODO...
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 5642e63326f..968a0e68fb9 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -827,6 +827,10 @@ char *get_rna_access (int blocktype, int adrcode, char actname[], char constname
char buf[512];
int dummy_index= 0;
+ /* hack: if constname is set, we can only be dealing with an Constraint curve */
+ if (constname)
+ blocktype= ID_CO;
+
/* get property name based on blocktype */
switch (blocktype) {
case ID_OB: /* object */
@@ -842,7 +846,7 @@ char *get_rna_access (int blocktype, int adrcode, char actname[], char constname
break;
case ID_CO: /* constraint */
- propname= constraint_adrcodes_to_paths(adrcode, &dummy_index);
+ propname= constraint_adrcodes_to_paths(adrcode, &dummy_index);
break;
case ID_TE: /* texture */
@@ -872,7 +876,10 @@ char *get_rna_access (int blocktype, int adrcode, char actname[], char constname
/* XXX problematic blocktypes */
case ID_CU: /* curve */
- propname= "speed"; // XXX this was a 'dummy curve' that didn't really correspond to any real var...
+ /* this used to be a 'dummy' curve which got evaluated on the fly...
+ * now we've got real var for this!
+ */
+ propname= "eval_time";
break;
case ID_SEQ: /* sequencer strip */
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index c2916bc2231..6490ff3c724 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1569,14 +1569,14 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
}
/* catch exceptions: curve paths used as a duplicator */
else if(enable_cu_speed) {
- ctime= bsystem_time(scene, ob, (float)scene->r.cfra, 0.0);
-
-#if 0 // XXX old animation system
- if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
- ctime /= cu->pathlen;
- CLAMP(ctime, 0.0, 1.0);
- }
-#endif // XXX old animation system
+ /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
+ * but this will only work if it actually is animated...
+ *
+ * we firstly calculate the modulus of cu->ctime/cu->pathlen to clamp ctime within the 0.0 to 1.0 times pathlen
+ * range, then divide this (the modulus) by pathlen to get a value between 0.0 and 1.0
+ */
+ ctime= fmod(cu->ctime, cu->pathlen) / cu->pathlen;
+ CLAMP(ctime, 0.0, 1.0);
}
else {
ctime= scene->r.cfra - give_timeoffset(ob);
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index f8ea5f95d65..b0f089d670f 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -148,7 +148,7 @@ typedef struct Curve {
ListBase *editnurb; /* edited data, not in file, use pointer so we can check for it */
struct Object *bevobj, *taperobj, *textoncurve;
- struct Ipo *ipo;
+ struct Ipo *ipo; // XXX depreceated... old animation system
Path *path;
struct Key *key;
struct Material **mat;
@@ -193,7 +193,8 @@ typedef struct Curve {
int sepchar;
- int totbox, actbox, pad;
+ float ctime; /* current evaltime - for use by Objects parented to curves */
+ int totbox, actbox;
struct TextBox *tb;
int selstart, selend;
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 41a47e279e9..91488aa2a49 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -31,6 +31,7 @@
#include "DNA_curve_types.h"
#include "DNA_material_types.h"
+#include "DNA_scene_types.h"
EnumPropertyItem beztriple_handle_type_items[] = {
{HD_FREE, "FREE", 0, "Free", ""},
@@ -558,6 +559,11 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 1, 1024, 1, 0);
RNA_def_property_ui_text(prop, "Render Resolution V", "Surface resolution in V direction used while rendering. Zero skips this property.");
+
+ prop= RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ctime");
+ RNA_def_property_ui_text(prop, "Evaluation Time", "Parametric position along the length of the curve that Objects 'following' it should be at.");
+
/* pointers */
prop= RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "bevobj");