This commit is contained in:
Daniel Genrich 2008-05-14 16:14:40 +00:00
commit b64eeda588
36 changed files with 559 additions and 276 deletions

@ -91,7 +91,6 @@ typedef struct process { /* parameters, function, storage */
float (*function)(float, float, float);
float size, delta; /* cube size, normal delta */
int bounds; /* cube range within lattice */
MB_POINT start; /* start point on surface */
CUBES *cubes; /* active cubes */
VERTICES vertices; /* surface vertices */
CENTERLIST **centers; /* cube center hash table */

@ -1728,31 +1728,38 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser)
{
RenderResult *rr= RE_GetResult(RE_GetRender(G.scene->id.name));
if(rr && iuser) {
if(rr) {
RenderResult rres;
float *rectf;
unsigned int *rect;
int channels= 4, layer= iuser->layer;
float dither;
int channels, layer, pass;
channels= 4;
layer= (iuser)? iuser->layer: 0;
pass= (iuser)? iuser->pass: 0;
/* this gives active layer, composite or seqence result */
RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
rect= (unsigned int *)rres.rect32;
rectf= rres.rectf;
dither= G.scene->r.dither_intensity;
/* get compo/seq result by default */
if(rr->rectf && layer==0);
else if(rr->layers.first) {
RenderLayer *rl= BLI_findlink(&rr->layers, iuser->layer-(rr->rectf?1:0));
RenderLayer *rl= BLI_findlink(&rr->layers, layer-(rr->rectf?1:0));
if(rl) {
/* there's no combined pass, is in renderlayer itself */
if(iuser->pass==0) {
if(pass==0) {
rectf= rl->rectf;
}
else {
RenderPass *rpass= BLI_findlink(&rl->passes, iuser->pass-1);
RenderPass *rpass= BLI_findlink(&rl->passes, pass-1);
if(rpass) {
channels= rpass->channels;
rectf= rpass->rect;
dither= 0.0f; /* don't dither passes */
}
}
}
@ -1779,6 +1786,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser)
ibuf->channels= channels;
ibuf->zbuf_float= rres.rectz;
ibuf->flags |= IB_zbuffloat;
ibuf->dither= dither;
ima->ok= IMA_OK_LOADED;
return ibuf;

@ -375,7 +375,7 @@ Object *find_basis_mball(Object *basis)
#define RTF 7 /* right top far corner */
/* the LBN corner of cube (i, j, k), corresponds with location
* (start.x+(i-0.5)*size, start.y+(j-0.5)*size, start.z+(k-0.5)*size) */
* (i-0.5)*size, (j-0.5)*size, (k-0.5)*size) */
#define HASHBIT (5)
#define HASHSIZE (size_t)(1<<(3*HASHBIT)) /*! < hash table size (32768) */
@ -836,11 +836,11 @@ CORNER *setcorner (PROCESS* p, int i, int j, int k)
c = (CORNER *) new_pgn_element(sizeof(CORNER));
c->i = i;
c->x = p->start.x+((float)i-0.5f)*p->size;
c->x = ((float)i-0.5f)*p->size;
c->j = j;
c->y = p->start.y+((float)j-0.5f)*p->size;
c->y = ((float)j-0.5f)*p->size;
c->k = k;
c->z = p->start.z+((float)k-0.5f)*p->size;
c->z = ((float)k-0.5f)*p->size;
c->value = p->function(c->x, c->y, c->z);
c->next = p->corners[index];
@ -1403,10 +1403,8 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
}
len = sqrt((workp.x-in.x)*(workp.x-in.x) + (workp.y-in.y)*(workp.y-in.y) + (workp.z-in.z)*(workp.z-in.z));
workp_v = tmp_v;
}
mbproc->start.x= mbproc->start.y= mbproc->start.z= 0.0;
}
}
}

@ -1056,6 +1056,7 @@ ParticleSystem *copy_particlesystem(ParticleSystem *psys)
psysn->effectors.first= psysn->effectors.last= 0;
psysn->pathcachebufs.first = psysn->pathcachebufs.last = NULL;
psysn->childcachebufs.first = psysn->childcachebufs.last = NULL;
psysn->reactevents.first = psysn->reactevents.last = NULL;
psysn->renderdata = NULL;

@ -3772,11 +3772,13 @@ static void boid_brain(BoidVecFunc *bvf, ParticleData *pa, Object *ob, ParticleS
near=0;
for(n=1; n<neighbours; n++){
if(ptn[n].dist<2.0f*pa->size){
if(ptn[n].dist!=0.0f) {
bvf->Subf(dvec,pa->state.co,pars[ptn[n].index].state.co);
bvf->Mulf(dvec,(2.0f*pa->size-ptn[n].dist)/ptn[n].dist);
bvf->Addf(avoid,avoid,dvec);
near++;
}
}
/* ptn[] is distance ordered so no need to check others */
else break;
}

@ -130,7 +130,7 @@ static int vertex_sort(const void *p1, const void *p2)
* 'box->index' is not used at all, the only reason its there
* is that the box array is sorted by area and programs need to be able
* to have some way of writing the boxes back to the original data.
* len - the number of boxes in teh array.
* len - the number of boxes in the array.
* tot_width and tot_height are set so you can normalize the data.
* */
void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height)

@ -59,7 +59,7 @@ void drawview3d_render(struct View3D *v3d, int winx, int winy, float winmat[][4]
void draw_depth(struct ScrArea *sa, void *spacedata);
void view3d_update_depths(struct View3D *v3d);
int update_time(void);
int update_time(int cfra);
void calc_viewborder(struct View3D *v3d, struct rctf *viewborder_r);
void view3d_set_1_to_1_viewborder(struct View3D *v3d);

@ -525,6 +525,7 @@ typedef struct SpaceImaSel {
/* SpaceIpo->flag */
#define SIPO_LOCK_VIEW 1<<0
#define SIPO_NOTRANSKEYCULL 1<<1
/* SpaceText flags (moved from DNA_text_types.h) */
@ -616,6 +617,7 @@ typedef struct SpaceImaSel {
#define SNLA_ALLKEYED 1
#define SNLA_ACTIVELAYERS 2
#define SNLA_DRAWTIME 4
#define SNLA_NOTRANSKEYCULL 8
/* time->flag */
/* show timing in frames instead of in seconds */

@ -48,7 +48,7 @@ def New (name, width, height, depth):
@type height: int
@param height: The height of the new Image object, between 1 and 5000.
@type depth: int
@param depth: The colour depth of the new Image object. (32:RGBA 8bit channels, 128:RGBA 32bit high dynamic range float channels).
@param depth: The color depth of the new Image object. (32:RGBA 8bit channels, 128:RGBA 32bit high dynamic range float channels).
@rtype: Blender Image
@return: A new Blender Image object.
"""

@ -80,7 +80,7 @@ Example::
@type ExtendModes: readonly dictionary
@var ExtendModes: Extend, clip, repeat or checker modes for image textures
- EXTEND - Extends the colour of the edge
- EXTEND - Extends the color of the edge
- CLIP - Return alpha 0.0 outside image
- CLIPCUBE - Return alpha 0.0 around cube-shaped area around image
- REPEAT - Repeat image vertically and horizontally
@ -209,10 +209,10 @@ Example::
@type TexCo: readonly dictionary
@var MapTo: Flags for MTex.mapto.
- COL - Make the texture affect the basic colour of the material
- COL - Make the texture affect the basic color of the material
- NOR - Make the texture affect the rendered normal
- CSP - Make the texture affect the specularity colour
- CMIR - Make the texture affect the mirror colour
- CSP - Make the texture affect the specularity color
- CMIR - Make the texture affect the mirror color
- REF - Make the texture affect the diffuse reflectivity value
- SPEC - Make the texture affect the specularity value
- HARD - Make the texture affect the hardness value

@ -384,7 +384,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr)
static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *shi, ShadeResult *shr, Isect *isec, float *vec)
{
/* un-intersected rays get either rendered material colour or sky colour */
/* un-intersected rays get either rendered material color or sky color */
if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOMAT) {
VECCOPY(col, shr->combined);
} else if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOSKY) {
@ -397,7 +397,7 @@ static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *sh
static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, float dist_mir)
{
/* if fading out, linear blend against fade colour */
/* if fading out, linear blend against fade color */
float blendfac;
blendfac = 1.0 - VecLenf(shi->co, is->start)/dist_mir;
@ -544,8 +544,8 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
if (dist_mir > 0.0) {
float blendcol[3];
/* max ray distance set, but found an intersection, so fade this colour
* out towards the sky/material colour for a smooth transition */
/* max ray distance set, but found an intersection, so fade this color
* out towards the sky/material color for a smooth transition */
ray_fadeout_endcolor(blendcol, origshi, &shi, origshr, &isec, vec);
ray_fadeout(&isec, &shi, col, blendcol, dist_mir);
}

@ -5337,7 +5337,7 @@ static void editing_panel_links(Object *ob)
uiDefBut(block, BUT, B_POSEGRP_ADD, "Add Group", xco,110,140,20, 0, 21, 0, 0, 0, "Add a new Bone Group for the Pose");
uiBlockEndAlign(block);
/* colour set for 'active' group */
/* color set for 'active' group */
if (pose->active_group && grp) {
uiBlockBeginAlign(block);
menustr= build_colorsets_menustr();
@ -5354,7 +5354,7 @@ static void editing_panel_links(Object *ob)
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
}
else {
/* init custom colours with a generic multi-colour rgb set, if not initialised already */
/* init custom colors with a generic multi-color rgb set, if not initialised already */
if (grp->cs.solid[0] == 0) {
/* define for setting colors in theme below */
#define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;

@ -3038,9 +3038,14 @@ void do_effects_panels(unsigned short event)
case B_PART_INIT_CHILD:
case B_PART_RECALC_CHILD:
if(psys) {
Base *base;
Object *bob;
ParticleSystem *bpsys;
int flush;
nr=0;
for(psys=ob->particlesystem.first; psys; psys=psys->next){
if(ELEM(psys->part->draw_as,PART_DRAW_OB,PART_DRAW_GR))
for(bpsys=ob->particlesystem.first; bpsys; bpsys=bpsys->next){
if(ELEM(bpsys->part->draw_as,PART_DRAW_OB,PART_DRAW_GR))
nr++;
}
if(nr)
@ -3048,6 +3053,21 @@ void do_effects_panels(unsigned short event)
else
ob->transflag &= ~OB_DUPLIPARTS;
if(psys->part->type==PART_REACTOR)
if(psys->target_ob)
DAG_object_flush_update(G.scene, psys->target_ob, OB_RECALC_DATA);
for(base = G.scene->base.first; base; base= base->next) {
bob= base->object;
flush= 0;
for(bpsys=bob->particlesystem.first; bpsys; bpsys=bpsys->next)
if(bpsys->part==psys->part)
flush= 1;
if(flush)
DAG_object_flush_update(G.scene, bob, OB_RECALC_DATA);
}
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSOBJECT, 0);

@ -2372,6 +2372,22 @@ static IDProperty * ffmpeg_property_add(
return prop;
}
/* not all versions of ffmpeg include that, so here we go ... */
static const AVOption *my_av_find_opt(void *v, const char *name,
const char *unit, int mask, int flags){
AVClass *c= *(AVClass**)v;
const AVOption *o= c->option;
for(;o && o->name; o++){
if(!strcmp(o->name, name) &&
(!unit || (o->unit && !strcmp(o->unit, unit))) &&
(o->flags & mask) == flags )
return o;
}
return NULL;
}
static int ffmpeg_property_add_string(const char * type, const char * str)
{
AVCodecContext c;
@ -2395,7 +2411,7 @@ static int ffmpeg_property_add_string(const char * type, const char * str)
while (*param == ' ') param++;
}
o = av_find_opt(&c, name, NULL, 0, 0);
o = my_av_find_opt(&c, name, NULL, 0, 0);
if (!o) {
return FALSE;
}
@ -2403,7 +2419,7 @@ static int ffmpeg_property_add_string(const char * type, const char * str)
return FALSE;
}
if (param && o->type != FF_OPT_TYPE_CONST && o->unit) {
p = av_find_opt(&c, param, o->unit, 0, 0);
p = my_av_find_opt(&c, param, o->unit, 0, 0);
prop = ffmpeg_property_add(
(char*) type, p - c.av_class->option,
o - c.av_class->option);
@ -2598,7 +2614,7 @@ static int render_panel_ffmpeg_property_option(
avcodec_get_context_defaults(&c);
o = av_find_opt(&c, param ? param : name, NULL, 0, 0);
o = my_av_find_opt(&c, param ? param : name, NULL, 0, 0);
if (!o) {
return yofs;
}

@ -3288,7 +3288,7 @@ static void material_panel_map_to(Object *ob, Material *ma, int from_nodes)
//uiButSetFunc(but, particle_recalc_material, ma, NULL);
but=uiDefButBitS(block, TOG3, MAP_PA_KINK, B_MAT_PARTICLE, "Kink", 70,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the kink of child particles");
//uiButSetFunc(but, particle_recalc_material, ma, NULL);
but=uiDefButBitS(block, TOG3, MAP_PA_LENGTH, B_MAT_PARTICLE, "Length",130,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the length of particles");
but=uiDefButBitS(block, TOG3, MAP_PA_LENGTH, B_MAT_PARTICLE, "Length",130,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the length of child particles");
//uiButSetFunc(but, particle_recalc_material, ma, NULL);
but=uiDefButBitS(block, TOG3, MAP_PA_CLUMP, B_MAT_PARTICLE, "Clump", 190,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the clump of child particles");
//uiButSetFunc(but, particle_recalc_material, ma, NULL);
@ -3298,10 +3298,10 @@ static void material_panel_map_to(Object *ob, Material *ma, int from_nodes)
uiBlockSetCol(block, TH_AUTO);
}
else {
uiDefButBitS(block, TOG, MAP_COL, B_MATPRV, "Col", 10,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect basic colour of the material");
uiDefButBitS(block, TOG, MAP_COL, B_MATPRV, "Col", 10,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect basic color of the material");
uiDefButBitS(block, TOG3, MAP_NORM, B_MATPRV, "Nor", 50,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the rendered normal");
uiDefButBitS(block, TOG, MAP_COLSPEC, B_MATPRV, "Csp", 90,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the specularity colour");
uiDefButBitS(block, TOG, MAP_COLMIR, B_MATPRV, "Cmir", 130,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the mirror colour");
uiDefButBitS(block, TOG, MAP_COLSPEC, B_MATPRV, "Csp", 90,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the specularity color");
uiDefButBitS(block, TOG, MAP_COLMIR, B_MATPRV, "Cmir", 130,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the mirror color");
uiDefButBitS(block, TOG3, MAP_REF, B_MATPRV, "Ref", 180,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of the materials reflectivity");
uiDefButBitS(block, TOG3, MAP_SPEC, B_MATPRV, "Spec", 220,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of specularity");
uiDefButBitS(block, TOG3, MAP_AMB, B_MATPRV, "Amb", 270,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of ambient");

@ -634,7 +634,7 @@ static void draw_channel_names(void)
}
else {
/* for normal channels
* - use 3 shades of color group/standard colour for 3 indention level
* - use 3 shades of color group/standard color for 3 indention level
* - only use group colors if allowed to, and if actually feasible
*/
if ( !(G.saction->flag & SACTION_NODRAWGCOLORS) &&
@ -1254,7 +1254,7 @@ static void draw_key_but(int x, int y, short w, short h, int sel)
int xmax= x+w-1, ymax= y+h-1;
int xc= (xmin+xmax)/2, yc= (ymin+ymax)/2;
/* interior - hardcoded colours (for selected and unselected only) */
/* interior - hardcoded colors (for selected and unselected only) */
if (sel) glColor3ub(0xF1, 0xCA, 0x13);
else glColor3ub(0xE9, 0xE9, 0xE9);

@ -96,7 +96,7 @@ static ThemeWireColor *bcolor= NULL;
/* values of colCode for set_pchan_glcolor */
enum {
PCHAN_COLOR_NORMAL = 0, /* normal drawing */
PCHAN_COLOR_SOLID, /* specific case where "solid" colour is needed */
PCHAN_COLOR_SOLID, /* specific case where "solid" color is needed */
PCHAN_COLOR_CONSTS, /* "constraint" colors (which may/may-not be suppressed) */
PCHAN_COLOR_SPHEREBONE_BASE, /* for the 'stick' of sphere (envelope) bones */
@ -1186,7 +1186,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign
/* wire */
if (armflag & ARM_POSEMODE) {
if (constflag) {
/* set constraint colours */
/* set constraint colors */
if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) {
glEnable(GL_BLEND);
@ -1645,7 +1645,7 @@ static void draw_pose_channels(Base *base, int dt)
glPushMatrix();
glMultMatrixf(pchan->pose_mat);
/* prepare colours */
/* prepare colors */
if (arm->flag & ARM_POSEMODE)
set_pchan_colorset(ob, pchan);
else {
@ -2090,7 +2090,7 @@ static void draw_pose_paths(Object *ob)
for (a=0, fp=fp_start; a<len; a++, fp+=3) {
float intensity; /* how faint */
/* set colour
/* set color
* - more intense for active/selected bones, less intense for unselected bones
* - black for before current frame, green for current frame, blue for after current frame
* - intensity decreases as distance from current frame increases
@ -2131,7 +2131,7 @@ static void draw_pose_paths(Object *ob)
BIF_ThemeColorBlendShade(TH_CFRAME, TH_BACK, intensity, 10);
}
/* draw a vertex with this colour */
/* draw a vertex with this color */
glVertex3fv(fp);
}

@ -367,7 +367,10 @@ static void drawcursor_sima(float xuser_asp, float yuser_asp)
int wi, hi;
float w, h;
if (!G.obedit || !CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE)) return;
if ( !G.obedit || /* only draw cursor in editmode */
!CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE) || /* must have UV's */
(G.sima->image && G.sima->flag & SI_DRAWTOOL) /* cant be painting */
) return;
transform_width_height_tface_uv(&wi, &hi);
w = (((float)wi)/256.0f)*G.sima->zoom * xuser_asp;
@ -1486,6 +1489,10 @@ static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PAINT
ID *id;
int yco, xco, butw;
if ((G.sima->image && (G.sima->flag & SI_DRAWTOOL))==0) {
return;
}
block= uiNewBlock(&curarea->uiblocks, "image_panel_paint", UI_EMBOSS, UI_HELV, curarea->win);
uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
uiSetPanelHandler(IMAGE_HANDLER_PAINT); // for close and esc

@ -3398,12 +3398,12 @@ static float redrawtimes_fps[REDRAW_FRAME_AVERAGE];
static short redrawtime_index;
int update_time(void)
int update_time(int cfra)
{
static double ltime;
double time;
if ((audiostream_pos() != CFRA)
if ((audiostream_pos() != cfra)
&& (G.scene->audio.flag & AUDIO_SYNC)) {
return 0;
}
@ -3641,7 +3641,7 @@ void inner_play_anim_loop(int init, int mode)
/* make sure that swaptime passed by */
tottime -= swaptime;
while (update_time()) {
while (update_time(CFRA)) {
PIL_sleep_ms(1);
}
@ -3700,7 +3700,7 @@ int play_anim(int mode)
inner_play_prefetch_startup(mode);
update_time();
update_time(CFRA);
inner_play_anim_loop(1, mode); /* 1==init */

@ -1161,7 +1161,7 @@ void verify_pchan2achan_grouping (bAction *act, bPose *pose, char name[])
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
}
else {
/* init custom colours with a generic multi-colour rgb set, if not initialised already */
/* init custom colors with a generic multi-color rgb set, if not initialised already */
if (agrp->cs.solid[0] == 0) {
/* define for setting colors in theme below */
#define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;
@ -1221,7 +1221,7 @@ void sync_pchan2achan_grouping ()
achan->grp = NULL;
BLI_freelistN(&act->groups);
/* loop through all achans, reassigning them to groups (colours are resyncronised) */
/* loop through all achans, reassigning them to groups (colors are resyncronised) */
last= act->chanbase.last;
for (achan= act->chanbase.first; achan && achan!=last; achan= next) {
next= achan->next;

@ -116,6 +116,7 @@
#include "BSE_headerbuttons.h"
#include "BSE_node.h"
#include "BSE_sequence.h"
#include "BSE_seqaudio.h"
#include "BSE_time.h"
#include "blendef.h"
@ -5671,6 +5672,7 @@ void ipo_record(void)
}
sa= sa->next;
}
if(sa) areawinset(sa->win);
/* can we? */
@ -5689,6 +5691,10 @@ void ipo_record(void)
cfra=efra= SFRA;
sfra= EFRA;
if (G.scene->audio.flag & AUDIO_SYNC) {
audiostream_start(cfra);
}
while(afbreek==0) {
getmouseco_areawin(mval);
@ -5729,7 +5735,7 @@ void ipo_record(void)
/* minimal wait swaptime */
tottime -= swaptime;
while (update_time()) PIL_sleep_ms(1);
while (update_time(cfra)) PIL_sleep_ms(1);
screen_swapbuffers();
@ -5739,8 +5745,18 @@ void ipo_record(void)
mvalo[1]= mval[1];
if(anim || (G.qual & LR_CTRLKEY)) {
if (G.scene->audio.flag & AUDIO_SYNC) {
cfra = audiostream_pos();
} else {
cfra++;
if(cfra>EFRA) cfra= SFRA;
}
if(cfra>EFRA) {
cfra= SFRA;
if (G.scene->audio.flag & AUDIO_SYNC) {
audiostream_stop();
audiostream_start( cfra );
}
}
}
}
@ -5793,6 +5809,9 @@ void ipo_record(void)
editipo_changed(G.sipo, 0);
do_ipo(G.sipo->ipo);
waitcursor(0);
if (G.scene->audio.flag & AUDIO_SYNC) {
audiostream_stop();
}
allqueue(REDRAWVIEW3D, 0);
if(sa) scrarea_queue_headredraw(sa); /* headerprint */

@ -1458,7 +1458,7 @@ void mesh_copy_menu(void)
eed_act = (EditEdge*)ese->data;
ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Length%x2");
ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Bevel Weight%x2|Length%x3");
if (ret<1) return;
eed_len_act = VecLenf(eed_act->v1->co, eed_act->v2->co);
@ -1472,8 +1472,16 @@ void mesh_copy_menu(void)
}
}
break;
case 2: /* copy bevel weight */
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act && eed->bweight != eed_act->bweight) {
eed->bweight = eed_act->bweight;
change = 1;
}
}
break;
case 2: /* copy length */
case 3: /* copy length */
for(eed=em->edges.first; eed; eed=eed->next) {
if (eed->f & SELECT && eed != eed_act) {
@ -3187,6 +3195,7 @@ void select_non_manifold(void)
}
/* select isolated verts */
if(G.scene->selectmode & SCE_SELECT_VERTEX) {
eve= em->verts.first;
while(eve) {
if (eve->f1 == 0) {
@ -3194,6 +3203,7 @@ void select_non_manifold(void)
}
eve= eve->next;
}
}
countall();
addqueue(curarea->win, REDRAW, 0);

@ -6758,7 +6758,7 @@ void mesh_mirror_uvs(void)
{
EditMesh *em = G.editMesh;
EditFace *efa;
short change = 0;
short change = 0, altaxis;
MTFace *tf;
float u1, v1;
@ -6767,33 +6767,65 @@ void mesh_mirror_uvs(void)
return;
}
altaxis = (G.qual == LR_SHIFTKEY);
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
u1= tf->uv[0][0];
v1= tf->uv[0][1];
if(efa->v4) {
tf->uv[0][0]= tf->uv[3][0];
tf->uv[0][1]= tf->uv[3][1];
tf->uv[3][0]= u1;
tf->uv[3][1]= v1;
if (altaxis) {
u1= tf->uv[1][0];
v1= tf->uv[1][1];
if(efa->v4) {
tf->uv[1][0]= tf->uv[2][0];
tf->uv[1][1]= tf->uv[2][1];
tf->uv[2][0]= u1;
tf->uv[2][1]= v1;
u1= tf->uv[3][0];
v1= tf->uv[3][1];
tf->uv[3][0]= tf->uv[0][0];
tf->uv[3][1]= tf->uv[0][1];
tf->uv[0][0]= u1;
tf->uv[0][1]= v1;
}
else {
tf->uv[0][0]= tf->uv[2][0];
tf->uv[0][1]= tf->uv[2][1];
tf->uv[1][0]= tf->uv[2][0];
tf->uv[1][1]= tf->uv[2][1];
tf->uv[2][0]= u1;
tf->uv[2][1]= v1;
}
} else {
u1= tf->uv[0][0];
v1= tf->uv[0][1];
if(efa->v4) {
tf->uv[0][0]= tf->uv[1][0];
tf->uv[0][1]= tf->uv[1][1];
tf->uv[1][0]= u1;
tf->uv[1][1]= v1;
u1= tf->uv[3][0];
v1= tf->uv[3][1];
tf->uv[3][0]= tf->uv[2][0];
tf->uv[3][1]= tf->uv[2][1];
tf->uv[2][0]= u1;
tf->uv[2][1]= v1;
}
else {
tf->uv[0][0]= tf->uv[1][0];
tf->uv[0][1]= tf->uv[1][1];
tf->uv[1][0]= u1;
tf->uv[1][1]= v1;
}
}
change = 1;
}
}
@ -6858,27 +6890,38 @@ void mesh_mirror_colors(void)
{
EditMesh *em = G.editMesh;
EditFace *efa;
short change = 0;
short change = 0, altaxis;
MCol tmpcol, *mcol;
if (!EM_vertColorCheck()) {
error("mesh has no color layers");
return;
}
altaxis = (G.qual == LR_SHIFTKEY);
for(efa=em->faces.first; efa; efa=efa->next) {
if (efa->f & SELECT) {
mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
tmpcol= mcol[0];
mcol[0]= mcol[1];
if (altaxis) {
tmpcol= mcol[1];
mcol[1]= mcol[2];
mcol[2]= tmpcol;
if(efa->v4) {
tmpcol= mcol[0];
mcol[0]= mcol[3];
mcol[3]= tmpcol;
}
} else {
tmpcol= mcol[0];
mcol[0]= mcol[1];
mcol[1]= tmpcol;
if(efa->v4) {
tmpcol= mcol[2];
mcol[2]= mcol[3];
mcol[3]= tmpcol;
}
else {
mcol[2]= tmpcol;
}
change = 1;
}

@ -2764,7 +2764,7 @@ void fly(void)
do_screenhandlers(G.curscreen); /* advance the next frame */
/* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to teh view */
/* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */
if (G.vd->persp==V3D_CAMOB) {
G.vd->persp= V3D_PERSP; /*set this so setviewmatrixview3d uses the ofs and quat instead of the camera */
setviewmatrixview3d();

@ -476,7 +476,9 @@ static uiBlock *image_viewmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "View Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Image Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Real-time Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, "");
if (G.sima->image && (G.sima->flag & SI_DRAWTOOL)) {
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Paint Tool...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, "");
}
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Curves Tool...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Composite Preview...|Shift P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 12, "");

@ -751,6 +751,9 @@ static void do_ipo_viewmenu(void *arg, int event)
case 14: /* Clear Preview Range */
anim_previewrange_clear();
break;
case 15: /* AutoMerge Keyframes */
G.sipo->flag ^= SIPO_NOTRANSKEYCULL;
break;
}
}
@ -772,6 +775,9 @@ static uiBlock *ipo_viewmenu(void *arg_unused)
else
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Keys|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
uiDefIconTextBut(block, BUTM, 1, (G.sipo->flag & SIPO_NOTRANSKEYCULL)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
"AutoMerge Keyframes|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Out|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, "");

@ -128,6 +128,9 @@ static void do_nla_viewmenu(void *arg, int event)
case 9: /* Clear Preview Range */
anim_previewrange_clear();
break;
case 10: /* AutoMerge Keyframes */
G.snla->flag ^= SNLA_NOTRANSKEYCULL;
break;
}
}
@ -149,6 +152,9 @@ static uiBlock *nla_viewmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
}
uiDefIconTextBut(block, BUTM, 1, (G.snla->flag & SNLA_NOTRANSKEYCULL)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
"AutoMerge Keyframes|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
if(BTST(G.snla->lock, 0)) {

@ -1835,7 +1835,7 @@ static uiBlock *view3d_transformmenu(void *arg_unused)
if (!G.obedit) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center New", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center Cursor", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align to Transform Orientation", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align to Transform Orientation|Ctrl Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
}
if (BIF_snappingSupported())
@ -5639,6 +5639,10 @@ void view3d_buttons(void)
xco+= XIC;
}
if (G.vd->twmode > (BIF_countTransformOrientation() - 1) + V3D_MANIP_CUSTOM) {
G.vd->twmode = 0;
}
str_menu = BIF_menustringTransformOrientation("Orientation");
uiDefButS(block, MENU, B_MAN_MODE, str_menu,xco,0,70,YIC, &G.vd->twmode, 0, 0, 0, 0, "Transform Orientation (ALT+Space)");
MEM_freeN(str_menu);
@ -5723,11 +5727,11 @@ void view3d_buttons(void)
}
else if(G.f & G_PARTICLEEDIT) {
uiBlockBeginAlign(block);
uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Path edit mode (Ctrl Tab 1)");
uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Path edit mode");
xco+= XIC;
uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Point select mode (Ctrl Tab 2)");
uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Point select mode");
xco+= XIC;
uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Tip select mode (Ctrl Tab 3)");
uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Tip select mode");
xco+= XIC;
uiBlockEndAlign(block);
if(G.vd->drawtype > OB_WIRE) {

@ -938,8 +938,8 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw,
{
ui_rasterpos_safe(x, y, aspect);
if(w<1 || h<1) {
printf("what the heck!\n");
if((w<1 || h<1) && G.f & G_DEBUG) {
printf("what the heck! - icons are %i x %i pixels?\n", w, h);
}
/* rect contains image in 'rendersize', we only scale if needed */
else if(rw!=w && rh!=h) {

@ -311,6 +311,8 @@ static void renderwin_draw_render_info(RenderWin *rw)
static void renderwin_draw(RenderWin *rw, int just_clear)
{
Image *ima;
ImBuf *ibuf;
float fullrect[2][2];
int set_back_mainwindow;
rcti rect;
@ -340,50 +342,45 @@ static void renderwin_draw(RenderWin *rw, int just_clear)
glColor3ub(0, 0, 0);
glRectfv(fullrect[0], fullrect[1]);
} else {
RenderResult rres;
RenderSpare *rspare= render_spare;
if(rspare && rspare->showspare) {
if(rspare->ibuf) {
rres.rectx= rspare->ibuf->x;
rres.recty= rspare->ibuf->y;
rres.rect32= (int *)rspare->ibuf->rect;
rres.rectf= rspare->ibuf->rect_float;
rres.rectz= rspare->ibuf->zbuf_float;
ibuf= rspare->ibuf;
}
else
memset(&rres, 0, sizeof(rres));
else {
ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
ibuf= BKE_image_get_ibuf(ima, NULL);
}
else
RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
if(rres.rectf || rres.rect32) {
if(ibuf) {
if(!ibuf->rect)
IMB_rect_from_float(ibuf);
glPixelZoom(rw->zoom, rw->zoom);
if(rw->flags & RW_FLAGS_ALPHA) {
if(rres.rect32) {
if(ibuf->rect) {
/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
if(G.order==B_ENDIAN)
glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_LUMINANCE, GL_UNSIGNED_INT, rres.rect32);
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ibuf->rect);
glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
}
else {
float *trectf= MEM_mallocN(rres.rectx*rres.recty*4, "temp");
float *trectf= MEM_mallocN(ibuf->x*ibuf->y*4, "temp");
int a, b;
for(a= rres.rectx*rres.recty -1, b= 4*a+3; a>=0; a--, b-=4)
trectf[a]= rres.rectf[b];
for(a= ibuf->x*ibuf->y -1, b= 4*a+3; a>=0; a--, b-=4)
trectf[a]= ibuf->rect_float[b];
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_LUMINANCE, GL_FLOAT, trectf);
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_FLOAT, trectf);
MEM_freeN(trectf);
}
}
else {
if(rres.rect32)
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_UNSIGNED_BYTE, rres.rect32);
else if(rres.rectf)
glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, rres.rectf);
if(ibuf->rect)
glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
else if(ibuf->rect_float)
glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, ibuf->rect_float);
}
glPixelZoom(1.0, 1.0);
}
@ -431,22 +428,20 @@ static void renderwin_zoom(RenderWin *rw, int ZoomIn) {
static void renderwin_mouse_moved(RenderWin *rw)
{
RenderResult rres;
Image *ima;
ImBuf *ibuf;
RenderSpare *rspare= render_spare;
if(rspare && rspare->showspare) {
if(rspare->ibuf) {
rres.rectx= rspare->ibuf->x;
rres.recty= rspare->ibuf->y;
rres.rect32= (int *)rspare->ibuf->rect;
rres.rectf= rspare->ibuf->rect_float;
rres.rectz= rspare->ibuf->zbuf_float;
ibuf= rspare->ibuf;
}
else
memset(&rres, 0, sizeof(rres));
else {
ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
ibuf= BKE_image_get_ibuf(ima, NULL);
}
else
RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
if(!ibuf)
return;
if (rw->flags & RW_FLAGS_PIXEL_EXAMINING) {
int imgco[2], ofs=0;
@ -455,19 +450,19 @@ static void renderwin_mouse_moved(RenderWin *rw)
if (renderwin_win_to_image_co(rw, rw->lmouse, imgco)) {
ofs= sprintf(buf, "X: %d Y: %d ", imgco[0], imgco[1]);
if (rres.rect32) {
pxl= (char*) &rres.rect32[rres.rectx*imgco[1] + imgco[0]];
if (ibuf->rect) {
pxl= (char*) &ibuf->rect[ibuf->x*imgco[1] + imgco[0]];
ofs+= sprintf(buf+ofs, " | R: %d G: %d B: %d A: %d", pxl[0], pxl[1], pxl[2], pxl[3]);
}
if (rres.rectf) {
float *pxlf= rres.rectf + 4*(rres.rectx*imgco[1] + imgco[0]);
if(!rres.rect32){
if (ibuf->rect_float) {
float *pxlf= ibuf->rect_float + 4*(ibuf->x*imgco[1] + imgco[0]);
if(!ibuf->rect) {
ofs+= sprintf(buf+ofs, " | R: %d G: %d B: %d A: %d", FTOCHAR(pxlf[0]), FTOCHAR(pxlf[1]), FTOCHAR(pxlf[2]), FTOCHAR(pxlf[3]));
}
ofs+= sprintf(buf+ofs, " | R: %.3f G: %.3f B: %.3f A: %.3f ", pxlf[0], pxlf[1], pxlf[2], pxlf[3]);
}
if (rres.rectz) {
float *pxlz= &rres.rectz[rres.rectx*imgco[1] + imgco[0]];
if (ibuf->zbuf_float) {
float *pxlz= &ibuf->zbuf_float[ibuf->x*imgco[1] + imgco[0]];
sprintf(buf+ofs, "| Z: %.3f", *pxlz );
}
@ -484,8 +479,8 @@ static void renderwin_mouse_moved(RenderWin *rw)
rw->zoomofs[0]= rw->pan_ofs_start[0] - delta_x/rw->zoom;
rw->zoomofs[1]= rw->pan_ofs_start[1] - delta_y/rw->zoom;
rw->zoomofs[0]= CLAMPIS(rw->zoomofs[0], -rres.rectx/2, rres.rectx/2);
rw->zoomofs[1]= CLAMPIS(rw->zoomofs[1], -rres.recty/2, rres.recty/2);
rw->zoomofs[0]= CLAMPIS(rw->zoomofs[0], -ibuf->x/2, ibuf->x/2);
rw->zoomofs[1]= CLAMPIS(rw->zoomofs[1], -ibuf->y/2, ibuf->y/2);
renderwin_queue_redraw(rw);
}
@ -497,8 +492,8 @@ static void renderwin_mouse_moved(RenderWin *rw)
h-= RW_HEADERY;
renderwin_win_to_ndc(rw, rw->lmouse, ndc);
rw->zoomofs[0]= -0.5*ndc[0]*(w-rres.rectx*rw->zoom)/rw->zoom;
rw->zoomofs[1]= -0.5*ndc[1]*(h-rres.recty*rw->zoom)/rw->zoom;
rw->zoomofs[0]= -0.5*ndc[0]*(w-ibuf->x*rw->zoom)/rw->zoom;
rw->zoomofs[1]= -0.5*ndc[1]*(h-ibuf->y*rw->zoom)/rw->zoom;
renderwin_queue_redraw(rw);
}
@ -1186,6 +1181,7 @@ static int render_store_spare(void)
RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
rspare->ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0, 0);
rspare->ibuf->dither= G.scene->r.dither_intensity;
if(rres.rect32) {
rspare->ibuf->rect= MEM_dupallocN(rres.rect32);
@ -1291,6 +1287,8 @@ void BIF_do_render(int anim)
allqueue(REDRAWNODE, 1);
allqueue(REDRAWIMAGE, 1);
}
if(G.scene->r.dither_intensity != 0.0f)
BIF_redraw_render_rect();
if (slink_flag) G.f |= G_DOSCRIPTLINKS;
if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER);
}

@ -243,6 +243,41 @@ float InputVerticalAbsolute(TransInfo *t, short mval[2]) {
return Inpf(t->viewinv[1], vec) * 2.0f;
}
float InputDeltaAngle(TransInfo *t, short mval[2])
{
double dx2 = t->center2d[0] - mval[0];
double dy2 = t->center2d[1] - mval[1];
double B = sqrt(dx2*dx2+dy2*dy2);
double dx1 = t->center2d[0] - t->imval[0];
double dy1 = t->center2d[1] - t->imval[1];
double A = sqrt(dx1*dx1+dy1*dy1);
double dx3 = mval[0] - t->imval[0];
double dy3 = mval[1] - t->imval[1];
/* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */
double deler = ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3))
/ (2.0 * (A*B?A*B:1.0));
/* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */
float dphi;
dphi = saacos((float)deler);
if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
if(t->flag & T_SHIFT_MOD) dphi = dphi/30.0f;
/* if no delta angle, don't update initial position */
if (dphi != 0)
{
t->imval[0] = mval[0];
t->imval[1] = mval[1];
}
return dphi;
}
/* ************************** SPACE DEPENDANT CODE **************************** */
void setTransformViewMatrices(TransInfo *t)
@ -2584,23 +2619,6 @@ int Rotation(TransInfo *t, short mval[2])
float final;
double dx2 = t->center2d[0] - mval[0];
double dy2 = t->center2d[1] - mval[1];
double B = sqrt(dx2*dx2+dy2*dy2);
double dx1 = t->center2d[0] - t->imval[0];
double dy1 = t->center2d[1] - t->imval[1];
double A = sqrt(dx1*dx1+dy1*dy1);
double dx3 = mval[0] - t->imval[0];
double dy3 = mval[1] - t->imval[1];
/* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */
double deler= ((double)((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3) ))
/ (2.0 * (A*B?A*B:1.0));
/* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */
float dphi;
float axis[3];
float mat[3][3];
@ -2608,19 +2626,7 @@ int Rotation(TransInfo *t, short mval[2])
VecMulf(axis, -1.0f);
Normalize(axis);
dphi = saacos((float)deler);
if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
if(t->flag & T_SHIFT_MOD) t->fac += dphi/30.0f;
else t->fac += dphi;
/*
clamping angle between -2 PI and 2 PI (not sure if useful so commented out - theeth)
if (t->fac >= 2 * M_PI)
t->fac -= 2 * M_PI;
else if (t->fac <= -2 * M_PI)
t->fac -= -2 * M_PI;
*/
t->fac += InputDeltaAngle(t, mval);
final = t->fac;
@ -2628,9 +2634,6 @@ int Rotation(TransInfo *t, short mval[2])
snapGrid(t, &final);
t->imval[0] = mval[0];
t->imval[1] = mval[1];
if (t->con.applyRot) {
t->con.applyRot(t, NULL, axis);
}
@ -3097,27 +3100,7 @@ int Tilt(TransInfo *t, short mval[2])
float final;
double dx2 = t->center2d[0] - mval[0];
double dy2 = t->center2d[1] - mval[1];
double B = (float)sqrt(dx2*dx2+dy2*dy2);
double dx1 = t->center2d[0] - t->imval[0];
double dy1 = t->center2d[1] - t->imval[1];
double A = (float)sqrt(dx1*dx1+dy1*dy1);
double dx3 = mval[0] - t->imval[0];
double dy3 = mval[1] - t->imval[1];
double deler= ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3))
/ (2 * A * B);
float dphi;
dphi = saacos((float)deler);
if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
if(G.qual & LR_SHIFTKEY) t->fac += dphi/30.0f;
else t->fac += dphi;
t->fac += InputDeltaAngle(t, mval);
final = t->fac;
@ -3125,9 +3108,6 @@ int Tilt(TransInfo *t, short mval[2])
snapGrid(t, &final);
t->imval[0] = mval[0];
t->imval[1] = mval[1];
if (hasNumInput(&t->num)) {
char c[20];
@ -3899,36 +3879,12 @@ int BoneRoll(TransInfo *t, short mval[2])
float final;
double dx2 = t->center2d[0] - mval[0];
double dy2 = t->center2d[1] - mval[1];
double B = sqrt(dx2*dx2+dy2*dy2);
double dx1 = t->center2d[0] - t->imval[0];
double dy1 = t->center2d[1] - t->imval[1];
double A = sqrt(dx1*dx1+dy1*dy1);
double dx3 = mval[0] - t->imval[0];
double dy3 = mval[1] - t->imval[1];
/* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */
double deler= ((double)((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3) ))
/ (2.0 * (A*B?A*B:1.0));
/* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */
float dphi;
dphi = saacos((float)deler);
if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
if(G.qual & LR_SHIFTKEY) t->fac += dphi/30.0f;
else t->fac += dphi;
t->fac += InputDeltaAngle(t, mval);
final = t->fac;
snapGrid(t, &final);
t->imval[0] = mval[0];
t->imval[1] = mval[1];
if (hasNumInput(&t->num)) {
char c[20];

@ -412,7 +412,8 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3])
VECCOPY(vec, t->con.mtx[2]);
break;
}
if (!(mode & CON_NOFLIP)) {
/* don't flip axis if asked to or if num input */
if (!(mode & CON_NOFLIP) && hasNumInput(&t->num) == 0) {
if (Inpf(vec, t->viewinv[2]) > 0.0f) {
VecMulf(vec, -1.0f);
}

@ -144,6 +144,8 @@ extern ListBase editelems;
/* local function prototype - for Object/Bone Constraints */
static short constraints_list_needinv(TransInfo *t, ListBase *list);
/* local function prototype - for finding number of keyframes that are selected for editing */
static int count_ipo_keys(Ipo *ipo, char side, float cfra);
/* ************************** Functions *************************** */
@ -2215,9 +2217,9 @@ static void UVsToTransData(TransData *td, TransData2D *td2d, float *uv, int sele
td->flag |= TD_SELECTED;
td->dist= 0.0;
}
else
else {
td->dist= MAXFLOAT;
}
Mat3One(td->mtx);
Mat3One(td->smtx);
}
@ -2229,6 +2231,7 @@ static void createTransUVs(TransInfo *t)
MTFace *tf;
int count=0, countsel=0;
int propmode = t->flag & T_PROP_EDIT;
int efa_s1,efa_s2,efa_s3,efa_s4;
EditMesh *em = G.editMesh;
EditFace *efa;
@ -2236,15 +2239,46 @@ static void createTransUVs(TransInfo *t)
if(is_uv_tface_editing_allowed()==0) return;
/* count */
if (G.sima->flag & SI_BE_SQUARE && !propmode) {
for (efa= em->faces.first; efa; efa= efa->next) {
/* store face pointer for second loop, prevent second lookup */
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (simaFaceDraw_Check(efa, tf)) {
efa->tmp.p = tf;
efa_s1 = simaUVSel_Check(efa, tf, 0);
efa_s2 = simaUVSel_Check(efa, tf, 1);
efa_s3 = simaUVSel_Check(efa, tf, 2);
if (efa->v4) {
efa_s4 = simaUVSel_Check(efa, tf, 3);
if ( efa_s1 || efa_s2 || efa_s3 || efa_s4 ) {
countsel += 4; /* all corners of this quad need their edges moved. so we must store TD for each */
}
} else {
/* tri's are delt with normally when SI_BE_SQUARE's enabled */
if (efa_s1) countsel++;
if (efa_s2) countsel++;
if (efa_s3) countsel++;
}
} else {
efa->tmp.p = NULL;
}
}
} else {
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (simaFaceDraw_Check(efa, tf)) {
efa->tmp.p = tf;
if (simaUVSel_Check(efa, tf, 0)) countsel++;
if (simaUVSel_Check(efa, tf, 1)) countsel++;
if (simaUVSel_Check(efa, tf, 2)) countsel++;
if (efa->v4 && simaUVSel_Check(efa, tf, 3)) countsel++;
if(propmode)
count += (efa->v4)? 4: 3;
} else {
efa->tmp.p = NULL;
}
}
}
@ -2262,18 +2296,63 @@ static void createTransUVs(TransInfo *t)
td= t->data;
td2d= t->data2d;
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (simaFaceDraw_Check(efa, tf)) {
if(propmode || simaUVSel_Check(efa, tf, 0))
UVsToTransData(td++, td2d++, tf->uv[0], simaUVSel_Check(efa, tf, 0));
if(propmode || simaUVSel_Check(efa, tf, 1))
UVsToTransData(td++, td2d++, tf->uv[1], simaUVSel_Check(efa, tf, 1));
if(propmode || simaUVSel_Check(efa, tf, 2))
UVsToTransData(td++, td2d++, tf->uv[2], simaUVSel_Check(efa, tf, 2));
if(efa->v4 && (propmode || simaUVSel_Check(efa, tf, 3)))
if (G.sima->flag & SI_BE_SQUARE && !propmode) {
for (efa= em->faces.first; efa; efa= efa->next) {
tf=(MTFace *)efa->tmp.p;
if (tf) {
efa_s1 = simaUVSel_Check(efa, tf, 0);
efa_s2 = simaUVSel_Check(efa, tf, 1);
efa_s3 = simaUVSel_Check(efa, tf, 2);
if (efa->v4) {
efa_s4 = simaUVSel_Check(efa, tf, 3);
if ( efa_s1 || efa_s2 || efa_s3 || efa_s4 ) {
/* all corners of this quad need their edges moved. so we must store TD for each */
UVsToTransData(td, td2d, tf->uv[0], efa_s1);
if (!efa_s1) td->flag |= TD_SKIP;
td++; td2d++;
UVsToTransData(td, td2d, tf->uv[1], efa_s2);
if (!efa_s2) td->flag |= TD_SKIP;
td++; td2d++;
UVsToTransData(td, td2d, tf->uv[2], efa_s3);
if (!efa_s3) td->flag |= TD_SKIP;
td++; td2d++;
UVsToTransData(td, td2d, tf->uv[3], efa_s4);
if (!efa_s4) td->flag |= TD_SKIP;
td++; td2d++;
}
} else {
/* tri's are delt with normally when SI_BE_SQUARE's enabled */
if (efa_s1) UVsToTransData(td++, td2d++, tf->uv[0], 1);
if (efa_s2) UVsToTransData(td++, td2d++, tf->uv[1], 1);
if (efa_s3) UVsToTransData(td++, td2d++, tf->uv[2], 1);
}
}
}
} else {
for (efa= em->faces.first; efa; efa= efa->next) {
/*tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (simaFaceDraw_Check(efa, tf)) {*/
if ((tf=(MTFace *)efa->tmp.p)) {
if (propmode) {
UVsToTransData(td++, td2d++, tf->uv[0], simaUVSel_Check(efa, tf, 0));
UVsToTransData(td++, td2d++, tf->uv[1], simaUVSel_Check(efa, tf, 1));
UVsToTransData(td++, td2d++, tf->uv[2], simaUVSel_Check(efa, tf, 2));
if(efa->v4)
UVsToTransData(td++, td2d++, tf->uv[3], simaUVSel_Check(efa, tf, 3));
} else {
if(simaUVSel_Check(efa, tf, 0)) UVsToTransData(td++, td2d++, tf->uv[0], 1);
if(simaUVSel_Check(efa, tf, 1)) UVsToTransData(td++, td2d++, tf->uv[1], 1);
if(simaUVSel_Check(efa, tf, 2)) UVsToTransData(td++, td2d++, tf->uv[2], 1);
if(efa->v4 && simaUVSel_Check(efa, tf, 3)) UVsToTransData(td++, td2d++, tf->uv[3], 1);
}
}
}
}
@ -2305,8 +2384,7 @@ void flushTransUVs(TransInfo *t)
}
}
/* always call this, also for cancel (it transforms non-selected vertices...) */
if((G.sima->flag & SI_BE_SQUARE))
if((G.sima->flag & SI_BE_SQUARE) && (t->flag & T_PROP_EDIT)==0 && (t->state != TRANS_CANCEL))
be_square_tface_uv(em);
/* this is overkill if G.sima->lock is not set, but still needed */
@ -2490,6 +2568,93 @@ static void posttrans_action_clean (bAction *act)
BLI_freelistN(&act_data);
}
/* Called by special_aftertrans_update to make sure selected keyframes replace
* any other keyframes which may reside on that frame (that is not selected).
* remake_all_ipos should have already been called
*/
static void posttrans_nla_clean (TransInfo *t)
{
Base *base;
Object *ob;
bActionStrip *strip;
bActionChannel *achan;
bConstraintChannel *conchan;
float cfra;
char side;
int i;
/* which side of the current frame should be allowed */
if (t->mode == TFM_TIME_EXTEND) {
/* only side on which mouse is gets transformed */
float xmouse, ymouse;
areamouseco_to_ipoco(G.v2d, t->imval, &xmouse, &ymouse);
side = (xmouse > CFRA) ? 'R' : 'L';
}
else {
/* normal transform - both sides of current frame are considered */
side = 'B';
}
/* only affect keyframes */
for (base=G.scene->base.first; base; base=base->next) {
ob= base->object;
/* Check object ipos */
i= count_ipo_keys(ob->ipo, side, CFRA);
if (i) posttrans_ipo_clean(ob->ipo);
/* Check object constraint ipos */
for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next) {
i= count_ipo_keys(conchan->ipo, side, CFRA);
if (i) posttrans_ipo_clean(ob->ipo);
}
/* skip actions and nlastrips if object is collapsed */
if (ob->nlaflag & OB_NLA_COLLAPSED)
continue;
/* Check action ipos */
if (ob->action) {
/* exclude if strip is selected too */
for (strip=ob->nlastrips.first; strip; strip=strip->next) {
if (strip->flag & ACTSTRIP_SELECT) {
if (strip->act == ob->action)
break;
}
}
if (strip==NULL) {
cfra = get_action_frame(ob, CFRA);
for (achan=ob->action->chanbase.first; achan; achan=achan->next) {
if (EDITABLE_ACHAN(achan)) {
i= count_ipo_keys(achan->ipo, side, cfra);
if (i) {
actstrip_map_ipo_keys(ob, achan->ipo, 0, 1);
posttrans_ipo_clean(achan->ipo);
actstrip_map_ipo_keys(ob, achan->ipo, 1, 1);
}
/* Check action constraint ipos */
if (EXPANDED_ACHAN(achan) && FILTER_CON_ACHAN(achan)) {
for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
if (EDITABLE_CONCHAN(conchan)) {
i = count_ipo_keys(conchan->ipo, side, cfra);
if (i) {
actstrip_map_ipo_keys(ob, conchan->ipo, 0, 1);
posttrans_ipo_clean(conchan->ipo);
actstrip_map_ipo_keys(ob, conchan->ipo, 1, 1);
}
}
}
}
}
}
}
}
}
}
/* ----------------------------- */
/* This function tests if a point is on the "mouse" side of the cursor/frame-marking */
@ -3487,8 +3652,6 @@ void special_aftertrans_update(TransInfo *t)
if (key->ipo) {
IpoCurve *icu;
if ( (G.saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
(cancelled == 0) )
{
@ -3507,17 +3670,39 @@ void special_aftertrans_update(TransInfo *t)
G.saction->flag &= ~SACTION_MOVING;
}
else if (t->spacetype == SPACE_NLA) {
recalc_all_ipos(); // bad
synchronize_action_strips();
/* cleanup */
for (base=G.scene->base.first; base; base=base->next)
base->flag &= ~(BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA);
recalc_all_ipos(); // bad
/* after transform, remove duplicate keyframes on a frame that resulted from transform */
if ( (G.snla->flag & SNLA_NOTRANSKEYCULL)==0 &&
(cancelled == 0) )
{
posttrans_nla_clean(t);
}
}
else if (t->spacetype == SPACE_IPO) {
// FIXME! is there any code from the old transform_ipo that needs to be added back?
/* after transform, remove duplicate keyframes on a frame that resulted from transform */
if (G.sipo->ipo)
{
if ( (G.sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
(cancelled == 0) )
{
if (NLA_IPO_SCALED) {
actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 1);
posttrans_ipo_clean(G.sipo->ipo);
actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 1);
}
else
posttrans_ipo_clean(G.sipo->ipo);
}
}
/* resetting slow-parents isn't really necessary when editing sequence ipo's */
if (G.sipo->blocktype==ID_SEQ)
resetslowpar= 0;

@ -389,7 +389,7 @@ static void init_userdef_file(void)
if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 11)) {
bTheme *btheme;
for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* these should all use the same colour */
/* these should all use the same color */
SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
SETCOL(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255);
SETCOL(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
@ -402,7 +402,7 @@ static void init_userdef_file(void)
if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 13)) {
bTheme *btheme;
for (btheme= U.themes.first; btheme; btheme= btheme->next) {
/* action channel groups (recolour anyway) */
/* action channel groups (recolor anyway) */
SETCOL(btheme->tact.group, 0x39, 0x7d, 0x1b, 255);
SETCOL(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255);

@ -2111,7 +2111,7 @@ void smooth_view(View3D *v3d, float *ofs, float *quat, float *dist, float *lens)
changed = 1;
}
/* The new view is different from teh old one
/* The new view is different from the old one
* so animate the view */
if (changed) {

@ -223,7 +223,7 @@ char KX_LightObject::doc[] = "Module KX_LightObject\n\n"
"\t\tThe effect radius of the light.\n"
"\tcolour -> list [r, g, b].\n"
"\tcolor -> list [r, g, b].\n"
"\t\tThe colour of the light.\n"
"\t\tThe color of the light.\n"
"\tlin_attenuation -> float.\n"
"\t\tThe attenuation factor for the light.\n"
"\tspotsize -> float.\n"