This commit is contained in:
Daniel Genrich 2008-09-07 19:47:15 +00:00
commit 44f9276b67
21 changed files with 2521 additions and 2286 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 67 KiB

@ -61,8 +61,20 @@ def get_object_images(ob):
me.activeUVLayer = orig_uvlayer
# Now get material images
for mat in me.materials:
if mat:
for mtex in mat.getTextures():
if mtex:
tex = mtex.tex
i = tex.getImage()
if i: unique_images[i.name] = i
return unique_images.values()
# Todo, support other object types, materials
return []
@ -118,7 +130,7 @@ def main():
def activate(ob, scn):
bpy.data.scenes.active = scn
scn.objects.selected = []
scn.Layers = ob.Layers
scn.Layers = ob.Layers & (1<<20)-1
ob.sel = 1
def name_cmp(name_search, name_found):

@ -367,19 +367,12 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
case CONSTRAINT_SPACE_WORLD: /* ---------- FROM WORLDSPACE ---------- */
{
/* world to pose */
if (to==CONSTRAINT_SPACE_POSE || to==CONSTRAINT_SPACE_LOCAL || to==CONSTRAINT_SPACE_PARLOCAL) {
Mat4Invert(imat, ob->obmat);
Mat4CpyMat4(tempmat, mat);
Mat4MulMat4(mat, tempmat, imat);
}
Mat4Invert(imat, ob->obmat);
Mat4CpyMat4(tempmat, mat);
Mat4MulMat4(mat, tempmat, imat);
/* pose to local */
if (to == CONSTRAINT_SPACE_LOCAL) {
/* call self with slightly different values */
constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
}
/* pose to local + parent */
else if (to == CONSTRAINT_SPACE_PARLOCAL) {
/* use pose-space as stepping stone for other spaces... */
if (ELEM(to, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_PARLOCAL)) {
/* call self with slightly different values */
constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
}
@ -445,69 +438,66 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
break;
case CONSTRAINT_SPACE_LOCAL: /* ------------ FROM LOCALSPACE --------- */
{
/* local to pose */
if (to==CONSTRAINT_SPACE_POSE || to==CONSTRAINT_SPACE_WORLD) {
/* do inverse procedure that was done for pose to local */
if (pchan->bone) {
/* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */
if (pchan->parent) {
float offs_bone[4][4];
/* local to pose - do inverse procedure that was done for pose to local */
if (pchan->bone) {
/* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */
if (pchan->parent) {
float offs_bone[4][4];
/* construct offs_bone the same way it is done in armature.c */
Mat4CpyMat3(offs_bone, pchan->bone->bone_mat);
VECCOPY(offs_bone[3], pchan->bone->head);
offs_bone[3][1]+= pchan->bone->parent->length;
if (pchan->bone->flag & BONE_HINGE) {
/* pose_mat = par_pose-space_location * chan_mat */
float tmat[4][4];
/* construct offs_bone the same way it is done in armature.c */
Mat4CpyMat3(offs_bone, pchan->bone->bone_mat);
VECCOPY(offs_bone[3], pchan->bone->head);
offs_bone[3][1]+= pchan->bone->parent->length;
/* the rotation of the parent restposition */
Mat4CpyMat4(tmat, pchan->bone->parent->arm_mat);
if (pchan->bone->flag & BONE_HINGE) {
/* pose_mat = par_pose-space_location * chan_mat */
float tmat[4][4];
/* the rotation of the parent restposition */
Mat4CpyMat4(tmat, pchan->bone->parent->arm_mat);
/* the location of actual parent transform */
VECCOPY(tmat[3], offs_bone[3]);
offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
Mat4MulVecfl(pchan->parent->pose_mat, tmat[3]);
Mat4MulMat4(diff_mat, offs_bone, tmat);
Mat4CpyMat4(tempmat, mat);
Mat4MulMat4(mat, tempmat, diff_mat);
}
else {
/* pose_mat = par_pose_mat * bone_mat * chan_mat */
Mat4MulMat4(diff_mat, offs_bone, pchan->parent->pose_mat);
Mat4CpyMat4(tempmat, mat);
Mat4MulMat4(mat, tempmat, diff_mat);
}
/* the location of actual parent transform */
VECCOPY(tmat[3], offs_bone[3]);
offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
Mat4MulVecfl(pchan->parent->pose_mat, tmat[3]);
Mat4MulMat4(diff_mat, offs_bone, tmat);
Mat4CpyMat4(tempmat, mat);
Mat4MulMat4(mat, tempmat, diff_mat);
}
else {
Mat4CpyMat4(diff_mat, pchan->bone->arm_mat);
/* pose_mat = par_pose_mat * bone_mat * chan_mat */
Mat4MulMat4(diff_mat, offs_bone, pchan->parent->pose_mat);
Mat4CpyMat4(tempmat, mat);
Mat4MulMat4(mat, tempmat, diff_mat);
}
}
else {
Mat4CpyMat4(diff_mat, pchan->bone->arm_mat);
Mat4CpyMat4(tempmat, mat);
Mat4MulMat4(mat, tempmat, diff_mat);
}
}
/* local to world */
if (to == CONSTRAINT_SPACE_WORLD) {
/* use pose-space as stepping stone for other spaces */
if (ELEM(to, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_PARLOCAL)) {
/* call self with slightly different values */
constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
}
}
}
break;
case CONSTRAINT_SPACE_PARLOCAL: /* -------------- FROM LOCAL WITH PARENT ---------- */
{
/* local to pose */
if (to==CONSTRAINT_SPACE_POSE || to==CONSTRAINT_SPACE_WORLD) {
if (pchan->bone) {
Mat4CpyMat4(diff_mat, pchan->bone->arm_mat);
Mat4CpyMat4(tempmat, mat);
Mat4MulMat4(mat, diff_mat, tempmat);
}
/* local + parent to pose */
if (pchan->bone) {
Mat4CpyMat4(diff_mat, pchan->bone->arm_mat);
Mat4CpyMat4(tempmat, mat);
Mat4MulMat4(mat, diff_mat, tempmat);
}
/* local to world */
if (to == CONSTRAINT_SPACE_WORLD) {
/* use pose-space as stepping stone for other spaces */
if (ELEM(to, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL)) {
/* call self with slightly different values */
constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
}

@ -697,9 +697,11 @@ float dof_camera(Object *ob)
if (cam->dof_ob) {
/* too simple, better to return the distance on the view axis only
* return VecLenf(ob->obmat[3], cam->dof_ob->obmat[3]); */
float mat[4][4], obmat[4][4];
float mat[4][4];
Mat4Invert(ob->imat, ob->obmat);
Mat4CpyMat4(obmat, ob->obmat);
Mat4Ortho(obmat);
Mat4Invert(ob->imat, obmat);
Mat4MulMat4(mat, cam->dof_ob->obmat, ob->imat);
return fabs(mat[3][2]);
}

@ -33,6 +33,8 @@
struct ScrArea;
struct Sequence;
#define SEQ_ZOOM_FAC(szoom) (szoom > 0)? (szoom) : (szoom == 0)? (1.0) : (-1.0/szoom)
void drawprefetchseqspace(struct ScrArea *sa, void *spacedata);
void drawseqspace(struct ScrArea *sa, void *spacedata);
void set_special_seq_update(int val);

@ -266,8 +266,8 @@ typedef enum {
ICON_WINDOW_WINDOW,
ICON_PANEL_CLOSE,
ICON_PHYSICS,
ICON_BLANK36,
ICON_BLANK37,
ICON_LAYER_USED,
ICON_LAYER_ACTIVE,
ICON_BLANK38,
ICON_BLENDER,

@ -86,7 +86,8 @@ typedef struct View3D {
float winmat1[4][4]; // persp(1) storage, for swap matrices
float viewmat1[4][4];
float viewquat[4], dist, zfac, pad0; /* zfac is initgrabz() result */
float viewquat[4], dist, zfac; /* zfac is initgrabz() result */
int lay_used; /* used while drawing */
short persp;
short view;

@ -33,12 +33,14 @@
#include "DNA_scene_types.h" /* for Base */
#include "BKE_mesh.h"
#include "BKE_image.h" // RFS: openanim
#include "BKE_library.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_scene.h"
#include "BIF_editseq.h" /* get_last_seq */
#include "BIF_editsound.h" // RFS: sound_open_hdaudio
#include "BLI_blenlib.h"
#include "BSE_sequence.h"
#include "Ipo.h"
@ -48,6 +50,9 @@
#include "Sound.h"
#include "gen_utils.h"
#include "IMB_imbuf_types.h" // RFS: IB_rect
#include "IMB_imbuf.h" // RFS: IMB_anim_get_duration
enum seq_consts {
EXPP_SEQ_ATTR_TYPE = 0,
EXPP_SEQ_ATTR_CHAN,
@ -145,7 +150,6 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
seq->len = PyList_Size( list );
/* strip and stripdata */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
strip->len= seq->len;
@ -185,12 +189,103 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
strip->us= 1;
strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
} else if (PyTuple_Check(py_data) && PyTuple_GET_SIZE(py_data) == 4) {
// MOVIE or AUDIO_HD
char *filename;
char *dir;
char *fullpath;
char *type;
int totframe;
if (!PyArg_ParseTuple( py_data, "ssss", &filename, &dir, &fullpath, &type )) {
BLI_remlink(seqbase, seq);
MEM_freeN(seq);
return EXPP_ReturnPyObjError( PyExc_ValueError,
"movie/audio hd data needs to be a tuple of a string and a list of images - (filename, dir, fullpath, type)" );
}
// RFS - Attempting to support Movie and Audio (HD) strips
#define RFS
#ifdef RFS
// Movie strips
if( strcmp( type, "movie" ) == 0 )
{
/* open it as an animation */
struct anim * an = openanim(fullpath, IB_rect);
if(an==0) {
BLI_remlink(seqbase, seq);
MEM_freeN(seq);
return EXPP_ReturnPyObjError( PyExc_ValueError,
"invalid movie strip" );
}
/* get the length in frames */
totframe = IMB_anim_get_duration( an );
/* set up sequence */
seq->type= SEQ_MOVIE;
seq->len= totframe;
seq->anim= an;
seq->anim_preseek = IMB_anim_get_preseek(an);
calc_sequence(seq);
/* strip and stripdata */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
strip->len= totframe;
strip->us= 1;
strncpy(strip->dir, dir, FILE_MAXDIR-1); // ????
strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
/* name movie in first strip */
strncpy(se->name, filename, FILE_MAXFILE-1); // ????
}
// Audio (HD) strips
if( strcmp( type, "audio_hd" ) == 0 )
{
struct hdaudio *hdaudio;
totframe= 0;
/* is it a sound file? */
hdaudio = sound_open_hdaudio( fullpath );
if(hdaudio==0) {
BLI_remlink(seqbase, seq);
MEM_freeN(seq);
return EXPP_ReturnPyObjError( PyExc_ValueError,
fullpath );
}
totframe= sound_hdaudio_get_duration(hdaudio, FPS);
/* set up sequence */
seq->type= SEQ_HD_SOUND;
seq->len= totframe;
seq->hdaudio= hdaudio;
calc_sequence(seq);
/* strip and stripdata - same as for MOVIE */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
strip->len= totframe;
strip->us= 1;
strncpy(strip->dir, dir, FILE_MAXDIR-1); // ????
strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
/* name movie in first strip */
strncpy(se->name, filename, FILE_MAXFILE-1); // ????
}
#endif
} else if (BPy_Sound_Check(py_data)) {
/* sound */
/* RAM sound */
int totframe;
bSound *sound = (( BPy_Sound * )py_data)->sound;
seq->type= SEQ_RAM_SOUND;
seq->sound = sound;
@ -198,7 +293,6 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
sound->flags |= SOUND_FLAGS_SEQUENCE;
/* strip and stripdata */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
strip->len= totframe;
@ -225,18 +319,7 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
strip->len= seq->len;
strip->us= 1;
} else {
/* movie, pydata is a path to a movie file */
char *name = PyString_AsString ( py_data );
if (!name) {
/* only free these 2 because other stuff isnt set */
BLI_remlink(seqbase, seq);
MEM_freeN(seq);
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expects a string for chan/bone name and an int for the frame where to put the new key" );
}
seq->type= SEQ_MOVIE;
// RFS: REMOVED MOVIE FROM HERE
}
strncpy(seq->name+2, "Untitled", 21);
intern_pos_update(seq);

@ -1766,7 +1766,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
psys->lattice=psys_get_lattice(ob,psys);
/* 3. start creating renderable things */
for(a=0,pa=pars; a<totpart+totchild; a++, pa++) {
for(a=0,pa=pars; a<totpart+totchild; a++, pa++, seed++) {
random = rng_getFloat(rng);
if(a<totpart){

@ -2346,6 +2346,12 @@ static int is_rendering_allowed(Render *re)
if(re->osa==0)
re->r.scemode &= ~R_FULL_SAMPLE;
/* no fullsample and edge */
if((re->r.scemode & R_FULL_SAMPLE) && (re->r.mode & R_EDGE)) {
re->error("Full Sample doesn't support Edge Enhance");
return 0;
}
}
else
re->r.scemode &= ~R_FULL_SAMPLE; /* clear to be sure */

@ -931,17 +931,23 @@ static void edge_enhance_add(RenderPart *pa, float *rectf, float *arect)
}
}
static void convert_to_key_alpha(RenderPart *pa, float *rectf)
static void convert_to_key_alpha(RenderPart *pa, RenderLayer *rl)
{
int y;
RenderLayer *rlpp[RE_MAX_OSA];
int y, sample, totsample;
for(y= pa->rectx*pa->recty; y>0; y--, rectf+=4) {
if(rectf[3] >= 1.0f);
else if(rectf[3] > 0.0f) {
rectf[0] /= rectf[3];
rectf[1] /= rectf[3];
rectf[2] /= rectf[3];
totsample= get_sample_layers(pa, rl, rlpp);
for(sample= 0; sample<totsample; sample++) {
float *rectf= rlpp[sample]->rectf;
for(y= pa->rectx*pa->recty; y>0; y--, rectf+=4) {
if(rectf[3] >= 1.0f);
else if(rectf[3] > 0.0f) {
rectf[0] /= rectf[3];
rectf[1] /= rectf[3];
rectf[2] /= rectf[3];
}
}
}
}
@ -1229,7 +1235,7 @@ void zbufshadeDA_tile(RenderPart *pa)
/* de-premul alpha */
if(R.r.alphamode & R_ALPHAKEY)
convert_to_key_alpha(pa, rl->rectf);
convert_to_key_alpha(pa, rl);
/* free stuff within loop! */
MEM_freeN(pa->rectdaps); pa->rectdaps= NULL;
@ -1393,7 +1399,7 @@ void zbufshade_tile(RenderPart *pa)
/* de-premul alpha */
if(R.r.alphamode & R_ALPHAKEY)
convert_to_key_alpha(pa, rl->rectf);
convert_to_key_alpha(pa, rl);
if(edgerect) MEM_freeN(edgerect);
edgerect= NULL;

File diff suppressed because it is too large Load Diff

@ -60,6 +60,7 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_butspace.h"
#include "BIF_drawseq.h"
#include "BIF_graphics.h"
#include "BIF_interface.h"
#include "BIF_mywindow.h"
@ -310,7 +311,7 @@ short draw_gpencil_panel (uiBlock *block, bGPdata *gpd, ScrArea *sa)
/* 'view align' button (naming depends on context) */
if (sa->spacetype == SPACE_VIEW3D)
uiDefButBitI(block, TOG, GP_DATA_VIEWALIGN, B_REDR, "Sketch in 3D", 170, 205, 150, 20, &gpd->flag, 0, 0, 0, 0, "New strokes are added in 3D-space");
else if (sa->spacetype != SPACE_SEQ) /* not available for sequencer yet */
else
uiDefButBitI(block, TOG, GP_DATA_VIEWALIGN, B_REDR, "Stick to View", 170, 205, 150, 20, &gpd->flag, 0, 0, 0, 0, "New strokes are added on 2d-canvas");
}
@ -411,8 +412,8 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short sfl
co[1]= points->y;
}
else if (sflag & GP_STROKE_2DIMAGE) {
co[0]= points->x;
co[1]= points->y;
co[0]= (points->x * winx) + offsx;
co[1]= (points->y * winy) + offsy;
}
else {
co[0]= (points->x / 1000 * winx);
@ -480,8 +481,12 @@ static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thicknes
static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag,
short debug, int offsx, int offsy, int winx, int winy)
{
/* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, 'smooth' opengl lines look better */
if ((thickness < GP_DRAWTHICKNESS_SPECIAL) || (dflag & GP_DRAWDATA_ONLYI2D)) {
/* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, 'smooth' opengl lines look better
* - but NOT if Image Editor 'image-based' stroke
*/
if ( (thickness < GP_DRAWTHICKNESS_SPECIAL) ||
((curarea->spacetype==SPACE_IMAGE) && (dflag & GP_DRAWDATA_ONLYV2D)) )
{
bGPDspoint *pt;
int i;
@ -491,8 +496,8 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
glVertex2f(pt->x, pt->y);
}
else if (sflag & GP_STROKE_2DIMAGE) {
const float x= pt->x;
const float y= pt->y;
const float x= (pt->x * winx) + offsx;
const float y= (pt->y * winy) + offsy;
glVertex2f(x, y);
}
@ -505,7 +510,10 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
}
glEnd();
}
else { /* tesselation code: currently only enabled with rt != 0 */
/* tesselation code: currently only enabled with rt != 0 */
else
{
bGPDspoint *pt1, *pt2;
float pm[2];
int i;
@ -526,8 +534,10 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
s1[0]= pt2->x; s1[1]= pt2->y;
}
else if (sflag & GP_STROKE_2DIMAGE) {
s0[0]= pt1->x; s0[1]= pt1->y;
s1[0]= pt2->x; s1[1]= pt2->y;
s0[0]= (pt1->x * winx) + offsx;
s0[1]= (pt1->y * winy) + offsy;
s1[0]= (pt2->x * winx) + offsx;
s1[1]= (pt2->y * winy) + offsy;
}
else {
s0[0]= (pt1->x / 1000 * winx);
@ -672,9 +682,8 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
glVertex2f(pt->x, pt->y);
}
else if (sflag & GP_STROKE_2DIMAGE) {
// fixme
const float x= pt->x;
const float y= pt->y;
const float x= (pt->x * winx) + offsx;
const float y= (pt->y * winy) + offsy;
glVertex2f(x, y);
}
@ -889,7 +898,7 @@ void draw_gpencil_2dimage (ScrArea *sa, ImBuf *ibuf)
{
bGPdata *gpd;
int offsx, offsy, sizex, sizey;
int dflag = 0;
int dflag = GP_DRAWDATA_NOSTATUS;
/* check that we have grease-pencil stuff to draw */
if (ELEM(NULL, sa, ibuf)) return;
@ -902,13 +911,39 @@ void draw_gpencil_2dimage (ScrArea *sa, ImBuf *ibuf)
{
SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
// fixme... are these settings still needed?
/* just draw using standard scaling (settings here are currently ignored anyways) */
// FIXME: the opengl poly-strokes don't draw at right thickness when done this way, so disabled
offsx= 0;
offsy= 0;
sizex= sa->winx;
sizey= sa->winy;
myortho2(sima->v2d.cur.xmin, sima->v2d.cur.xmax, sima->v2d.cur.ymin, sima->v2d.cur.ymax);
dflag |= GP_DRAWDATA_ONLYV2D;
}
break;
case SPACE_SEQ: /* sequence */
{
SpaceSeq *sseq= (SpaceSeq *)sa->spacedata.first;
float zoom, zoomx, zoomy;
/* calculate accessory values */
zoom= SEQ_ZOOM_FAC(sseq->zoom);
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
zoomx = zoom * ((float)G.scene->r.xasp / (float)G.scene->r.yasp);
zoomy = zoom;
}
else
zoomx = zoomy = zoom;
sizex= zoomx * ibuf->x;
sizey= zoomy * ibuf->y;
offsx= (sa->winx-sizex)/2 + sseq->xof;
offsy= (sa->winy-sizey)/2 + sseq->yof;
dflag |= GP_DRAWDATA_ONLYI2D;
}
break;
@ -917,12 +952,13 @@ void draw_gpencil_2dimage (ScrArea *sa, ImBuf *ibuf)
offsy= 0;
sizex= sa->winx;
sizey= sa->winy;
dflag |= GP_DRAWDATA_ONLYI2D;
break;
}
/* draw it! */
dflag = (GP_DRAWDATA_ONLYI2D|GP_DRAWDATA_NOSTATUS);
gp_draw_data(gpd, offsx, offsy, sizex, sizey, dflag);
}

@ -922,17 +922,11 @@ static void draw_image_seq(ScrArea *sa)
if(ibuf->rect_float && ibuf->rect==NULL)
IMB_rect_from_float(ibuf);
if (sseq->zoom > 0) {
zoom = sseq->zoom;
} else if (sseq->zoom == 0) {
zoom = 1.0;
} else {
zoom = -1.0/sseq->zoom;
}
/* needed for gla draw */
glaDefine2DArea(&curarea->winrct);
zoom= SEQ_ZOOM_FAC(sseq->zoom);
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
zoomx = zoom * ((float)G.scene->r.xasp / (float)G.scene->r.yasp);
zoomy = zoom;
@ -976,7 +970,10 @@ static void draw_image_seq(ScrArea *sa)
setlinestyle(0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
/* draw grease-pencil (image aligned) */
if (sseq->flag & SEQ_DRAW_GPENCIL)
draw_gpencil_2dimage(sa, ibuf);
if (free_ibuf) {
IMB_freeImBuf(ibuf);

@ -3023,9 +3023,12 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
for(SETLOOPER(G.scene->set, base))
object_handle_update(base->object); // bke_object.h
}
for(base= G.scene->base.first; base; base= base->next)
v3d->lay_used = 0;
for(base= G.scene->base.first; base; base= base->next) {
object_handle_update(base->object); // bke_object.h
v3d->lay_used |= base->lay;
}
/* shadow buffers, before we setup matrices */
if(draw_glsl_material(NULL, v3d->drawtype))

@ -67,6 +67,7 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_butspace.h"
#include "BIF_drawseq.h"
#include "BIF_editarmature.h"
#include "BIF_editview.h"
#include "BIF_graphics.h"
@ -694,7 +695,6 @@ static void gp_strokepoint_convertcoords (bGPDstroke *gps, bGPDspoint *pt, float
{
if (gps->flag & GP_STROKE_3DSPACE) {
/* directly use 3d-coordinates */
// FIXME: maybe we need to counterotate this for object rotation?
VecCopyf(p3d, &pt->x);
}
else {
@ -1246,17 +1246,45 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[])
out[1]= y;
}
/* 2d - on image 'canvas' (asume that p->v2d is set) */
else if ( (gpd->sbuffer_sflag & GP_STROKE_2DIMAGE) &&
(p->v2d) && (p->ibuf) )
/* 2d - on image 'canvas' (assume that p->v2d is set) */
else if ( (gpd->sbuffer_sflag & GP_STROKE_2DIMAGE) && (p->v2d) )
{
float x, y;
/* convert to 'canvas' coordinates (not need to adjust to canvas) */
areamouseco_to_ipoco(p->v2d, mval, &x, &y);
out[0]= x;
out[1]= y;
/* for now - space specific */
switch (p->sa->spacetype) {
case SPACE_SEQ: /* sequencer */
{
SpaceSeq *sseq= (SpaceSeq *)p->sa->spacedata.first;
int sizex, sizey, offsx, offsy, rectx, recty;
float zoom, zoomx, zoomy;
/* calculate zoom factor */
zoom= SEQ_ZOOM_FAC(sseq->zoom);
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
zoomx = zoom * ((float)G.scene->r.xasp / (float)G.scene->r.yasp);
zoomy = zoom;
}
else
zoomx = zoomy = zoom;
/* calculate rect size */
rectx= (G.scene->r.size*G.scene->r.xsch)/100;
recty= (G.scene->r.size*G.scene->r.ysch)/100;
sizex= zoomx * rectx;
sizey= zoomy * recty;
offsx= (p->sa->winx-sizex)/2 + sseq->xof;
offsy= (p->sa->winy-sizey)/2 + sseq->yof;
/* calculate new points */
out[0]= (float)(mval[0] - offsx) / (float)sizex;
out[1]= (float)(mval[1] - offsy) / (float)sizey;
}
break;
default: /* just use raw mouse coordinates - BAD! */
out[0]= mval[0];
out[1]= mval[1];
break;
}
}
/* 2d - relative to screen (viewport area) */
@ -1487,6 +1515,11 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, short mval[], short mvalo[],
x0= xyval[0];
y0= xyval[1];
}
else if (gps->flag & GP_STROKE_2DIMAGE) {
ipoco_to_areaco_noclip(p->v2d, &gps->points->x, xyval);
x0= xyval[0];
y0= xyval[1];
}
else {
x0= (gps->points->x / 1000 * p->sa->winx);
y0= (gps->points->y / 1000 * p->sa->winy);
@ -1530,6 +1563,15 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, short mval[], short mvalo[],
x1= xyval[0];
y1= xyval[1];
}
else if (gps->flag & GP_STROKE_2DIMAGE) {
ipoco_to_areaco_noclip(p->v2d, &pt1->x, xyval);
x0= xyval[0];
y0= xyval[1];
ipoco_to_areaco_noclip(p->v2d, &pt2->x, xyval);
x1= xyval[0];
y1= xyval[1];
}
else {
x0= (pt1->x / 1000 * p->sa->winx);
y0= (pt1->y / 1000 * p->sa->winy);
@ -1553,8 +1595,6 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, short mval[], short mvalo[],
}
}
/* -------- */
/* erase strokes which fall under the eraser strokes */
static void gp_stroke_doeraser (tGPsdata *p)
{
@ -1626,14 +1666,14 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
case SPACE_SEQ:
{
/* for now, this is not applicable here... */
//p->gpd->sbuffer_sflag |= GP_STROKE_2DIMAGE;
p->gpd->sbuffer_sflag |= GP_STROKE_2DIMAGE;
}
break;
case SPACE_IMAGE:
{
/* check if any ibuf available */
if (p->ibuf)
p->gpd->sbuffer_sflag |= GP_STROKE_2DIMAGE;
p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE;
}
break;
}

@ -602,11 +602,11 @@ static uiBlock *node_nodemenu(void *arg_unused)
if(snode->treetype==NTREE_COMPOSIT) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Execute Composite|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Read Saved Render Results|R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Read Saved Full Sample Results|R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Read Saved Full Sample Results|Shift R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Connect Node to Viewer|Ctrl LMB", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Connect Node to Viewer|Ctrl RMB", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
}

@ -5567,6 +5567,16 @@ static void view3d_header_pulldowns(uiBlock *block, short *xcoord)
*xcoord= xco;
}
static int view3d_layer_icon(int but_lay, int ob_lay, int used_lay)
{
if (but_lay & ob_lay)
return ICON_LAYER_ACTIVE;
else if (but_lay & used_lay)
return ICON_LAYER_USED;
else
return ICON_BLANK1;
}
void view3d_buttons(void)
{
uiBlock *block;
@ -5733,19 +5743,22 @@ void view3d_buttons(void)
/* LAYERS */
if(G.obedit==NULL && G.vd->localview==0) {
int ob_lay = ob ? ob->lay : 0;
uiBlockBeginAlign(block);
for(a=0; a<5; a++)
uiDefButBitI(block, TOG, 1<<a, B_LAY+a, "", (short)(xco+a*(XIC/2)), (short)(YIC/2),(short)(XIC/2),(short)(YIC/2), &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Num, Shift Num)");
for(a=0; a<5; a++)
uiDefButBitI(block, TOG, 1<<(a+10), B_LAY+10+a, "",(short)(xco+a*(XIC/2)), 0, XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Alt Num, Alt Shift Num)");
for(a=0; a<5; a++) {
uiDefIconButBitI(block, TOG, 1<<a, B_LAY+a, view3d_layer_icon(1<<a, ob_lay, G.vd->lay_used), (short)(xco+a*(XIC/2)), (short)(YIC/2),(short)(XIC/2),(short)(YIC/2), &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Alt Num, Alt Shift Num)");
}
for(a=0; a<5; a++) {
uiDefIconButBitI(block, TOG, 1<<(a+10), B_LAY+10+a, view3d_layer_icon(1<<(a+10), ob_lay, G.vd->lay_used), (short)(xco+a*(XIC/2)), 0, XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Alt Num, Alt Shift Num)");
}
xco+= 5;
uiBlockBeginAlign(block);
for(a=5; a<10; a++)
uiDefButBitI(block, TOG, 1<<a, B_LAY+a, "", (short)(xco+a*(XIC/2)), (short)(YIC/2),(short)(XIC/2),(short)(YIC/2), &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Num, Shift Num)");
for(a=5; a<10; a++)
uiDefButBitI(block, TOG, 1<<(a+10), B_LAY+10+a, "",(short)(xco+a*(XIC/2)), 0, XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Alt Num, Alt Shift Num)");
for(a=5; a<10; a++) {
uiDefIconButBitI(block, TOG, 1<<a, B_LAY+a, view3d_layer_icon(1<<a, ob_lay, G.vd->lay_used), (short)(xco+a*(XIC/2)), (short)(YIC/2),(short)(XIC/2),(short)(YIC/2), &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Alt Num, Alt Shift Num)");
}
for(a=5; a<10; a++) {
uiDefIconButBitI(block, TOG, 1<<(a+10), B_LAY+10+a, view3d_layer_icon(1<<(a+10), ob_lay, G.vd->lay_used), (short)(xco+a*(XIC/2)), 0, XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility (Alt Num, Alt Shift Num)");
}
uiBlockEndAlign(block);
xco+= (a-2)*(XIC/2)+3;

@ -2144,7 +2144,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
gameobj->NodeUpdateGS(0,true);
gameobj->AddMeshUser();
}
else
{
@ -2209,6 +2208,41 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
{
struct Object* blenderchild = pcit->m_blenderchild;
struct Object* blenderparent = blenderchild->parent;
KX_GameObject* parentobj = converter->FindGameObject(blenderparent);
KX_GameObject* childobj = converter->FindGameObject(blenderchild);
assert(childobj);
if (!parentobj || objectlist->SearchValue(childobj) != objectlist->SearchValue(parentobj))
{
// special case: the parent and child object are not in the same layer.
// This weird situation is used in Apricot for test purposes.
// Resolve it by not converting the child
childobj->GetSGNode()->DisconnectFromParent();
delete pcit->m_gamechildnode;
// Now destroy the child object but also all its descendent that may already be linked
// Remove the child reference in the local list!
// Note: there may be descendents already if the children of the child were processed
// by this loop before the child. In that case, we must remove the children also
CListValue* childrenlist = (CListValue*)childobj->PyGetChildrenRecursive(childobj);
childrenlist->Add(childobj->AddRef());
for ( i=0;i<childrenlist->GetCount();i++)
{
KX_GameObject* obj = static_cast<KX_GameObject*>(childrenlist->GetValue(i));
if (templist->RemoveValue(obj))
obj->Release();
if (sumolist->RemoveValue(obj))
obj->Release();
if (logicbrick_conversionlist->RemoveValue(obj))
obj->Release();
}
childrenlist->Release();
// now destroy recursively
kxscene->RemoveObject(childobj);
continue;
}
switch (blenderchild->partype)
{
case PARVERT1:
@ -2248,12 +2282,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
break;
}
struct Object* blenderparent = blenderchild->parent;
KX_GameObject* parentobj = converter->FindGameObject(blenderparent);
if (parentobj)
{
parentobj-> GetSGNode()->AddChild(pcit->m_gamechildnode);
}
parentobj-> GetSGNode()->AddChild(pcit->m_gamechildnode);
}
vec_parent_child.clear();

@ -501,7 +501,17 @@ void KX_BlenderSceneConverter::RegisterGameObject(
void KX_BlenderSceneConverter::UnregisterGameObject(
KX_GameObject *gameobject)
{
m_map_gameobject_to_blender.remove(CHashedPtr(gameobject));
CHashedPtr gptr(gameobject);
struct Object **bobp= m_map_gameobject_to_blender[gptr];
if (bobp) {
CHashedPtr bptr(*bobp);
KX_GameObject **gobp= m_map_blender_to_gameobject[bptr];
if (gobp && *gobp == gameobject)
// also maintain m_map_blender_to_gameobject if the gameobject
// being removed is matching the blender object
m_map_blender_to_gameobject.remove(bptr);
m_map_gameobject_to_blender.remove(gptr);
}
}

@ -696,7 +696,7 @@ static PyObject* gPySetGLSLMaterialSetting(PyObject*,
char *setting;
int enable, flag;
if (PyArg_ParseTuple(args,"si",&setting,&enable))
if (!PyArg_ParseTuple(args,"si",&setting,&enable))
return NULL;
flag = getGLSLSettingFlag(setting);