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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-01-18 15:20:28 +0300
committerCampbell Barton <ideasman42@gmail.com>2008-01-18 15:20:28 +0300
commit9afc417bed94fa83db70ee98f8d1dc0a5f54fee6 (patch)
treefb5c94399622cfa6bb86bf067470f3dd98a7c967 /source
parent9d13e083311727deeb1c7dc8efaf06bc5170fdac (diff)
2 new timeoffset buttons in the animation panel "Ofs" and "Rand"
Useful when animating many objects falling at different times (for instance).
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BDR_editobject.h2
-rw-r--r--source/blender/include/butspace.h4
-rw-r--r--source/blender/makesdna/DNA_object_types.h2
-rw-r--r--source/blender/src/buttons_object.c14
-rw-r--r--source/blender/src/editobject.c52
-rw-r--r--source/blender/src/view.c1
6 files changed, 70 insertions, 5 deletions
diff --git a/source/blender/include/BDR_editobject.h b/source/blender/include/BDR_editobject.h
index b38ee8d3939..9e65a049bfc 100644
--- a/source/blender/include/BDR_editobject.h
+++ b/source/blender/include/BDR_editobject.h
@@ -111,6 +111,8 @@ void set_ob_ipoflags(void);
void select_select_keys(void);
int vergbaseco(const void *a1, const void *a2);
void auto_timeoffs(void);
+void ofs_timeoffs(void);
+void rand_timeoffs(void);
void texspace_edit(void);
void flip_subdivison(int);
void mirrormenu(void);
diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h
index e296a71bc70..a20dc36ab50 100644
--- a/source/blender/include/butspace.h
+++ b/source/blender/include/butspace.h
@@ -725,7 +725,7 @@ enum {
#define B_EFFECTSBUTS 3500
-#define B_AUTOTIMEOFS 3403
+#define B_AUTOTIMEOFS 3403 /* see B_OFSTIMEOFS, B_RANDTIMEOFS also */
#define B_FRAMEMAP 3404
#define B_NEWEFFECT 3405
#define B_PREVEFFECT 3406
@@ -760,6 +760,8 @@ enum {
#define B_PART_EDITABLE 3435
#define B_PART_REKEY 3436
#define B_PART_ENABLE 3437
+#define B_OFSTIMEOFS 3438 /* see B_AUTOTIMEOFS too */
+#define B_RANDTIMEOFS 3439
#define B_MODIFIER_BUTS 3600
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index c02b353f604..565b2cfd678 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -119,7 +119,7 @@ typedef struct Object {
int dupon, dupoff, dupsta, dupend;
- float sf, ctime;
+ float sf, ctime; /* sf is time-offset, ctime is the objects current time */
/* during realtime */
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 8198c51550b..b7be9d7f9bc 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -2500,9 +2500,11 @@ static void object_panel_anim(Object *ob)
uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "Offs Particle", 140,35,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,10,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify an offset in frames");
- uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time", 139,10,104,20, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames");
- uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 248,10,67,20, 0, 0, 0, 0, 0, "Print objectspeed");
+ uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,10,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Animation offset in frames for ipo's and dupligroup instances");
+ uiDefBut(block, BUT, B_AUTOTIMEOFS, "Auto", 139,10,34,20, 0, 0, 0, 0, 0, "Assign selected objects a timeoffset within a range, starting from the active object");
+ uiDefBut(block, BUT, B_OFSTIMEOFS, "Ofs", 173,10,34,20, 0, 0, 0, 0, 0, "Offset selected objects timeoffset");
+ uiDefBut(block, BUT, B_RANDTIMEOFS, "Rand", 207,10,34,20, 0, 0, 0, 0, 0, "Randomize selected objects timeoffset");
+ uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 250,10,65,20, 0, 0, 0, 0, 0, "Print objectspeed");
uiBlockEndAlign(block);
sprintf(str, "%.4f", prspeed);
@@ -2647,6 +2649,12 @@ void do_effects_panels(unsigned short event)
case B_AUTOTIMEOFS:
auto_timeoffs();
break;
+ case B_OFSTIMEOFS:
+ ofs_timeoffs();
+ break;
+ case B_RANDTIMEOFS:
+ rand_timeoffs();
+ break;
case B_FRAMEMAP:
G.scene->r.framelen= G.scene->r.framapto;
G.scene->r.framelen/= G.scene->r.images;
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index eea97e15f00..bbdcfc428dd 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -92,6 +92,7 @@
#include "BLI_arithb.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
+#include "BLI_rand.h"
#include "BKE_action.h"
#include "BKE_anim.h"
@@ -5462,6 +5463,57 @@ void auto_timeoffs(void)
allqueue(REDRAWBUTSOBJECT, 0);
}
+void ofs_timeoffs(void)
+{
+ Base *base;
+ float offset=0.0f;
+
+ if(BASACT==0 || G.vd==NULL) return;
+
+ if(fbutton(&offset, -10000.0f, 10000.0f, 10, 10, "Offset")==0) return;
+
+ /* make array of all bases, xco yco (screen) */
+ base= FIRSTBASE;
+ while(base) {
+ if(TESTBASELIB(base)) {
+ base->object->sf += offset;
+ if (base->object->sf < -MAXFRAMEF) base->object->sf = -MAXFRAMEF;
+ else if (base->object->sf > MAXFRAMEF) base->object->sf = MAXFRAMEF;
+ }
+ base= base->next;
+ }
+
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSOBJECT, 0);
+}
+
+
+void rand_timeoffs(void)
+{
+ Base *base;
+ float rand=0.0f;
+
+ if(BASACT==0 || G.vd==NULL) return;
+
+ if(fbutton(&rand, 0.0f, 10000.0f, 10, 10, "Randomize")==0) return;
+
+ rand *= 2;
+
+ base= FIRSTBASE;
+ while(base) {
+ if(TESTBASELIB(base)) {
+ base->object->sf += (BLI_drand()-0.5) * rand;
+ if (base->object->sf < -MAXFRAMEF) base->object->sf = -MAXFRAMEF;
+ else if (base->object->sf > MAXFRAMEF) base->object->sf = MAXFRAMEF;
+ }
+ base= base->next;
+ }
+
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSOBJECT, 0);
+}
+
+
void texspace_edit(void)
{
Base *base;
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index a4960b76ae7..abb49c0ec9d 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -69,6 +69,7 @@
#include "BKE_sculpt.h"
#include "BKE_utildefines.h"
+#include "BIF_transform.h"
#include "BIF_editparticle.h"
#include "BIF_gl.h"
#include "BIF_previewrender.h"