diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-13 05:39:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-13 05:39:57 +0400 |
commit | 705f23064e8ba3e96690d163c98687fc79d4a179 (patch) | |
tree | 13251a1f24cfb219a62c4f64c6750cadec7ff712 /source | |
parent | 9e59fed5d8ff9f63477b3a73d2b02eaa55abd6cd (diff) | |
parent | dbdd1c2ea7496546f4f7e17350720a6005cdb187 (diff) |
svn merge ^/trunk/blender -r43294:43338
Diffstat (limited to 'source')
98 files changed, 898 insertions, 1842 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index ff43d54a902..af6f4b88f4b 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 261 -#define BLENDER_SUBVERSION 1 +#define BLENDER_SUBVERSION 2 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 32418384795..b69eabbb371 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -76,7 +76,7 @@ struct BrushPainter; typedef struct BrushPainter BrushPainter; typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, float *lastpos, float *pos); -BrushPainter *brush_painter_new(struct Brush *brush); +BrushPainter *brush_painter_new(struct Scene *scene, struct Brush *brush); void brush_painter_require_imbuf(BrushPainter *painter, short flt, short texonly, int size); int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, @@ -95,14 +95,9 @@ struct ImBuf *brush_gen_radial_control_imbuf(struct Brush *br); int brush_size(struct Brush *brush); void brush_set_size(struct Brush *brush, int value); -int brush_use_locked_size(struct Brush *brush); -void brush_set_use_locked_size(struct Brush *brush, int value); - -int brush_use_alpha_pressure(struct Brush *brush); -void brush_set_use_alpha_pressure(struct Brush *brush, int value); - -int brush_use_size_pressure(struct Brush *brush); -void brush_set_use_size_pressure(struct Brush *brush, int value); +int brush_use_locked_size(const struct Scene *scene, struct Brush *brush); +int brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush); +int brush_use_size_pressure(const struct Scene *scene, struct Brush *brush); float brush_unprojected_radius(struct Brush *brush); void brush_set_unprojected_radius(struct Brush *brush, float value); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 61064bede7e..daa41442ed5 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -642,6 +642,7 @@ typedef struct BrushPainterCache { } BrushPainterCache; struct BrushPainter { + Scene *scene; Brush *brush; float lastmousepos[2]; /* mouse position of last paint call */ @@ -665,11 +666,12 @@ struct BrushPainter { BrushPainterCache cache; }; -BrushPainter *brush_painter_new(Brush *brush) +BrushPainter *brush_painter_new(Scene *scene, Brush *brush) { BrushPainter *painter= MEM_callocN(sizeof(BrushPainter), "BrushPainter"); painter->brush= brush; + painter->scene= scene; painter->firsttouch= 1; painter->cache.lastsize= -1; /* force ibuf create in refresh */ @@ -917,9 +919,9 @@ void brush_painter_break_stroke(BrushPainter *painter) static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pressure) { - if (brush_use_alpha_pressure(brush)) + if (brush_use_alpha_pressure(painter->scene, brush)) brush_set_alpha(brush, MAX2(0.0f, painter->startalpha*pressure)); - if (brush_use_size_pressure(brush)) + if (brush_use_size_pressure(painter->scene, brush)) brush_set_size(brush, MAX2(1.0f, painter->startsize*pressure)); if (brush->flag & BRUSH_JITTER_PRESSURE) brush->jitter = MAX2(0.0f, painter->startjitter*pressure); @@ -1219,25 +1221,6 @@ struct ImBuf *brush_gen_radial_control_imbuf(Brush *br) /* XXX, wouldnt it be better to only pass the active scene? * this can return any old scene! - campbell*/ -static void set_unified_settings(Brush *brush, short flag, int value) -{ - Scene *sce; - for (sce= G.main->scene.first; sce; sce= sce->id.next) { - if (sce->toolsettings && - ELEM4(brush, - paint_brush(&(sce->toolsettings->imapaint.paint)), - paint_brush(&(sce->toolsettings->vpaint->paint)), - paint_brush(&(sce->toolsettings->wpaint->paint)), - paint_brush(&(sce->toolsettings->sculpt->paint)))) - { - if (value) - sce->toolsettings->sculpt_paint_settings |= flag; - else - sce->toolsettings->sculpt_paint_settings &= ~flag; - } - } -} - static short unified_settings(Brush *brush) { Scene *sce; @@ -1249,7 +1232,7 @@ static short unified_settings(Brush *brush) paint_brush(&(sce->toolsettings->wpaint->paint)), paint_brush(&(sce->toolsettings->sculpt->paint)))) { - return sce->toolsettings->sculpt_paint_settings; + return sce->toolsettings->unified_paint_settings.flag; } } @@ -1280,7 +1263,7 @@ static void set_unified_size(Brush *brush, int value) paint_brush(&(sce->toolsettings->wpaint->paint)), paint_brush(&(sce->toolsettings->sculpt->paint)))) { - sce->toolsettings->sculpt_paint_unified_size= value; + sce->toolsettings->unified_paint_settings.size= value; } } } @@ -1296,7 +1279,7 @@ static int unified_size(Brush *brush) paint_brush(&(sce->toolsettings->wpaint->paint)), paint_brush(&(sce->toolsettings->sculpt->paint)))) { - return sce->toolsettings->sculpt_paint_unified_size; + return sce->toolsettings->unified_paint_settings.size; } } @@ -1314,7 +1297,7 @@ static void set_unified_alpha(Brush *brush, float value) paint_brush(&(sce->toolsettings->wpaint->paint)), paint_brush(&(sce->toolsettings->sculpt->paint)))) { - sce->toolsettings->sculpt_paint_unified_alpha= value; + sce->toolsettings->unified_paint_settings.alpha= value; } } } @@ -1330,7 +1313,7 @@ static float unified_alpha(Brush *brush) paint_brush(&(sce->toolsettings->wpaint->paint)), paint_brush(&(sce->toolsettings->sculpt->paint)))) { - return sce->toolsettings->sculpt_paint_unified_alpha; + return sce->toolsettings->unified_paint_settings.alpha; } } @@ -1348,7 +1331,7 @@ static void set_unified_unprojected_radius(Brush *brush, float value) paint_brush(&(sce->toolsettings->wpaint->paint)), paint_brush(&(sce->toolsettings->sculpt->paint)))) { - sce->toolsettings->sculpt_paint_unified_unprojected_radius= value; + sce->toolsettings->unified_paint_settings.unprojected_radius= value; } } } @@ -1364,7 +1347,7 @@ static float unified_unprojected_radius(Brush *brush) paint_brush(&(sce->toolsettings->wpaint->paint)), paint_brush(&(sce->toolsettings->sculpt->paint)))) { - return sce->toolsettings->sculpt_paint_unified_unprojected_radius; + return sce->toolsettings->unified_paint_settings.unprojected_radius; } } @@ -1374,7 +1357,7 @@ void brush_set_size(Brush *brush, int size) { const short us_flag = unified_settings(brush); - if (us_flag & SCULPT_PAINT_USE_UNIFIED_SIZE) + if (us_flag & UNIFIED_PAINT_SIZE) set_unified_size(brush, size); else brush->size= size; @@ -1386,84 +1369,33 @@ int brush_size(Brush *brush) { const short us_flag = unified_settings(brush); - return (us_flag & SCULPT_PAINT_USE_UNIFIED_SIZE) ? unified_size(brush) : brush->size; -} - -void brush_set_use_locked_size(Brush *brush, int value) -{ - const short us_flag = unified_settings(brush); - - if (us_flag & SCULPT_PAINT_USE_UNIFIED_SIZE) { - set_unified_settings(brush, SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE, value); - } - else { - if (value) - brush->flag |= BRUSH_LOCK_SIZE; - else - brush->flag &= ~BRUSH_LOCK_SIZE; - } - - //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush); + return (us_flag & UNIFIED_PAINT_SIZE) ? unified_size(brush) : brush->size; } -int brush_use_locked_size(Brush *brush) +int brush_use_locked_size(const Scene *scene, Brush *brush) { - const short us_flag = unified_settings(brush); + const short us_flag = scene->toolsettings->unified_paint_settings.flag; - return (us_flag & SCULPT_PAINT_USE_UNIFIED_SIZE) ? - (us_flag & SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE) : + return (us_flag & UNIFIED_PAINT_SIZE) ? + (us_flag & UNIFIED_PAINT_BRUSH_LOCK_SIZE) : (brush->flag & BRUSH_LOCK_SIZE); } -void brush_set_use_size_pressure(Brush *brush, int value) -{ - const short us_flag = unified_settings(brush); - - if (us_flag & SCULPT_PAINT_USE_UNIFIED_SIZE) { - set_unified_settings(brush, SCULPT_PAINT_UNIFIED_SIZE_PRESSURE, value); - } - else { - if (value) - brush->flag |= BRUSH_SIZE_PRESSURE; - else - brush->flag &= ~BRUSH_SIZE_PRESSURE; - } - - //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush); -} - -int brush_use_size_pressure(Brush *brush) +int brush_use_size_pressure(const Scene *scene, Brush *brush) { - const short us_flag = unified_settings(brush); + const short us_flag = scene->toolsettings->unified_paint_settings.flag; - return (us_flag & SCULPT_PAINT_USE_UNIFIED_SIZE) ? - (us_flag & SCULPT_PAINT_UNIFIED_SIZE_PRESSURE) : + return (us_flag & UNIFIED_PAINT_SIZE) ? + (us_flag & UNIFIED_PAINT_BRUSH_SIZE_PRESSURE) : (brush->flag & BRUSH_SIZE_PRESSURE); } -void brush_set_use_alpha_pressure(Brush *brush, int value) +int brush_use_alpha_pressure(const Scene *scene, Brush *brush) { - const short us_flag = unified_settings(brush); - - if (us_flag & SCULPT_PAINT_USE_UNIFIED_ALPHA) { - set_unified_settings(brush, SCULPT_PAINT_UNIFIED_ALPHA_PRESSURE, value); - } - else { - if (value) - brush->flag |= BRUSH_ALPHA_PRESSURE; - else - brush->flag &= ~BRUSH_ALPHA_PRESSURE; - } - - //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush); -} - -int brush_use_alpha_pressure(Brush *brush) -{ - const short us_flag = unified_settings(brush); + const short us_flag = scene->toolsettings->unified_paint_settings.flag; - return (us_flag & SCULPT_PAINT_USE_UNIFIED_ALPHA) ? - (us_flag & SCULPT_PAINT_UNIFIED_ALPHA_PRESSURE) : + return (us_flag & UNIFIED_PAINT_ALPHA) ? + (us_flag & UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE) : (brush->flag & BRUSH_ALPHA_PRESSURE); } @@ -1471,7 +1403,7 @@ void brush_set_unprojected_radius(Brush *brush, float unprojected_radius) { const short us_flag = unified_settings(brush); - if (us_flag & SCULPT_PAINT_USE_UNIFIED_SIZE) + if (us_flag & UNIFIED_PAINT_SIZE) set_unified_unprojected_radius(brush, unprojected_radius); else brush->unprojected_radius= unprojected_radius; @@ -1483,7 +1415,7 @@ float brush_unprojected_radius(Brush *brush) { const short us_flag = unified_settings(brush); - return (us_flag & SCULPT_PAINT_USE_UNIFIED_SIZE) ? + return (us_flag & UNIFIED_PAINT_SIZE) ? unified_unprojected_radius(brush) : brush->unprojected_radius; } @@ -1492,7 +1424,7 @@ void brush_set_alpha(Brush *brush, float alpha) { const short us_flag = unified_settings(brush); - if (us_flag & SCULPT_PAINT_USE_UNIFIED_ALPHA) + if (us_flag & UNIFIED_PAINT_ALPHA) set_unified_alpha(brush, alpha); else brush->alpha= alpha; @@ -1504,7 +1436,7 @@ float brush_alpha(Brush *brush) { const short us_flag = unified_settings(brush); - return (us_flag & SCULPT_PAINT_USE_UNIFIED_ALPHA) ? + return (us_flag & UNIFIED_PAINT_ALPHA) ? unified_alpha(brush) : brush->alpha; } diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index a4d07969604..5c945c3a17c 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -269,9 +269,9 @@ int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, i (*b)= 1; } - if( (dl->flag & DL_CYCL_V) && a==dl->parts-1) { \ - (*p3)-= dl->nr*dl->parts; \ - (*p4)-= dl->nr*dl->parts; \ + if( (dl->flag & DL_CYCL_V) && a==dl->parts-1) { + (*p3)-= dl->nr*dl->parts; + (*p4)-= dl->nr*dl->parts; } return 1; diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index b11d87b1557..601c040c202 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -271,8 +271,6 @@ void BMEdit_Free(BMEditMesh *em) em->derivedCage= NULL; } - em->retopo_paint_data= NULL; - if (em->looptris) MEM_freeN(em->looptris); if (em->vert_index) MEM_freeN(em->vert_index); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 5b3b9b4e1c4..9e5917f0b07 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -950,6 +950,7 @@ char BKE_imtype_valid_channels(const char imtype) case R_IMF_IMTYPE_MULTILAYER: case R_IMF_IMTYPE_DDS: case R_IMF_IMTYPE_JP2: + case R_IMF_IMTYPE_QUICKTIME: chan_flag |= IMA_CHAN_FLAG_ALPHA; } diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index ae65b913283..df908aaa006 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -310,7 +310,7 @@ int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports)) } } - len = recv(connsock, buf, 4095, 0); + len = recv(connsock, buf, sizeof(buf) - 1, 0); if (len < 0) { return -1; diff --git a/source/blender/blenlib/BLI_editVert.h b/source/blender/blenlib/BLI_editVert.h index 3f20187dee1..fa0c0746f66 100644 --- a/source/blender/blenlib/BLI_editVert.h +++ b/source/blender/blenlib/BLI_editVert.h @@ -42,7 +42,6 @@ #include "BLO_sys_types.h" // for intptr_t support struct DerivedMesh; -struct RetopoPaintData; struct BLI_mempool; /* note; changing this also might affect the undo copy in editmesh.c */ @@ -187,8 +186,6 @@ typedef struct EditMesh */ int lastDataMask; - struct RetopoPaintData *retopo_paint_data; - CustomData vdata, edata, fdata; } EditMesh; diff --git a/source/blender/blenlib/BLI_fnmatch.h b/source/blender/blenlib/BLI_fnmatch.h index c09a7c7c0d2..ac8960ff9c9 100644 --- a/source/blender/blenlib/BLI_fnmatch.h +++ b/source/blender/blenlib/BLI_fnmatch.h @@ -51,7 +51,7 @@ extern "C" { #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ -#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE) +#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE) || defined( __SUNPRO_C) #define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ #define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ #define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index 30bf69ba3b4..073b4b5d0c6 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -174,33 +174,33 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he for (box=boxarray, box_index=0, i=0; box_index < len; box_index++, box++) { - vert->blb = vert->brb = vert->tlb =\ - vert->isect_cache[0] = vert->isect_cache[1] =\ - vert->isect_cache[2] = vert->isect_cache[3] = NULL; + vert->blb = vert->brb = vert->tlb = + vert->isect_cache[0] = vert->isect_cache[1] = + vert->isect_cache[2] = vert->isect_cache[3] = NULL; vert->free = CORNERFLAGS &~ TRF; vert->trb = box; vert->index = i; i++; box->v[BL] = vert; vert++; - vert->trb= vert->brb = vert->tlb =\ - vert->isect_cache[0] = vert->isect_cache[1] =\ - vert->isect_cache[2] = vert->isect_cache[3] = NULL; + vert->trb= vert->brb = vert->tlb = + vert->isect_cache[0] = vert->isect_cache[1] = + vert->isect_cache[2] = vert->isect_cache[3] = NULL; vert->free = CORNERFLAGS &~ BLF; vert->blb = box; vert->index = i; i++; box->v[TR] = vert; vert++; - vert->trb = vert->blb = vert->tlb =\ - vert->isect_cache[0] = vert->isect_cache[1] =\ - vert->isect_cache[2] = vert->isect_cache[3] = NULL; + vert->trb = vert->blb = vert->tlb = + vert->isect_cache[0] = vert->isect_cache[1] = + vert->isect_cache[2] = vert->isect_cache[3] = NULL; vert->free = CORNERFLAGS &~ BRF; vert->brb = box; vert->index = i; i++; box->v[TL] = vert; vert++; - vert->trb = vert->blb = vert->brb =\ - vert->isect_cache[0] = vert->isect_cache[1] =\ - vert->isect_cache[2] = vert->isect_cache[3] = NULL; + vert->trb = vert->blb = vert->brb = + vert->isect_cache[0] = vert->isect_cache[1] = + vert->isect_cache[2] = vert->isect_cache[3] = NULL; vert->free = CORNERFLAGS &~ TLF; vert->tlb = box; vert->index = i; i++; diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 95b6a970b49..ad0478060f2 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -82,7 +82,7 @@ int BLI_file_gzip(const char *from, const char *to) return -2; while(1) { - readsize = read(file, buffer, 10240); + readsize = read(file, buffer, sizeof(buffer)); if(readsize < 0) { rval= -2; /* error happened in reading */ diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 6d631051496..bbdb9bc5823 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -52,7 +52,7 @@ #include "GHOST_Path-api.h" -#if defined WIN32 && !defined _LIBC +#if defined WIN32 && !defined _LIBC || defined __sun # include "BLI_fnmatch.h" /* use fnmatch included in blenlib */ #else # ifndef _GNU_SOURCE diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 8a07fe69ec8..0328be060cc 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10983,7 +10983,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce->gm.dome.warptext = sce->r.dometext; //Stand Alone - sce->gm.fullscreen = sce->r.fullscreen; + sce->gm.playerflag |= (sce->r.fullscreen?GAME_PLAYER_FULLSCREEN:0); sce->gm.xplay = sce->r.xplay; sce->gm.yplay = sce->r.yplay; sce->gm.freqplay = sce->r.freqplay; @@ -13019,7 +13019,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - /* put compatibility code here until next subversion bump */ + if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 2)) { { /* convert Camera Actuator values to defines */ @@ -13038,6 +13038,24 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } + + { + /* convert deprecated sculpt_paint_unified_* fields to + UnifiedPaintSettings */ + Scene *scene; + for(scene= main->scene.first; scene; scene= scene->id.next) { + ToolSettings *ts= scene->toolsettings; + UnifiedPaintSettings *ups= &ts->unified_paint_settings; + ups->size= ts->sculpt_paint_unified_size; + ups->unprojected_radius= ts->sculpt_paint_unified_unprojected_radius; + ups->alpha= ts->sculpt_paint_unified_alpha; + ups->flag= ts->sculpt_paint_settings; + } + } + } + + /* put compatibility code here until next subversion bump */ + { } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ diff --git a/source/blender/bmesh/editmesh_tools.c b/source/blender/bmesh/editmesh_tools.c index c1b50acb6b4..87f69f747b2 100644 --- a/source/blender/bmesh/editmesh_tools.c +++ b/source/blender/bmesh/editmesh_tools.c @@ -4654,831 +4654,6 @@ void bevel_menu_old() } } -/* *********** END BEVEL *********/ -typedef struct SlideUv { - float origuv[2]; - float *uv_up, *uv_down; - //float *fuv[4]; - LinkNode *fuv_list; -} SlideUv; - -typedef struct SlideVert { - EditEdge *up,*down; - EditVert origvert; -} SlideVert; - -int EdgeLoopDelete(void) -{ - - /* temporal flag setting so we keep UVs when deleting edge loops, - * this is a bit of a hack but it works how you would want in almost all cases */ - short uvcalc_flag_orig = G.scene->toolsettings->uvcalc_flag; - G.scene->toolsettings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT; - - if(!EdgeSlide(1, 1)) { - return 0; - } - - /* restore uvcalc flag */ - G.scene->toolsettings->uvcalc_flag = uvcalc_flag_orig; - - EM_select_more(); - removedoublesflag(1,0, 0.001); - EM_select_flush(); - DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); - return 1; -} - -int EdgeSlide(short immediate, float imperc) -{ - NumInput num; - EditMesh *em = G.editMesh; - EditFace *efa; - EditEdge *eed,*first=NULL,*last=NULL, *temp = NULL; - EditVert *ev, *nearest; - LinkNode *edgelist = NULL, *vertlist=NULL, *look; - GHash *vertgh; - - SlideVert *tempsv; - float perc = 0, percp = 0,vertdist, projectMat[4][4], viewMat[4][4]; - float shiftlabda= 0.0f,len = 0.0f; - int i = 0,j, numsel, numadded=0, timesthrough = 0, vertsel=0, prop=1, cancel = 0,flip=0; - int wasshift = 0; - - /* UV correction vars */ - GHash **uvarray= NULL; - int uvlay_tot= CustomData_number_of_layers(&G.editMesh->fdata, CD_MTFACE); - int uvlay_idx; - SlideUv *slideuvs=NULL, *suv=NULL, *suv_last=NULL; - float uv_tmp[2]; - LinkNode *fuv_link; - - short event, draw=1; - short mval[2], mvalo[2]; - char str[128]; - float labda = 0.0f; - - initNumInput(&num); - - view3d_get_object_project_mat(curarea, G.obedit, projectMat, viewMat); - - mvalo[0] = -1; mvalo[1] = -1; - numsel =0; - - // Get number of selected edges and clear some flags - for(eed=em->edges.first;eed;eed=eed->next) { - eed->f1 = 0; - eed->f2 = 0; - if(eed->f & SELECT) numsel++; - } - - for(ev=em->verts.first;ev;ev=ev->next) { - ev->f1 = 0; - } - - //Make sure each edge only has 2 faces - // make sure loop doesn't cross face - for(efa=em->faces.first;efa;efa=efa->next) { - int ct = 0; - if(efa->e1->f & SELECT) { - ct++; - efa->e1->f1++; - if(efa->e1->f1 > 2) { - error("3+ face edge"); - return 0; - } - } - if(efa->e2->f & SELECT) { - ct++; - efa->e2->f1++; - if(efa->e2->f1 > 2) { - error("3+ face edge"); - return 0; - } - } - if(efa->e3->f & SELECT) { - ct++; - efa->e3->f1++; - if(efa->e3->f1 > 2) { - error("3+ face edge"); - return 0; - } - } - if(efa->e4 && efa->e4->f & SELECT) { - ct++; - efa->e4->f1++; - if(efa->e4->f1 > 2) { - error("3+ face edge"); - return 0; - } - } - // Make sure loop is not 2 edges of same face - if(ct > 1) { - error("loop crosses itself"); - return 0; - } - } - // Get # of selected verts - for(ev=em->verts.first;ev;ev=ev->next) { - if(ev->f & SELECT) vertsel++; - } - - // Test for multiple segments - if(vertsel > numsel+1) { - error("Was not a single edge loop"); - return 0; - } - - // Get the edgeloop in order - mark f1 with SELECT once added - for(eed=em->edges.first;eed;eed=eed->next) { - if((eed->f & SELECT) && !(eed->f1 & SELECT)) { - // If this is the first edge added, just put it in - if(!edgelist) { - BLI_linklist_prepend(&edgelist,eed); - numadded++; - first = eed; - last = eed; - eed->f1 = SELECT; - } else { - if(editedge_getSharedVert(eed, last)) { - BLI_linklist_append(&edgelist,eed); - eed->f1 = SELECT; - numadded++; - last = eed; - } else if(editedge_getSharedVert(eed, first)) { - BLI_linklist_prepend(&edgelist,eed); - eed->f1 = SELECT; - numadded++; - first = eed; - } - } - } - if(eed->next == NULL && numadded != numsel) { - eed=em->edges.first; - timesthrough++; - } - - // It looks like there was an unexpected case - Hopefully should not happen - if(timesthrough >= numsel*2) { - BLI_linklist_free(edgelist,NULL); - error("could not order loop"); - return 0; - } - } - - // Put the verts in order in a linklist - look = edgelist; - while(look) { - eed = look->link; - if(!vertlist) { - if(look->next) { - temp = look->next->link; - - //This is the first entry takes care of extra vert - if(eed->v1 != temp->v1 && eed->v1 != temp->v2) { - BLI_linklist_append(&vertlist,eed->v1); - eed->v1->f1 = 1; - } else { - BLI_linklist_append(&vertlist,eed->v2); - eed->v2->f1 = 1; - } - } else { - //This is the case that we only have 1 edge - BLI_linklist_append(&vertlist,eed->v1); - eed->v1->f1 = 1; - } - } - // for all the entries - if(eed->v1->f1 != 1) { - BLI_linklist_append(&vertlist,eed->v1); - eed->v1->f1 = 1; - } else if(eed->v2->f1 != 1) { - BLI_linklist_append(&vertlist,eed->v2); - eed->v2->f1 = 1; - } - look = look->next; - } - - // populate the SlideVerts - - vertgh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp); - look = vertlist; - while(look) { - i=0; - j=0; - ev = look->link; - tempsv = (struct SlideVert*)MEM_mallocN(sizeof(struct SlideVert),"SlideVert"); - tempsv->up = NULL; - tempsv->down = NULL; - tempsv->origvert.co[0] = ev->co[0]; - tempsv->origvert.co[1] = ev->co[1]; - tempsv->origvert.co[2] = ev->co[2]; - tempsv->origvert.no[0] = ev->no[0]; - tempsv->origvert.no[1] = ev->no[1]; - tempsv->origvert.no[2] = ev->no[2]; - // i is total edges that vert is on - // j is total selected edges that vert is on - - for(eed=em->edges.first;eed;eed=eed->next) { - if(eed->v1 == ev || eed->v2 == ev) { - i++; - if(eed->f & SELECT) { - j++; - } - } - } - // If the vert is in the middle of an edge loop, it touches 2 selected edges and 2 unselected edges - if(i == 4 && j == 2) { - for(eed=em->edges.first;eed;eed=eed->next) { - if(editedge_containsVert(eed, ev)) { - if(!(eed->f & SELECT)) { - if(!tempsv->up) { - tempsv->up = eed; - } else if (!(tempsv->down)) { - tempsv->down = eed; - } - } - } - } - } - // If it is on the end of the loop, it touches 1 selected and as least 2 more unselected - if(i >= 3 && j == 1) { - for(eed=em->edges.first;eed;eed=eed->next) { - if(editedge_containsVert(eed, ev) && eed->f & SELECT) { - for(efa = em->faces.first;efa;efa=efa->next) { - if(editface_containsEdge(efa, eed)) { - if(editedge_containsVert(efa->e1, ev) && efa->e1 != eed) { - if(!tempsv->up) { - tempsv->up = efa->e1; - } else if (!(tempsv->down)) { - tempsv->down = efa->e1; - } - } - if(editedge_containsVert(efa->e2, ev) && efa->e2 != eed) { - if(!tempsv->up) { - tempsv->up = efa->e2; - } else if (!(tempsv->down)) { - tempsv->down = efa->e2; - } - } - if(editedge_containsVert(efa->e3, ev) && efa->e3 != eed) { - if(!tempsv->up) { - tempsv->up = efa->e3; - } else if (!(tempsv->down)) { - tempsv->down = efa->e3; - } - } - if(efa->e4) { - if(editedge_containsVert(efa->e4, ev) && efa->e4 != eed) { - if(!tempsv->up) { - tempsv->up = efa->e4; - } else if (!(tempsv->down)) { - tempsv->down = efa->e4; - } - } - } - - } - } - } - } - } - if(i > 4 && j == 2) { - BLI_ghash_free(vertgh, NULL, (GHashValFreeFP)MEM_freeN); - BLI_linklist_free(vertlist,NULL); - BLI_linklist_free(edgelist,NULL); - return 0; - } - BLI_ghash_insert(vertgh,ev,tempsv); - - look = look->next; - } - - // make sure the UPs nad DOWNs are 'faceloops' - // Also find the nearest slidevert to the cursor - getmouseco_areawin(mval); - look = vertlist; - nearest = NULL; - vertdist = -1; - while(look) { - tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link); - - if(!tempsv->up || !tempsv->down) { - error("Missing rails"); - BLI_ghash_free(vertgh, NULL, (GHashValFreeFP)MEM_freeN); - BLI_linklist_free(vertlist,NULL); - BLI_linklist_free(edgelist,NULL); - return 0; - } - - if(G.f & G_DRAW_EDGELEN) { - if(!(tempsv->up->f & SELECT)) { - tempsv->up->f |= SELECT; - tempsv->up->f2 |= 16; - } else { - tempsv->up->f2 |= ~16; - } - if(!(tempsv->down->f & SELECT)) { - tempsv->down->f |= SELECT; - tempsv->down->f2 |= 16; - } else { - tempsv->down->f2 |= ~16; - } - } - - if(look->next != NULL) { - SlideVert *sv; - - sv = BLI_ghash_lookup(vertgh,(EditVert*)look->next->link); - - if(sv) { - float tempdist, co[2]; - - if(!sharesFace(tempsv->up,sv->up)) { - EditEdge *swap; - swap = sv->up; - sv->up = sv->down; - sv->down = swap; - } - - view3d_project_float(curarea, tempsv->origvert.co, co, projectMat); - - tempdist = sqrt(pow(co[0] - mval[0],2)+pow(co[1] - mval[1],2)); - - if(vertdist < 0) { - vertdist = tempdist; - nearest = (EditVert*)look->link; - } else if ( tempdist < vertdist ) { - vertdist = tempdist; - nearest = (EditVert*)look->link; - } - } - } - - - - look = look->next; - } - - - if (uvlay_tot && (G.scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)) { - int maxnum = 0; - uvarray = MEM_callocN( uvlay_tot * sizeof(GHash *), "SlideUVs Array"); - suv_last = slideuvs = MEM_callocN( uvlay_tot * (numadded+1) * sizeof(SlideUv), "SlideUVs"); /* uvLayers * verts */ - suv = NULL; - - for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) { - - uvarray[uvlay_idx] = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp); - - for(ev=em->verts.first;ev;ev=ev->next) { - ev->tmp.l = 0; - } - look = vertlist; - while(look) { - float *uv_new; - tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link); - - ev = look->link; - suv = NULL; - for(efa = em->faces.first;efa;efa=efa->next) { - if (ev->tmp.l != -1) { /* test for self, in this case its invalid */ - int k=-1; /* face corner */ - - /* Is this vert in the faces corner? */ - if (efa->v1==ev) k=0; - else if (efa->v2==ev) k=1; - else if (efa->v3==ev) k=2; - else if (efa->v4 && efa->v4==ev) k=3; - - if (k != -1) { - MTFace *tf = CustomData_em_get_n(&em->fdata, efa->data, CD_MTFACE, uvlay_idx); - EditVert *ev_up, *ev_down; - - uv_new = tf->uv[k]; - - if (ev->tmp.l) { - if (fabs(suv->origuv[0]-uv_new[0]) > 0.0001 || fabs(suv->origuv[1]-uv_new[1])) { - ev->tmp.l = -1; /* Tag as invalid */ - BLI_linklist_free(suv->fuv_list,NULL); - suv->fuv_list = NULL; - BLI_ghash_remove(uvarray[uvlay_idx],ev, NULL, NULL); - suv = NULL; - break; - } - } else { - ev->tmp.l = 1; - suv = suv_last; - - suv->fuv_list = NULL; - suv->uv_up = suv->uv_down = NULL; - suv->origuv[0] = uv_new[0]; - suv->origuv[1] = uv_new[1]; - - BLI_linklist_prepend(&suv->fuv_list, uv_new); - BLI_ghash_insert(uvarray[uvlay_idx],ev,suv); - - suv_last++; /* advance to next slide UV */ - maxnum++; - } - - /* Now get the uvs along the up or down edge if we can */ - if (suv) { - if (!suv->uv_up) { - ev_up = editedge_getOtherVert(tempsv->up,ev); - if (efa->v1==ev_up) suv->uv_up = tf->uv[0]; - else if (efa->v2==ev_up) suv->uv_up = tf->uv[1]; - else if (efa->v3==ev_up) suv->uv_up = tf->uv[2]; - else if (efa->v4 && efa->v4==ev_up) suv->uv_up = tf->uv[3]; - } - if (!suv->uv_down) { /* if the first face was apart of the up edge, it cant be apart of the down edge */ - ev_down = editedge_getOtherVert(tempsv->down,ev); - if (efa->v1==ev_down) suv->uv_down = tf->uv[0]; - else if (efa->v2==ev_down) suv->uv_down = tf->uv[1]; - else if (efa->v3==ev_down) suv->uv_down = tf->uv[2]; - else if (efa->v4 && efa->v4==ev_down) suv->uv_down = tf->uv[3]; - } - - /* Copy the pointers to the face UV's */ - BLI_linklist_prepend(&suv->fuv_list, uv_new); - } - } - } - } - look = look->next; - } - } /* end uv layer loop */ - } /* end uvlay_tot */ - - - - // we should have enough info now to slide - - len = 0.0f; - - percp = -1; - while(draw) { - /* For the % calculation */ - short mval[2]; - float rc[2]; - float v2[2], v3[2]; - EditVert *centerVert, *upVert, *downVert; - - getmouseco_areawin(mval); - - if (!immediate && (mval[0] == mvalo[0] && mval[1] == mvalo[1])) { - PIL_sleep_ms(10); - } else { - char *p = str;; - - mvalo[0] = mval[0]; - mvalo[1] = mval[1]; - - - tempsv = BLI_ghash_lookup(vertgh,nearest); - - centerVert = editedge_getSharedVert(tempsv->up, tempsv->down); - upVert = editedge_getOtherVert(tempsv->up, centerVert); - downVert = editedge_getOtherVert(tempsv->down, centerVert); - - view3d_project_float(curarea, upVert->co, v2, projectMat); - view3d_project_float(curarea, downVert->co, v3, projectMat); - - /* Determine the % on which the loop should be cut */ - - rc[0]= v3[0]-v2[0]; - rc[1]= v3[1]-v2[1]; - len= rc[0]*rc[0]+ rc[1]*rc[1]; - if (len==0) {len = 0.0001;} - - if ((G.qual & LR_SHIFTKEY)==0) { - wasshift = 0; - labda= ( rc[0]*((mval[0]-v2[0])) + rc[1]*((mval[1]-v2[1])) )/len; - } - else { - if (wasshift==0) { - wasshift = 1; - shiftlabda = labda; - } - labda= ( rc[0]*((mval[0]-v2[0])) + rc[1]*((mval[1]-v2[1])) )/len / 10.0 + shiftlabda; - } - - - if(labda<=0.0) labda=0.0; - else if(labda>=1.0)labda=1.0; - - perc=((1-labda)*2)-1; - - if(G.qual == 0) { - perc *= 100; - perc = floor(perc); - perc /= 100; - } else if (G.qual == LR_CTRLKEY) { - perc *= 10; - perc = floor(perc); - perc /= 10; - } - - if(prop == 0) { - len = len_v3v3(upVert->co,downVert->co)*((perc+1)/2); - if(flip == 1) { - len = len_v3v3(upVert->co,downVert->co) - len; - } - } - - if (hasNumInput(&num)) - { - applyNumInput(&num, &perc); - - if (prop) - { - perc = MIN2(perc, 1); - perc = MAX2(perc, -1); - } - else - { - len = MIN2(perc, len_v3v3(upVert->co,downVert->co)); - len = MAX2(len, 0); - } - } - - //Adjust Edgeloop - if(immediate) { - perc = imperc; - } - percp = perc; - if(prop) { - look = vertlist; - while(look) { - EditVert *tempev; - ev = look->link; - tempsv = BLI_ghash_lookup(vertgh,ev); - - tempev = editedge_getOtherVert((perc>=0)?tempsv->up:tempsv->down, ev); - interp_v3_v3v3(ev->co, tempsv->origvert.co, tempev->co, fabs(perc)); - - if (G.scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) { - for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) { - suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev ); - if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) { - interp_v2_v2v2(uv_tmp, suv->origuv, (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc)); - fuv_link = suv->fuv_list; - while (fuv_link) { - copy_v2_v2(((float *)fuv_link->link), uv_tmp); - fuv_link = fuv_link->next; - } - } - } - } - - look = look->next; - } - } - else { - //Non prop code - look = vertlist; - while(look) { - float newlen; - ev = look->link; - tempsv = BLI_ghash_lookup(vertgh,ev); - newlen = (len / len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co)); - if(newlen > 1.0) {newlen = 1.0;} - if(newlen < 0.0) {newlen = 0.0;} - if(flip == 0) { - interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen)); - if (G.scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) { - /* dont do anything if no UVs */ - for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) { - suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev ); - if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) { - interp_v2_v2v2(uv_tmp, suv->uv_down, suv->uv_up, fabs(newlen)); - fuv_link = suv->fuv_list; - while (fuv_link) { - copy_v2_v2(((float *)fuv_link->link), uv_tmp); - fuv_link = fuv_link->next; - } - } - } - } - } else{ - interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen)); - - if (G.scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) { - /* dont do anything if no UVs */ - for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) { - suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev ); - if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) { - interp_v2_v2v2(uv_tmp, suv->uv_up, suv->uv_down, fabs(newlen)); - fuv_link = suv->fuv_list; - while (fuv_link) { - copy_v2_v2(((float *)fuv_link->link), uv_tmp); - fuv_link = fuv_link->next; - } - } - } - } - } - look = look->next; - } - - } - - // Highlight the Control Edges - scrarea_do_windraw(curarea); - persp(PERSP_VIEW); - glPushMatrix(); - mymultmatrix(G.obedit->obmat); - - glColor3ub(0, 255, 0); - glBegin(GL_LINES); - glVertex3fv(upVert->co); - glVertex3fv(downVert->co); - glEnd(); - - if(prop == 0) { - // draw start edge for non-prop - glPointSize(5); - glBegin(GL_POINTS); - glColor3ub(255,0,255); - if(flip) { - glVertex3fv(upVert->co); - } else { - glVertex3fv(downVert->co); - } - glEnd(); - } - - - glPopMatrix(); - - if(prop) { - p += sprintf(str, "(P)ercentage: "); - } else { - p += sprintf(str, "Non (P)rop Length: "); - } - - if (hasNumInput(&num)) - { - char num_str[20]; - - outputNumInput(&num, num_str); - p += sprintf(p, "%s", num_str); - } - else - { - if (prop) - { - p += sprintf(p, "%f", perc); - } - else - { - p += sprintf(p, "%f", len); - } - } - - - if (prop == 0) { - p += sprintf(p, ", Press (F) to flip control side"); - } - - headerprint(str); - screen_swapbuffers(); - } - if(!immediate) { - while(qtest()) { - short val=0; - event= extern_qread(&val); // extern_qread stores important events for the mainloop to handle - - /* val==0 on key-release event */ - if (val) { - if(ELEM(event, ESCKEY, RIGHTMOUSE)) { - prop = 1; // Go back to prop mode - imperc = 0; // This is the % that gets set for immediate - immediate = 1; //Run through eval code 1 more time - cancel = 1; // Return -1 - mvalo[0] = -1; - } else if(ELEM3(event, PADENTER, LEFTMOUSE, RETKEY)) { - draw = 0; // End looping now - } else if(event==MIDDLEMOUSE) { - perc = 0; - immediate = 1; - } else if(event==PKEY) { - initNumInput(&num); /* reset num input */ - if (prop) { - prop = 0; - num.flag |= NUM_NO_NEGATIVE; - } - else { - prop = 1; - } - mvalo[0] = -1; - } else if(event==FKEY) { - (flip == 1) ? (flip = 0):(flip = 1); - mvalo[0] = -1; - } else if(ELEM(event, RIGHTARROWKEY, WHEELUPMOUSE)) { // Scroll through Control Edges - look = vertlist; - while(look) { - if(nearest == (EditVert*)look->link) { - if(look->next == NULL) { - nearest = (EditVert*)vertlist->link; - } else { - nearest = (EditVert*)look->next->link; - } - mvalo[0] = -1; - break; - } - look = look->next; - } - } else if(ELEM(event, LEFTARROWKEY, WHEELDOWNMOUSE)) { // Scroll through Control Edges - look = vertlist; - while(look) { - if(look->next) { - if(look->next->link == nearest) { - nearest = (EditVert*)look->link; - mvalo[0] = -1; - break; - } - } else { - if((EditVert*)vertlist->link == nearest) { - nearest = look->link; - mvalo[0] = -1; - break; - } - } - look = look->next; - } - } - - if (handleNumInput(&num, event)) - { - mvalo[0] = -1; /* NEED A BETTER WAY TO TRIGGER REDRAW */ - } - } - - } - } else { - draw = 0; - } - DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); - } - - - if(G.f & G_DRAW_EDGELEN) { - look = vertlist; - while(look) { - tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link); - if(tempsv != NULL) { - tempsv->up->f &= !SELECT; - tempsv->down->f &= !SELECT; - } - look = look->next; - } - } - - force_draw(0); - - if(!immediate) - EM_automerge(0); - DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); - scrarea_queue_winredraw(curarea); - - //BLI_ghash_free(edgesgh, freeGHash, NULL); - BLI_ghash_free(vertgh, NULL, (GHashValFreeFP)MEM_freeN); - BLI_linklist_free(vertlist,NULL); - BLI_linklist_free(edgelist,NULL); - - if (uvlay_tot && (G.scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)) { - for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) { - BLI_ghash_free(uvarray[uvlay_idx], NULL, NULL); - } - MEM_freeN(uvarray); - MEM_freeN(slideuvs); - - suv = suv_last-1; - while (suv >= slideuvs) { - if (suv->fuv_list) { - BLI_linklist_free(suv->fuv_list,NULL); - } - suv--; - } - - allqueue(REDRAWIMAGE, 0); - } - - if(cancel == 1) { - return -1; - } - else { -#ifdef WITH_VERSE - if(G.editMesh->vnode) { - sync_all_verseverts_with_editverts((VNode*)G.editMesh->vnode); - sync_all_versefaces_with_editfaces((VNode*)G.editMesh->vnode); - } -#endif - } - return 1; -} - /* -------------------- More tools ------------------ */ void mesh_set_face_flags(short mode) diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 22568cd676e..2f5272e37b0 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4607,8 +4607,6 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) } } - // XXX retopo_do_all(); - if(ok) { test2DNurb(nu); @@ -4636,7 +4634,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event) { RegionView3D *rv3d= CTX_wm_region_view3d(C); - if(rv3d && !RNA_property_is_set(op->ptr, "location")) { + if(rv3d && !RNA_struct_property_is_set(op->ptr, "location")) { Curve *cu; ViewContext vc; float location[3]; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index cd12cc78ad5..e629a09ca70 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -398,7 +398,7 @@ static int paste_file_exec(bContext *C, wmOperator *op) static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return paste_file_exec(C, op); WM_event_add_fileselect(C, op); @@ -1190,7 +1190,7 @@ static int insert_text_exec(bContext *C, wmOperator *op) wchar_t *inserted_text; int a, len; - if(!RNA_property_is_set(op->ptr, "text")) + if(!RNA_struct_property_is_set(op->ptr, "text")) return OPERATOR_CANCELLED; inserted_utf8= RNA_string_get_alloc(op->ptr, "text", NULL, 0); @@ -1223,10 +1223,10 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) int event= evt->type, val= evt->val; wchar_t inserted_text[2]= {0}; - if(RNA_property_is_set(op->ptr, "text")) + if(RNA_struct_property_is_set(op->ptr, "text")) return insert_text_exec(C, op); - if(RNA_property_is_set(op->ptr, "accent")) { + if(RNA_struct_property_is_set(op->ptr, "accent")) { if(cu->len!=0 && cu->pos>0) accentcode= 1; return OPERATOR_FINISHED; @@ -1673,7 +1673,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0)? font->name: U.fontdir; - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return font_open_exec(C, op); RNA_string_set(op->ptr, "filepath", path); diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 27c61e98e21..957b58b141c 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -66,5 +66,8 @@ int ED_space_image_show_uvshadow(struct SpaceImage *sima, struct Object *obedit) /* UI level image (texture) updating... render calls own stuff (too) */ void ED_image_update_frame(const struct Main *mainp, int cfra); +void ED_image_draw_info(struct ARegion *ar, int color_manage, int channels, + int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf); + #endif /* ED_IMAGE_H */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 239dae7d236..7ff69277843 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -831,7 +831,9 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) if(but->optype) { IDProperty *prop= (but->opptr)? but->opptr->data: NULL; - if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, buf, sizeof(buf))) { + if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, + buf, sizeof(buf))) + { UI_MENU_KEY_STR_CAT } } @@ -846,7 +848,9 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) IDP_AssignString(prop_menu_name, mt->idname, sizeof(mt->idname)); - if(WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE, buf, sizeof(buf))) { + if(WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE, + buf, sizeof(buf))) + { UI_MENU_KEY_STR_CAT } } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 525b15ac7e3..3a19bb2a90c 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4388,7 +4388,9 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event)) IDProperty *prop= (but->opptr)? but->opptr->data: NULL; /* complex code to change name of button */ - if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, buf, sizeof(buf))) { + if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, + buf, sizeof(buf))) + { char *butstr_orig; // XXX but->str changed... should not, remove the hotkey from it diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 5e42b06e1a7..a01efa25d19 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2742,6 +2742,11 @@ const char *uiLayoutIntrospect(uiLayout *layout) return str; } +static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt, void *UNUSED(arg_dummy2)) +{ + WM_operator_properties_reset((wmOperator *)op_pt); +} + /* this function does not initialize the layout, functions can be called on the layout before and after */ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag) { @@ -2803,7 +2808,22 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in uiItemL(layout, IFACE_("No Properties"), ICON_NONE); } } - + + /* its possible that reset can do nothing if all have PROP_SKIP_SAVE enabled + * but this is not so important if this button is drawn in those cases + * (which isn't all that likely anyway) - campbell */ + if (op->properties->len) { + uiBlock *block; + uiBut *but; + uiLayout *col; /* needed to avoid alignment errors with previous buttons */ + + col= uiLayoutColumn(layout, 0); + block= uiLayoutGetBlock(col); + but = uiDefIconTextBut(block , BUT, 0, ICON_FILE_REFRESH, "Reset", 0, 0, 18, 20, NULL, 0.0, 0.0, 0.0, 0.0, + "Reset operator defaults"); + uiButSetFunc(but, ui_layout_operator_buts__reset_cb, op, NULL); + } + /* set various special settings for buttons */ { uiBut *but; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 973b43fca78..0c5aed83c1b 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -409,7 +409,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* operator keymap (not menus, they already have it) */ prop= (but->opptr)? but->opptr->data: NULL; - if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, buf, sizeof(buf))) { + if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, + buf, sizeof(buf))) + { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf); data->color[data->totline]= 0x888888; data->totline++; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 44224c808cc..9cf93980c2c 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -181,7 +181,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) /* fake button, it holds space for search items */ uiDefBut(block, LABEL, 0, "", 10, 15, w, h, NULL, 0, 0, 0, 0, NULL); - but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 0, w, 19, template.prv_rows, template.prv_cols, ""); + but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, 19, template.prv_rows, template.prv_cols, ""); uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data); } /* list view */ @@ -189,7 +189,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) /* fake button, it holds space for search items */ uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); - but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 0, 150, 19, 0, 0, ""); + but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, ""); uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data); } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 5618d37712a..bf2f66e95f8 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -165,14 +165,14 @@ static unsigned int check_tria_face[4][3]= { GLubyte checker_stipple_sml[32*32/8] = { - 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ - 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ - 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ - 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ - 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ - 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \ - 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ - 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \ + 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, + 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, + 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, + 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, + 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, + 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, + 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, + 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, }; /* ************************************************* */ diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index c200a12dad5..baee3fcb23d 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -4827,7 +4827,7 @@ static int export_obj_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) BLI_strncpy(filename, "//untitled.obj", FILE_MAX); - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return mesh_export_obj_exec(C, op); export_obj_filesel(C, op, filename); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 8ba4bb15849..74e3e189f40 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -533,7 +533,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) } /* check input variables */ - if(RNA_property_is_set(op->ptr, "filepath")) { + if(RNA_struct_property_is_set(op->ptr, "filepath")) { char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index a2d73ac8b5d..48b1630025c 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -189,35 +189,40 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) PropertyRNA *prop; /* note: this property gets hidden for add-camera operator */ - prop= RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view"); + prop = RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view"); RNA_def_property_update_runtime(prop, view_align_update); if(do_editmode) { - prop= RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode", "Enter editmode when adding this object"); - RNA_def_property_flag(prop, PROP_HIDDEN); + prop = RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode", + "Enter editmode when adding this object"); + RNA_def_property_flag(prop, PROP_HIDDEN|PROP_SKIP_SAVE); } - RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object", -FLT_MAX, FLT_MAX); - RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f); + prop = RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", + "Location for the newly added object", -FLT_MAX, FLT_MAX); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", + "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", ""); - RNA_def_property_flag(prop, PROP_HIDDEN); + RNA_def_property_flag(prop, PROP_HIDDEN|PROP_SKIP_SAVE); } static void object_add_generic_invoke_options(bContext *C, wmOperator *op) { if(RNA_struct_find_property(op->ptr, "enter_editmode")) /* optional */ - if (!RNA_property_is_set(op->ptr, "enter_editmode")) + if (!RNA_struct_property_is_set(op->ptr, "enter_editmode")) RNA_boolean_set(op->ptr, "enter_editmode", U.flag & USER_ADD_EDITMODE); - if(!RNA_property_is_set(op->ptr, "location")) { + if(!RNA_struct_property_is_set(op->ptr, "location")) { float loc[3]; ED_object_location_from_view(C, loc); RNA_float_set_array(op->ptr, "location", loc); } - if(!RNA_property_is_set(op->ptr, "layers")) { + if(!RNA_struct_property_is_set(op->ptr, "layers")) { View3D *v3d = CTX_wm_view3d(C); Scene *scene = CTX_data_scene(C); int a, values[20], layer; @@ -257,7 +262,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, *enter_editmode = TRUE; } - if(RNA_property_is_set(op->ptr, "layers")) { + if(RNA_struct_property_is_set(op->ptr, "layers")) { RNA_boolean_get_array(op->ptr, "layers", layer_values); *layer= 0; for(a=0; a<20; a++) { @@ -278,9 +283,9 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, if(v3d && v3d->localvd) *layer |= v3d->lay; - if(RNA_property_is_set(op->ptr, "rotation")) + if(RNA_struct_property_is_set(op->ptr, "rotation")) view_align = FALSE; - else if (RNA_property_is_set(op->ptr, "view_align")) + else if (RNA_struct_property_is_set(op->ptr, "view_align")) view_align = RNA_boolean_get(op->ptr, "view_align"); else { view_align = U.flag & USER_ADD_VIEWALIGNED; diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index ac73f03c2d7..a90edb29c29 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -553,7 +553,7 @@ static int edit_constraint_invoke_properties(bContext *C, wmOperator *op) bConstraint *con; ListBase *list; - if (RNA_property_is_set(op->ptr, "constraint") && RNA_property_is_set(op->ptr, "owner")) + if (RNA_struct_property_is_set(op->ptr, "constraint") && RNA_struct_property_is_set(op->ptr, "owner")) return 1; if (ptr.data) { diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index ea39e857643..5f313301e2e 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -322,9 +322,6 @@ void ED_object_exit_editmode(bContext *C, int flag) // if(EM_texFaceCheck()) -// if(retopo_mesh_paint_check()) -// retopo_end_okee(); - if(me->edit_btmesh->bm->totvert>MESH_MAX_VERTS) { error("Too many vertices"); return; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 1e7cd9f7624..37ce9c268a4 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -748,7 +748,7 @@ static int edit_modifier_invoke_properties(bContext *C, wmOperator *op) PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier); ModifierData *md; - if (RNA_property_is_set(op->ptr, "modifier")) + if (RNA_struct_property_is_set(op->ptr, "modifier")) return 1; if (ptr.data) { @@ -1281,7 +1281,7 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U if(CustomData_external_test(&me->ldata, CD_MDISPS)) return OPERATOR_CANCELLED; - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return multires_external_save_exec(C, op); op->customdata= me; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 56fd1b4409a..3aa604d48c0 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1054,7 +1054,7 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op) int values[20], a; unsigned int lay= 0; - if(!RNA_property_is_set(op->ptr, "layers")) { + if(!RNA_struct_property_is_set(op->ptr, "layers")) { /* note: layers are set in bases, library objects work for this */ CTX_DATA_BEGIN(C, Base*, base, selected_bases) { lay |= base->lay; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 24061defa7c..68c017adecd 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -646,7 +646,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) /* get the view settings if 'around' isnt set and the view is available */ View3D *v3d= CTX_wm_view3d(C); copy_v3_v3(cursor, give_cursor(scene, v3d)); - if(v3d && !RNA_property_is_set(op->ptr, "center")) + if(v3d && !RNA_struct_property_is_set(op->ptr, "center")) around= v3d->around; } diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 0bb5dbef0ea..d652d2c0e5c 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -884,7 +884,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor if(getenv(strEnvName)) { int dlevel = atoi(getenv(strEnvName)); elbeemSetDebugLevel(dlevel); - BLI_snprintf(debugStrBuffer,256,"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName); + BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName); elbeemDebugOut(debugStrBuffer); } @@ -921,7 +921,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor /* rough check of settings... */ if(domainSettings->previewresxyz > domainSettings->resolutionxyz) { - BLI_snprintf(debugStrBuffer,256,"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz); + BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz); elbeemDebugOut(debugStrBuffer); domainSettings->previewresxyz = domainSettings->resolutionxyz; } @@ -941,7 +941,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor } else { gridlevels = domainSettings->maxRefine; } - BLI_snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels ); + BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels ); elbeemDebugOut(debugStrBuffer); @@ -993,7 +993,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor /* ******** init domain object's matrix ******** */ copy_m4_m4(domainMat, fsDomain->obmat); if(!invert_m4_m4(invDomMat, domainMat)) { - BLI_snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n"); + BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::error - Invalid obj matrix?\n"); elbeemDebugOut(debugStrBuffer); BKE_report(reports, RPT_ERROR, "Invalid object matrix"); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index e4597d6afc3..e35df217761 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -160,7 +160,7 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **scene, SceneRenderLayer **srl) { /* single layer re-render */ - if(RNA_property_is_set(op->ptr, "scene")) { + if(RNA_struct_property_is_set(op->ptr, "scene")) { Scene *scn; char scene_name[MAX_ID_NAME-2]; @@ -176,7 +176,7 @@ static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **s } } - if(RNA_property_is_set(op->ptr, "layer")) { + if(RNA_struct_property_is_set(op->ptr, "layer")) { SceneRenderLayer *rl; char rl_name[RE_MAXNAME]; @@ -537,7 +537,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) /* custom scene and single layer re-render */ screen_render_scene_layer_set(op, mainp, &scene, &srl); - if(RNA_property_is_set(op->ptr, "layer")) + if(RNA_struct_property_is_set(op->ptr, "layer")) jobflag |= WM_JOB_SUSPEND; /* job custom data */ diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 361b01fe6e0..66f0e429b76 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -40,6 +40,7 @@ #include "BLI_editVert.h" #include "BLI_dlrbTree.h" #include "BLI_utildefines.h" +#include "BLI_jitter.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" @@ -150,28 +151,31 @@ static void screen_opengl_render_apply(OGLRender *oglrender) } else { /* simple accumulation, less hassle then FSAA FBO's */ -# define SAMPLES 5 /* fixed, easy to have more but for now this is ok */ - const float jit_ofs[SAMPLES][2] = {{0, 0}, {0.5f, 0.5f}, {-0.5f,-0.5f}, {-0.5f, 0.5f}, {0.5f, -0.5f}}; + static float jit_ofs[32][2]; float winmat_jitter[4][4]; float *accum_buffer= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum1"); float *accum_tmp= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum2"); int j; + BLI_initjit(jit_ofs[0], scene->r.osa); + /* first sample buffer, also initializes 'rv3d->persmat' */ ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat); GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_buffer); /* skip the first sample */ - for(j=1; j < SAMPLES; j++) { + for(j=1; j < scene->r.osa; j++) { copy_m4_m4(winmat_jitter, winmat); - window_translate_m4(winmat_jitter, rv3d->persmat, jit_ofs[j][0] / sizex, jit_ofs[j][1] / sizey); + window_translate_m4(winmat_jitter, rv3d->persmat, + (jit_ofs[j][0] * 2.0f) / sizex, + (jit_ofs[j][1] * 2.0f) / sizey); ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat_jitter); GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_tmp); add_vn_vn(accum_buffer, accum_tmp, sizex*sizey*sizeof(float)); } - mul_vn_vn_fl(rr->rectf, accum_buffer, sizex*sizey*sizeof(float), 1.0/SAMPLES); + mul_vn_vn_fl(rr->rectf, accum_buffer, sizex*sizey*sizeof(float), 1.0f / scene->r.osa); MEM_freeN(accum_buffer); MEM_freeN(accum_tmp); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 86328ca2a64..3e34a55a3d9 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -104,7 +104,7 @@ ImBuf* get_brush_icon(Brush *brush) { static const int flags = IB_rect|IB_multilayer|IB_metadata; - char path[240]; + char path[FILE_MAX]; char *folder; if (!(brush->icon_imbuf)) { diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index a9025b8cdfc..01d3811cce8 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -705,7 +705,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event { //Scene *scene= CTX_data_scene(C); - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return envmap_save_exec(C, op); //RNA_enum_set(op->ptr, "file_type", scene->r.im_format.imtype); diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 3a0202ad546..25b8b8415d9 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1689,8 +1689,6 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa) /* XXX bad code: setscreen() ends with first area active. fullscreen render assumes this too */ CTX_wm_area_set(C, sc->areabase.first); - /* XXX retopo_force_update(); */ - return sc->areabase.first; } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index b2192b9dabb..eaca87f2d6f 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1346,12 +1346,12 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event) int x, y; /* retrieve initial mouse coord, so we can find the active edge */ - if(RNA_property_is_set(op->ptr, "mouse_x")) + if(RNA_struct_property_is_set(op->ptr, "mouse_x")) x= RNA_int_get(op->ptr, "mouse_x"); else x= event->x; - if(RNA_property_is_set(op->ptr, "mouse_y")) + if(RNA_struct_property_is_set(op->ptr, "mouse_y")) y= RNA_int_get(op->ptr, "mouse_y"); else y= event->x; @@ -3060,7 +3060,7 @@ static int screen_animation_play_exec(bContext *C, wmOperator *op) int mode= (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1; int sync= -1; - if (RNA_property_is_set(op->ptr, "sync")) + if (RNA_struct_property_is_set(op->ptr, "sync")) sync= (RNA_boolean_get(op->ptr, "sync")); return ED_screen_animation_play(C, sync, mode); diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index fe2dc1fb913..043def31a23 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -198,7 +198,7 @@ static int screenshot_exec(bContext *C, wmOperator *op) static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(screenshot_data_create(C, op)) { - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return screenshot_exec(C, op); RNA_string_set(op->ptr, "filepath", G.ima); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 59181aba6e4..50583c2bbfb 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4862,7 +4862,7 @@ static int texture_paint_init(bContext *C, wmOperator *op) image_undo_restore, image_undo_free); /* create painter */ - pop->painter= brush_painter_new(pop->s.brush); + pop->painter= brush_painter_new(scene, pop->s.brush); return 1; } @@ -4968,6 +4968,7 @@ static int paint_exec(bContext *C, wmOperator *op) static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) { + const Scene *scene = CTX_data_scene(C); PaintOperation *pop= op->customdata; wmTabletData *wmtab; PointerRNA itemptr; @@ -4999,13 +5000,13 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) /* special exception here for too high pressure values on first touch in windows for some tablets, then we just skip first touch .. */ - if (tablet && (pressure >= 0.99f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || brush_use_alpha_pressure(pop->s.brush) || brush_use_size_pressure(pop->s.brush))) + if (tablet && (pressure >= 0.99f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || brush_use_alpha_pressure(scene, pop->s.brush) || brush_use_size_pressure(scene, pop->s.brush))) return; /* This can be removed once fixed properly in brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user) at zero pressure we should do nothing 1/2^12 is .0002 which is the sensitivity of the most sensitive pen tablet available*/ - if (tablet && (pressure < .0002f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || brush_use_alpha_pressure(pop->s.brush) || brush_use_size_pressure(pop->s.brush))) + if (tablet && (pressure < .0002f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || brush_use_alpha_pressure(scene, pop->s.brush) || brush_use_size_pressure(scene, pop->s.brush))) return; } diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 7cff37e8814..ca5abc16ec8 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -453,7 +453,7 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush, glTranslatef(-0.5f, -0.5f, 0); /* scale based on tablet pressure */ - if(sd->draw_pressure && brush_use_size_pressure(brush)) { + if(sd->draw_pressure && brush_use_size_pressure(vc->scene, brush)) { glTranslatef(0.5f, 0.5f, 0); glScalef(1.0f/sd->pressure_value, 1.0f/sd->pressure_value, 1); glTranslatef(-0.5f, -0.5f, 0); @@ -515,7 +515,7 @@ static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc, /* TODO: check whether this should really only be done when brush is over mesh? */ - if(sd->draw_pressure && brush_use_alpha_pressure(brush)) + if(sd->draw_pressure && brush_use_alpha_pressure(vc->scene, brush)) (*visual_strength) *= sd->pressure_value; if(sd->draw_anchored) @@ -529,16 +529,17 @@ static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc, unprojected_radius = paint_calc_object_space_radius(vc, location, projected_radius); - if(sd->draw_pressure && brush_use_size_pressure(brush)) + if(sd->draw_pressure && brush_use_size_pressure(vc->scene, brush)) unprojected_radius *= sd->pressure_value; - if(!brush_use_locked_size(brush)) + if(!brush_use_locked_size(vc->scene, brush)) brush_set_unprojected_radius(brush, unprojected_radius); } static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) { - Paint *paint = paint_get_active(CTX_data_scene(C)); + Scene *scene = CTX_data_scene(C); + Paint *paint = paint_get_active(scene); Brush *brush = paint_brush(paint); ViewContext vc; float final_radius; @@ -597,7 +598,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) /* draw overlay */ paint_draw_alpha_overlay(sd, brush, &vc, x, y); - if(brush_use_locked_size(brush)) + if(brush_use_locked_size(scene, brush)) brush_set_size(brush, pixel_radius); /* check if brush is subtracting, use different color then */ @@ -764,12 +765,13 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const length = len_v2(vec); if(length > FLT_EPSILON) { + const Scene *scene = CTX_data_scene(C); int steps; int i; float pressure= 1.0f; /* XXX mysterious :) what has 'use size' do with this here... if you don't check for it, pressure fails */ - if(brush_use_size_pressure(stroke->brush)) + if(brush_use_size_pressure(scene, stroke->brush)) pressure = event_tablet_data(event, NULL); if(pressure > FLT_EPSILON) { diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index e827e16f643..a64326d8d98 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2055,6 +2055,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr) { + const Scene *scene= CTX_data_scene(C); ToolSettings *ts= CTX_data_tool_settings(C); VPaint *wp= ts->wpaint; Brush *brush = paint_brush(&wp->paint); @@ -2073,8 +2074,8 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P char *defbase_sel; const float pressure = RNA_float_get(itemptr, "pressure"); - const float brush_size_final = brush_size(brush) * (brush_use_size_pressure(brush) ? pressure : 1.0f); - const float brush_alpha_final = brush_alpha(brush) * (brush_use_alpha_pressure(brush) ? pressure : 1.0f); + const float brush_size_final = brush_size(brush) * (brush_use_size_pressure(scene, brush) ? pressure : 1.0f); + const float brush_alpha_final = brush_alpha(brush) * (brush_use_alpha_pressure(scene, brush) ? pressure : 1.0f); /* intentionally dont initialize as NULL, make sure we initialize all members below */ WeightPaintInfo wpi; @@ -2567,6 +2568,7 @@ static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr) { + const Scene *scene= CTX_data_scene(C); ToolSettings *ts= CTX_data_tool_settings(C); struct VPaintData *vpd = paint_stroke_mode_data(stroke); VPaint *vp= ts->vpaint; @@ -2581,8 +2583,8 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P float mval[2]; const float pressure = RNA_float_get(itemptr, "pressure"); - const float brush_size_final = brush_size(brush) * (brush_use_size_pressure(brush) ? pressure : 1.0f); - const float brush_alpha_final = brush_alpha(brush) * (brush_use_alpha_pressure(brush) ? pressure : 1.0f); + const float brush_size_final = brush_size(brush) * (brush_use_size_pressure(scene, brush) ? pressure : 1.0f); + const float brush_alpha_final = brush_alpha(brush) * (brush_use_alpha_pressure(scene, brush) ? pressure : 1.0f); RNA_float_get_array(itemptr, "mouse", mval); flip = RNA_boolean_get(itemptr, "pen_flip"); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 694485f51f2..f323a592b07 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -549,7 +549,7 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather) const float root_alpha = brush_alpha(brush); float alpha = root_alpha*root_alpha; float dir = brush->flag & BRUSH_DIR_IN ? -1 : 1; - float pressure = brush_use_alpha_pressure(brush) ? cache->pressure : 1; + float pressure = brush_use_alpha_pressure(cache->vc->scene, brush) ? cache->pressure : 1; float pen_flip = cache->pen_flip ? -1 : 1; float invert = cache->invert ? -1 : 1; float accum = integrate_overlap(brush); @@ -3017,6 +3017,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, struct PaintStroke *stroke, PointerRNA *ptr) { + const Scene *scene = CTX_data_scene(C); SculptSession *ss = ob->sculpt; StrokeCache *cache = ss->cache; Brush *brush = paint_brush(&sd->paint); @@ -3054,7 +3055,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, cache->pixel_radius = brush_size(brush); if(cache->first_time) { - if (!brush_use_locked_size(brush)) { + if (!brush_use_locked_size(scene, brush)) { cache->initial_radius= paint_calc_object_space_radius(cache->vc, cache->true_location, brush_size(brush)); brush_set_unprojected_radius(brush, cache->initial_radius); } @@ -3063,7 +3064,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, } } - if(brush_use_size_pressure(brush)) { + if(brush_use_size_pressure(scene, brush)) { cache->pixel_radius *= cache->pressure; cache->radius= cache->initial_radius * cache->pressure; } @@ -3287,7 +3288,8 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss) /* Restore the mesh before continuing with anchored stroke */ if((brush->flag & BRUSH_ANCHORED) || - (brush->sculpt_tool == SCULPT_TOOL_GRAB && brush_use_size_pressure(brush)) || + (brush->sculpt_tool == SCULPT_TOOL_GRAB && + brush_use_size_pressure(ss->cache->vc->scene, brush)) || (brush->flag & BRUSH_RESTORE_MESH)) { StrokeCache *cache = ss->cache; diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index a82d75e6ce7..50c436d88f5 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -162,7 +162,7 @@ static int sound_open_exec(bContext *UNUSED(C), wmOperator *op) static int sound_open_invoke(bContext *C, wmOperator *op, wmEvent *event) { - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return sound_open_exec(C, op); sound_open_init(C, op); @@ -359,7 +359,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) static int sound_mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event) { - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return sound_mixdown_exec(C, op); return WM_operator_filesel(C, op, event); @@ -653,7 +653,7 @@ static int sound_unpack_exec(bContext *C, wmOperator *op) bSound* sound= NULL; /* find the suppplied image by name */ - if (RNA_property_is_set(op->ptr, "id")) { + if (RNA_struct_property_is_set(op->ptr, "id")) { char sndname[MAX_ID_NAME-2]; RNA_string_get(op->ptr, "id", sndname); sound = BLI_findstring(&CTX_data_main(C)->sound, sndname, offsetof(ID, name) + 2); @@ -675,7 +675,7 @@ static int sound_unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even Editing* ed = CTX_data_scene(C)->ed; bSound* sound; - if(RNA_property_is_set(op->ptr, "id")) + if(RNA_struct_property_is_set(op->ptr, "id")) return sound_unpack_exec(C, op); if(!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND) diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 05fdcd50067..df05521fa8d 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -103,7 +103,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) char *str, path[FILE_MAX]; const char *path_prop= RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath"; - if (RNA_property_is_set(op->ptr, path_prop)==0 || fbo==NULL) + if (RNA_struct_property_is_set(op->ptr, path_prop)==0 || fbo==NULL) return OPERATOR_CANCELLED; str= RNA_string_get_alloc(op->ptr, path_prop, NULL, 0); @@ -200,7 +200,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event) /* normally ED_fileselect_get_params would handle this but we need to because of stupid * user-prefs exception - campbell */ if(RNA_struct_find_property(op->ptr, "relative_path")) { - if(!RNA_property_is_set(op->ptr, "relative_path")) { + if(!RNA_struct_property_is_set(op->ptr, "relative_path")) { /* annoying exception!, if were dealign with the user prefs, default relative to be off */ RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS && (ptr.data != &U)); } diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index c7d09c2edfc..45c7043c44c 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -184,10 +184,10 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) if(clip) path= clip->name; - if(!RNA_property_is_set(op->ptr, "relative_path")) + if(!RNA_struct_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return open_exec(C, op); open_init(C, op); diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 23316616a57..c91c8e1bd14 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -410,7 +410,7 @@ static int console_insert_exec(bContext *C, wmOperator *op) static int console_insert_invoke(bContext *C, wmOperator *op, wmEvent *event) { - // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ + // if(!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if(!RNA_string_length(op->ptr, "text")) { /* if alt/ctrl/super are pressed pass through */ if(event->ctrl || event->oskey) { diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 1d629ad6dea..bf31775a349 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -130,7 +130,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) else params->type = FILE_SPECIAL; - if (is_filepath && RNA_property_is_set(op->ptr, "filepath")) { + if (is_filepath && RNA_struct_property_is_set(op->ptr, "filepath")) { char name[FILE_MAX]; RNA_string_get(op->ptr, "filepath", name); if (params->type == FILE_LOADLIB) { @@ -142,12 +142,12 @@ short ED_fileselect_set_params(SpaceFile *sfile) } } else { - if (is_directory && RNA_property_is_set(op->ptr, "directory")) { + if (is_directory && RNA_struct_property_is_set(op->ptr, "directory")) { RNA_string_get(op->ptr, "directory", params->dir); sfile->params->file[0]= '\0'; } - if (is_filename && RNA_property_is_set(op->ptr, "filename")) { + if (is_filename && RNA_struct_property_is_set(op->ptr, "filename")) { RNA_string_get(op->ptr, "filename", params->file); } } @@ -226,7 +226,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) } if (is_relative_path) { - if (!RNA_property_is_set(op->ptr, "relative_path")) { + if (!RNA_struct_property_is_set(op->ptr, "relative_path")) { RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); } } diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 21a4f35bcb8..41fc861f8e4 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -110,7 +110,8 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar) BKE_image_release_renderresult(scene, ima); } -void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf) +/* used by node view too */ +void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf) { char str[256]; float dx= 6; @@ -378,14 +379,14 @@ static void sima_draw_alpha_backdrop(float x1, float y1, float xsize, float ysiz { GLubyte checker_stipple[32*32/8] = { - 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, \ - 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, \ - 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, \ - 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, \ - 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, \ - 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, \ - 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, \ - 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, \ + 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, + 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, + 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, + 255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0, + 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, + 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, + 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, + 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, }; glColor3ubv(col1); diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h index 04156c80c0e..29673f74538 100644 --- a/source/blender/editors/space_image/image_intern.h +++ b/source/blender/editors/space_image/image_intern.h @@ -55,7 +55,6 @@ void IMAGE_OT_toolbox(struct wmOperatorType *ot); /* image_draw.c */ void draw_image_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene); -void draw_image_info(struct ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf); void draw_image_grease_pencil(struct bContext *C, short onlyv2d); /* image_ops.c */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0efc89e802a..999a25f57b5 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -817,7 +817,7 @@ static int image_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) if(ima) path= ima->name; - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return image_open_exec(C, op); image_open_init(C, op); @@ -876,10 +876,10 @@ static int image_replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve if(!sima->image) return OPERATOR_CANCELLED; - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return image_replace_exec(C, op); - if(!RNA_property_is_set(op->ptr, "relative_path")) + if(!RNA_struct_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", (strncmp(sima->image->name, "//", 2))==0); image_filesel(C, op, sima->image->name); @@ -1011,7 +1011,7 @@ static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op simopts->im_format= *(ImageFormatData *)op->customdata; } - if (RNA_property_is_set(op->ptr, "filepath")) { + if (RNA_struct_property_is_set(op->ptr, "filepath")) { RNA_string_get(op->ptr, "filepath", simopts->filepath); BLI_path_abs(simopts->filepath, G.main->name); } @@ -1176,7 +1176,7 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve Scene *scene= CTX_data_scene(C); SaveImageOptions simopts; - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return image_save_as_exec(C, op); if (save_image_options_init(&simopts, sima, scene, TRUE) == 0) @@ -1184,7 +1184,7 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve save_image_options_to_op(&simopts, op); /* enable save_copy by default for render results */ - if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_property_is_set(op->ptr, "copy")) { + if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_struct_property_is_set(op->ptr, "copy")) { RNA_boolean_set(op->ptr, "copy", TRUE); } @@ -1676,7 +1676,7 @@ static int image_unpack_exec(bContext *C, wmOperator *op) int method= RNA_enum_get(op->ptr, "method"); /* find the suppplied image by name */ - if (RNA_property_is_set(op->ptr, "id")) { + if (RNA_struct_property_is_set(op->ptr, "id")) { char imaname[MAX_ID_NAME-2]; RNA_string_get(op->ptr, "id", imaname); ima = BLI_findstring(&CTX_data_main(C)->image, imaname, offsetof(ID, name) + 2); @@ -1708,7 +1708,7 @@ static int image_unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even { Image *ima= CTX_data_edit_image(C); - if(RNA_property_is_set(op->ptr, "id")) + if(RNA_struct_property_is_set(op->ptr, "id")) return image_unpack_exec(C, op); if(!ima || !ima->packedfile) @@ -1772,7 +1772,7 @@ static void image_sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_ ImageSampleInfo *info= arg_info; if(info->draw) { /* no color management needed for images (color_manage=0) */ - draw_image_info(ar, 0, info->channels, info->x, info->y, info->colp, info->colfp, info->zp, info->zfp); + ED_image_draw_info(ar, 0, info->channels, info->x, info->y, info->colp, info->colfp, info->zp, info->zfp); } } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index acc2bf5349a..c9cb5bd406d 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -593,8 +593,13 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa)) /* new shading system, get image from material */ BMFace *efa = BM_get_actFace(em->bm, sloppy); - if(efa) - ED_object_get_active_image(obedit, efa->mat_nr, &sima->image, NULL, NULL); + if(efa) { + Image *node_ima; + ED_object_get_active_image(obedit, efa->mat_nr, &node_ima, NULL, NULL); + + if(node_ima) + sima->image= node_ima; + } } else { /* old shading system, we set texface */ diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index b0f5e786eef..0dfcafcf549 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -96,7 +96,7 @@ static int edit_sensor_invoke_properties(bContext *C, wmOperator *op) { PointerRNA ptr= CTX_data_pointer_get_type(C, "sensor", &RNA_Sensor); - if (RNA_property_is_set(op->ptr, "sensor") && RNA_property_is_set(op->ptr, "object") ) + if (RNA_struct_property_is_set(op->ptr, "sensor") && RNA_struct_property_is_set(op->ptr, "object") ) return 1; if (ptr.data) { @@ -152,7 +152,7 @@ static int edit_controller_invoke_properties(bContext *C, wmOperator *op) { PointerRNA ptr= CTX_data_pointer_get_type(C, "controller", &RNA_Controller); - if (RNA_property_is_set(op->ptr, "controller") && RNA_property_is_set(op->ptr, "object") ) + if (RNA_struct_property_is_set(op->ptr, "controller") && RNA_struct_property_is_set(op->ptr, "object") ) return 1; if (ptr.data) { @@ -191,7 +191,7 @@ static int edit_actuator_invoke_properties(bContext *C, wmOperator *op) { PointerRNA ptr= CTX_data_pointer_get_type(C, "actuator", &RNA_Actuator); - if (RNA_property_is_set(op->ptr, "actuator") && RNA_property_is_set(op->ptr, "object") ) + if (RNA_struct_property_is_set(op->ptr, "actuator") && RNA_struct_property_is_set(op->ptr, "object") ) return 1; if (ptr.data) { diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 3f8d9a75244..7d475973c09 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -2279,211 +2279,6 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage) } } -void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4]) -{ - char str[256]; - float dx= 6; - /* text colors */ - /* XXX colored text not allowed in Blender UI */ - #if 0 - unsigned char red[3] = {255, 50, 50}; - unsigned char green[3] = {0, 255, 0}; - unsigned char blue[3] = {100, 100, 255}; - #else - unsigned char red[3] = {255, 255, 255}; - unsigned char green[3] = {255, 255, 255}; - unsigned char blue[3] = {255, 255, 255}; - #endif - float hue=0, sat=0, val=0, lum=0, u=0, v=0; - float col[4], finalcol[4]; - - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - /* noisy, high contrast make impossible to read if lower alpha is used. */ - glColor4ub(0, 0, 0, 190); - glRecti(0.0, 0.0, ar->winrct.xmax - ar->winrct.xmin + 1, 20); - glDisable(GL_BLEND); - - BLF_size(blf_mono_font, 11, 72); - - glColor3ub(255, 255, 255); - BLI_snprintf(str, sizeof(str), "X:%-4d Y:%-4d |", x, y); - // UI_DrawString(6, 6, str); // works ok but fixed width is nicer. - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - #if 0 /* XXX no Z value in compo backdrop atm */ - if(zp) { - glColor3ub(255, 255, 255); - BLI_snprintf(str, sizeof(str), " Z:%-.4f |", 0.5f+0.5f*(((float)*zp)/(float)0x7fffffff)); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - } - if(zpf) { - glColor3ub(255, 255, 255); - BLI_snprintf(str, sizeof(str), " Z:%-.3f |", *zpf); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - } - #endif - - if(channels >= 3) { - glColor3ubv(red); - if (fp) - BLI_snprintf(str, sizeof(str), " R:%-.4f", fp[0]); - else if (cp) - BLI_snprintf(str, sizeof(str), " R:%-3d", cp[0]); - else - BLI_snprintf(str, sizeof(str), " R:-"); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - glColor3ubv(green); - if (fp) - BLI_snprintf(str, sizeof(str), " G:%-.4f", fp[1]); - else if (cp) - BLI_snprintf(str, sizeof(str), " G:%-3d", cp[1]); - else - BLI_snprintf(str, sizeof(str), " G:-"); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - glColor3ubv(blue); - if (fp) - BLI_snprintf(str, sizeof(str), " B:%-.4f", fp[2]); - else if (cp) - BLI_snprintf(str, sizeof(str), " B:%-3d", cp[2]); - else - BLI_snprintf(str, sizeof(str), " B:-"); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - if(channels == 4) { - glColor3ub(255, 255, 255); - if (fp) - BLI_snprintf(str, sizeof(str), " A:%-.4f", fp[3]); - else if (cp) - BLI_snprintf(str, sizeof(str), " A:%-3d", cp[3]); - else - BLI_snprintf(str, sizeof(str), "- "); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - } - } - - /* color rectangle */ - if (channels==1) { - if (fp) - col[0] = col[1] = col[2] = fp[0]; - else if (cp) - col[0] = col[1] = col[2] = (float)cp[0]/255.0f; - else - col[0] = col[1] = col[2] = 0.0f; - } - else if (channels==3) { - if (fp) - copy_v3_v3(col, fp); - else if (cp) { - col[0] = (float)cp[0]/255.0f; - col[1] = (float)cp[1]/255.0f; - col[2] = (float)cp[2]/255.0f; - } - else - zero_v3(col); - } - else if (channels==4) { - if (fp) - copy_v4_v4(col, fp); - else if (cp) { - col[0] = (float)cp[0]/255.0f; - col[1] = (float)cp[1]/255.0f; - col[2] = (float)cp[2]/255.0f; - col[3] = (float)cp[3]/255.0f; - } - else - zero_v4(col); - } - if (color_manage) { - linearrgb_to_srgb_v3_v3(finalcol, col); - finalcol[3] = col[3]; - } - else { - copy_v4_v4(finalcol, col); - } - glDisable(GL_BLEND); - glColor3fv(finalcol); - dx += 5; - glBegin(GL_QUADS); - glVertex2f(dx, 3); - glVertex2f(dx, 17); - glVertex2f(dx+30, 17); - glVertex2f(dx+30, 3); - glEnd(); - dx += 35; - - glColor3ub(255, 255, 255); - if(channels == 1) { - if (fp) { - rgb_to_hsv(fp[0], fp[0], fp[0], &hue, &sat, &val); - rgb_to_yuv(fp[0], fp[0], fp[0], &lum, &u, &v); - } - else if (cp) { - rgb_to_hsv((float)cp[0]/255.0f, (float)cp[0]/255.0f, (float)cp[0]/255.0f, &hue, &sat, &val); - rgb_to_yuv((float)cp[0]/255.0f, (float)cp[0]/255.0f, (float)cp[0]/255.0f, &lum, &u, &v); - } - - BLI_snprintf(str, sizeof(str), "V:%-.4f", val); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - BLI_snprintf(str, sizeof(str), " L:%-.4f", lum); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - } - else if(channels >= 3) { - if (fp) { - rgb_to_hsv(fp[0], fp[1], fp[2], &hue, &sat, &val); - rgb_to_yuv(fp[0], fp[1], fp[2], &lum, &u, &v); - } - else if (cp) { - rgb_to_hsv((float)cp[0]/255.0f, (float)cp[1]/255.0f, (float)cp[2]/255.0f, &hue, &sat, &val); - rgb_to_yuv((float)cp[0]/255.0f, (float)cp[1]/255.0f, (float)cp[2]/255.0f, &lum, &u, &v); - } - - BLI_snprintf(str, sizeof(str), "H:%-.4f", hue); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - BLI_snprintf(str, sizeof(str), " S:%-.4f", sat); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - BLI_snprintf(str, sizeof(str), " V:%-.4f", val); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - - BLI_snprintf(str, sizeof(str), " L:%-.4f", lum); - BLF_position(blf_mono_font, dx, 6, 0); - BLF_draw_ascii(blf_mono_font, str, sizeof(str)); - dx += BLF_width(blf_mono_font, str); - } - - (void)dx; -} - #if 0 /* note: needs to be userpref or opengl profile option */ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode) diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 3523e6bd9ab..5beac4ea212 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -71,6 +71,7 @@ #include "IMB_imbuf_types.h" #include "ED_node.h" +#include "ED_image.h" #include "ED_screen.h" #include "ED_space_api.h" #include "ED_render.h" @@ -758,7 +759,7 @@ static void edit_node_properties(wmOperatorType *ot) static int edit_node_invoke_properties(bContext *C, wmOperator *op) { - if (!RNA_property_is_set(op->ptr, "node")) { + if (!RNA_struct_property_is_set(op->ptr, "node")) { bNode *node= CTX_data_pointer_get_type(C, "node", &RNA_Node).data; if (!node) return 0; @@ -766,10 +767,10 @@ static int edit_node_invoke_properties(bContext *C, wmOperator *op) RNA_string_set(op->ptr, "node", node->name); } - if (!RNA_property_is_set(op->ptr, "in_out")) + if (!RNA_struct_property_is_set(op->ptr, "in_out")) RNA_enum_set(op->ptr, "in_out", SOCK_IN); - if (!RNA_property_is_set(op->ptr, "socket")) + if (!RNA_struct_property_is_set(op->ptr, "socket")) RNA_int_set(op->ptr, "socket", 0); return 1; @@ -896,13 +897,13 @@ static int node_group_socket_add_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(C); - if (RNA_property_is_set(op->ptr, "name")) + if (RNA_struct_property_is_set(op->ptr, "name")) RNA_string_get(op->ptr, "name", name); - if (RNA_property_is_set(op->ptr, "type")) + if (RNA_struct_property_is_set(op->ptr, "type")) type = RNA_enum_get(op->ptr, "type"); - if (RNA_property_is_set(op->ptr, "in_out")) + if (RNA_struct_property_is_set(op->ptr, "in_out")) in_out = RNA_enum_get(op->ptr, "in_out"); else return OPERATOR_CANCELLED; @@ -948,12 +949,12 @@ static int node_group_socket_remove_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(C); - if (RNA_property_is_set(op->ptr, "index")) + if (RNA_struct_property_is_set(op->ptr, "index")) index = RNA_int_get(op->ptr, "index"); else return OPERATOR_CANCELLED; - if (RNA_property_is_set(op->ptr, "in_out")) + if (RNA_struct_property_is_set(op->ptr, "in_out")) in_out = RNA_enum_get(op->ptr, "in_out"); else return OPERATOR_CANCELLED; @@ -999,12 +1000,12 @@ static int node_group_socket_move_up_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(C); - if (RNA_property_is_set(op->ptr, "index")) + if (RNA_struct_property_is_set(op->ptr, "index")) index = RNA_int_get(op->ptr, "index"); else return OPERATOR_CANCELLED; - if (RNA_property_is_set(op->ptr, "in_out")) + if (RNA_struct_property_is_set(op->ptr, "in_out")) in_out = RNA_enum_get(op->ptr, "in_out"); else return OPERATOR_CANCELLED; @@ -1069,12 +1070,12 @@ static int node_group_socket_move_down_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(C); - if (RNA_property_is_set(op->ptr, "index")) + if (RNA_struct_property_is_set(op->ptr, "index")) index = RNA_int_get(op->ptr, "index"); else return OPERATOR_CANCELLED; - if (RNA_property_is_set(op->ptr, "in_out")) + if (RNA_struct_property_is_set(op->ptr, "in_out")) in_out = RNA_enum_get(op->ptr, "in_out"); else return OPERATOR_CANCELLED; @@ -1343,8 +1344,10 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) { ImageSampleInfo *info= arg_info; - draw_nodespace_color_info(ar, (CTX_data_scene(C)->r.color_mgt_flag & R_COLOR_MANAGEMENT), info->channels, - info->x, info->y, info->col, info->colf); + ED_image_draw_info(ar, (CTX_data_scene(C)->r.color_mgt_flag & R_COLOR_MANAGEMENT), info->channels, + info->x, info->y, info->col, info->colf, + NULL, NULL /* zbuf - unused for nodes */ + ); } static void sample_apply(bContext *C, wmOperator *op, wmEvent *event) @@ -3435,7 +3438,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) ntemp.type = -1; /* check input variables */ - if (RNA_property_is_set(op->ptr, "filepath")) + if (RNA_struct_property_is_set(op->ptr, "filepath")) { char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); @@ -3449,7 +3452,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } } - else if(RNA_property_is_set(op->ptr, "name")) + else if(RNA_struct_property_is_set(op->ptr, "name")) { char name[MAX_ID_NAME-2]; RNA_string_get(op->ptr, "name", name); @@ -3495,7 +3498,7 @@ static int node_add_file_invoke(bContext *C, wmOperator *op, wmEvent *event) UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &snode->mx, &snode->my); - if (RNA_property_is_set(op->ptr, "filepath") || RNA_property_is_set(op->ptr, "name")) + if (RNA_struct_property_is_set(op->ptr, "filepath") || RNA_struct_property_is_set(op->ptr, "name")) return node_add_file_exec(C, op); else return WM_operator_filesel(C, op, event); @@ -3534,12 +3537,12 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) /* retrieve state */ snode= CTX_wm_space_node(C); - if (RNA_property_is_set(op->ptr, "type")) + if (RNA_struct_property_is_set(op->ptr, "type")) treetype = RNA_enum_get(op->ptr, "type"); else treetype = snode->treetype; - if (RNA_property_is_set(op->ptr, "name")) + if (RNA_struct_property_is_set(op->ptr, "name")) RNA_string_get(op->ptr, "name", treename); ntree = ntreeAddTree(treename, treetype, 0); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 71cb83ad231..f8abfb6f4c3 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -628,7 +628,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi) /* fake button, it holds space for search items */ uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); - but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 0, 150, UI_UNIT_Y, 0, 0, ""); + but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, UI_UNIT_Y, 0, 0, ""); uiButSetSearchFunc(but, operator_search_cb, arg_kmi, operator_call_cb, ot); uiBoundsBlock(block, 6); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index a45b493ffb3..33e0136b6bb 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -57,7 +57,7 @@ #include "BLI_utildefines.h" #include "BLI_math_base.h" -#if defined WIN32 && !defined _LIBC +#if defined WIN32 && !defined _LIBC || defined __sun # include "BLI_fnmatch.h" /* use fnmatch included in blenlib */ #else # ifndef _GNU_SOURCE diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 458e6453b77..f1d3d65559d 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -130,7 +130,7 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w RNA_int_set(op->ptr, "frame_start", (int)mval_v2d[0]); - if ((flag & SEQPROP_ENDFRAME) && RNA_property_is_set(op->ptr, "frame_end")==0) + if ((flag & SEQPROP_ENDFRAME) && RNA_struct_property_is_set(op->ptr, "frame_end")==0) RNA_int_set(op->ptr, "frame_end", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now. if (!(flag & SEQPROP_NOPATHS)) { @@ -264,7 +264,7 @@ static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, wmEvent return OPERATOR_CANCELLED; } - if(!RNA_property_is_set(op->ptr, "scene")) + if(!RNA_struct_property_is_set(op->ptr, "scene")) return WM_enum_search_invoke(C, op, event); sequencer_generic_invoke_xy__internal(C, op, event, 0); @@ -371,7 +371,7 @@ static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent } /* This is for drag and drop */ - if(RNA_collection_length(op->ptr, "files") || RNA_property_is_set(op->ptr, "filepath")) { + if(RNA_collection_length(op->ptr, "files") || RNA_struct_property_is_set(op->ptr, "filepath")) { sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS); return sequencer_add_movie_strip_exec(C, op); } @@ -423,7 +423,7 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent } /* This is for drag and drop */ - if(RNA_collection_length(op->ptr, "files") || RNA_property_is_set(op->ptr, "filepath")) { + if(RNA_collection_length(op->ptr, "files") || RNA_struct_property_is_set(op->ptr, "filepath")) { sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS); return sequencer_add_sound_strip_exec(C, op); } @@ -650,7 +650,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) /* an unset channel is a special case where we automatically go above * the other strips. */ - if(!RNA_property_is_set(op->ptr, "channel")) { + if(!RNA_struct_property_is_set(op->ptr, "channel")) { if(seq->seq1) { int chan= MAX3( seq->seq1 ? seq->seq1->machine : 0, seq->seq2 ? seq->seq2->machine : 0, @@ -686,7 +686,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) /* add color */ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event) { - short is_type_set= RNA_property_is_set(op->ptr, "type"); + short is_type_set= RNA_struct_property_is_set(op->ptr, "type"); int type= -1; int prop_flag= SEQPROP_ENDFRAME; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 566659e0391..e8ad6e19fd4 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -276,7 +276,7 @@ static int text_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) Text *text= CTX_data_edit_text(C); char *path= (text && text->name)? text->name: G.main->name; - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return text_open_exec(C, op); text_open_init(C, op); @@ -534,7 +534,7 @@ static int text_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even Text *text= CTX_data_edit_text(C); char *str; - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) return text_save_as_exec(C, op); if(text->name) @@ -2209,7 +2209,7 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, wmEvent *event) SpaceText *st= CTX_wm_space_text(C); TextScroll *tsc; - if(RNA_property_is_set(op->ptr, "lines")) + if(RNA_struct_property_is_set(op->ptr, "lines")) return text_scroll_exec(C, op); tsc= MEM_callocN(sizeof(TextScroll), "TextScroll"); @@ -2289,7 +2289,7 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event) const int *mval= event->mval; int zone= -1; - if(RNA_property_is_set(op->ptr, "lines")) + if(RNA_struct_property_is_set(op->ptr, "lines")) return text_scroll_exec(C, op); /* verify we are in the right zone */ @@ -2784,7 +2784,7 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event) { int ret; - // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ + // if(!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if(!RNA_string_length(op->ptr, "text")) { /* if alt/ctrl/super are pressed pass through */ if(event->ctrl || event->oskey) { diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index e3f65bbafdf..ce8ddc3c361 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3074,8 +3074,6 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, draw_em_fancy_edges(em, scene, v3d, me, cageDM, 0, eed_act); } if(em) { -// XXX retopo_matrix_update(v3d); - draw_em_fancy_verts(scene, v3d, ob, em, cageDM, eve_act); if(me->drawflag & ME_DRAWNORMALS) { @@ -5401,8 +5399,6 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, short hide_handles = (cu->drawflag & CU_HIDE_HANDLES); int index; -// XXX retopo_matrix_update(v3d); - /* DispList */ UI_ThemeColor(TH_WIRE); drawDispList(scene, v3d, rv3d, base, dt); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index cac5d856652..196af34137a 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -553,7 +553,6 @@ static void view3d_main_area_free(ARegion *ar) if(rv3d->localvd) MEM_freeN(rv3d->localvd); if(rv3d->clipbb) MEM_freeN(rv3d->clipbb); - // XXX retopo_free_view_data(rv3d); if(rv3d->ri) { // XXX BIF_view3d_previewrender_free(rv3d); } diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 951aa1a5ebd..a595fc1f02b 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -193,7 +193,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float dg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr); if(dg) { max+= BLI_snprintf(str, sizeof(str), "%s %%x%d|", dg->name, dvert->dw[i].def_nr); - if(max<320) strcat(defstr, str); + if (max < sizeof(str)) strcat(defstr, str); } if(tfp->curdef==dvert->dw[i].def_nr) { diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 6e591a714e4..8a0fa5324be 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1585,8 +1585,8 @@ static int viewzoom_exec(bContext *C, wmOperator *op) v3d= sa->spacedata.first; rv3d= ar->regiondata; - mx= RNA_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") : ar->winx / 2; - my= RNA_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") : ar->winy / 2; + mx= RNA_struct_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") : ar->winx / 2; + my= RNA_struct_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") : ar->winy / 2; use_cam_zoom= (rv3d->persp==RV3D_CAMOB) && !(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d)); @@ -1667,12 +1667,12 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) vod= op->customdata; /* if one or the other zoom position aren't set, set from event */ - if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) { + if (!RNA_struct_property_is_set(op->ptr, "mx") || !RNA_struct_property_is_set(op->ptr, "my")) { RNA_int_set(op->ptr, "mx", event->x); RNA_int_set(op->ptr, "my", event->y); } - if(RNA_property_is_set(op->ptr, "delta")) { + if(RNA_struct_property_is_set(op->ptr, "delta")) { viewzoom_exec(C, op); } else { @@ -1880,12 +1880,12 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event) vod= op->customdata; /* if one or the other zoom position aren't set, set from event */ - if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my")) { + if (!RNA_struct_property_is_set(op->ptr, "mx") || !RNA_struct_property_is_set(op->ptr, "my")) { RNA_int_set(op->ptr, "mx", event->x); RNA_int_set(op->ptr, "my", event->y); } - if(RNA_property_is_set(op->ptr, "delta")) { + if(RNA_struct_property_is_set(op->ptr, "delta")) { viewdolly_exec(C, op); } else { @@ -2963,13 +2963,13 @@ static int background_image_add_invoke(bContext *C, wmOperator *op, wmEvent *UNU char name[MAX_ID_NAME-2]; /* check input variables */ - if(RNA_property_is_set(op->ptr, "filepath")) { + if(RNA_struct_property_is_set(op->ptr, "filepath")) { char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); ima= BKE_add_image_file(path); } - else if(RNA_property_is_set(op->ptr, "name")) { + else if(RNA_struct_property_is_set(op->ptr, "name")) { RNA_string_get(op->ptr, "name", name); ima= (Image *)find_id("IM", name); } diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index cb6a53c67eb..86a2abe7a74 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -177,7 +177,7 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase) /* fake button, it holds space for search items */ uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); - but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, OP_MAX_TYPENAME, 10, 0, 150, 19, 0, 0, ""); + but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, ""); uiButSetSearchFunc(but, operator_search_cb, arg_listbase, operator_call_cb, NULL); uiBoundsBlock(block, 6); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 8a021922aa7..3ff5f7bbcba 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1410,18 +1410,18 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) if (t->flag & T_MODAL) { /* save settings if not set in operator */ - if (RNA_struct_find_property(op->ptr, "proportional") && !RNA_property_is_set(op->ptr, "proportional")) { + if (RNA_struct_find_property(op->ptr, "proportional") && !RNA_struct_property_is_set(op->ptr, "proportional")) { if (t->obedit) ts->proportional = proportional; else ts->proportional_objects = (proportional != PROP_EDIT_OFF); } - if (RNA_struct_find_property(op->ptr, "proportional_size") && !RNA_property_is_set(op->ptr, "proportional_size")) { + if (RNA_struct_find_property(op->ptr, "proportional_size") && !RNA_struct_property_is_set(op->ptr, "proportional_size")) { ts->proportional_size = t->prop_size; } - if (RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && !RNA_property_is_set(op->ptr, "proportional_edit_falloff")) { + if (RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && !RNA_struct_property_is_set(op->ptr, "proportional_edit_falloff")) { ts->prop_mode = t->prop_mode; } @@ -1433,7 +1433,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } if(t->spacetype == SPACE_VIEW3D) { - if (RNA_struct_find_property(op->ptr, "constraint_orientation") && !RNA_property_is_set(op->ptr, "constraint_orientation")) { + if (RNA_struct_find_property(op->ptr, "constraint_orientation") && !RNA_struct_property_is_set(op->ptr, "constraint_orientation")) { View3D *v3d = t->view; v3d->twmode = t->current_orientation; @@ -1706,7 +1706,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int /* overwrite initial values if operator supplied a non-null vector */ - if (RNA_property_is_set(op->ptr, "value")) + if (RNA_struct_property_is_set(op->ptr, "value")) { float values[4]= {0}; /* incase value isn't length 4, avoid uninitialized memory */ PropertyRNA *prop= RNA_struct_find_property(op->ptr, "value"); @@ -1723,7 +1723,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int } /* Transformation axis from operator */ - if (RNA_struct_find_property(op->ptr, "axis") && RNA_property_is_set(op->ptr, "axis")) + if (RNA_struct_find_property(op->ptr, "axis") && RNA_struct_property_is_set(op->ptr, "axis")) { RNA_float_get_array(op->ptr, "axis", t->axis); normalize_v3(t->axis); @@ -1731,7 +1731,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int } /* Constraint init from operator */ - if (RNA_struct_find_property(op->ptr, "constraint_axis") && RNA_property_is_set(op->ptr, "constraint_axis")) + if (RNA_struct_find_property(op->ptr, "constraint_axis") && RNA_struct_property_is_set(op->ptr, "constraint_axis")) { int constraint_axis[3]; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index b6f75fe1b48..e917b7d4c96 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1078,7 +1078,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) if(v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN; t->around = v3d->around; - if (op && RNA_struct_find_property(op->ptr, "constraint_orientation") && RNA_property_is_set(op->ptr, "constraint_orientation")) + if (op && RNA_struct_find_property(op->ptr, "constraint_orientation") && RNA_struct_property_is_set(op->ptr, "constraint_orientation")) { t->current_orientation = RNA_enum_get(op->ptr, "constraint_orientation"); @@ -1101,7 +1101,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) /* initialize UV transform from */ if (op && RNA_struct_find_property(op->ptr, "correct_uv")) { - if(RNA_property_is_set(op->ptr, "correct_uv")) { + if(RNA_struct_property_is_set(op->ptr, "correct_uv")) { if(RNA_boolean_get(op->ptr, "correct_uv")) { t->settings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT; } @@ -1147,7 +1147,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->around = V3D_CENTER; } - if (op && RNA_property_is_set(op->ptr, "release_confirm")) + if (op && RNA_struct_property_is_set(op->ptr, "release_confirm")) { if (RNA_boolean_get(op->ptr, "release_confirm")) { @@ -1162,7 +1162,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } } - if (op && RNA_struct_find_property(op->ptr, "mirror") && RNA_property_is_set(op->ptr, "mirror")) + if (op && RNA_struct_find_property(op->ptr, "mirror") && RNA_struct_property_is_set(op->ptr, "mirror")) { if (RNA_boolean_get(op->ptr, "mirror")) { @@ -1183,7 +1183,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) /* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */ if (op && RNA_struct_find_property(op->ptr, "proportional")) { - if (RNA_property_is_set(op->ptr, "proportional")) + if (RNA_struct_property_is_set(op->ptr, "proportional")) { switch(RNA_enum_get(op->ptr, "proportional")) { @@ -1216,7 +1216,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } } - if (op && RNA_struct_find_property(op->ptr, "proportional_size") && RNA_property_is_set(op->ptr, "proportional_size")) + if (op && RNA_struct_find_property(op->ptr, "proportional_size") && RNA_struct_property_is_set(op->ptr, "proportional_size")) { t->prop_size = RNA_float_get(op->ptr, "proportional_size"); } @@ -1233,7 +1233,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->prop_size = 1.0f; } - if (op && RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && RNA_property_is_set(op->ptr, "proportional_edit_falloff")) + if (op && RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && RNA_struct_property_is_set(op->ptr, "proportional_edit_falloff")) { t->prop_mode = RNA_enum_get(op->ptr, "proportional_edit_falloff"); } diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 81a2b7158ee..b7aba109cdd 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -429,7 +429,7 @@ static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_CANCELLED; } - if(RNA_property_is_set(op->ptr, "value")) { + if(RNA_struct_property_is_set(op->ptr, "value")) { return transform_exec(C, op); } else { diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 4514b36f3a5..332af6fdfcf 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -447,18 +447,18 @@ void initSnapping(TransInfo *t, wmOperator *op) resetSnapping(t); /* if snap property exists */ - if (op && RNA_struct_find_property(op->ptr, "snap") && RNA_property_is_set(op->ptr, "snap")) + if (op && RNA_struct_find_property(op->ptr, "snap") && RNA_struct_property_is_set(op->ptr, "snap")) { if (RNA_boolean_get(op->ptr, "snap")) { t->modifiers |= MOD_SNAP; - if (RNA_property_is_set(op->ptr, "snap_target")) + if (RNA_struct_property_is_set(op->ptr, "snap_target")) { snap_target = RNA_enum_get(op->ptr, "snap_target"); } - if (RNA_property_is_set(op->ptr, "snap_point")) + if (RNA_struct_property_is_set(op->ptr, "snap_point")) { RNA_float_get_array(op->ptr, "snap_point", t->tsnap.snapPoint); t->tsnap.status |= SNAP_FORCED|POINT_INIT; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index be596a9a4a9..56a835beeb8 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -524,7 +524,7 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even /* note: also check ed_undo_step() in top if you change notifiers */ static int undo_history_exec(bContext *C, wmOperator *op) { - if(RNA_property_is_set(op->ptr, "item")) { + if(RNA_struct_property_is_set(op->ptr, "item")) { int undosys= get_undo_system(C); int item= RNA_int_get(op->ptr, "item"); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index f3019448240..3ed0cd02838 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -540,7 +540,7 @@ static int pack_islands_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - if(RNA_property_is_set(op->ptr, "margin")) { + if(RNA_struct_property_is_set(op->ptr, "margin")) { scene->toolsettings->uvcalc_margin= RNA_float_get(op->ptr, "margin"); } else { diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index 3e017d5af82..f98f37e388c 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -703,11 +703,11 @@ void DDSHeader::setSwizzleCode(uint8 c0, uint8 c1, uint8 c2, uint8 c3) void DDSHeader::setPixelFormat(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask) { // Make sure the masks are correct. - if ((rmask & gmask) || \ - (rmask & bmask) || \ - (rmask & amask) || \ - (gmask & bmask) || \ - (gmask & amask) || \ + if ((rmask & gmask) || + (rmask & bmask) || + (rmask & amask) || + (gmask & bmask) || + (gmask & amask) || (bmask & amask)) { printf("DDS: bad RGBA masks, pixel format not set\n"); return; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index ce14951b5fb..e1481d2a08f 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -386,12 +386,12 @@ static void get_proxy_filename(struct anim * anim, IMB_Proxy_Size preview_size, stream_suffix[0] = 0; if (anim->streamindex > 0) { - BLI_snprintf(stream_suffix, 20, "_st%d", anim->streamindex); + BLI_snprintf(stream_suffix, sizeof(stream_suffix), "_st%d", anim->streamindex); } - BLI_snprintf(proxy_name, 256, "proxy_%d%s.avi", + BLI_snprintf(proxy_name, sizeof(proxy_name), "proxy_%d%s.avi", (int) (proxy_fac[i] * 100), stream_suffix); - BLI_snprintf(proxy_temp_name, 256, "proxy_%d%s_part.avi", + BLI_snprintf(proxy_temp_name, sizeof(proxy_temp_name), "proxy_%d%s_part.avi", (int) (proxy_fac[i] * 100), stream_suffix); get_index_dir(anim, index_dir); diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 2051b8d2195..6fe2a3b8bc2 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -541,7 +541,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags) } else { fprintf(stderr, - "imb_loadtiff: could not allocate memory for TIFF " \ + "imb_loadtiff: could not allocate memory for TIFF " "image.\n"); TIFFClose(image); return NULL; diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index f311d94703f..bfd3bb4b0bf 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -86,6 +86,10 @@ typedef struct IDProperty { /* IDP_STRING */ #define IDP_STRING_SUB_UTF8 0 /* default */ #define IDP_STRING_SUB_BYTE 1 /* arbitrary byte array, _not_ null terminated */ +/*->flag*/ +#define IDP_FLAG_GHOST (1<<7) /* this means the propery is set but RNA will return + * false when checking 'RNA_property_is_set', + * currently this is a runtime flag */ /* add any future new id property types here.*/ diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 7df4ebd3c55..e582d071319 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -184,7 +184,7 @@ typedef struct bPoseChannel { IDProperty *prop; /* User-Defined Properties on this PoseChannel */ ListBase constraints;/* Constraints that act on this PoseChannel */ - char name[72]; /* Channels need longer names than normal blender objects */ + char name[64]; /* need to match bone name length: MAXBONENAME */ short flag; /* dynamic, for detecting transform changes */ short ikflag; /* settings for IK bones */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index d3eb4f12b2a..505a9ee30ab 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -583,8 +583,9 @@ typedef struct GameData { /* standalone player */ struct GameFraming framing; - short fullscreen, xplay, yplay, freqplay; + short playerflag, xplay, yplay, freqplay; short depth, attrib, rt1, rt2; + short aasamples, pad4[3]; /* stereo/dome mode */ struct GameDome dome; @@ -661,6 +662,10 @@ typedef struct GameData { #define GAME_SHOW_OBSTACLE_SIMULATION (1 << 16) /* Note: GameData.flag is now an int (max 32 flags). A short could only take 16 flags */ +/* GameData.playerflag */ +#define GAME_PLAYER_FULLSCREEN (1 << 0) +#define GAME_PLAYER_DESKTOP_RESOLUTION (1 << 1) + /* GameData.matmode */ #define GAME_MAT_TEXFACE 0 #define GAME_MAT_MULTITEX 1 @@ -810,6 +815,40 @@ typedef struct TransformOrientation { } TransformOrientation; /* *************************************************************** */ +/* Unified Paint Settings */ + +/* These settings can override the equivalent fields in the active + Brush for any paint mode; the flag field controls whether these + values are used */ +typedef struct UnifiedPaintSettings { + /* unified radius of brush in pixels */ + int size; + + /* unified radius of brush in Blender units */ + float unprojected_radius; + + /* unified strength of brush */ + float alpha; + + /* user preferences for sculpt and paint */ + int flag; +} UnifiedPaintSettings; + +typedef enum { + UNIFIED_PAINT_SIZE = (1<<0), + UNIFIED_PAINT_ALPHA = (1<<1), + + /* only used if unified size is enabled, mirros the brush flags + BRUSH_LOCK_SIZE and BRUSH_SIZE_PRESSURE */ + UNIFIED_PAINT_BRUSH_LOCK_SIZE = (1<<2), + UNIFIED_PAINT_BRUSH_SIZE_PRESSURE = (1<<3), + + /* only used if unified alpha is enabled, mirrors the brush flag + BRUSH_ALPHA_PRESSURE */ + UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE = (1<<4) +} UnifiedPaintSettingsFlags; + +/* *************************************************************** */ /* Tool Settings */ typedef struct ToolSettings { @@ -881,13 +920,9 @@ typedef struct ToolSettings { /* Auto-Keying Mode */ short autokey_mode, autokey_flag; /* defines in DNA_userdef_types.h */ - /* Retopo */ - char retopo_mode; - char retopo_paint_tool; - char line_div, ellipse_div, retopo_hotspot; - /* Multires */ char multires_subdiv_type; + char pad2[5]; /* Skeleton generation */ short skgen_resolution; @@ -931,11 +966,16 @@ typedef struct ToolSettings { char auto_normalize; /*auto normalizing mode in wpaint*/ char multipaint; /* paint multiple bones in wpaint */ - short sculpt_paint_settings; /* user preferences for sculpt and paint */ + /* XXX: these sculpt_paint_* fields are deprecated, use the + unified_paint_settings field instead! */ + short sculpt_paint_settings DNA_DEPRECATED; short pad1; - int sculpt_paint_unified_size; /* unified radius of brush in pixels */ - float sculpt_paint_unified_unprojected_radius;/* unified radius of brush in Blender units */ - float sculpt_paint_unified_alpha; /* unified strength of brush */ + int sculpt_paint_unified_size DNA_DEPRECATED; + float sculpt_paint_unified_unprojected_radius DNA_DEPRECATED; + float sculpt_paint_unified_alpha DNA_DEPRECATED; + + /* Unified Paint Settings */ + struct UnifiedPaintSettings unified_paint_settings; } ToolSettings; /* *************************************************************** */ @@ -1362,13 +1402,6 @@ typedef enum SculptFlags { SCULPT_ONLY_DEFORM = (1<<8), } SculptFlags; -/* sculpt_paint_settings */ -#define SCULPT_PAINT_USE_UNIFIED_SIZE (1<<0) -#define SCULPT_PAINT_USE_UNIFIED_ALPHA (1<<1) -#define SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE (1<<2) -#define SCULPT_PAINT_UNIFIED_SIZE_PRESSURE (1<<3) -#define SCULPT_PAINT_UNIFIED_ALPHA_PRESSURE (1<<4) - /* ImagePaintSettings.flag */ #define IMAGEPAINT_DRAWING 1 // #define IMAGEPAINT_DRAW_TOOL 2 // deprecated @@ -1439,15 +1472,6 @@ typedef enum SculptFlags { #define PE_TYPE_SOFTBODY 1 #define PE_TYPE_CLOTH 2 -/* toolsettings->retopo_mode */ -#define RETOPO 1 -#define RETOPO_PAINT 2 - -/* toolsettings->retopo_paint_tool */ /*UNUSED*/ -/* #define RETOPO_PEN 1 */ -/* #define RETOPO_LINE 2 */ -/* #define RETOPO_ELLIPSE 4 */ - /* toolsettings->skgen_options */ #define SKGEN_FILTER_INTERNAL (1 << 0) #define SKGEN_FILTER_EXTERNAL (1 << 1) diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index ee069cccb78..172c71000b8 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -938,7 +938,8 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name); } /* check if the idproperty exists, for operators */ -int RNA_property_is_set(PointerRNA *ptr, const char *name); +int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop); +int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier); int RNA_property_is_idprop(PropertyRNA *prop); /* python compatible string representation of this property, (must be freed!) */ @@ -1000,7 +1001,7 @@ StructRNA *ID_code_to_RNA_type(short idcode); /* macro which inserts the function name */ -#ifdef __GNUC__ +#if defined __GNUC__ || defined __sun # define RNA_warning(format, args...) _RNA_warning("%s: " format "\n", __func__, ##args) #else # define RNA_warning(format, ...) _RNA_warning("%s: " format "\n", __FUNCTION__, __VA_ARGS__) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index c50e233c43f..4eebfc52920 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -226,6 +226,12 @@ void RNA_pointer_recast(PointerRNA *ptr, PointerRNA *r_ptr) /* ID Properties */ +static void rna_idproperty_touch(IDProperty *idprop) +{ + /* so the property is seen as 'set' by rna */ + idprop->flag &= ~IDP_FLAG_GHOST; +} + /* return a UI local ID prop definition for this prop */ IDProperty *rna_idproperty_ui(PropertyRNA *prop) { @@ -1621,8 +1627,10 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) /* just incase other values are passed */ if(value) value= 1; - if((idprop=rna_idproperty_check(&prop, ptr))) + if((idprop=rna_idproperty_check(&prop, ptr))) { IDP_Int(idprop)= value; + rna_idproperty_touch(idprop); + } else if(bprop->set) bprop->set(ptr, value); else if(prop->flag & PROP_EDITABLE) { @@ -1698,6 +1706,8 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in IDP_Int(idprop)= values[0]; else memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len); + + rna_idproperty_touch(idprop); } else if(prop->arraydimension == 0) RNA_property_boolean_set(ptr, prop, values[0]); @@ -1818,8 +1828,10 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) /* useful to check on bad values but set function should clamp */ /* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */ - if((idprop=rna_idproperty_check(&prop, ptr))) + if((idprop=rna_idproperty_check(&prop, ptr))) { IDP_Int(idprop)= value; + rna_idproperty_touch(idprop); + } else if(iprop->set) iprop->set(ptr, value); else if(prop->flag & PROP_EDITABLE) { @@ -1931,7 +1943,9 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v if(prop->arraydimension == 0) IDP_Int(idprop)= values[0]; else - memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);\ + memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len); + + rna_idproperty_touch(idprop); } else if(prop->arraydimension == 0) RNA_property_int_set(ptr, prop, values[0]); @@ -2054,6 +2068,8 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) IDP_Float(idprop)= value; else IDP_Double(idprop)= value; + + rna_idproperty_touch(idprop); } else if(fprop->set) { fprop->set(ptr, value); @@ -2185,6 +2201,8 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa for(i=0; i<idprop->len; i++) ((double*)IDP_Array(idprop))[i]= values[i]; } + + rna_idproperty_touch(idprop); } else if(prop->arraydimension == 0) RNA_property_float_set(ptr, prop, values[0]); @@ -2372,9 +2390,11 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val BLI_assert(RNA_property_type(prop) == PROP_STRING); - if((idprop=rna_idproperty_check(&prop, ptr))) + if((idprop=rna_idproperty_check(&prop, ptr))) { /* both IDP_STRING_SUB_BYTE / IDP_STRING_SUB_UTF8 */ IDP_AssignString(idprop, value, RNA_property_string_maxlength(prop) - 1); + rna_idproperty_touch(idprop); + } else if(sprop->set) sprop->set(ptr, value); /* set function needs to clamp its self */ else if(prop->flag & PROP_EDITABLE) { @@ -2446,8 +2466,10 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) BLI_assert(RNA_property_type(prop) == PROP_ENUM); - if((idprop=rna_idproperty_check(&prop, ptr))) + if((idprop=rna_idproperty_check(&prop, ptr))) { IDP_Int(idprop)= value; + rna_idproperty_touch(idprop); + } else if(eprop->set) { eprop->set(ptr, value); } @@ -2516,6 +2538,7 @@ void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr if((/*idprop=*/ rna_idproperty_check(&prop, ptr))) { /* not supported */ + /* rna_idproperty_touch(idprop); */ } else { PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; @@ -4412,15 +4435,23 @@ int RNA_collection_length(PointerRNA *ptr, const char *name) } } -int RNA_property_is_set(PointerRNA *ptr, const char *name) +int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop) { - PropertyRNA *prop= RNA_struct_find_property(ptr, name); + if(prop->flag & PROP_IDPROPERTY) { + IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier); + return ((idprop != NULL) && !(idprop->flag & IDP_FLAG_GHOST)); + } + else { + return 1; + } +} + +int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier) +{ + PropertyRNA *prop= RNA_struct_find_property(ptr, identifier); if(prop) { - if(prop->flag & PROP_IDPROPERTY) - return (rna_idproperty_find(ptr, name) != NULL); - else - return 1; + return RNA_property_is_set(ptr, prop); } else { /* python raises an error */ diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 4fb672fd203..63009e09161 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -185,42 +185,6 @@ static int rna_Brush_get_size(PointerRNA *ptr) return brush_size(me); } -static void rna_Brush_set_use_locked_size(PointerRNA *ptr, int value) -{ - Brush* me = (Brush*)(ptr->data); - brush_set_use_locked_size(me, value); -} - -static int rna_Brush_get_use_locked_size(PointerRNA *ptr) -{ - Brush* me = (Brush*)(ptr->data); - return brush_use_locked_size(me); -} - -static void rna_Brush_set_use_size_pressure(PointerRNA *ptr, int value) -{ - Brush* me = (Brush*)(ptr->data); - brush_set_use_size_pressure(me, value); -} - -static int rna_Brush_get_use_size_pressure(PointerRNA *ptr) -{ - Brush* me = (Brush*)(ptr->data); - return brush_use_size_pressure(me); -} - -static void rna_Brush_set_use_alpha_pressure(PointerRNA *ptr, int value) -{ - Brush* me = (Brush*)(ptr->data); - brush_set_use_alpha_pressure(me, value); -} - -static int rna_Brush_get_use_alpha_pressure(PointerRNA *ptr) -{ - Brush* me = (Brush*)(ptr->data); - return brush_use_alpha_pressure(me); -} - static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value) { Brush* me = (Brush*)(ptr->data); @@ -575,7 +539,6 @@ static void rna_def_brush(BlenderRNA *brna) prop= RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE); - RNA_def_property_boolean_funcs(prop, "rna_Brush_get_use_alpha_pressure", "rna_Brush_set_use_alpha_pressure"); RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength"); RNA_def_property_update(prop, 0, "rna_Brush_update"); @@ -588,7 +551,6 @@ static void rna_def_brush(BlenderRNA *brna) prop= RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE); - RNA_def_property_boolean_funcs(prop, "rna_Brush_get_use_size_pressure", "rna_Brush_set_use_size_pressure"); RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size"); RNA_def_property_update(prop, 0, "rna_Brush_update"); @@ -668,7 +630,6 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Brush_update"); prop= RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_Brush_get_use_locked_size", "rna_Brush_set_use_locked_size"); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_LOCK_SIZE); RNA_def_property_ui_text(prop, "Use Blender Units", "When locked brush stays same size relative to object; when unlocked brush size is given in pixels"); RNA_def_property_update(prop, 0, "rna_Brush_update"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 2b5925179d8..a04ddec2098 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -369,6 +369,15 @@ static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) node_update(bmain, scene, ntree, node); } +static void rna_Node_image_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + bNodeTree *ntree= (bNodeTree*)ptr->id.data; + bNode *node= (bNode*)ptr->data; + + node_update(bmain, scene, ntree, node); + WM_main_add_notifier(NC_IMAGE, NULL); +} + static void rna_Node_material_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bNodeTree *ntree= (bNodeTree*)ptr->id.data; @@ -1268,7 +1277,7 @@ static void def_sh_tex_environment(StructRNA *srna) RNA_def_property_struct_type(prop, "Image"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Image", ""); - RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_image_update"); RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage"); def_sh_tex(srna); @@ -1293,7 +1302,7 @@ static void def_sh_tex_image(StructRNA *srna) RNA_def_property_struct_type(prop, "Image"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Image", ""); - RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_image_update"); RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage"); def_sh_tex(srna); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1eb7457fed6..efa1d49ba13 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -32,6 +32,7 @@ #include "rna_internal.h" +#include "DNA_brush_types.h" #include "DNA_group_types.h" #include "DNA_modifier_types.h" #include "DNA_particle_types.h" @@ -1276,8 +1277,6 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons } } - - /* note: without this, when Multi-Paint is activated/deactivated, the colors * will not change right away when multiple bones are selected, this function * is not for general use and only for the few cases where changing scene @@ -1615,20 +1614,66 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Stroke conversion method", "Method used to convert stroke to bones"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); - /* Sculpt/Paint Unified Size and Strength */ + /* Unified Paint Settings */ + prop= RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "UnifiedPaintSettings"); + RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL); +} - prop= RNA_def_property(srna, "sculpt_paint_use_unified_size", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_SIZE); - RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Radius", - "Instead of per brush radius, the radius is shared across brushes"); +static void rna_def_unified_paint_settings(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; - prop= RNA_def_property(srna, "sculpt_paint_use_unified_strength", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_ALPHA); - RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Strength", - "Instead of per brush strength, the strength is shared across brushes"); + srna= RNA_def_struct(brna, "UnifiedPaintSettings", NULL); + RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings"); + + /* high-level flags to enable or disable unified paint settings */ + prop= RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE); + RNA_def_property_ui_text(prop, "Use Unified Radius", + "Instead of per-brush radius, the radius is shared across brushes"); + + prop= RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA); + RNA_def_property_ui_text(prop, "Use Unified Strength", + "Instead of per-brush strength, the strength is shared across brushes"); + + /* unified paint settings that override the equivalent settings + from the active brush */ + prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE); + RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS*10); + RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0); + RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels"); + + prop= RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_range(prop, 0.001, FLT_MAX); + RNA_def_property_ui_range(prop, 0.001, 1, 0, 0); + RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units"); + + prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "alpha"); + RNA_def_property_float_default(prop, 0.5f); + RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 0.001); + RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied"); + + prop= RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE); + RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); + RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size"); + + prop= RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE); + RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); + RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength"); + + prop= RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_LOCK_SIZE); + RNA_def_property_ui_text(prop, "Use Blender Units", "When locked brush stays same size relative to object; when unlocked brush size is given in pixels"); } - static void rna_def_unit_settings(BlenderRNA *brna) { StructRNA *srna; @@ -2038,6 +2083,14 @@ static void rna_def_scene_game_data(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + static EnumPropertyItem aasamples_items[] ={ + {0, "SAMPLES_0", 0, "Off", ""}, + {2, "SAMPLES_2", 0, "2x", ""}, + {4, "SAMPLES_4", 0, "4x", ""}, + {8, "SAMPLES_8", 0, "8x", ""}, + {16, "SAMPLES_16", 0, "16x", ""}, + {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem framing_types_items[] ={ {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox", "Show the entire viewport in the display window, using bar horizontally or vertically"}, @@ -2107,6 +2160,11 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen"); RNA_def_property_update(prop, NC_SCENE, NULL); + prop= RNA_def_property(srna, "samples", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "aasamples"); + RNA_def_property_enum_items(prop, aasamples_items); + RNA_def_property_ui_text(prop, "AA Samples", "The number of AA Samples to use for MSAA"); + prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "depth"); RNA_def_property_range(prop, 8, 32); @@ -2128,10 +2186,15 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "fullscreen", 1.0); + RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_FULLSCREEN); RNA_def_property_ui_text(prop, "Fullscreen", "Start player in a new fullscreen display"); RNA_def_property_update(prop, NC_SCENE, NULL); + prop= RNA_def_property(srna, "use_desktop", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_DESKTOP_RESOLUTION); + RNA_def_property_ui_text(prop, "Desktop", "Uses the current desktop resultion in fullscreen mode"); + RNA_def_property_update(prop, NC_SCENE, NULL); + /* Framing */ prop= RNA_def_property(srna, "frame_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "framing.type"); @@ -4032,6 +4095,7 @@ void RNA_def_scene(BlenderRNA *brna) /* Nestled Data */ rna_def_tool_settings(brna); + rna_def_unified_paint_settings(brna); rna_def_unit_settings(brna); rna_def_scene_image_format_data(brna); rna_def_scene_render_data(brna); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 8e05e43b48f..52a4a1db36b 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -371,7 +371,7 @@ EnumPropertyItem wm_report_items[] = { {RPT_OPERATOR, "OPERATOR", 0, "Operator", ""}, {RPT_WARNING, "WARNING", 0, "Warning", ""}, {RPT_ERROR, "ERROR", 0, "Error", ""}, - {RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""},\ + {RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""}, {RPT_ERROR_INVALID_CONTEXT, "ERROR_INVALID_CONTEXT", 0, "Invalid Context", ""}, {RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c index 955d8813cf1..b7ebb7d291b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c @@ -716,10 +716,11 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l is also empty. If both conditions are true for any one of the 4 adjacent pixels then the current pixel is counted as being a true outer edge pixel. */ - if((!lomask[pix_nextCol] && !limask[pix_nextCol]) || \ - (!lomask[pix_prevCol] && !limask[pix_prevCol]) || \ - (!lomask[pix_nextRow] && !limask[pix_nextRow]) || \ - (!lomask[pix_prevRow] && !limask[pix_prevRow])) { + if((!lomask[pix_nextCol] && !limask[pix_nextCol]) || + (!lomask[pix_prevCol] && !limask[pix_prevCol]) || + (!lomask[pix_nextRow] && !limask[pix_nextRow]) || + (!lomask[pix_prevRow] && !limask[pix_prevRow])) + { in_osz++; // increment the outer boundary pixel count lres[a]=3; // flag pixel as part of outer edge } else { // it's not a boundary pixel, but it is a gradient pixel @@ -773,10 +774,11 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i is also empty. If both conditions are true for any one of the 4 adjacent pixels then the current pixel is counted as being a true outer edge pixel. */ - if((!lomask[pix_nextCol] && !limask[pix_nextCol]) || \ - (!lomask[pix_prevCol] && !limask[pix_prevCol]) || \ - (!lomask[pix_nextRow] && !limask[pix_nextRow]) || \ - (!lomask[pix_prevRow] && !limask[pix_prevRow])) { + if((!lomask[pix_nextCol] && !limask[pix_nextCol]) || + (!lomask[pix_prevCol] && !limask[pix_prevCol]) || + (!lomask[pix_nextRow] && !limask[pix_nextRow]) || + (!lomask[pix_prevRow] && !limask[pix_prevRow])) + { in_osz++; // increment the outer boundary pixel count lres[a]=3; // flag pixel as part of outer edge } else { // it's not a boundary pixel, but it is a gradient pixel @@ -786,10 +788,11 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i } } else { - if((!limask[pix_nextCol] && lomask[pix_nextCol]) || \ - (!limask[pix_prevCol] && lomask[pix_prevCol]) || \ - (!limask[pix_nextRow] && lomask[pix_nextRow]) || \ - (!limask[pix_prevRow] && lomask[pix_prevRow])) { + if((!limask[pix_nextCol] && lomask[pix_nextCol]) || + (!limask[pix_prevCol] && lomask[pix_prevCol]) || + (!limask[pix_nextRow] && lomask[pix_nextRow]) || + (!limask[pix_prevRow] && lomask[pix_prevRow])) + { in_isz++; // increment the inner boundary pixel count lres[a]=4; // flag pixel as part of inner edge } else { @@ -1172,7 +1175,7 @@ static void node_composit_exec_doubleedgemask(void *UNUSED(data), bNode *node, b void register_node_type_cmp_doubleedgemask(bNodeTreeType *ttype) { static bNodeType ntype; // allocate a node type data structure - node_type_base(ttype, &ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_OP_FILTER, NODE_OPTIONS); + node_type_base(ttype, &ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, NODE_OPTIONS); node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out); node_type_size(&ntype, 210, 210, 210); node_type_exec(&ntype, node_composit_exec_doubleedgemask); diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 81eb81e90fa..d94ba8b9441 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -1423,7 +1423,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw return ret; } else if (PyTuple_GET_SIZE(args) > 1) { - PyErr_SetString(PyExc_ValueError, "all args must be keywords"); \ + PyErr_SetString(PyExc_ValueError, "all args must be keywords"); return NULL; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 9dfbe64e905..588f08224c8 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3055,7 +3055,6 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg { PropertyRNA *prop; const char *name; - int ret; PYRNA_STRUCT_CHECK_OBJ(self); @@ -3069,22 +3068,7 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg return NULL; } - /* double property lookup, could speed up */ - /* return PyBool_FromLong(RNA_property_is_set(&self->ptr, name)); */ - if (RNA_property_flag(prop) & PROP_IDPROPERTY) { - IDProperty *group = RNA_struct_idprops(&self->ptr, 0); - if (group) { - ret = IDP_GetPropertyFromGroup(group, name) ? 1:0; - } - else { - ret = 0; - } - } - else { - ret = 1; - } - - return PyBool_FromLong(ret); + return PyBool_FromLong(RNA_property_is_set(&self->ptr, prop)); } PyDoc_STRVAR(pyrna_struct_is_property_hidden_doc, diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m index 365a06c7cd8..045ef973e91 100644 --- a/source/blender/quicktime/apple/qtkit_export.m +++ b/source/blender/quicktime/apple/qtkit_export.m @@ -604,13 +604,14 @@ int append_qt(struct RenderData *rd, int frame, int *pixels, int rectx, int rect OSStatus err = noErr; unsigned char *from_Ptr,*to_Ptr; int y,from_i,to_i; + BOOL alpha = (rd->im_format.planes == R_IMF_PLANES_RGBA)? YES: NO; /* Create bitmap image rep in blender format (32bit RGBA) */ blBitmapFormatImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:rectx pixelsHigh:recty - bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO + bitsPerSample:8 samplesPerPixel:4 hasAlpha:alpha isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bitmapFormat:NSAlphaNonpremultipliedBitmapFormat bytesPerRow:rectx*4 diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 06fae560bfe..f8f78d83434 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -2283,7 +2283,18 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve if(texco & TEXCO_REFL) { /* not (yet?) */ } - + if(texco & TEXCO_STRESS) { + float *s= RE_vertren_get_stress(obr, vr, 0); + + if(s) { + shi->stress= *s; + if(shi->stress<1.0f) shi->stress-= 1.0f; + else shi->stress= (shi->stress-1.0f)/shi->stress; + } + else + shi->stress= 0.0f; + } + shi->displace[0]= shi->displace[1]= shi->displace[2]= 0.0; do_material_tex(shi, re); @@ -3536,6 +3547,9 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) } if(!timeoffset) { + if(need_stress) + calc_edge_stress(re, obr, me); + if (test_for_displace(re, ob ) ) { recalc_normals= 1; calc_vertexnormals(re, obr, 0, 0); @@ -3552,9 +3566,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) if(recalc_normals!=0 || need_tangent!=0) calc_vertexnormals(re, obr, need_tangent, need_nmap_tangent); - - if(need_stress) - calc_edge_stress(re, obr, me); } dm->release(dm); diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index c77a1309743..a46b3791693 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -1036,6 +1036,9 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const * @param v2 [4 floats, world coordinates] second vertex * @param v3 [4 floats, world coordinates] third vertex */ + +/* WATCH IT: zbuffillGLinv4 and zbuffillGL4 are identical except for a 2 lines, + * commented below */ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4) { double zxd, zyd, zy0, zverg; @@ -1047,10 +1050,10 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v int *rectmaskofs, *rm; int *rz, x, y; int sn1, sn2, rectx, *rectzofs, my0, my2; - + /* init */ zbuf_init_span(zspan); - + /* set spans */ zbuf_add_to_span(zspan, v1, v2); zbuf_add_to_span(zspan, v2, v3); @@ -1058,19 +1061,19 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v zbuf_add_to_span(zspan, v3, v4); zbuf_add_to_span(zspan, v4, v1); } - else + else zbuf_add_to_span(zspan, v3, v1); - + /* clipped */ if(zspan->minp2==NULL || zspan->maxp2==NULL) return; - + if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1; if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1; - + // printf("my %d %d\n", my0, my2); if(my2<my0) return; - - + + /* ZBUF DX DY, in floats still */ x1= v1[0]- v2[0]; x2= v2[0]- v3[0]; @@ -1081,22 +1084,22 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v x0= y1*z2-z1*y2; y0= z1*x2-x1*z2; z0= x1*y2-y1*x2; - + if(z0==0.0f) return; - + xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2]; - + zxd= -(double)x0/(double)z0; zyd= -(double)y0/(double)z0; zy0= ((double)my2)*zyd + (double)xx1; - + /* start-offset in rect */ rectx= zspan->rectx; rectzofs= (zspan->rectz+rectx*my2); rectpofs= (zspan->rectp+rectx*my2); rectoofs= (zspan->recto+rectx*my2); rectmaskofs= (zspan->rectmask+rectx*my2); - + /* correct span */ sn1= (my0 + my2)/2; if(zspan->span1[sn1] < zspan->span2[sn1]) { @@ -1107,45 +1110,45 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v span1= zspan->span2+my2; span2= zspan->span1+my2; } - + for(y=my2; y>=my0; y--, span1--, span2--) { - + sn1= floor(*span1); sn2= floor(*span2); - sn1++; - + sn1++; + if(sn2>=rectx) sn2= rectx-1; if(sn1<0) sn1= 0; - + if(sn2>=sn1) { int intzverg; - + zverg= (double)sn1*zxd + zy0; rz= rectzofs+sn1; rp= rectpofs+sn1; ro= rectoofs+sn1; rm= rectmaskofs+sn1; x= sn2-sn1; - + while(x>=0) { intzverg= (int)CLAMPIS(zverg, INT_MIN, INT_MAX); - if( intzverg > *rz || *rz==0x7FFFFFFF) { + if( intzverg > *rz || *rz==0x7FFFFFFF) { /* UNIQUE LINE: see comment above */ if(!zspan->rectmask || intzverg > *rm) { - *ro= obi; + *ro= obi; /* UNIQUE LINE: see comment above (order differs) */ *rz= intzverg; *rp= zvlnr; } } zverg+= zxd; - rz++; - rp++; + rz++; + rp++; ro++; rm++; x--; } } - + zy0-=zyd; rectzofs-= rectx; rectpofs-= rectx; @@ -1156,6 +1159,8 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v /* uses spanbuffers */ +/* WATCH IT: zbuffillGLinv4 and zbuffillGL4 are identical except for a 2 lines, + * commented below */ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4) { double zxd, zyd, zy0, zverg; @@ -1167,10 +1172,10 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, int *rectmaskofs, *rm; int *rz, x, y; int sn1, sn2, rectx, *rectzofs, my0, my2; - + /* init */ zbuf_init_span(zspan); - + /* set spans */ zbuf_add_to_span(zspan, v1, v2); zbuf_add_to_span(zspan, v2, v3); @@ -1178,19 +1183,19 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, zbuf_add_to_span(zspan, v3, v4); zbuf_add_to_span(zspan, v4, v1); } - else + else zbuf_add_to_span(zspan, v3, v1); - + /* clipped */ if(zspan->minp2==NULL || zspan->maxp2==NULL) return; - + if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1; if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1; - -// printf("my %d %d\n", my0, my2); + + // printf("my %d %d\n", my0, my2); if(my2<my0) return; - - + + /* ZBUF DX DY, in floats still */ x1= v1[0]- v2[0]; x2= v2[0]- v3[0]; @@ -1201,7 +1206,7 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, x0= y1*z2-z1*y2; y0= z1*x2-x1*z2; z0= x1*y2-y1*x2; - + if(z0==0.0f) return; xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2]; @@ -1227,45 +1232,45 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, span1= zspan->span2+my2; span2= zspan->span1+my2; } - + for(y=my2; y>=my0; y--, span1--, span2--) { - + sn1= floor(*span1); sn2= floor(*span2); - sn1++; - + sn1++; + if(sn2>=rectx) sn2= rectx-1; if(sn1<0) sn1= 0; - + if(sn2>=sn1) { int intzverg; - + zverg= (double)sn1*zxd + zy0; rz= rectzofs+sn1; rp= rectpofs+sn1; ro= rectoofs+sn1; rm= rectmaskofs+sn1; x= sn2-sn1; - + while(x>=0) { intzverg= (int)CLAMPIS(zverg, INT_MIN, INT_MAX); - - if(intzverg < *rz) { + + if(intzverg < *rz) { /* ONLY UNIQUE LINE: see comment above */ if(!zspan->rectmask || intzverg > *rm) { *rz= intzverg; *rp= zvlnr; - *ro= obi; + *ro= obi; /* UNIQUE LINE: see comment above (order differs) */ } } zverg+= zxd; - rz++; - rp++; - ro++; + rz++; + rp++; + ro++; rm++; x--; } } - + zy0-=zyd; rectzofs-= rectx; rectpofs-= rectx; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 61c3da36203..11ac56090a3 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -199,6 +199,7 @@ int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, int con void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */ void WM_operator_properties_sanitize(struct PointerRNA *ptr, const short no_context); /* make props context sensitive or not */ +void WM_operator_properties_reset(struct wmOperator *op); void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring); void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot); void WM_operator_properties_free(struct PointerRNA *ptr); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 4107356ca0e..079833f693f 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -729,6 +729,47 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event) } } +static int wm_operator_init_from_last(wmWindowManager *wm, wmOperator *op) +{ + int change= FALSE; + wmOperator *lastop; + + for(lastop= wm->operators.last; lastop; lastop= lastop->prev) { + /* equality check is a bit paranoid but just incase */ + if((op != lastop) && (op->type == (lastop->type))) { + break; + } + } + + if (lastop && op != lastop) { + PropertyRNA *iterprop; + iterprop= RNA_struct_iterator_property(op->type->srna); + + RNA_PROP_BEGIN(op->ptr, itemptr, iterprop) { + PropertyRNA *prop= itemptr.data; + if((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) { + if (!RNA_property_is_set(op->ptr, prop)) { /* don't override a setting already set */ + const char *identifier= RNA_property_identifier(prop); + IDProperty *idp_src= IDP_GetPropertyFromGroup(lastop->properties, identifier); + if(idp_src) { + IDProperty *idp_dst = IDP_CopyProperty(idp_src); + + /* note - in the future this may need to be done recursively, + * but for now RNA doesn't access nested operators */ + idp_dst->flag |= IDP_FLAG_GHOST; + + IDP_ReplaceInGroup(op->properties, idp_dst); + change= TRUE; + } + } + } + } + RNA_PROP_END; + } + + return change; +} + static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, PointerRNA *properties, ReportList *reports, short poll_only) { wmWindowManager *wm= CTX_wm_manager(C); @@ -741,6 +782,11 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P if(WM_operator_poll(C, ot)) { wmOperator *op= wm_operator_create(wm, ot, properties, reports); /* if reports==NULL, theyll be initialized */ + /* initialize setting from previous run */ + if(wm->op_undo_depth == 0 && (ot->flag & OPTYPE_REGISTER)) { /* not called by py script */ + wm_operator_init_from_last(wm, op); + } + if((G.f & G_DEBUG) && event && event->type!=MOUSEMOVE) printf("handle evt %d win %d op %s\n", event?event->type:0, CTX_wm_screen(C)->subwinactive, ot->idname); diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index a81bfaacae7..97fb2022150 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -265,7 +265,7 @@ int WM_init_game(bContext *C) } /* Fullscreen */ - if(scene->gm.fullscreen) { + if((scene->gm.playerflag & GAME_PLAYER_FULLSCREEN)) { WM_operator_name_call(C, "WM_OT_window_fullscreen_toggle", WM_OP_EXEC_DEFAULT, NULL); wm_get_screensize(&ar->winrct.xmax, &ar->winrct.ymax); ar->winx = ar->winrct.xmax + 1; diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index c75395456dd..24af3ffedc1 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -981,6 +981,8 @@ void WM_keyconfig_update(wmWindowManager *wm) wmKeyMapDiffItem *kmdi; int compat_update = 0; + if(G.background) + return; if(!WM_KEYMAP_UPDATE) return; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 638a94db20a..123d5807325 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -638,6 +638,25 @@ void WM_operator_properties_sanitize(PointerRNA *ptr, const short no_context) RNA_STRUCT_END; } +/* remove all props without PROP_SKIP_SAVE */ +void WM_operator_properties_reset(wmOperator *op) +{ + if (op->ptr->data) { + PropertyRNA *iterprop; + iterprop= RNA_struct_iterator_property(op->type->srna); + + RNA_PROP_BEGIN(op->ptr, itemptr, iterprop) { + PropertyRNA *prop= itemptr.data; + + if((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) { + const char *identifier = RNA_property_identifier(prop); + RNA_struct_idprops_unset(op->ptr, identifier); + } + } + RNA_PROP_END; + } +} + void WM_operator_properties_free(PointerRNA *ptr) { IDProperty *properties= ptr->data; @@ -665,7 +684,7 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) printf("%s: %s \"%s\" is not an enum property\n", __func__, op->type->idname, RNA_property_identifier(prop)); } - else if (RNA_property_is_set(op->ptr, RNA_property_identifier(prop))) { + else if (RNA_property_is_set(op->ptr, prop)) { const int retval= op->type->exec(C, op); OPERATOR_RETVAL_CHECK(retval); return retval; @@ -747,7 +766,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op) uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT); //uiDefBut(block, LABEL, 0, op->type->name, 10, 10, 180, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); // ok, this isnt so easy... - but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, ""); + but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, ""); uiButSetSearchFunc(but, operator_enum_search_cb, op->type, operator_enum_call_cb, NULL); /* fake button, it holds space for search items */ @@ -802,7 +821,7 @@ int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) /* op->invoke, opens fileselect if path property not set, otherwise executes */ int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - if (RNA_property_is_set(op->ptr, "filepath")) { + if (RNA_struct_property_is_set(op->ptr, "filepath")) { return WM_operator_call_notest(C, op); /* call exec direct */ } else { @@ -1378,12 +1397,15 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons int len= strlen(ot->name); /* display name for menu, can hold hotkey */ - BLI_strncpy(name, ot->name, 256); + BLI_strncpy(name, ot->name, sizeof(name)); /* check for hotkey */ - if(len < 256-6) { - if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE, &name[len+1], 256-len-1)) + if (len < sizeof(name) - 6) { + if (WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE, + &name[len+1], sizeof(name)-len-1)) + { name[len]= '|'; + } } if(0==uiSearchItemAdd(items, name, ot, 0)) @@ -1405,7 +1427,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_ block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS); uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT); - but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, ""); + but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, ""); uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL); /* fake button, it holds space for search items */ @@ -1550,13 +1572,13 @@ static void WM_OT_read_factory_settings(wmOperatorType *ot) static void open_set_load_ui(wmOperator *op) { - if(!RNA_property_is_set(op->ptr, "load_ui")) + if(!RNA_struct_property_is_set(op->ptr, "load_ui")) RNA_boolean_set(op->ptr, "load_ui", !(U.flag & USER_FILENOUI)); } static void open_set_use_scripts(wmOperator *op) { - if(!RNA_property_is_set(op->ptr, "use_scripts")) { + if(!RNA_struct_property_is_set(op->ptr, "use_scripts")) { /* use G_SCRIPT_AUTOEXEC rather than the userpref because this means if * the flag has been disabled from the command line, then opening * from the menu wont enable this setting. */ @@ -1654,7 +1676,7 @@ int wm_link_append_poll(bContext *C) static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - if(RNA_property_is_set(op->ptr, "filepath")) { + if(RNA_struct_property_is_set(op->ptr, "filepath")) { return WM_operator_call_notest(C, op); } else { @@ -1918,7 +1940,7 @@ static void untitled(char *name) static void save_set_compress(wmOperator *op) { - if(!RNA_property_is_set(op->ptr, "compress")) { + if(!RNA_struct_property_is_set(op->ptr, "compress")) { if(G.save_over) /* keep flag for existing file */ RNA_boolean_set(op->ptr, "compress", G.fileflags & G_FILE_COMPRESS); else /* use userdef for new file */ @@ -1957,14 +1979,14 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op) save_set_compress(op); - if(RNA_property_is_set(op->ptr, "filepath")) + if(RNA_struct_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", path); else { BLI_strncpy(path, G.main->name, FILE_MAX); untitled(path); } - if(RNA_property_is_set(op->ptr, "copy")) + if(RNA_struct_property_is_set(op->ptr, "copy")) copy = RNA_boolean_get(op->ptr, "copy"); fileflags= G.fileflags; @@ -2092,7 +2114,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot) static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - if(!RNA_property_is_set(op->ptr, "filepath")) { + if(!RNA_struct_property_is_set(op->ptr, "filepath")) { char filepath[FILE_MAX]; BLI_strncpy(filepath, G.main->name, sizeof(filepath)); BLI_replace_extension(filepath, sizeof(filepath), ".dae"); @@ -2110,7 +2132,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) char filename[FILE_MAX]; int selected; - if(!RNA_property_is_set(op->ptr, "filepath")) { + if(!RNA_struct_property_is_set(op->ptr, "filepath")) { BKE_report(op->reports, RPT_ERROR, "No filename given"); return OPERATOR_CANCELLED; } @@ -2144,7 +2166,7 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op) { char filename[FILE_MAX]; - if(!RNA_property_is_set(op->ptr, "filepath")) { + if(!RNA_struct_property_is_set(op->ptr, "filepath")) { BKE_report(op->reports, RPT_ERROR, "No filename given"); return OPERATOR_CANCELLED; } diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index f64bcf14d11..1cecac4001c 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -2152,6 +2152,155 @@ KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist){ } +/* helper for BL_ConvertBlenderObjects, avoids code duplication + * note: all var names match args are passed from the caller */ +static void bl_ConvertBlenderObject_Single( + KX_BlenderSceneConverter *converter, + Scene *blenderscene, Object *blenderobject, + vector<MT_Vector3> &inivel, vector<MT_Vector3> &iniang, + vector<parentChildLink> &vec_parent_child, + CListValue* logicbrick_conversionlist, + CListValue* objectlist, CListValue* inactivelist, CListValue* sumolist, + KX_Scene* kxscene, KX_GameObject* gameobj, + SCA_LogicManager* logicmgr, SCA_TimeEventManager* timemgr, + bool isInActiveLayer + ) +{ + MT_Point3 posPrev; + MT_Matrix3x3 angor; + if (converter->addInitFromFrame) blenderscene->r.cfra=blenderscene->r.sfra; + + MT_Point3 pos( + blenderobject->loc[0]+blenderobject->dloc[0], + blenderobject->loc[1]+blenderobject->dloc[1], + blenderobject->loc[2]+blenderobject->dloc[2] + ); + MT_Vector3 eulxyz(blenderobject->rot); + MT_Vector3 scale(blenderobject->size); + if (converter->addInitFromFrame){//rcruiz + float eulxyzPrev[3]; + blenderscene->r.cfra=blenderscene->r.sfra-1; + //XXX update_for_newframe(); + MT_Vector3 tmp=pos-MT_Point3(blenderobject->loc[0]+blenderobject->dloc[0], + blenderobject->loc[1]+blenderobject->dloc[1], + blenderobject->loc[2]+blenderobject->dloc[2] + ); + eulxyzPrev[0]=blenderobject->rot[0]; + eulxyzPrev[1]=blenderobject->rot[1]; + eulxyzPrev[2]=blenderobject->rot[2]; + + double fps = (double) blenderscene->r.frs_sec/ + (double) blenderscene->r.frs_sec_base; + + tmp.scale(fps, fps, fps); + inivel.push_back(tmp); + tmp=eulxyz-eulxyzPrev; + tmp.scale(fps, fps, fps); + iniang.push_back(tmp); + blenderscene->r.cfra=blenderscene->r.sfra; + //XXX update_for_newframe(); + } + + gameobj->NodeSetLocalPosition(pos); + gameobj->NodeSetLocalOrientation(MT_Matrix3x3(eulxyz)); + gameobj->NodeSetLocalScale(scale); + gameobj->NodeUpdateGS(0); + + BL_ConvertMaterialIpos(blenderobject, gameobj, converter); + + sumolist->Add(gameobj->AddRef()); + + BL_ConvertProperties(blenderobject,gameobj,timemgr,kxscene,isInActiveLayer); + + gameobj->SetName(blenderobject->id.name + 2); + + // update children/parent hierarchy + if ((blenderobject->parent != 0)&&(!converter->addInitFromFrame)) + { + // blender has an additional 'parentinverse' offset in each object + SG_Callbacks callback(NULL,NULL,NULL,KX_Scene::KX_ScenegraphUpdateFunc,KX_Scene::KX_ScenegraphRescheduleFunc); + SG_Node* parentinversenode = new SG_Node(NULL,kxscene,callback); + + // define a normal parent relationship for this node. + KX_NormalParentRelation * parent_relation = KX_NormalParentRelation::New(); + parentinversenode->SetParentRelation(parent_relation); + + parentChildLink pclink; + pclink.m_blenderchild = blenderobject; + pclink.m_gamechildnode = parentinversenode; + vec_parent_child.push_back(pclink); + + float* fl = (float*) blenderobject->parentinv; + MT_Transform parinvtrans(fl); + parentinversenode->SetLocalPosition(parinvtrans.getOrigin()); + // problem here: the parent inverse transform combines scaling and rotation + // in the basis but the scenegraph needs separate rotation and scaling. + // This is not important for OpenGL (it uses 4x4 matrix) but it is important + // for the physic engine that needs a separate scaling + //parentinversenode->SetLocalOrientation(parinvtrans.getBasis()); + + // Extract the rotation and the scaling from the basis + MT_Matrix3x3 ori(parinvtrans.getBasis()); + MT_Vector3 x(ori.getColumn(0)); + MT_Vector3 y(ori.getColumn(1)); + MT_Vector3 z(ori.getColumn(2)); + MT_Vector3 parscale(x.length(), y.length(), z.length()); + if (!MT_fuzzyZero(parscale[0])) + x /= parscale[0]; + if (!MT_fuzzyZero(parscale[1])) + y /= parscale[1]; + if (!MT_fuzzyZero(parscale[2])) + z /= parscale[2]; + ori.setColumn(0, x); + ori.setColumn(1, y); + ori.setColumn(2, z); + parentinversenode->SetLocalOrientation(ori); + parentinversenode->SetLocalScale(parscale); + + parentinversenode->AddChild(gameobj->GetSGNode()); + } + + // needed for python scripting + logicmgr->RegisterGameObjectName(gameobj->GetName(),gameobj); + + // needed for group duplication + logicmgr->RegisterGameObj(blenderobject, gameobj); + for (int i = 0; i < gameobj->GetMeshCount(); i++) + logicmgr->RegisterGameMeshName(gameobj->GetMesh(i)->GetName(), blenderobject); + + converter->RegisterGameObject(gameobj, blenderobject); + // this was put in rapidly, needs to be looked at more closely + // only draw/use objects in active 'blender' layers + + logicbrick_conversionlist->Add(gameobj->AddRef()); + + if (converter->addInitFromFrame){ + posPrev=gameobj->NodeGetWorldPosition(); + angor=gameobj->NodeGetWorldOrientation(); + } + if (isInActiveLayer) + { + objectlist->Add(gameobj->AddRef()); + //tf.Add(gameobj->GetSGNode()); + + gameobj->NodeUpdateGS(0); + gameobj->AddMeshUser(); + + } + else + { + //we must store this object otherwise it will be deleted + //at the end of this function if it is not a root object + inactivelist->Add(gameobj->AddRef()); + } + + if (converter->addInitFromFrame) { + gameobj->NodeSetLocalPosition(posPrev); + gameobj->NodeSetLocalOrientation(angor); + } +} + + // convert blender objects into ketsji gameobjects void BL_ConvertBlenderObjects(struct Main* maggie, KX_Scene* kxscene, @@ -2162,7 +2311,21 @@ void BL_ConvertBlenderObjects(struct Main* maggie, KX_BlenderSceneConverter* converter, bool alwaysUseExpandFraming ) -{ +{ + +#define BL_CONVERTBLENDEROBJECT_SINGLE \ + bl_ConvertBlenderObject_Single(converter, \ + blenderscene, blenderobject, \ + inivel, iniang, \ + vec_parent_child, \ + logicbrick_conversionlist, \ + objectlist, inactivelist, sumolist, \ + kxscene, gameobj, \ + logicmgr, timemgr, \ + isInActiveLayer \ + ) + + Scene *blenderscene = kxscene->GetBlenderScene(); // for SETLOOPER @@ -2265,155 +2428,27 @@ void BL_ConvertBlenderObjects(struct Main* maggie, if (!isInActiveLayer) addobj=false; - if (gameobj&&addobj) + if (gameobj) { - MT_Point3 posPrev; - MT_Matrix3x3 angor; - if (converter->addInitFromFrame) blenderscene->r.cfra=blenderscene->r.sfra; - - MT_Point3 pos; - pos.setValue( - blenderobject->loc[0]+blenderobject->dloc[0], - blenderobject->loc[1]+blenderobject->dloc[1], - blenderobject->loc[2]+blenderobject->dloc[2] - ); - MT_Vector3 eulxyz(blenderobject->rot); - MT_Vector3 scale(blenderobject->size); - if (converter->addInitFromFrame){//rcruiz - float eulxyzPrev[3]; - blenderscene->r.cfra=blenderscene->r.sfra-1; - //XXX update_for_newframe(); - MT_Vector3 tmp=pos-MT_Point3(blenderobject->loc[0]+blenderobject->dloc[0], - blenderobject->loc[1]+blenderobject->dloc[1], - blenderobject->loc[2]+blenderobject->dloc[2] - ); - eulxyzPrev[0]=blenderobject->rot[0]; - eulxyzPrev[1]=blenderobject->rot[1]; - eulxyzPrev[2]=blenderobject->rot[2]; - - double fps = (double) blenderscene->r.frs_sec/ - (double) blenderscene->r.frs_sec_base; - - tmp.scale(fps, fps, fps); - inivel.push_back(tmp); - tmp=eulxyz-eulxyzPrev; - tmp.scale(fps, fps, fps); - iniang.push_back(tmp); - blenderscene->r.cfra=blenderscene->r.sfra; - //XXX update_for_newframe(); - } - - gameobj->NodeSetLocalPosition(pos); - gameobj->NodeSetLocalOrientation(MT_Matrix3x3(eulxyz)); - gameobj->NodeSetLocalScale(scale); - gameobj->NodeUpdateGS(0); + if (addobj) + { /* macro calls object conversion funcs */ + BL_CONVERTBLENDEROBJECT_SINGLE; - BL_ConvertMaterialIpos(blenderobject, gameobj, converter); - - sumolist->Add(gameobj->AddRef()); - - BL_ConvertProperties(blenderobject,gameobj,timemgr,kxscene,isInActiveLayer); - - gameobj->SetName(blenderobject->id.name + 2); - - // update children/parent hierarchy - if ((blenderobject->parent != 0)&&(!converter->addInitFromFrame)) - { - // blender has an additional 'parentinverse' offset in each object - SG_Callbacks callback(NULL,NULL,NULL,KX_Scene::KX_ScenegraphUpdateFunc,KX_Scene::KX_ScenegraphRescheduleFunc); - SG_Node* parentinversenode = new SG_Node(NULL,kxscene,callback); - - // define a normal parent relationship for this node. - KX_NormalParentRelation * parent_relation = KX_NormalParentRelation::New(); - parentinversenode->SetParentRelation(parent_relation); - - parentChildLink pclink; - pclink.m_blenderchild = blenderobject; - pclink.m_gamechildnode = parentinversenode; - vec_parent_child.push_back(pclink); - - float* fl = (float*) blenderobject->parentinv; - MT_Transform parinvtrans(fl); - parentinversenode->SetLocalPosition(parinvtrans.getOrigin()); - // problem here: the parent inverse transform combines scaling and rotation - // in the basis but the scenegraph needs separate rotation and scaling. - // This is not important for OpenGL (it uses 4x4 matrix) but it is important - // for the physic engine that needs a separate scaling - //parentinversenode->SetLocalOrientation(parinvtrans.getBasis()); - - // Extract the rotation and the scaling from the basis - MT_Matrix3x3 ori(parinvtrans.getBasis()); - MT_Vector3 x(ori.getColumn(0)); - MT_Vector3 y(ori.getColumn(1)); - MT_Vector3 z(ori.getColumn(2)); - MT_Vector3 parscale(x.length(), y.length(), z.length()); - if (!MT_fuzzyZero(parscale[0])) - x /= parscale[0]; - if (!MT_fuzzyZero(parscale[1])) - y /= parscale[1]; - if (!MT_fuzzyZero(parscale[2])) - z /= parscale[2]; - ori.setColumn(0, x); - ori.setColumn(1, y); - ori.setColumn(2, z); - parentinversenode->SetLocalOrientation(ori); - parentinversenode->SetLocalScale(parscale); - - parentinversenode->AddChild(gameobj->GetSGNode()); + if (gameobj->IsDupliGroup()) { + grouplist.insert(blenderobject->dup_group); + } } - - // needed for python scripting - logicmgr->RegisterGameObjectName(gameobj->GetName(),gameobj); - // needed for group duplication - logicmgr->RegisterGameObj(blenderobject, gameobj); - for (int i = 0; i < gameobj->GetMeshCount(); i++) - logicmgr->RegisterGameMeshName(gameobj->GetMesh(i)->GetName(), blenderobject); - - converter->RegisterGameObject(gameobj, blenderobject); - // this was put in rapidly, needs to be looked at more closely - // only draw/use objects in active 'blender' layers - - logicbrick_conversionlist->Add(gameobj->AddRef()); - - if (converter->addInitFromFrame){ - posPrev=gameobj->NodeGetWorldPosition(); - angor=gameobj->NodeGetWorldOrientation(); - } - if (isInActiveLayer) - { - objectlist->Add(gameobj->AddRef()); - //tf.Add(gameobj->GetSGNode()); - - gameobj->NodeUpdateGS(0); - gameobj->AddMeshUser(); - - } - else - { - //we must store this object otherwise it will be deleted - //at the end of this function if it is not a root object - inactivelist->Add(gameobj->AddRef()); - } - if (gameobj->IsDupliGroup()) - grouplist.insert(blenderobject->dup_group); - if (converter->addInitFromFrame){ - gameobj->NodeSetLocalPosition(posPrev); - gameobj->NodeSetLocalOrientation(angor); - } - - } - /* Note about memory leak issues: - When a CValue derived class is created, m_refcount is initialized to 1 - so the class must be released after being used to make sure that it won't - hang in memory. If the object needs to be stored for a long time, - use AddRef() so that this Release() does not free the object. - Make sure that for any AddRef() there is a Release()!!!! - Do the same for any object derived from CValue, CExpression and NG_NetworkMessage - */ - if (gameobj) + /* Note about memory leak issues: + * When a CValue derived class is created, m_refcount is initialized to 1 + * so the class must be released after being used to make sure that it won't + * hang in memory. If the object needs to be stored for a long time, + * use AddRef() so that this Release() does not free the object. + * Make sure that for any AddRef() there is a Release()!!!! + * Do the same for any object derived from CValue, CExpression and NG_NetworkMessage + */ gameobj->Release(); - + } } if (!grouplist.empty()) @@ -2453,147 +2488,26 @@ void BL_ConvertBlenderObjects(struct Main* maggie, if (converter->addInitFromFrame) if (!isInActiveLayer) addobj=false; - - if (gameobj&&addobj) + + if (gameobj) { - MT_Point3 posPrev; - MT_Matrix3x3 angor; - if (converter->addInitFromFrame) - blenderscene->r.cfra=blenderscene->r.sfra; - - MT_Point3 pos( - blenderobject->loc[0]+blenderobject->dloc[0], - blenderobject->loc[1]+blenderobject->dloc[1], - blenderobject->loc[2]+blenderobject->dloc[2] - ); - MT_Vector3 eulxyz(blenderobject->rot); - MT_Vector3 scale(blenderobject->size); - if (converter->addInitFromFrame){//rcruiz - float eulxyzPrev[3]; - blenderscene->r.cfra=blenderscene->r.sfra-1; - //XXX update_for_newframe(); - MT_Vector3 tmp=pos-MT_Point3(blenderobject->loc[0]+blenderobject->dloc[0], - blenderobject->loc[1]+blenderobject->dloc[1], - blenderobject->loc[2]+blenderobject->dloc[2] - ); - eulxyzPrev[0]=blenderobject->rot[0]; - eulxyzPrev[1]=blenderobject->rot[1]; - eulxyzPrev[2]=blenderobject->rot[2]; - - double fps = (double) blenderscene->r.frs_sec/ - (double) blenderscene->r.frs_sec_base; - - tmp.scale(fps, fps, fps); - inivel.push_back(tmp); - tmp=eulxyz-eulxyzPrev; - tmp.scale(fps, fps, fps); - iniang.push_back(tmp); - blenderscene->r.cfra=blenderscene->r.sfra; - //XXX update_for_newframe(); - } - - gameobj->NodeSetLocalPosition(pos); - gameobj->NodeSetLocalOrientation(MT_Matrix3x3(eulxyz)); - gameobj->NodeSetLocalScale(scale); - gameobj->NodeUpdateGS(0); - - BL_ConvertMaterialIpos(blenderobject,gameobj, converter); - - sumolist->Add(gameobj->AddRef()); - - BL_ConvertProperties(blenderobject,gameobj,timemgr,kxscene,isInActiveLayer); - - - gameobj->SetName(blenderobject->id.name + 2); - - // update children/parent hierarchy - if ((blenderobject->parent != 0)&&(!converter->addInitFromFrame)) - { - // blender has an additional 'parentinverse' offset in each object - SG_Callbacks callback(NULL,NULL,NULL,KX_Scene::KX_ScenegraphUpdateFunc,KX_Scene::KX_ScenegraphRescheduleFunc); - SG_Node* parentinversenode = new SG_Node(NULL,kxscene,callback); - - // define a normal parent relationship for this node. - KX_NormalParentRelation * parent_relation = KX_NormalParentRelation::New(); - parentinversenode->SetParentRelation(parent_relation); - - parentChildLink pclink; - pclink.m_blenderchild = blenderobject; - pclink.m_gamechildnode = parentinversenode; - vec_parent_child.push_back(pclink); - - float* fl = (float*) blenderobject->parentinv; - MT_Transform parinvtrans(fl); - parentinversenode->SetLocalPosition(parinvtrans.getOrigin()); - - // Extract the rotation and the scaling from the basis - MT_Matrix3x3 ori(parinvtrans.getBasis()); - MT_Vector3 x(ori.getColumn(0)); - MT_Vector3 y(ori.getColumn(1)); - MT_Vector3 z(ori.getColumn(2)); - MT_Vector3 localscale(x.length(), y.length(), z.length()); - if (!MT_fuzzyZero(localscale[0])) - x /= localscale[0]; - if (!MT_fuzzyZero(localscale[1])) - y /= localscale[1]; - if (!MT_fuzzyZero(localscale[2])) - z /= localscale[2]; - ori.setColumn(0, x); - ori.setColumn(1, y); - ori.setColumn(2, z); - parentinversenode->SetLocalOrientation(ori); - parentinversenode->SetLocalScale(localscale); - - parentinversenode->AddChild(gameobj->GetSGNode()); - } - - // needed for python scripting - logicmgr->RegisterGameObjectName(gameobj->GetName(),gameobj); - - // needed for group duplication - logicmgr->RegisterGameObj(blenderobject, gameobj); - for (int i = 0; i < gameobj->GetMeshCount(); i++) - logicmgr->RegisterGameMeshName(gameobj->GetMesh(i)->GetName(), blenderobject); - - converter->RegisterGameObject(gameobj, blenderobject); - // this was put in rapidly, needs to be looked at more closely - // only draw/use objects in active 'blender' layers - - logicbrick_conversionlist->Add(gameobj->AddRef()); - - if (converter->addInitFromFrame){ - posPrev=gameobj->NodeGetWorldPosition(); - angor=gameobj->NodeGetWorldOrientation(); - } - if (isInActiveLayer) - { - objectlist->Add(gameobj->AddRef()); - //tf.Add(gameobj->GetSGNode()); - - gameobj->NodeUpdateGS(0); - gameobj->AddMeshUser(); + if (addobj) + { /* macro calls object conversion funcs */ + BL_CONVERTBLENDEROBJECT_SINGLE; } - else - { - //we must store this object otherwise it will be deleted - //at the end of this function if it is not a root object - inactivelist->Add(gameobj->AddRef()); - } if (gameobj->IsDupliGroup()) { - // check that the group is not already converted if (allgrouplist.insert(blenderobject->dup_group).second) + { grouplist.insert(blenderobject->dup_group); + } } - if (converter->addInitFromFrame){ - gameobj->NodeSetLocalPosition(posPrev); - gameobj->NodeSetLocalOrientation(angor); - } - - } - if (gameobj) + + + /* see comment above re: mem leaks */ gameobj->Release(); + } } } } diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index f249510ecc7..f7c366599ef 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -372,17 +372,20 @@ bool GPG_Application::startFullScreen( int bpp,int frequency, const bool stereoVisual, const int stereoMode, - const GHOST_TUns16 samples) + const GHOST_TUns16 samples, + bool useDesktop) { bool success; + GHOST_TUns32 sysWidth=0, sysHeight=0; + fSystem->getMainDisplayDimensions(sysWidth, sysHeight); // Create the main window GHOST_DisplaySetting setting; - setting.xPixels = width; - setting.yPixels = height; + setting.xPixels = (useDesktop) ? sysWidth : width; + setting.yPixels = (useDesktop) ? sysHeight : height; setting.bpp = bpp; setting.frequency = frequency; - fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual); + fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual, samples); m_mainWindow->setCursorVisibility(false); m_mainWindow->setState(GHOST_kWindowStateFullScreen); diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h index 37625dc8998..51dac5cb3f3 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h @@ -64,7 +64,7 @@ public: bool SetGameEngineData(struct Main* maggie, struct Scene* scene, GlobalSettings* gs, int argc, char** argv); bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); - bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); + bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0, bool useDesktop=false); bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); #ifdef WIN32 bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index e84df921fd5..c725847037a 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -365,6 +365,7 @@ int main(int argc, char** argv) GHOST_TEmbedderWindowID parentWindow = 0; bool isBlenderPlayer = false; int validArguments=0; + bool samplesParFound = false; GHOST_TUns16 aasamples = 0; #ifdef __linux__ @@ -582,8 +583,14 @@ int main(int argc, char** argv) break; case 'm': i++; + samplesParFound = true; if ((i+1) <= validArguments ) - aasamples = atoi(argv[i++]); + aasamples = atoi(argv[i++]); + else + { + error = true; + printf("error: No argument supplied for -m"); + } break; case 'c': i++; @@ -819,7 +826,7 @@ int main(int argc, char** argv) if ((!fullScreenParFound) && (!windowParFound)) { // Only use file settings when command line did not override - if (scene->gm.fullscreen) { + if ((scene->gm.playerflag & GAME_PLAYER_FULLSCREEN)) { //printf("fullscreen option found in Blender file\n"); fullScreen = true; fullScreenWidth= scene->gm.xplay; @@ -848,6 +855,9 @@ int main(int argc, char** argv) else scene->gm.stereoflag = STEREO_ENABLED; + if (!samplesParFound) + aasamples = scene->gm.aasamples; + if (stereoFlag == STEREO_DOME){ stereomode = RAS_IRasterizer::RAS_STEREO_DOME; scene->gm.stereoflag = STEREO_DOME; @@ -893,7 +903,7 @@ int main(int argc, char** argv) #endif { app.startFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency, - stereoWindow, stereomode, aasamples); + stereoWindow, stereomode, aasamples, (scene->gm.playerflag & GAME_PLAYER_DESKTOP_RESOLUTION)); } } else diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 9a2c0cb89b1..114ca735265 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -47,6 +47,12 @@ #undef _XOPEN_SOURCE #endif +#if defined(__sun) || defined(sun) +#if defined(_XPG4) +#undef _XPG4 +#endif +#endif + #include <Python.h> extern "C" { |