2 new timeoffset buttons in the animation panel "Ofs" and "Rand"
Useful when animating many objects falling at different times (for instance).
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user