2.5
Cleanup - for portablity we can keep the old ugly defines for retrieving active object, cfra and so on. But, they will use 'scene' not G.scene. - fixed code that uses those defines. - some unused variables/functions removed
This commit is contained in:
@@ -4429,7 +4429,7 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
|
||||
part= psys->part;
|
||||
cache= psys->pointcache;
|
||||
|
||||
framenr= (int)CFRA;
|
||||
framenr= (int)G.scene->r.cfra;
|
||||
framedelta= framenr - cache->simframe;
|
||||
|
||||
BKE_ptcache_id_from_particles(&pid, ob, psys);
|
||||
|
||||
@@ -71,7 +71,7 @@ extern void ui_rasterpos_safe(float x, float y, float aspect);
|
||||
/* CURRENT FRAME DRAWING */
|
||||
|
||||
/* Draw current frame number in a little green box beside the current frame indicator */
|
||||
static void draw_cfra_number (View2D *v2d, float cfra, short time)
|
||||
static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
|
||||
{
|
||||
float xscale, yscale, x, y;
|
||||
char str[32];
|
||||
@@ -147,7 +147,7 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag)
|
||||
/* Draw current frame number in a little box */
|
||||
if (flag & DRAWCFRA_SHOW_NUMBOX) {
|
||||
UI_view2d_view_orthoSpecial(C, v2d, 1);
|
||||
draw_cfra_number(v2d, vec[0], (flag & DRAWCFRA_UNIT_SECONDS));
|
||||
draw_cfra_number(scene, v2d, vec[0], (flag & DRAWCFRA_UNIT_SECONDS));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -362,6 +362,7 @@ int WM_modal_tweak_check(wmEvent *evt, int tweak_event)
|
||||
|
||||
static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
MarkerMove *mm= op->customdata;
|
||||
View2D *v2d= UI_view2d_fromcontext(C);
|
||||
TimeMarker *marker, *selmarker=NULL;
|
||||
|
||||
@@ -867,6 +867,7 @@ static void step_to_grid(float *step, int *power, int unit)
|
||||
*/
|
||||
View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
View2DGrid *grid;
|
||||
float space, pixels, seconddiv;
|
||||
int secondgrid;
|
||||
@@ -1137,7 +1138,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
|
||||
}
|
||||
|
||||
/* Print scale marking along a time scrollbar */
|
||||
static void scroll_printstr(View2DScrollers *scrollers, float x, float y, float val, int power, short unit, char dir)
|
||||
static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, float y, float val, int power, short unit, char dir)
|
||||
{
|
||||
int len;
|
||||
char str[32];
|
||||
@@ -1250,6 +1251,7 @@ static void scroll_printstr(View2DScrollers *scrollers, float x, float y, float
|
||||
/* Draw scrollbars in the given 2d-region */
|
||||
void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
const short darker= -50, dark= -10, light= 20, lighter= 50;
|
||||
rcti vert, hor, corner;
|
||||
|
||||
@@ -1355,12 +1357,12 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
|
||||
for (; fac < hor.xmax; fac+=dfac, val+=grid->dx) {
|
||||
switch (vs->xunits) {
|
||||
case V2D_UNIT_FRAMES: /* frames (as whole numbers)*/
|
||||
scroll_printstr(vs, fac, 3.0+(float)(hor.ymin), val, grid->powerx, V2D_UNIT_FRAMES, 'h');
|
||||
scroll_printstr(vs, scene, fac, 3.0+(float)(hor.ymin), val, grid->powerx, V2D_UNIT_FRAMES, 'h');
|
||||
break;
|
||||
|
||||
case V2D_UNIT_SECONDS: /* seconds */
|
||||
fac2= val/FPS;
|
||||
scroll_printstr(vs, fac, 3.0+(float)(hor.ymin), fac2, grid->powerx, V2D_UNIT_SECONDS, 'h');
|
||||
scroll_printstr(vs, scene, fac, 3.0+(float)(hor.ymin), fac2, grid->powerx, V2D_UNIT_SECONDS, 'h');
|
||||
break;
|
||||
|
||||
case V2D_UNIT_SECONDSSEQ: /* seconds with special calculations (only used for sequencer only) */
|
||||
@@ -1371,13 +1373,13 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
|
||||
time= floor(fac2);
|
||||
fac2= fac2-time;
|
||||
|
||||
scroll_printstr(vs, fac, 3.0+(float)(hor.ymin), time+FPS*fac2/100.0, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h');
|
||||
scroll_printstr(vs, scene, fac, 3.0+(float)(hor.ymin), time+FPS*fac2/100.0, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h');
|
||||
}
|
||||
break;
|
||||
|
||||
case V2D_UNIT_DEGREES: /* IPO-Editor for rotation IPO-Drivers */
|
||||
/* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */
|
||||
scroll_printstr(vs, fac, 3.0+(float)(hor.ymin), val, grid->powerx, V2D_UNIT_DEGREES, 'v');
|
||||
scroll_printstr(vs, scene, fac, 3.0+(float)(hor.ymin), val, grid->powerx, V2D_UNIT_DEGREES, 'v');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1484,7 +1486,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
|
||||
|
||||
/* draw vertical steps */
|
||||
for (; fac < vert.ymax; fac+= dfac, val += grid->dy) {
|
||||
scroll_printstr(vs, (float)(vert.xmax)-14.0, fac, val, grid->powery, vs->yunits, 'v');
|
||||
scroll_printstr(vs, scene, (float)(vert.xmax)-14.0, fac, val, grid->powery, vs->yunits, 'v');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1267,11 +1267,11 @@ void ed_screen_fullarea(bContext *C)
|
||||
void ED_animation_timer(wmWindow *win, int enable)
|
||||
{
|
||||
|
||||
if(win->animtimer)
|
||||
WM_event_remove_window_timer(win, win->animtimer);
|
||||
win->animtimer= NULL;
|
||||
// if(win->animtimer)
|
||||
// WM_event_remove_window_timer(win, win->animtimer);
|
||||
// win->animtimer= NULL;
|
||||
|
||||
if(enable)
|
||||
win->animtimer= WM_event_add_window_timer(win, (int)(1000/FPS), (int)(1000/FPS));
|
||||
// if(enable)
|
||||
// win->animtimer= WM_event_add_window_timer(win, (int)(1000/FPS), (int)(1000/FPS));
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ static void time_draw_cfra_time(const bContext *C, SpaceTime *stime, ARegion *ar
|
||||
static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar)
|
||||
{
|
||||
View2D *v2d= UI_view2d_fromcontext(C);
|
||||
//Scene *scene= CTX_data_scene(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
|
||||
/* draw darkened area outside of active timeline
|
||||
* frame range used is preview range or scene range */
|
||||
@@ -229,9 +229,10 @@ static SpaceLink *time_new(void)
|
||||
BLI_addtail(&stime->regionbase, ar);
|
||||
ar->regiontype= RGN_TYPE_WINDOW;
|
||||
|
||||
ar->v2d.tot.xmin= (float)(SFRA - 4);
|
||||
/* XXX here sfra and efra was used.... */
|
||||
ar->v2d.tot.xmin= (float)(- 4);
|
||||
ar->v2d.tot.ymin= 0.0f;
|
||||
ar->v2d.tot.xmax= (float)(EFRA + 4);
|
||||
ar->v2d.tot.xmax= (float)(250 + 4);
|
||||
ar->v2d.tot.ymax= 50.0f;
|
||||
|
||||
ar->v2d.cur= ar->v2d.tot;
|
||||
|
||||
@@ -2022,7 +2022,7 @@ static void draw_ebones(View3D *v3d, Object *ob, int dt)
|
||||
/* draw bone paths
|
||||
* - in view space
|
||||
*/
|
||||
static void draw_pose_paths(View3D *v3d, Object *ob)
|
||||
static void draw_pose_paths(Scene *scene, View3D *v3d, Object *ob)
|
||||
{
|
||||
bArmature *arm= ob->data;
|
||||
bPoseChannel *pchan;
|
||||
@@ -2547,7 +2547,7 @@ int draw_armature(Scene *scene, View3D *v3d, Base *base, int dt, int flag)
|
||||
else if(G.f & G_WEIGHTPAINT)
|
||||
arm->flag |= ARM_POSEMODE;
|
||||
|
||||
draw_pose_paths(v3d, ob);
|
||||
draw_pose_paths(scene, v3d, ob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmoot
|
||||
return 1;
|
||||
}
|
||||
|
||||
void draw_mesh_text(Object *ob, int glsl)
|
||||
void draw_mesh_text(Scene *scene, Object *ob, int glsl)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
DerivedMesh *ddm;
|
||||
@@ -561,7 +561,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, Object *ob, DerivedMesh *dm,
|
||||
|
||||
/* draw game engine text hack */
|
||||
if(get_ob_property(ob, "Text"))
|
||||
draw_mesh_text(ob, 0);
|
||||
draw_mesh_text(scene, ob, 0);
|
||||
|
||||
draw_textured_end();
|
||||
|
||||
|
||||
@@ -2824,7 +2824,7 @@ static int drawDispList(Scene *scene, View3D *v3d, Base *base, int dt)
|
||||
/* 5. start filling the arrays */
|
||||
/* 6. draw the arrays */
|
||||
/* 7. clean up */
|
||||
static void draw_new_particle_system(View3D *v3d, Base *base, ParticleSystem *psys, int dt)
|
||||
static void draw_new_particle_system(Scene *scene, View3D *v3d, Base *base, ParticleSystem *psys, int dt)
|
||||
{
|
||||
Object *ob=base->object;
|
||||
ParticleSystemModifierData *psmd;
|
||||
@@ -5069,7 +5069,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
for(psys=ob->particlesystem.first; psys; psys=psys->next)
|
||||
draw_new_particle_system(v3d, base, psys, dt);
|
||||
draw_new_particle_system(scene, v3d, base, psys, dt);
|
||||
|
||||
if(G.f & G_PARTICLEEDIT && ob==OBACT) {
|
||||
psys= NULL; // XXX PE_get_current(ob);
|
||||
|
||||
@@ -233,6 +233,7 @@ void do_layer_buttons(bContext *C, short event)
|
||||
|
||||
static void do_view3d_view_camerasmenu(bContext *C, void *arg, int event)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
View3D *v3d;
|
||||
Base *base;
|
||||
int i=1;
|
||||
|
||||
@@ -723,7 +723,7 @@ void mouse_cursor(Scene *scene, ARegion *ar, View3D *v3d, short mx, short my)
|
||||
|
||||
}
|
||||
|
||||
void deselectall(View3D *v3d) /* is toggle */
|
||||
void deselectall(Scene *scene, View3D *v3d) /* is toggle */
|
||||
{
|
||||
Base *base;
|
||||
int a=0, ok=0;
|
||||
@@ -806,7 +806,7 @@ void selectrandom(Scene *scene, View3D *v3d)
|
||||
}
|
||||
|
||||
/* selects all objects of a particular type, on currently visible layers */
|
||||
void selectall_type(View3D *v3d, short obtype)
|
||||
void selectall_type(Scene *scene, View3D *v3d, short obtype)
|
||||
{
|
||||
Base *base;
|
||||
|
||||
@@ -825,7 +825,7 @@ void selectall_type(View3D *v3d, short obtype)
|
||||
BIF_undo_push("Select all per type");
|
||||
}
|
||||
/* selects all objects on a particular layer */
|
||||
void selectall_layer(unsigned int layernum)
|
||||
void selectall_layer(Scene *scene, unsigned int layernum)
|
||||
{
|
||||
Base *base;
|
||||
|
||||
@@ -1863,6 +1863,7 @@ static int view3d_circle_select(bContext *C, wmOperator *op)
|
||||
{
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
View3D *v3d= sa->spacedata.first;
|
||||
Base *base;
|
||||
|
||||
|
||||
@@ -724,22 +724,22 @@ typedef struct Scene {
|
||||
#define TESTBASE(v3d, base) ( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0) )
|
||||
#define TESTBASELIB(v3d, base) ( ((base)->flag & SELECT) && ((base)->lay & v3d->lay) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
|
||||
#define BASE_SELECTABLE(v3d, base) ((base->lay & v3d->lay) && (base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0)
|
||||
#define FIRSTBASE G.scene->base.first
|
||||
#define LASTBASE G.scene->base.last
|
||||
#define BASACT (G.scene->basact)
|
||||
#define FIRSTBASE scene->base.first
|
||||
#define LASTBASE scene->base.last
|
||||
#define BASACT (scene->basact)
|
||||
#define OBACT (BASACT? BASACT->object: 0)
|
||||
#define ID_NEW(a) if( (a) && (a)->id.newid ) (a)= (void *)(a)->id.newid
|
||||
#define ID_NEW_US(a) if( (a)->id.newid) {(a)= (void *)(a)->id.newid; (a)->id.us++;}
|
||||
#define ID_NEW_US2(a) if( ((ID *)a)->newid) {(a)= ((ID *)a)->newid; ((ID *)a)->us++;}
|
||||
#define CFRA (G.scene->r.cfra)
|
||||
#define F_CFRA ((float)(G.scene->r.cfra))
|
||||
#define SFRA (G.scene->r.sfra)
|
||||
#define EFRA (G.scene->r.efra)
|
||||
#define PSFRA ((G.scene->r.psfra != 0)? (G.scene->r.psfra): (G.scene->r.sfra))
|
||||
#define PEFRA ((G.scene->r.psfra != 0)? (G.scene->r.pefra): (G.scene->r.efra))
|
||||
#define FRA2TIME(a) ((((double) G.scene->r.frs_sec_base) * (a)) / G.scene->r.frs_sec)
|
||||
#define TIME2FRA(a) ((((double) G.scene->r.frs_sec) * (a)) / G.scene->r.frs_sec_base)
|
||||
#define FPS (((double) G.scene->r.frs_sec) / G.scene->r.frs_sec_base)
|
||||
#define CFRA (scene->r.cfra)
|
||||
#define F_CFRA ((float)(scene->r.cfra))
|
||||
#define SFRA (scene->r.sfra)
|
||||
#define EFRA (scene->r.efra)
|
||||
#define PSFRA ((scene->r.psfra != 0)? (scene->r.psfra): (scene->r.sfra))
|
||||
#define PEFRA ((scene->r.psfra != 0)? (scene->r.pefra): (scene->r.efra))
|
||||
#define FRA2TIME(a) ((((double) scene->r.frs_sec_base) * (a)) / scene->r.frs_sec)
|
||||
#define TIME2FRA(a) ((((double) scene->r.frs_sec) * (a)) / scene->r.frs_sec_base)
|
||||
#define FPS (((double) scene->r.frs_sec) / scene->r.frs_sec_base)
|
||||
|
||||
#define RAD_PHASE_PATCHES 1
|
||||
#define RAD_PHASE_FACES 2
|
||||
|
||||
@@ -44,7 +44,6 @@ static bNodeSocketType outputs[]= {
|
||||
static void valuefn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
|
||||
{
|
||||
float coord1[3], coord2[3];
|
||||
float x, y, z;
|
||||
|
||||
tex_input_vec(coord1, in[0], coord, thread);
|
||||
tex_input_vec(coord2, in[1], coord, thread);
|
||||
|
||||
@@ -36,8 +36,9 @@
|
||||
|
||||
/* called by meshtools */
|
||||
struct View3D;
|
||||
struct Scene;
|
||||
|
||||
void RE_make_sticky(struct View3D *v3d);
|
||||
void RE_make_sticky(struct Scene *scene, struct View3D *v3d);
|
||||
|
||||
/* for radiosity module */
|
||||
struct RadView;
|
||||
|
||||
@@ -1473,7 +1473,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
MCol *mcol= 0;
|
||||
float loc[3],loc1[3],loc0[3],vel[3],mat[4][4],nmat[3][3],co[3],nor[3],time;
|
||||
float *orco=0,*surfnor=0,*uvco=0, strandlen=0.0f, curlen=0.0f;
|
||||
float hasize, pa_size, pa_time, r_tilt, cfra=bsystem_time(ob,(float)CFRA,0.0);
|
||||
float hasize, pa_size, pa_time, r_tilt, cfra=bsystem_time(ob,(float)re->scene->r.cfra,0.0);
|
||||
float adapt_angle=0.0, adapt_pix=0.0, random, simplify[2];
|
||||
int i, a, k, max_k=0, totpart, totuv=0, totcol=0, override_uv=-1, dosimplify = 0, dosurfacecache = 0;
|
||||
int path_possible=0, keys_possible=0, baked_keys=0, totchild=0;
|
||||
@@ -1570,7 +1570,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
}
|
||||
|
||||
if(part->flag&PART_GLOB_TIME)
|
||||
cfra=bsystem_time(0,(float)CFRA,0.0);
|
||||
cfra=bsystem_time(0,(float)re->scene->r.cfra,0.0);
|
||||
|
||||
if(part->type==PART_REACTOR){
|
||||
psys_get_reactor_target(ob, psys, &tob, &tpsys);
|
||||
@@ -5512,7 +5512,7 @@ void RE_Database_Baking(Render *re, Scene *scene, int type, Object *actob)
|
||||
/* Sticky texture coords */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
void RE_make_sticky(View3D *v3d)
|
||||
void RE_make_sticky(Scene *scene, View3D *v3d)
|
||||
{
|
||||
Object *ob;
|
||||
Base *base;
|
||||
|
||||
@@ -2140,6 +2140,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac)
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* only when face points away from lamp, in direction of lamp, trace ray and find first exit point */
|
||||
static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float *co)
|
||||
{
|
||||
@@ -2182,4 +2183,5 @@ static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float
|
||||
*distfac= 0.0f;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user