diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-05-19 05:40:37 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-05-19 05:40:37 +0400 |
commit | dfcd01553536d63dab1037d0ea289b9d9d90c39c (patch) | |
tree | 089cf7b605457c8d565f1e1a3c82558210c5e87d /source | |
parent | 31471f644cb9d9c3b88da1977705724649482a82 (diff) | |
parent | c04f9b779c4384f3cc6961b2ed54456bdab14f43 (diff) |
Merged changes in the trunk up to revision 36757.
Diffstat (limited to 'source')
229 files changed, 3039 insertions, 2984 deletions
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt index d4d572aca8e..88f15c2430e 100644 --- a/source/blender/CMakeLists.txt +++ b/source/blender/CMakeLists.txt @@ -91,7 +91,6 @@ add_subdirectory(blenlib) add_subdirectory(render) add_subdirectory(blenfont) add_subdirectory(blenloader) -add_subdirectory(readblenfile) add_subdirectory(blenpluginapi) add_subdirectory(ikplugin) add_subdirectory(gpu) @@ -124,6 +123,5 @@ if(WITH_PYTHON) endif() if(WITH_OPENCOLLADA) - add_subdirectory(collada) + add_subdirectory(collada) endif() - diff --git a/source/blender/SConscript b/source/blender/SConscript index 1489f9a3738..ed69c9e57e9 100644 --- a/source/blender/SConscript +++ b/source/blender/SConscript @@ -13,7 +13,6 @@ SConscript(['avi/SConscript', 'imbuf/SConscript', 'makesdna/SConscript', 'makesrna/SConscript', - 'readblenfile/SConscript', 'render/SConscript', 'nodes/SConscript', 'modifiers/SConscript', diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index 15fbfaa2de2..48ee4aed033 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -29,7 +29,7 @@ set(INC ../editors/include ../blenkernel ../../../intern/guardedalloc - ${GLEW_INCLUDE_PATH} + ${GLEW_INCLUDE_PATH} ${FREETYPE_INCLUDE_DIRS} ) diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c index 857ead0b7cd..fd874d991ea 100644 --- a/source/blender/blenfont/intern/blf_dir.c +++ b/source/blender/blenfont/intern/blf_dir.c @@ -51,6 +51,7 @@ #include "BLF_api.h" #include "blf_internal_types.h" +#include "blf_internal.h" static ListBase global_font_dir= { NULL, NULL }; @@ -150,6 +151,7 @@ char *blf_dir_search(const char *file) return(s); } +#if 0 // UNUSED int blf_dir_split(const char *str, char *file, int *size) { int i, len; @@ -173,6 +175,7 @@ int blf_dir_split(const char *str, char *file, int *size) } return(0); } +#endif /* Some font have additional file with metrics information, * in general, the extension of the file is: .afm or .pfm diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index 34df8d72103..9271d8d5a9e 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -44,7 +44,7 @@ int blf_utf8_next(unsigned char *buf, int *iindex); char *blf_dir_search(const char *file); char *blf_dir_metrics_search(const char *filename); -int blf_dir_split(const char *str, char *file, int *size); +// int blf_dir_split(const char *str, char *file, int *size); // UNUSED int blf_font_init(void); void blf_font_exit(void); diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index a9d379e6c69..ad736cd07bf 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -90,8 +90,7 @@ void brush_painter_free(BrushPainter *painter); unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side); /* radial control */ -void brush_radial_control_invoke(struct wmOperator *op, struct Brush *br, float size_weight); -int brush_radial_control_exec(struct wmOperator *op, struct Brush *br, float size_weight); +struct ImBuf *brush_gen_radial_control_imbuf(struct Brush *br); /* unified strength and size */ diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index b3709853a8c..744ed9dba9c 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -78,7 +78,6 @@ void curvemapping_premultiply(struct CurveMapping *cumap, int restore); int curvemapping_RGBA_does_something(struct CurveMapping *cumap); void curvemapping_initialize(struct CurveMapping *cumap); void curvemapping_table_RGBA(struct CurveMapping *cumap, float **array, int *size); -void colorcorrection_do_ibuf(struct ImBuf *ibuf, const char *profile); void scopes_update(struct Scopes *scopes, struct ImBuf *ibuf, int use_color_management); void scopes_free(struct Scopes *scopes); diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h index 5404402718d..3c12a5d615d 100644 --- a/source/blender/blenkernel/BKE_icons.h +++ b/source/blender/blenkernel/BKE_icons.h @@ -52,6 +52,7 @@ struct Icon typedef struct Icon Icon; struct PreviewImage; +struct ID; void BKE_icons_init(int first_dyn_id); @@ -74,11 +75,14 @@ void BKE_icon_changed(int icon_id); /* free all icons */ void BKE_icons_free(void); +/* free the preview image for use in list */ +void BKE_previewimg_freefunc(void *link); + /* free the preview image */ void BKE_previewimg_free(struct PreviewImage **prv); /* free the preview image belonging to the id */ -void BKE_previewimg_free_id(ID *id); +void BKE_previewimg_free_id(struct ID *id); /* create a new preview image */ struct PreviewImage* BKE_previewimg_create(void) ; @@ -87,6 +91,6 @@ struct PreviewImage* BKE_previewimg_create(void) ; struct PreviewImage* BKE_previewimg_copy(struct PreviewImage *prv); /* retrieve existing or create new preview image */ -PreviewImage* BKE_previewimg_get(ID *id); +struct PreviewImage* BKE_previewimg_get(struct ID *id); #endif /* BKE_ICONS_H */ diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 57829e957f7..94c474c668f 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -268,6 +268,10 @@ void seq_translate(struct Scene *scene, struct Sequence *seq, int delta); void seq_sound_init(struct Scene *scene, struct Sequence *seq); struct Sequence *seq_foreground_frame_get(struct Scene *scene, int frame); struct ListBase *seq_seqbase(struct ListBase *seqbase, struct Sequence *seq); +struct Sequence *seq_metastrip( + ListBase * seqbase /* = ed->seqbase */, + struct Sequence * meta /* = NULL */, struct Sequence *seq); + void seq_offset_animdata(struct Scene *scene, struct Sequence *seq, int ofs); void seq_dupe_animdata(struct Scene *scene, char *name_from, char *name_to); int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene *evil_scene); diff --git a/source/blender/blenkernel/BKE_sketch.h b/source/blender/blenkernel/BKE_sketch.h index 360a95bfb24..087cabc5c3d 100644 --- a/source/blender/blenkernel/BKE_sketch.h +++ b/source/blender/blenkernel/BKE_sketch.h @@ -73,8 +73,8 @@ typedef struct SK_Overdraw typedef struct SK_DrawData { - short mval[2]; - short previous_mval[2]; + int mval[2]; + int previous_mval[2]; SK_PType type; } SK_DrawData; @@ -152,7 +152,7 @@ void sk_endContinuousStroke(SK_Stroke *stk); void sk_updateNextPoint(SK_Sketch *sketch, SK_Stroke *stk); -void sk_initDrawData(SK_DrawData *dd, const short mval[2]); +void sk_initDrawData(SK_DrawData *dd, const int mval[2]); void sk_deleteSelectedStrokes(SK_Sketch *sketch); void sk_selectAllSketch(SK_Sketch *sketch, int mode); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 0da260c3f2a..47fe302fb1b 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -54,7 +54,7 @@ set(INC ../../../intern/opennl/extern ../../../intern/smoke/extern ../../../intern/mikktspace - ../../../source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h + ../../../source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h ${GLEW_INCLUDE_PATH} ${ZLIB_INCLUDE_DIRS} ) @@ -279,11 +279,6 @@ if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() -if(WITH_LCMS) - list(APPEND INC ${LCMS_INCLUDE_DIR}) - add_definitions(-DWITH_LCMS) -endif() - if(WITH_PYTHON) list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS}) add_definitions(-DWITH_PYTHON) @@ -316,7 +311,7 @@ if(WITH_LZMA) endif() if(MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") endif() blender_add_lib(bf_blenkernel "${SRC}" "${INC}") diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 52b8b535038..a06479db102 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -78,10 +78,6 @@ if env['OURPLATFORM'] == 'darwin': if env['BF_NO_ELBEEM']: defs.append('DISABLE_ELBEEM') -if env['WITH_BF_LCMS']: - defs.append('WITH_LCMS') - incs += ' ' + env['BF_LCMS_INC'] - if env['WITH_BF_LZO']: incs += ' #/extern/lzo/minilzo' defs.append('WITH_LZO') diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 5b49d9a9841..77f56058a4f 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -831,7 +831,10 @@ void pose_remove_group (Object *ob) /* now, remove it from the pose */ BLI_freelinkN(&pose->agroups, grp); - pose->active_group= 0; + pose->active_group--; + if(pose->active_group < 0 || pose->agroups.first == NULL) { + pose->active_group= 0; + } } } diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 75c6303d800..2fce1175fe1 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -191,7 +191,7 @@ static void clean_paths(Main *main) /* note, this is called on Undo so any slow conversion functions here * should be avoided or check (mode!='u') */ -static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filename) +static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath) { bScreen *curscreen= NULL; Scene *curscene= NULL; @@ -295,18 +295,18 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filename if(recover && bfd->filename[0] && G.relbase_valid) { /* in case of autosave or quit.blend, use original filename instead * use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */ - filename= bfd->filename; + filepath= bfd->filename; } #if 0 else if (!G.relbase_valid) { /* otherwise, use an empty string as filename, rather than <memory2> */ - filename=""; + filepath=""; } #endif /* these are the same at times, should never copy to the same location */ - if(G.main->name != filename) - BLI_strncpy(G.main->name, filename, FILE_MAX); + if(G.main->name != filepath) + BLI_strncpy(G.main->name, filepath, FILE_MAX); /* baseflags, groups, make depsgraph, etc */ set_scene_bg(G.main, CTX_data_scene(C)); @@ -353,15 +353,15 @@ void BKE_userdef_free(void) BLI_freelistN(&U.addons); } -int BKE_read_file(bContext *C, const char *dir, ReportList *reports) +int BKE_read_file(bContext *C, const char *filepath, ReportList *reports) { BlendFileData *bfd; int retval= BKE_READ_FILE_OK; - if(strstr(dir, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */ - printf("read blend: %s\n", dir); + if(strstr(filepath, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */ + printf("read blend: %s\n", filepath); - bfd= BLO_read_from_file(dir, reports); + bfd= BLO_read_from_file(filepath, reports); if (bfd) { if(bfd->user) retval= BKE_READ_FILE_OK_USERPREFS; @@ -372,10 +372,10 @@ int BKE_read_file(bContext *C, const char *dir, ReportList *reports) retval= BKE_READ_FILE_FAIL; } else - setup_app_data(C, bfd, dir); // frees BFD + setup_app_data(C, bfd, filepath); // frees BFD } else - BKE_reports_prependf(reports, "Loading %s failed: ", dir); + BKE_reports_prependf(reports, "Loading %s failed: ", filepath); return (bfd?retval:BKE_READ_FILE_FAIL); } @@ -521,19 +521,19 @@ void BKE_write_undo(bContext *C, const char *name) /* disk save version */ if(UNDO_DISK) { static int counter= 0; - char tstr[FILE_MAXDIR+FILE_MAXFILE]; + char filepath[FILE_MAXDIR+FILE_MAXFILE]; char numstr[32]; - /* calculate current filename */ + /* calculate current filepath */ counter++; counter= counter % U.undosteps; BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter); - BLI_make_file_string("/", tstr, btempdir, numstr); + BLI_make_file_string("/", filepath, btempdir, numstr); - success= BLO_write_file(CTX_data_main(C), tstr, G.fileflags, NULL, NULL); + success= BLO_write_file(CTX_data_main(C), filepath, G.fileflags, NULL, NULL); - BLI_strncpy(curundo->str, tstr, sizeof(curundo->str)); + BLI_strncpy(curundo->str, filepath, sizeof(curundo->str)); } else { MemFile *prevfile=NULL; diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index fa3b756ae27..98c540f53b7 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -426,13 +426,6 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset) curvemapping_changed(b->curve, 0); } -static MTex *brush_active_texture(Brush *brush) -{ - if(brush) - return &brush->mtex; - return NULL; -} - int brush_texture_set_nr(Brush *brush, int nr) { ID *idtest, *id=NULL; @@ -1185,7 +1178,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side) } /**** Radial Control ****/ -static struct ImBuf *brush_gen_radial_control_imbuf(Brush *br) +struct ImBuf *brush_gen_radial_control_imbuf(Brush *br) { ImBuf *im = MEM_callocN(sizeof(ImBuf), "radial control texture"); unsigned int *texcache; @@ -1219,50 +1212,6 @@ static struct ImBuf *brush_gen_radial_control_imbuf(Brush *br) return im; } -void brush_radial_control_invoke(wmOperator *op, Brush *br, float size_weight) -{ - int mode = RNA_enum_get(op->ptr, "mode"); - float original_value= 0; - - if(mode == WM_RADIALCONTROL_SIZE) - original_value = brush_size(br) * size_weight; - else if(mode == WM_RADIALCONTROL_STRENGTH) - original_value = brush_alpha(br); - else if(mode == WM_RADIALCONTROL_ANGLE) { - MTex *mtex = brush_active_texture(br); - if(mtex) - original_value = mtex->rot; - } - - RNA_float_set(op->ptr, "initial_value", original_value); - op->customdata = brush_gen_radial_control_imbuf(br); -} - -int brush_radial_control_exec(wmOperator *op, Brush *br, float size_weight) -{ - int mode = RNA_enum_get(op->ptr, "mode"); - float new_value = RNA_float_get(op->ptr, "new_value"); - const float conv = 0.017453293; - - if(mode == WM_RADIALCONTROL_SIZE) - if (brush_use_locked_size(br)) { - float initial_value = RNA_float_get(op->ptr, "initial_value"); - const float unprojected_radius = brush_unprojected_radius(br); - brush_set_unprojected_radius(br, unprojected_radius * new_value/initial_value * size_weight); - } - else - brush_set_size(br, new_value * size_weight); - else if(mode == WM_RADIALCONTROL_STRENGTH) - brush_set_alpha(br, new_value); - else if(mode == WM_RADIALCONTROL_ANGLE) { - MTex *mtex = brush_active_texture(br); - if(mtex) - mtex->rot = new_value * conv; - } - - return OPERATOR_FINISHED; -} - /* Unified Size and Strength */ static void set_unified_settings(Brush *brush, short flag, int value) diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 1d7481b365a..9a6c2cc7e31 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -37,10 +37,6 @@ #include <stdlib.h> #include <float.h> -#ifdef WITH_LCMS -#include <lcms.h> -#endif - #include "MEM_guardedalloc.h" #include "DNA_color_types.h" @@ -789,60 +785,6 @@ void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float *vecout, const } -#ifdef WITH_LCMS -/* basic error handler, if we dont do this blender will exit */ -static int ErrorReportingFunction(int ErrorCode, const char *ErrorText) -{ - fprintf(stderr, "%s:%d\n", ErrorText, ErrorCode); - return 1; -} -#endif - -void colorcorrection_do_ibuf(ImBuf *ibuf, const char *profile) -{ -#ifdef WITH_LCMS - if (ibuf->crect == NULL) - { - cmsHPROFILE proofingProfile; - - /* TODO, move to initialization area of code */ - //cmsSetLogErrorHandler(ErrorReportingFunction); - cmsSetErrorHandler(ErrorReportingFunction); - - /* will return NULL if the file isn't fount */ - proofingProfile = cmsOpenProfileFromFile(profile, "r"); - - cmsErrorAction(LCMS_ERROR_SHOW); - - if(proofingProfile) { - cmsHPROFILE imageProfile; - cmsHTRANSFORM hTransform; - - ibuf->crect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(int), "imbuf crect"); - - imageProfile = cmsCreate_sRGBProfile(); - - - hTransform = cmsCreateProofingTransform(imageProfile, TYPE_RGBA_8, imageProfile, TYPE_RGBA_8, - proofingProfile, - INTENT_ABSOLUTE_COLORIMETRIC, - INTENT_ABSOLUTE_COLORIMETRIC, - cmsFLAGS_SOFTPROOFING); - - cmsDoTransform(hTransform, ibuf->rect, ibuf->crect, ibuf->x * ibuf->y); - - cmsDeleteTransform(hTransform); - cmsCloseProfile(imageProfile); - cmsCloseProfile(proofingProfile); - } - } -#else - /* unused */ - (void)ibuf; - (void)profile; -#endif -} - /* only used for image editor curves */ void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf) { diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index b5194ca2f89..54e4bf08ee7 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -72,6 +72,8 @@ #include "ED_curve.h" /* for BKE_curve_nurbs */ +extern Material defmaterial; /* material.c */ + static void boundbox_displist(Object *ob); void free_disp_elem(DispList *dl) @@ -552,7 +554,6 @@ static void mesh_create_shadedColors(Render *re, Object *ob, int onlyForMesh, un } for (i=0; i<totface; i++) { - extern Material defmaterial; /* material.c */ MFace *mf= &mface[i]; Material *ma= give_current_material(ob, mf->mat_nr+1); int j, vidx[4], nverts= mf->v4?4:3; @@ -664,8 +665,6 @@ void shadeDispList(Scene *scene, Base *base) dl= ob->disp.first; while(dl) { - extern Material defmaterial; /* material.c */ - dlob= MEM_callocN(sizeof(DispList), "displistshade"); BLI_addtail(&ob->disp, dlob); dlob->type= DL_VERTCOL; @@ -734,8 +733,6 @@ void shadeDispList(Scene *scene, Base *base) if(dl->type==DL_INDEX4) { if(dl->nors) { - extern Material defmaterial; /* material.c */ - if(dl->col1) MEM_freeN(dl->col1); col1= dl->col1= MEM_mallocN(sizeof(int)*dl->nr, "col1"); @@ -984,16 +981,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) dl= dl->next; } - if(totvert && BLI_edgefill(0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { - - /* count faces */ - tot= 0; - efa= fillfacebase.first; - while(efa) { - tot++; - efa= efa->next; - } - + if(totvert && (tot= BLI_edgefill(0))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { if(tot) { dlnew= MEM_callocN(sizeof(DispList), "filldisplist"); dlnew->type= DL_INDEX3; @@ -1973,8 +1961,9 @@ static void boundbox_displist(Object *ob) } if(!doit) { - min[0] = min[1] = min[2] = -1.0f; - max[0] = max[1] = max[2] = 1.0f; + /* there's no geometry in displist, use zero-sized boundbox */ + zero_v3(min); + zero_v3(max); } } diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 09c189a8847..9effd25c142 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -125,25 +125,33 @@ struct PreviewImage* BKE_previewimg_create(void) prv_img = MEM_callocN(sizeof(PreviewImage), "img_prv"); - for (i=0; i<PREVIEW_MIPMAPS; ++i) { + for (i=0; i<NUM_ICON_SIZES; ++i) { prv_img->changed[i] = 1; prv_img->changed_timestamp[i] = 0; } return prv_img; } -void BKE_previewimg_free(PreviewImage **prv) +void BKE_previewimg_freefunc(void *link) { - if(prv && (*prv)) { + PreviewImage *prv = (PreviewImage *)link; + if (prv) { int i; - - for (i=0; i<PREVIEW_MIPMAPS;++i) { - if ((*prv)->rect[i]) { - MEM_freeN((*prv)->rect[i]); - (*prv)->rect[i] = NULL; + + for (i=0; i<NUM_ICON_SIZES;++i) { + if (prv->rect[i]) { + MEM_freeN(prv->rect[i]); + prv->rect[i] = NULL; } } - MEM_freeN((*prv)); + MEM_freeN(prv); + } +} + +void BKE_previewimg_free(PreviewImage **prv) +{ + if(prv && (*prv)) { + BKE_previewimg_freefunc(*prv); *prv = NULL; } } @@ -155,7 +163,7 @@ struct PreviewImage* BKE_previewimg_copy(PreviewImage *prv) if (prv) { prv_img = MEM_dupallocN(prv); - for (i=0; i < PREVIEW_MIPMAPS; ++i) { + for (i=0; i < NUM_ICON_SIZES; ++i) { if (prv->rect[i]) { prv_img->rect[i] = MEM_dupallocN(prv->rect[i]); } else { @@ -237,7 +245,7 @@ void BKE_icon_changed(int id) /* all previews changed */ if (prv) { int i; - for (i=0; i<PREVIEW_MIPMAPS; ++i) { + for (i=0; i<NUM_ICON_SIZES; ++i) { prv->changed[i] = 1; prv->changed_timestamp[i]++; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 15c4028478c..43dc5f228fb 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1680,21 +1680,20 @@ void object_rot_to_mat3(Object *ob, float mat[][3]) { float rmat[3][3], dmat[3][3]; - /* initialise the delta-rotation matrix, which will get (pre)multiplied + /* 'dmat' is the delta-rotation matrix, which will get (pre)multiplied * with the rotation matrix to yield the appropriate rotation */ - unit_m3(dmat); - + /* rotations may either be quats, eulers (with various rotation orders), or axis-angle */ if (ob->rotmode > 0) { /* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */ - eulO_to_mat3( rmat,ob->rot, ob->rotmode); - eulO_to_mat3( dmat,ob->drot, ob->rotmode); + eulO_to_mat3(rmat, ob->rot, ob->rotmode); + eulO_to_mat3(dmat, ob->drot, ob->rotmode); } else if (ob->rotmode == ROT_MODE_AXISANGLE) { /* axis-angle - not really that great for 3D-changing orientations */ - axis_angle_to_mat3( rmat,ob->rotAxis, ob->rotAngle); - axis_angle_to_mat3( dmat,ob->drotAxis, ob->drotAngle); + axis_angle_to_mat3(rmat, ob->rotAxis, ob->rotAngle); + axis_angle_to_mat3(dmat, ob->drotAxis, ob->drotAngle); } else { /* quats are normalised before use to eliminate scaling issues */ @@ -1729,9 +1728,22 @@ void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat) ob->rotAngle -= ob->drotAngle; break; default: /* euler */ - if(use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, mat); - else mat3_to_eulO(ob->rot, ob->rotmode, mat); - sub_v3_v3(ob->rot, ob->drot); + { + float quat[4]; + float dquat[4]; + float tmat[3][3]; + + /* without drot we could apply 'mat' directly */ + mat3_to_quat(quat, mat); + eulO_to_quat(dquat, ob->drot, ob->rotmode); + invert_qt(dquat); + mul_qt_qtqt(quat, dquat, quat); + quat_to_mat3(tmat, quat); + /* end drot correction */ + + if(use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, tmat); + else mat3_to_eulO(ob->rot, ob->rotmode, tmat); + } } } @@ -1923,9 +1935,10 @@ static void give_parvert(Object *par, int nr, float *vec) if(dm) { MVert *mvert= dm->getVertArray(dm); int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX); - int i, count = 0, vindex, numVerts = dm->getNumVerts(dm); + int i, vindex, numVerts = dm->getNumVerts(dm); /* get the average of all verts with (original index == nr) */ + count= 0; for(i = 0; i < numVerts; i++) { vindex= (index)? index[i]: i; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index c2aa297b174..6b1540d7d53 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1250,7 +1250,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D double step, pos; step= (totpart < 2) ? 0.5 : 1.0/(double)totpart; - pos= 1e-16; /* tiny offset to avoid zero weight face */ + pos= 1e-6; /* tiny offset to avoid zero weight face */ i= 0; for(p=0; p<totpart; p++, pos+=step) { diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 6f49155c0fd..d2f05a8ca53 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -2859,6 +2859,83 @@ static struct ImBuf * do_multicam( } /* ********************************************************************** + ADJUSTMENT + ********************************************************************** */ + +/* no effect inputs for adjustment, we use give_ibuf_seq */ +static int num_inputs_adjustment(void) +{ + return 0; +} + +static int early_out_adjustment(struct Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1)) +{ + return -1; +} + +static struct ImBuf * do_adjustment_impl(SeqRenderData context, Sequence * seq, + float cfra) +{ + Editing * ed; + ListBase * seqbasep; + struct ImBuf * i = 0; + + ed = context.scene->ed; + + seqbasep = seq_seqbase(&ed->seqbase, seq); + + if (seq->machine > 0) { + i = give_ibuf_seqbase(context, cfra, + seq->machine - 1, seqbasep); + } + + /* found nothing? so let's work the way up the metastrip stack, so + that it is possible to group a bunch of adjustment strips into + a metastrip and have that work on everything below the metastrip + */ + + if (!i) { + Sequence * meta; + + meta = seq_metastrip(&ed->seqbase, NULL, seq); + + if (meta) { + i = do_adjustment_impl(context, meta, cfra); + } + } + + return i; +} + +static struct ImBuf * do_adjustment( + SeqRenderData context, Sequence *seq, float cfra, + float UNUSED(facf0), float UNUSED(facf1), + struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2), + struct ImBuf *UNUSED(ibuf3)) +{ + struct ImBuf * i = 0; + struct ImBuf * out; + Editing * ed; + + ed = context.scene->ed; + + if (!ed) { + return NULL; + } + + i = do_adjustment_impl(context, seq, cfra); + + if (input_have_to_preprocess(context, seq, cfra)) { + out = IMB_dupImBuf(i); + IMB_freeImBuf(i); + } else { + out = i; + } + + return out; +} + +/* ********************************************************************** SPEED ********************************************************************** */ static void init_speed_effect(Sequence *seq) @@ -3256,6 +3333,11 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type) rval.early_out = early_out_multicam; rval.execute = do_multicam; break; + case SEQ_ADJUSTMENT: + rval.num_inputs = num_inputs_adjustment; + rval.early_out = early_out_adjustment; + rval.execute = do_adjustment; + break; } return rval; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index e3639dd1c51..30abb6278a7 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -79,9 +79,15 @@ #define snprintf _snprintf #endif -/* **** XXX ******** */ -//static void waitcursor(int val) {} -//static int blender_test_break() {return 0;} + +static ImBuf* seq_render_strip_stack( + SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown); + +static ImBuf * seq_render_strip( + SeqRenderData context, Sequence * seq, float cfra); + +static void seq_free_animdata(Scene *scene, Sequence *seq); + /* **** XXX ******** */ #define SELECT 1 @@ -177,8 +183,6 @@ void seq_free_strip(Strip *strip) MEM_freeN(strip); } -static void seq_free_animdata(Scene *scene, Sequence *seq); - void seq_free_sequence(Scene *scene, Sequence *seq) { if(seq->strip) seq_free_strip(seq->strip); @@ -191,6 +195,10 @@ void seq_free_sequence(Scene *scene, Sequence *seq) sh.free(seq); } + if(seq->sound) { + ((ID *)seq->sound)->us--; + } + /* clipboard has no scene and will never have a sound handle or be active */ if(scene) { Editing *ed = scene->ed; @@ -446,51 +454,6 @@ void seq_end(SeqIterator *iter) * in metastrips!) ********************************************************************** */ -#if 0 /* UNUSED */ -static void do_seq_count(ListBase *seqbase, int *totseq) -{ - Sequence *seq; - - seq= seqbase->first; - while(seq) { - (*totseq)++; - if(seq->seqbase.first) do_seq_count(&seq->seqbase, totseq); - seq= seq->next; - } -} - -static void do_build_seqar(ListBase *seqbase, Sequence ***seqar, int depth) -{ - Sequence *seq; - - seq= seqbase->first; - while(seq) { - seq->depth= depth; - if(seq->seqbase.first) do_build_seqar(&seq->seqbase, seqar, depth+1); - **seqar= seq; - (*seqar)++; - seq= seq->next; - } -} - -static void build_seqar(ListBase *seqbase, Sequence ***seqar, int *totseq) -{ - Sequence **tseqar; - - *totseq= 0; - do_seq_count(seqbase, totseq); - - if(*totseq==0) { - *seqar= NULL; - return; - } - *seqar= MEM_mallocN(sizeof(void *)* *totseq, "seqar"); - tseqar= *seqar; - - do_build_seqar(seqbase, seqar, 0); - *seqar= tseqar; -} -#endif /* UNUSED */ static void do_seq_count_cb(ListBase *seqbase, int *totseq, int (*test_func)(Sequence * seq)) @@ -916,6 +879,7 @@ static const char *give_seqname_by_type(int type) case SEQ_TRANSFORM: return "Transform"; case SEQ_COLOR: return "Color"; case SEQ_MULTICAM: return "Multicam"; + case SEQ_ADJUSTMENT: return "Adjustment"; case SEQ_SPEED: return "Speed"; default: return NULL; @@ -1013,16 +977,22 @@ static float give_stripelem_index(Sequence *seq, float cfra) int sta = seq->start; int end = seq->start+seq->len-1; - if(seq->len == 0) return -1; + if (seq->type & SEQ_EFFECT) { + end = seq->enddisp; + } + + if(end < sta) { + return -1; + } if(seq->flag&SEQ_REVERSE_FRAMES) { /*reverse frame in this sequence */ - if(cfra <= sta) nr= seq->len-1; + if(cfra <= sta) nr= end - sta; else if(cfra >= end) nr= 0; else nr= end - cfra; } else { if(cfra <= sta) nr= 0; - else if(cfra >= end) nr= seq->len-1; + else if(cfra >= end) nr= end - sta; else nr= cfra - sta; } @@ -1039,7 +1009,11 @@ StripElem *give_stripelem(Sequence *seq, int cfra) { StripElem *se= seq->strip->stripdata; - if(seq->type != SEQ_MOVIE) { /* movie use the first */ + if(seq->type == SEQ_IMAGE) { /* only + IMAGE strips use the whole array, + MOVIE strips use only + the first element, all other strips + don't use this... */ int nr = (int) give_stripelem_index(seq, cfra); if (nr == -1 || se == NULL) return NULL; @@ -1093,15 +1067,12 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se } if(evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) { - if (b > 0) { - if (seq_arr[b] == NULL) { - return 0; - } - } else { - for (b = MAXSEQ; b > 0; b--) { - if (video_seq_is_rendered(seq_arr[b])) { - break; - } + if (b == 0) { + b = MAXSEQ; + } + for (; b > 0; b--) { + if (video_seq_is_rendered(seq_arr[b])) { + break; } } } @@ -2071,8 +2042,9 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr break; } case SEQ_EFFECT: - { - ibuf = seq_render_effect_strip_impl(context, seq, cfra); + { + ibuf = seq_render_effect_strip_impl( + context, seq, seq->start + nr); break; } case SEQ_IMAGE: @@ -2855,7 +2827,10 @@ void seq_tx_set_final_right(Sequence *seq, int val) since they work a bit differently to normal image seq's (during transform) */ int seq_single_check(Sequence *seq) { - return (seq->len==1 && ELEM3(seq->type, SEQ_IMAGE, SEQ_COLOR, SEQ_MULTICAM)); + return (seq->len==1 && ( + seq->type == SEQ_IMAGE + || ((seq->type & SEQ_EFFECT) && + get_sequence_effect_num_inputs(seq->type) == 0))); } /* check if the selected seq's reference unselected seq's */ @@ -3214,6 +3189,24 @@ ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq) return NULL; } +Sequence *seq_metastrip(ListBase * seqbase, Sequence * meta, Sequence *seq) +{ + Sequence * iseq; + + for(iseq = seqbase->first; iseq; iseq = iseq->next) { + Sequence * rval; + + if (seq == iseq) { + return meta; + } else if(iseq->seqbase.first && + (rval = seq_metastrip(&iseq->seqbase, iseq, seq))) { + return rval; + } + } + + return NULL; +} + int seq_swap(Sequence *seq_a, Sequence *seq_b) { char name[sizeof(seq_a->name)]; @@ -3523,7 +3516,8 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo strip->len = seq->len = ceil(info.length * FPS); strip->us= 1; - strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); + /* we only need 1 element to store the filename */ + strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem"); BLI_split_dirfile(seq_load->path, strip->dir, se->name); @@ -3572,7 +3566,8 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo strip->len = seq->len = IMB_anim_get_duration( an ); strip->us= 1; - strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); + /* we only need 1 element for MOVIE strips */ + strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem"); BLI_split_dirfile(seq_load->path, strip->dir, se->name); diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c index ec0f5d1316b..4cc5a880625 100644 --- a/source/blender/blenkernel/intern/sketch.c +++ b/source/blender/blenkernel/intern/sketch.c @@ -543,7 +543,7 @@ int sk_stroke_filtermval(SK_DrawData *dd) return retval; } -void sk_initDrawData(SK_DrawData *dd, const short mval[2]) +void sk_initDrawData(SK_DrawData *dd, const int mval[2]) { dd->mval[0] = mval[0]; dd->mval[1] = mval[1]; diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 756d1501536..4a7d749842d 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -77,7 +77,7 @@ void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3], #define ISECT_LINE_LINE_CROSS 2 int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]); -int isect_line_line_v2_short(const short a1[2], const short a2[2], const short b1[2], const short b2[2]); +int isect_line_line_v2_int(const int a1[2], const int a2[2], const int b1[2], const int b2[2]); int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]); /* Returns the number of point of interests diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index e2f102c20eb..c5acf7b7f70 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -53,7 +53,7 @@ extern "C" { /* scanfill.c: used in displist only... */ struct EditVert *BLI_addfillvert(float *vec); struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2); -int BLI_edgefill(int mat_nr); +int BLI_edgefill(short mat_nr); void BLI_end_edgefill(void); /* These callbacks are needed to make the lib finction properly */ diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 1cfbc026b56..34e6b7f1356 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -763,7 +763,12 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) { /* be sure there is low chance of the path being too short */ char filepath_relative[(FILE_MAXDIR * 2) + FILE_MAXFILE]; - + + if(basedir[0] == '\0') { + printf("makeFilesRelative: basedir='', this is a bug\n"); + return; + } + BLI_bpathIterator_init(&bpi, bmain, basedir, 0); while (!BLI_bpathIterator_isDone(bpi)) { BLI_bpathIterator_getPath(bpi, filepath); @@ -814,7 +819,12 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports) /* be sure there is low chance of the path being too short */ char filepath_absolute[(FILE_MAXDIR * 2) + FILE_MAXFILE]; - + + if(basedir[0] == '\0') { + printf("makeFilesAbsolute: basedir='', this is a bug\n"); + return; + } + BLI_bpathIterator_init(&bpi, bmain, basedir, 0); while (!BLI_bpathIterator_isDone(bpi)) { BLI_bpathIterator_getPath(bpi, filepath); diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index be7f2d95d04..8785415c6a1 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -239,7 +239,7 @@ float dist_to_line_segment_v3(const float v1[3], const float v2[3], const float /******************************* Intersection ********************************/ /* intersect Line-Line, shorts */ -int isect_line_line_v2_short(const short v1[2], const short v2[2], const short v3[2], const short v4[2]) +int isect_line_line_v2_int(const int v1[2], const int v2[2], const int v3[2], const int v4[2]) { float div, labda, mu; diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c index d889c1b9bf2..9bd540e46ea 100644 --- a/source/blender/blenlib/intern/rand.c +++ b/source/blender/blenlib/intern/rand.c @@ -58,6 +58,8 @@ typedef unsigned long long r_uint64; #define LOWSEED 0x330E +extern unsigned char hash[]; // noise.c + /***/ struct RNG { @@ -83,8 +85,6 @@ void rng_seed(RNG *rng, unsigned int seed) { } void rng_srandom(RNG *rng, unsigned int seed) { - extern unsigned char hash[]; // noise.c - rng_seed(rng, seed + hash[seed & 255]); seed= rng_getInt(rng); rng_seed(rng, seed + hash[seed & 255]); @@ -180,8 +180,6 @@ static RNG rng_tab[BLENDER_MAX_THREADS]; void BLI_thread_srandom(int thread, unsigned int seed) { - extern unsigned char hash[]; // noise.c - if(thread >= BLENDER_MAX_THREADS) thread= 0; diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 423b9b99569..47a07d86e66 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -85,7 +85,6 @@ typedef struct PolyFill { typedef struct ScFillVert { EditVert *v1; EditEdge *first,*last; - short f,f1; } ScFillVert; @@ -95,9 +94,9 @@ typedef struct ScFillVert { static ScFillVert *scdata; -ListBase fillvertbase = {0,0}; -ListBase filledgebase = {0,0}; -ListBase fillfacebase = {0,0}; +ListBase fillvertbase = {NULL, NULL}; +ListBase filledgebase = {NULL, NULL}; +ListBase fillfacebase = {NULL, NULL}; static short cox, coy; @@ -219,7 +218,7 @@ EditEdge *BLI_addfilledge(EditVert *v1, EditVert *v2) return newed; } -static void addfillface(EditVert *v1, EditVert *v2, EditVert *v3, int mat_nr) +static void addfillface(EditVert *v1, EditVert *v2, EditVert *v3, short mat_nr) { /* does not make edges */ EditFace *evl; @@ -495,7 +494,7 @@ static void splitlist(ListBase *tempve, ListBase *temped, short nr) } -static void scanfill(PolyFill *pf, int mat_nr) +static int scanfill(PolyFill *pf, short mat_nr) { ScFillVert *sc = NULL, *sc1; EditVert *eve,*v1,*v2,*v3; @@ -748,11 +747,13 @@ static void scanfill(PolyFill *pf, int mat_nr) } MEM_freeN(scdata); + + return totface; } -int BLI_edgefill(int mat_nr) +int BLI_edgefill(short mat_nr) { /* - fill works with its own lists, so create that first (no faces!) @@ -760,6 +761,7 @@ int BLI_edgefill(int mat_nr) - struct elements xs en ys are not used here: don't hide stuff in it - edge flag ->f becomes 2 when it's a new edge - mode: & 1 is check for crossings, then create edges (TO DO ) + - returns number of triangle faces added. */ ListBase tempve, temped; EditVert *eve; @@ -767,6 +769,7 @@ int BLI_edgefill(int mat_nr) PolyFill *pflist,*pf; float *minp, *maxp, *v1, *v2, norm[3], len; short a,c,poly=0,ok=0,toggle=0; + int totfaces= 0; /* total faces added */ /* reset variables */ eve= fillvertbase.first; @@ -1030,7 +1033,7 @@ int BLI_edgefill(int mat_nr) for(a=0;a<poly;a++) { if(pf->edges>1) { splitlist(&tempve,&temped,pf->nr); - scanfill(pf, mat_nr); + totfaces += scanfill(pf, mat_nr); } pf++; } @@ -1040,6 +1043,6 @@ int BLI_edgefill(int mat_nr) /* FREE */ MEM_freeN(pflist); - return 1; + return totfaces; } diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 22083eda1c8..6267b819c55 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -49,6 +49,8 @@ struct SpaceFile; struct SpaceImaSel; struct UserDef; struct bContext; +struct BHead; +struct FileData; typedef struct BlendHandle BlendHandle; @@ -79,12 +81,12 @@ typedef struct BlendFileData { * returns NULL and sets a report in the list if * it cannot open the file. * - * @param file The path of the file to open. + * @param filepath The path of the file to open. * @param reports If the return value is NULL, errors * indicating the cause of the failure. * @return The data of the file. */ -BlendFileData* BLO_read_from_file(const char *file, struct ReportList *reports); +BlendFileData* BLO_read_from_file(const char *filepath, struct ReportList *reports); /** * Open a blender file from memory. The function @@ -209,7 +211,7 @@ int BLO_has_bfile_extension(char *str); */ int BLO_is_a_library(const char *path, char *dir, char *group); -struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, char *dir); +struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, const char *filepath); /** * Link/Append a named datablock from an external blend file. @@ -217,14 +219,16 @@ struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh * @param C The context, when NULL instancing object in the scene isnt done. * @param mainl The main database to link from (not the active one). * @param bh The blender file handle. - * @param name The name of the datablock (without the 2 char ID prefix) + * @param idname The name of the datablock (without the 2 char ID prefix) * @param idcode The kind of datablock to link. * @param flag Options for linking, used for instancing. * @return Boolean, 0 when the datablock could not be found. */ -int BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *name, int idcode, short flag); +int BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *idname, int idcode, short flag); void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag); +void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname); + /* deprecated */ #if 1 void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, int idcode, short flag, struct Main *mainvar, struct Scene *scene, struct ReportList *reports); diff --git a/source/blender/readblenfile/test/test.c b/source/blender/blenloader/BLO_runtime.h index 647df053c38..920b14e92fa 100644 --- a/source/blender/readblenfile/test/test.c +++ b/source/blender/blenloader/BLO_runtime.h @@ -25,27 +25,29 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** + * + */ + +#ifndef BLO_RUNTIME_H +#define BLO_RUNTIME_H + +/** \file BLO_runtime.h + * \ingroup blenloader */ -#include <string.h> // strlen -#include "BLO_readblenfile.h" - -struct streamGlueControlStruct *Global_streamGlueControl; - - int -streamGlueWrite( - struct streamGlueControlStruct *streamGlueControl, - struct streamGlueStruct **streamGlue, - unsigned char *data, - unsigned int dataIn, - int finishUp) -{ - printf("called with %d bytes in buffer [%s]\n", dataIn, data); - return (0); -} -main() -{ - int err; +#ifdef __cplusplus +extern "C" { +#endif - err = BLO_readblenfile(); +struct BlendFileData; +struct ReportList; + +int BLO_is_a_runtime(char *file); +struct BlendFileData *BLO_read_runtime(char *file, struct ReportList *reports); + +#ifdef __cplusplus } +#endif + +#endif /* BLO_RUNTIME_H */ + diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h index 651928aa6a1..5c41350a463 100644 --- a/source/blender/blenloader/BLO_writefile.h +++ b/source/blender/blenloader/BLO_writefile.h @@ -39,7 +39,7 @@ struct MemFile; struct Main; struct ReportList; -extern int BLO_write_file(struct Main *mainvar, char *dir, int write_flags, struct ReportList *reports, int *thumb); +extern int BLO_write_file(struct Main *mainvar, const char *filepath, int write_flags, struct ReportList *reports, int *thumb); extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags); extern int BLO_write_runtime(struct Main *mainvar, const char *file, char *exename, struct ReportList *reports); diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index 4d8ac9bc4b6..888cf3148e3 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -29,7 +29,6 @@ set(INC ../blenlib ../blenkernel ../makesdna - ../readblenfile ../makesrna ../render/extern/include ../../../intern/guardedalloc @@ -39,10 +38,12 @@ set(INC set(SRC intern/readblenentry.c intern/readfile.c + intern/runtime.c intern/undofile.c intern/writefile.c BLO_readfile.h + BLO_runtime.h BLO_soundfile.h BLO_sys_types.h BLO_undofile.h diff --git a/source/blender/blenloader/SConscript b/source/blender/blenloader/SConscript index 695d17f0638..be9908d84e6 100644 --- a/source/blender/blenloader/SConscript +++ b/source/blender/blenloader/SConscript @@ -4,7 +4,7 @@ Import ('env') sources = env.Glob('intern/*.c') incs = '. #/intern/guardedalloc ../blenlib ../blenkernel' -incs += ' ../makesdna ../readblenfile ../editors/include' +incs += ' ../makesdna ../editors/include' incs += ' ../render/extern/include ../makesrna' incs += ' ' + env['BF_ZLIB_INC'] diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 39fab1929da..4ce5685ff18 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -62,8 +62,6 @@ #include "readfile.h" -#include "BLO_readblenfile.h" - #include "BLO_sys_types.h" // needed for intptr_t #ifdef _WIN32 @@ -150,15 +148,14 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to LinkNode *previews= NULL; BHead *bhead; int looking=0; - int npreviews = 0; PreviewImage* prv = NULL; PreviewImage* new_prv = NULL; int tot= 0; for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { if (bhead->code==ofblocktype) { - ID *id= (ID*) (bhead+1); - switch(GS(id->name)) + char *idname= bhead_id_name(fd, bhead); + switch(GS(idname)) { case ID_MA: /* fall through */ case ID_TE: /* fall through */ @@ -176,31 +173,29 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to } else if (bhead->code==DATA) { if (looking) { if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage") ) { - prv = (PreviewImage*) (bhead+1); - npreviews = 0; - memcpy(new_prv, prv, sizeof(PreviewImage)); - if (prv->rect[0]) { - unsigned int *rect = NULL; - // int rectlen = 0; - new_prv->rect[0] = MEM_callocN(new_prv->w[0]*new_prv->h[0]*sizeof(unsigned int), "prvrect"); - bhead= blo_nextbhead(fd, bhead); - rect = (unsigned int*)(bhead+1); - // rectlen = new_prv->w[0]*new_prv->h[0]*sizeof(unsigned int); - memcpy(new_prv->rect[0], rect, bhead->len); - } else { - new_prv->rect[0] = NULL; - } - - if (prv->rect[1]) { - unsigned int *rect = NULL; - // int rectlen = 0; - new_prv->rect[1] = MEM_callocN(new_prv->w[1]*new_prv->h[1]*sizeof(unsigned int), "prvrect"); - bhead= blo_nextbhead(fd, bhead); - rect = (unsigned int*)(bhead+1); - // rectlen = new_prv->w[1]*new_prv->h[1]*sizeof(unsigned int); - memcpy(new_prv->rect[1], rect, bhead->len); - } else { - new_prv->rect[1] = NULL; + prv = BLO_library_read_struct(fd, bhead, "PreviewImage"); + if (prv) { + memcpy(new_prv, prv, sizeof(PreviewImage)); + if (prv->rect[0]) { + unsigned int *rect = NULL; + new_prv->rect[0] = MEM_callocN(new_prv->w[0]*new_prv->h[0]*sizeof(unsigned int), "prvrect"); + bhead= blo_nextbhead(fd, bhead); + rect = (unsigned int*)(bhead+1); + memcpy(new_prv->rect[0], rect, bhead->len); + } else { + new_prv->rect[0] = NULL; + } + + if (prv->rect[1]) { + unsigned int *rect = NULL; + new_prv->rect[1] = MEM_callocN(new_prv->w[1]*new_prv->h[1]*sizeof(unsigned int), "prvrect"); + bhead= blo_nextbhead(fd, bhead); + rect = (unsigned int*)(bhead+1); + memcpy(new_prv->rect[1], rect, bhead->len); + } else { + new_prv->rect[1] = NULL; + } + MEM_freeN(prv); } } } @@ -253,15 +248,15 @@ void BLO_blendhandle_close(BlendHandle *bh) { /**********/ -BlendFileData *BLO_read_from_file(const char *file, ReportList *reports) +BlendFileData *BLO_read_from_file(const char *filepath, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd; - fd = blo_openblenderfile(file, reports); + fd = blo_openblenderfile(filepath, reports); if (fd) { fd->reports= reports; - bfd= blo_read_file_internal(fd, file); + bfd= blo_read_file_internal(fd, filepath); blo_freefiledata(fd); } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index cf1b191cd63..f224b36bad9 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -138,7 +138,6 @@ //XXX #include "BIF_previewrender.h" // bedlelvel, for struct RenderInfo #include "BLO_readfile.h" #include "BLO_undofile.h" -#include "BLO_readblenfile.h" // streaming read pipe, for BLO_readblenfile BLO_readblenfilememory #include "readfile.h" @@ -489,13 +488,13 @@ static void read_file_version(FileData *fd, Main *main) } -static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *name, const char *relabase) +static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepath, const char *relabase) { Main *m; Library *lib; char name1[FILE_MAXDIR+FILE_MAXFILE]; - strncpy(name1, name, sizeof(name1)-1); + BLI_strncpy(name1, filepath, sizeof(name1)); cleanup_path(relabase, name1); // printf("blo_find_main: original in %s\n", name); // printf("blo_find_main: converted to %s\n", name1); @@ -513,14 +512,14 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *name, c BLI_addtail(mainlist, m); lib= alloc_libblock(&m->library, ID_LI, "lib"); - strncpy(lib->name, name, sizeof(lib->name)-1); + strncpy(lib->name, filepath, sizeof(lib->name)-1); BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath)); m->curlib= lib; read_file_version(fd, m); - if(G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", name); + if(G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath); return m; } @@ -946,14 +945,14 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports) /* cannot be called with relative paths anymore! */ /* on each new library added, it now checks for the current FileData and expands relativeness */ -FileData *blo_openblenderfile(const char *name, ReportList *reports) +FileData *blo_openblenderfile(const char *filepath, ReportList *reports) { gzFile gzfile; errno= 0; - gzfile= gzopen(name, "rb"); + gzfile= gzopen(filepath, "rb"); if (gzfile == (gzFile)Z_NULL) { - BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", name, errno ? strerror(errno) : "Unknown error reading file"); + BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error reading file"); return NULL; } else { FileData *fd = filedata_new(); @@ -961,7 +960,7 @@ FileData *blo_openblenderfile(const char *name, ReportList *reports) fd->read = fd_read_gzip_from_file; /* needed for library_append and read_libraries */ - BLI_strncpy(fd->relabase, name, sizeof(fd->relabase)); + BLI_strncpy(fd->relabase, filepath, sizeof(fd->relabase)); return blo_decode_and_check(fd, reports); } @@ -1585,7 +1584,7 @@ static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_p if (prv) { int i; - for (i=0; i < PREVIEW_MIPMAPS; ++i) { + for (i=0; i < NUM_ICON_SIZES; ++i) { if (prv->rect[i]) { prv->rect[i] = newdataadr(fd, prv->rect[i]); } @@ -3969,7 +3968,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) fluidmd->fss= newdataadr(fd, fluidmd->fss); fluidmd->fss->fmd= fluidmd; - fluidmd->fss->meshSurfNormals = NULL; + fluidmd->fss->meshVelocities = NULL; } else if (md->type==eModifierType_Smoke) { SmokeModifierData *smd = (SmokeModifierData*) md; @@ -5526,20 +5525,31 @@ static void lib_link_library(FileData *UNUSED(fd), Main *main) } } -/* Always call this once you havbe loaded new library data to set the relative paths correctly in relation to the blend file */ +/* Always call this once you have loaded new library data to set the relative paths correctly in relation to the blend file */ static void fix_relpaths_library(const char *basepath, Main *main) { Library *lib; /* BLO_read_from_memory uses a blank filename */ - if (basepath==NULL || basepath[0] == '\0') - return; - - for(lib= main->library.first; lib; lib= lib->id.next) { - /* Libraries store both relative and abs paths, recreate relative paths, - * relative to the blend file since indirectly linked libs will be relative to their direct linked library */ - if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */ - strncpy(lib->name, lib->filepath, sizeof(lib->name)); - BLI_path_rel(lib->name, basepath); + if (basepath==NULL || basepath[0] == '\0') { + for(lib= main->library.first; lib; lib= lib->id.next) { + /* when loading a linked lib into a file which has not been saved, + * there is nothing we can be relative to, so instead we need to make + * it absolute. This can happen when appending an object with a relative + * link into an unsaved blend file. See [#27405]. + * The remap relative option will make it relative again on save - campbell */ + if (strncmp(lib->name, "//", 2)==0) { + strncpy(lib->name, lib->filepath, sizeof(lib->name)); + } + } + } + else { + for(lib= main->library.first; lib; lib= lib->id.next) { + /* Libraries store both relative and abs paths, recreate relative paths, + * relative to the blend file since indirectly linked libs will be relative to their direct linked library */ + if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */ + strncpy(lib->name, lib->filepath, sizeof(lib->name)); + BLI_path_rel(lib->name, basepath); + } } } } @@ -9774,7 +9784,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) fluidmd->fss->lastgoodframe = INT_MAX; fluidmd->fss->flag = 0; - fluidmd->fss->meshSurfNormals = NULL; + fluidmd->fss->meshVelocities = NULL; } } } @@ -11891,7 +11901,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) return bhead; } -BlendFileData *blo_read_file_internal(FileData *fd, const char *filename) +BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) { BHead *bhead= blo_firstbhead(fd); BlendFileData *bfd; @@ -11903,7 +11913,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filename) bfd->main->versionfile= fd->fileversion; bfd->type= BLENFILETYPE_BLEND; - strncpy(bfd->main->name, filename, sizeof(bfd->main->name)-1); + strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)-1); while(bhead) { switch(bhead->code) { @@ -12954,7 +12964,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene) /* returns true if the item was found * but it may already have already been appended/linked */ -static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const char *name, int idcode, short flag) +static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const char *idname, int idcode, short flag) { Scene *scene= CTX_data_scene(C); Object *ob; @@ -12969,9 +12979,9 @@ static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const if(bhead->code==ENDB) endloop= 1; else if(bhead->code==idcode) { - char *idname= bhead_id_name(fd, bhead); + const char *idname_test= bhead_id_name(fd, bhead); - if(strcmp(idname+2, name)==0) { + if(strcmp(idname_test + 2, idname)==0) { found= 1; id= is_yet_read(fd, mainl, bhead); if(id==NULL) { @@ -13023,10 +13033,10 @@ static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const return found; } -int BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, const char *name, int idcode, short flag) +int BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, const char *idname, int idcode, short flag) { FileData *fd= (FileData*)(*bh); - return append_named_part(C, mainl, fd, name, idcode, flag); + return append_named_part(C, mainl, fd, idname, idcode, flag); } static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r) @@ -13051,7 +13061,7 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r) /* common routine to append/link something from a library */ -static Main* library_append_begin(const bContext *C, FileData **fd, char *dir) +static Main* library_append_begin(const bContext *C, FileData **fd, const char *filepath) { Main *mainvar= CTX_data_main(C); Main *mainl; @@ -13060,7 +13070,7 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir) blo_split_main(&(*fd)->mainlist, mainvar); /* which one do we need? */ - mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.main->name); + mainl = blo_find_main(*fd, &(*fd)->mainlist, filepath, G.main->name); /* needed for do_version */ mainl->versionfile= (*fd)->fileversion; @@ -13069,10 +13079,10 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir) return mainl; } -Main* BLO_library_append_begin(const bContext *C, BlendHandle** bh, char *dir) +Main* BLO_library_append_begin(const bContext *C, BlendHandle** bh, const char *filepath) { FileData *fd= (FileData*)(*bh); - return library_append_begin(C, &fd, dir); + return library_append_begin(C, &fd, filepath); } static void append_do_cursor(Scene *scene, Library *curlib, short flag) @@ -13194,30 +13204,10 @@ void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle** *bh= (BlendHandle*)fd; } -/* this is a version of BLO_library_append needed by the BPython API, so - * scripts can load data from .blend files -- see Blender.Library module.*/ -/* append to scene */ -/* this should probably be moved into the Python code anyway */ -/* tentatively removed, Python should be able to use the split functions too: */ -/* BLO_library_append_begin, BLO_library_append_end, BLO_library_append_named_part */ -#if 0 -void BLO_script_library_append(BlendHandle **bh, char *dir, const char *name, - int idcode, short flag, Main *mainvar, Scene *scene, ReportList *reports) +void *BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname) { - FileData *fd= (FileData*)(*bh); - - /* try to append the requested object */ - fd->reports= reports; - library_append(mainvar, scene, name, dir, idcode, 0, &fd, NULL, 0, flag ); - if(fd) fd->reports= NULL; - - /* do we need to do this? */ - if(scene) - DAG_scene_sort(bmain, scene); - - *bh= (BlendHandle*)fd; + return read_struct(fd, bh, blockname); } -#endif /* ************* READ LIBRARY ************** */ diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index b409e456fe6..d4e42ccde16 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -113,9 +113,9 @@ struct Main; void blo_join_main(ListBase *mainlist); void blo_split_main(ListBase *mainlist, struct Main *main); -BlendFileData *blo_read_file_internal(FileData *fd, const char *filename); +BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath); -FileData *blo_openblenderfile(const char *name, struct ReportList *reports); +FileData *blo_openblenderfile(const char *filepath, struct ReportList *reports); FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports); FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports); diff --git a/source/blender/readblenfile/intern/BLO_readblenfile.c b/source/blender/blenloader/intern/runtime.c index 351de4bd215..f5308b5ea5c 100644 --- a/source/blender/readblenfile/intern/BLO_readblenfile.c +++ b/source/blender/blenloader/intern/runtime.c @@ -27,11 +27,13 @@ * ***** END GPL LICENSE BLOCK ***** * */ + /** - * \file BLO_readblenfile.c - * \brief This file handles the loading if .blend files - * \ingroup blo + * \file runtime.c + * \brief This file handles the loading of .blend files embedded in runtimes + * \ingroup blenloader */ + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -46,90 +48,56 @@ #endif #include "BLO_readfile.h" -#include "BLO_readblenfile.h" +#include "BLO_runtime.h" #include "BKE_blender.h" #include "BKE_report.h" +#include "BKE_utildefines.h" #include "BLI_blenlib.h" -/** Magic number for the file header */ -const char *headerMagic = "BLENDFI"; - -/** - * \brief Set the version number into the array. - * - * version contains the integer number of the version - * i.e. 227 - * array[1] gets set to the div of the number by 100 i.e. 2 - * array[2] gets the remainder i.e. 27 - */ -void BLO_setversionnumber(char array[4], int version) -{ - memset(array, 0, sizeof(char)*4); - - array[1] = version / 100; - array[2] = version % 100; -} - -/** - * Sets version number using BLENDER_VERSION - * Function that calls the setversionnumber(char[],int) with - * the BLENDER_VERSION constant and sets the resultant array - * with the version parts. - * see BLO_setversionnumber(char[],int). - */ -void BLO_setcurrentversionnumber(char array[4]) -{ - BLO_setversionnumber(array, BLENDER_VERSION); -} - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - /* Runtime reading */ -static int handle_read_msb_int(int handle) { +static int handle_read_msb_int(int handle) +{ unsigned char buf[4]; - if (read(handle, buf, 4)!=4) + if(read(handle, buf, 4) != 4) return -1; - else - return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0); + + return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0); } -int blo_is_a_runtime(char *path) { +int BLO_is_a_runtime(char *path) +{ int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0); int datastart; char buf[8]; - if (fd==-1) + if(fd==-1) goto cleanup; lseek(fd, -12, SEEK_END); datastart= handle_read_msb_int(fd); - if (datastart==-1) + + if(datastart==-1) goto cleanup; - else if (read(fd, buf, 8)!=8) + else if(read(fd, buf, 8)!=8) goto cleanup; - else if (memcmp(buf, "BRUNTIME", 8)!=0) + else if(memcmp(buf, "BRUNTIME", 8)!=0) goto cleanup; else res= 1; cleanup: - if (fd!=-1) + if(fd!=-1) close(fd); return res; } -BlendFileData * -blo_read_runtime( - char *path, - ReportList *reports) +BlendFileData *BLO_read_runtime(char *path, ReportList *reports) { BlendFileData *bfd= NULL; size_t actualsize; @@ -137,7 +105,8 @@ blo_read_runtime( char buf[8]; fd= open(path, O_BINARY|O_RDONLY, 0); - if (fd==-1) { + + if(fd==-1) { BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", path, strerror(errno)); goto cleanup; } @@ -147,16 +116,20 @@ blo_read_runtime( lseek(fd, -12, SEEK_END); datastart= handle_read_msb_int(fd); - if (datastart==-1) { + + if(datastart==-1) { BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (problem seeking)", path); goto cleanup; - } else if (read(fd, buf, 8)!=8) { + } + else if(read(fd, buf, 8)!=8) { BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (truncated header)", path); goto cleanup; - } else if (memcmp(buf, "BRUNTIME", 8)!=0) { + } + else if(memcmp(buf, "BRUNTIME", 8)!=0) { BKE_reportf(reports, RPT_ERROR, "Unable to read \"%s\" (not a blend file)", path); goto cleanup; - } else { + } + else { //printf("starting to read runtime from %s at datastart %d\n", path, datastart); lseek(fd, datastart, SEEK_SET); bfd = blo_read_blendafterruntime(fd, path, actualsize-datastart, reports); @@ -164,7 +137,7 @@ blo_read_runtime( } cleanup: - if (fd!=-1) + if(fd!=-1) close(fd); return bfd; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 2093400b952..8e877faad0d 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2661,14 +2661,14 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil } /* return: success (1) */ -int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *reports, int *thumb) +int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportList *reports, int *thumb) { char userfilename[FILE_MAXDIR+FILE_MAXFILE]; char tempname[FILE_MAXDIR+FILE_MAXFILE+1]; int file, err, write_user_block; /* open temporary file, so we preserve the original in case we crash */ - BLI_snprintf(tempname, sizeof(tempname), "%s@", dir); + BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath); file = open(tempname,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666); if(file == -1) { @@ -2680,24 +2680,32 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report if(write_flags & G_FILE_RELATIVE_REMAP) { char dir1[FILE_MAXDIR+FILE_MAXFILE]; char dir2[FILE_MAXDIR+FILE_MAXFILE]; - BLI_split_dirfile(dir, dir1, NULL); + BLI_split_dirfile(filepath, dir1, NULL); BLI_split_dirfile(mainvar->name, dir2, NULL); /* just incase there is some subtle difference */ BLI_cleanup_dir(mainvar->name, dir1); BLI_cleanup_dir(mainvar->name, dir2); - if(strcmp(dir1, dir2)==0) + if(BLI_path_cmp(dir1, dir2)==0) { write_flags &= ~G_FILE_RELATIVE_REMAP; - else - makeFilesAbsolute(mainvar, G.main->name, NULL); + } + else { + if(G.relbase_valid) { + /* blend may not have been saved before. Tn this case + * we should not have any relative paths, but if there + * is somehow, an invalid or empty G.main->name it will + * print an error, dont try make the absolute in this case. */ + makeFilesAbsolute(mainvar, G.main->name, NULL); + } + } } BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); - write_user_block= (BLI_path_cmp(dir, userfilename) == 0); + write_user_block= (BLI_path_cmp(filepath, userfilename) == 0); if(write_flags & G_FILE_RELATIVE_REMAP) - makeFilesRelative(mainvar, dir, NULL); /* note, making relative to something OTHER then G.main->name */ + makeFilesRelative(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */ /* actual file writing */ err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb); @@ -2711,12 +2719,12 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report int ret; /* first write compressed to separate @.gz */ - BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", dir); + BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", filepath); ret = BLI_gzip(tempname, gzname); if(0==ret) { /* now rename to real file name, and delete temp @ file too */ - if(BLI_rename(gzname, dir) != 0) { + if(BLI_rename(gzname, filepath) != 0) { BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @."); return 0; } @@ -2732,7 +2740,7 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report return 0; } } - else if(BLI_rename(tempname, dir) != 0) { + else if(BLI_rename(tempname, filepath) != 0) { BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @"); return 0; } diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index cb93d2bf70b..1ba695209b2 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1360,6 +1360,7 @@ void ANIM_OT_keyframe_delete_v3d (wmOperatorType *ot) { /* identifiers */ ot->name= "Delete Keyframe"; + ot->description= "Remove keyframes on current frame for selected object"; ot->idname= "ANIM_OT_keyframe_delete_v3d"; /* callbacks */ diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 04565b4c236..10886615976 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -578,9 +578,8 @@ void ANIM_keyingset_info_register (KeyingSetInfo *ksi) } /* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */ -void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi) +void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi) { - Main *bmain= CTX_data_main(C); KeyingSet *ks, *ksn; /* find relevant builtin KeyingSets which use this, and remove them */ diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 86dc2182e03..82decf8d1cf 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -206,7 +206,7 @@ void POSE_OT_propagate(struct wmOperatorType *ot); /* editarmature.c */ EditBone *make_boneList(struct ListBase *edbo, struct ListBase *bones, struct EditBone *parent, struct Bone *actBone); -void BIF_sk_selectStroke(struct bContext *C, const short mval[2], short extend); +void BIF_sk_selectStroke(struct bContext *C, const int mval[2], short extend); /* duplicate method */ void preEditBoneDuplicate(struct ListBase *editbones); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index f4e9c7c5d3e..06b2c06d4d2 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -1698,7 +1698,7 @@ void ARMATURE_OT_select_linked(wmOperatorType *ot) /* does bones and points */ /* note that BONE ROOT only gets drawn for root bones (or without IK) */ -static EditBone *get_nearest_editbonepoint (ViewContext *vc, const short mval[2], ListBase *edbo, int findunsel, int *selmask) +static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2], ListBase *edbo, int findunsel, int *selmask) { EditBone *ebone; rcti rect; @@ -1958,7 +1958,7 @@ static int ebone_select_flag(EditBone *ebone) } /* context: editmode armature in view3d */ -int mouse_armature(bContext *C, const short mval[2], int extend) +int mouse_armature(bContext *C, const int mval[2], int extend) { Object *obedit= CTX_data_edit_object(C); bArmature *arm= obedit->data; @@ -2498,8 +2498,8 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e ARegion *ar; View3D *v3d; RegionView3D *rv3d; - float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3]; - short mx, my, mval[2]; + float *fp = NULL, tvec[3], oldcurs[3]; + int mx, my; int retv; scene= CTX_data_scene(C); @@ -2513,27 +2513,9 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e mx= event->x - ar->winrct.xmin; my= event->y - ar->winrct.ymin; - project_short_noclip(ar, fp, mval); - - initgrabz(rv3d, fp[0], fp[1], fp[2]); - - if(mval[0]!=IS_CLIPPED) { - - window_to_3d_delta(ar, dvec, mval[0]-mx, mval[1]-my); - sub_v3_v3v3(fp, fp, dvec); - } - else { - - dx= ((float)(mx-(ar->winx/2)))*rv3d->zfac/(ar->winx/2); - dy= ((float)(my-(ar->winy/2)))*rv3d->zfac/(ar->winy/2); - - fz= rv3d->persmat[0][3]*fp[0]+ rv3d->persmat[1][3]*fp[1]+ rv3d->persmat[2][3]*fp[2]+ rv3d->persmat[3][3]; - fz= fz/rv3d->zfac; - - fp[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy+ rv3d->persinv[2][0]*fz)-rv3d->ofs[0]; - fp[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy+ rv3d->persinv[2][1]*fz)-rv3d->ofs[1]; - fp[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy+ rv3d->persinv[2][2]*fz)-rv3d->ofs[2]; - } + + window_to_3d(ar, tvec, fp, mx, my); + copy_v3_v3(fp, tvec); /* extrude to the where new cursor is and store the operation result */ retv= armature_click_extrude_exec(C, op); diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 158c0d23ddc..1fa6a88c9f3 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -702,7 +702,7 @@ static void sk_drawStrokeSubdivision(ToolSettings *toolsettings, SK_Stroke *stk) } } -static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, short mval[2], int *dist, int *index, int all_pts) +static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, int mval[2], int *dist, int *index, int all_pts) { ARegion *ar = CTX_wm_region(C); SK_Point *pt = NULL; @@ -736,7 +736,7 @@ static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, short mval[2], } #if 0 /* UNUSED 2.5 */ -static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, short mval[2], int *dist) +static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones, int mval[2], int *dist) { ARegion *ar = CTX_wm_region(C); SK_Point *pt = NULL; @@ -2157,7 +2157,7 @@ static void sk_applyGesture(bContext *C, SK_Sketch *sketch) /********************************************/ -static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const short mval[2], int extend) +static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], int extend) { ViewContext vc; rcti rect; @@ -2473,7 +2473,7 @@ static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(ev return OPERATOR_FINISHED; } -void BIF_sk_selectStroke(bContext *C, const short mval[2], short extend) +void BIF_sk_selectStroke(bContext *C, const int mval[2], short extend) { ToolSettings *ts = CTX_data_tool_settings(C); SK_Sketch *sketch = contextSketch(C, 0); diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 5897da97f85..9e0e9374d5d 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -527,7 +527,7 @@ static int poselib_remove_exec (bContext *C, wmOperator *op) } /* get index (and pointer) of pose to remove */ - marker= BLI_findlink(&act->markers, RNA_int_get(op->ptr, "pose")); + marker= BLI_findlink(&act->markers, RNA_enum_get(op->ptr, "pose")); if (marker == NULL) { BKE_reportf(op->reports, RPT_ERROR, "Invalid Pose specified %d", RNA_int_get(op->ptr, "pose")); return OPERATOR_CANCELLED; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index cb73f20fe7b..1bfd910523e 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4169,7 +4169,7 @@ void CURVE_OT_make_segment(wmOperatorType *ot) /***************** pick select from 3d view **********************/ -int mouse_nurb(bContext *C, const short mval[2], int extend) +int mouse_nurb(bContext *C, const int mval[2], int extend) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4666,7 +4666,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event) Curve *cu; ViewContext vc; float location[3]; - short mval[2]; + int mval[2]; Nurb *nu; BezTriple *bezt; @@ -6118,6 +6118,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) mul_m4_v3(cmat, bezt->vec[2]); bezt++; } + calchandlesNurb(newnu); } if( (bp= newnu->bp) ) { a= newnu->pntsu*nu->pntsv; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 2baefc2de8e..4de40bc536c 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -377,8 +377,7 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi } else { float *fp= give_cursor(scene, v3d); - float dvec[3]; - short mval[2]; + int mval[2]; int mx, my; /* get screen coordinate */ @@ -390,15 +389,13 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi mx= (int)(pt->x / 100 * ar->winx); my= (int)(pt->y / 100 * ar->winy); } - mval[0]= (short)mx; - mval[1]= (short)my; + mval[0]= mx; + mval[1]= my; /* convert screen coordinate to 3d coordinates * - method taken from editview.c - mouse_cursor() */ - project_short_noclip(ar, fp, mval); - window_to_3d(ar, dvec, mval[0]-mx, mval[1]-my); - sub_v3_v3v3(p3d, fp, dvec); + window_to_3d(ar, p3d, fp, mval[0], mval[1]); } } @@ -564,8 +561,6 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op) bGPdata *gpd= gpencil_data_get_active(C); bGPDlayer *gpl= gpencil_layer_getactive(gpd); Scene *scene= CTX_data_scene(C); - View3D *v3d= CTX_wm_view3d(C); - float *fp= give_cursor(scene, v3d); int mode= RNA_enum_get(op->ptr, "type"); /* check if there's data to work with */ @@ -574,9 +569,6 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* initialise 3d-cursor correction globals */ - initgrabz(CTX_wm_region_view3d(C), fp[0], fp[1], fp[2]); - /* handle conversion modes */ switch (mode) { case GP_STROKECONVERT_PATH: diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 5763fcde705..7db18eaedf4 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -239,7 +239,7 @@ static short gp_stroke_filtermval (tGPsdata *p, int mval[2], int pmval[2]) /* convert screen-coordinates to buffer-coordinates */ // XXX this method needs a total overhaul! -static void gp_stroke_convertcoords (tGPsdata *p, short mval[2], float out[3], float *depth) +static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], float *depth) { bGPdata *gpd= p->gpd; @@ -251,7 +251,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[2], float out[3], f */ } else { - const short mx=mval[0], my=mval[1]; + const int mx=mval[0], my=mval[1]; float rvec[3], dvec[3]; /* Current method just converts each point in screen-coordinates to @@ -266,7 +266,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[2], float out[3], f gp_get_3d_reference(p, rvec); /* method taken from editview.c - mouse_cursor() */ - project_short_noclip(p->ar, rvec, mval); + project_int_noclip(p->ar, rvec, mval); window_to_3d_delta(p->ar, dvec, mval[0]-mx, mval[1]-my); sub_v3_v3v3(out, rvec, dvec); } @@ -387,8 +387,8 @@ static short gp_stroke_addpoint (tGPsdata *p, int mval[2], float pressure) /* temp struct for gp_stroke_smooth() */ typedef struct tGpSmoothCo { - short x; - short y; + int x; + int y; } tGpSmoothCo; /* smooth a stroke (in buffer) before storing it */ @@ -417,8 +417,8 @@ static void gp_stroke_smooth (tGPsdata *p) const tGPspoint *pd= (i+1 < cmx)?(pc+1):(pc); const tGPspoint *pe= (i+2 < cmx)?(pc+2):(pd); - spc->x= (short)(0.1*pa->x + 0.2*pb->x + 0.4*pc->x + 0.2*pd->x + 0.1*pe->x); - spc->y= (short)(0.1*pa->y + 0.2*pb->y + 0.4*pc->y + 0.2*pd->y + 0.1*pe->y); + spc->x= (int)(0.1*pa->x + 0.2*pb->x + 0.4*pc->x + 0.2*pd->x + 0.1*pe->x); + spc->y= (int)(0.1*pa->y + 0.2*pb->y + 0.4*pc->y + 0.2*pd->y + 0.1*pe->y); } /* second pass: apply smoothed coordinates */ @@ -574,7 +574,7 @@ static void gp_stroke_newfrombuffer (tGPsdata *p) /* get an array of depths, far depths are blended */ if (gpencil_project_check(p)) { - short mval[2], mval_prev[2]= {0}; + int mval[2], mval_prev[2]= {0}; int interp_depth = 0; int found_depth = 0; @@ -738,7 +738,7 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho { bGPDspoint *pt1, *pt2; int x0=0, y0=0, x1=0, y1=0; - short xyval[2]; + int xyval[2]; int i; if (gps->totpoints == 0) { @@ -750,7 +750,7 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho else if (gps->totpoints == 1) { /* get coordinates */ if (gps->flag & GP_STROKE_3DSPACE) { - project_short(p->ar, &gps->points->x, xyval); + project_int(p->ar, &gps->points->x, xyval); x0= xyval[0]; y0= xyval[1]; } @@ -804,11 +804,11 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho /* get coordinates */ if (gps->flag & GP_STROKE_3DSPACE) { - project_short(p->ar, &pt1->x, xyval); + project_int(p->ar, &pt1->x, xyval); x0= xyval[0]; y0= xyval[1]; - project_short(p->ar, &pt2->x, xyval); + project_int(p->ar, &pt2->x, xyval); x1= xyval[0]; y1= xyval[1]; } @@ -1501,8 +1501,8 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op) /* get relevant data for this point from stroke */ RNA_float_get_array(&itemptr, "mouse", mousef); - p->mval[0] = (short)mousef[0]; - p->mval[1] = (short)mousef[1]; + p->mval[0] = (int)mousef[0]; + p->mval[1] = (int)mousef[1]; p->pressure= RNA_float_get(&itemptr, "pressure"); if (RNA_boolean_get(&itemptr, "is_start")) { diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 36923736068..a029c5c1f12 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -117,7 +117,7 @@ void ED_armature_deselect_all_visible(struct Object *obedit); int ED_do_pose_selectbuffer(struct Scene *scene, struct Base *base, unsigned int *buffer, short hits, short extend); -int mouse_armature(struct bContext *C, const short mval[2], int extend); +int mouse_armature(struct bContext *C, const int mval[2], int extend); int join_armature_exec(struct bContext *C, struct wmOperator *op); struct Bone *get_indexed_bone (struct Object *ob, int index); float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const short axis_only); diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index cfafd38ed15..6a92ee2e056 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -66,7 +66,7 @@ void free_editNurb (struct Object *obedit); void free_curve_editNurb (struct Curve *cu); -int mouse_nurb (struct bContext *C, const short mval[2], int extend); +int mouse_nurb (struct bContext *C, const int mval[2], int extend); struct Nurb *add_nurbs_primitive(struct bContext *C, float mat[4][4], int type, int newob); diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index d06b0d6c4ee..e5715316a31 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -56,7 +56,7 @@ struct wmKeyConfig; * Used as part of the 'stroke cache' used during drawing of new strokes */ typedef struct tGPspoint { - short x, y; /* x and y coordinates of cursor (in relative to area) */ + int x, y; /* x and y coordinates of cursor (in relative to area) */ float pressure; /* pressure of tablet at this point */ } tGPspoint; diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 2c866495503..cfe9ea53d9a 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -68,8 +68,5 @@ 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); -/* image_render.c, export for screen_ops.c, render operator */ -void ED_space_image_output(struct bContext *C); - #endif /* ED_IMAGE_H */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 7bab563641a..6523a897713 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -36,6 +36,7 @@ extern "C" { #endif +struct Main; struct ListBase; struct ID; struct Scene; @@ -190,7 +191,7 @@ KeyingSetInfo *ANIM_keyingset_info_find_named(const char name[]); /* for RNA type registrations... */ void ANIM_keyingset_info_register(KeyingSetInfo *ksi); -void ANIM_keyingset_info_unregister(const struct bContext *C, KeyingSetInfo *ksi); +void ANIM_keyingset_info_unregister(struct Main *bmain, KeyingSetInfo *ksi); /* cleanup on exit */ void ANIM_keyingset_infos_exit(void); diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h index a742be7337c..2afc3155398 100644 --- a/source/blender/editors/include/ED_mball.h +++ b/source/blender/editors/include/ED_mball.h @@ -42,7 +42,7 @@ void ED_keymap_metaball(struct wmKeyConfig *keyconf); struct MetaElem *add_metaball_primitive(struct bContext *C, float mat[4][4], int type, int newname); -int mouse_mball(struct bContext *C, const short mval[2], int extend); +int mouse_mball(struct bContext *C, const int mval[2], int extend); void free_editMball(struct Object *obedit); void make_editMball(struct Object *obedit); diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index c3c843154e5..5c4dfc6ba3d 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -169,9 +169,9 @@ void EM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs; void EM_cache_x_mirror_vert(struct Object *ob, struct EditMesh *em); -int mouse_mesh(struct bContext *C, const short mval[2], short extend); +int mouse_mesh(struct bContext *C, const int mval[2], short extend); int EM_check_backbuf(unsigned int index); -int EM_mask_init_backbuf_border(struct ViewContext *vc, short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax); +int EM_mask_init_backbuf_border(struct ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax); void EM_free_backbuf(void); int EM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); int EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads); @@ -187,10 +187,10 @@ void EM_automerge(struct Scene *scene, struct Object *obedit, int update); /* editface.c */ void paintface_flush_flags(struct Object *ob); struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy); -int paintface_mouse_select(struct bContext *C, struct Object *ob, const short mval[2], int extend); +int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], int extend); int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend); void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags); -void paintface_select_linked(struct bContext *C, struct Object *ob, short mval[2], int mode); +void paintface_select_linked(struct bContext *C, struct Object *ob, int mval[2], int mode); int paintface_minmax(struct Object *ob, float *min, float *max); void paintface_hide(struct Object *ob, const int unselected); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 3b27fb45f5d..28d0a9520b2 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -126,7 +126,7 @@ void ED_object_constraint_update(struct Object *ob); void ED_object_constraint_dependency_update(struct Main *bmain, struct Scene *scene, struct Object *ob); /* object_lattice.c */ -int mouse_lattice(struct bContext *C, const short mval[2], int extend); +int mouse_lattice(struct bContext *C, const int mval[2], int extend); void undo_push_lattice(struct bContext *C, const char *name); /* object_lattice.c */ diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index f29284fe64d..23997e06aef 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -60,10 +60,10 @@ void PE_hide_keys_time(struct Scene *scene, struct PTCacheEdit *edit, float cfra void PE_update_object(struct Scene *scene, struct Object *ob, int useflag); /* selection tools */ -int PE_mouse_particles(struct bContext *C, const short mval[2], int extend); +int PE_mouse_particles(struct bContext *C, const int mval[2], int extend); int PE_border_select(struct bContext *C, struct rcti *rect, int select, int extend); -int PE_circle_select(struct bContext *C, int selecting, const short mval[2], float rad); -int PE_lasso_select(struct bContext *C, short mcords[][2], short moves, short extend, short select); +int PE_circle_select(struct bContext *C, int selecting, const int mval[2], float rad); +int PE_lasso_select(struct bContext *C, int mcords[][2], short moves, short extend, short select); void PE_deselect_all_visible(struct PTCacheEdit *edit); /* undo */ diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 77b754519fb..50dd2308b6b 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -86,7 +86,6 @@ void undo_editmode_step (struct bContext *C, int step); float *crazyspace_get_mapped_editverts(struct Scene *scene, struct Object *obedit); void crazyspace_set_quats_editmesh(struct EditMesh *em, float *origcos, float *mappedcos, float *quats); void crazyspace_set_quats_mesh(struct Mesh *me, float *origcos, float *mappedcos, float *quats); -int editmesh_get_first_deform_matrices(struct Scene *scene, struct Object *ob, struct EditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3]); int sculpt_get_first_deform_matrices(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]); void crazyspace_build_sculpt(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 297bd234edd..00fb6371d68 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -64,7 +64,7 @@ typedef struct ViewContext { struct View3D *v3d; struct RegionView3D *rv3d; struct EditMesh *em; - short mval[2]; + int mval[2]; } ViewContext; typedef struct ViewDepths { @@ -80,9 +80,9 @@ typedef struct ViewDepths { float *give_cursor(struct Scene *scene, struct View3D *v3d); int initgrabz(struct RegionView3D *rv3d, float x, float y, float z); -void window_to_3d(struct ARegion *ar, float out[3], short mx, short my); -void window_to_3d_delta(struct ARegion *ar, float out[3], short mx, short my); -void window_to_3d_vector(struct ARegion *ar, float out[3], short mx, short my); +void window_to_3d(struct ARegion *ar, float out[3], const float depth_pt[3], const int mx, const int my); +void window_to_3d_delta(struct ARegion *ar, float out[3], const int mx, const int my); +void window_to_3d_vector(struct ARegion *ar, float out[3], const int mx, const int my); void view3d_unproject(struct bglMats *mats, float out[3], const short x, const short y, const float z); /* Depth buffer */ @@ -109,9 +109,9 @@ void viewvector(struct RegionView3D *rv3d, float coord[3], float vec[3]); void viewline(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_start[3], float ray_end[3]); void viewray(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_start[3], float ray_normal[3]); +void get_object_clip_range(struct Object *ob, float *lens, float *clipsta, float *clipend); int get_view3d_cliprange(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend); int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize); -int get_view3d_ortho(struct View3D *v3d, struct RegionView3D *rv3d); void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); void view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]); void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r, short do_shift); @@ -133,18 +133,18 @@ void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]); /* backbuffer select and draw support */ void view3d_validate_backbuf(struct ViewContext *vc); struct ImBuf *view3d_read_backbuf(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); -unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const short mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict, +unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const int mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict, void *handle, unsigned int (*indextest)(void *handle, unsigned int index)); unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y); /* draws and does a 4x4 sample */ -int view_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const short mval[2], float mouse_worldloc[3]); +int view_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3]); /* only draw so view_autodist_simple can be called many times after */ int view_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode); -int view_autodist_simple(struct ARegion *ar, const short mval[2], float mouse_worldloc[3], int margin, float *force_depth); -int view_autodist_depth(struct ARegion *ar, const short mval[2], int margin, float *depth); -int view_autodist_depth_segment(struct ARegion *ar, const short mval_sta[2], const short mval_end[2], int margin, float *depth); +int view_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth); +int view_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth); +int view_autodist_depth_segment(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth); /* select */ #define MAXPICKBUF 10000 @@ -153,13 +153,13 @@ short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigne void view3d_set_viewcontext(struct bContext *C, struct ViewContext *vc); void view3d_operator_needs_opengl(const struct bContext *C); void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar); -int view3d_get_view_aligned_coordinate(struct ViewContext *vc, float fp[3], const short mval[2], const short do_fallback); +int view3d_get_view_aligned_coordinate(struct ViewContext *vc, float fp[3], const int mval[2], const short do_fallback); void view3d_get_transformation(struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats); /* XXX should move to BLI_math */ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2); -int lasso_inside(short mcords[][2], short moves, short sx, short sy); -int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1); +int lasso_inside(int mcords[][2], short moves, int sx, int sy); +int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int y1); /* get 3d region from context, also if mouse is in header or toolbar */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); @@ -178,7 +178,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256]); -Base *ED_view3d_give_base_under_cursor(struct bContext *C, const short mval[2]); +Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip); int ED_view3d_lock(struct RegionView3D *rv3d); @@ -187,9 +187,19 @@ unsigned int ED_viewedit_datamask(struct bScreen *screen); /* assigning view matrix */ -void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist); -void view3d_apply_ob(struct Object *ob, float *ofs, float *quat, float *dist, float *lens); +void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist); + +void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); +void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist); + +/* camera lock functions */ +/* copy the camera to the view before starting a view transformation */ +void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d); +/* copy the view to the camera */ +void ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); + int view3d_is_ortho(struct View3D *v3d, struct RegionView3D *rv3d); + #endif /* ED_VIEW3D_H */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index ae5af185442..759301cc8f3 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -262,14 +262,12 @@ static int ui_is_a_warp_but(uiBut *but) static int ui_is_utf8_but(uiBut *but) { if (but->rnaprop) { - int subtype= RNA_property_subtype(but->rnaprop); - - if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { - return TRUE; - } + const int subtype= RNA_property_subtype(but->rnaprop); + return !(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)); + } + else { + return !(but->flag & UI_BUT_NO_UTF8); } - - return !(but->flag & UI_BUT_NO_UTF8); } /* ********************** button apply/revert ************************/ @@ -300,7 +298,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but) after->func_arg3= but->func_arg3; after->funcN= but->funcN; - after->func_argN= but->func_argN; + after->func_argN= MEM_dupallocN(but->func_argN); after->rename_func= but->rename_func; after->rename_arg1= but->rename_arg1; @@ -404,6 +402,8 @@ static void ui_apply_but_funcs_after(bContext *C) after.func(C, after.func_arg1, after.func_arg2); if(after.funcN) after.funcN(C, after.func_argN, after.func_arg2); + if(after.func_argN) + MEM_freeN(after.func_argN); if(after.handle_func) after.handle_func(C, after.handle_func_arg, after.retval); @@ -1679,7 +1679,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) { if(but) { - if(!ui_is_utf8_but(but)) { + if(ui_is_utf8_but(but)) { int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr)); /* not a file?, strip non utf-8 chars */ if(strip) { diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 9507a1a07f4..037cc22f879 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -798,36 +798,39 @@ void UI_icons_init(int first_dyn_id) init_brush_icons(); } -/* Render size for preview images at level miplevel */ -static int preview_render_size(int miplevel) +/* Render size for preview images and icons + */ +static int preview_render_size(enum eIconSizes size) { - switch (miplevel) { - case 0: return 32; - case 1: return PREVIEW_DEFAULT_HEIGHT; + switch (size) { + case ICON_SIZE_ICON: return 32; + case ICON_SIZE_PREVIEW: return PREVIEW_DEFAULT_HEIGHT; } return 0; } -static void icon_create_mipmap(struct PreviewImage* prv_img, int miplevel) +/* Create rect for the icon + */ +static void icon_create_rect(struct PreviewImage* prv_img, enum eIconSizes size) { - unsigned int size = preview_render_size(miplevel); + unsigned int render_size = preview_render_size(size); if (!prv_img) { if (G.f & G_DEBUG) printf("Error: requested preview image does not exist"); } - if (!prv_img->rect[miplevel]) { - prv_img->w[miplevel] = size; - prv_img->h[miplevel] = size; - prv_img->changed[miplevel] = 1; - prv_img->changed_timestamp[miplevel] = 0; - prv_img->rect[miplevel] = MEM_callocN(size*size*sizeof(unsigned int), "prv_rect"); + if (!prv_img->rect[size]) { + prv_img->w[size] = render_size; + prv_img->h[size] = render_size; + prv_img->changed[size] = 1; + prv_img->changed_timestamp[size] = 0; + prv_img->rect[size] = MEM_callocN(render_size*render_size*sizeof(unsigned int), "prv_rect"); } } /* only called when icon has changed */ /* only call with valid pointer from UI_icon_draw */ -static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miplevel) +static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, enum eIconSizes size) { if (!prv_img) { if (G.f & G_DEBUG) @@ -835,11 +838,10 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple return; } - /* create the preview rect */ - icon_create_mipmap(prv_img, miplevel); + icon_create_rect(prv_img, size); - ED_preview_icon_job(C, prv_img, id, prv_img->rect[miplevel], - prv_img->w[miplevel], prv_img->h[miplevel]); + ED_preview_icon_job(C, prv_img, id, prv_img->rect[size], + prv_img->w[size], prv_img->h[size]); } static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview) @@ -928,17 +930,17 @@ static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy glDisable(GL_TEXTURE_2D); } -/* Drawing size for preview images at level miplevel */ -static int preview_size(int miplevel) +/* Drawing size for preview images */ +static int get_draw_size(enum eIconSizes size) { - switch (miplevel) { - case 0: return ICON_DEFAULT_HEIGHT; - case 1: return PREVIEW_DEFAULT_HEIGHT; + switch (size) { + case ICON_SIZE_ICON: return ICON_DEFAULT_HEIGHT; + case ICON_SIZE_PREVIEW: return PREVIEW_DEFAULT_HEIGHT; } return 0; } -static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate), int is_preview) +static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), int is_preview) { Icon *icon = NULL; DrawInfo *di = NULL; @@ -988,11 +990,11 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al if(pi) { /* no create icon on this level in code */ - if(!pi->rect[miplevel]) return; /* something has gone wrong! */ + if(!pi->rect[size]) return; /* something has gone wrong! */ /* preview images use premul alpha ... */ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL, is_preview); + icon_draw_rect(x, y, w, h, aspect, pi->w[size], pi->h[size], pi->rect[size], 1.0f, NULL, is_preview); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } } @@ -1024,7 +1026,7 @@ static void ui_id_brush_render(bContext *C, ID *id) if(!pi) return; - for(i = 0; i < PREVIEW_MIPMAPS; i++) { + for(i = 0; i < NUM_ICON_SIZES; i++) { /* check if rect needs to be created; changed only set by dynamic icons */ if((pi->changed[i] || !pi->rect[i])) { @@ -1113,21 +1115,21 @@ int ui_id_icon_get(bContext *C, ID *id, int big) return iconid; } -static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, float alpha, int miplevel, int nocreate) +static void icon_draw_at_size(float x, float y, int icon_id, float aspect, float alpha, enum eIconSizes size, int nocreate) { - int draw_size = preview_size(miplevel); - icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate, FALSE); + int draw_size = get_draw_size(size); + icon_draw_size(x, y, icon_id, aspect, alpha, NULL, size, draw_size, nocreate, FALSE); } void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha) { - icon_draw_mipmap(x, y, icon_id, aspect, alpha, PREVIEW_MIPMAP_ZERO, 0); + icon_draw_at_size(x, y, icon_id, aspect, alpha, ICON_SIZE_ICON, 0); } void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb) { - int draw_size = preview_size(PREVIEW_MIPMAP_ZERO); - icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, FALSE, FALSE); + int draw_size = get_draw_size(ICON_SIZE_ICON); + icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, ICON_SIZE_ICON, draw_size, FALSE, FALSE); } void UI_icon_draw(float x, float y, int icon_id) @@ -1137,21 +1139,21 @@ void UI_icon_draw(float x, float y, int icon_id) void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha) { - icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, PREVIEW_MIPMAP_ZERO, size, TRUE, FALSE); + icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, ICON_SIZE_ICON, size, TRUE, FALSE); } void UI_icon_draw_preview(float x, float y, int icon_id) { - icon_draw_mipmap(x, y, icon_id, 1.0f, 1.0f, PREVIEW_MIPMAP_LARGE, 0); + icon_draw_at_size(x, y, icon_id, 1.0f, 1.0f, ICON_SIZE_PREVIEW, 0); } void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect) { - icon_draw_mipmap(x, y, icon_id, aspect, 1.0f, PREVIEW_MIPMAP_LARGE, 0); + icon_draw_at_size(x, y, icon_id, aspect, 1.0f, ICON_SIZE_PREVIEW, 0); } void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size) { - icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, FALSE, TRUE); + icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, ICON_SIZE_PREVIEW, size, FALSE, TRUE); } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 12506d28593..e9fad382beb 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -97,7 +97,7 @@ static int eyedropper_cancel(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static void eyedropper_sample(bContext *C, Eyedropper *eye, short mx, short my) +static void eyedropper_sample(bContext *C, Eyedropper *eye, int mx, int my) { if(RNA_property_type(eye->prop) == PROP_FLOAT) { const int color_manage = CTX_data_scene(C)->r.color_mgt_flag & R_COLOR_MANAGEMENT; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index a4c2dbb9943..624f06db3c1 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1625,7 +1625,7 @@ void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_ } #if 0 -static void ui_warp_pointer(short x, short y) +static void ui_warp_pointer(int x, int y) { /* XXX 2.50 which function to use for this? */ /* OSX has very poor mousewarp support, it sends events; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 7648d5067b4..60a6008de43 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -461,7 +461,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiButSetNFunc(but, NULL, MEM_dupallocN(template), NULL); } else { - but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Unlink datablock. Shift + Click to set users to zero, data gets not saved"); + but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Unlink datablock. Shift + Click to set users to zero, data will then not be saved"); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE)); if(RNA_property_flag(template->prop) & PROP_NEVER_NULL) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index ecadb52ad5d..58ed1e31b81 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -888,7 +888,7 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect) /* textbut exception, clip right when... */ if(but->editstr && but->pos >= 0) { float width; - char buf[256]; + char buf[UI_MAX_DRAW_STR]; /* copy draw string */ BLI_strncpy(buf, but->drawstr, sizeof(buf)); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 32301dd6423..84cf5af5414 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -2028,7 +2028,7 @@ typedef struct View2DString { unsigned char ub[4]; int pack; } col; - short mval[2]; + int mval[2]; rcti rect; } View2DString; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 62b191c2c6e..4cb67994704 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -86,6 +86,7 @@ typedef struct v2dViewPanData { /* options for version 1 */ int startx, starty; /* mouse x/y values in window when operator was initiated */ int lastx, lasty; /* previous x/y values of mouse in window */ + int invoke_event; /* event starting pan, for modal exit */ short in_scroller; /* for MMB in scrollers (old feature in past, but now not that useful) */ } v2dViewPanData; @@ -202,7 +203,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event) /* set initial settings */ vpd->startx= vpd->lastx= event->x; vpd->starty= vpd->lasty= event->y; - + vpd->invoke_event= event->type; + if (event->type == MOUSEPAN) { RNA_int_set(op->ptr, "deltax", event->prevx - event->x); RNA_int_set(op->ptr, "deltay", event->prevy - event->y); @@ -261,17 +263,19 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL); return OPERATOR_FINISHED; } - case MIDDLEMOUSE: - case ESCKEY: - if (event->val==KM_RELEASE) { - /* calculate overall delta mouse-movement for redo */ - RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); - RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); - - view_pan_exit(op); - WM_cursor_restore(CTX_wm_window(C)); - - return OPERATOR_FINISHED; + + default: + if (event->type == vpd->invoke_event || event->type==ESCKEY) { + if (event->val==KM_RELEASE) { + /* calculate overall delta mouse-movement for redo */ + RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); + RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); + + view_pan_exit(op); + WM_cursor_restore(CTX_wm_window(C)); + + return OPERATOR_FINISHED; + } } break; } @@ -519,6 +523,7 @@ typedef struct v2dViewZoomData { double timer_lastdraw; int lastx, lasty; /* previous x/y values of mouse in window */ + int invoke_event; /* event type that invoked, for modal exits */ float dx, dy; /* running tally of previous delta values (for obtaining final zoom) */ float mx_2d, my_2d; /* initial mouse location in v2d coords */ } v2dViewZoomData; @@ -923,6 +928,9 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_float_set(op->ptr, "deltax", 0); RNA_float_set(op->ptr, "deltay", 0); + /* for modal exit test */ + vzd->invoke_event= event->type; + if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { ARegion *ar= CTX_wm_region(C); @@ -1021,8 +1029,9 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) /* apply zooming */ view_zoomdrag_apply(C, op); } - else if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) { /* XXX needs modal keymap */ - if (event->val==KM_RELEASE) { + else if (event->type == vzd->invoke_event || event->type==ESCKEY) { + if (event->val == KM_RELEASE) { + /* for redo, store the overall deltas - need to respect zoom-locks here... */ if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) RNA_float_set(op->ptr, "deltax", vzd->dx); diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 9cec034af28..ab62c88deaa 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -98,7 +98,7 @@ void paintface_flush_flags(Object *ob) } /* returns 0 if not found, otherwise 1 */ -static int facesel_face_pick(struct bContext *C, Mesh *me, const short mval[2], unsigned int *index, short rect) +static int facesel_face_pick(struct bContext *C, Mesh *me, const int mval[2], unsigned int *index, short rect) { ViewContext vc; view3d_set_viewcontext(C, &vc); @@ -327,7 +327,7 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind MEM_freeN(linkflag); } -void paintface_select_linked(bContext *UNUSED(C), Object *ob, short UNUSED(mval[2]), int mode) +void paintface_select_linked(bContext *UNUSED(C), Object *ob, int UNUSED(mval[2]), int mode) { Mesh *me; unsigned int index=0; @@ -716,7 +716,7 @@ void seam_mark_clear_tface(Scene *scene, short mode) } #endif -int paintface_mouse_select(struct bContext *C, Object *ob, const short mval[2], int extend) +int paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], int extend) { Mesh *me; MFace *mface, *msel; diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 72e9e3b6d9e..d7e59e0a68f 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -199,7 +199,7 @@ static void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcut EditEdge *nearest=NULL, *eed; float fac; int keys = 0, holdnum=0, selectmode, dist; - short mvalo[2] = {0, 0}, mval[2] = {0, 0}; + int mvalo[2] = {0, 0}, mval[2] = {0, 0}; short event=0, val, choosing=1, cancel=0, cuthalf = 0, smooth=0; short hasHidden = 0; char msg[128]; diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 8cdbe6707a3..bd49fab1de1 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -162,7 +162,7 @@ unsigned int em_solidoffs=0, em_wireoffs=0, em_vertoffs=0; /* set in drawobject. static char *selbuf= NULL; /* opengl doesn't support concave... */ -static void draw_triangulated(short mcords[][2], short tot) +static void draw_triangulated(int mcords[][2], short tot) { ListBase lb={NULL, NULL}; DispList *dl; @@ -256,7 +256,7 @@ void EM_free_backbuf(void) - grab again and compare returns 'OK' */ -int EM_mask_init_backbuf_border(ViewContext *vc, short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax) +int EM_mask_init_backbuf_border(ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax) { unsigned int *dr, *drm; struct ImBuf *buf, *bufmask; @@ -290,7 +290,7 @@ int EM_mask_init_backbuf_border(ViewContext *vc, short mcords[][2], short tot, s draw_triangulated(mcords, tot); glBegin(GL_LINE_LOOP); /* for zero sized masks, lines */ - for(a=0; a<tot; a++) glVertex2s(mcords[a][0], mcords[a][1]); + for(a=0; a<tot; a++) glVertex2iv(mcords[a]); glEnd(); glFinish(); /* to be sure readpixels sees mask */ @@ -358,7 +358,7 @@ int EM_init_backbuf_circle(ViewContext *vc, short xs, short ys, short rads) static void findnearestvert__doClosest(void *userData, EditVert *eve, int x, int y, int index) { - struct { short mval[2], pass, select, strict; int dist, lastIndex, closestIndex; EditVert *closest; } *data = userData; + struct { int mval[2]; short pass, select, strict; int dist, lastIndex, closestIndex; EditVert *closest; } *data = userData; if (data->pass==0) { if (index<=data->lastIndex) @@ -426,7 +426,7 @@ EditVert *findnearestvert(ViewContext *vc, int *dist, short sel, short strict) } else { - struct { short mval[2], pass, select, strict; int dist, lastIndex, closestIndex; EditVert *closest; } data; + struct { int mval[2]; short pass, select, strict; int dist, lastIndex, closestIndex; EditVert *closest; } data; static int lastSelectedIndex=0; static EditVert *lastSelected=NULL; @@ -549,7 +549,7 @@ EditEdge *findnearestedge(ViewContext *vc, int *dist) static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { - struct { short mval[2]; int dist; EditFace *toFace; } *data = userData; + struct { int mval[2]; int dist; EditFace *toFace; } *data = userData; if (efa==data->toFace) { int temp = abs(data->mval[0]-x) + abs(data->mval[1]-y); @@ -560,7 +560,7 @@ static void findnearestface__getDistance(void *userData, EditFace *efa, int x, i } static void findnearestface__doClosest(void *userData, EditFace *efa, int x, int y, int index) { - struct { short mval[2], pass; int dist, lastIndex, closestIndex; EditFace *closest; } *data = userData; + struct { int mval[2]; short pass; int dist, lastIndex, closestIndex; EditFace *closest; } *data = userData; if (data->pass==0) { if (index<=data->lastIndex) @@ -588,7 +588,7 @@ static EditFace *findnearestface(ViewContext *vc, int *dist) EditFace *efa = BLI_findlink(&vc->em->faces, index-1); if (efa) { - struct { short mval[2]; int dist; EditFace *toFace; } data; + struct { int mval[2]; int dist; EditFace *toFace; } data; data.mval[0] = vc->mval[0]; data.mval[1] = vc->mval[1]; @@ -607,7 +607,7 @@ static EditFace *findnearestface(ViewContext *vc, int *dist) return NULL; } else { - struct { short mval[2], pass; int dist, lastIndex, closestIndex; EditFace *closest; } data; + struct { int mval[2]; short pass; int dist, lastIndex, closestIndex; EditFace *closest; } data; static int lastSelectedIndex=0; static EditFace *lastSelected=NULL; @@ -2061,7 +2061,7 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot) /* ***************** loop select (non modal) ************** */ -static void mouse_mesh_loop(bContext *C, const short mval[2], short extend, short ring) +static void mouse_mesh_loop(bContext *C, const int mval[2], short extend, short ring) { ViewContext vc; EditMesh *em; @@ -2149,7 +2149,7 @@ void MESH_OT_loop_select(wmOperatorType *ot) /* ******************* mesh shortest path select, uses prev-selected edge ****************** */ /* since you want to create paths with multiple selects, it doesn't have extend option */ -static void mouse_mesh_shortest_path(bContext *C, const short mval[2]) +static void mouse_mesh_shortest_path(bContext *C, const int mval[2]) { ViewContext vc; EditMesh *em; @@ -2282,7 +2282,7 @@ void MESH_OT_select_shortest_path(wmOperatorType *ot) /* here actual select happens */ /* gets called via generic mouse select operator */ -int mouse_mesh(bContext *C, const short mval[2], short extend) +int mouse_mesh(bContext *C, const int mval[2], short extend) { ViewContext vc; EditVert *eve; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index a78029da079..11e7d64c667 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4011,7 +4011,7 @@ useless: LinkNode *fuv_link; short event, draw=1; - short mval[2], mvalo[2]; + int mval[2], mvalo[2]; char str[128]; float labda = 0.0f; @@ -4416,7 +4416,7 @@ useless: percp = -1; while(draw) { /* For the % calculation */ - short mval[2]; + int mval[2]; float rc[2]; float v2[2], v3[2]; EditVert *centerVert, *upVert, *downVert; @@ -4867,7 +4867,7 @@ void mesh_set_face_flags(EditMesh *em, short mode) /********************** Rip Operator *************************/ /* helper to find edge for edge_rip */ -static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const short mval[2]) +static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const int mval[2]) { float vec1[3], vec2[3], mvalf[2]; @@ -4910,7 +4910,8 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) EditEdge *eed, *seed= NULL; EditFace *efa, *sefa= NULL; float projectMat[4][4], vec[3], dist, mindist; - short doit= 1, *mval= event->mval; + short doit= 1; + int *mval= event->mval; /* select flush... vertices are important */ EM_selectmode_set(em); diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index b67f9d6de29..b007e30422d 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -455,7 +455,7 @@ void MBALL_OT_reveal_metaelems(wmOperatorType *ot) /* Select MetaElement with mouse click (user can select radius circle or * stiffness circle) */ -int mouse_mball(bContext *C, const short mval[2], int extend) +int mouse_mball(bContext *C, const int mval[2], int extend) { static MetaElem *startelem=NULL; Object *obedit= CTX_data_edit_object(C); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index eb04a2743e3..91980ddf228 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -607,7 +607,7 @@ static void spot_interactive(Object *ob, int mode) Lamp *la= ob->data; float transfac, dx, dy, ratio, origval; int keep_running= 1, center2d[2]; - short mval[2], mvalo[2]; + int mval[2], mvalo[2]; // getmouseco_areawin(mval); // getmouseco_areawin(mvalo); @@ -1689,6 +1689,7 @@ void OBJECT_OT_shade_flat(wmOperatorType *ot) { /* identifiers */ ot->name= "Shade Flat"; + ot->description= "Display faces 'smooth' (using vertext normals)"; ot->idname= "OBJECT_OT_shade_flat"; /* api callbacks */ @@ -1703,6 +1704,7 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot) { /* identifiers */ ot->name= "Shade Smooth"; + ot->description= "Display faces 'flat'"; ot->idname= "OBJECT_OT_shade_smooth"; /* api callbacks */ @@ -2053,6 +2055,7 @@ void OBJECT_OT_game_property_new(wmOperatorType *ot) { /* identifiers */ ot->name= "New Game Property"; + ot->description= "Create a new property available to the game engine"; ot->idname= "OBJECT_OT_game_property_new"; /* api callbacks */ @@ -2090,6 +2093,7 @@ void OBJECT_OT_game_property_remove(wmOperatorType *ot) { /* identifiers */ ot->name= "Remove Game Property"; + ot->description= "Remove game property"; ot->idname= "OBJECT_OT_game_property_remove"; /* api callbacks */ diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 198c8cab7fa..14ce223db5e 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -305,7 +305,7 @@ void LATTICE_OT_make_regular(wmOperatorType *ot) static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, int y) { - struct { BPoint *bp; short dist, select, mval[2]; } *data = userData; + struct { BPoint *bp; short dist, select; int mval[2]; } *data = userData; float temp = abs(data->mval[0]-x) + abs(data->mval[1]-y); if((bp->f1 & SELECT)==data->select) @@ -318,12 +318,12 @@ static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, in } } -static BPoint *findnearestLattvert(ViewContext *vc, const short mval[2], int sel) +static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel) { /* sel==1: selected gets a disadvantage */ /* in nurb and bezt or bp the nearest is written */ /* return 0 1 2: handlepunt */ - struct { BPoint *bp; short dist, select, mval[2]; } data = {NULL}; + struct { BPoint *bp; short dist, select; int mval[2]; } data = {NULL}; data.dist = 100; data.select = sel; @@ -336,7 +336,7 @@ static BPoint *findnearestLattvert(ViewContext *vc, const short mval[2], int sel return data.bp; } -int mouse_lattice(bContext *C, const short mval[2], int extend) +int mouse_lattice(bContext *C, const int mval[2], int extend) { ViewContext vc; BPoint *bp= NULL; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index ff1b693d0e1..d5bf894ac8c 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -204,17 +204,28 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob ob->dt = OB_TEXTURE; } else if(md->type == eModifierType_Multires) { + int ok= 1; Mesh *me= ob->data; + ModifierData *tmpmd; - if(me->edit_mesh) { - EditMesh *em= me->edit_mesh; - /* CustomData_external_remove is used here only to mark layer as non-external - for further free-ing, so zero element count looks safer than em->totface */ - CustomData_external_remove(&em->fdata, &me->id, CD_MDISPS, 0); - EM_free_data_layer(em, &em->fdata, CD_MDISPS); - } else { - CustomData_external_remove(&me->fdata, &me->id, CD_MDISPS, me->totface); - CustomData_free_layer_active(&me->fdata, CD_MDISPS, me->totface); + /* ensure MDISPS CustomData layer is't used by another multires modifiers */ + for(tmpmd= ob->modifiers.first; tmpmd; tmpmd= tmpmd->next) + if(tmpmd!=md && tmpmd->type == eModifierType_Multires) { + ok= 0; + break; + } + + if(ok) { + if(me->edit_mesh) { + EditMesh *em= me->edit_mesh; + /* CustomData_external_remove is used here only to mark layer as non-external + for further free-ing, so zero element count looks safer than em->totface */ + CustomData_external_remove(&em->fdata, &me->id, CD_MDISPS, 0); + EM_free_data_layer(em, &em->fdata, CD_MDISPS); + } else { + CustomData_external_remove(&me->fdata, &me->id, CD_MDISPS, me->totface); + CustomData_free_layer_active(&me->fdata, CD_MDISPS, me->totface); + } } } @@ -971,6 +982,7 @@ static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmE void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot) { ot->name= "Delete Higher Levels"; + ot->description= "Deletes the higher resolution mesh, potential loss of detail"; ot->idname= "OBJECT_OT_multires_higher_levels_delete"; ot->poll= multires_poll; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index bce16ceeed2..f7c6ff99bde 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -515,6 +515,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo mul_m4_v3(mat, bezt->vec[2]); bezt->radius *= scale; } + calchandlesNurb(nu); } else { a= nu->pntsu*nu->pntsv; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 1c9f9e60e14..f4f66c17459 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -338,7 +338,7 @@ typedef struct PEData { DerivedMesh *dm; PTCacheEdit *edit; - const short *mval; + const int *mval; rcti *rect; float rad; float dist; @@ -439,9 +439,9 @@ static int key_test_depth(PEData *data, float co[3]) static int key_inside_circle(PEData *data, float rad, float co[3], float *distance) { float dx, dy, dist; - short sco[2]; + int sco[2]; - project_short(data->vc.ar, co, sco); + project_int(data->vc.ar, co, sco); if(sco[0] == IS_CLIPPED) return 0; @@ -465,9 +465,9 @@ static int key_inside_circle(PEData *data, float rad, float co[3], float *distan static int key_inside_rect(PEData *data, float co[3]) { - short sco[2]; + int sco[2]; - project_short(data->vc.ar, co,sco); + project_int(data->vc.ar, co,sco); if(sco[0] == IS_CLIPPED) return 0; @@ -1369,7 +1369,7 @@ void PARTICLE_OT_select_all(wmOperatorType *ot) /************************ pick select operator ************************/ -int PE_mouse_particles(bContext *C, const short mval[2], int extend) +int PE_mouse_particles(bContext *C, const int mval[2], int extend) { PEData data; Scene *scene= CTX_data_scene(C); @@ -1484,7 +1484,7 @@ void PARTICLE_OT_select_tips(wmOperatorType *ot) static int select_linked_exec(bContext *C, wmOperator *op) { PEData data; - short mval[2]; + int mval[2]; int location[2]; RNA_int_get_array(op->ptr, "location", location); @@ -1574,7 +1574,7 @@ int PE_border_select(bContext *C, rcti *rect, int select, int extend) /************************ circle select operator ************************/ -int PE_circle_select(bContext *C, int selecting, const short mval[2], float rad) +int PE_circle_select(bContext *C, int selecting, const int mval[2], float rad) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -1599,7 +1599,7 @@ int PE_circle_select(bContext *C, int selecting, const short mval[2], float rad) /************************ lasso select operator ************************/ -int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, short select) +int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, short select) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -1610,7 +1610,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, s ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); POINT_P; KEY_K; float co[3], mat[4][4]= MAT4_UNITY; - short vertco[2]; + int vertco[2]; PEData data; @@ -1631,7 +1631,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, s LOOP_KEYS { VECCOPY(co, key->co); mul_m4_v3(mat, co); - project_short(ar, co, vertco); + project_int(ar, co, vertco); if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) { if(select && !(key->flag & PEK_SELECT)) { key->flag |= PEK_SELECT; @@ -1649,7 +1649,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short extend, s VECCOPY(co, key->co); mul_m4_v3(mat, co); - project_short(ar, co,vertco); + project_int(ar, co,vertco); if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) { if(select && !(key->flag & PEK_SELECT)) { key->flag |= PEK_SELECT; @@ -2521,80 +2521,6 @@ static void toggle_particle_cursor(bContext *C, int enable) pset->paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), PE_poll_view3d, brush_drawcursor, NULL); } -/********************* radial control operator *********************/ - -static int brush_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - ParticleEditSettings *pset= PE_settings(CTX_data_scene(C)); - ParticleBrushData *brush; - int mode = RNA_enum_get(op->ptr, "mode"); - float original_value=1.0f; - - if(pset->brushtype < 0) - return OPERATOR_CANCELLED; - - brush= &pset->brush[pset->brushtype]; - - toggle_particle_cursor(C, 0); - - if(mode == WM_RADIALCONTROL_SIZE) - original_value = brush->size; - else if(mode == WM_RADIALCONTROL_STRENGTH) - original_value = brush->strength; - - RNA_float_set(op->ptr, "initial_value", original_value); - - return WM_radial_control_invoke(C, op, event); -} - -static int brush_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) -{ - int ret = WM_radial_control_modal(C, op, event); - - if(ret != OPERATOR_RUNNING_MODAL) - toggle_particle_cursor(C, 1); - - return ret; -} - -static int brush_radial_control_exec(bContext *C, wmOperator *op) -{ - ParticleEditSettings *pset= PE_settings(CTX_data_scene(C)); - ParticleBrushData *brush; - int mode = RNA_enum_get(op->ptr, "mode"); - float new_value = RNA_float_get(op->ptr, "new_value"); - - if(pset->brushtype < 0) - return OPERATOR_CANCELLED; - - brush= &pset->brush[pset->brushtype]; - - if(mode == WM_RADIALCONTROL_SIZE) - brush->size= new_value; - else if(mode == WM_RADIALCONTROL_STRENGTH) - brush->strength= new_value; - - WM_event_add_notifier(C, NC_WINDOW, NULL); - - return OPERATOR_FINISHED; -} - -void PARTICLE_OT_brush_radial_control(wmOperatorType *ot) -{ - WM_OT_radial_control_partial(ot); - - ot->name= "Brush Radial Control"; - ot->idname= "PARTICLE_OT_brush_radial_control"; - - ot->invoke= brush_radial_control_invoke; - ot->modal= brush_radial_control_modal; - ot->exec= brush_radial_control_exec; - ot->poll= PE_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; -} - /*************************** delete operator **************************/ enum { DEL_PARTICLE, DEL_KEY }; @@ -2845,7 +2771,7 @@ static void brush_cut(PEData *data, int pa_index) float rad2, cut_time= 1.0; float x0, x1, v0, v1, o0, o1, xo0, xo1, d, dv; int k, cut, keys= (int)pow(2.0, (double)pset->draw_step); - short vertco[2]; + int vertco[2]; /* blunt scissors */ if(BLI_frand() > data->cutfac) return; @@ -2858,7 +2784,7 @@ static void brush_cut(PEData *data, int pa_index) cut=0; - project_short_noclip(ar, key->co, vertco); + project_int_noclip(ar, key->co, vertco); x0= (float)vertco[0]; x1= (float)vertco[1]; @@ -2876,7 +2802,7 @@ static void brush_cut(PEData *data, int pa_index) else { /* calculate path time closest to root that was inside the circle */ for(k=1, key++; k<=keys; k++, key++) { - project_short_noclip(ar, key->co, vertco); + project_int_noclip(ar, key->co, vertco); if(key_test_depth(data, key->co) == 0) { x0= (float)vertco[0]; @@ -3540,7 +3466,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) ParticleBrushData *brush= &pset->brush[pset->brushtype]; ARegion *ar= CTX_wm_region(C); float vec[3], mousef[2]; - short mval[2], mvalo[2]; + int mval[2], mvalo[2]; int flip, mouse[2], dx, dy, removed= 0, added=0, selected= 0; int lock_root = pset->flag & PE_LOCK_FIRST; diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h index d447da3f8c4..71f1128baf0 100644 --- a/source/blender/editors/physics/physics_intern.h +++ b/source/blender/editors/physics/physics_intern.h @@ -60,7 +60,6 @@ void PARTICLE_OT_delete(struct wmOperatorType *ot); void PARTICLE_OT_mirror(struct wmOperatorType *ot); void PARTICLE_OT_brush_edit(struct wmOperatorType *ot); -void PARTICLE_OT_brush_radial_control(struct wmOperatorType *ot); void PARTICLE_OT_particle_edit_toggle(struct wmOperatorType *ot); void PARTICLE_OT_edited_clear(struct wmOperatorType *ot); diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index 02b2fad7a00..56bd8b97532 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -66,7 +66,6 @@ static void operatortypes_particle(void) WM_operatortype_append(PARTICLE_OT_mirror); WM_operatortype_append(PARTICLE_OT_brush_edit); - WM_operatortype_append(PARTICLE_OT_brush_radial_control); WM_operatortype_append(PARTICLE_OT_particle_edit_toggle); WM_operatortype_append(PARTICLE_OT_edited_clear); @@ -91,6 +90,7 @@ static void operatortypes_particle(void) static void keymap_particle(wmKeyConfig *keyconf) { + wmKeyMapItem *kmi; wmKeyMap *keymap; keymap= WM_keymap_find(keyconf, "Particle", 0, 0); @@ -110,10 +110,19 @@ static void keymap_particle(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, 0, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1); + kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0); + RNA_boolean_set(kmi->ptr, "release_confirm", 1); + WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", LEFTMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); - RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE); - RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); + + /* size radial control */ + kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, 0, 0); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.particle_edit.brush.size"); + + /* size radial control */ + kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.particle_edit.brush.strength"); WM_keymap_add_menu(keymap, "VIEW3D_MT_particle_specials", WKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index df6cdb577a2..797ead3cd90 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -156,6 +156,7 @@ void PTCACHE_OT_bake_all(wmOperatorType *ot) { /* identifiers */ ot->name= "Bake All Physics"; + ot->description= "Bake all physics"; ot->idname= "PTCACHE_OT_bake_all"; /* api callbacks */ @@ -171,6 +172,7 @@ void PTCACHE_OT_free_bake_all(wmOperatorType *ot) { /* identifiers */ ot->name= "Free All Physics Bakes"; + ot->name= "Free all physics bakes"; ot->idname= "PTCACHE_OT_free_bake_all"; /* api callbacks */ @@ -268,6 +270,7 @@ void PTCACHE_OT_bake(wmOperatorType *ot) { /* identifiers */ ot->name= "Bake Physics"; + ot->description= "Bake physics"; ot->idname= "PTCACHE_OT_bake"; /* api callbacks */ @@ -283,6 +286,7 @@ void PTCACHE_OT_free_bake(wmOperatorType *ot) { /* identifiers */ ot->name= "Free Physics Bake"; + ot->description= "Free physics bake"; ot->idname= "PTCACHE_OT_free_bake"; /* api callbacks */ @@ -296,6 +300,7 @@ void PTCACHE_OT_bake_from_cache(wmOperatorType *ot) { /* identifiers */ ot->name= "Bake From Cache"; + ot->description= "Bake from cache"; ot->idname= "PTCACHE_OT_bake_from_cache"; /* api callbacks */ @@ -364,7 +369,8 @@ static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op)) void PTCACHE_OT_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add new cache"; + ot->name= "Add New Cache"; + ot->description= "Add new cache"; ot->idname= "PTCACHE_OT_add"; /* api callbacks */ @@ -377,7 +383,8 @@ void PTCACHE_OT_add(wmOperatorType *ot) void PTCACHE_OT_remove(wmOperatorType *ot) { /* identifiers */ - ot->name= "Delete current cache"; + ot->name= "Delete Current Cache"; + ot->description= "Delete current cache"; ot->idname= "PTCACHE_OT_remove"; /* api callbacks */ diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index cb67026ffbd..032737c400e 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -32,7 +32,7 @@ set(INC ../../render/extern/include ../../windowmanager ../../../../intern/guardedalloc - ${GLEW_INCLUDE_PATH} + ${GLEW_INCLUDE_PATH} ../../freestyle ) diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index e2d7147d21f..02fae52219b 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -110,7 +110,7 @@ int ED_operator_screenactive(bContext *C) } /* XXX added this to prevent anim state to change during renders */ -int ED_operator_screenactive_norender(bContext *C) +static int ED_operator_screenactive_norender(bContext *C) { if(G.rendering) return 0; if(CTX_wm_window(C)==NULL) return 0; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 29bcb191b46..db575907b49 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -440,6 +440,8 @@ static void image_undo_restore(bContext *C, ListBase *lb) GPU_free_image(ima); /* force OpenGL reload */ if(ibuf->rect_float) ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */ + if(ibuf->mipmap[0]) + ibuf->userflags |= IB_MIPMAP_INVALID; /* force mipmap recreatiom */ } @@ -5066,56 +5068,6 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings) } } -/* ************ image paint radial control *************/ -static int paint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - float zoom; - ToolSettings *ts = CTX_data_scene(C)->toolsettings; - get_imapaint_zoom(C, &zoom, &zoom); - toggle_paint_cursor(C, 0); - brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), zoom); - return WM_radial_control_invoke(C, op, event); -} - -static int paint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) -{ - int ret = WM_radial_control_modal(C, op, event); - if(ret != OPERATOR_RUNNING_MODAL) - toggle_paint_cursor(C, 1); - return ret; -} - -static int paint_radial_control_exec(bContext *C, wmOperator *op) -{ - Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint); - float zoom; - int ret; - char str[64]; - get_imapaint_zoom(C, &zoom, &zoom); - ret = brush_radial_control_exec(op, brush, 1.0f / zoom); - WM_radial_control_string(op, str, sizeof(str)); - - WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); - - return ret; -} - -void PAINT_OT_image_paint_radial_control(wmOperatorType *ot) -{ - WM_OT_radial_control_partial(ot); - - ot->name= "Image Paint Radial Control"; - ot->idname= "PAINT_OT_image_paint_radial_control"; - - ot->invoke= paint_radial_control_invoke; - ot->modal= paint_radial_control_modal; - ot->exec= paint_radial_control_exec; - ot->poll= image_paint_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; -} - /************************ grab clone operator ************************/ typedef struct GrabClone { @@ -5332,7 +5284,7 @@ static int set_clone_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event) View3D *v3d= CTX_wm_view3d(C); ARegion *ar= CTX_wm_region(C); float location[3]; - short mval[2]; + int mval[2]; mval[0]= event->x - ar->winrct.xmin; mval[1]= event->y - ar->winrct.ymin; @@ -5443,28 +5395,6 @@ void PAINT_OT_texture_paint_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -/************* texture paint radial control *************/ - -static int texture_paint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - ToolSettings *ts = CTX_data_scene(C)->toolsettings; - toggle_paint_cursor(C, !ts->imapaint.paintcursor); - brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), 1); - return WM_radial_control_invoke(C, op, event); -} - -static int texture_paint_radial_control_exec(bContext *C, wmOperator *op) -{ - Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint); - int ret = brush_radial_control_exec(op, brush, 1); - char str[64]; - WM_radial_control_string(op, str, sizeof(str)); - - WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); - - return ret; -} - static int texture_paint_poll(bContext *C) { if(texture_paint_toggle_poll(C)) @@ -5479,23 +5409,6 @@ int image_texture_paint_poll(bContext *C) return (texture_paint_poll(C) || image_paint_poll(C)); } -void PAINT_OT_texture_paint_radial_control(wmOperatorType *ot) -{ - WM_OT_radial_control_partial(ot); - - ot->name= "Texture Paint Radial Control"; - ot->idname= "PAINT_OT_texture_paint_radial_control"; - - ot->invoke= texture_paint_radial_control_invoke; - ot->modal= paint_radial_control_modal; - ot->exec= texture_paint_radial_control_exec; - ot->poll= texture_paint_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; -} - - int facemask_paint_poll(bContext *C) { return paint_facesel_test(CTX_data_active_object(C)); diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 48fca04ac87..ba7235a3161 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -81,12 +81,10 @@ void vpaint_fill(struct Object *ob, unsigned int paintcol); void wpaint_fill(struct VPaint *wp, struct Object *ob, float paintweight); void PAINT_OT_weight_paint_toggle(struct wmOperatorType *ot); -void PAINT_OT_weight_paint_radial_control(struct wmOperatorType *ot); void PAINT_OT_weight_paint(struct wmOperatorType *ot); void PAINT_OT_weight_set(struct wmOperatorType *ot); void PAINT_OT_weight_from_bones(struct wmOperatorType *ot); -void PAINT_OT_vertex_paint_radial_control(struct wmOperatorType *ot); void PAINT_OT_vertex_paint_toggle(struct wmOperatorType *ot); void PAINT_OT_vertex_paint(struct wmOperatorType *ot); @@ -96,12 +94,10 @@ unsigned int vpaint_get_current_col(struct VPaint *vp); int image_texture_paint_poll(struct bContext *C); void PAINT_OT_image_paint(struct wmOperatorType *ot); -void PAINT_OT_image_paint_radial_control(struct wmOperatorType *ot); void PAINT_OT_grab_clone(struct wmOperatorType *ot); void PAINT_OT_sample_color(struct wmOperatorType *ot); void PAINT_OT_clone_cursor_set(struct wmOperatorType *ot); void PAINT_OT_texture_paint_toggle(struct wmOperatorType *ot); -void PAINT_OT_texture_paint_radial_control(struct wmOperatorType *ot); void PAINT_OT_project_image(struct wmOperatorType *ot); void PAINT_OT_image_from_view(struct wmOperatorType *ot); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 9a1de939067..e4a21b1f1a7 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -23,7 +23,10 @@ * \ingroup edsculpt */ +#include "MEM_guardedalloc.h" +#include <stdlib.h> +#include "BLI_string.h" #include "BLI_utildefines.h" #include "DNA_object_types.h" @@ -355,9 +358,7 @@ void ED_operatortypes_paint(void) /* image */ WM_operatortype_append(PAINT_OT_texture_paint_toggle); - WM_operatortype_append(PAINT_OT_texture_paint_radial_control); WM_operatortype_append(PAINT_OT_image_paint); - WM_operatortype_append(PAINT_OT_image_paint_radial_control); WM_operatortype_append(PAINT_OT_sample_color); WM_operatortype_append(PAINT_OT_grab_clone); WM_operatortype_append(PAINT_OT_clone_cursor_set); @@ -366,13 +367,11 @@ void ED_operatortypes_paint(void) /* weight */ WM_operatortype_append(PAINT_OT_weight_paint_toggle); - WM_operatortype_append(PAINT_OT_weight_paint_radial_control); WM_operatortype_append(PAINT_OT_weight_paint); WM_operatortype_append(PAINT_OT_weight_set); WM_operatortype_append(PAINT_OT_weight_from_bones); /* vertex */ - WM_operatortype_append(PAINT_OT_vertex_paint_radial_control); WM_operatortype_append(PAINT_OT_vertex_paint_toggle); WM_operatortype_append(PAINT_OT_vertex_paint); WM_operatortype_append(PAINT_OT_vertex_color_set); @@ -464,6 +463,59 @@ static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path RNA_float_set(kmi->ptr, "scalar", 10.0/9.0); // 1.1111.... } +typedef enum { + RC_COLOR = 1, + RC_ROTATION = 2, + RC_ZOOM = 4, +} RCFlags; + +static void set_brush_rc_path(PointerRNA *ptr, const char *brush_path, + const char *output_name, const char *input_name) +{ + char *path; + + path = BLI_sprintfN("%s.%s", brush_path, input_name); + RNA_string_set(ptr, output_name, path); + MEM_freeN(path); +} + +static void set_brush_rc_props(PointerRNA *ptr, const char *paint, + const char *prop, RCFlags flags) +{ + char *brush_path; + + brush_path = BLI_sprintfN("tool_settings.%s.brush", paint); + + set_brush_rc_path(ptr, brush_path, "data_path", prop); + set_brush_rc_path(ptr, brush_path, "color_path", "cursor_color_add"); + set_brush_rc_path(ptr, brush_path, "rotation_path", "texture_slot.angle"); + RNA_string_set(ptr, "image_id", brush_path); + + if(flags & RC_COLOR) + set_brush_rc_path(ptr, brush_path, "fill_color_path", "color"); + if(flags & RC_ZOOM) + RNA_string_set(ptr, "zoom_path", "space_data.zoom"); + + MEM_freeN(brush_path); +} + +static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *paint, + RCFlags flags) +{ + wmKeyMapItem *kmi; + + kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, 0, 0); + set_brush_rc_props(kmi->ptr, paint, "size", flags); + + kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0); + set_brush_rc_props(kmi->ptr, paint, "strength", flags); + + if(flags & RC_ROTATION) { + kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0); + set_brush_rc_props(kmi->ptr, paint, "texture_slot.angle", flags); + } +} + void ED_keymap_paint(wmKeyConfig *keyconf) { wmKeyMap *keymap; @@ -474,10 +526,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf) keymap= WM_keymap_find(keyconf, "Sculpt", 0, 0); keymap->poll= sculpt_poll; - RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE); - RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); - RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", WM_RADIALCONTROL_ANGLE); - RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL); RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "mode", BRUSH_STROKE_INVERT); RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", BRUSH_STROKE_SMOOTH); @@ -496,6 +544,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) ed_keymap_paint_brush_switch(keymap, "sculpt"); ed_keymap_paint_brush_size(keymap, "tool_settings.sculpt.brush.size"); + ed_keymap_paint_brush_radial_control(keymap, "sculpt", RC_ROTATION); RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", DKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_DRAW); RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", SKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_SMOOTH); @@ -521,8 +570,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf) keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0); keymap->poll= vertex_paint_mode_poll; - RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE); - RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); WM_keymap_verify_item(keymap, "PAINT_OT_vertex_paint", LEFTMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0); @@ -531,6 +578,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) ed_keymap_paint_brush_switch(keymap, "vertex_paint"); ed_keymap_paint_brush_size(keymap, "tool_settings.vertex_paint.brush.size"); + ed_keymap_paint_brush_radial_control(keymap, "vertex_paint", RC_COLOR); kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */ RNA_string_set(kmi->ptr, "data_path", "vertex_paint_object.data.use_paint_mask"); @@ -539,9 +587,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf) keymap= WM_keymap_find(keyconf, "Weight Paint", 0, 0); keymap->poll= weight_paint_mode_poll; - RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE); - RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); - WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, @@ -549,6 +594,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) ed_keymap_paint_brush_switch(keymap, "weight_paint"); ed_keymap_paint_brush_size(keymap, "tool_settings.weight_paint.brush.size"); + ed_keymap_paint_brush_radial_control(keymap, "weight_paint", 0); kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */ RNA_string_set(kmi->ptr, "data_path", "weight_paint_object.data.use_paint_mask"); @@ -559,12 +605,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf) keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0); keymap->poll= image_texture_paint_poll; - RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE); - RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); - - RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE); - RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); - WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PAINT_OT_grab_clone", RIGHTMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0); @@ -572,6 +612,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) ed_keymap_paint_brush_switch(keymap, "image_paint"); ed_keymap_paint_brush_size(keymap, "tool_settings.image_paint.brush.size"); + ed_keymap_paint_brush_radial_control(keymap, "image_paint", RC_COLOR|RC_ZOOM); kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */ RNA_string_set(kmi->ptr, "data_path", "image_paint_object.data.use_paint_mask"); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 19c726616da..f4fc004f413 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -736,10 +736,10 @@ static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], fl Brush *brush = paint_brush(&vp->paint); float fac, fac_2, size, dx, dy; float alpha; - short vertco[2]; + int vertco[2]; const int radius= brush_size(brush); - project_short_noclip(vc->ar, vert_nor, vertco); + project_int_noclip(vc->ar, vert_nor, vertco); dx= mval[0]-vertco[0]; dy= mval[1]-vertco[1]; @@ -868,7 +868,7 @@ static void sample_wpaint(Scene *scene, ARegion *ar, View3D *UNUSED(v3d), int mo Object *ob= OBACT; Mesh *me= get_mesh(ob); int index; - short mval[2] = {0, 0}, sco[2]; + int mval[2] = {0, 0}, sco[2]; int vgroup= ob->actdef-1; if (!me) return; @@ -953,20 +953,20 @@ static void sample_wpaint(Scene *scene, ARegion *ar, View3D *UNUSED(v3d), int mo else { /* calc 3 or 4 corner weights */ dm->getVertCo(dm, mface->v1, co); - project_short_noclip(ar, co, sco); + project_int_noclip(ar, co, sco); w1= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1])); dm->getVertCo(dm, mface->v2, co); - project_short_noclip(ar, co, sco); + project_int_noclip(ar, co, sco); w2= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1])); dm->getVertCo(dm, mface->v3, co); - project_short_noclip(ar, co, sco); + project_int_noclip(ar, co, sco); w3= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1])); if(mface->v4) { dm->getVertCo(dm, mface->v4, co); - project_short_noclip(ar, co, sco); + project_int_noclip(ar, co, sco); w4= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1])); } else w4= 1.0e10; @@ -1147,110 +1147,6 @@ void PAINT_OT_weight_paint_toggle(wmOperatorType *ot) } -/* ************ paint radial controls *************/ - -static int vpaint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - Paint *p = paint_get_active(CTX_data_scene(C)); - Brush *brush = paint_brush(p); - float col[4]; - - WM_paint_cursor_end(CTX_wm_manager(C), p->paint_cursor); - p->paint_cursor = NULL; - brush_radial_control_invoke(op, brush, 1); - - copy_v3_v3(col, brush->add_col); - col[3]= 0.5f; - RNA_float_set_array(op->ptr, "color", col); - - return WM_radial_control_invoke(C, op, event); -} - -static int vpaint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) -{ - int ret = WM_radial_control_modal(C, op, event); - if(ret != OPERATOR_RUNNING_MODAL) - paint_cursor_start(C, vertex_paint_poll); - return ret; -} - -static int vpaint_radial_control_exec(bContext *C, wmOperator *op) -{ - Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->vpaint->paint); - int ret = brush_radial_control_exec(op, brush, 1); - - WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); - - return ret; -} - -static int wpaint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - Paint *p = paint_get_active(CTX_data_scene(C)); - Brush *brush = paint_brush(p); - float col[4]; - - WM_paint_cursor_end(CTX_wm_manager(C), p->paint_cursor); - p->paint_cursor = NULL; - brush_radial_control_invoke(op, brush, 1); - - copy_v3_v3(col, brush->add_col); - col[3]= 0.5f; - RNA_float_set_array(op->ptr, "color", col); - - return WM_radial_control_invoke(C, op, event); -} - -static int wpaint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) -{ - int ret = WM_radial_control_modal(C, op, event); - if(ret != OPERATOR_RUNNING_MODAL) - paint_cursor_start(C, weight_paint_poll); - return ret; -} - -static int wpaint_radial_control_exec(bContext *C, wmOperator *op) -{ - Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->wpaint->paint); - int ret = brush_radial_control_exec(op, brush, 1); - - WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); - - return ret; -} - -void PAINT_OT_weight_paint_radial_control(wmOperatorType *ot) -{ - WM_OT_radial_control_partial(ot); - - ot->name= "Weight Paint Radial Control"; - ot->idname= "PAINT_OT_weight_paint_radial_control"; - - ot->invoke= wpaint_radial_control_invoke; - ot->modal= wpaint_radial_control_modal; - ot->exec= wpaint_radial_control_exec; - ot->poll= weight_paint_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; -} - -void PAINT_OT_vertex_paint_radial_control(wmOperatorType *ot) -{ - WM_OT_radial_control_partial(ot); - - ot->name= "Vertex Paint Radial Control"; - ot->idname= "PAINT_OT_vertex_paint_radial_control"; - - ot->invoke= vpaint_radial_control_invoke; - ot->modal= vpaint_radial_control_modal; - ot->exec= vpaint_radial_control_exec; - ot->poll= vertex_paint_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; -} - /* ************ weight paint operator ********** */ struct WPaintData { diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 7156b49c026..09e46119dbe 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2816,65 +2816,6 @@ static const char *sculpt_tool_name(Sculpt *sd) } } -/**** Radial control ****/ -static int sculpt_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - Paint *p = paint_get_active(CTX_data_scene(C)); - Brush *brush = paint_brush(p); - float col[4], tex_col[4]; - - WM_paint_cursor_end(CTX_wm_manager(C), p->paint_cursor); - p->paint_cursor = NULL; - brush_radial_control_invoke(op, brush, 1); - - if((brush->flag & BRUSH_DIR_IN) && ELEM4(brush->sculpt_tool, SCULPT_TOOL_DRAW, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_PINCH)) - copy_v3_v3(col, brush->sub_col); - else - copy_v3_v3(col, brush->add_col); - col[3]= 0.5f; - - copy_v3_v3(tex_col, U.sculpt_paint_overlay_col); - tex_col[3]= (brush->texture_overlay_alpha / 100.0f); - - RNA_float_set_array(op->ptr, "color", col); - RNA_float_set_array(op->ptr, "texture_color", tex_col); - - return WM_radial_control_invoke(C, op, event); -} - -static int sculpt_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) -{ - int ret = WM_radial_control_modal(C, op, event); - if(ret != OPERATOR_RUNNING_MODAL) - paint_cursor_start(C, sculpt_poll); - return ret; -} - -static int sculpt_radial_control_exec(bContext *C, wmOperator *op) -{ - Brush *brush = paint_brush(&CTX_data_tool_settings(C)->sculpt->paint); - int ret = brush_radial_control_exec(op, brush, 1); - - WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); - - return ret; -} - -static void SCULPT_OT_radial_control(wmOperatorType *ot) -{ - WM_OT_radial_control_partial(ot); - - ot->name= "Sculpt Radial Control"; - ot->idname= "SCULPT_OT_radial_control"; - - ot->invoke= sculpt_radial_control_invoke; - ot->modal= sculpt_radial_control_modal; - ot->exec= sculpt_radial_control_exec; - ot->poll= sculpt_poll; - - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; -} - /**** Operator for applying a stroke (various attributes including mouse path) using the current brush. ****/ @@ -3346,18 +3287,23 @@ static void sculpt_brush_init_tex(Sculpt *sd, SculptSession *ss) sculpt_update_tex(sd, ss); } -static int sculpt_brush_stroke_init(bContext *C, ReportList *UNUSED(reports)) +static int sculpt_brush_stroke_init(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; SculptSession *ss = CTX_data_active_object(C)->sculpt; Brush *brush = paint_brush(&sd->paint); + int mode= RNA_enum_get(op->ptr, "mode"); + int is_smooth= 0; view3d_operator_needs_opengl(C); sculpt_brush_init_tex(sd, ss); - sculpt_update_mesh_elements(scene, sd, ob, brush->sculpt_tool == SCULPT_TOOL_SMOOTH); + is_smooth|= mode == BRUSH_STROKE_SMOOTH; + is_smooth|= brush->sculpt_tool == SCULPT_TOOL_SMOOTH; + + sculpt_update_mesh_elements(scene, sd, ob, is_smooth); return 1; } @@ -3573,7 +3519,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even struct PaintStroke *stroke; int ignore_background_click; - if(!sculpt_brush_stroke_init(C, op->reports)) + if(!sculpt_brush_stroke_init(C, op)) return OPERATOR_CANCELLED; stroke = paint_stroke_new(C, sculpt_stroke_get_location, @@ -3602,7 +3548,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op) { - if(!sculpt_brush_stroke_init(C, op->reports)) + if(!sculpt_brush_stroke_init(C, op)) return OPERATOR_CANCELLED; op->customdata = paint_stroke_new(C, sculpt_stroke_get_location, sculpt_stroke_test_start, @@ -3758,7 +3704,6 @@ static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot) void ED_operatortypes_sculpt(void) { - WM_operatortype_append(SCULPT_OT_radial_control); WM_operatortype_append(SCULPT_OT_brush_stroke); WM_operatortype_append(SCULPT_OT_sculptmode_toggle); WM_operatortype_append(SCULPT_OT_set_persistent_base); diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index bee872dbe60..6637e7004d5 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -858,9 +858,9 @@ static int actkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent /* determine which side of the current frame mouse is on */ UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, NULL); if (x < CFRA) - RNA_int_set(op->ptr, "mode", ACTKEYS_LRSEL_LEFT); + RNA_enum_set(op->ptr, "mode", ACTKEYS_LRSEL_LEFT); else - RNA_int_set(op->ptr, "mode", ACTKEYS_LRSEL_RIGHT); + RNA_enum_set(op->ptr, "mode", ACTKEYS_LRSEL_RIGHT); } /* perform selection */ diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index b097ad0f55e..9b65589ef4c 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -59,6 +59,7 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_library.h" +#include "BKE_icons.h" #include "BKE_main.h" #include "BKE_report.h" #include "BLO_readfile.h" @@ -433,7 +434,7 @@ void folderlist_pushdir(ListBase* folderlist, const char *dir) // check if already exists if(previous_folder && previous_folder->foldername){ - if(! strcmp(previous_folder->foldername, dir)){ + if(BLI_path_cmp(previous_folder->foldername, dir)==0){ return; } } @@ -999,7 +1000,7 @@ static int groupname_to_code(char *group) return BKE_idcode_from_name(buf); } - + void filelist_from_library(struct FileList* filelist) { LinkNode *l, *names, *previews; @@ -1070,9 +1071,9 @@ void filelist_from_library(struct FileList* filelist) PreviewImage *img= l->link; if (img) { - unsigned int w = img->w[PREVIEW_MIPMAP_LARGE]; - unsigned int h = img->h[PREVIEW_MIPMAP_LARGE]; - unsigned int *rect = img->rect[PREVIEW_MIPMAP_LARGE]; + unsigned int w = img->w[ICON_SIZE_PREVIEW]; + unsigned int h = img->h[ICON_SIZE_PREVIEW]; + unsigned int *rect = img->rect[ICON_SIZE_PREVIEW]; /* first allocate imbuf for copying preview into it */ if (w > 0 && h > 0 && rect) { @@ -1086,7 +1087,7 @@ void filelist_from_library(struct FileList* filelist) } BLI_linklist_free(names, free); - if (previews) BLI_linklist_free(previews, (void(*)(void*)) MEM_freeN); + if (previews) BLI_linklist_free(previews, BKE_previewimg_freefunc); filelist_sort(filelist, FILE_SORT_ALPHA); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 6c713d6e469..47b3a71a9ea 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -818,7 +818,7 @@ static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEve ARegion *ar= ac.ar; View2D *v2d= &ar->v2d; - short mval[2]; + int mval[2]; float x; /* get mouse coordinates (in region coordinates) */ diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index b23ab624faa..286f1f3178b 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -38,7 +38,6 @@ set(SRC image_buttons.c image_draw.c image_ops.c - image_render.c space_image.c image_intern.h @@ -60,9 +59,4 @@ if(WITH_IMAGE_CINEON) add_definitions(-DWITH_CINEON) endif() -if(WITH_LCMS) - set(INC ${INC} ${LCMS_INCLUDE_DIR}) - add_definitions(-DWITH_LCMS) -endif() - blender_add_lib(bf_editor_space_image "${SRC}" "${INC}") diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript index e84afcdaab1..27696e35701 100644 --- a/source/blender/editors/space_image/SConscript +++ b/source/blender/editors/space_image/SConscript @@ -9,9 +9,6 @@ incs += ' ../../render/extern/include ../../makesrna ../../blenloader' defs = [] -if env['WITH_BF_LCMS']: - defs.append('WITH_LCMS') - incs += ' ' + env['BF_LCMS_INC'] if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') if env['WITH_BF_OPENJPEG']: diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index c48078118a7..7e881e7e62f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -98,19 +98,6 @@ /* proto */ -static void do_image_panel_events(bContext *C, void *UNUSED(arg), int event) -{ - SpaceImage *sima= CTX_wm_space_image(C); - - switch(event) { - case B_REDR: - break; - } - - /* all events now */ - WM_event_add_notifier(C, NC_IMAGE, sima->image); -} - static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, char *str) { int ofs= 0; @@ -281,7 +268,7 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block) rcti *disprect= &G.scene->r.disprect; int winx= (G.scene->r.size*G.scene->r.xsch)/100; int winy= (G.scene->r.size*G.scene->r.ysch)/100; - short mval[2]; + int mval[2]; if(G.scene->r.mode & R_BORDER) { winx*= (G.scene->r.border.xmax - G.scene->r.border.xmin); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 0f361b43de6..112359726ea 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -58,10 +58,6 @@ #include "BKE_image.h" #include "BKE_paint.h" -#ifdef WITH_LCMS -#include "BKE_colortools.h" -#endif - #include "BIF_gl.h" #include "BIF_glutil.h" @@ -452,20 +448,6 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl // glColorMask(1, 1, 1, 1); } -#ifdef WITH_LCMS -static int sima_draw_colorcorrected_pixels(float x1, float y1, ImBuf *ibuf) -{ - colorcorrection_do_ibuf(ibuf, "MONOSCNR.ICM"); /* path is hardcoded here, find some place better */ - - if(ibuf->crect) { - glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->crect); - return 1; - } - - return 0; -} -#endif - static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti) { /* zbuffer values are signed, so we need to shift color range */ @@ -544,17 +526,6 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image else if(ibuf->channels==1) sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->rect_float); } -#ifdef WITH_LCMS - else if(sima->flag & SI_COLOR_CORRECTION) { - image_verify_buffer_float(ima, ibuf, color_manage); - - if(sima_draw_colorcorrected_pixels(x, y, ibuf)==0) { - unsigned char col1[3]= {100, 0, 100}, col2[3]= {160, 0, 160}; /* pink says 'warning' in blender land */ - sima_draw_alpha_backdrop(x, y, ibuf->x, ibuf->y, zoomx, zoomy, col1, col2); - } - - } -#endif else { if(sima->flag & SI_USE_ALPHA) { unsigned char col1[3]= {100, 100, 100}, col2[3]= {160, 160, 160}; @@ -702,7 +673,7 @@ static void draw_image_view_tool(Scene *scene) { ToolSettings *settings= scene->toolsettings; Brush *brush= settings->imapaint.brush; - short mval[2]; + int mval[2]; float radius; int draw= 0; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 17244a5251c..c4d52e3b836 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -802,6 +802,7 @@ void IMAGE_OT_open(wmOperatorType *ot) { /* identifiers */ ot->name= "Open Image"; + ot->description= "Open image"; ot->idname= "IMAGE_OT_open"; /* api callbacks */ @@ -1345,6 +1346,7 @@ void IMAGE_OT_new(wmOperatorType *ot) /* identifiers */ ot->name= "New Image"; + ot->description= "Create a new image"; ot->idname= "IMAGE_OT_new"; /* api callbacks */ diff --git a/source/blender/editors/space_image/image_render.c b/source/blender/editors/space_image/image_render.c deleted file mode 100644 index 04b65af618e..00000000000 --- a/source/blender/editors/space_image/image_render.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * Contributor(s): Blender Foundation, 2002-2009 - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/editors/space_image/image_render.c - * \ingroup spimage - */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "BLI_utildefines.h" - -#include "DNA_screen_types.h" -#include "DNA_space_types.h" - -#include "BKE_context.h" -#include "BKE_image.h" - -#include "BIF_gl.h" -#include "BIF_glutil.h" - - -#include "RE_pipeline.h" - - -#define HEADER_HEIGHT 18 - -/* *********************** render callbacks ***************** */ - -/* set on initialize render, only one render output to imagewindow can exist, so the global isnt dangerous yet :) */ -static ScrArea *image_area= NULL; - -/* can get as well the full picture, as the parts while rendering */ -/* XXX will be obsolete, here for reference now */ -static void imagewindow_progress(SpaceImage *sima, RenderResult *rr, volatile rcti *renrect) -{ - float x1, y1, *rectf= NULL; - unsigned int *rect32= NULL; - int ymin, ymax, xmin, xmax; - - /* if renrect argument, we only display scanlines */ - if(renrect) { - /* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */ - if(rr->renlay==NULL || renrect->ymax>=rr->recty) - return; - - /* xmin here is first subrect x coord, xmax defines subrect width */ - xmin = renrect->xmin; - xmax = renrect->xmax - xmin; - if (xmax<2) return; - - ymin= renrect->ymin; - ymax= renrect->ymax - ymin; - if(ymax<2) - return; - renrect->ymin= renrect->ymax; - } - else { - xmin = ymin = 0; - xmax = rr->rectx - 2*rr->crop; - ymax = rr->recty - 2*rr->crop; - } - - /* image window cruft */ - - /* find current float rect for display, first case is after composit... still weak */ - if(rr->rectf) - rectf= rr->rectf; - else { - if(rr->rect32) - rect32= (unsigned int *)rr->rect32; - else { - if(rr->renlay==NULL || rr->renlay->rectf==NULL) return; - rectf= rr->renlay->rectf; - } - } - if(rectf) { - /* if scanline updates... */ - rectf+= 4*(rr->rectx*ymin + xmin); - - /* when rendering more pixels than needed, we crop away cruft */ - if(rr->crop) - rectf+= 4*(rr->crop*rr->rectx + rr->crop); - } - - /* tilerect defines drawing offset from (0,0) */ - /* however, tilerect (xmin, ymin) is first pixel */ - x1 = sima->centx + (rr->tilerect.xmin + rr->crop + xmin)*sima->zoom; - y1 = sima->centy + (rr->tilerect.ymin + rr->crop + ymin)*sima->zoom; - - /* needed for gla draw */ - // XXX { rcti rct= ar->winrct; rct.ymax-= HEADER_HEIGHT; glaDefine2DArea(&rct);} - - glPixelZoom(sima->zoom, sima->zoom); - - if(rect32) - glaDrawPixelsSafe(x1, y1, xmax, ymax, rr->rectx, GL_RGBA, GL_UNSIGNED_BYTE, rect32); - else - glaDrawPixelsSafe_to32(x1, y1, xmax, ymax, rr->rectx, rectf, 0); - - glPixelZoom(1.0, 1.0); - -} - - -/* coming from BIF_toggle_render_display() */ -static void imagewindow_toggle_render(bContext *C) -{ - bScreen *sc= CTX_wm_screen(C); - ScrArea *sa; - - /* check if any imagewindow is showing temporal render output */ - for(sa=sc->areabase.first; sa; sa= sa->next) { - if(sa->spacetype==SPACE_IMAGE) { - SpaceImage *sima= sa->spacedata.first; - - if(sima->image && sima->image->type==IMA_TYPE_R_RESULT) - if(sima->flag & (SI_PREVSPACE|SI_FULLWINDOW)) - break; - } - } - - if(sa) { - // XXX addqueue(sa->win, ESCKEY, 1); /* also returns from fullscreen */ - } - else { -// sa= imagewindow_set_render_display(C); - // XXX scrarea_queue_headredraw(sa); - // XXX scrarea_queue_winredraw(sa); - } -} - -/* NOTE: called while render, so no malloc allowed! */ -static void imagewindow_renderinfo_cb(void *UNUSED(handle), RenderStats *UNUSED(rs)) -{ - if(image_area) { - // XXX BIF_make_render_text(rs); - - // XXX sima_draw_render_info(sima, ar); - - /* no screen_swapbuffers, prevent any other window to draw */ - // XXX myswapbuffers(); - } -} - -static void ED_space_image_render_callbacks(bContext *C, Render *re) -{ - -// RE_display_init_cb(re, C, imagewindow_init_display_cb); -// RE_display_draw_cb(re, C, imagewindow_progress_display_cb); -// RE_display_clear_cb(re, C, imagewindow_clear_display_cb); - RE_stats_draw_cb(re, C, imagewindow_renderinfo_cb); -} - diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 67f02ce4f8e..937b683e880 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -230,7 +230,7 @@ static int borderselect_exec(bContext *C, wmOperator *op) rcti rect; //rctf rectf, rq; short selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); - //short mval[2]; + //int mval[2]; rect.xmin= RNA_int_get(op->ptr, "xmin"); rect.ymin= RNA_int_get(op->ptr, "ymin"); diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index d75c1aa7dd3..188042ad1d1 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -612,7 +612,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even bAnimContext ac; Scene *scene; ARegion *ar; - View2D *v2d; + // View2D *v2d; /*UNUSED*/ short selectmode; int mval[2]; @@ -623,7 +623,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even /* get useful pointers from animation context data */ scene= ac.scene; ar= ac.ar; - v2d= &ar->v2d; + // v2d= &ar->v2d; /* get mouse coordinates (in region coordinates) */ mval[0]= (event->x - ar->winrct.xmin); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 01f32b49888..19a9bfb224b 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1010,7 +1010,7 @@ static bNode *visible_node(SpaceNode *snode, rctf *rct) /* **************************** */ typedef struct NodeViewMove { - short mvalo[2]; + int mvalo[2]; int xmin, ymin, xmax, ymax; } NodeViewMove; @@ -1615,7 +1615,7 @@ static int node_mouse_groupheader(SpaceNode *snode) { bNode *gnode; float mx=0, my=0; -// XXX short mval[2]; +// XXX int mval[2]; gnode= node_tree_get_editgroup(snode->nodetree); if(gnode==NULL) return 0; diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 78368d91378..6bda47e5c8f 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -70,7 +70,7 @@ static bNode *node_under_mouse(bNodeTree *ntree, int mx, int my) /* ****** Click Select ****** */ -static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const short mval[2], short extend) +static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, const int mval[2], short extend) { bNode *node; float mx, my; @@ -102,7 +102,7 @@ static int node_select_exec(bContext *C, wmOperator *op) { SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); - short mval[2]; + int mval[2]; short extend; bNode *node= NULL; @@ -125,7 +125,7 @@ static int node_select_exec(bContext *C, wmOperator *op) static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event) { ARegion *ar= CTX_wm_region(C); - short mval[2]; + int mval[2]; mval[0]= event->x - ar->winrct.xmin; mval[1]= event->y - ar->winrct.ymin; @@ -199,7 +199,7 @@ static int node_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event /* this allows border select on empty space, but drag-translate on nodes */ SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); - short mval[2]; + int mval[2]; float mx, my; mval[0]= event->x - ar->winrct.xmin; diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c index 1ae36b077af..9665a152970 100644 --- a/source/blender/editors/space_node/node_state.c +++ b/source/blender/editors/space_node/node_state.c @@ -158,7 +158,7 @@ static int do_header_hidden_node(bNode *node, float mx, float my) return 0; } -static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, const short mval[2]) +static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, const int mval[2]) { bNode *node; float mx, my; @@ -189,7 +189,7 @@ static int node_toggle_visibility_exec(bContext *C, wmOperator *op) { SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); - short mval[2]; + int mval[2]; mval[0] = RNA_int_get(op->ptr, "mouse_x"); mval[1] = RNA_int_get(op->ptr, "mouse_y"); @@ -202,7 +202,7 @@ static int node_toggle_visibility_exec(bContext *C, wmOperator *op) static int node_toggle_visibility_invoke(bContext *C, wmOperator *op, wmEvent *event) { ARegion *ar= CTX_wm_region(C); - short mval[2]; + int mval[2]; mval[0]= event->x - ar->winrct.xmin; mval[1]= event->y - ar->winrct.ymin; diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 2ef8fb12965..ad0d0048388 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -120,7 +120,7 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w ARegion *ar= CTX_wm_region(C); View2D *v2d= UI_view2d_fromcontext(C); - short mval[2]; + int mval[2]; float mval_v2d[2]; @@ -633,12 +633,13 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load.", path); return OPERATOR_CANCELLED; } - } - else if (seq->type==SEQ_COLOR) { + } else if (seq->type == SEQ_COLOR) { SolidColorVars *colvars= (SolidColorVars *)seq->effectdata; RNA_float_get_array(op->ptr, "color", colvars->col); seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */ + } else if (seq->type == SEQ_ADJUSTMENT) { + seq->blend_mode= SEQ_CROSS; } // XXX, this conflicts with giving a channel with invoke, perhaps we should have an active channel diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 2f95e8fa64c..f351d52db07 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -126,6 +126,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ case SEQ_OVERDROP: case SEQ_GLOW: case SEQ_MULTICAM: + case SEQ_ADJUSTMENT: UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col); /* slightly offset hue to distinguish different effects */ @@ -137,6 +138,8 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ if (seq->type == SEQ_OVERDROP) rgb_byte_set_hue_float_offset(col,0.24); if (seq->type == SEQ_GLOW) rgb_byte_set_hue_float_offset(col,0.28); if (seq->type == SEQ_TRANSFORM) rgb_byte_set_hue_float_offset(col,0.36); + if (seq->type == SEQ_MULTICAM) rgb_byte_set_hue_float_offset(col,0.32); + if (seq->type == SEQ_ADJUSTMENT) rgb_byte_set_hue_float_offset(col,0.40); break; case SEQ_COLOR: @@ -476,7 +479,7 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float if(name[0]=='\0') name= give_seqname(seq); - if(seq->type == SEQ_META) { + if(seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) { sprintf(str, "%d | %s", seq->len, name); } else if(seq->type == SEQ_SCENE) { diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 92fae3d4820..880f285c3e3 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -100,6 +100,7 @@ EnumPropertyItem sequencer_prop_effect_types[] = { {SEQ_COLOR, "COLOR", 0, "Color", "Color effect strip type"}, {SEQ_SPEED, "SPEED", 0, "Speed", "Color effect strip type"}, {SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, + {SEQ_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, {0, NULL, 0, NULL, NULL} }; @@ -191,7 +192,7 @@ void boundbox_seq(Scene *scene, rctf *rect) static int mouse_frame_side(View2D *v2d, short mouse_x, int frame ) { - short mval[2]; + int mval[2]; float mouseloc[2]; mval[0]= mouse_x; @@ -284,7 +285,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i } -Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const short mval[2]) +Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[2]) { Sequence *seq; Editing *ed= seq_give_editing(scene, FALSE); @@ -406,6 +407,7 @@ int event_to_efftype(int event) if(event==15) return SEQ_TRANSFORM; if(event==16) return SEQ_COLOR; if(event==17) return SEQ_SPEED; + if(event==18) return SEQ_ADJUSTMENT; return 0; } @@ -517,7 +519,8 @@ static void change_sequence(Scene *scene) "|Glow%x14" "|Transform%x15" "|Color Generator%x16" - "|Speed Control%x17"); + "|Speed Control%x17" + "|Adjustment Layer%x18"); if(event > 0) { if(event==1) { SWAP(Sequence *,last_seq->seq1,last_seq->seq2); @@ -703,15 +706,9 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de while(seq) { seqn= seq->next; if((seq->flag & flag) || deleteall) { - if(seq->type==SEQ_SOUND && seq->sound) { - ((ID *)seq->sound)->us--; /* TODO, could be moved into seq_free_sequence() */ - } - BLI_remlink(lb, seq); if(seq==last_seq) seq_active_set(scene, NULL); if(seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1); - /* if(seq->ipo) seq->ipo->id.us--; */ - /* XXX, remove fcurve */ seq_free_sequence(scene, seq); } seq= seqn; @@ -1084,7 +1081,7 @@ static int seq_get_snaplimit(View2D *v2d) /* fake mouse coords to get the snap value a bit lazy but its only done once pre transform */ float xmouse, ymouse, x; - short mval[2] = {24, 0}; /* 24 screen px snap */ + int mval[2] = {24, 0}; /* 24 screen px snap */ UI_view2d_region_to_view(v2d, mval[0], mval[1], &xmouse, &ymouse); x = xmouse; @@ -1706,11 +1703,6 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) if (nothingSelected) return OPERATOR_FINISHED; - /* free imbufs of all dependent strips */ - for(seq=ed->seqbasep->first; seq; seq=seq->next) - if(seq->flag & SELECT) - update_changed_seq_and_deps(scene, seq, 1, 0); - /* for effects, try to find a replacement input */ for(seq=ed->seqbasep->first; seq; seq=seq->next) if((seq->type & SEQ_EFFECT) && !(seq->flag & SELECT)) diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 9a4796ced5e..209b39662aa 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -61,7 +61,7 @@ void seq_reset_imageofs(struct SpaceSeq *sseq); struct View2D; void seq_rectf(struct Sequence *seq, struct rctf *rectf); void boundbox_seq(struct Scene *scene, struct rctf *rect); -struct Sequence *find_nearest_seq(struct Scene *scene, struct View2D *v2d, int *hand, const short mval[2]); +struct Sequence *find_nearest_seq(struct Scene *scene, struct View2D *v2d, int *hand, const int mval[2]); struct Sequence *find_neighboring_sequence(struct Scene *scene, struct Sequence *test, int lr, int sel); void deselect_all_seq(struct Scene *scene); void recurs_sel_seq(struct Sequence *seqm); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index b2d6ab6f8ca..2cae2d17a33 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -307,7 +307,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) short left_right= RNA_boolean_get(op->ptr, "left_right"); short linked_time= RNA_boolean_get(op->ptr, "linked_time"); - short mval[2]; + int mval[2]; Sequence *seq,*neighbor, *act_orig; int hand,sel_side; @@ -489,7 +489,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) /* marker transform */ #if 0 // XXX probably need to redo this differently for 2.5 if (marker) { - short mval[2], xo, yo; + int mval[2], xo, yo; // getmouseco_areawin(mval); xo= mval[0]; yo= mval[1]; @@ -656,7 +656,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv View2D *v2d= UI_view2d_fromcontext(C); short extend= RNA_boolean_get(op->ptr, "extend"); - short mval[2]; + int mval[2]; Sequence *mouse_seq; int selected, hand; @@ -837,7 +837,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op) rcti rect; rctf rectf, rq; short selecting = (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT); - short mval[2]; + int mval[2]; if(ed==NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index e87719084ce..635e922cd65 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2109,7 +2109,7 @@ static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event) SpaceText *st= CTX_wm_space_text(C); ARegion *ar= CTX_wm_region(C); TextScroll *tsc= op->customdata; - short mval[2]= {event->x, event->y}; + int mval[2]= {event->x, event->y}; short txtdelta[2] = {0, 0}; text_update_character_width(st); @@ -2283,7 +2283,7 @@ static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event) SpaceText *st= CTX_wm_space_text(C); ARegion *ar= CTX_wm_region(C); TextScroll *tsc; - const short *mval= event->mval; + const int *mval= event->mval; int zone= -1; if(RNA_property_is_set(op->ptr, "lines")) @@ -2694,7 +2694,7 @@ static int line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *even SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); ARegion *ar= CTX_wm_region(C); - const short *mval= event->mval; + const int *mval= event->mval; double time; static int jump_to= 0; static double last_jump= 0; diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index bd8710ec120..6e6f131655b 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -54,7 +54,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar) TextLine *tmp; int l, x, y, w, h, i; int tgti, *top; - short mval[2] = {0, 0}; + int mval[2] = {0, 0}; if(!st || !st->text) return 0; if(!texttool_text_is_active(st->text)) return 0; diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index d062ca8e25f..f070bae4e54 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -366,7 +366,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O } else { /* draw with lights in the scene otherwise */ - Gtexdraw.islit= GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, get_view3d_ortho(v3d, rv3d)); + Gtexdraw.islit= GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp); } obcol[0]= CLAMPIS(ob->col[0]*255, 0, 255); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index a3a139181d5..e88ee7dd69a 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -46,6 +46,7 @@ #include "DNA_scene_types.h" #include "DNA_smoke_types.h" #include "DNA_world_types.h" +#include "DNA_armature_types.h" #include "BLI_blenlib.h" #include "BLI_math.h" @@ -76,6 +77,9 @@ #include "smoke_API.h" +#include "IMB_imbuf.h" +#include "IMB_imbuf_types.h" + #include "BIF_gl.h" #include "BIF_glutil.h" @@ -515,6 +519,96 @@ void drawaxes(float size, char drawtype) } } + +/* Function to draw an Image on a empty Object */ +static void draw_empty_image(Object *ob) +{ + Image *ima = (Image*)ob->data; + ImBuf *ibuf = ima ? BKE_image_get_ibuf(ima, NULL) : NULL; + + float scale, ofs_x, ofs_y, sca_x, sca_y; + int ima_x, ima_y; + + if(ibuf && (ibuf->rect == NULL) && (ibuf->rect_float != NULL)) { + IMB_rect_from_float(ibuf); + } + + /* Get the buffer dimensions so we can fallback to fake ones */ + if(ibuf && ibuf->rect) { + ima_x= ibuf->x; + ima_y= ibuf->y; + } + else { + ima_x= 1; + ima_y= 1; + } + + /* Get the image aspect even if the buffer is invalid */ + if(ima) { + if(ima->aspx > ima->aspy) { + sca_x= 1.0f; + sca_y= ima->aspy / ima->aspx; + } + else if(ima->aspx < ima->aspy) { + sca_x= ima->aspx / ima->aspy; + sca_y= 1.0f; + } + else { + sca_x= 1.0f; + sca_y= 1.0f; + } + } + else { + sca_x= 1.0f; + sca_y= 1.0f; + } + + /* Calculate the scale center based on objects origin */ + ofs_x= ob->ima_ofs[0] * ima_x; + ofs_y= ob->ima_ofs[1] * ima_y; + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + + /* Make sure we are drawing at the origin */ + glTranslatef(0.0f, 0.0f, 0.0f); + + /* Calculate Image scale */ + scale= (ob->empty_drawsize / (float)MAX2(ima_x * sca_x, ima_y * sca_y)); + + /* Set the object scale */ + glScalef(scale * sca_x, scale * sca_y, 1.0f); + + if(ibuf && ibuf->rect) { + /* Setup GL params */ + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + /* Use the object color and alpha */ + glColor4fv(ob->col); + + /* Draw the Image on the screen */ + glaDrawPixelsTex(ofs_x, ofs_y, ima_x, ima_y, GL_UNSIGNED_BYTE, ibuf->rect); + glPixelTransferf(GL_ALPHA_SCALE, 1.0f); + + glDisable(GL_BLEND); + } + + UI_ThemeColor((ob->flag & SELECT) ? TH_SELECT : TH_WIRE); + + /* Calculate the outline vertex positions */ + glBegin(GL_LINE_LOOP); + glVertex2f(ofs_x, ofs_y); + glVertex2f(ofs_x + ima_x, ofs_y); + glVertex2f(ofs_x + ima_x, ofs_y + ima_y); + glVertex2f(ofs_x, ofs_y + ima_y); + glEnd(); + + /* Reset GL settings */ + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); +} + void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]) { float vec[3], vx[3], vy[3]; @@ -572,7 +666,7 @@ typedef struct ViewCachedString { unsigned char ub[4]; int pack; } col; - short mval[2]; + short sco[2]; short xoffs; short flag; int str_len, pad; @@ -614,8 +708,8 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa for(vos= strings->first; vos; vos= vos->next) { if(mat && !(vos->flag & V3D_CACHE_TEXT_WORLDSPACE)) mul_m4_v3(mat, vos->vec); - view3d_project_short_clip(ar, vos->vec, vos->mval, 0); - if(vos->mval[0]!=IS_CLIPPED) + view3d_project_short_clip(ar, vos->vec, vos->sco, 0); + if(vos->sco[0]!=IS_CLIPPED) tot++; } @@ -655,7 +749,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa continue; } #endif - if(vos->mval[0]!=IS_CLIPPED) { + if(vos->sco[0]!=IS_CLIPPED) { const char *str= (char *)(vos+1); if(col_pack_prev != vos->col.pack) { @@ -663,10 +757,10 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa col_pack_prev= vos->col.pack; } if(vos->flag & V3D_CACHE_TEXT_ASCII) { - BLF_draw_default_ascii((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len); + BLF_draw_default_ascii((float)vos->sco[0]+vos->xoffs, (float)vos->sco[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len); } else { - BLF_draw_default((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len); + BLF_draw_default((float)vos->sco[0]+vos->xoffs, (float)vos->sco[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len); } } } @@ -5954,8 +6048,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) break; } case OB_EMPTY: - if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) - drawaxes(ob->empty_drawsize, ob->empty_drawtype); + if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { + if (ob->empty_drawtype == OB_EMPTY_IMAGE) { + draw_empty_image(ob); + } + else { + drawaxes(ob->empty_drawsize, ob->empty_drawtype); + } + } break; case OB_LAMP: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { @@ -6564,7 +6664,12 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline); break; case OB_EMPTY: - drawaxes(ob->empty_drawsize, ob->empty_drawtype); + if (ob->empty_drawtype == OB_EMPTY_IMAGE) { + draw_empty_image(ob); + } + else { + drawaxes(ob->empty_drawsize, ob->empty_drawtype); + } break; } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index e967e8ed2e7..4ef02243cd5 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -564,13 +564,13 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) { - short mx,my,co[2]; + int mx, my, co[2]; int flag; /* we dont want the clipping for cursor */ flag= v3d->flag; v3d->flag= 0; - project_short(ar, give_cursor(scene, v3d), co); + project_int(ar, give_cursor(scene, v3d), co); v3d->flag= flag; mx = co[0]; @@ -763,7 +763,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d) /* draw info beside axes in bottom left-corner: * framenum, object name, bone name (if available), marker name (if available) */ -static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d) +static void draw_selected_name(Scene *scene, Object *ob) { char info[256], *markern; short offset=30; @@ -832,7 +832,7 @@ static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d) } /* color depends on whether there is a keyframe */ - if (id_frame_has_keyframe((ID *)ob, /*BKE_curframe(scene)*/(float)(CFRA), v3d->keyflags)) + if (id_frame_has_keyframe((ID *)ob, /*BKE_curframe(scene)*/(float)(CFRA), ANIMFILTER_KEYS_LOCAL)) UI_ThemeColor(TH_VERTEX_SELECT); else UI_ThemeColor(TH_TEXT_HI); @@ -921,6 +921,77 @@ void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, Vi } } +static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float fac) +{ + float x3, y3, x4, y4; + + x3= x1 + fac * (x2-x1); + y3= y1 + fac * (y2-y1); + x4= x1 + (1.0f - fac) * (x2-x1); + y4= y1 + (1.0f - fac) * (y2-y1); + + glBegin(GL_LINES); + glVertex2f(x1, y3); + glVertex2f(x2, y3); + + glVertex2f(x1, y4); + glVertex2f(x2, y4); + + glVertex2f(x3, y1); + glVertex2f(x3, y2); + + glVertex2f(x4, y1); + glVertex2f(x4, y2); + glEnd(); +} + +/* harmonious triangle */ +static void drawviewborder_triangle(float x1, float x2, float y1, float y2, const char golden, const char dir) +{ + float ofs; + float w= x2 - x1; + float h= y2 - y1; + + glBegin(GL_LINES); + if(w > h) { + if(golden) { + ofs = w * (1.0f-(1.0f/1.61803399)); + } + else { + ofs = h * (h / w); + } + if(dir == 'B') SWAP(float, y1, y2); + + glVertex2f(x1, y1); + glVertex2f(x2, y2); + + glVertex2f(x2, y1); + glVertex2f(x1 + (w - ofs), y2); + + glVertex2f(x1, y2); + glVertex2f(x1 + ofs, y1); + } + else { + if(golden) { + ofs = h * (1.0f-(1.0f/1.61803399)); + } + else { + ofs = w * (w / h); + } + if(dir == 'B') SWAP(float, x1, x2); + + glVertex2f(x1, y1); + glVertex2f(x2, y2); + + glVertex2f(x2, y1); + glVertex2f(x1, y1 + ofs); + + glVertex2f(x1, y2); + glVertex2f(x2, y1 + (h - ofs)); + } + glEnd(); +} + static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) { float fac, a; @@ -944,10 +1015,14 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) y2= viewborder.ymax; /* apply offsets so the real 3D camera shows through */ - x1i= (int)(x1 - 1.0f); - y1i= (int)(y1 - 1.0f); - x2i= (int)(x2 + 1.0f); - y2i= (int)(y2 + 1.0f); + + /* note: quite un-scientific but without this bit extra + * 0.0001 on the lower left the 2D border sometimes + * obscures the 3D camera border */ + x1i= (int)(x1 - 1.0001f); + y1i= (int)(y1 - 1.0001f); + x2i= (int)(x2 + (1.0f-0.0001f)); + y2i= (int)(y2 + (1.0f-0.0001f)); /* passepartout, specified in camera edit buttons */ if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) { @@ -995,21 +1070,80 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) } /* safety border */ - if (ca && (ca->flag & CAM_SHOWTITLESAFE)) { - fac= 0.1; - - a= fac*(x2-x1); - x1+= a; - x2-= a; - - a= fac*(y2-y1); - y1+= a; - y2-= a; - - UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); - - uiSetRoundBox(15); - uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); + if(ca) { + if (ca->dtx & CAM_DTX_CENTER) { + UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + + x3= x1+ 0.5f*(x2-x1); + y3= y1+ 0.5f*(y2-y1); + + glBegin(GL_LINES); + glVertex2f(x1, y3); + glVertex2f(x2, y3); + + glVertex2f(x3, y1); + glVertex2f(x3, y2); + glEnd(); + } + + if (ca->dtx & CAM_DTX_CENTER_DIAG) { + UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + + glBegin(GL_LINES); + glVertex2f(x1, y1); + glVertex2f(x2, y2); + + glVertex2f(x1, y2); + glVertex2f(x2, y1); + glEnd(); + } + + if (ca->dtx & CAM_DTX_THIRDS) { + UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + drawviewborder_grid3(x1, x2, y1, y2, 1.0f/3.0f); + } + + if (ca->dtx & CAM_DTX_GOLDEN) { + UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399)); + } + + if (ca->dtx & CAM_DTX_GOLDEN_TRI_A) { + UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + drawviewborder_triangle(x1, x2, y1, y2, 0, 'A'); + } + + if (ca->dtx & CAM_DTX_GOLDEN_TRI_B) { + UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + drawviewborder_triangle(x1, x2, y1, y2, 0, 'B'); + } + + if (ca->dtx & CAM_DTX_HARMONY_TRI_A) { + UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + drawviewborder_triangle(x1, x2, y1, y2, 1, 'A'); + } + + if (ca->dtx & CAM_DTX_HARMONY_TRI_B) { + UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + drawviewborder_triangle(x1, x2, y1, y2, 1, 'B'); + } + + if (ca->flag & CAM_SHOWTITLESAFE) { + fac= 0.1; + + a= fac*(x2-x1); + x1+= a; + x2-= a; + + a= fac*(y2-y1); + y1+= a; + y2-= a; + + UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); + + uiSetRoundBox(15); + uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); + } } setlinestyle(0); @@ -1172,7 +1306,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax, } /* smart function to sample a rect spiralling outside, nice for backbuf selection */ -unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const short mval[2], int size, +unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int size, unsigned int min, unsigned int max, int *dist, short strict, void *handle, unsigned int (*indextest)(void *handle, unsigned int index)) { @@ -2362,7 +2496,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) // needs to be done always, gridview is adjusted in drawgrid() now rv3d->gridview= v3d->grid; - if(rv3d->view==0 || rv3d->persp != RV3D_ORTHO) { + if((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) { if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { drawfloor(scene, v3d, &grid_unit); } @@ -2534,7 +2668,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) ob= OBACT; if(U.uiflag & USER_DRAWVIEWINFO) - draw_selected_name(scene, ob, v3d); + draw_selected_name(scene, ob); /* XXX here was the blockhandlers for floating panels */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 30bfc355480..2bd2e4e497f 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -40,6 +40,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_camera_types.h" +#include "DNA_lamp_types.h" #include "MEM_guardedalloc.h" @@ -55,6 +56,7 @@ #include "BKE_paint.h" #include "BKE_report.h" #include "BKE_scene.h" +#include "BKE_depsgraph.h" /* for ED_view3d_camera_lock_sync */ #include "BIF_gl.h" @@ -79,6 +81,23 @@ /* ********************** view3d_edit: view manipulations ********************* */ +void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d) +{ + if(v3d->camera && (v3d->flag2 & V3D_LOCK_CAMERA) && (rv3d->persp==RV3D_CAMOB)) { + ED_view3d_from_object(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL); + } +} + +void ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) +{ + if(v3d->camera && (v3d->flag2 & V3D_LOCK_CAMERA) && (rv3d->persp==RV3D_CAMOB)) { + ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist); + DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); + WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d->camera); + } +} + + /* ********************* box view support ***************** */ static void view3d_boxview_clip(ScrArea *sa) @@ -277,6 +296,7 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip) typedef struct ViewOpsData { ScrArea *sa; ARegion *ar; + View3D *v3d; RegionView3D *rv3d; /* needed for continuous zoom */ @@ -331,7 +351,6 @@ static void calctrackballvec(rcti *rect, int mx, int my, float *vec) static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) { static float lastofs[3] = {0,0,0}; - View3D *v3d; RegionView3D *rv3d; ViewOpsData *vod= MEM_callocN(sizeof(ViewOpsData), "viewops data"); @@ -339,8 +358,13 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) op->customdata= vod; vod->sa= CTX_wm_area(C); vod->ar= CTX_wm_region(C); - v3d= vod->sa->spacedata.first; + vod->v3d= vod->sa->spacedata.first; vod->rv3d= rv3d= vod->ar->regiondata; + + /* set the view from the camera, if view locking is enabled. + * we may want to make this optional but for now its needed always */ + ED_view3d_camera_lock_init(vod->v3d, vod->rv3d); + vod->dist0= rv3d->dist; copy_qt_qt(vod->oldquat, rv3d->viewquat); vod->origx= vod->oldx= event->x; @@ -358,8 +382,8 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) view3d_operator_needs_opengl(C); /* needed for zbuf drawing */ - if((vod->use_dyn_ofs=view_autodist(CTX_data_scene(C), vod->ar, v3d, event->mval, vod->dyn_ofs))) { - if (rv3d->persp==RV3D_PERSP) { + if((vod->use_dyn_ofs=view_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) { + if (rv3d->is_persp) { float my_origin[3]; /* original G.vd->ofs */ float my_pivot[3]; /* view */ float dvec[3]; @@ -390,17 +414,15 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) } negate_v3(vod->dyn_ofs); copy_v3_v3(vod->ofs, rv3d->ofs); - } else { - vod->ofs[0] = vod->ofs[1] = vod->ofs[2] = 0.0f; } } /* for dolly */ - window_to_3d_vector(vod->ar, vod->mousevec, (vod->oldx - vod->ar->winrct.xmin)-(vod->ar->winx)/2, (vod->oldy - vod->ar->winrct.ymin)-(vod->ar->winy)/2); + window_to_3d_vector(vod->ar, vod->mousevec, vod->oldx - vod->ar->winrct.xmin, vod->oldy - vod->ar->winrct.ymin); /* lookup, we dont pass on v3d to prevent confusement */ - vod->grid= v3d->grid; - vod->far= v3d->far; + vod->grid= vod->v3d->grid; + vod->far= vod->v3d->far; calctrackballvec(&vod->ar->winrct, event->x, event->y, vod->trackvec); @@ -546,7 +568,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) { RegionView3D *rv3d= vod->rv3d; - rv3d->view= 0; /* need to reset everytime because of view snapping */ + rv3d->view= RV3D_VIEW_USER; /* need to reset everytime because of view snapping */ if (U.flag & USER_TRACKBALL) { float phi, si, q1[4], dvec[3], newvec[3]; @@ -711,6 +733,8 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) /* avoid precision loss over time */ normalize_qt(rv3d->viewquat); + ED_view3d_camera_lock_sync(vod->v3d, rv3d); + ED_region_tag_redraw(vod->ar); } @@ -782,18 +806,18 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) if(rv3d->persp != RV3D_PERSP) { if (U.uiflag & USER_AUTOPERSP) { - rv3d->persp= RV3D_PERSP; + if(!((rv3d->persp==RV3D_CAMOB) && (vod->v3d->flag2 & V3D_LOCK_CAMERA))) { + rv3d->persp= RV3D_PERSP; + } } else if(rv3d->persp==RV3D_CAMOB) { /* changed since 2.4x, use the camera view */ - View3D *v3d = vod->sa->spacedata.first; - - if(v3d->camera) { - view3d_apply_ob(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL); + if(vod->v3d->camera) { + ED_view3d_from_object(vod->v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL); } - if(rv3d->persp==RV3D_CAMOB) { + if(!(vod->v3d->flag2 & V3D_LOCK_CAMERA)) { rv3d->persp= rv3d->lpersp; } } @@ -894,7 +918,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf) static void viewmove_apply(ViewOpsData *vod, int x, int y) { - if(vod->rv3d->persp==RV3D_CAMOB) { + if((vod->rv3d->persp==RV3D_CAMOB) && !(vod->v3d->flag2 & V3D_LOCK_CAMERA)) { float zoomfac= ((float)M_SQRT2 + (float)vod->rv3d->camzoom / 50.0f); zoomfac= (zoomfac * zoomfac) * 0.5f; @@ -917,6 +941,8 @@ static void viewmove_apply(ViewOpsData *vod, int x, int y) vod->oldx= x; vod->oldy= y; + ED_view3d_camera_lock_sync(vod->v3d, vod->rv3d); + ED_region_tag_redraw(vod->ar); } @@ -966,11 +992,13 @@ static int viewmove_modal(bContext *C, wmOperator *op, wmEvent *event) static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event) { + ViewOpsData *vod; + /* makes op->customdata */ viewops_data_create(C, op, event); + vod= op->customdata; if (event->type == MOUSEPAN) { - ViewOpsData *vod= op->customdata; viewmove_apply(vod, event->prevx, event->prevy); request_depth_update(vod->rv3d); @@ -1159,6 +1187,8 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom, if(vod->rv3d->viewlock & RV3D_BOXVIEW) view3d_boxview_sync(vod->sa, vod->ar); + ED_view3d_camera_lock_sync(vod->v3d, vod->rv3d); + ED_region_tag_redraw(vod->ar); } @@ -1237,7 +1267,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op) if(delta < 0) { /* this min and max is also in viewmove() */ - if(rv3d->persp==RV3D_CAMOB) { + if((rv3d->persp==RV3D_CAMOB) && !(v3d->flag2 & V3D_LOCK_CAMERA)) { rv3d->camzoom-= 10; if(rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom= RV3D_CAMZOOM_MIN; } @@ -1246,7 +1276,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op) } } else { - if(rv3d->persp==RV3D_CAMOB) { + if((rv3d->persp==RV3D_CAMOB) && !(v3d->flag2 & V3D_LOCK_CAMERA)) { rv3d->camzoom+= 10; if(rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom= RV3D_CAMZOOM_MAX; } @@ -1259,6 +1289,9 @@ static int viewzoom_exec(bContext *C, wmOperator *op) view3d_boxview_sync(sa, ar); request_depth_update(rv3d); + + ED_view3d_camera_lock_sync(v3d, rv3d); + ED_region_tag_redraw(ar); viewops_data_free(C, op); @@ -1269,6 +1302,12 @@ static int viewzoom_exec(bContext *C, wmOperator *op) /* viewdolly_invoke() copied this function, changes here may apply there */ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) { + ViewOpsData *vod; + + /* makes op->customdata */ + viewops_data_create(C, op, 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")) { @@ -1277,18 +1316,9 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) } if(RNA_property_is_set(op->ptr, "delta")) { - /* makes op->customdata */ - viewops_data_create(C, op, event); viewzoom_exec(C, op); } else { - ViewOpsData *vod; - - /* makes op->customdata */ - viewops_data_create(C, op, event); - - vod= op->customdata; - if (event->type == MOUSEZOOM) { /* Bypass Zoom invert flag for track pads (pass FALSE always) */ @@ -1349,7 +1379,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot) static void view_dolly_mouseloc(ARegion *ar, float orig_ofs[3], float dvec[3], float dfac) { RegionView3D *rv3d= ar->regiondata; - madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, 1.0 - dfac); + madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0 - dfac)); } static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_invert) @@ -1379,6 +1409,8 @@ static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_inv if(vod->rv3d->viewlock & RV3D_BOXVIEW) view3d_boxview_sync(vod->sa, vod->ar); + ED_view3d_camera_lock_sync(vod->v3d, vod->rv3d); + ED_region_tag_redraw(vod->ar); } @@ -1444,7 +1476,8 @@ static int viewdolly_exec(bContext *C, wmOperator *op) else { sa= CTX_wm_area(C); ar= CTX_wm_region(C); - normalize_v3_v3(mousevec, ((RegionView3D *)ar->regiondata)->viewinv[2]); + negate_v3_v3(mousevec, ((RegionView3D *)ar->regiondata)->viewinv[2]); + normalize_v3(mousevec); } /* v3d= sa->spacedata.first; */ /* UNUSED */ @@ -1475,7 +1508,13 @@ static int viewdolly_exec(bContext *C, wmOperator *op) /* copied from viewzoom_invoke(), changes here may apply there */ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ +{ + ViewOpsData *vod; + + /* makes op->customdata */ + viewops_data_create(C, op, 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")) { @@ -1484,21 +1523,13 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event) } if(RNA_property_is_set(op->ptr, "delta")) { - /* makes op->customdata */ - viewops_data_create(C, op, event); viewdolly_exec(C, op); } else { - ViewOpsData *vod; - - /* makes op->customdata */ - viewops_data_create(C, op, event); - - vod= op->customdata; - /* overwrite the mouse vector with the view direction (zoom into the center) */ if((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) { - normalize_v3_v3(vod->mousevec, vod->rv3d->viewinv[2]); + negate_v3_v3(vod->mousevec, vod->rv3d->viewinv[2]); + normalize_v3(vod->mousevec); } if (event->type == MOUSEZOOM) { @@ -1534,10 +1565,17 @@ static int viewdolly_poll(bContext *C) { RegionView3D *rv3d= CTX_wm_region_view3d(C); - if (rv3d && rv3d->persp == RV3D_PERSP) { - return 1; + if(rv3d) { + if (rv3d->persp == RV3D_PERSP) { + return 1; + } + else { + View3D *v3d= CTX_wm_view3d(C); + if ((rv3d->persp == RV3D_CAMOB) && (v3d->flag2 & V3D_LOCK_CAMERA)) { + return 1; + } + } } - return 0; } @@ -1572,6 +1610,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in Scene *scene= CTX_data_scene(C); Base *base; float *curs; + const short skip_camera= ((rv3d->persp==RV3D_CAMOB) && (v3d->flag2 & V3D_LOCK_CAMERA)); int center= RNA_boolean_get(op->ptr, "center"); @@ -1592,6 +1631,11 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in for(base= scene->base.first; base; base= base->next) { if(BASE_VISIBLE(v3d, base)) { onedone= 1; + + if(skip_camera && base->object == v3d->camera) { + continue; + } + minmax_object(base->object, min, max); } } @@ -1627,7 +1671,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in new_dist*= size; } - if (rv3d->persp==RV3D_CAMOB) { + if ((rv3d->persp==RV3D_CAMOB) && !(v3d->flag2 & V3D_LOCK_CAMERA)) { rv3d->persp= RV3D_PERSP; smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL); } @@ -1671,6 +1715,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca Object *obedit= CTX_data_edit_object(C); float size, min[3], max[3], afm[3]; int ok=0, ok_dist=1; + const short skip_camera= ((rv3d->persp==RV3D_CAMOB) && (v3d->flag2 & V3D_LOCK_CAMERA)); /* SMOOTHVIEW */ float new_ofs[3]; @@ -1724,17 +1769,20 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca ok= PE_minmax(scene, min, max); } else { - Base *base= FIRSTBASE; - while(base) { + Base *base; + for(base= FIRSTBASE; base; base = base->next) { if(TESTBASE(v3d, base)) { + if(skip_camera && base->object == v3d->camera) { + continue; + } + /* account for duplis */ if (minmax_object_duplis(scene, base->object, min, max)==0) minmax_object(base->object, min, max); /* use if duplis not found */ ok= 1; } - base= base->next; } } @@ -1770,7 +1818,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca new_dist*= size; } - if (rv3d->persp==RV3D_CAMOB) { + if (rv3d->persp==RV3D_CAMOB && !(v3d->flag2 & V3D_LOCK_CAMERA)) { rv3d->persp= RV3D_PERSP; smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL); } @@ -1838,10 +1886,23 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot) static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */ { + ARegion *ar= CTX_wm_region(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); + Scene *scene= CTX_data_scene(C); + float xfac, yfac; + float size[2]; rv3d->camdx= rv3d->camdy= 0.0f; + view3d_viewborder_size_get(scene, ar, size); + + /* 4px is just a little room from the edge of the area */ + xfac= (float)ar->winx / (float)(size[0] + 4); + yfac= (float)ar->winy / (float)(size[1] + 4); + + rv3d->camzoom= (sqrtf(4.0f * MIN2(xfac, yfac)) - (float)M_SQRT2) * 50.0f; + rv3d->camzoom= CLAMPIS(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX); + WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); return OPERATOR_FINISHED; @@ -2053,10 +2114,11 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) static int view3d_zoom_border_invoke(bContext *C, wmOperator *op, wmEvent *event) { + View3D *v3d= CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); /* if in camera view do not exec the operator so we do not conflict with set render border*/ - if (rv3d->persp != RV3D_CAMOB) + if ((rv3d->persp != RV3D_CAMOB) || (v3d->flag2 & V3D_LOCK_CAMERA)) return WM_border_select_invoke(C, op, event); else return OPERATOR_PASS_THROUGH; @@ -2169,7 +2231,7 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, float q1, float invert_qt(obact_quat); mul_qt_qtqt(new_quat, new_quat, obact_quat); - rv3d->view= view= 0; + rv3d->view= view= RV3D_VIEW_USER; } } @@ -2361,6 +2423,7 @@ static EnumPropertyItem prop_view_orbit_items[] = { static int vieworbit_exec(bContext *C, wmOperator *op) { + View3D *v3d= CTX_wm_view3d(C); ARegion *ar= ED_view3d_context_region_unlock(C); RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */ float phi, q1[4], new_quat[4]; @@ -2369,8 +2432,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op) orbitdir = RNA_enum_get(op->ptr, "type"); if(rv3d->viewlock==0) { - - if(rv3d->persp != RV3D_CAMOB) { + if((rv3d->persp != RV3D_CAMOB) || (v3d->flag2 & V3D_LOCK_CAMERA)) { if(orbitdir == V3D_VIEW_STEPLEFT || orbitdir == V3D_VIEW_STEPRIGHT) { float si; /* z-axis */ @@ -2381,7 +2443,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op) q1[1]= q1[2]= 0.0; q1[3]= si; mul_qt_qtqt(new_quat, rv3d->viewquat, q1); - rv3d->view= 0; + rv3d->view= RV3D_VIEW_USER; } else if(orbitdir == V3D_VIEW_STEPDOWN || orbitdir == V3D_VIEW_STEPUP) { /* horizontal axis */ @@ -2393,7 +2455,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op) q1[0]= (float)cos(phi); mul_v3_fl(q1+1, sin(phi)); mul_qt_qtqt(new_quat, rv3d->viewquat, q1); - rv3d->view= 0; + rv3d->view= RV3D_VIEW_USER; } smooth_view(C, CTX_wm_view3d(C), ar, NULL, NULL, NULL, new_quat, NULL, NULL); @@ -2733,7 +2795,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3]; - short mx, my, mval[2]; + int mx, my, mval[2]; // short ctrl= 0; // XXX int flip; fp= give_cursor(scene, v3d); @@ -2744,7 +2806,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve mx= event->x - ar->winrct.xmin; my= event->y - ar->winrct.ymin; - project_short_noclip(ar, fp, mval); + project_int_noclip(ar, fp, mval); flip= initgrabz(rv3d, fp[0], fp[1], fp[2]); /* reset the depth based on the view offset */ @@ -2752,7 +2814,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve negate_v3_v3(fp, rv3d->ofs); /* re initialize */ - project_short_noclip(ar, fp, mval); + project_int_noclip(ar, fp, mval); flip= initgrabz(rv3d, fp[0], fp[1], fp[2]); } @@ -2760,7 +2822,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve short depth_used = 0; if (U.uiflag & USER_ORBIT_ZBUF) { /* maybe this should be accessed some other way */ - short mval_depth[2]; + int mval_depth[2]; mval_depth[0]= mx; mval_depth[1]= my; view3d_operator_needs_opengl(C); @@ -2891,7 +2953,7 @@ void VIEW3D_OT_enable_manipulator(wmOperatorType *ot) /* ************************* below the line! *********************** */ -static float view_autodist_depth_margin(ARegion *ar, const short mval[2], int margin) +static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int margin) { ViewDepths depth_temp= {0}; rcti rect; @@ -2919,7 +2981,7 @@ static float view_autodist_depth_margin(ARegion *ar, const short mval[2], int ma } /* XXX todo Zooms in on a border drawn by the user */ -int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, const short mval[2], float mouse_worldloc[3] ) //, float *autodist ) +int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3] ) //, float *autodist ) { bglMats mats; /* ZBuffer depth vars */ float depth_close= FLT_MAX; @@ -2962,7 +3024,7 @@ int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, flo } // no 4x4 sampling, run view_autodist_init first -int view_autodist_simple(ARegion *ar, const short mval[2], float mouse_worldloc[3], int margin, float *force_depth) //, float *autodist ) +int view_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth) //, float *autodist ) { bglMats mats; /* ZBuffer depth vars, could cache? */ float depth; @@ -2990,7 +3052,7 @@ int view_autodist_simple(ARegion *ar, const short mval[2], float mouse_worldloc[ return 1; } -int view_autodist_depth(struct ARegion *ar, const short mval[2], int margin, float *depth) +int view_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth) { *depth= view_autodist_depth_margin(ar, mval, margin); @@ -3000,11 +3062,11 @@ int view_autodist_depth(struct ARegion *ar, const short mval[2], int margin, flo static int depth_segment_cb(int x, int y, void *userData) { struct { struct ARegion *ar; int margin; float depth; } *data = userData; - short mval[2]; + int mval[2]; float depth; - mval[0]= (short)x; - mval[1]= (short)y; + mval[0]= x; + mval[1]= y; depth= view_autodist_depth_margin(data->ar, mval, data->margin); @@ -3017,7 +3079,7 @@ static int depth_segment_cb(int x, int y, void *userData) } } -int view_autodist_depth_segment(struct ARegion *ar, const short mval_sta[2], const short mval_end[2], int margin, float *depth) +int view_autodist_depth_segment(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth) { struct { struct ARegion *ar; int margin; float depth; } data = {NULL}; int p1[2]; @@ -3446,3 +3508,62 @@ void view3d_persp_mat4(RegionView3D *rv3d, float mat[][4]) mul_v3_v3fl(dvec, mat[2], -rv3d->dist); sub_v3_v3v3(mat[3], dvec, rv3d->ofs); } + + +/* Gets the view trasnformation from a camera +* currently dosnt take camzoom into account +* +* The dist is not modified for this function, if NULL its assimed zero +* */ +void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist) +{ + /* Offset */ + if (ofs) + negate_v3_v3(ofs, mat[3]); + + /* Quat */ + if (quat) { + float imat[4][4]; + invert_m4_m4(imat, mat); + mat4_to_quat(quat, imat); + } + + if (dist) { + float nmat[3][3]; + float vec[3]; + + vec[0]= 0.0f; + vec[1]= 0.0f; + vec[2]= -(*dist); + + copy_m3_m4(nmat, mat); + normalize_m3(nmat); + + mul_m3_v3(nmat, vec);; + sub_v3_v3(ofs, vec); + } +} + + +/* object -> view */ +void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist, float *lens) +{ + ED_view3d_from_m4(ob->obmat, ofs, quat, dist); + + if (lens) { + get_object_clip_range(ob, lens, NULL, NULL); + } +} + +/* view -> object */ +void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], const float dist) +{ + float mat4[4][4]; + float dvec[3]= {0.0f, 0.0f, dist}; + float iviewquat[4]= {-quat[0], quat[1], quat[2], quat[3]}; + + quat_to_mat4(mat4, iviewquat); + mul_mat3_m4_v3(mat4, dvec); + sub_v3_v3v3(mat4[3], dvec, ofs); + object_apply_mat4(ob, mat4, TRUE, TRUE); +} diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 32deee50fb2..e37361fbc54 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -158,7 +158,7 @@ typedef struct FlyInfo { short state; short use_precision; short redraw; - short mval[2]; + int mval[2]; /* fly state state */ float speed; /* the speed the view is moving per redraw */ diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index aad9c1dd3ff..fce23df3810 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -522,9 +522,9 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) block= uiLayoutGetBlock(row); if(v3d->twflag & V3D_USE_MANIPULATOR) { - uiDefIconButBitS(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode"); - uiDefIconButBitS(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode"); - uiDefIconButBitS(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode"); + uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode"); + uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode"); + uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode"); } if (v3d->twmode > (BIF_countTransformOrientation(C) - 1) + V3D_MANIP_CUSTOM) { @@ -532,7 +532,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } str_menu = BIF_menustringTransformOrientation(C, "Orientation"); - uiDefButS(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, YIC, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation"); + uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, YIC, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation"); MEM_freeN((void *)str_menu); } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index f51a780787e..c4999b961f0 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -93,15 +93,15 @@ void view3d_set_viewcontext(bContext *C, ViewContext *vc) vc->obedit= CTX_data_edit_object(C); } -int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const short mval[2], const short do_fallback) +int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int mval[2], const short do_fallback) { float dvec[3]; - short mval_cpy[2]; + int mval_cpy[2]; mval_cpy[0]= mval[0]; mval_cpy[1]= mval[1]; - project_short_noclip(vc->ar, fp, mval_cpy); + project_int_noclip(vc->ar, fp, mval_cpy); initgrabz(vc->rv3d, fp[0], fp[1], fp[2]); @@ -274,12 +274,12 @@ static int edge_inside_rect(rcti *rect, short x1, short y1, short x2, short y2) #define MOVES_GESTURE 50 #define MOVES_LASSO 500 -int lasso_inside(short mcords[][2], short moves, short sx, short sy) +int lasso_inside(int mcords[][2], short moves, int sx, int sy) { /* we do the angle rule, define that all added angles should be about zero or 2*PI */ float angletot=0.0, len, dot, ang, cross, fp1[2], fp2[2]; int a; - short *p1, *p2; + int *p1, *p2; if(sx==IS_CLIPPED) return 0; @@ -322,9 +322,9 @@ int lasso_inside(short mcords[][2], short moves, short sx, short sy) } /* edge version for lasso select. we assume boundbox check was done */ -int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1) +int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int y1) { - short v1[2], v2[2]; + int v1[2], v2[2]; int a; if(x0==IS_CLIPPED || x1==IS_CLIPPED) @@ -339,9 +339,9 @@ int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, in /* no points in lasso, so we have to intersect with lasso edge */ - if( isect_line_line_v2_short(mcords[0], mcords[moves-1], v1, v2) > 0) return 1; + if( isect_line_line_v2_int(mcords[0], mcords[moves-1], v1, v2) > 0) return 1; for(a=0; a<moves-1; a++) { - if( isect_line_line_v2_short(mcords[a], mcords[a+1], v1, v2) > 0) return 1; + if( isect_line_line_v2_int(mcords[a], mcords[a+1], v1, v2) > 0) return 1; } return 0; @@ -351,11 +351,11 @@ int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, in /* warning; lasso select with backbuffer-check draws in backbuf with persp(PERSP_WIN) and returns with persp(PERSP_VIEW). After lasso select backbuf is not OK */ -static void do_lasso_select_pose(ViewContext *vc, Object *ob, short mcords[][2], short moves, short select) +static void do_lasso_select_pose(ViewContext *vc, Object *ob, int mcords[][2], short moves, short select) { bPoseChannel *pchan; float vec[3]; - short sco1[2], sco2[2]; + int sco1[2], sco2[2]; bArmature *arm= ob->data; if(ob->type!=OB_ARMATURE || ob->pose==NULL) return; @@ -363,9 +363,9 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, short mcords[][2], for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { if (PBONE_VISIBLE(arm, pchan->bone) && (pchan->bone->flag & BONE_UNSELECTABLE)==0) { mul_v3_m4v3(vec, ob->obmat, pchan->pose_head); - project_short(vc->ar, vec, sco1); + project_int(vc->ar, vec, sco1); mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail); - project_short(vc->ar, vec, sco2); + project_int(vc->ar, vec, sco2); if(lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) { if(select) pchan->bone->flag |= BONE_SELECTED; @@ -386,7 +386,7 @@ static void object_deselect_all_visible(Scene *scene, View3D *v3d) } } -static void do_lasso_select_objects(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_objects(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { Base *base; @@ -409,7 +409,7 @@ static void do_lasso_select_objects(ViewContext *vc, short mcords[][2], short mo } } -static void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves) +static void lasso_select_boundbox(rcti *rect, int mcords[][2], short moves) { short a; @@ -426,7 +426,7 @@ static void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves) static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { - struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; + struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } *data = userData; if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) { eve->f = data->select?(eve->f|1):(eve->f&~1); @@ -434,7 +434,7 @@ static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, in } static void do_lasso_select_mesh__doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index) { - struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; + struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } *data = userData; if (EM_check_backbuf(em_solidoffs+index)) { if (data->pass==0) { @@ -453,16 +453,16 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, EditEdge *eed, in } static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { - struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; + struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } *data = userData; if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) { EM_select_face_fgon(data->vc.em, efa, data->select); } } -static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { - struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } data; + struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } data; ToolSettings *ts= vc->scene->toolsettings; rcti rect; int bbsel; @@ -528,7 +528,7 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves #if 0 /* this is an exception in that its the only lasso that dosnt use the 3d view (uses space image view) */ -static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select) +static void do_lasso_select_mesh_uv(int mcords[][2], short moves, short select) { EditFace *efa; MTFace *tf; @@ -585,7 +585,7 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { - struct { ViewContext *vc; short (*mcords)[2]; short moves; short select; } *data = userData; + struct { ViewContext *vc; int (*mcords)[2]; short moves; short select; } *data = userData; Object *obedit= data->vc->obedit; Curve *cu= (Curve*)obedit->data; @@ -612,9 +612,9 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BP } } -static void do_lasso_select_curve(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_curve(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { - struct { ViewContext *vc; short (*mcords)[2]; short moves; short select; } data; + struct { ViewContext *vc; int (*mcords)[2]; short moves; short select; } data; /* set vc->editnurb */ data.vc = vc; @@ -631,15 +631,15 @@ static void do_lasso_select_curve(ViewContext *vc, short mcords[][2], short move static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, int x, int y) { - struct { short (*mcords)[2]; short moves; short select; } *data = userData; + struct { int (*mcords)[2]; short moves; short select; } *data = userData; if (lasso_inside(data->mcords, data->moves, x, y)) { bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT); } } -static void do_lasso_select_lattice(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_lattice(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { - struct { short (*mcords)[2]; short moves; short select; } data; + struct { int (*mcords)[2]; short moves; short select; } data; /* set editdata in vc */ data.mcords = mcords; @@ -653,7 +653,7 @@ static void do_lasso_select_lattice(ViewContext *vc, short mcords[][2], short mo lattice_foreachScreenVert(vc, do_lasso_select_lattice__doSelect, &data); } -static void do_lasso_select_armature(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_armature(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { bArmature *arm= vc->obedit->data; EditBone *ebone; @@ -705,7 +705,7 @@ static void do_lasso_select_armature(ViewContext *vc, short mcords[][2], short m -static void do_lasso_select_meta(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_meta(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { MetaBall *mb = (MetaBall*)vc->obedit->data; MetaElem *ml; @@ -730,7 +730,7 @@ static void do_lasso_select_meta(ViewContext *vc, short mcords[][2], short moves } } -static void do_lasso_select_paintface(ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void do_lasso_select_paintface(ViewContext *vc, int mcords[][2], short moves, short extend, short select) { Object *ob= vc->obact; Mesh *me= ob?ob->data:NULL; @@ -755,7 +755,7 @@ static void do_lasso_select_paintface(ViewContext *vc, short mcords[][2], short } #if 0 -static void do_lasso_select_node(short mcords[][2], short moves, short select) +static void do_lasso_select_node(int mcords[][2], short moves, short select) { SpaceNode *snode = sa->spacedata.first; @@ -785,7 +785,7 @@ static void do_lasso_select_node(short mcords[][2], short moves, short select) } #endif -static void view3d_lasso_select(bContext *C, ViewContext *vc, short mcords[][2], short moves, short extend, short select) +static void view3d_lasso_select(bContext *C, ViewContext *vc, int mcords[][2], short moves, short extend, short select) { Object *ob = CTX_data_active_object(C); @@ -834,14 +834,14 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op) { ViewContext vc; int i= 0; - short mcords[1024][2]; + int mcords[1024][2]; RNA_BEGIN(op->ptr, itemptr, "path") { float loc[2]; RNA_float_get_array(&itemptr, "loc", loc); - mcords[i][0]= (short)loc[0]; - mcords[i][1]= (short)loc[1]; + mcords[i][0]= (int)loc[0]; + mcords[i][1]= (int)loc[1]; i++; if(i>=1024) break; } @@ -953,7 +953,7 @@ static void deselectall_except(Scene *scene, Base *b) /* deselect all except b } } -static Base *mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const short mval[2], short extend) +static Base *mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], short extend) { short baseCount = 0; short ok; @@ -1039,7 +1039,7 @@ static Base *mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffe /* we want a select buffer with bones, if there are... */ /* so check three selection levels and compare */ -static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buffer, const short mval[2]) +static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buffer, const int mval[2]) { rcti rect; int offs; @@ -1096,12 +1096,12 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff } /* returns basact */ -static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits, const short mval[2], Base *startbase, int has_bones) +static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], Base *startbase, int has_bones) { Scene *scene= vc->scene; View3D *v3d= vc->v3d; Base *base, *basact= NULL; - static short lastmval[2]={-100, -100}; + static int lastmval[2]={-100, -100}; int a, donearest= 0; /* define if we use solid nearest select or not */ @@ -1189,7 +1189,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int } /* mval comes from event->mval, only use within region handlers */ -Base *ED_view3d_give_base_under_cursor(bContext *C, const short mval[2]) +Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2]) { ViewContext vc; Base *basact= NULL; @@ -1214,7 +1214,7 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const short mval[2]) } /* mval is region coords */ -static int mouse_select(bContext *C, const short mval[2], short extend, short obcenter, short enumerate) +static int mouse_select(bContext *C, const int mval[2], short extend, short obcenter, short enumerate) { ViewContext vc; ARegion *ar= CTX_wm_region(C); @@ -1905,7 +1905,7 @@ void VIEW3D_OT_select(wmOperatorType *ot) static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); @@ -1915,7 +1915,7 @@ static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y } static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index)) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; if (edge_inside_circle(data->mval[0], data->mval[1], (short) data->radius, x0, y0, x1, y1)) { EM_select_edge(eed, data->select); @@ -1923,7 +1923,7 @@ static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int } static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); @@ -1932,11 +1932,11 @@ static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y } } -static void mesh_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { ToolSettings *ts= vc->scene->toolsettings; int bbsel; - struct {ViewContext *vc; short select, mval[2]; float radius; } data; + struct {ViewContext *vc; short select; int mval[2]; float radius; } data; bbsel= EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0f)); ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */ @@ -1977,7 +1977,7 @@ static void mesh_circle_select(ViewContext *vc, int select, const short mval[2], EM_selectmode_flush(vc->em); } -static void paint_facesel_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void paint_facesel_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { Object *ob= vc->obact; Mesh *me = ob?ob->data:NULL; @@ -1995,7 +1995,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int select, const short static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); Object *obedit= data->vc->obedit; @@ -2024,9 +2024,9 @@ static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint } } } -static void nurbscurve_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void nurbscurve_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { - struct {ViewContext *vc; short select, mval[2]; float radius; } data; + struct {ViewContext *vc; short select; int mval[2]; float radius; } data; /* set vc-> edit data */ @@ -2043,7 +2043,7 @@ static void nurbscurve_circle_select(ViewContext *vc, int select, const short mv static void latticecurve_circle_doSelect(void *userData, BPoint *bp, int x, int y) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); @@ -2051,9 +2051,9 @@ static void latticecurve_circle_doSelect(void *userData, BPoint *bp, int x, int bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT); } } -static void lattice_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void lattice_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { - struct {ViewContext *vc; short select, mval[2]; float radius; } data; + struct {ViewContext *vc; short select; int mval[2]; float radius; } data; /* set vc-> edit data */ @@ -2070,7 +2070,7 @@ static void lattice_circle_select(ViewContext *vc, int select, const short mval[ // NOTE: pose-bone case is copied from editbone case... static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, int x, int y) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); @@ -2083,9 +2083,9 @@ static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, int } return 0; } -static void pose_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void pose_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { - struct {ViewContext *vc; short select, mval[2]; float radius; } data; + struct {ViewContext *vc; short select; int mval[2]; float radius; } data; bPose *pose = vc->obact->pose; bPoseChannel *pchan; int change= FALSE; @@ -2130,7 +2130,7 @@ static void pose_circle_select(ViewContext *vc, int select, const short mval[2], static short armature_circle_doSelectJoint(void *userData, EditBone *ebone, int x, int y, short head) { - struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; + struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; float r = sqrt(mx*mx + my*my); @@ -2151,7 +2151,7 @@ static short armature_circle_doSelectJoint(void *userData, EditBone *ebone, int } return 0; } -static void armature_circle_select(ViewContext *vc, int select, const short mval[2], float rad) +static void armature_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { struct {ViewContext *vc; short select, mval[2]; float radius; } data; bArmature *arm= vc->obedit->data; @@ -2210,7 +2210,7 @@ static void armature_circle_select(ViewContext *vc, int select, const short mval /** Callbacks for circle selection in Editmode */ -static void obedit_circle_select(ViewContext *vc, short select, const short mval[2], float rad) +static void obedit_circle_select(ViewContext *vc, short select, const int mval[2], float rad) { switch(vc->obedit->type) { case OB_MESH: @@ -2251,7 +2251,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) (obact && (obact->mode & (OB_MODE_PARTICLE_EDIT|OB_MODE_POSE))) ) { ViewContext vc; - short mval[2]; + int mval[2]; view3d_operator_needs_opengl(C); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index a3d42aa5579..b4d2fc22143 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -70,6 +70,7 @@ #include "view3d_intern.h" +extern float originmat[3][3]; /* XXX object.c */ /* ************************************************** */ /* ********************* old transform stuff ******** */ @@ -451,7 +452,6 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) { - extern float originmat[3][3]; /* XXX object.c */ Main *bmain= CTX_data_main(C); Object *obedit= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); @@ -588,7 +588,6 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) { - extern float originmat[3][3]; /* XXX object.c */ Main *bmain= CTX_data_main(C); Object *obedit= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index b46c7236170..6e2e1898fb4 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -32,9 +32,9 @@ #include "DNA_camera_types.h" -#include "DNA_lamp_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "DNA_lamp_types.h" #include "MEM_guardedalloc.h" @@ -105,7 +105,7 @@ float *give_cursor(Scene *scene, View3D *v3d) /* Gets the lens and clipping values from a camera of lamp type object */ -static void object_lens_clip_settings(Object *ob, float *lens, float *clipsta, float *clipend) +void get_object_clip_range(Object *ob, float *lens, float *clipsta, float *clipend) { if(ob->type==OB_LAMP ) { Lamp *la = ob->data; @@ -129,51 +129,6 @@ static void object_lens_clip_settings(Object *ob, float *lens, float *clipsta, f } } - -/* Gets the view trasnformation from a camera -* currently dosnt take camzoom into account -* -* The dist is not modified for this function, if NULL its assimed zero -* */ -void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist) -{ - /* Offset */ - if (ofs) - negate_v3_v3(ofs, mat[3]); - - /* Quat */ - if (quat) { - float imat[4][4]; - invert_m4_m4(imat, mat); - mat4_to_quat(quat, imat); - } - - if (dist) { - float nmat[3][3]; - float vec[3]; - - vec[0]= 0.0f; - vec[1]= 0.0f; - vec[2]= -(*dist); - - copy_m3_m4(nmat, mat); - normalize_m3(nmat); - - mul_m3_v3(nmat, vec);; - sub_v3_v3(ofs, vec); - } -} - -void view3d_apply_ob(Object *ob, float *ofs, float *quat, float *dist, float *lens) -{ - view3d_apply_mat4(ob->obmat, ofs, quat, dist); - - if (lens) { - object_lens_clip_settings(ob, lens, NULL, NULL); - } -} - - /* ****************** smooth view operator ****************** */ /* This operator is one of the 'timer refresh' ones like animation playback */ @@ -206,7 +161,19 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec sms.new_dist= rv3d->dist; sms.new_lens= v3d->lens; sms.to_camera= 0; - + + /* note on camera locking, this is a little confusing but works ok. + * we may be changing the view 'as if' there is no active camera, but infact + * there is an active camera which is locked to the view. + * + * In the case where smooth view is moving _to_ a camera we dont want that + * camera to be moved or changed, so only when the camera is not being set should + * we allow camera option locking to initialize the view settings from the camera. + */ + if(camera == NULL && oldcamera == NULL) { + ED_view3d_camera_lock_init(v3d, rv3d); + } + /* store the options we want to end with */ if(ofs) copy_v3_v3(sms.new_ofs, ofs); if(quat) copy_qt_qt(sms.new_quat, quat); @@ -214,7 +181,7 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec if(lens) sms.new_lens= *lens; if (camera) { - view3d_apply_ob(camera, sms.new_ofs, sms.new_quat, &sms.new_dist, &sms.new_lens); + ED_view3d_from_object(camera, sms.new_ofs, sms.new_quat, &sms.new_dist, &sms.new_lens); sms.to_camera= 1; /* restore view3d values in end */ } @@ -239,7 +206,7 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec /* original values */ if (oldcamera) { sms.orig_dist= rv3d->dist; // below function does weird stuff with it... - view3d_apply_ob(oldcamera, sms.orig_ofs, sms.orig_quat, &sms.orig_dist, &sms.orig_lens); + ED_view3d_from_object(oldcamera, sms.orig_ofs, sms.orig_quat, &sms.orig_dist, &sms.orig_lens); } else { copy_v3_v3(sms.orig_ofs, rv3d->ofs); @@ -251,7 +218,7 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec if((rv3d->viewlock & RV3D_LOCKED)==0) { /* use existing if exists, means multiple calls to smooth view wont loose the original 'view' setting */ sms.orig_view= rv3d->sms ? rv3d->sms->orig_view : rv3d->view; - rv3d->view= 0; + rv3d->view= RV3D_VIEW_USER; } sms.time_allowed= (double)U.smooth_viewtx / 1000.0; @@ -341,6 +308,8 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent copy_qt_qt(rv3d->viewquat, sms->new_quat); rv3d->dist = sms->new_dist; v3d->lens = sms->new_lens; + + ED_view3d_camera_lock_sync(v3d, rv3d); } if((rv3d->viewlock & RV3D_LOCKED)==0) { @@ -370,6 +339,8 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent rv3d->dist = sms->new_dist * step + sms->orig_dist*step_inv; v3d->lens = sms->new_lens * step + sms->orig_lens*step_inv; + + ED_view3d_camera_lock_sync(v3d, rv3d); } if(rv3d->viewlock & RV3D_BOXVIEW) @@ -396,25 +367,6 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot) /* ****************** change view operators ****************** */ -static void setcameratoview3d(RegionView3D *rv3d, Object *ob) -{ - float dvec[3]; - float mat3[3][3]; - - mul_v3_v3fl(dvec, rv3d->viewinv[2], rv3d->dist); - sub_v3_v3v3(ob->loc, dvec, rv3d->ofs); - rv3d->viewquat[0]= -rv3d->viewquat[0]; - - // quat_to_eul( ob->rot,rv3d->viewquat); // in 2.4x for xyz eulers only - quat_to_mat3(mat3, rv3d->viewquat); - object_mat3_to_rot(ob, mat3, 0); - - rv3d->viewquat[0]= -rv3d->viewquat[0]; - - ob->recalc= OB_RECALC_OB; -} - - static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); @@ -426,7 +378,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) rv3d->lpersp= rv3d->persp; } - setcameratoview3d(rv3d, v3d->camera); + ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist); DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); rv3d->persp = RV3D_CAMOB; @@ -555,7 +507,7 @@ void viewline(ARegion *ar, View3D *v3d, float mval[2], float ray_start[3], float float vec[4]; int a; - if(!get_view3d_ortho(v3d, rv3d)) { + if(rv3d->is_persp) { vec[0]= 2.0f * mval[0] / ar->winx - 1; vec[1]= 2.0f * mval[1] / ar->winy - 1; vec[2]= -1.0f; @@ -646,26 +598,42 @@ int initgrabz(RegionView3D *rv3d, float x, float y, float z) return flip; } -/* always call initgrabz */ -void window_to_3d(ARegion *ar, float out[3], short mx, short my) +void window_to_3d(ARegion *ar, float out[3], const float depth_pt[3], const int mx, const int my) { RegionView3D *rv3d= ar->regiondata; - float dx= ((float)(mx-(ar->winx/2)))*rv3d->zfac/(ar->winx/2); - float dy= ((float)(my-(ar->winy/2)))*rv3d->zfac/(ar->winy/2); - - float fz= rv3d->persmat[0][3]*out[0]+ rv3d->persmat[1][3]*out[1]+ rv3d->persmat[2][3]*out[2]+ rv3d->persmat[3][3]; - fz= fz/rv3d->zfac; - - out[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy+ rv3d->persinv[2][0]*fz)-rv3d->ofs[0]; - out[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy+ rv3d->persinv[2][1]*fz)-rv3d->ofs[1]; - out[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy+ rv3d->persinv[2][2]*fz)-rv3d->ofs[2]; - + float line_sta[3]; + float line_end[3]; + + if(rv3d->is_persp) { + float mousevec[3]; + float view_z[3]; + float pt_mid[3]; + + window_to_3d_vector(ar, mousevec, mx, my); + + copy_v3_v3(line_sta, rv3d->viewinv[3]); + normalize_v3_v3(view_z, rv3d->viewinv[2]); + add_v3_v3v3(line_end, line_sta, view_z); + closest_to_line_v3(pt_mid, depth_pt, line_sta, line_end); + mul_v3_fl(mousevec, shell_angle_to_dist(angle_normalized_v3v3(view_z, mousevec)) * len_v3v3(line_sta, pt_mid)); + add_v3_v3v3(out, line_sta, mousevec); + } + else { + const float dx= (2.0f * (float)mx / (float)ar->winx) - 1.0f; + const float dy= (2.0f * (float)my / (float)ar->winy) - 1.0f; + line_sta[0]= (rv3d->persinv[0][0] * dx) + (rv3d->persinv[1][0] * dy) + rv3d->viewinv[3][0]; + line_sta[1]= (rv3d->persinv[0][1] * dx) + (rv3d->persinv[1][1] * dy) + rv3d->viewinv[3][1]; + line_sta[2]= (rv3d->persinv[0][2] * dx) + (rv3d->persinv[1][2] * dy) + rv3d->viewinv[3][2]; + + add_v3_v3v3(line_end, line_sta, rv3d->viewinv[2]); + closest_to_line_v3(out, depth_pt, line_sta, line_end); + } } /* always call initgrabz */ /* only to detect delta motion */ -void window_to_3d_delta(ARegion *ar, float out[3], short mx, short my) +void window_to_3d_delta(ARegion *ar, float out[3], const int mx, const int my) { RegionView3D *rv3d= ar->regiondata; float dx, dy; @@ -681,22 +649,27 @@ void window_to_3d_delta(ARegion *ar, float out[3], short mx, short my) /* doesn't rely on initgrabz */ /* for perspective view, get the vector direction to * the mouse cursor as a normalized vector */ -void window_to_3d_vector(ARegion *ar, float out[3], short mx, short my) +void window_to_3d_vector(ARegion *ar, float out[3], const int mx, const int my) { RegionView3D *rv3d= ar->regiondata; - float dx, dy; - float viewvec[3]; - dx= 2.0f*mx/ar->winx; - dy= 2.0f*my/ar->winy; + if(rv3d->is_persp) { + float dx, dy; + float viewvec[3]; - /* normalize here so vecs are proportional to eachother */ - normalize_v3_v3(viewvec, rv3d->viewinv[2]); + dx= (2.0f * mx / ar->winx) - 1.0f; + dy= (2.0f * my / ar->winy) - 1.0f; - out[0]= viewvec[0] - (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy); - out[1]= viewvec[1] - (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy); - out[2]= viewvec[2] - (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy); + /* normalize here so vecs are proportional to eachother */ + normalize_v3_v3(viewvec, rv3d->viewinv[2]); + out[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy) - viewvec[0]; + out[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy) - viewvec[1]; + out[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy) - viewvec[2]; + } + else { + copy_v3_v3(out, rv3d->viewinv[2]); + } normalize_v3(out); } @@ -938,29 +911,6 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2]) } } -int get_view3d_ortho(View3D *v3d, RegionView3D *rv3d) -{ - Camera *cam; - - if(rv3d->persp==RV3D_CAMOB) { - if(v3d->camera && v3d->camera->type==OB_CAMERA) { - cam= v3d->camera->data; - - if(cam && cam->type==CAM_ORTHO) - return 1; - else - return 0; - } - else - return 0; - } - - if(rv3d->persp==RV3D_ORTHO) - return 1; - - return 0; -} - /* copies logic of get_view3d_viewplane(), keep in sync */ int get_view3d_cliprange(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend) { @@ -1130,6 +1080,8 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for pick int orth; orth= get_view3d_viewplane(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL); + rv3d->is_persp= !orth; + // printf("%d %d %f %f %f %f %f %f\n", winx, winy, viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax, clipsta, clipend); x1= viewplane.xmin; y1= viewplane.ymin; @@ -1164,7 +1116,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short float bmat[4][4]; float tmat[3][3]; - rv3d->view= 0; /* dont show the grid */ + rv3d->view= RV3D_VIEW_USER; /* dont show the grid */ copy_m4_m4(bmat, ob->obmat); normalize_m4(bmat); @@ -1188,7 +1140,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short rv3d->persp=RV3D_PERSP; rv3d->dist= 0.0; - view3d_apply_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens); + ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens); smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX rv3d->persp=RV3D_CAMOB; /* just to be polite, not needed */ @@ -1917,7 +1869,7 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f cross_v3_v3v3(axis, alignaxis, norm); axis_angle_to_quat( new_quat,axis, -angle); - rv3d->view= 0; + rv3d->view= RV3D_VIEW_USER; if (rv3d->persp==RV3D_CAMOB && v3d->camera) { /* switch out of camera view */ @@ -1928,7 +1880,7 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f copy_v3_v3(orig_ofs, rv3d->ofs); rv3d->persp= RV3D_PERSP; rv3d->dist= 0.0; - view3d_apply_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens); + ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens); smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX } else { if (rv3d->persp==RV3D_CAMOB) rv3d->persp= RV3D_PERSP; /* switch out of camera mode */ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index b7095df1599..96c78f4b632 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -120,7 +120,7 @@ void setTransformViewMatrices(TransInfo *t) calculateCenter2D(t); } -void convertViewVec(TransInfo *t, float *vec, short dx, short dy) +void convertViewVec(TransInfo *t, float *vec, int dx, int dy) { if (t->spacetype==SPACE_VIEW3D) { if (t->ar->regiontype == RGN_TYPE_WINDOW) @@ -780,7 +780,7 @@ int transformEvent(TransInfo *t, wmEvent *event) case SPACEKEY: if ((t->spacetype==SPACE_VIEW3D) && event->alt) { #if 0 // TRANSFORM_FIX_ME - short mval[2]; + int mval[2]; getmouseco_sc(mval); BIF_selectOrientation(); @@ -1267,7 +1267,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) setlinestyle(3); glBegin(GL_LINE_STRIP); - glVertex2sv(t->mval); + glVertex2iv(t->mval); glVertex2fv(cent); glEnd(); @@ -1312,7 +1312,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) setlinestyle(3); glBegin(GL_LINE_STRIP); - glVertex2sv(t->mval); + glVertex2iv(t->mval); glVertex2fv(cent); glEnd(); @@ -2286,7 +2286,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event) return status; } -int Warp(TransInfo *t, const short UNUSED(mval[2])) +int Warp(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3]; @@ -2434,7 +2434,7 @@ int handleEventShear(TransInfo *t, wmEvent *event) } -int Shear(TransInfo *t, const short UNUSED(mval[2])) +int Shear(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float vec[3]; @@ -2700,7 +2700,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) { constraintTransLim(t, td); } -int Resize(TransInfo *t, const short mval[2]) +int Resize(TransInfo *t, const int mval[2]) { TransData *td; float size[3], mat[3][3]; @@ -2805,7 +2805,7 @@ void initToSphere(TransInfo *t) t->val /= (float)t->total; } -int ToSphere(TransInfo *t, const short UNUSED(mval[2])) +int ToSphere(TransInfo *t, const int UNUSED(mval[2])) { float vec[3]; float ratio, radius; @@ -3152,7 +3152,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) } } -int Rotation(TransInfo *t, const short UNUSED(mval[2])) +int Rotation(TransInfo *t, const int UNUSED(mval[2])) { char str[128], *spos= str; @@ -3260,7 +3260,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a } } -int Trackball(TransInfo *t, const short UNUSED(mval[2])) +int Trackball(TransInfo *t, const int UNUSED(mval[2])) { char str[128], *spos= str; float axis1[3], axis2[3]; @@ -3490,7 +3490,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) { } /* uses t->vec to store actual translation in */ -int Translation(TransInfo *t, const short UNUSED(mval[2])) +int Translation(TransInfo *t, const int UNUSED(mval[2])) { char str[250]; @@ -3557,7 +3557,7 @@ void initShrinkFatten(TransInfo *t) -int ShrinkFatten(TransInfo *t, const short UNUSED(mval[2])) +int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) { float vec[3]; float distance; @@ -3632,7 +3632,7 @@ void initTilt(TransInfo *t) -int Tilt(TransInfo *t, const short UNUSED(mval[2])) +int Tilt(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; int i; @@ -3704,7 +3704,7 @@ void initCurveShrinkFatten(TransInfo *t) t->flag |= T_NO_CONSTRAINT; } -int CurveShrinkFatten(TransInfo *t, const short UNUSED(mval[2])) +int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float ratio; @@ -3772,7 +3772,7 @@ void initPushPull(TransInfo *t) } -int PushPull(TransInfo *t, const short UNUSED(mval[2])) +int PushPull(TransInfo *t, const int UNUSED(mval[2])) { float vec[3], axis[3]; float distance; @@ -3905,7 +3905,7 @@ int handleEventBevel(TransInfo *t, wmEvent *event) return 0; } -int Bevel(TransInfo *t, const short UNUSED(mval[2])) +int Bevel(TransInfo *t, const int UNUSED(mval[2])) { float distance,d; int i; @@ -3973,7 +3973,7 @@ void initBevelWeight(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BevelWeight(TransInfo *t, const short UNUSED(mval[2])) +int BevelWeight(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float weight; @@ -4046,7 +4046,7 @@ void initCrease(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int Crease(TransInfo *t, const short UNUSED(mval[2])) +int Crease(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float crease; @@ -4165,7 +4165,7 @@ static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3]) td->loc[1]= oldy; } -int BoneSize(TransInfo *t, const short mval[2]) +int BoneSize(TransInfo *t, const int mval[2]) { TransData *td = t->data; float size[3], mat[3][3]; @@ -4241,7 +4241,7 @@ void initBoneEnvelope(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BoneEnvelope(TransInfo *t, const short UNUSED(mval[2])) +int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float ratio; @@ -4672,10 +4672,10 @@ static int createSlideVerts(TransInfo *t) #undef EDGE_SLIDE_MIN - sld->start[0] = (short) start[0]; - sld->start[1] = (short) start[1]; - sld->end[0] = (short) end[0]; - sld->end[1] = (short) end[1]; + sld->start[0] = (int) start[0]; + sld->start[1] = (int) start[1]; + sld->end[0] = (int) end[0]; + sld->end[1] = (int) end[1]; if (uvlay_tot) { // XXX && (scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)) { int maxnum = 0; @@ -4975,7 +4975,7 @@ int doEdgeSlide(TransInfo *t, float perc) return 1; } -int EdgeSlide(TransInfo *t, const short UNUSED(mval[2])) +int EdgeSlide(TransInfo *t, const int UNUSED(mval[2])) { char str[50]; float final; @@ -5034,7 +5034,7 @@ void initBoneRoll(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BoneRoll(TransInfo *t, const short UNUSED(mval[2])) +int BoneRoll(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; int i; @@ -5095,7 +5095,7 @@ void initBakeTime(TransInfo *t) t->num.increment = t->snap[1]; } -int BakeTime(TransInfo *t, const short mval[2]) +int BakeTime(TransInfo *t, const int mval[2]) { TransData *td = t->data; float time; @@ -5170,7 +5170,7 @@ void initMirror(TransInfo *t) } } -int Mirror(TransInfo *t, const short UNUSED(mval[2])) +int Mirror(TransInfo *t, const int UNUSED(mval[2])) { TransData *td; float size[3], mat[3][3]; @@ -5247,7 +5247,7 @@ void initAlign(TransInfo *t) initMouseInputMode(t, &t->mouse, INPUT_NONE); } -int Align(TransInfo *t, const short UNUSED(mval[2])) +int Align(TransInfo *t, const int UNUSED(mval[2])) { TransData *td = t->data; float center[3]; @@ -5350,7 +5350,7 @@ static void applySeqSlide(TransInfo *t, float val[2]) { } } -int SeqSlide(TransInfo *t, const short UNUSED(mval[2])) +int SeqSlide(TransInfo *t, const int UNUSED(mval[2])) { char str[200]; @@ -5640,7 +5640,7 @@ static void applyTimeTranslate(TransInfo *t, float UNUSED(sval)) } } -int TimeTranslate(TransInfo *t, const short mval[2]) +int TimeTranslate(TransInfo *t, const int mval[2]) { View2D *v2d = (View2D *)t->view; float cval[2], sval[2]; @@ -5770,7 +5770,7 @@ static void applyTimeSlide(TransInfo *t, float sval) } } -int TimeSlide(TransInfo *t, const short mval[2]) +int TimeSlide(TransInfo *t, const int mval[2]) { View2D *v2d = (View2D *)t->view; float cval[2], sval[2]; @@ -5895,7 +5895,7 @@ static void applyTimeScale(TransInfo *t) { } } -int TimeScale(TransInfo *t, const short UNUSED(mval[2])) +int TimeScale(TransInfo *t, const int UNUSED(mval[2])) { char str[200]; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index b94f2cc525a..b55435fd0cf 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -119,7 +119,7 @@ typedef struct TransCon { float pmtx[3][3]; /* Projection Constraint Matrix (same as imtx with some axis == 0) */ float center[3]; /* transformation center to define where to draw the view widget ALWAYS in global space. Unlike the transformation center */ - short imval[2]; /* initial mouse value for visual calculation */ + int imval[2]; /* initial mouse value for visual calculation */ /* the one in TransInfo is not garanty to stay the same (Rotates change it) */ int mode; /* Mode flags of the Constraint */ void (*drawExtra)(struct TransInfo *); @@ -217,7 +217,7 @@ typedef struct SlideData { struct GHash *vhash, **uvhash; struct EditVert *nearest; struct LinkNode *edgelist, *vertlist; - short start[2], end[2]; + int start[2], end[2]; } SlideData; typedef struct TransData { @@ -242,12 +242,12 @@ typedef struct TransData { } TransData; typedef struct MouseInput { - void (*apply)(struct TransInfo *, struct MouseInput *, const short [2], float [3]); + void (*apply)(struct TransInfo *, struct MouseInput *, const int [2], float [3]); void (*post)(struct TransInfo *, float [3]); - short imval[2]; /* initial mouse position */ + int imval[2]; /* initial mouse position */ char precision; - short precision_mval[2]; /* mouse position when precision key was pressed */ + int precision_mval[2]; /* mouse position when precision key was pressed */ int center[2]; float factor; void *data; /* additional data, if needed by the particular function */ @@ -261,7 +261,7 @@ typedef struct TransInfo { int options; /* current context/options for transform */ float val; /* init value for some transformations (and rotation angle) */ float fac; /* factor for distance based transform */ - int (*transform)(struct TransInfo *, const short *); + int (*transform)(struct TransInfo *, const int *); /* transform function pointer */ int (*handleEvent)(struct TransInfo *, struct wmEvent *); /* event handler function pointer RETURN 1 if redraw is needed */ @@ -279,7 +279,7 @@ typedef struct TransInfo { char proptext[20]; /* proportional falloff text */ float center[3]; /* center of transformation */ int center2d[2]; /* center in screen coordinates */ - short imval[2]; /* initial mouse position */ + int imval[2]; /* initial mouse position */ short event_type; /* event->type used to invoke transform */ short idx_max; /* maximum index on the input vector */ float snap[3]; /* Snapping Gears */ @@ -328,7 +328,7 @@ typedef struct TransInfo { struct Scene *scene; struct ToolSettings *settings; struct wmTimer *animtimer; - short mval[2]; /* current mouse position */ + int mval[2]; /* current mouse position */ struct Object *obedit; void *draw_handle_apply; void *draw_handle_view; @@ -458,7 +458,7 @@ void transformApply(struct bContext *C, TransInfo *t); int transformEnd(struct bContext *C, TransInfo *t); void setTransformViewMatrices(TransInfo *t); -void convertViewVec(TransInfo *t, float *vec, short dx, short dy); +void convertViewVec(TransInfo *t, float *vec, int dx, int dy); void projectIntView(TransInfo *t, float *vec, int *adr); void projectFloatView(TransInfo *t, float *vec, float *adr); @@ -467,81 +467,81 @@ void removeAspectRatio(TransInfo *t, float *vec); void initWarp(TransInfo *t); int handleEventWarp(TransInfo *t, struct wmEvent *event); -int Warp(TransInfo *t, const short mval[2]); +int Warp(TransInfo *t, const int mval[2]); void initShear(TransInfo *t); int handleEventShear(TransInfo *t, struct wmEvent *event); -int Shear(TransInfo *t, const short mval[2]); +int Shear(TransInfo *t, const int mval[2]); void initResize(TransInfo *t); -int Resize(TransInfo *t, const short mval[2]); +int Resize(TransInfo *t, const int mval[2]); void initTranslation(TransInfo *t); -int Translation(TransInfo *t, const short mval[2]); +int Translation(TransInfo *t, const int mval[2]); void initToSphere(TransInfo *t); -int ToSphere(TransInfo *t, const short mval[2]); +int ToSphere(TransInfo *t, const int mval[2]); void initRotation(TransInfo *t); -int Rotation(TransInfo *t, const short mval[2]); +int Rotation(TransInfo *t, const int mval[2]); void initShrinkFatten(TransInfo *t); -int ShrinkFatten(TransInfo *t, const short mval[2]); +int ShrinkFatten(TransInfo *t, const int mval[2]); void initTilt(TransInfo *t); -int Tilt(TransInfo *t, const short mval[2]); +int Tilt(TransInfo *t, const int mval[2]); void initCurveShrinkFatten(TransInfo *t); -int CurveShrinkFatten(TransInfo *t, const short mval[2]); +int CurveShrinkFatten(TransInfo *t, const int mval[2]); void initTrackball(TransInfo *t); -int Trackball(TransInfo *t, const short mval[2]); +int Trackball(TransInfo *t, const int mval[2]); void initPushPull(TransInfo *t); -int PushPull(TransInfo *t, const short mval[2]); +int PushPull(TransInfo *t, const int mval[2]); void initBevel(TransInfo *t); int handleEventBevel(TransInfo *t, struct wmEvent *event); -int Bevel(TransInfo *t, const short mval[2]); +int Bevel(TransInfo *t, const int mval[2]); void initBevelWeight(TransInfo *t); -int BevelWeight(TransInfo *t, const short mval[2]); +int BevelWeight(TransInfo *t, const int mval[2]); void initCrease(TransInfo *t); -int Crease(TransInfo *t, const short mval[2]); +int Crease(TransInfo *t, const int mval[2]); void initBoneSize(TransInfo *t); -int BoneSize(TransInfo *t, const short mval[2]); +int BoneSize(TransInfo *t, const int mval[2]); void initBoneEnvelope(TransInfo *t); -int BoneEnvelope(TransInfo *t, const short mval[2]); +int BoneEnvelope(TransInfo *t, const int mval[2]); void initBoneRoll(TransInfo *t); -int BoneRoll(TransInfo *t, const short mval[2]); +int BoneRoll(TransInfo *t, const int mval[2]); void initEdgeSlide(TransInfo *t); -int EdgeSlide(TransInfo *t, const short mval[2]); +int EdgeSlide(TransInfo *t, const int mval[2]); void initTimeTranslate(TransInfo *t); -int TimeTranslate(TransInfo *t, const short mval[2]); +int TimeTranslate(TransInfo *t, const int mval[2]); void initTimeSlide(TransInfo *t); -int TimeSlide(TransInfo *t, const short mval[2]); +int TimeSlide(TransInfo *t, const int mval[2]); void initTimeScale(TransInfo *t); -int TimeScale(TransInfo *t, const short mval[2]); +int TimeScale(TransInfo *t, const int mval[2]); void initBakeTime(TransInfo *t); -int BakeTime(TransInfo *t, const short mval[2]); +int BakeTime(TransInfo *t, const int mval[2]); void initMirror(TransInfo *t); -int Mirror(TransInfo *t, const short mval[2]); +int Mirror(TransInfo *t, const int mval[2]); void initAlign(TransInfo *t); -int Align(TransInfo *t, const short mval[2]); +int Align(TransInfo *t, const int mval[2]); void initSeqSlide(TransInfo *t); -int SeqSlide(TransInfo *t, const short mval[2]); +int SeqSlide(TransInfo *t, const int mval[2]); void drawPropCircle(const struct bContext *C, TransInfo *t); @@ -645,12 +645,12 @@ typedef enum { INPUT_CUSTOM_RATIO } MouseInputMode; -void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], short mval[2]); +void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], int mval[2]); void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode); int handleMouseInput(struct TransInfo *t, struct MouseInput *mi, struct wmEvent *event); -void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, short mval[2], float output[3]); +void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, int mval[2], float output[3]); -void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2]); +void setCustomPoints(TransInfo *t, MouseInput *mi, int start[2], int end[2]); void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3])); /*********************** Generics ********************************/ diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 16a943baabe..0ca0812f050 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -665,7 +665,7 @@ void drawConstraint(TransInfo *t) char col2[3] = {255,255,255}; int depth_test_enabled; - convertViewVec(t, vec, (short)(t->mval[0] - t->con.imval[0]), (short)(t->mval[1] - t->con.imval[1])); + convertViewVec(t, vec, (t->mval[0] - t->con.imval[0]), (t->mval[1] - t->con.imval[1])); add_v3_v3(vec, tc->center); drawLine(t, tc->center, tc->mtx[0], 'X', 0); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index fc57bad35b4..8d37b7aeabb 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5323,7 +5323,7 @@ void createTransData(bContext *C, TransInfo *t) sort_trans_data_dist(t); } - if (t->ar->regiontype == RGN_TYPE_WINDOW) + if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) { View3D *v3d = t->view; RegionView3D *rv3d = CTX_wm_region_view3d(C); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 8c7a39e5dff..67e04bbd34e 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1039,9 +1039,14 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } else { - // XXX for now, get View2D from the active region - t->view = &ar->v2d; - // XXX for now, the center point is the midpoint of the data + if(ar) { + // XXX for now, get View2D from the active region + t->view = &ar->v2d; + // XXX for now, the center point is the midpoint of the data + } + else { + t->view= NULL; + } t->around = V3D_CENTER; } diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index b6c4deffe0a..7a16e25302c 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -43,25 +43,25 @@ /* ************************** INPUT FROM MOUSE *************************** */ -static void InputVector(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) +static void InputVector(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float vec[3], dvec[3]; if(mi->precision) { /* calculate the main translation and the precise one separate */ - convertViewVec(t, dvec, (short)(mval[0] - mi->precision_mval[0]), (short)(mval[1] - mi->precision_mval[1])); + convertViewVec(t, dvec, (mval[0] - mi->precision_mval[0]), (mval[1] - mi->precision_mval[1])); mul_v3_fl(dvec, 0.1f); - convertViewVec(t, vec, (short)(mi->precision_mval[0] - t->imval[0]), (short)(mi->precision_mval[1] - t->imval[1])); + convertViewVec(t, vec, (mi->precision_mval[0] - t->imval[0]), (mi->precision_mval[1] - t->imval[1])); add_v3_v3v3(output, vec, dvec); } else { - convertViewVec(t, output, (short)(mval[0] - t->imval[0]), (short)(mval[1] - t->imval[1])); + convertViewVec(t, output, (mval[0] - t->imval[0]), (mval[1] - t->imval[1])); } } -static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2], float output[3]) +static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3]) { float ratio, precise_ratio, dx, dy; if(mi->precision) @@ -87,7 +87,7 @@ static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2 output[0] = ratio; } -static void InputSpringFlip(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) +static void InputSpringFlip(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { InputSpring(t, mi, mval, output); @@ -100,7 +100,7 @@ static void InputSpringFlip(TransInfo *t, MouseInput *mi, const short mval[2], f } } -static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2], float output[3]) +static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3]) { if(mi->precision) @@ -118,7 +118,7 @@ static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const short mva output[1] *= mi->factor; } -static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) { +static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float x, pad; pad = t->ar->winx / 10; @@ -135,7 +135,7 @@ static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const short mval[ output[0] = (x - pad) / (t->ar->winx - 2 * pad); } -static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) { +static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float vec[3]; InputVector(t, mi, mval, vec); @@ -144,7 +144,7 @@ static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const short mv output[0] = dot_v3v3(t->viewinv[0], vec) * 2.0f; } -static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) { +static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float y, pad; pad = t->ar->winy / 10; @@ -160,7 +160,7 @@ static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const short mval[2] output[0] = (y - pad) / (t->ar->winy - 2 * pad); } -static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const short mval[2], float output[3]) { +static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float vec[3]; InputVector(t, mi, mval, vec); @@ -169,12 +169,12 @@ static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const short mval output[0] = dot_v3v3(t->viewinv[1], vec) * 2.0f; } -void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, short start[2], short end[2]) +void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, int start[2], int end[2]) { - short *data; + int *data; if (mi->data == NULL) { - mi->data = MEM_callocN(sizeof(short) * 4, "custom points"); + mi->data = MEM_callocN(sizeof(int) * 4, "custom points"); } data = mi->data; @@ -185,12 +185,12 @@ void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, short start[2], short data[3] = end[1]; } -static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2], float output[3]) +static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3]) { float length; float distance; - short *data = mi->data; - short dx, dy; + int *data = mi->data; + int dx, dy; if (data) { dx = data[2] - data[0]; @@ -200,14 +200,14 @@ static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const short m if (mi->precision) { /* deal with Shift key by adding motion / 10 to motion before shift press */ - short mdx, mdy; + int mdx, mdy; mdx = (mi->precision_mval[0] + (float)(mval[0] - mi->precision_mval[0]) / 10.0f) - data[2]; mdy = (mi->precision_mval[1] + (float)(mval[1] - mi->precision_mval[1]) / 10.0f) - data[3]; distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f; } else { - short mdx, mdy; + int mdx, mdy; mdx = mval[0] - data[2]; mdy = mval[1] - data[3]; @@ -218,7 +218,7 @@ static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const short m } } -static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2], float output[3]) +static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3]) { double dx2 = mval[0] - mi->center[0]; double dy2 = mval[1] - mi->center[1]; @@ -279,7 +279,7 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const short mval[2] output[0] = *angle; } -void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, int center[2], short mval[2]) +void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, int center[2], int mval[2]) { mi->factor = 0; mi->precision = 0; @@ -372,7 +372,7 @@ void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3]) mi->post = post; } -void applyMouseInput(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void applyMouseInput(TransInfo *t, MouseInput *mi, int mval[2], float output[3]) { if (mi->apply != NULL) { diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 2fa094c6b8b..1933b11b308 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1487,7 +1487,7 @@ void BIF_draw_manipulator(const bContext *C) } } -static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const short mval[2], float hotspot) +static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], float hotspot) { View3D *v3d= sa->spacedata.first; RegionView3D *rv3d= ar->regiondata; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 4edaabb9508..7bdf6c909d9 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -514,7 +514,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_areaactive; + ot->poll = ED_operator_screenactive; RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); @@ -534,7 +534,7 @@ void TRANSFORM_OT_resize(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_areaactive; + ot->poll = ED_operator_screenactive; RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); @@ -555,7 +555,7 @@ void TRANSFORM_OT_trackball(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_areaactive; + ot->poll = ED_operator_screenactive; RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "angle", "", -FLT_MAX, FLT_MAX); @@ -575,7 +575,7 @@ void TRANSFORM_OT_rotate(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_areaactive; + ot->poll = ED_operator_screenactive; RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2); @@ -618,7 +618,7 @@ void TRANSFORM_OT_warp(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_areaactive; + ot->poll = ED_operator_screenactive; RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", 0, 1); @@ -639,7 +639,7 @@ void TRANSFORM_OT_shear(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_areaactive; + ot->poll = ED_operator_screenactive; RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX); @@ -660,7 +660,7 @@ void TRANSFORM_OT_push_pull(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_areaactive; + ot->poll = ED_operator_screenactive; RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX); @@ -701,7 +701,7 @@ void TRANSFORM_OT_tosphere(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_areaactive; + ot->poll = ED_operator_screenactive; RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1); @@ -721,7 +721,7 @@ void TRANSFORM_OT_mirror(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_areaactive; + ot->poll = ED_operator_screenactive; Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL); } @@ -801,7 +801,7 @@ void TRANSFORM_OT_transform(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_areaactive; + ot->poll = ED_operator_screenactive; prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", ""); RNA_def_property_flag(prop, PROP_HIDDEN); diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 60f551afa6e..9ac44f482a1 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -260,7 +260,7 @@ int ED_undo_valid(const bContext *C, const char *undoname) static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op)) { /* "last operator" should disappear, later we can tie ths with undo stack nicer */ - WM_operator_stack_clear(C); + WM_operator_stack_clear(CTX_wm_manager(C)); return ed_undo_step(C, 1, NULL); } diff --git a/source/blender/editors/util/util_intern.h b/source/blender/editors/util/util_intern.h index 9ecfb07d535..1a82668236d 100644 --- a/source/blender/editors/util/util_intern.h +++ b/source/blender/editors/util/util_intern.h @@ -37,7 +37,6 @@ /* internal exports only */ /* editmode_undo.c */ -void undo_editmode_clear(void); void undo_editmode_name(bContext *C, const char *undoname); int undo_editmode_valid(const char *undoname); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index eee7a3d7f69..20d7ea21d5c 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -419,7 +419,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float return sel; } -int ED_uvedit_median(Scene *scene, Image *ima, Object *obedit, float co[3]) +static int ED_uvedit_median(Scene *scene, Image *ima, Object *obedit, float co[3]) { EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); EditFace *efa; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index e1eab55b434..1b8acb013ea 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -893,6 +893,7 @@ void UV_OT_unwrap(wmOperatorType *ot) /* identifiers */ ot->name= "Unwrap"; + ot->description= "Unwrap the mesh of the object being edited"; ot->idname= "UV_OT_unwrap"; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index fc7e3408683..d6e2b56c065 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -34,7 +34,7 @@ set(INC ../makesrna ../../../intern/guardedalloc ../../../intern/smoke/extern - ${GLEW_INCLUDE_PATH} + ${GLEW_INCLUDE_PATH} ) set(SRC diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 25be2e2aeb4..0e7df43bd34 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -76,6 +76,8 @@ #include "smoke_API.h" +extern Material defmaterial; /* from material.c */ + /* These are some obscure rendering functions shared between the * game engine and the blender, in this module to avoid duplicaten * and abstract them away from the rest a bit */ @@ -951,7 +953,6 @@ static Material *gpu_active_node_material(Material *ma) void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, Object *ob, int glsl, int *do_alpha_pass) { - extern Material defmaterial; /* from material.c */ Material *ma; GPUMaterial *gpumat; GPUBlendMode blendmode; @@ -1042,7 +1043,6 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O int GPU_enable_material(int nr, void *attribs) { - extern Material defmaterial; /* from material.c */ GPUVertexAttribs *gattribs = attribs; GPUMaterial *gpumat; GPUBlendMode blendmode; diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h index 81512adf065..f5e2bf71468 100644 --- a/source/blender/imbuf/IMB_imbuf_types.h +++ b/source/blender/imbuf/IMB_imbuf_types.h @@ -84,11 +84,13 @@ typedef struct ImBuf { /* pixels */ unsigned int *rect; /* pixel values stored here */ - unsigned int *crect; /* color corrected pixel values stored here */ float *rect_float; /* floating point Rect equivalent Linear RGB color space - may need gamma correction to sRGB when generating 8bit representations */ - + + /* resolution - pixels per meter */ + double ppm[2]; + /* tiled pixel storage */ int tilex, tiley; int xtiles, ytiles; @@ -101,7 +103,6 @@ typedef struct ImBuf { /* parameters used by conversion between byte and float */ float dither; /* random dither value, for conversion from float -> byte rect */ short profile; /* color space/profile preset that the byte rect buffer represents */ - char profile_filename[256]; /* to be implemented properly, specific filename for custom profiles */ /* mipmapping */ struct ImBuf *mipmap[IB_MIPMAP_LEVELS]; /* MipMap levels, a series of halved images */ diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index a8b9e21331d..59772771f3b 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -84,17 +84,13 @@ void imb_freerectfloatImBuf(ImBuf *ibuf) void imb_freerectImBuf(ImBuf *ibuf) { if(ibuf==NULL) return; - - if(ibuf->crect) - MEM_freeN(ibuf->crect); if(ibuf->rect && (ibuf->mall & IB_rect)) MEM_freeN(ibuf->rect); + ibuf->rect= NULL; imb_freemipmapImBuf(ibuf); - - ibuf->rect= NULL; - ibuf->crect= NULL; + ibuf->mall &= ~IB_rect; } @@ -346,6 +342,7 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar d, unsigned int flag ibuf->depth= d; ibuf->ftype= TGA; ibuf->channels= 4; /* float option, is set to other values when buffers get assigned */ + ibuf->ppm[0]= ibuf->ppm[1]= 150.0 / 0.0254; /* 150dpi -> pixels-per-meter */ if(flags & IB_rect) { if(imb_addrectImBuf(ibuf)==FALSE) { diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 504817b263f..8df2a9f6985 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -44,6 +44,7 @@ #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" +#include "IMB_filetype.h" #include "BKE_global.h" @@ -192,7 +193,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon return 1; } -short imb_savecineon(struct ImBuf *buf, const char *myfile, int flags) +int imb_savecineon(struct ImBuf *buf, const char *myfile, int flags) { return imb_save_dpx_cineon(buf, myfile, 1, flags); } @@ -203,14 +204,14 @@ int imb_is_cineon(unsigned char *buf) return cineonIsMemFileCineon(buf); } -ImBuf *imb_loadcineon(unsigned char *mem, int size, int flags) +ImBuf *imb_loadcineon(unsigned char *mem, size_t size, int flags) { if(imb_is_cineon(mem)) return imb_load_dpx_cineon(mem, 1, size, flags); return NULL; } -short imb_save_dpx(struct ImBuf *buf, const char *myfile, int flags) +int imb_save_dpx(struct ImBuf *buf, const char *myfile, int flags) { return imb_save_dpx_cineon(buf, myfile, 0, flags); } @@ -220,7 +221,7 @@ int imb_is_dpx(unsigned char *buf) return dpxIsMemFileCineon(buf); } -ImBuf *imb_loaddpx(unsigned char *mem, int size, int flags) +ImBuf *imb_loaddpx(unsigned char *mem, size_t size, int flags) { if(imb_is_dpx(mem)) return imb_load_dpx_cineon(mem, 0, size, flags); diff --git a/source/blender/imbuf/intern/cineon/cineonfile.h b/source/blender/imbuf/intern/cineon/cineonfile.h index 31aa56f560c..896e0af65b3 100644 --- a/source/blender/imbuf/intern/cineon/cineonfile.h +++ b/source/blender/imbuf/intern/cineon/cineonfile.h @@ -126,19 +126,6 @@ typedef struct { ASCII reserved[740]; } CineonMPISpecificInformation; -#if 0 -/* create CineonFile from data in header */ -/* return 0 for OK */ -int readCineonGenericHeader(CineonFile* cineon, CineonGenericHeader* header); - -/* create header from data in CineonFile */ -int initCineonGenericHeader( - CineonFile* cineon, CineonGenericHeader* header, const char* imagename); - -/* Note: dump routine assumes network byte order */ -void dumpCineonGenericHeader(CineonGenericHeader* header); -#endif - #ifdef __cplusplus } #endif diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index fdcd3491af1..922cfcf9629 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -276,7 +276,7 @@ dumpCineonOriginationInfo(CineonOriginationInformation* originInfo) { d_printf("Input device gamma %f\n", ntohf(originInfo->input_device_gamma)); } -int +static int initCineonGenericHeader(CineonFile* cineon, CineonGenericHeader* header, const char* imagename) { fillCineonFileInfo(cineon, &header->fileInfo, imagename); @@ -287,7 +287,7 @@ initCineonGenericHeader(CineonFile* cineon, CineonGenericHeader* header, const c return 0; } -void +static void dumpCineonGenericHeader(CineonGenericHeader* header) { dumpCineonFileInfo(&header->fileInfo); dumpCineonImageInfo(&header->imageInfo); diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c index 6347eb5fdf9..d3a32774efd 100644 --- a/source/blender/imbuf/intern/cineon/logmemfile.c +++ b/source/blender/imbuf/intern/cineon/logmemfile.c @@ -27,6 +27,8 @@ #include "logImageCore.h" +#include "logmemfile.h" /* own include */ + int logimage_fseek(void* logfile, intptr_t offsett, int origin) { struct _Log_Image_File_t_ *file = (struct _Log_Image_File_t_*) logfile; diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index ceac1d2ae18..971658ff482 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -980,7 +980,7 @@ bool DirectDrawSurface::hasAlpha() const { if (header.hasDX10Header()) { -#pragma NV_MESSAGE("TODO: Update hasAlpha to handle all DX10 formats.") + /* TODO: Update hasAlpha to handle all DX10 formats. */ return header.header10.dxgiFormat == DXGI_FORMAT_BC1_UNORM || header.header10.dxgiFormat == DXGI_FORMAT_BC2_UNORM || diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 2821ba2a361..16fb1fdf4aa 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -437,7 +437,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter) hbuf= ibuf->mipmap[curmap]; hbuf->miplevel= curmap+1; - if(!hbuf || (hbuf->x == 1 && hbuf->y == 1)) + if(!hbuf || (hbuf->x <= 2 && hbuf->y <= 2)) break; curmap++; diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 200ff0af9af..6b6dcdb88af 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -257,6 +257,10 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) } + if(ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) { + png_set_pHYs(png_ptr, info_ptr, (unsigned int)(ibuf->ppm[0] + 0.5), (unsigned int)(ibuf->ppm[1] + 0.5), PNG_RESOLUTION_METER); + } + // write the file header information png_write_info(png_ptr, info_ptr); @@ -384,7 +388,19 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) if (ibuf) { ibuf->ftype = PNG; ibuf->profile = IB_PROFILE_SRGB; - } else { + + if (png_get_valid (png_ptr, info_ptr, PNG_INFO_pHYs)) { + int unit_type; + unsigned int xres, yres; + + if(png_get_pHYs(png_ptr, info_ptr, &xres, &yres, &unit_type)) + if(unit_type == PNG_RESOLUTION_METER) { + ibuf->ppm[0]= xres; + ibuf->ppm[1]= yres; + } + } + } + else { printf("Couldn't allocate memory for PNG image\n"); } diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 67d20d56466..36130aa0dbf 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -354,6 +354,25 @@ static void scanline_separate_32bit(float *rectf, float *fbuf, int scanline_w, i rectf[i*4 + chan] = fbuf[i]; } +static void imb_read_tiff_resolution(ImBuf *ibuf, TIFF *image) +{ + uint16 unit; + float xres; + float yres; + + TIFFGetFieldDefaulted(image, TIFFTAG_RESOLUTIONUNIT, &unit); + TIFFGetFieldDefaulted(image, TIFFTAG_XRESOLUTION, &xres); + TIFFGetFieldDefaulted(image, TIFFTAG_YRESOLUTION, &yres); + + if(unit == RESUNIT_CENTIMETER) { + ibuf->ppm[0]= (double)xres * 100.0; + ibuf->ppm[1]= (double)yres * 100.0; + } + else { + ibuf->ppm[0]= (double)xres / 0.0254; + ibuf->ppm[1]= (double)yres / 0.0254; + } +} /* * Use the libTIFF scanline API to read a TIFF image. @@ -369,10 +388,13 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) int ib_flag=0, row, chan; float *fbuf=NULL; unsigned short *sbuf=NULL; - + TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitspersample); TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp); /* number of 'channels' */ TIFFGetField(image, TIFFTAG_PLANARCONFIG, &config); + + imb_read_tiff_resolution(ibuf, image); + scanline = TIFFScanlineSize(image); if (bitspersample == 32) { @@ -658,6 +680,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags) unsigned char *from = NULL, *to = NULL; unsigned short *pixels16 = NULL, *to16 = NULL; float *fromf = NULL; + float xres, yres; int x, y, from_i, to_i, i; int extraSampleTypes[1] = { EXTRASAMPLE_ASSOCALPHA }; @@ -783,8 +806,18 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags) TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE); TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB); TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); - TIFFSetField(image, TIFFTAG_XRESOLUTION, 150.0); - TIFFSetField(image, TIFFTAG_YRESOLUTION, 150.0); + + + if(ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) { + xres= (float)(ibuf->ppm[0] * 0.0254); + yres= (float)(ibuf->ppm[1] * 0.0254); + } + else { + xres= yres= 150.0f; + } + + TIFFSetField(image, TIFFTAG_XRESOLUTION, xres); + TIFFSetField(image, TIFFTAG_YRESOLUTION, yres); TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); if(TIFFWriteEncodedStrip(image, 0, (bitspersample == 16)? (unsigned char*)pixels16: pixels, diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 97ae2a579fc..53db4f082d5 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -123,12 +123,14 @@ typedef struct Library { struct Library *parent; /* set for indirectly linked libs, used in the outliner and while reading */ } Library; -#define PREVIEW_MIPMAPS 2 -#define PREVIEW_MIPMAP_ZERO 0 -#define PREVIEW_MIPMAP_LARGE 1 +enum eIconSizes { + ICON_SIZE_ICON, + ICON_SIZE_PREVIEW, +}; +#define NUM_ICON_SIZES (ICON_SIZE_PREVIEW + 1) typedef struct PreviewImage { - /* All values of 2 are really PREVIEW_MIPMAPS */ + /* All values of 2 are really NUM_ICON_SIZES */ unsigned int w[2]; unsigned int h[2]; short changed[2]; diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h index 4ebd7318ea8..952b4e799b5 100644 --- a/source/blender/makesdna/DNA_camera_types.h +++ b/source/blender/makesdna/DNA_camera_types.h @@ -47,7 +47,9 @@ typedef struct Camera { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - short type, flag; + char type; /* CAM_PERSP or CAM_ORTHO */ + char dtx; /* draw type extra */ + short flag; float passepartalpha; float clipsta, clipend; float lens, ortho_scale, drawsize; @@ -69,6 +71,16 @@ typedef struct Camera { #define CAM_PERSP 0 #define CAM_ORTHO 1 +/* dtx */ +#define CAM_DTX_CENTER 1 +#define CAM_DTX_CENTER_DIAG 2 +#define CAM_DTX_THIRDS 4 +#define CAM_DTX_GOLDEN 8 +#define CAM_DTX_GOLDEN_TRI_A 16 +#define CAM_DTX_GOLDEN_TRI_B 32 +#define CAM_DTX_HARMONY_TRI_A 64 +#define CAM_DTX_HARMONY_TRI_B 128 + /* flag */ #define CAM_SHOWLIMITS 1 #define CAM_SHOWMIST 2 diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h index e8360b99d69..6f4c16cb7f3 100644 --- a/source/blender/makesdna/DNA_object_fluidsim.h +++ b/source/blender/makesdna/DNA_object_fluidsim.h @@ -42,7 +42,10 @@ extern "C" { struct Mesh; struct Ipo; -struct MVert; + +typedef struct FluidVertexVelocity { + float vel[3]; +} FluidVertexVelocity; typedef struct FluidsimSettings { struct FluidsimModifierData *fmd; /* for fast RNA access */ @@ -82,8 +85,6 @@ typedef struct FluidsimSettings { /* store pointer to original mesh (for replacing the current one) */ struct Mesh *orgMesh; - /* pointer to the currently loaded fluidsim mesh */ - struct Mesh *meshSurface; /* a mesh to display the bounding box used for simulation */ struct Mesh *meshBB; @@ -122,8 +123,10 @@ typedef struct FluidsimSettings { /* testing vars */ float farFieldSize; - /* save fluidsurface normals in mvert.no, and surface vertex velocities (if available) in mvert.co */ - struct MVert *meshSurfNormals; + /* vertex velocities of simulated fluid mesh */ + struct FluidVertexVelocity *meshVelocities; + /* number of vertices in simulated fluid mesh */ + int totvert; /* Fluid control settings */ float cpsTimeStart; @@ -136,6 +139,8 @@ typedef struct FluidsimSettings { float velocityforceRadius; int lastgoodframe; + + int pad; } FluidsimSettings; diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index c97a1d8fef5..54a885a0860 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -259,6 +259,9 @@ typedef struct Object { ListBase gpulamp; /* runtime, for lamps only */ ListBase pc_ids; ListBase *duplilist; /* for temporary dupli list storage, only for use by RNA API */ + + float ima_ofs[2]; /* offset for image empties */ + char pad3[8]; } Object; /* Warning, this is not used anymore because hooks are now modifiers */ @@ -399,6 +402,7 @@ extern Object workob; #define OB_CUBE 5 #define OB_EMPTY_SPHERE 6 #define OB_EMPTY_CONE 7 +#define OB_EMPTY_IMAGE 8 /* boundtype */ #define OB_BOUND_BOX 0 diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 22f0c23ea9b..f89cc9d518a 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -310,7 +310,8 @@ typedef struct SpeedControlVars { #define SEQ_COLOR 28 #define SEQ_SPEED 29 #define SEQ_MULTICAM 30 -#define SEQ_EFFECT_MAX 30 +#define SEQ_ADJUSTMENT 31 +#define SEQ_EFFECT_MAX 31 #define STRIPELEM_FAILED 0 #define STRIPELEM_OK 1 diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index c9a440522d1..f4b4ef37ad9 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -96,10 +96,13 @@ typedef struct RegionView3D { float zfac; /* initgrabz() result */ float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */ float pixsize; /* runtime only */ - float ofs[3]; /* view center & orbit pivot, negative of worldspace location */ + float ofs[3]; /* view center & orbit pivot, negative of worldspace location, + * also matches -viewinv[3][0:3] in ortho mode.*/ short camzoom; short twdrawflag; - int pad; + char is_persp; /* check if persp/ortho view, since 'persp' cant be used for this since + * it can have cameras assigned as well. (only set in setwinmatrixview3d) */ + char pad[3]; short rflag, viewlock; short persp; @@ -163,26 +166,21 @@ typedef struct View3D { * OB_SHADED or OB_TEXTURE */ short drawtype; short ob_centre_cursor; /* optional bool for 3d cursor to define center */ - short scenelock, around, pad3; + short scenelock, around; short flag, flag2; - short pivot_last; /* pivot_last is for rotating around the last edited element */ - float lens, grid; - float gridview; /* XXX deprecated, now in RegionView3D */ float near, far; float ofs[3]; /* XXX deprecated */ float cursor[3]; - short gridlines, pad4; - short gridflag; - short gridsubdiv; /* Number of subdivisions in the grid between each highlighted grid line */ short modeselect; - short keyflags; /* flags for display of keyframes */ - + short gridlines; + short gridsubdiv; /* Number of subdivisions in the grid between each highlighted grid line */ + char gridflag; + /* transform widget info */ - short twtype, twmode, twflag; - short twdrawflag; /* XXX deprecated */ + char twtype, twmode, twflag, pad2[2]; /* afterdraw, for xray & transparent */ struct ListBase afterdraw_transp; @@ -195,7 +193,7 @@ typedef struct View3D { char ndofmode; /* mode of transform for 6DOF devices -1 not found, 0 normal, 1 fly, 2 ob transform */ char ndoffilter; /* filter for 6DOF devices 0 normal, 1 dominant */ - void *properties_storage; /* Nkey panel stores stuff here, not in file */ + void *properties_storage; /* Nkey panel stores stuff here (runtime only!) */ /* XXX depricated? */ struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */ @@ -231,10 +229,11 @@ typedef struct View3D { #define RV3D_BOXCLIP 4 /* RegionView3d->view */ -#define RV3D_VIEW_FRONT 1 +#define RV3D_VIEW_USER 0 +#define RV3D_VIEW_FRONT 1 #define RV3D_VIEW_BACK 2 #define RV3D_VIEW_LEFT 3 -#define RV3D_VIEW_RIGHT 4 +#define RV3D_VIEW_RIGHT 4 #define RV3D_VIEW_TOP 5 #define RV3D_VIEW_BOTTOM 6 #define RV3D_VIEW_PERSPORTHO 7 @@ -244,6 +243,7 @@ typedef struct View3D { #define V3D_RENDER_OVERRIDE 4 #define V3D_SOLID_TEX 8 #define V3D_DISPGP 16 +#define V3D_LOCK_CAMERA 32 /* View3D->around */ #define V3D_CENTER 0 diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 3072c2c3430..31e59f18626 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -316,10 +316,4 @@ typedef struct wmOperator { /* wmOperator flag */ #define OP_GRAB_POINTER 1 -typedef enum wmRadialControlMode { - WM_RADIALCONTROL_SIZE, - WM_RADIALCONTROL_STRENGTH, - WM_RADIALCONTROL_ANGLE -} wmRadialControlMode; - #endif /* DNA_WINDOWMANAGER_TYPES_H */ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 4975b1bc984..2e71ebe4cc9 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -31,7 +31,6 @@ #include <stdarg.h> -#include "DNA_listBase.h" #include "RNA_types.h" #ifdef __cplusplus @@ -40,6 +39,7 @@ extern "C" { struct bContext; struct ID; +struct ListBase; struct Main; struct ReportList; struct Scene; @@ -53,6 +53,7 @@ extern StructRNA RNA_ActionGroup; extern StructRNA RNA_Actuator; extern StructRNA RNA_ActuatorSensor; extern StructRNA RNA_Addon; +extern StructRNA RNA_AdjustmentSequence; extern StructRNA RNA_AlwaysSensor; extern StructRNA RNA_AndController; extern StructRNA RNA_AnimData; @@ -627,6 +628,7 @@ int RNA_struct_is_a(StructRNA *type, StructRNA *srna); StructRegisterFunc RNA_struct_register(StructRNA *type); StructUnregisterFunc RNA_struct_unregister(StructRNA *type); +void **RNA_struct_instance(PointerRNA *ptr); void *RNA_struct_py_type_get(StructRNA *srna); void RNA_struct_py_type_set(StructRNA *srna, void *py_type); @@ -919,7 +921,7 @@ int RNA_property_is_idprop(PropertyRNA *prop); /* python compatible string representation of this property, (must be freed!) */ char *RNA_property_as_string(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop); -char *RNA_pointer_as_string(PointerRNA *ptr); +char *RNA_pointer_as_string(struct bContext *C, PointerRNA *ptr); /* Function */ diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index f131f7c9ebe..f52a69182b5 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -60,7 +60,7 @@ void RNA_def_struct_flag(StructRNA *srna, int flag); void RNA_def_struct_clear_flag(StructRNA *srna, int flag); void RNA_def_struct_refine_func(StructRNA *srna, const char *refine); void RNA_def_struct_idprops_func(StructRNA *srna, const char *refine); -void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg); +void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance); void RNA_def_struct_path_func(StructRNA *srna, const char *path); void RNA_def_struct_identifier(StructRNA *srna, const char *identifier); void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description); diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 3a15146770f..ec6f05c0e6a 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -43,6 +43,7 @@ struct StructRNA; struct BlenderRNA; struct IDProperty; struct bContext; +struct Main; struct ReportList; /** Pointer @@ -329,9 +330,10 @@ typedef enum StructFlag { typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function); typedef int (*StructCallbackFunc)(struct bContext *C, struct PointerRNA *ptr, struct FunctionRNA *func, ParameterList *list); typedef void (*StructFreeFunc)(void *data); -typedef struct StructRNA *(*StructRegisterFunc)(struct bContext *C, struct ReportList *reports, void *data, +typedef struct StructRNA *(*StructRegisterFunc)(struct Main *bmain, struct ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free); -typedef void (*StructUnregisterFunc)(const struct bContext *C, struct StructRNA *type); +typedef void (*StructUnregisterFunc)(struct Main *bmain, struct StructRNA *type); +typedef void **(*StructInstanceFunc)(PointerRNA *ptr); typedef struct StructRNA StructRNA; diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index a2d332ec807..322101a58cf 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -43,10 +43,6 @@ if env['WITH_BF_QUICKTIME']: defs.append('WITH_QUICKTIME') incs += ' ../quicktime' -if env['WITH_BF_LCMS']: - defs.append('WITH_LCMS') - incs += ' ' + env['BF_LCMS_INC'] - if env['WITH_BF_GAMEENGINE']: defs.append('WITH_GAMEENGINE') diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 68c2f930180..2c6c503fd3c 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -176,11 +176,6 @@ if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() -if(WITH_LCMS) - list(APPEND INC ${LCMS_INCLUDE_DIR}) - add_definitions(-DWITH_LCMS) -endif() - if(NOT WITH_MOD_FLUID) add_definitions(-DDISABLE_ELBEEM) endif() @@ -224,7 +219,7 @@ blender_include_dirs( ../../../../intern/audaspace/intern ../../../../intern/guardedalloc ../../../../intern/memutil - ${GLEW_INCLUDE_PATH} + ${GLEW_INCLUDE_PATH} ) add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC}) diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index c48b479da16..421c3a60691 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -65,9 +65,6 @@ if env['WITH_BF_QUICKTIME']: defs.append('WITH_QUICKTIME') incs += ' ../../quicktime' -if env['WITH_BF_LCMS']: - defs.append('WITH_LCMS') - if env['WITH_BF_GAMEENGINE']: defs.append('WITH_GAMEENGINE') diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 8756e352838..d45864812f6 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -193,7 +193,17 @@ static int replace_if_different(char *tmpfile, const char *dep_files[]) #undef REN_IF_DIFF } +/* Helper to solve keyword problems with C/C++ */ +static const char *rna_safe_id(const char *id) +{ + if(strcmp(id, "default") == 0) + return "default_value"; + else if(strcmp(id, "operator") == 0) + return "operator_value"; + + return id; +} /* Sorting */ @@ -501,7 +511,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr } - func= rna_alloc_function_name(srna->identifier, prop->identifier, "get"); + func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); switch(prop->type) { case PROP_STRING: { @@ -569,7 +579,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr rna_print_data_get(f, dp); if(prop->flag & PROP_DYNAMIC) { - char *lenfunc= rna_alloc_function_name(srna->identifier, prop->identifier, "get_length"); + char *lenfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get_length"); fprintf(f, " int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n"); fprintf(f, " int len= %s(ptr, arraylen);\n\n", lenfunc); fprintf(f, " for(i=0; i<len; i++) {\n"); @@ -684,7 +694,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr } } - func= rna_alloc_function_name(srna->identifier, prop->identifier, "set"); + func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set"); switch(prop->type) { case PROP_STRING: { @@ -754,7 +764,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr rna_print_data_get(f, dp); if(prop->flag & PROP_DYNAMIC) { - char *lenfunc= rna_alloc_function_name(srna->identifier, prop->identifier, "set_length"); + char *lenfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set_length"); fprintf(f, " int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n"); fprintf(f, " int len= %s(ptr, arraylen);\n\n", lenfunc); fprintf(f, " for(i=0; i<len; i++) {\n"); @@ -851,7 +861,7 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA } } - func= rna_alloc_function_name(srna->identifier, prop->identifier, "length"); + func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length"); fprintf(f, "int %s(PointerRNA *ptr)\n", func); fprintf(f, "{\n"); @@ -873,7 +883,7 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA } } - func= rna_alloc_function_name(srna->identifier, prop->identifier, "length"); + func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length"); fprintf(f, "int %s(PointerRNA *ptr)\n", func); fprintf(f, "{\n"); @@ -908,7 +918,7 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA * } } - func= rna_alloc_function_name(srna->identifier, prop->identifier, "begin"); + func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "begin"); fprintf(f, "void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func); fprintf(f, "{\n"); @@ -940,7 +950,7 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA * fprintf(f, "\n rna_iterator_listbase_begin(iter, data->%s, NULL);\n", dp->dnaname); } - getfunc= rna_alloc_function_name(srna->identifier, prop->identifier, "get"); + getfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); fprintf(f, "\n if(iter->valid)\n"); fprintf(f, " iter->ptr= %s(iter);\n", getfunc); @@ -970,7 +980,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property else return NULL; } - func= rna_alloc_function_name(srna->identifier, prop->identifier, "lookup_int"); + func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_int"); fprintf(f, "int %s(PointerRNA *ptr, int index, PointerRNA *r_ptr)\n", func); fprintf(f, "{\n"); @@ -984,7 +994,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property fprintf(f, " int found= 0;\n"); fprintf(f, " CollectionPropertyIterator iter;\n\n"); - fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, prop->identifier); + fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier)); fprintf(f, " if(iter.valid){\n"); if(strcmp(nextfunc, "rna_iterator_array_next") == 0) { @@ -1022,9 +1032,9 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property fprintf(f, " }\n"); } - fprintf(f, " if(found) *r_ptr = %s_%s_get(&iter);\n", srna->identifier, prop->identifier); + fprintf(f, " if(found) *r_ptr = %s_%s_get(&iter);\n", srna->identifier, rna_safe_id(prop->identifier)); fprintf(f, " }\n\n"); - fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, prop->identifier); + fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier)); fprintf(f, " return found;\n"); @@ -1061,13 +1071,13 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p if(!manualfunc) return NULL; - func= rna_alloc_function_name(srna->identifier, prop->identifier, "next"); + func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "next"); fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func); fprintf(f, "{\n"); fprintf(f, " %s(iter);\n", manualfunc); - getfunc= rna_alloc_function_name(srna->identifier, prop->identifier, "get"); + getfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); fprintf(f, "\n if(iter->valid)\n"); fprintf(f, " iter->ptr= %s(iter);\n", getfunc); @@ -1084,7 +1094,7 @@ static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *pr if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL) return NULL; - func= rna_alloc_function_name(srna->identifier, prop->identifier, "end"); + func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "end"); fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func); fprintf(f, "{\n"); @@ -1272,7 +1282,7 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR if(prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN)) return; - func= rna_alloc_function_name(srna->identifier, prop->identifier, ""); + func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), ""); switch(prop->type) { case PROP_BOOLEAN: @@ -1281,10 +1291,14 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR fprintf(f, "int %sget(PointerRNA *ptr);\n", func); //fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func); } - else { + else if(prop->arraydimension && prop->totarraylength) { fprintf(f, "void %sget(PointerRNA *ptr, int values[%d]);\n", func, prop->totarraylength); //fprintf(f, "void %sset(PointerRNA *ptr, const int values[%d]);\n", func, prop->arraylength); } + else { + fprintf(f, "void %sget(PointerRNA *ptr, int values[]);\n", func); + //fprintf(f, "void %sset(PointerRNA *ptr, const int values[]);\n", func); + } break; } case PROP_FLOAT: { @@ -1292,10 +1306,14 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR fprintf(f, "float %sget(PointerRNA *ptr);\n", func); //fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func); } - else { + else if(prop->arraydimension && prop->totarraylength) { fprintf(f, "void %sget(PointerRNA *ptr, float values[%d]);\n", func, prop->totarraylength); //fprintf(f, "void %sset(PointerRNA *ptr, const float values[%d]);\n", func, prop->arraylength); } + else { + fprintf(f, "void %sget(PointerRNA *ptr, float values[]);\n", func); + //fprintf(f, "void %sset(PointerRNA *ptr, const float values[]);\n", func); + } break; } case PROP_ENUM: { @@ -1368,23 +1386,23 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property switch(prop->type) { case PROP_BOOLEAN: { if(!prop->arraydimension) - fprintf(f, "\tbool %s(void);", prop->identifier); + fprintf(f, "\tinline bool %s(void);", rna_safe_id(prop->identifier)); else - fprintf(f, "\tArray<int, %d> %s(void);", prop->totarraylength, prop->identifier); + fprintf(f, "\tinline Array<int, %d> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_INT: { if(!prop->arraydimension) - fprintf(f, "\tint %s(void);", prop->identifier); + fprintf(f, "\tinline int %s(void);", rna_safe_id(prop->identifier)); else - fprintf(f, "\tArray<int, %d> %s(void);", prop->totarraylength, prop->identifier); + fprintf(f, "\tinline Array<int, %d> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_FLOAT: { if(!prop->arraydimension) - fprintf(f, "\tfloat %s(void);", prop->identifier); + fprintf(f, "\tinline float %s(void);", rna_safe_id(prop->identifier)); else - fprintf(f, "\tArray<float, %d> %s(void);", prop->totarraylength, prop->identifier); + fprintf(f, "\tinline Array<float, %d> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_ENUM: { @@ -1392,38 +1410,38 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property int i; if(eprop->item) { - fprintf(f, "\tenum %s_enum {\n", prop->identifier); + fprintf(f, "\tenum %s_enum {\n", rna_safe_id(prop->identifier)); for(i=0; i<eprop->totitem; i++) if(eprop->item[i].identifier[0]) - fprintf(f, "\t\t%s_%s = %d,\n", prop->identifier, eprop->item[i].identifier, eprop->item[i].value); + fprintf(f, "\t\t%s_%s = %d,\n", rna_safe_id(prop->identifier), eprop->item[i].identifier, eprop->item[i].value); fprintf(f, "\t};\n"); } - fprintf(f, "\t%s_enum %s(void);", prop->identifier, prop->identifier); + fprintf(f, "\tinline %s_enum %s(void);", rna_safe_id(prop->identifier), rna_safe_id(prop->identifier)); break; } case PROP_STRING: { - fprintf(f, "\tstd::string %s(void);", prop->identifier); + fprintf(f, "\tinline std::string %s(void);", rna_safe_id(prop->identifier)); break; } case PROP_POINTER: { PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; if(pprop->type) - fprintf(f, "\t%s %s(void);", (char*)pprop->type, prop->identifier); + fprintf(f, "\tinline %s %s(void);", (char*)pprop->type, rna_safe_id(prop->identifier)); else - fprintf(f, "\t%s %s(void);", "UnknownType", prop->identifier); + fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier)); break; } case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop; if(cprop->item_type) - fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (char*)cprop->item_type, srna->identifier, prop->identifier); + fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (char*)cprop->item_type, srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier); + fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier)); break; } } @@ -1443,41 +1461,41 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe switch(prop->type) { case PROP_BOOLEAN: { if(!prop->arraydimension) - fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, prop->identifier); + fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, prop->identifier); + fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_INT: { if(!prop->arraydimension) - fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, prop->identifier); + fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, prop->identifier); + fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_FLOAT: { if(!prop->arraydimension) - fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, prop->identifier); + fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, prop->identifier); + fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_ENUM: { - fprintf(f, "\tENUM_PROPERTY(%s_enum, %s, %s)", prop->identifier, srna->identifier, prop->identifier); + fprintf(f, "\tENUM_PROPERTY(%s_enum, %s, %s)", rna_safe_id(prop->identifier), srna->identifier, rna_safe_id(prop->identifier)); break; } case PROP_STRING: { - fprintf(f, "\tSTRING_PROPERTY(%s, %s)", srna->identifier, prop->identifier); + fprintf(f, "\tSTRING_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); break; } case PROP_POINTER: { PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; if(pprop->type) - fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (char*)pprop->type, srna->identifier, prop->identifier); + fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (char*)pprop->type, srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier); + fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier)); break; } case PROP_COLLECTION: { @@ -2337,6 +2355,7 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f) fprintf(f, "\t%s,\n", rna_function_string(srna->path)); fprintf(f, "\t%s,\n", rna_function_string(srna->reg)); fprintf(f, "\t%s,\n", rna_function_string(srna->unreg)); + fprintf(f, "\t%s,\n", rna_function_string(srna->instance)); fprintf(f, "\t%s,\n", rna_function_string(srna->idproperties)); if(srna->reg && !srna->refine) { @@ -2547,40 +2566,40 @@ static const char *cpp_classes = "" "\n" "#include <string>\n" "\n" -"namespace RNA {\n" +"namespace BL {\n" "\n" "#define BOOLEAN_PROPERTY(sname, identifier) \\\n" -" bool sname::identifier(void) { return (bool)sname##_##identifier##_get(&ptr); }\n" +" inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr)? true: false; }\n" "\n" "#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n" -" Array<int,size> sname::identifier(void) \\\n" +" inline Array<int,size> sname::identifier(void) \\\n" " { Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; }\n" "\n" "#define INT_PROPERTY(sname, identifier) \\\n" -" int sname::identifier(void) { return sname##_##identifier##_get(&ptr); }\n" +" inline int sname::identifier(void) { return sname##_##identifier##_get(&ptr); }\n" "\n" "#define INT_ARRAY_PROPERTY(sname, size, identifier) \\\n" -" Array<int,size> sname::identifier(void) \\\n" +" inline Array<int,size> sname::identifier(void) \\\n" " { Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; }\n" "\n" "#define FLOAT_PROPERTY(sname, identifier) \\\n" -" float sname::identifier(void) { return sname##_##identifier##_get(&ptr); }\n" +" inline float sname::identifier(void) { return sname##_##identifier##_get(&ptr); }\n" "\n" "#define FLOAT_ARRAY_PROPERTY(sname, size, identifier) \\\n" -" Array<float,size> sname::identifier(void) \\\n" +" inline Array<float,size> sname::identifier(void) \\\n" " { Array<float, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; }\n" "\n" "#define ENUM_PROPERTY(type, sname, identifier) \\\n" -" sname::type sname::identifier(void) { return (type)sname##_##identifier##_get(&ptr); }\n" +" inline sname::type sname::identifier(void) { return (type)sname##_##identifier##_get(&ptr); }\n" "\n" "#define STRING_PROPERTY(sname, identifier) \\\n" -" std::string sname::identifier(void) { \\\n" +" inline std::string sname::identifier(void) { \\\n" " int len= sname##_##identifier##_length(&ptr); \\\n" " std::string str; str.resize(len); \\\n" " sname##_##identifier##_get(&ptr, &str[0]); return str; } \\\n" "\n" "#define POINTER_PROPERTY(type, sname, identifier) \\\n" -" type sname::identifier(void) { return type(sname##_##identifier##_get(&ptr)); }\n" +" inline type sname::identifier(void) { return type(sname##_##identifier##_get(&ptr)); }\n" "\n" "#define COLLECTION_PROPERTY(type, sname, identifier) \\\n" " typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n" @@ -2592,7 +2611,7 @@ static const char *cpp_classes = "" "public:\n" " Pointer(const PointerRNA& p) : ptr(p) { }\n" " operator const PointerRNA&() { return ptr; }\n" -" bool is_a(StructRNA *type) { return RNA_struct_is_a(&ptr, type); }\n" +" bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type)? true: false; }\n" " operator void*() { return ptr.data; }\n" " operator bool() { return ptr.data != NULL; }\n" "\n" @@ -2616,12 +2635,13 @@ static const char *cpp_classes = "" "public:\n" " CollectionIterator() : t(iter.ptr), init(false) { iter.valid= false; }\n" " ~CollectionIterator(void) { if(init) Tend(&iter); };\n" -" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator=(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy)\n" -" { if(init) Tend(&iter); iter= copy.iter; if(iter.internal) iter.internal= MEM_dupallocN(iter.internal); t= copy.t; init= copy.init; return *this; }\n" "\n" " operator bool(void)\n" " { return iter.valid != 0; }\n" " const CollectionIterator<T, Tbegin, Tnext, Tend>& operator++() { Tnext(&iter); t = T(iter.ptr); return *this; }\n" +" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator=(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy)\n" +" { if(init) Tend(&iter); iter= copy.iter; if(iter.internal) iter.internal= MEM_dupallocN(iter.internal); t= copy.t; init= copy.init; return *this; }\n" +"\n" " T& operator*(void) { return t; }\n" " T* operator->(void) { return &t; }\n" " bool operator==(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) { return iter.valid == other.iter.valid; }\n" @@ -2662,7 +2682,7 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f) fprintf(f, "/* Automatically generated classes for the Data API.\n" " Do not edit manually, changes will be overwritten. */\n\n"); - + fprintf(f, "#include \"RNA_blender.h\"\n"); fprintf(f, "#include \"RNA_types.h\"\n"); diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index e2c25972bdf..d31043ef1d9 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -213,12 +213,12 @@ IDProperty *rna_PropertyGroup_idprops(PointerRNA *ptr, int create) return ptr->data; } -void rna_PropertyGroup_unregister(const bContext *C, StructRNA *type) +void rna_PropertyGroup_unregister(Main *bmain, StructRNA *type) { RNA_struct_free(&BLENDER_RNA, type); } -StructRNA *rna_PropertyGroup_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +StructRNA *rna_PropertyGroup_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { PointerRNA dummyptr; @@ -387,7 +387,7 @@ static void rna_def_ID_properties(BlenderRNA *brna) RNA_def_struct_sdna(srna, "IDPropertyGroup"); RNA_def_struct_ui_text(srna, "ID Property Group", "Group of ID properties"); RNA_def_struct_idprops_func(srna, "rna_PropertyGroup_idprops"); - RNA_def_struct_register_funcs(srna, "rna_PropertyGroup_register", "rna_PropertyGroup_unregister"); + RNA_def_struct_register_funcs(srna, "rna_PropertyGroup_register", "rna_PropertyGroup_unregister", NULL); RNA_def_struct_refine_func(srna, "rna_PropertyGroup_refine"); /* important so python types can have their name used in list views diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 03622ec756f..ff54ac6254f 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -681,6 +681,18 @@ StructUnregisterFunc RNA_struct_unregister(StructRNA *type) return NULL; } +void **RNA_struct_instance(PointerRNA *ptr) +{ + StructRNA *type= ptr->type; + + do { + if(type->instance) + return type->instance(ptr); + } while((type=type->base)); + + return NULL; +} + void *RNA_struct_py_type_get(StructRNA *srna) { return srna->py_type; @@ -1107,21 +1119,26 @@ int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, con { EnumPropertyItem *item, *item_array; int free, found; - + RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free); - - for(item= item_array; item->identifier; item++) { - if(item->identifier[0] && strcmp(item->identifier, identifier)==0) { - *value = item->value; - break; + + if(item_array) { + for(item= item_array; item->identifier; item++) { + if(item->identifier[0] && strcmp(item->identifier, identifier)==0) { + *value = item->value; + break; + } } - } - - found= (item->identifier != NULL); /* could be alloc'd, assign before free */ - if(free) - MEM_freeN(item_array); + found= (item->identifier != NULL); /* could be alloc'd, assign before free */ + if(free) { + MEM_freeN(item_array); + } + } + else { + found= 0; + } return found; } @@ -4036,8 +4053,9 @@ int RNA_property_is_idprop(PropertyRNA *prop) } /* string representation of a property, python - * compatible but can be used for display too*/ -char *RNA_pointer_as_string(PointerRNA *ptr) + * compatible but can be used for display too, + * context may be NULL */ +char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr) { DynStr *dynstr= BLI_dynstr_new(); char *cstring; @@ -4057,7 +4075,7 @@ char *RNA_pointer_as_string(PointerRNA *ptr) BLI_dynstr_append(dynstr, ", "); first_time= 0; - cstring = RNA_property_as_string(NULL, ptr, prop); + cstring = RNA_property_as_string(C, ptr, prop); BLI_dynstr_appendf(dynstr, "\"%s\":%s", propname, cstring); MEM_freeN(cstring); } @@ -4175,7 +4193,7 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop) case PROP_POINTER: { PointerRNA tptr= RNA_property_pointer_get(ptr, prop); - cstring= RNA_pointer_as_string(&tptr); + cstring= RNA_pointer_as_string(C, &tptr); BLI_dynstr_append(dynstr, cstring); MEM_freeN(cstring); break; @@ -4194,7 +4212,7 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop) first_time= 0; /* now get every prop of the collection */ - cstring= RNA_pointer_as_string(&itemptr); + cstring= RNA_pointer_as_string(C, &itemptr); BLI_dynstr_append(dynstr, cstring); MEM_freeN(cstring); } diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 106c51865fd..7f817aa5b4b 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -188,7 +188,7 @@ static StructRNA *rna_KeyingSetInfo_refine(PointerRNA *ptr) return (ksi->ext.srna)? ksi->ext.srna: &RNA_KeyingSetInfo; } -static void rna_KeyingSetInfo_unregister(const bContext *C, StructRNA *type) +static void rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type) { KeyingSetInfo *ksi= RNA_struct_blender_type_get(type); @@ -200,10 +200,10 @@ static void rna_KeyingSetInfo_unregister(const bContext *C, StructRNA *type) RNA_struct_free(&BLENDER_RNA, type); /* unlink Blender-side data */ - ANIM_keyingset_info_unregister(C, ksi); + ANIM_keyingset_info_unregister(bmain, ksi); } -static StructRNA *rna_KeyingSetInfo_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { KeyingSetInfo dummyksi = {NULL}; KeyingSetInfo *ksi; @@ -226,7 +226,7 @@ static StructRNA *rna_KeyingSetInfo_register(bContext *C, ReportList *reports, v /* check if we have registered this info before, and remove it */ ksi = ANIM_keyingset_info_find_named(dummyksi.idname); if (ksi && ksi->ext.srna) - rna_KeyingSetInfo_unregister(C, ksi->ext.srna); + rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna); /* create a new KeyingSetInfo type */ ksi= MEM_callocN(sizeof(KeyingSetInfo), "python keying set info"); @@ -509,7 +509,7 @@ static void rna_def_keyingset_info(BlenderRNA *brna) RNA_def_struct_sdna(srna, "KeyingSetInfo"); RNA_def_struct_ui_text(srna, "Keying Set Info", "Callback function defines for builtin Keying Sets"); RNA_def_struct_refine_func(srna, "rna_KeyingSetInfo_refine"); - RNA_def_struct_register_funcs(srna, "rna_KeyingSetInfo_register", "rna_KeyingSetInfo_unregister"); + RNA_def_struct_register_funcs(srna, "rna_KeyingSetInfo_register", "rna_KeyingSetInfo_unregister", NULL); /* Properties --------------------- */ diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 34b1dc85881..1705e2e5376 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -67,6 +67,16 @@ void RNA_def_camera(BlenderRNA *brna) {CAM_PERSP, "PERSP", 0, "Perspective", ""}, {CAM_ORTHO, "ORTHO", 0, "Orthographic", ""}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem prop_draw_type_extra_items[] = { + {CAM_DTX_CENTER, "CENTER", 0, "Center", ""}, + {CAM_DTX_CENTER_DIAG, "CENTER_DIAGONAL", 0, "Center Diagonal", ""}, + {CAM_DTX_THIRDS, "THIRDS", 0, "Thirds", ""}, + {CAM_DTX_GOLDEN, "GOLDEN", 0, "Golden", ""}, + {CAM_DTX_GOLDEN_TRI_A, "GOLDEN_TRIANGLE_A", 0, "Golden Triangle A", ""}, + {CAM_DTX_GOLDEN_TRI_B, "GOLDEN_TRIANGLE_B", 0, "Golden Triangle B", ""}, + {CAM_DTX_HARMONY_TRI_A, "HARMONY_TRIANGLE_A", 0, "Harmonious Triangle A", ""}, + {CAM_DTX_HARMONY_TRI_B, "HARMONY_TRIANGLE_B", 0, "Harmonious Triangle B", ""}, + {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_lens_unit_items[] = { {0, "MILLIMETERS", 0, "Millimeters", ""}, {CAM_ANGLETOGGLE, "DEGREES", 0, "Degrees", ""}, @@ -81,6 +91,13 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Type", "Camera types"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + + prop= RNA_def_property(srna, "show_guide", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "dtx"); + RNA_def_property_enum_items(prop, prop_draw_type_extra_items); + RNA_def_property_flag(prop, PROP_ENUM_FLAG); + RNA_def_property_ui_text(prop, "Composition Guides", "Draw overlay"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); /* Number values */ @@ -91,7 +108,7 @@ void RNA_def_camera(BlenderRNA *brna) prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "clipsta"); - RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_range(prop, 0.001f, FLT_MAX); RNA_def_property_ui_text(prop, "Clip Start", "Camera near clipping distance"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 3fba13deb32..af9cfd80ca6 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -458,13 +458,13 @@ static void rna_def_color_ramp_element(BlenderRNA *brna) prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "r"); RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Color", ""); + RNA_def_property_ui_text(prop, "Color", "Set color of selected color stop"); RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); prop= RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pos"); RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Position", ""); + RNA_def_property_ui_text(prop, "Position", "Set position of selected color stop"); RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); } diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 966e679f0fe..e7604b2beb4 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -75,18 +75,25 @@ EnumPropertyItem constraint_type_items[] ={ {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap", ""}, {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem space_pchan_items[] = { - {0, "WORLD", 0, "World Space", ""}, - {2, "POSE", 0, "Pose Space", ""}, - {3, "LOCAL_WITH_PARENT", 0, "Local With Parent", ""}, - {1, "LOCAL", 0, "Local Space", ""}, +static EnumPropertyItem target_space_pchan_items[] = { + {0, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"}, + {2, "POSE", 0, "Pose Space", "The transformation of the target is only evaluated in the Pose Space, the target armature object transformation is ignored"}, + {3, "LOCAL_WITH_PARENT", 0, "Local With Parent", "The transformation of the target bone is evaluated relative its local coordinate system, with the parent transformation added"}, + {1, "LOCAL", 0, "Local Space", "The transformation of the target is evaluated relative to its local coordinate system"}, + {0, NULL, 0, NULL, NULL}}; + +static EnumPropertyItem owner_space_pchan_items[] = { + {0, "WORLD", 0, "World Space", "The constraint is applied relative to the world coordinate system"}, + {2, "POSE", 0, "Pose Space", "The constraint is applied in Pose Space, the object transformation is ignored"}, + {3, "LOCAL_WITH_PARENT", 0, "The constraint is applied relative to the local coordinate system of the object, with the parent transformation added"}, + {1, "LOCAL", 0, "Local Space", "The constraint is applied relative to the local coordinate sytem of the object"}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME static EnumPropertyItem space_object_items[] = { - {0, "WORLD", 0, "World Space", ""}, - {1, "LOCAL", 0, "Local Space", ""}, + {0, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"}, + {1, "LOCAL", 0, "Local Space", "The transformation of the target is evaluated relative to its local coordinate system"}, {0, NULL, 0, NULL, NULL}}; #include "BKE_animsys.h" @@ -242,7 +249,7 @@ static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *C, PointerRN bConstraint *con= (bConstraint*)ptr->data; if(BLI_findindex(&ob->constraints, con) == -1) - return space_pchan_items; + return owner_space_pchan_items; else /* object */ return space_object_items; } @@ -265,7 +272,7 @@ static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *C, PointerR cti->flush_constraint_targets(con, &targets, 1); if(ct) - return space_pchan_items; + return target_space_pchan_items; } return space_object_items; @@ -318,9 +325,9 @@ static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const flo #else EnumPropertyItem constraint_distance_items[] = { - {LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside", ""}, - {LIMITDIST_OUTSIDE, "LIMITDIST_OUTSIDE", 0, "Outside", ""}, - {LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", 0, "On Surface", ""}, + {LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside", "The object is constrained inside a virtual sphere around the target object, with a radius defined by the limit distance"}, + {LIMITDIST_OUTSIDE, "LIMITDIST_OUTSIDE", 0, "Outside", "The object is constrained outside a virtual sphere around the target object, with a radius defined by the limit distance"}, + {LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", 0, "On Surface", "The object is constrained on the surface of a virtual sphere around the target object, with a radius defined by the limit distance"}, {0, NULL, 0, NULL, NULL} }; @@ -966,7 +973,7 @@ static void rna_def_constraint_action(BlenderRNA *brna) prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act"); - RNA_def_property_ui_text(prop, "Action", ""); + RNA_def_property_ui_text(prop, "Action", "The constraining action"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); @@ -1183,10 +1190,10 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem pivot_items[] = { - {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", ""}, - {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", ""}, - {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", ""}, - {CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF", ""}, + {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allows rotations around all axes"}, + {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Works in one plane, allows rotations around one axis only"}, + {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allows rotations around all axes with limits for the cone and twist axes"}, + {CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF", "No constraints by default, limits can be set individually"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "RigidBodyJointConstraint", "Constraint"); @@ -1788,9 +1795,9 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem type_items[] = { - {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", ""}, - {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", ""}, - {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", ""}, + {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrinks the location to the nearest target surface"}, + {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrinks the location to the nearest target surface along a given axis"}, + {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrinks the location to the nearest target vertex"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint"); @@ -1940,13 +1947,13 @@ static void rna_def_constraint_pivot(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem pivot_rotAxis_items[] = { - {PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", ""}, - {PIVOTCON_AXIS_X_NEG, "NX", 0, "-X Rot", ""}, - {PIVOTCON_AXIS_Y_NEG, "NY", 0, "-Y Rot", ""}, - {PIVOTCON_AXIS_Z_NEG, "NZ", 0, "-Z Rot", ""}, - {PIVOTCON_AXIS_X, "X", 0, "X Rot", ""}, - {PIVOTCON_AXIS_Y, "Y", 0, "Y Rot", ""}, - {PIVOTCON_AXIS_Z, "Z", 0, "Z Rot", ""}, + {PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"}, + {PIVOTCON_AXIS_X_NEG, "NX", 0, "-X Rot", "Use the pivot point in the negative rotation range around the X-axis"}, + {PIVOTCON_AXIS_Y_NEG, "NY", 0, "-Y Rot", "Use the pivot point in the negative rotation range around the Y-axis"}, + {PIVOTCON_AXIS_Z_NEG, "NZ", 0, "-Z Rot", "Use the pivot point in the negative rotation range around the Z-axis"}, + {PIVOTCON_AXIS_X, "X", 0, "X Rot", "Use the pivot point in the positive rotation range around the X-axis"}, + {PIVOTCON_AXIS_Y, "Y", 0, "Y Rot", "Use the pivot point in the positive rotation range around the Y-axis"}, + {PIVOTCON_AXIS_Z, "Z", 0, "Z Rot", "Use the pivot point in the positive rotation range around the Z-axis"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "PivotConstraint", "Constraint"); @@ -2019,13 +2026,13 @@ void RNA_def_constraint(BlenderRNA *brna) prop= RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ownspace"); - RNA_def_property_enum_items(prop, space_pchan_items); + RNA_def_property_enum_items(prop, owner_space_pchan_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf"); RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in"); prop= RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "tarspace"); - RNA_def_property_enum_items(prop, space_pchan_items); + RNA_def_property_enum_items(prop, target_space_pchan_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_target_space_itemf"); RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 3afec03a13f..d66f0042d88 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -813,7 +813,7 @@ void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties) if(idproperties) srna->idproperties= (IDPropertiesFunc)idproperties; } -void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg) +void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance) { if(!DefRNA.preprocess) { fprintf(stderr, "RNA_def_struct_register_funcs: only during preprocessing.\n"); @@ -822,6 +822,7 @@ void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char if(reg) srna->reg= (StructRegisterFunc)reg; if(unreg) srna->unreg= (StructUnregisterFunc)unreg; + if(instance) srna->instance= (StructInstanceFunc)instance; } void RNA_def_struct_path_func(StructRNA *srna, const char *path) diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index acec2ca7a24..7c93ae4168b 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -195,6 +195,18 @@ static char *rna_FluidSettings_path(PointerRNA *ptr) return BLI_sprintfN("modifiers[\"%s\"].settings", md->name); } +static void rna_FluidMeshVertex_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + FluidsimSettings *fss = (FluidsimSettings*)ptr->data; + rna_iterator_array_begin(iter, fss->meshVelocities, sizeof(float)*3, fss->totvert, 0, NULL); +} + +static int rna_FluidMeshVertex_data_length(PointerRNA *ptr) +{ + FluidsimSettings *fss = (FluidsimSettings*)ptr->data; + return fss->totvert; +} + #else static void rna_def_fluidsim_slip(StructRNA *srna) @@ -219,6 +231,24 @@ static void rna_def_fluidsim_slip(StructRNA *srna) RNA_def_property_ui_text(prop, "Partial Slip Amount", "Amount of mixing between no- and free-slip, 0 is no slip and 1 is free slip"); } +static void rna_def_fluid_mesh_vertices(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "FluidMeshVertex", NULL); + RNA_def_struct_sdna(srna, "FluidVertexVelocity"); + RNA_def_struct_ui_text(srna, "Fluid Mesh Vertex", "Vertex of a simulated fluid mesh"); + RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL); + + prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY); + RNA_def_property_array(prop, 3); + RNA_def_property_float_sdna(prop, NULL, "vel"); + RNA_def_property_ui_text(prop, "Velocity", ""); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); +} + + static void rna_def_fluidsim_domain(BlenderRNA *brna) { StructRNA *srna; @@ -367,6 +397,13 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0, 10.0); RNA_def_property_ui_text(prop, "Generate Particles", "Amount of particles to generate (0=off, 1=normal, >1=more)"); + + /* simulated fluid mesh data */ + prop= RNA_def_property(srna, "fluid_mesh_vertices", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "FluidMeshVertex"); + RNA_def_property_ui_text(prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation"); + RNA_def_property_collection_funcs(prop, "rna_FluidMeshVertex_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_FluidMeshVertex_data_length", 0, 0); + rna_def_fluid_mesh_vertices(brna); } static void rna_def_fluidsim_volume(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 5872542d10a..3db90c2de0e 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -221,6 +221,39 @@ static void rna_Image_size_get(PointerRNA *ptr,int *values) BKE_image_release_ibuf(im, lock); } +static void rna_Image_resolution_get(PointerRNA *ptr, float *values) +{ + Image *im= (Image*)ptr->data; + ImBuf *ibuf; + void *lock; + + ibuf = BKE_image_acquire_ibuf(im, NULL , &lock); + if (ibuf) { + values[0]= ibuf->ppm[0]; + values[1]= ibuf->ppm[1]; + } + else { + values[0]= 0; + values[1]= 0; + } + + BKE_image_release_ibuf(im, lock); +} + +static void rna_Image_resolution_set(PointerRNA *ptr, const float *values) +{ + Image *im= (Image*)ptr->data; + ImBuf *ibuf; + void *lock; + + ibuf = BKE_image_acquire_ibuf(im, NULL , &lock); + if (ibuf) { + ibuf->ppm[0]= values[0]; + ibuf->ppm[1]= values[1]; + } + + BKE_image_release_ibuf(im, lock); +} static int rna_Image_depth_get(PointerRNA *ptr) { @@ -557,6 +590,9 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_int_funcs(prop, "rna_Image_size_get" , NULL, NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop= RNA_def_float_vector(srna, "resolution" , 2 , NULL , 0, 0, "Resolution" , "X/Y pixels per meter" , 0 , 0); + RNA_def_property_float_funcs(prop, "rna_Image_resolution_get" , "rna_Image_resolution_set", NULL); + prop= RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_multi_array(prop, 1, NULL); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 7df31fc12f9..81edf6f6a0d 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -198,8 +198,8 @@ struct StructRNA *rna_ID_refine(struct PointerRNA *ptr); struct IDProperty *rna_ID_idprops(struct PointerRNA *ptr, int create); void rna_ID_fake_user_set(struct PointerRNA *ptr, int value); struct IDProperty *rna_PropertyGroup_idprops(struct PointerRNA *ptr, int create); -void rna_PropertyGroup_unregister(const struct bContext *C, struct StructRNA *type); -struct StructRNA *rna_PropertyGroup_register(struct bContext *C, struct ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free); +void rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type); +struct StructRNA *rna_PropertyGroup_register(struct Main *bmain, struct ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free); struct StructRNA* rna_PropertyGroup_refine(struct PointerRNA *ptr); void rna_object_vgroup_name_index_get(struct PointerRNA *ptr, char *value, int index); diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index eb1beb90567..a59db183453 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -330,6 +330,7 @@ struct StructRNA { /* function to register/unregister subclasses */ StructRegisterFunc reg; StructUnregisterFunc unreg; + StructInstanceFunc instance; /* callback to get id properties */ IDPropertiesFunc idproperties; diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 3f0ccf99266..3e65eb8665e 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -521,7 +521,7 @@ static void rna_def_keyblock(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA); prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_property_ui_text(prop, "Name", "Name of Shape Key"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShapeKey_name_set"); RNA_def_struct_name_property(srna, prop); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 909c824074e..0e9629f973d 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -743,7 +743,7 @@ static void rna_def_material_colors(StructRNA *srna) prop= RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "r"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Diffuse Color", ""); + RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material"); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); prop= RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR); @@ -797,25 +797,25 @@ static void rna_def_material_colors(StructRNA *srna) prop= RNA_def_property(srna, "diffuse_ramp_blend", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rampblend_col"); RNA_def_property_enum_items(prop, ramp_blend_items); - RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", ""); + RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", "Blending method of the ramp and the diffuse color"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "specular_ramp_blend", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rampblend_spec"); RNA_def_property_enum_items(prop, ramp_blend_items); - RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", ""); + RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", "Blending method of the ramp and the specular color"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "diffuse_ramp_input", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rampin_col"); RNA_def_property_enum_items(prop, prop_ramp_input_items); - RNA_def_property_ui_text(prop, "Diffuse Ramp Input", ""); + RNA_def_property_ui_text(prop, "Diffuse Ramp Input", "Determines how the ramp maps on the surface"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "specular_ramp_input", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rampin_spec"); RNA_def_property_enum_items(prop, prop_ramp_input_items); - RNA_def_property_ui_text(prop, "Specular Ramp Input", ""); + RNA_def_property_ui_text(prop, "Specular Ramp Input", "Determines how the ramp maps on the surface"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "diffuse_ramp_factor", PROP_FLOAT, PROP_FACTOR); @@ -836,11 +836,11 @@ static void rna_def_material_diffuse(StructRNA *srna) PropertyRNA *prop; static EnumPropertyItem prop_diff_shader_items[] = { - {MA_DIFF_LAMBERT, "LAMBERT", 0, "Lambert", ""}, - {MA_DIFF_ORENNAYAR, "OREN_NAYAR", 0, "Oren-Nayar", ""}, - {MA_DIFF_TOON, "TOON", 0, "Toon", ""}, - {MA_DIFF_MINNAERT, "MINNAERT", 0, "Minnaert", ""}, - {MA_DIFF_FRESNEL, "FRESNEL", 0, "Fresnel", ""}, + {MA_DIFF_LAMBERT, "LAMBERT", 0, "Lambert", "Use a Lambertian shader"}, + {MA_DIFF_ORENNAYAR, "OREN_NAYAR", 0, "Oren-Nayar", "Use an Oren-Nayar shader"}, + {MA_DIFF_TOON, "TOON", 0, "Toon", "Use a toon shader"}, + {MA_DIFF_MINNAERT, "MINNAERT", 0, "Minnaert", "Use a Minnaert shader"}, + {MA_DIFF_FRESNEL, "FRESNEL", 0, "Fresnel", "Use a Fresnel shader"}, {0, NULL, 0, NULL, NULL}}; prop= RNA_def_property(srna, "diffuse_shader", PROP_ENUM, PROP_NONE); @@ -1048,7 +1048,7 @@ static void rna_def_material_volume(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_lighting_items[] = { - {MA_VOL_SHADE_SHADELESS, "SHADELESS", 0, "Shadeless", ""}, + {MA_VOL_SHADE_SHADELESS, "SHADELESS", 0, "Shadeless", "Do not calculate lighting and shadows"}, {MA_VOL_SHADE_SHADOWED, "SHADOWED", 0, "Shadowed", ""}, {MA_VOL_SHADE_SHADED, "SHADED", 0, "Shaded", ""}, {MA_VOL_SHADE_MULTIPLE, "MULTIPLE_SCATTERING", 0, "Multiple Scattering", ""}, @@ -1168,7 +1168,7 @@ static void rna_def_material_volume(BlenderRNA *brna) prop= RNA_def_property(srna, "emission_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "emission_col"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Emission Color", ""); + RNA_def_property_ui_text(prop, "Emission Color", "Color of emitted light"); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); prop= RNA_def_property(srna, "emission", PROP_FLOAT, PROP_NONE); @@ -1389,11 +1389,11 @@ static void rna_def_material_specularity(StructRNA *srna) PropertyRNA *prop; static EnumPropertyItem prop_specular_shader_items[] = { - {MA_SPEC_COOKTORR, "COOKTORR", 0, "CookTorr", ""}, - {MA_SPEC_PHONG, "PHONG", 0, "Phong", ""}, - {MA_SPEC_BLINN, "BLINN", 0, "Blinn", ""}, - {MA_SPEC_TOON, "TOON", 0, "Toon", ""}, - {MA_SPEC_WARDISO, "WARDISO", 0, "WardIso", ""}, + {MA_SPEC_COOKTORR, "COOKTORR", 0, "CookTorr", "Use a Cook-Torrance shader"}, + {MA_SPEC_PHONG, "PHONG", 0, "Phong", "Use a Phong shader"}, + {MA_SPEC_BLINN, "BLINN", 0, "Blinn", "Use a Blinn shader"}, + {MA_SPEC_TOON, "TOON", 0, "Toon", "Use a toon shader"}, + {MA_SPEC_WARDISO, "WARDISO", 0, "WardIso", "Use a Ward anisotropic shader"}, {0, NULL, 0, NULL, NULL}}; prop= RNA_def_property(srna, "specular_shader", PROP_ENUM, PROP_NONE); @@ -1405,7 +1405,7 @@ static void rna_def_material_specularity(StructRNA *srna) prop= RNA_def_property(srna, "specular_intensity", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "spec"); RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Specular Intensity", ""); + RNA_def_property_ui_text(prop, "Specular Intensity", "How intense (bright) the specular reflection is"); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); /* NOTE: "har", "param", etc are used for multiple purposes depending on @@ -1416,13 +1416,13 @@ static void rna_def_material_specularity(StructRNA *srna) prop= RNA_def_property(srna, "specular_hardness", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "har"); RNA_def_property_range(prop, 1, 511); - RNA_def_property_ui_text(prop, "Specular Hardness", ""); + RNA_def_property_ui_text(prop, "Specular Hardness", "How hard (sharp) the specular reflection is"); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); prop= RNA_def_property(srna, "specular_ior", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "refrac"); RNA_def_property_range(prop, 1, 10); - RNA_def_property_ui_text(prop, "Specular IOR", ""); + RNA_def_property_ui_text(prop, "Specular IOR", "Specular index of refraction"); RNA_def_property_update(prop, 0, "rna_Material_update"); prop= RNA_def_property(srna, "specular_toon_size", PROP_FLOAT, PROP_NONE); @@ -1585,9 +1585,9 @@ void RNA_def_material(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_shadows_only_items[] = { - {MA_SO_OLD, "SHADOW_ONLY_OLD", 0, "Shadow and Distance", ""}, - {MA_SO_SHADOW, "SHADOW_ONLY", 0, "Shadow Only", ""}, - {MA_SO_SHADED, "SHADOW_ONLY_SHADED", 0, "Shadow and Shading", ""}, + {MA_SO_OLD, "SHADOW_ONLY_OLD", 0, "Shadow and Distance", "Old shadow only method"}, + {MA_SO_SHADOW, "SHADOW_ONLY", 0, "Shadow Only", "Improved shadow only method"}, + {MA_SO_SHADED, "SHADOW_ONLY_SHADED", 0, "Shadow and Shading", "Improved shadow only method which also renders lightless areas as shadows"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Material", "ID"); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 03c79af1907..9e5a2e9f65a 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1346,7 +1346,7 @@ static void rna_def_mtface(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_struct_name_property(srna, prop); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshTextureFaceLayer_name_set"); - RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_property_ui_text(prop, "Name", "Name of UV unwrapping layer"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); @@ -1530,7 +1530,7 @@ static void rna_def_mcol(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_struct_name_property(srna, prop); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshColorLayer_name_set"); - RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index f6cc93664d6..333451e1d31 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -631,10 +631,10 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) static void rna_def_modifier_generic_map_info(StructRNA *srna) { static EnumPropertyItem prop_texture_coordinates_items[] = { - {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Map", ""}, - {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", ""}, - {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object", ""}, - {MOD_DISP_MAP_UV, "UV", 0, "UV", ""}, + {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Map", "Uses the local coordinate system for the texture coordinates"}, + {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Uses the global coordinate system for the texture coordinates"}, + {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object", "Uses the linked object's local coordinate system for the texture coordinates"}, + {MOD_DISP_MAP_UV, "UV", 0, "UV", "Uses UV coordinates for the texture coordinates"}, {0, NULL, 0, NULL, NULL}}; PropertyRNA *prop; @@ -656,9 +656,9 @@ static void rna_def_modifier_generic_map_info(StructRNA *srna) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MappingInfo_uvlayer_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "texture_coordinate_object", PROP_POINTER, PROP_NONE); + prop= RNA_def_property(srna, "texture_coords_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "map_object"); - RNA_def_property_ui_text(prop, "Texture Coordinate Object", ""); + RNA_def_property_ui_text(prop, "Texture Coordinate Object", "Object to set the texture coordinates"); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); } @@ -754,7 +754,7 @@ static void rna_def_modifier_multires(BlenderRNA *brna) prop= RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "renderlvl"); - RNA_def_property_ui_text(prop, "Render Levels", ""); + RNA_def_property_ui_text(prop, "Render Levels", "The subdivision level visible at render time"); RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range"); prop= RNA_def_property(srna, "total_levels", PROP_INT, PROP_UNSIGNED); @@ -1020,39 +1020,39 @@ static void rna_def_modifier_wave(BlenderRNA *brna) prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME); RNA_def_property_float_sdna(prop, NULL, "lifetime"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Lifetime", ""); + RNA_def_property_ui_text(prop, "Lifetime", "Lifetime of the wave in frames, zero means infinite"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_TIME); RNA_def_property_float_sdna(prop, NULL, "damp"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Damping Time", ""); + RNA_def_property_ui_text(prop, "Damping Time", "Number of frames in which the waves damps out after it dies"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "falloff"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 100, 100, 2); - RNA_def_property_ui_text(prop, "Falloff Radius", ""); + RNA_def_property_ui_text(prop, "Falloff Radius", "Distance after which it fades out"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "start_position_x", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "startx"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -100, 100, 100, 2); - RNA_def_property_ui_text(prop, "Start Position X", ""); + RNA_def_property_ui_text(prop, "Start Position X", "X coordinate of the start position"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "start_position_y", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "starty"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -100, 100, 100, 2); - RNA_def_property_ui_text(prop, "Start Position Y", ""); + RNA_def_property_ui_text(prop, "Start Position Y", "Z coordinate of the start position"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "start_position_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "objectcenter"); - RNA_def_property_ui_text(prop, "Start Position Object", ""); + RNA_def_property_ui_text(prop, "Start Position Object", "Object which defines the wave center"); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); @@ -1088,26 +1088,26 @@ static void rna_def_modifier_wave(BlenderRNA *brna) prop= RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -1, 1, 10, 2); - RNA_def_property_ui_text(prop, "Speed", ""); + RNA_def_property_ui_text(prop, "Speed", "Speed of the wave, towards the starting point when negative"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -2, 2, 10, 2); - RNA_def_property_ui_text(prop, "Height", ""); + RNA_def_property_ui_text(prop, "Height", "Height of the wave"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 5, 10, 2); - RNA_def_property_ui_text(prop, "Width", ""); + RNA_def_property_ui_text(prop, "Width", "Distance between the waves"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "narrowness", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "narrow"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 10, 10, 2); - RNA_def_property_ui_text(prop, "Narrowness", ""); + RNA_def_property_ui_text(prop, "Narrowness", "Distance between the top and the base of a wave, the higher the value, the more narrow the wave"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); } @@ -1129,12 +1129,12 @@ static void rna_def_modifier_armature(BlenderRNA *brna) prop= RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE); - RNA_def_property_ui_text(prop, "Use Bone Envelopes", ""); + RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Binds Bone envelope to armature modifier"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP); - RNA_def_property_ui_text(prop, "Use Vertex Groups", ""); + RNA_def_property_ui_text(prop, "Use Vertex Groups", "Binds vertex group to armature modifier"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE); @@ -1226,9 +1226,9 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_operation_items[] = { - {eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect", ""}, - {eBooleanModifierOp_Union, "UNION", 0, "Union", ""}, - {eBooleanModifierOp_Difference, "DIFFERENCE", 0, "Difference", ""}, + {eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect", "Keeps the part of the mesh that intersects with the other selected object"}, + {eBooleanModifierOp_Union, "UNION", 0, "Union", "Combines two meshes in an additive way"}, + {eBooleanModifierOp_Difference, "DIFFERENCE", 0, "Difference", "Combines two meshes in a subtractive way"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "BooleanModifier", "Modifier"); @@ -1254,9 +1254,9 @@ static void rna_def_modifier_array(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_fit_type_items[] = { - {MOD_ARR_FIXEDCOUNT, "FIXED_COUNT", 0, "Fixed Count", ""}, - {MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length", ""}, - {MOD_ARR_FITCURVE, "FIT_CURVE", 0, "Fit Curve", ""}, + {MOD_ARR_FIXEDCOUNT, "FIXED_COUNT", 0, "Fixed Count", "Duplicate the object a certain number of times"}, + {MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length", "Duplicate the object as many times as fits in a certain length"}, + {MOD_ARR_FITCURVE, "FIT_CURVE", 0, "Fit Curve", "Fit the duplicated objects to a curve"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "ArrayModifier", "Modifier"); @@ -1298,7 +1298,7 @@ static void rna_def_modifier_array(BlenderRNA *brna) prop= RNA_def_property(srna, "constant_offset_displace", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_float_sdna(prop, NULL, "offset"); - RNA_def_property_ui_text(prop, "Constant Offset Displacement", ""); + RNA_def_property_ui_text(prop, "Constant Offset Displacement", "Value for the distance between arrayed items"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE); @@ -1308,7 +1308,7 @@ static void rna_def_modifier_array(BlenderRNA *brna) prop= RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE); /* PROP_TRANSLATION causes units to be used which we dont want */ RNA_def_property_float_sdna(prop, NULL, "scale"); - RNA_def_property_ui_text(prop, "Relative Offset Displacement", ""); + RNA_def_property_ui_text(prop, "Relative Offset Displacement", "The size of the geometry will determine the distance between arrayed items"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); /* Vertex merging parameters */ @@ -1337,7 +1337,7 @@ static void rna_def_modifier_array(BlenderRNA *brna) prop= RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "offset_ob"); - RNA_def_property_ui_text(prop, "Object Offset", ""); + RNA_def_property_ui_text(prop, "Object Offset", "Uses the location and rotation of another object to determine the distance and rotational change between arrayed items"); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); @@ -1389,11 +1389,11 @@ static void rna_def_modifier_displace(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_direction_items[] = { - {MOD_DISP_DIR_X, "X", 0, "X", ""}, - {MOD_DISP_DIR_Y, "Y", 0, "Y", ""}, - {MOD_DISP_DIR_Z, "Z", 0, "Z", ""}, - {MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal", ""}, - {MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ", ""}, + {MOD_DISP_DIR_X, "X", 0, "X", "Uses the texture's intensity value to displace in the X direction"}, + {MOD_DISP_DIR_Y, "Y", 0, "Y", "Uses the texture's intensity value to displace in the Y direction"}, + {MOD_DISP_DIR_Z, "Z", 0, "Z", "Uses the texture's intensity value to displace in the Z direction"}, + {MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal", "Uses the texture's intensity value to displace in the normal direction"}, + {MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ", "Uses the texture's RGB values to displace the mesh in the XYZ direction"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "DisplaceModifier", "Modifier"); @@ -1409,7 +1409,7 @@ static void rna_def_modifier_displace(BlenderRNA *brna) prop= RNA_def_property(srna, "mid_level", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "midlevel"); - RNA_def_property_range(prop, 0, 1); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, 0, 1, 10, 3); RNA_def_property_ui_text(prop, "Midlevel", "Material value that gives no displacement"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -1417,7 +1417,7 @@ static void rna_def_modifier_displace(BlenderRNA *brna) prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -100, 100, 10, 3); - RNA_def_property_ui_text(prop, "Strength", ""); + RNA_def_property_ui_text(prop, "Strength", "Amount to displace geometry"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE); @@ -1517,24 +1517,24 @@ static void rna_def_modifier_smooth(BlenderRNA *brna) prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_X); - RNA_def_property_ui_text(prop, "X", ""); + RNA_def_property_ui_text(prop, "X", "Smooth object along X axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Y); - RNA_def_property_ui_text(prop, "Y", ""); + RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Z); - RNA_def_property_ui_text(prop, "Z", ""); + RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fac"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -10, 10, 1, 3); - RNA_def_property_ui_text(prop, "Factor", ""); + RNA_def_property_ui_text(prop, "Factor", "Strength of modifier effect"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE); @@ -1569,7 +1569,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna) prop= RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_cast_type_items); - RNA_def_property_ui_text(prop, "Cast Type", ""); + RNA_def_property_ui_text(prop, "Cast Type", "Target object shape"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); @@ -1979,9 +1979,9 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem shrink_type_items[] = { - {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point", ""}, - {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", ""}, - {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", ""}, + {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point", "Shrinks the mesh to the nearest target surface"}, + {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrinks the mesh to the nearest target surface along a given axis"}, + {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrinks the mesh to the nearest target vertex"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem shrink_face_cull_items[] = { @@ -2133,10 +2133,10 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem simple_deform_mode_items[] = { - {MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", ""}, - {MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", ""}, - {MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", ""}, - {MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch", ""}, + {MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", "Rotates around the Z axis of the modifier space"}, + {MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", "Bends the mesh over the Z axis of the modifier space"}, + {MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", "Linearly scales along Z axis of the modifier space"}, + {MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch", "Stretches the object along the Z axis of the modifier space"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SimpleDeformModifier", "Modifier"); @@ -2169,7 +2169,7 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna) prop= RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -10, 10, 1, 3); - RNA_def_property_ui_text(prop, "Factor", ""); + RNA_def_property_ui_text(prop, "Factor", "Amount to deform object"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "limits", PROP_FLOAT, PROP_NONE); @@ -2182,12 +2182,12 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna) prop= RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_X); - RNA_def_property_ui_text(prop, "Lock X Axis", ""); + RNA_def_property_ui_text(prop, "Lock X Axis", "Do not allow tapering along the X axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_Y); - RNA_def_property_ui_text(prop, "Lock Y Axis", ""); + RNA_def_property_ui_text(prop, "Lock Y Axis", "Do not allow tapering along the Y axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 11e7dd81cb6..4407ca8ad4e 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -68,14 +68,14 @@ EnumPropertyItem object_mode_items[] = { {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem parent_type_items[] = { - {PAROBJECT, "OBJECT", 0, "Object", ""}, - {PARCURVE, "CURVE", 0, "Curve", ""}, + {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"}, + {PARCURVE, "CURVE", 0, "Curve", "The object is parented to a curve"}, {PARKEY, "KEY", 0, "Key", ""}, {PARSKEL, "ARMATURE", 0, "Armature", ""}, - {PARSKEL, "LATTICE", 0, "Lattice", ""}, // PARSKEL reuse will give issues - {PARVERT1, "VERTEX", 0, "Vertex", ""}, + {PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"}, // PARSKEL reuse will give issues + {PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"}, {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""}, - {PARBONE, "BONE", 0, "Bone", ""}, + {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem collision_bounds_items[] = { @@ -307,22 +307,26 @@ static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene); } -static int rna_Object_data_editable(PointerRNA *ptr) -{ - Object *ob= (Object*)ptr->data; - - return (ob->type == OB_EMPTY)? 0: PROP_EDITABLE; -} - static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value) { Object *ob= (Object*)ptr->data; ID *id= value.data; - if(ob->type == OB_EMPTY || id == NULL || ob->mode & OB_MODE_EDIT) + if (id == NULL || ob->mode & OB_MODE_EDIT) return; - - if(ob->type == OB_MESH) { + + if (ob->type == OB_EMPTY) { + if(ob->data) { + id_us_min((ID*)ob->data); + ob->data = NULL; + } + + if (id && GS(id->name) == ID_IM) { + id_us_plus(id); + ob->data = id; + } + } + else if(ob->type == OB_MESH) { set_mesh(ob, (Mesh*)id); } else { @@ -346,6 +350,7 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr) Object *ob= (Object*)ptr->data; switch(ob->type) { + case OB_EMPTY: return &RNA_Image; case OB_MESH: return &RNA_Mesh; case OB_CURVE: return &RNA_Curve; case OB_SURF: return &RNA_Curve; @@ -1691,6 +1696,7 @@ static void rna_def_object(BlenderRNA *brna) {OB_CUBE, "CUBE", 0, "Cube", ""}, {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""}, {OB_EMPTY_CONE, "CONE", 0, "Cone", ""}, + {OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem track_items[] = { @@ -1709,20 +1715,20 @@ static void rna_def_object(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem drawtype_items[] = { - {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", ""}, - {OB_WIRE, "WIRE", 0, "Wire", ""}, - {OB_SOLID, "SOLID", 0, "Solid", ""}, + {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounding box of the object"}, + {OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"}, + {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (If solid drawing is enabled in the viewport)"}, // disabled {OB_SHADED, "SHADED", 0, "Shaded", ""}, - {OB_TEXTURE, "TEXTURED", 0, "Textured", ""}, + {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (If textures are enabled in the viewport)"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem boundtype_items[] = { - {OB_BOUND_BOX, "BOX", 0, "Box", ""}, - {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""}, - {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""}, - {OB_BOUND_CONE, "CONE", 0, "Cone", ""}, - {OB_BOUND_POLYH, "POLYHEDRON", 0, "Polyhedron", ""}, - {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""}, + {OB_BOUND_BOX, "BOX", 0, "Box", "Draw bounds as box"}, + {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as sphere"}, + {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as cylinder"}, + {OB_BOUND_CONE, "CONE", 0, "Cone", "Draw bounds as cone"}, + {OB_BOUND_POLYH, "POLYHEDRON", 0, "Polyhedron", "Draw bounds as polyhedron"}, + {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Draw bounds as capsule"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem dupli_items[] = { @@ -1758,7 +1764,6 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "ID"); RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", NULL); - RNA_def_property_editable_func(prop, "rna_Object_data_editable"); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK); RNA_def_property_ui_text(prop, "Data", "Object data"); RNA_def_property_update(prop, 0, "rna_Object_internal_update_data"); @@ -2043,6 +2048,12 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Empty Display Size", "Size of display for empties in the viewport"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + prop= RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "ima_ofs"); + RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance"); + RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + /* render */ prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "index"); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index a4fbd7c160e..6955c7f8fa8 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1055,18 +1055,18 @@ static void rna_def_field(BlenderRNA *brna) static EnumPropertyItem field_type_items[] = { {0, "NONE", 0, "None", ""}, - {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", ""}, - {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", ""}, - {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", ""}, - {PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", ""}, - {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic", ""}, - {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge", ""}, - {PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones", ""}, - {PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", ""}, - {PFIELD_GUIDE, "GUIDE", ICON_FORCE_CURVE, "Curve Guide", ""}, + {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Gives a radial field toward the center of object"}, + {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Gives a constant force along the force object’s local Z axis"}, + {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Gives a spiraling force that twists the force object’s local Z axis"}, + {PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", "Forcefield depends on the speed of the particles"}, + {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic", "The source of this force field is the zero point of a harmonic oscillator"}, + {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge", "Spherical forcefield based on the charge of particles, only influences other charge force fields"}, + {PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones", "Forcefield based on the Lennard-Jones potential"}, + {PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", "Forcefield based on a texture"}, + {PFIELD_GUIDE, "GUIDE", ICON_FORCE_CURVE, "Curve Guide", "Creates a force along a curve object"}, {PFIELD_BOID, "BOID", ICON_FORCE_BOID, "Boid", ""}, - {PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", ""}, - {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", ""}, + {PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Creates turbulence with a noise field"}, + {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Creates a force that dampens motion"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem falloff_items[] = { @@ -1126,7 +1126,7 @@ static void rna_def_field(BlenderRNA *brna) prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "falloff"); RNA_def_property_enum_items(prop, falloff_items); - RNA_def_property_ui_text(prop, "Fall-Off", "Fall-off shape"); + RNA_def_property_ui_text(prop, "Fall-Off", ""); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 9fd5fafc712..fa69fad253f 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1682,7 +1682,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, type_items); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Type", ""); + RNA_def_property_ui_text(prop, "Type", "Particle Type"); RNA_def_property_update(prop, 0, "rna_Particle_change_type"); prop= RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE); @@ -1840,15 +1840,15 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 0, 7); - RNA_def_property_ui_range(prop, 0, 10, 1, 0); + RNA_def_property_range(prop, 0, 10); + RNA_def_property_ui_range(prop, 0, 7, 1, 0); RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); prop= RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ren_step"); - RNA_def_property_range(prop, 0, 9); - RNA_def_property_ui_range(prop, 0, 20, 1, 0); + RNA_def_property_range(prop, 0, 20); + RNA_def_property_ui_range(prop, 0, 9, 1, 0); RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)"); prop= RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE); @@ -1896,7 +1896,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, integrator_type_items); - RNA_def_property_ui_text(prop, "Integration", "Select physics integrator type"); + RNA_def_property_ui_text(prop, "Integration", "Algorithm used to calculate physics. Fastest to most stable/accurate: Midpoint, Euler, Verlet, RK4 (Old)"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c index 08a3f174c15..9fd5610a577 100644 --- a/source/blender/makesrna/intern/rna_property.c +++ b/source/blender/makesrna/intern/rna_property.c @@ -101,11 +101,11 @@ void RNA_def_gameproperty(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem gameproperty_type_items[] ={ - {GPROP_BOOL, "BOOL", 0, "Boolean", ""}, - {GPROP_INT, "INT", 0, "Integer", ""}, - {GPROP_FLOAT, "FLOAT", 0, "Float", ""}, - {GPROP_STRING, "STRING", 0, "String", ""}, - {GPROP_TIME, "TIMER", 0, "Timer", ""}, + {GPROP_BOOL, "BOOL", 0, "Boolean", "Boolean Property"}, + {GPROP_INT, "INT", 0, "Integer", "Integer Property"}, + {GPROP_FLOAT, "FLOAT", 0, "Float", "Floating-Point Property"}, + {GPROP_STRING, "STRING", 0, "String", "String Property"}, + {GPROP_TIME, "TIMER", 0, "Timer", "Timer Property"}, {0, NULL, 0, NULL, NULL}}; /* Base Struct for GameProperty */ diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index f87eb4ca4aa..da2704ab641 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -101,7 +101,7 @@ static void engine_render(RenderEngine *engine, struct Scene *scene) RNA_parameter_list_free(&list); } -static void rna_RenderEngine_unregister(const bContext *C, StructRNA *type) +static void rna_RenderEngine_unregister(Main *bmain, StructRNA *type) { RenderEngineType *et= RNA_struct_blender_type_get(type); @@ -113,7 +113,7 @@ static void rna_RenderEngine_unregister(const bContext *C, StructRNA *type) RNA_struct_free(&BLENDER_RNA, type); } -static StructRNA *rna_RenderEngine_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { RenderEngineType *et, dummyet = {NULL}; RenderEngine dummyengine= {NULL}; @@ -137,7 +137,7 @@ static StructRNA *rna_RenderEngine_register(bContext *C, ReportList *reports, vo for(et=R_engines.first; et; et=et->next) { if(strcmp(et->idname, dummyet.idname) == 0) { if(et->ext.srna) - rna_RenderEngine_unregister(C, et->ext.srna); + rna_RenderEngine_unregister(bmain, et->ext.srna); break; } } @@ -233,7 +233,7 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_struct_sdna(srna, "RenderEngine"); RNA_def_struct_ui_text(srna, "Render Engine", "Render engine"); RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine"); - RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister"); + RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", NULL); /* render */ func= RNA_def_function(srna, "render", NULL); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index b8ce006461d..6450e2259fb 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -68,13 +68,13 @@ EnumPropertyItem snap_target_items[] = { {0, NULL, 0, NULL, NULL}}; EnumPropertyItem proportional_falloff_items[] ={ - {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""}, - {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", ""}, - {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", ""}, - {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""}, - {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", ""}, - {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", ""}, - {PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", ""}, + {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"}, + {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"}, + {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"}, + {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"}, + {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"}, + {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Consant falloff"}, + {PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"}, {0, NULL, 0, NULL, NULL}}; @@ -101,54 +101,54 @@ EnumPropertyItem snap_element_items[] = { EnumPropertyItem image_type_items[] = { {0, "", 0, "Image", NULL}, - {R_BMP, "BMP", ICON_FILE_IMAGE, "BMP", ""}, + {R_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"}, #ifdef WITH_DDS - {R_DDS, "DDS", ICON_FILE_IMAGE, "DDS", ""}, + {R_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"}, #endif - {R_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", ""}, - {R_PNG, "PNG", ICON_FILE_IMAGE, "PNG", ""}, - {R_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", ""}, + {R_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"}, + {R_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"}, + {R_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"}, #ifdef WITH_OPENJPEG - {R_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", ""}, + {R_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"}, #endif - {R_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", ""}, - {R_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", ""}, + {R_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"}, + {R_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"}, {0, "", 0, " ", NULL}, #ifdef WITH_CINEON - {R_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", ""}, - {R_DPX, "DPX",ICON_FILE_IMAGE, "DPX", ""}, + {R_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"}, + {R_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"}, #endif #ifdef WITH_OPENEXR - {R_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", ""}, - {R_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", ""}, + {R_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"}, + {R_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"}, #endif #ifdef WITH_HDR - {R_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", ""}, + {R_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"}, #endif #ifdef WITH_TIFF - {R_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", ""}, + {R_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"}, #endif {0, "", 0, "Movie", NULL}, #ifdef _WIN32 - {R_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", ""}, // XXX Missing codec menu + {R_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", "Output video in AVI format"}, // XXX Missing codec menu #endif - {R_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", ""}, - {R_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", ""}, - {R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", ""}, + {R_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"}, + {R_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"}, + {R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", "Output image to a frameserver"}, #ifdef WITH_FFMPEG - {R_H264, "H264", ICON_FILE_MOVIE, "H.264", ""}, - {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", ""}, - {R_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", ""}, + {R_H264, "H264", ICON_FILE_MOVIE, "H.264", "Output video in H.264 format"}, + {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", "Output video in MPEG format"}, + {R_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", "Output video in Ogg format"}, #endif #ifdef WITH_QUICKTIME # ifdef USE_QTKIT - {R_QUICKTIME, "QUICKTIME_QTKIT", ICON_FILE_MOVIE, "QuickTime", ""}, + {R_QUICKTIME, "QUICKTIME_QTKIT", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"}, # else - {R_QUICKTIME, "QUICKTIME_CARBON", ICON_FILE_MOVIE, "QuickTime", ""}, + {R_QUICKTIME, "QUICKTIME_CARBON", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"}, # endif #endif #ifdef WITH_FFMPEG - {R_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", ""}, + {R_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", "Output video in Xvid format"}, #endif {0, NULL, 0, NULL, NULL}}; @@ -1374,7 +1374,7 @@ static void rna_def_unit_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem rotation_units[] = { - {0, "DEGREES", 0, "Degrees", ""}, + {0, "DEGREES", 0, "Degrees", "Use degrees for measuring rotation"}, {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""}, {0, NULL, 0, NULL, NULL}}; @@ -1993,12 +1993,12 @@ static void rna_def_scene_game_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem physics_engine_items[] = { - {WOPHY_NONE, "NONE", 0, "None", ""}, + {WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"}, //{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, //{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, //{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, //{WOPHY_ODE, "ODE", 0, "ODE", ""}, - {WOPHY_BULLET, "BULLET", 0, "Bullet", ""}, + {WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem material_items[] ={ @@ -2122,7 +2122,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_ACCELERATION); RNA_def_property_float_sdna(prop, NULL, "gravity"); - RNA_def_property_range(prop, 0.0, 25.0); + RNA_def_property_ui_range(prop, 0.0, 25.0, 1, 2); + RNA_def_property_range(prop, 0.0, 10000.0); RNA_def_property_ui_text(prop, "Physics Gravity", "Gravitational constant used for physics simulation in the game engine"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2313,13 +2314,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem pixel_filter_items[] ={ - {R_FILTER_BOX, "BOX", 0, "Box", ""}, - {R_FILTER_TENT, "TENT", 0, "Tent", ""}, - {R_FILTER_QUAD, "QUADRATIC", 0, "Quadratic", ""}, - {R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""}, - {R_FILTER_CATROM, "CATMULLROM", 0, "Catmull-Rom", ""}, - {R_FILTER_GAUSS, "GAUSSIAN", 0, "Gaussian", ""}, - {R_FILTER_MITCH, "MITCHELL", 0, "Mitchell-Netravali", ""}, + {R_FILTER_BOX, "BOX", 0, "Box", "Use a box filter for anti-aliasing"}, + {R_FILTER_TENT, "TENT", 0, "Tent", "Use a tent filter for anti-aliasing"}, + {R_FILTER_QUAD, "QUADRATIC", 0, "Quadratic", "Use a quadratic filter for anti-aliasing"}, + {R_FILTER_CUBIC, "CUBIC", 0, "Cubic", "Use a cubic filter for anti-aliasing"}, + {R_FILTER_CATROM, "CATMULLROM", 0, "Catmull-Rom", "Use a Catmull-Rom filter for anti-aliasing"}, + {R_FILTER_GAUSS, "GAUSSIAN", 0, "Gaussian", "Use a Gaussian filter for anti-aliasing"}, + {R_FILTER_MITCH, "MITCHELL", 0, "Mitchell-Netravali", "Use a Mitchell-Netravali filter for anti-aliasing"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem alpha_mode_items[] ={ @@ -2343,19 +2344,25 @@ static void rna_def_scene_render_data(BlenderRNA *brna) /* Bake */ static EnumPropertyItem bake_mode_items[] ={ - {RE_BAKE_ALL, "FULL", 0, "Full Render", ""}, - {RE_BAKE_AO, "AO", 0, "Ambient Occlusion", ""}, - {RE_BAKE_SHADOW, "SHADOW", 0, "Shadow", ""}, - {RE_BAKE_NORMALS, "NORMALS", 0, "Normals", ""}, - {RE_BAKE_TEXTURE, "TEXTURE", 0, "Textures", ""}, - {RE_BAKE_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", ""}, + {RE_BAKE_ALL, "FULL", 0, "Full Render", "Bake everything"}, + {RE_BAKE_AO, "AO", 0, "Ambient Occlusion", "Bake ambient occlusion"}, + {RE_BAKE_SHADOW, "SHADOW", 0, "Shadow", "Bake shadows"}, + {RE_BAKE_NORMALS, "NORMALS", 0, "Normals", "Bake normals"}, + {RE_BAKE_TEXTURE, "TEXTURE", 0, "Textures", "Bake textures"}, + {RE_BAKE_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Bake displacement"}, + {RE_BAKE_EMIT, "EMIT", 0, "Emission", "Bake Emit values (glow)"}, + {RE_BAKE_ALPHA, "ALPHA", 0, "Alpha", "Bake Alpha values (transparency)"}, + {RE_BAKE_MIRROR_INTENSITY, "MIRROR_INTENSITY", 0, "Mirror Intensity", "Bake Mirror values"}, + {RE_BAKE_MIRROR_COLOR, "MIRROR_COLOR", 0, "Mirror Colors", "Bake Mirror colors"}, + {RE_BAKE_SPEC_INTENSITY, "SPEC_INTENSITY", 0, "Specular Intensity", "Bake Specular values"}, + {RE_BAKE_SPEC_COLOR, "SPEC_COLOR", 0, "Specular Colors", "Bake Specular colors"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem bake_normal_space_items[] ={ - {R_BAKE_SPACE_CAMERA, "CAMERA", 0, "Camera", ""}, - {R_BAKE_SPACE_WORLD, "WORLD", 0, "World", ""}, - {R_BAKE_SPACE_OBJECT, "OBJECT", 0, "Object", ""}, - {R_BAKE_SPACE_TANGENT, "TANGENT", 0, "Tangent", ""}, + {R_BAKE_SPACE_CAMERA, "CAMERA", 0, "Camera", "Bake the normals in camera space"}, + {R_BAKE_SPACE_WORLD, "WORLD", 0, "World", "Bake the normals in world space"}, + {R_BAKE_SPACE_OBJECT, "OBJECT", 0, "Object", "Bake the normals in object space"}, + {R_BAKE_SPACE_TANGENT, "TANGENT", 0, "Tangent", "Bake the normals in tangent space"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem bake_qyad_split_items[] ={ @@ -2372,12 +2379,12 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem raytrace_structure_items[] = { - {R_RAYSTRUCTURE_AUTO, "AUTO", 0, "Auto", ""}, + {R_RAYSTRUCTURE_AUTO, "AUTO", 0, "Auto", "Automatically select acceleration structure"}, {R_RAYSTRUCTURE_OCTREE, "OCTREE", 0, "Octree", "Use old Octree structure"}, {R_RAYSTRUCTURE_BLIBVH, "BLIBVH", 0, "BLI BVH", "Use BLI K-Dop BVH.c"}, - {R_RAYSTRUCTURE_VBVH, "VBVH", 0, "vBVH", ""}, - {R_RAYSTRUCTURE_SIMD_SVBVH, "SIMD_SVBVH", 0, "SIMD SVBVH", ""}, - {R_RAYSTRUCTURE_SIMD_QBVH, "SIMD_QBVH", 0, "SIMD QBVH", ""}, + {R_RAYSTRUCTURE_VBVH, "VBVH", 0, "vBVH", "Use vBVH"}, + {R_RAYSTRUCTURE_SIMD_SVBVH, "SIMD_SVBVH", 0, "SIMD SVBVH", "Use SIMD SVBVH"}, + {R_RAYSTRUCTURE_SIMD_QBVH, "SIMD_QBVH", 0, "SIMD QBVH", "Use SIMD QBVH"}, {0, NULL, 0, NULL, NULL} }; @@ -2506,7 +2513,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) #endif static EnumPropertyItem engine_items[] = { - {0, "BLENDER_RENDER", 0, "Blender Render", ""}, + {0, "BLENDER_RENDER", 0, "Blender Render", "Use the Blender internal rendering engine for rendering"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "RenderSettings", NULL); @@ -2947,7 +2954,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "edge_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "edgeR"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Edge Color", ""); + RNA_def_property_ui_text(prop, "Edge Color", "Edge color"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE); @@ -3571,10 +3578,15 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "r.cfra"); RNA_def_property_range(prop, MINAFRAME, MAXFRAME); RNA_def_property_int_funcs(prop, NULL, "rna_Scene_current_frame_set", NULL); - RNA_def_property_ui_text(prop, "Current Frame", ""); + RNA_def_property_ui_text(prop, "Current Frame", "Current Frame"); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_frame_update"); + prop= RNA_def_property(srna, "frame_subframe", PROP_FLOAT, PROP_TIME); + RNA_def_property_float_sdna(prop, NULL, "r.subframe"); + RNA_def_property_ui_text(prop, "Current Sub-Frame", ""); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE); + prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "r.sfra"); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index ce018fdfd6e..da536f95cba 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -481,12 +481,12 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ParticleBrushData"); RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush"); - prop= RNA_def_property(srna, "size", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE); RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_ui_range(prop, 1, 100, 10, 3); RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels"); - prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR); RNA_def_property_range(prop, 0.001, 1.0); RNA_def_property_ui_text(prop, "Strength", "Brush strength"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 34963e9507f..90ae95894b0 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -387,6 +387,8 @@ static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr) return &RNA_EffectSequence; case SEQ_MULTICAM: return &RNA_MulticamSequence; + case SEQ_ADJUSTMENT: + return &RNA_AdjustmentSequence; case SEQ_PLUGIN: return &RNA_PluginSequence; case SEQ_WIPE: @@ -844,6 +846,7 @@ static void rna_def_sequence(BlenderRNA *brna) {SEQ_COLOR, "COLOR", 0, "Color", ""}, {SEQ_SPEED, "SPEED", 0, "Speed", ""}, {SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, + {SEQ_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, {0, NULL, 0, NULL, NULL}}; static const EnumPropertyItem blend_mode_items[]= { @@ -1371,6 +1374,20 @@ static void rna_def_multicam(BlenderRNA *brna) rna_def_input(srna); } +static void rna_def_adjustment(BlenderRNA *brna) +{ + StructRNA *srna; +// PropertyRNA *prop; + + srna = RNA_def_struct(brna, "AdjustmentSequence", "Sequence"); + RNA_def_struct_ui_text(srna, "Adjustment Layer Sequence", "Sequence strip to perform filter adjustments to layers below"); + RNA_def_struct_sdna(srna, "Sequence"); + + rna_def_filter_video(srna); + rna_def_proxy(srna); + rna_def_input(srna); +} + static void rna_def_plugin(BlenderRNA *brna) { StructRNA *srna; @@ -1620,6 +1637,7 @@ void RNA_def_sequencer(BlenderRNA *brna) rna_def_sound(brna); rna_def_effect(brna); rna_def_multicam(brna); + rna_def_adjustment(brna); rna_def_plugin(brna); rna_def_wipe(brna); rna_def_glow(brna); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 922c68f45bd..974f2fdecb8 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -212,7 +212,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "strength"); RNA_def_property_range(prop, 0.0, 10.0); RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2); - RNA_def_property_ui_text(prop, "Strength", "Strength of wavelet noise"); + RNA_def_property_ui_text(prop, "Strength", "Strength of noise"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 59824d6a752..6b6071c4912 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -76,9 +76,6 @@ static EnumPropertyItem draw_channels_items[] = { {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, {SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"}, {SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer", "Draw Z-buffer associated with image (mapped from camera clip start to end)"}, -#ifdef WITH_LCMS - {SI_COLOR_CORRECTION, "COLOR_CORRECTED", ICON_IMAGE_ALPHA, "Color Corrected", "Display color corrected image"}, -#endif {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem transform_orientation_items[] = { @@ -426,7 +423,7 @@ static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *value { RegionView3D *rv3d= (RegionView3D *)(ptr->data); negate_v3_v3(rv3d->ofs, values); - view3d_apply_mat4((float (*)[4])values, rv3d->ofs, rv3d->viewquat, &rv3d->dist); + ED_view3d_from_m4((float (*)[4])values, rv3d->ofs, rv3d->viewquat, &rv3d->dist); } /* Space Image Editor */ @@ -498,16 +495,33 @@ static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *C, P RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ZBUF); } -#ifdef WITH_LCMS - RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_COLOR_CORRECTION); -#endif - RNA_enum_item_end(&item, &totitem); *free= 1; return item; } +static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values) +{ + SpaceImage *sima= (SpaceImage*)ptr->data; + ScrArea *sa; + ARegion *ar; + + values[0] = values[1] = 1; + + sa = rna_area_from_space(ptr); + if(!sa) return; + + /* find aregion */ + for(ar=sa->regionbase.first; ar; ar=ar->next) { + if(ar->regiontype == RGN_TYPE_WINDOW) + break; + } + if(!ar) return; + + ED_space_image_zoom(sima, ar, &values[0], &values[1]); +} + static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *values) { SpaceImage *sima= (SpaceImage*)ptr->data; @@ -1017,18 +1031,18 @@ static void rna_def_space_outliner(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem display_mode_items[] = { - {SO_ALL_SCENES, "ALL_SCENES", 0, "All Scenes", ""}, - {SO_CUR_SCENE, "CURRENT_SCENE", 0, "Current Scene", ""}, - {SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", ""}, - {SO_SELECTED, "SELECTED", 0, "Selected", ""}, - {SO_ACTIVE, "ACTIVE", 0, "Active", ""}, - {SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types", ""}, - {SO_GROUPS, "GROUPS", 0, "Groups", ""}, - {SO_LIBRARIES, "LIBRARIES", 0, "Libraries", ""}, - {SO_SEQUENCE, "SEQUENCE", 0, "Sequence", ""}, - {SO_DATABLOCKS, "DATABLOCKS", 0, "Datablocks", ""}, - {SO_USERDEF, "USER_PREFERENCES", 0, "User Preferences", ""}, - {SO_KEYMAP, "KEYMAPS", 0, "Key Maps", ""}, + {SO_ALL_SCENES, "ALL_SCENES", 0, "All Scenes", "Display datablocks in all scenes"}, + {SO_CUR_SCENE, "CURRENT_SCENE", 0, "Current Scene", "Display datablocks in current scene"}, + {SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", "Display datablocks in visible layers"}, + {SO_SELECTED, "SELECTED", 0, "Selected", "Display datablocks of selected objects"}, + {SO_ACTIVE, "ACTIVE", 0, "Active", "Display datablocks of active object"}, + {SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types", "Display datablocks of all objects of same type as selected object"}, + {SO_GROUPS, "GROUPS", 0, "Groups", "Display groups and their datablocks"}, + {SO_LIBRARIES, "LIBRARIES", 0, "Libraries", "Display libraries"}, + {SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence datablocks"}, + {SO_DATABLOCKS, "DATABLOCKS", 0, "Datablocks", "Display raw datablocks"}, + {SO_USERDEF, "USER_PREFERENCES", 0, "User Preferences", "Display the user preference datablocks"}, + {SO_KEYMAP, "KEYMAPS", 0, "Key Maps", "Display keymap datablocks"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SpaceOutliner", "Space"); @@ -1070,20 +1084,20 @@ static void rna_def_background_image(BlenderRNA *brna) /* note: combinations work but dont flip so arnt that useful */ static EnumPropertyItem bgpic_axis_items[] = { {0, "", 0, "X Axis", ""}, - {(1<<RV3D_VIEW_LEFT), "LEFT", 0, "Left", ""}, - {(1<<RV3D_VIEW_RIGHT), "RIGHT", 0, "Right", ""}, + {(1<<RV3D_VIEW_LEFT), "LEFT", 0, "Left", "Show background image while looking to the left"}, + {(1<<RV3D_VIEW_RIGHT), "RIGHT", 0, "Right", "Show background image while looking to the right"}, /*{(1<<RV3D_VIEW_LEFT)|(1<<RV3D_VIEW_RIGHT), "LEFT_RIGHT", 0, "Left/Right", ""},*/ {0, "", 0, "Y Axis", ""}, - {(1<<RV3D_VIEW_BACK), "BACK", 0, "Back", ""}, - {(1<<RV3D_VIEW_FRONT), "FRONT", 0, "Front", ""}, + {(1<<RV3D_VIEW_BACK), "BACK", 0, "Back", "Show background image in back view"}, + {(1<<RV3D_VIEW_FRONT), "FRONT", 0, "Front", "Show background image in front view"}, /*{(1<<RV3D_VIEW_BACK)|(1<<RV3D_VIEW_FRONT), "BACK_FRONT", 0, "Back/Front", ""},*/ {0, "", 0, "Z Axis", ""}, - {(1<<RV3D_VIEW_BOTTOM), "BOTTOM", 0, "Bottom", ""}, - {(1<<RV3D_VIEW_TOP), "TOP", 0, "Top", ""}, + {(1<<RV3D_VIEW_BOTTOM), "BOTTOM", 0, "Bottom", "Show background image in bottom view"}, + {(1<<RV3D_VIEW_TOP), "TOP", 0, "Top", "Show background image in top view"}, /*{(1<<RV3D_VIEW_BOTTOM)|(1<<RV3D_VIEW_TOP), "BOTTOM_TOP", 0, "Top/Bottom", ""},*/ {0, "", 0, "Other", ""}, - {0, "ALL", 0, "All Views", ""}, - {(1<<RV3D_VIEW_CAMERA), "CAMERA", 0, "Camera", ""}, + {0, "ALL", 0, "All Views", "Show background image in all views"}, + {(1<<RV3D_VIEW_CAMERA), "CAMERA", 0, "Camera", "Show background image in camera view"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "BackgroundImage", NULL); @@ -1145,11 +1159,11 @@ static void rna_def_space_view3d(BlenderRNA *brna) const int matrix_dimsize[]= {4, 4}; static EnumPropertyItem pivot_items[] = { - {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""}, - {V3D_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", ""}, - {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Origins", ""}, - {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", ""}, - {V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", ""}, + {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", "Pivot around bounding box center of selected object(s)"}, + {V3D_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"}, + {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Origins", "Pivot around each object's own origin"}, + {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", "Pivot around the median point of selected objects"}, + {V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", "Pivot around active object"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem rv3d_persp_items[] = { @@ -1209,7 +1223,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "near"); - RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_range(prop, 0.001f, FLT_MAX); RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); @@ -1277,6 +1291,11 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid view"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + prop= RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_LOCK_CAMERA); + RNA_def_property_ui_text(prop, "Lock Camera to View", "Enable view navigation within the camera view"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + prop= RNA_def_property(srna, "show_only_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE); RNA_def_property_ui_text(prop, "Only Render", "Display only objects which will be rendered"); @@ -1416,6 +1435,11 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_enum_items(prop, rv3d_persp_items); RNA_def_property_ui_text(prop, "Perspective", "View Perspective"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + + prop= RNA_def_property(srna, "is_perspective", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "is_persp", 1); + RNA_def_property_ui_text(prop, "Is Perspective", ""); + RNA_def_property_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION); #if 0 @@ -1556,6 +1580,12 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "sample_line_hist"); RNA_def_property_struct_type(prop, "Histogram"); RNA_def_property_ui_text(prop, "Line sample", "Sampled colors along line"); + + prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE); + RNA_def_property_array(prop, 2); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_zoom_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Zoom", "Zoom factor"); /* image draw */ prop= RNA_def_property(srna, "show_repeat", PROP_BOOLEAN, PROP_NONE); @@ -1847,10 +1877,10 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem mode_items[] = { - {SACTCONT_DOPESHEET, "DOPESHEET", 0, "DopeSheet", ""}, - {SACTCONT_ACTION, "ACTION", 0, "Action Editor", ""}, - {SACTCONT_SHAPEKEY, "SHAPEKEY", 0, "ShapeKey Editor", ""}, - {SACTCONT_GPENCIL, "GPENCIL", 0, "Grease Pencil", ""}, + {SACTCONT_DOPESHEET, "DOPESHEET", 0, "DopeSheet", "DopeSheet Editor"}, + {SACTCONT_ACTION, "ACTION", 0, "Action Editor", "Action Editor"}, + {SACTCONT_SHAPEKEY, "SHAPEKEY", 0, "ShapeKey Editor", "ShapeKey Editor"}, + {SACTCONT_GPENCIL, "GPENCIL", 0, "Grease Pencil", "Grease Pencil"}, {0, NULL, 0, NULL, NULL}}; @@ -1929,8 +1959,8 @@ static void rna_def_space_graph(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem mode_items[] = { - {SIPO_MODE_ANIMATION, "FCURVES", 0, "F-Curve Editor", ""}, - {SIPO_MODE_DRIVERS, "DRIVERS", 0, "Drivers", ""}, + {SIPO_MODE_ANIMATION, "FCURVES", 0, "F-Curve Editor", "Edit f-curves"}, + {SIPO_MODE_DRIVERS, "DRIVERS", 0, "Drivers", "Edit drivers"}, {0, NULL, 0, NULL, NULL}}; /* this is basically the same as the one for the 3D-View, but with some entries ommitted */ diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index fc74fc7268d..a750fa3765f 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -56,21 +56,21 @@ EnumPropertyItem texture_filter_items[] = { EnumPropertyItem texture_type_items[] = { {0, "NONE", 0, "None", ""}, - {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", ""}, - {TEX_CLOUDS, "CLOUDS", ICON_TEXTURE, "Clouds", ""}, - {TEX_DISTNOISE, "DISTORTED_NOISE", ICON_TEXTURE, "Distorted Noise", ""}, - {TEX_ENVMAP, "ENVIRONMENT_MAP", ICON_IMAGE_DATA, "Environment Map", ""}, - {TEX_IMAGE, "IMAGE", ICON_IMAGE_DATA, "Image or Movie", ""}, - {TEX_MAGIC, "MAGIC", ICON_TEXTURE, "Magic", ""}, - {TEX_MARBLE, "MARBLE", ICON_TEXTURE, "Marble", ""}, - {TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", ""}, - {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise", ""}, + {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", "Procedural - Creates a ramp texture"}, + {TEX_CLOUDS, "CLOUDS", ICON_TEXTURE, "Clouds", "Procedural - Creates a cloud-like fractal noise texture"}, + {TEX_DISTNOISE, "DISTORTED_NOISE", ICON_TEXTURE, "Distorted Noise", "Procedural - Noise texture distorted by two noise algorithms"}, + {TEX_ENVMAP, "ENVIRONMENT_MAP", ICON_IMAGE_DATA, "Environment Map", "Creates a render of the environment mapped to a texture"}, + {TEX_IMAGE, "IMAGE", ICON_IMAGE_DATA, "Image or Movie", "Allows for images or movies to be used as textures"}, + {TEX_MAGIC, "MAGIC", ICON_TEXTURE, "Magic", "Procedural - Color texture based on trigonometric functions"}, + {TEX_MARBLE, "MARBLE", ICON_TEXTURE, "Marble", "Procedural - Marble-like noise texture with wave generated bands"}, + {TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", "Procedural - Highly flexible fractal noise texture"}, + {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise", "Procedural - Random noise, gives a different result every time, for every frame, for every pixel"}, //{TEX_PLUGIN, "PLUGIN", ICON_PLUGIN, "Plugin", ""}, /* Nothing yet */ {TEX_POINTDENSITY, "POINT_DENSITY", ICON_TEXTURE, "Point Density", ""}, - {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", ""}, - {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", ""}, - {TEX_VOXELDATA, "VOXEL_DATA", ICON_TEXTURE, "Voxel Data", ""}, - {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", ""}, + {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - Creates a fractal noise texture"}, + {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - Creates cell-like patterns based on Worley noise"}, + {TEX_VOXELDATA, "VOXEL_DATA", ICON_TEXTURE, "Voxel Data", "Creates a 3d texture based on volumetric data"}, + {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", "Procedural - Wave generated bands or rings, with optional noise"}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -509,7 +509,7 @@ static void rna_def_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "blendtype"); RNA_def_property_enum_items(prop, prop_blend_type_items); - RNA_def_property_ui_text(prop, "Blend Type", ""); + RNA_def_property_ui_text(prop, "Blend Type", "The mode used to apply the texture"); RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop= RNA_def_property(srna, "use_stencil", PROP_BOOLEAN, PROP_NONE); @@ -627,7 +627,7 @@ static void rna_def_environment_map(BlenderRNA *brna) prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "clipsta"); - RNA_def_property_range(prop, 0.01, FLT_MAX); + RNA_def_property_range(prop, 0.001, FLT_MAX); RNA_def_property_ui_range(prop, 0.01, 50, 100, 2); RNA_def_property_ui_text(prop, "Clip Start", "Objects nearer than this are not visible to map"); RNA_def_property_update(prop, 0, "rna_Texture_update"); @@ -665,21 +665,21 @@ static void rna_def_environment_map(BlenderRNA *brna) } static EnumPropertyItem prop_noise_basis_items[] = { - {TEX_BLENDER, "BLENDER_ORIGINAL", 0, "Blender Original", ""}, - {TEX_STDPERLIN, "ORIGINAL_PERLIN", 0, "Original Perlin", ""}, - {TEX_NEWPERLIN, "IMPROVED_PERLIN", 0, "Improved Perlin", ""}, - {TEX_VORONOI_F1, "VORONOI_F1", 0, "Voronoi F1", ""}, - {TEX_VORONOI_F2, "VORONOI_F2", 0, "Voronoi F2", ""}, - {TEX_VORONOI_F3, "VORONOI_F3", 0, "Voronoi F3", ""}, - {TEX_VORONOI_F4, "VORONOI_F4", 0, "Voronoi F4", ""}, - {TEX_VORONOI_F2F1, "VORONOI_F2_F1", 0, "Voronoi F2-F1", ""}, - {TEX_VORONOI_CRACKLE, "VORONOI_CRACKLE", 0, "Voronoi Crackle", ""}, - {TEX_CELLNOISE, "CELL_NOISE", 0, "Cell Noise", ""}, + {TEX_BLENDER, "BLENDER_ORIGINAL", 0, "Blender Original", "Noise algorithm - Blender original: Smooth interpolated noise"}, + {TEX_STDPERLIN, "ORIGINAL_PERLIN", 0, "Original Perlin", "Noise algorithm - Original Perlin: Smooth interpolated noise"}, + {TEX_NEWPERLIN, "IMPROVED_PERLIN", 0, "Improved Perlin", "Noise algorithm - Improved Perlin: Smooth interpolated noise"}, + {TEX_VORONOI_F1, "VORONOI_F1", 0, "Voronoi F1", "Noise algorithm - Voronoi F1: Returns distance to the closest feature point"}, + {TEX_VORONOI_F2, "VORONOI_F2", 0, "Voronoi F2", "Noise algorithm - Voronoi F2: Returns distance to the 2nd closest feature point"}, + {TEX_VORONOI_F3, "VORONOI_F3", 0, "Voronoi F3", "Noise algorithm - Voronoi F3: Returns distance to the 3rd closest feature point"}, + {TEX_VORONOI_F4, "VORONOI_F4", 0, "Voronoi F4", "Noise algorithm - Voronoi F4: Returns distance to the 4th closest feature point"}, + {TEX_VORONOI_F2F1, "VORONOI_F2_F1", 0, "Voronoi F2-F1", "Noise algorithm - Voronoi F1-F2"}, + {TEX_VORONOI_CRACKLE, "VORONOI_CRACKLE", 0, "Voronoi Crackle", "Noise algorithm - Voronoi Crackle: Voronoi tessellation with sharp edges"}, + {TEX_CELLNOISE, "CELL_NOISE", 0, "Cell Noise", "Noise algorithm - Cell Noise: Square cell tessallation"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_noise_type[] = { - {TEX_NOISESOFT, "SOFT_NOISE", 0, "Soft", ""}, - {TEX_NOISEPERL, "HARD_NOISE", 0, "Hard", ""}, + {TEX_NOISESOFT, "SOFT_NOISE", 0, "Soft", "Generate soft noise (smooth transitions)"}, + {TEX_NOISEPERL, "HARD_NOISE", 0, "Hard", "Generate hard noise (sharp transitions)"}, {0, NULL, 0, NULL, NULL}}; @@ -726,7 +726,7 @@ static void rna_def_texture_clouds(BlenderRNA *brna) prop= RNA_def_property(srna, "cloud_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "stype"); RNA_def_property_enum_items(prop, prop_clouds_stype); - RNA_def_property_ui_text(prop, "Color", ""); + RNA_def_property_ui_text(prop, "Color", "Determines whether Noise returns grayscale or RGB values"); RNA_def_property_update(prop, 0, "rna_Texture_nodes_update"); prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE); @@ -1195,11 +1195,11 @@ static void rna_def_texture_musgrave(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_musgrave_type[] = { - {TEX_MFRACTAL, "MULTIFRACTAL", 0, "Multifractal", ""}, - {TEX_RIDGEDMF, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", ""}, - {TEX_HYBRIDMF, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", ""}, - {TEX_FBM, "FBM", 0, "fBM", ""}, - {TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", ""}, + {TEX_MFRACTAL, "MULTIFRACTAL", 0, "Multifractal", "Fractal noise algorithm. Multifractal: Uses Perlin noise as a basis"}, + {TEX_RIDGEDMF, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", "Fractal noise algorithm. Ridged Multifractal: Uses Perlin noise with inflection as a basis"}, + {TEX_HYBRIDMF, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", "Fractal noise algorithm.Hybrid Multifractal: Uses Perlin noise as a basis, with extended controls"}, + {TEX_FBM, "FBM", 0, "fBM", "Fractal noise algorithm. Fractal Brownian Motion: Uses Brownian noise as a basis"}, + {TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", "Fractal noise algorithm. Hetero Terrain: similar to multifractal"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "MusgraveTexture", "Texture"); @@ -1245,7 +1245,7 @@ static void rna_def_texture_musgrave(BlenderRNA *brna) prop= RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ns_outscale"); RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text(prop, "Noise Intensity", ""); + RNA_def_property_ui_text(prop, "Noise Intensity", "Scales the intensity of the noise"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE); @@ -1274,13 +1274,13 @@ static void rna_def_texture_voronoi(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_distance_metric_items[] = { - {TEX_DISTANCE, "DISTANCE", 0, "Actual Distance", ""}, - {TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", ""}, - {TEX_MANHATTAN, "MANHATTAN", 0, "Manhattan", ""}, - {TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", ""}, - {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkovsky 1/2", ""}, - {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkovsky 4", ""}, - {TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkovsky", ""}, + {TEX_DISTANCE, "DISTANCE", 0, "Actual Distance", "Algorithm used to calculate distance of sample points to feature points. Actual Distance: sqrt(x*x+y*y+z*z)"}, + {TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", "Algorithm used to calculate distance of sample points to feature points. Distance squared: (x*x+y*y+z*z)"}, + {TEX_MANHATTAN, "MANHATTAN", 0, "Manhattan", "Algorithm used to calculate distance of sample points to feature points. Manhattan: The length of the distance in axial directions"}, + {TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "Algorithm used to calculate distance of sample points to feature points. Chebychev: The length of the longest Axial journey"}, + {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkovsky 1/2", "Algorithm used to calculate distance of sample points to feature points. Minovsky 1/2: Sets Minkovsky variable to 0.5"}, + {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkovsky 4", "Algorithm used to calculate distance of sample points to feature points. Minkovsky 4: Sets Minkovsky variable to 4"}, + {TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkovsky", "Algorithm used to calculate distance of sample points to feature points. Minkovsky: Uses the Minkowsky function to calculate distance. Exponent value determines the shape of the boundaries"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_coloring_items[] = { @@ -1340,7 +1340,7 @@ static void rna_def_texture_voronoi(BlenderRNA *brna) prop= RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ns_outscale"); RNA_def_property_range(prop, 0.01, 10); - RNA_def_property_ui_text(prop, "Noise Intensity", ""); + RNA_def_property_ui_text(prop, "Noise Intensity", "Scales the intensity of the noise"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE); @@ -1369,7 +1369,7 @@ static void rna_def_texture_distorted_noise(BlenderRNA *brna) prop= RNA_def_property(srna, "distortion", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dist_amount"); RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text(prop, "Distortion Amount", ""); + RNA_def_property_ui_text(prop, "Distortion Amount", "Amount of distortion"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE); @@ -1550,7 +1550,6 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) prop= RNA_def_property(srna, "turbulence_strength", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "noise_fac"); RNA_def_property_range(prop, 0.01, FLT_MAX); - RNA_def_property_ui_text(prop, "Strength", ""); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE); @@ -1737,17 +1736,17 @@ static void rna_def_texture(BlenderRNA *brna) prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bright"); RNA_def_property_range(prop, 0, 2); - RNA_def_property_ui_text(prop, "Brightness", ""); + RNA_def_property_ui_text(prop, "Brightness", "Adjusts the brightness of the texture"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01, 5); - RNA_def_property_ui_text(prop, "Contrast", ""); + RNA_def_property_ui_text(prop, "Contrast", "Adjusts the contrast of the texture"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0, 2); - RNA_def_property_ui_text(prop, "Saturation", ""); + RNA_def_property_ui_text(prop, "Saturation", "Adjusts the saturation of colors in the texture"); RNA_def_property_update(prop, 0, "rna_Texture_update"); /* RGB Factor */ diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index d48c1d35c13..13c7ac238a3 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -148,7 +148,7 @@ static void panel_draw_header(const bContext *C, Panel *pnl) RNA_parameter_list_free(&list); } -static void rna_Panel_unregister(const bContext *C, StructRNA *type) +static void rna_Panel_unregister(Main *bmain, StructRNA *type) { ARegionType *art; PanelType *pt= RNA_struct_blender_type_get(type); @@ -164,11 +164,10 @@ static void rna_Panel_unregister(const bContext *C, StructRNA *type) RNA_struct_free(&BLENDER_RNA, type); /* update while blender is running */ - if(C) - WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); } -static StructRNA *rna_Panel_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { ARegionType *art; PanelType *pt, dummypt = {NULL}; @@ -196,7 +195,7 @@ static StructRNA *rna_Panel_register(bContext *C, ReportList *reports, void *dat for(pt=art->paneltypes.first; pt; pt=pt->next) { if(strcmp(pt->idname, dummypt.idname) == 0) { if(pt->ext.srna) - rna_Panel_unregister(C, pt->ext.srna); + rna_Panel_unregister(bmain, pt->ext.srna); else BLI_freelinkN(&art->paneltypes, pt); break; @@ -233,8 +232,7 @@ static StructRNA *rna_Panel_register(bContext *C, ReportList *reports, void *dat BLI_addtail(&art->paneltypes, pt); /* update while blender is running */ - if(C) - WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); return pt->ext.srna; } @@ -263,7 +261,7 @@ static void header_draw(const bContext *C, Header *hdr) RNA_parameter_list_free(&list); } -static void rna_Header_unregister(const bContext *C, StructRNA *type) +static void rna_Header_unregister(Main *bmain, StructRNA *type) { ARegionType *art; HeaderType *ht= RNA_struct_blender_type_get(type); @@ -279,11 +277,10 @@ static void rna_Header_unregister(const bContext *C, StructRNA *type) RNA_struct_free(&BLENDER_RNA, type); /* update while blender is running */ - if(C) - WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); } -static StructRNA *rna_Header_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { ARegionType *art; HeaderType *ht, dummyht = {NULL}; @@ -311,7 +308,7 @@ static StructRNA *rna_Header_register(bContext *C, ReportList *reports, void *da for(ht=art->headertypes.first; ht; ht=ht->next) { if(strcmp(ht->idname, dummyht.idname) == 0) { if(ht->ext.srna) - rna_Header_unregister(C, ht->ext.srna); + rna_Header_unregister(bmain, ht->ext.srna); break; } } @@ -331,8 +328,7 @@ static StructRNA *rna_Header_register(bContext *C, ReportList *reports, void *da BLI_addtail(&art->headertypes, ht); /* update while blender is running */ - if(C) - WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); return ht->ext.srna; } @@ -384,7 +380,7 @@ static void menu_draw(const bContext *C, Menu *hdr) RNA_parameter_list_free(&list); } -static void rna_Menu_unregister(const bContext *C, StructRNA *type) +static void rna_Menu_unregister(Main *bmain, StructRNA *type) { MenuType *mt= RNA_struct_blender_type_get(type); @@ -398,11 +394,10 @@ static void rna_Menu_unregister(const bContext *C, StructRNA *type) RNA_struct_free(&BLENDER_RNA, type); /* update while blender is running */ - if(C) - WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); } -static StructRNA *rna_Menu_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { MenuType *mt, dummymt = {NULL}; Menu dummymenu= {NULL}; @@ -425,7 +420,7 @@ static StructRNA *rna_Menu_register(bContext *C, ReportList *reports, void *data /* check if we have registered this menu type before, and remove it */ mt= WM_menutype_find(dummymt.idname, TRUE); if(mt && mt->ext.srna) - rna_Menu_unregister(C, mt->ext.srna); + rna_Menu_unregister(bmain, mt->ext.srna); /* create a new menu type */ mt= MEM_callocN(sizeof(MenuType), "python buttons menu"); @@ -444,8 +439,7 @@ static StructRNA *rna_Menu_register(bContext *C, ReportList *reports, void *data WM_menutype_add(mt); /* update while blender is running */ - if(C) - WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); return mt->ext.srna; } @@ -617,12 +611,12 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Panel", "Panel containing UI elements"); RNA_def_struct_sdna(srna, "Panel"); RNA_def_struct_refine_func(srna, "rna_Panel_refine"); - RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister"); + RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL); /* poll */ func= RNA_def_function(srna, "poll", NULL); RNA_def_function_ui_description(func, "If this method returns a non-null output, then the panel can be drawn."); - RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER|FUNC_REGISTER_OPTIONAL); + RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL); RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); parm= RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); @@ -694,7 +688,7 @@ static void rna_def_header(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Header", "Editor header containing UI elements."); RNA_def_struct_sdna(srna, "Header"); RNA_def_struct_refine_func(srna, "rna_Header_refine"); - RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister"); + RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL); /* draw */ func= RNA_def_function(srna, "draw", NULL); @@ -736,12 +730,12 @@ static void rna_def_menu(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Menu", "Editor menu containing buttons"); RNA_def_struct_sdna(srna, "Menu"); RNA_def_struct_refine_func(srna, "rna_Menu_refine"); - RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister"); + RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL); /* poll */ func= RNA_def_function(srna, "poll", NULL); RNA_def_function_ui_description(func, "If this method returns a non-null output, then the menu can be drawn."); - RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER|FUNC_REGISTER_OPTIONAL); + RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL); RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); parm= RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index ae308b9423f..d4ac9880290 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -389,7 +389,7 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm= RNA_def_pointer(func, "image_user", "ImageUser", "", ""); - RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); RNA_def_boolean(func, "compact", 0, "", "Use more compact layout."); func= RNA_def_function(srna, "template_list", "uiTemplateList"); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 4c79c27e0de..e8b127b68bb 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -669,19 +669,20 @@ static void rna_wmClipboard_set(PointerRNA *ptr, const char *value) } #ifdef WITH_PYTHON -static void rna_Operator_unregister(const bContext *C, StructRNA *type) +static void rna_Operator_unregister(struct Main *bmain, StructRNA *type) { const char *idname; wmOperatorType *ot= RNA_struct_blender_type_get(type); + wmWindowManager *wm; if(!ot) return; /* update while blender is running */ - if(C) { - WM_operator_stack_clear((bContext*)C); - WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); - } + wm= bmain->wm.first; + if(wm) + WM_operator_stack_clear(wm); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); RNA_struct_free_extension(type, &ot->ext); @@ -858,7 +859,7 @@ void macro_wrapper(wmOperatorType *ot, void *userdata); static char _operator_idname[OP_MAX_TYPENAME]; static char _operator_name[OP_MAX_TYPENAME]; static char _operator_descr[1024]; -static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { wmOperatorType dummyot = {NULL}; wmOperator dummyop= {NULL}; @@ -935,7 +936,7 @@ static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void * { wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE); if(ot && ot->ext.srna) - rna_Operator_unregister(C, ot->ext.srna); + rna_Operator_unregister(bmain, ot->ext.srna); } /* create a new menu type */ @@ -955,14 +956,18 @@ static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void * WM_operatortype_append_ptr(operator_wrapper, (void *)&dummyot); /* update while blender is running */ - if(C) - WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); return dummyot.ext.srna; } +void **rna_Operator_instance(PointerRNA *ptr) +{ + wmOperator *op = ptr->data; + return &op->py_instance; +} -static StructRNA *rna_MacroOperator_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { wmOperatorType dummyot = {NULL}; wmOperator dummyop= {NULL}; @@ -1006,7 +1011,7 @@ static StructRNA *rna_MacroOperator_register(bContext *C, ReportList *reports, v { wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE); if(ot && ot->ext.srna) - rna_Operator_unregister(C, ot->ext.srna); + rna_Operator_unregister(bmain, ot->ext.srna); } /* create a new menu type */ @@ -1021,8 +1026,7 @@ static StructRNA *rna_MacroOperator_register(bContext *C, ReportList *reports, v WM_operatortype_append_macro_ptr(macro_wrapper, (void *)&dummyot); /* update while blender is running */ - if(C) - WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); + WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); return dummyot.ext.srna; } @@ -1161,7 +1165,7 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_struct_sdna(srna, "wmOperator"); RNA_def_struct_refine_func(srna, "rna_Operator_refine"); #ifdef WITH_PYTHON - RNA_def_struct_register_funcs(srna, "rna_Operator_register", "rna_Operator_unregister"); + RNA_def_struct_register_funcs(srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance"); #endif prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); @@ -1230,7 +1234,7 @@ static void rna_def_macro_operator(BlenderRNA *brna) RNA_def_struct_sdna(srna, "wmOperator"); RNA_def_struct_refine_func(srna, "rna_MacroOperator_refine"); #ifdef WITH_PYTHON - RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister"); + RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister", "rna_Operator_instance"); #endif prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 7166d51da5a..064f28df85d 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -223,7 +223,7 @@ static void rna_def_lighting(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_sample_method_items[] = { - {WO_AOSAMP_CONSTANT, "CONSTANT_JITTERED", 0, "Constant Jittered", ""}, + {WO_AOSAMP_CONSTANT, "CONSTANT_JITTERED", 0, "Constant Jittered", "Fastest and gives the most noise"}, {WO_AOSAMP_HALTON, "ADAPTIVE_QMC", 0, "Adaptive QMC", "Fast in high-contrast areas"}, {WO_AOSAMP_HAMMERSLEY, "CONSTANT_QMC", 0, "Constant QMC", "Best quality"}, {0, NULL, 0, NULL, NULL}}; @@ -314,7 +314,7 @@ static void rna_def_lighting(BlenderRNA *brna) prop= RNA_def_property(srna, "falloff_strength", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "aodistfac"); - RNA_def_property_ui_text(prop, "Strength", "Distance attenuation factor, the higher, the less influence farther away objects have influence"); + RNA_def_property_ui_text(prop, "Strength", "Attenuation falloff strength, the higher, the less influence distant objects have"); RNA_def_property_update(prop, 0, "rna_World_update"); prop= RNA_def_property(srna, "bias", PROP_FLOAT, PROP_NONE); @@ -350,7 +350,7 @@ static void rna_def_lighting(BlenderRNA *brna) prop= RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AODIST); - RNA_def_property_ui_text(prop, "Falloff", ""); + RNA_def_property_ui_text(prop, "Falloff", "Distance will be used to attenuate shadows"); RNA_def_property_update(prop, 0, "rna_World_update"); prop= RNA_def_property(srna, "use_cache", PROP_BOOLEAN, PROP_NONE); @@ -515,7 +515,7 @@ void RNA_def_world(BlenderRNA *brna) prop= RNA_def_property(srna, "ambient_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "ambr"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Ambient Color", ""); + RNA_def_property_ui_text(prop, "Ambient Color", "Ambient color of the world"); RNA_def_property_update(prop, 0, "rna_World_update"); /* exp, range */ diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 02912e38204..61345427d1c 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -139,8 +139,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) fluid_get_bb(mesh->mvert, mesh->totvert, ob->obmat, fss->bbStart, fss->bbSize); */ - // (ab)used to store velocities - fss->meshSurfNormals = NULL; + fss->meshVelocities = NULL; fss->lastgoodframe = -1; @@ -158,10 +157,10 @@ void fluidsim_free(FluidsimModifierData *fluidmd) #ifndef DISABLE_ELBEEM if(fluidmd) { - if(fluidmd->fss->meshSurfNormals) + if(fluidmd->fss->meshVelocities) { - MEM_freeN(fluidmd->fss->meshSurfNormals); - fluidmd->fss->meshSurfNormals = NULL; + MEM_freeN(fluidmd->fss->meshVelocities); + fluidmd->fss->meshVelocities = NULL; } MEM_freeN(fluidmd->fss); } @@ -394,12 +393,12 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * FluidsimSettings *fss = fluidmd->fss; int len = strlen(filename); int totvert = dm->getNumVerts(dm); - float *velarray = NULL; + FluidVertexVelocity *velarray = NULL; // mesh and vverts have to be valid from loading... - if(fss->meshSurfNormals) - MEM_freeN(fss->meshSurfNormals); + if(fss->meshVelocities) + MEM_freeN(fss->meshVelocities); if(len<7) { @@ -408,12 +407,10 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * if(fss->domainNovecgen>0) return; - // abusing pointer to hold an array of 3d-velocities - fss->meshSurfNormals = MEM_callocN(sizeof(float)*3*dm->getNumVerts(dm), "Fluidsim_velocities"); - // abusing pointer to hold an INT - fss->meshSurface = SET_INT_IN_POINTER(totvert); + fss->meshVelocities = MEM_callocN(sizeof(FluidVertexVelocity)*dm->getNumVerts(dm), "Fluidsim_velocities"); + fss->totvert = totvert; - velarray = (float *)fss->meshSurfNormals; + velarray = fss->meshVelocities; // .bobj.gz , correct filename // 87654321 @@ -424,16 +421,16 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * gzf = gzopen(filename, "rb"); if (!gzf) { - MEM_freeN(fss->meshSurfNormals); - fss->meshSurfNormals = NULL; + MEM_freeN(fss->meshVelocities); + fss->meshVelocities = NULL; return; } gzread(gzf, &wri, sizeof( wri )); if(wri != totvert) { - MEM_freeN(fss->meshSurfNormals); - fss->meshSurfNormals = NULL; + MEM_freeN(fss->meshVelocities); + fss->meshVelocities = NULL; return; } @@ -442,7 +439,7 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * for(j=0; j<3; j++) { gzread(gzf, &wrf, sizeof( wrf )); - velarray[3*i + j] = wrf; + velarray[i].vel[j] = wrf; } } @@ -531,10 +528,10 @@ static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData } else { - if(fss->meshSurfNormals) - MEM_freeN(fss->meshSurfNormals); + if(fss->meshVelocities) + MEM_freeN(fss->meshVelocities); - fss->meshSurfNormals = NULL; + fss->meshVelocities = NULL; } return dm; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c index a6ce77b64f0..36b7988c4e0 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c @@ -45,7 +45,7 @@ static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack * { bNodeSocket *sock= node->outputs.first; - VECCOPY(out[0]->vec, sock->ns.vec); + QUATCOPY(out[0]->vec, sock->ns.vec); } void register_node_type_cmp_rgb(ListBase *lb) diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index ccf498f1550..8330927d920 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -45,12 +45,6 @@ #include "py_capi_utils.h" #endif -PyObject * PyC_UnicodeFromByte(const char *str); -const char * PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */ - -/*** Function to wrap ID properties ***/ -PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent); - extern PyTypeObject IDArray_Type; extern PyTypeObject IDGroup_Iter_Type; diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c index 41d9626db16..2b9de49bf3f 100644 --- a/source/blender/python/generic/mathutils_Matrix.c +++ b/source/blender/python/generic/mathutils_Matrix.c @@ -1674,7 +1674,7 @@ static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure)) return PyLong_FromLong((long) self->col_size); } -static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure)) +static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closure)) { float mat[3][3]; @@ -1692,7 +1692,7 @@ static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure) return PyFloat_FromDouble(mat3_to_scale(mat)); } -static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure)) +static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure)) { if(BaseMath_ReadCallback(self) == -1) return NULL; @@ -1708,6 +1708,21 @@ static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure)) } } +static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closure)) +{ + if(BaseMath_ReadCallback(self) == -1) + return NULL; + + /*must be 3-4 cols, 3-4 rows, square matrix*/ + if(self->col_size == 4 && self->row_size == 4) + return PyBool_FromLong(is_orthogonal_m4((float (*)[4])self->contigPtr)); + else if(self->col_size == 3 && self->row_size == 3) + return PyBool_FromLong(is_orthogonal_m3((float (*)[3])self->contigPtr)); + else { + PyErr_SetString(PyExc_AttributeError, "Matrix.is_orthogonal: inappropriate matrix size - expects 3x3 or 4x4 matrix"); + return NULL; + } +} /*****************************************************************************/ /* Python attributes get/set structure: */ @@ -1715,8 +1730,9 @@ static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure)) static PyGetSetDef Matrix_getseters[] = { {(char *)"row_size", (getter)Matrix_getRowSize, (setter)NULL, (char *)"The row size of the matrix (readonly).\n\n:type: int", NULL}, {(char *)"col_size", (getter)Matrix_getColSize, (setter)NULL, (char *)"The column size of the matrix (readonly).\n\n:type: int", NULL}, - {(char *)"median_scale", (getter)Matrix_getMedianScale, (setter)NULL, (char *)"The average scale applied to each axis (readonly).\n\n:type: float", NULL}, - {(char *)"is_negative", (getter)Matrix_getIsNegative, (setter)NULL, (char *)"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL}, + {(char *)"median_scale", (getter)Matrix_median_scale_get, (setter)NULL, (char *)"The average scale applied to each axis (readonly).\n\n:type: float", NULL}, + {(char *)"is_negative", (getter)Matrix_is_negative_get, (setter)NULL, (char *)"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL}, + {(char *)"is_orthogonal", (getter)Matrix_is_orthogonal_get, (setter)NULL, (char *)"True if this matrix is orthogonal, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL}, {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL}, {(char *)"owner",(getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 4291fc824e9..b66b2109329 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -76,7 +76,7 @@ static void bpy_lib_dealloc(BPy_Library *self) } -PyTypeObject bpy_lib_Type= { +static PyTypeObject bpy_lib_Type= { PyVarObject_HEAD_INIT(NULL, 0) "bpy_lib", /* tp_name */ sizeof(BPy_Library), /* tp_basicsize */ diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index c230e952ca1..b8883e655f2 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -36,6 +36,7 @@ #include "RNA_types.h" +#include "BPY_extern.h" #include "bpy_operator.h" #include "bpy_operator_wrap.h" #include "bpy_rna.h" /* for setting arg props only - pyrna_py_to_prop() */ diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index e1ef8aa49c1..de29cb2aeac 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -1,4 +1,3 @@ - /* * $Id$ * diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 8af0db6ee13..4f62c545a71 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6040,17 +6040,18 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param bpy_context_set(C, &gilstate); if (!is_static) { - /* exception, operators store their PyObjects for re-use */ + /* some datatypes (operator, render engine) can store PyObjects for re-use */ if(ptr->data) { - if(RNA_struct_is_a(ptr->type, &RNA_Operator)) { - wmOperator *op= ptr->data; - if(op->py_instance) { - py_class_instance= op->py_instance; + void **instance = RNA_struct_instance(ptr); + + if(instance) { + if(*instance) { + py_class_instance= *instance; Py_INCREF(py_class_instance); } else { /* store the instance here once its created */ - py_class_instance_store= &op->py_instance; + py_class_instance_store= instance; } } } @@ -6418,7 +6419,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class identifier= ((PyTypeObject*)py_class)->tp_name; - srna_new= reg(C, &reports, py_class, identifier, bpy_class_validate, bpy_class_call, bpy_class_free); + srna_new= reg(CTX_data_main(C), &reports, py_class, identifier, bpy_class_validate, bpy_class_call, bpy_class_free); if(BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1) return NULL; @@ -6568,7 +6569,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla C= BPy_GetContext(); /* call unregister */ - unreg(C, srna); /* calls bpy_class_free, this decref's py_class */ + unreg(CTX_data_main(C), srna); /* calls bpy_class_free, this decref's py_class */ PyDict_DelItemString(((PyTypeObject *)py_class)->tp_dict, "bl_rna"); if(PyErr_Occurred()) diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index ba19f155842..28459677b32 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -187,12 +187,8 @@ int pyrna_write_check(void); int pyrna_struct_validity_check(BPy_StructRNA *pysrna); int pyrna_prop_validity_check(BPy_PropertyRNA *self); -void BPY_modules_update(struct bContext *C); //XXX temp solution - /* bpy.utils.(un)register_class */ extern PyMethodDef meth_bpy_register_class; extern PyMethodDef meth_bpy_unregister_class; -void BPY_id_release(struct ID *id); - #endif diff --git a/source/blender/readblenfile/BLO_readblenfile.h b/source/blender/readblenfile/BLO_readblenfile.h deleted file mode 100644 index 9b4e15165f5..00000000000 --- a/source/blender/readblenfile/BLO_readblenfile.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -#ifndef BLO_READBLENFILE_H -#define BLO_READBLENFILE_H - -/** \file BLO_readblenfile.h - * \ingroup blo - */ - -#ifdef __cplusplus -extern "C" { -#endif - -struct ReportList; - - BlendFileData * -BLO_readblenfilename( - char *fileName, - struct ReportList *reports); - - BlendFileData * -BLO_readblenfilehandle( - int fileHandle, - struct ReportList *reports); - - BlendFileData * -BLO_readblenfilememory( - char *fromBuffer, - int fromBufferSize, - struct ReportList *reports); - - - void -BLO_setcurrentversionnumber( - char array[4]); - - void -BLO_setversionnumber( - char array[4], - int version); - - int -blo_is_a_runtime( - char *file); - - BlendFileData * -blo_read_runtime( - char *file, - struct ReportList *reports); - -#define BLO_RESERVEDSIZE 12 -extern const char *headerMagic; - -#ifdef __cplusplus -} -#endif - -#endif /* BLO_READBLENFILE_H */ - diff --git a/source/blender/readblenfile/CMakeLists.txt b/source/blender/readblenfile/CMakeLists.txt deleted file mode 100644 index 9b869d39697..00000000000 --- a/source/blender/readblenfile/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -set(INC - . - ../blenloader - ../blenloader/intern - ../blenkernel - ../blenlib - ../makesdna -) - -set(SRC - intern/BLO_readblenfile.c - - BLO_readblenfile.h -) - -blender_add_lib(bf_readblenfile "${SRC}" "${INC}") diff --git a/source/blender/readblenfile/SConscript b/source/blender/readblenfile/SConscript deleted file mode 100644 index 07f84eb52d5..00000000000 --- a/source/blender/readblenfile/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = env.Glob('intern/*.c') - -incs = '. ../blenloader ../blenloader/intern ../blenkernel ../blenlib ../makesdna' - -env.BlenderLib ( 'bf_readblenfile', sources, Split(incs), [], libtype=['core','player'], priority = [0,5] ) diff --git a/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c b/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c deleted file mode 100644 index 0f3541b510d..00000000000 --- a/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -/** \file blender/readblenfile/stub/BLO_readblenfileSTUB.c - * \ingroup blo - */ - - -#include <stdio.h> - -int BLO_readblenfilememory( char *fromBuffer, int fromBufferSize); -int BLO_readblenfilename( char *fileName); -int BLO_readblenfilehandle( int fileHandle); -int BLO_is_a_runtime( char *file); -int BLO_read_runtime( char *file); - - int -BLO_readblenfilememory( - char *fromBuffer, int fromBufferSize) -{ -#if defined(DEBUG) - fprintf(stderr, - "Error BLO_readblenfilename is a stub\n"); -#endif - return(1); -} - - int -BLO_readblenfilename( - char *fileName) -{ -#if defined(DEBUG) - fprintf(stderr, - "Error BLO_readblenfilename is a stub\n"); -#endif - return(1); -} - - int -BLO_readblenfilehandle( - int fileHandle) -{ -#if defined(DEBUG) - fprintf(stderr, - "Error BLO_readblenfilehandle is a stub\n"); -#endif - return(1); -} - - int -BLO_is_a_runtime( - char *file) -{ -#if defined(DEBUG) - fprintf(stderr, - "Error BLO_is_a_runtime is a stub\n"); -#endif - return 0; -} - - int -BLO_read_runtime( - char *file) -{ -#if defined(DEBUG) - fprintf(stderr, - "Error BLO_read_runtime is a stub\n"); -#endif - return 0; -} diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 382c230ceac..4fdf0fe9d60 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -251,13 +251,19 @@ float RE_filter_value(int type, float x); void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect); /* shaded view or baking options */ -#define RE_BAKE_LIGHT 0 -#define RE_BAKE_ALL 1 -#define RE_BAKE_AO 2 -#define RE_BAKE_NORMALS 3 -#define RE_BAKE_TEXTURE 4 -#define RE_BAKE_DISPLACEMENT 5 -#define RE_BAKE_SHADOW 6 +#define RE_BAKE_LIGHT 0 /* not listed in rna_scene.c -> can't be enabled! */ +#define RE_BAKE_ALL 1 +#define RE_BAKE_AO 2 +#define RE_BAKE_NORMALS 3 +#define RE_BAKE_TEXTURE 4 +#define RE_BAKE_DISPLACEMENT 5 +#define RE_BAKE_SHADOW 6 +#define RE_BAKE_SPEC_COLOR 7 +#define RE_BAKE_SPEC_INTENSITY 8 +#define RE_BAKE_MIRROR_COLOR 9 +#define RE_BAKE_MIRROR_INTENSITY 10 +#define RE_BAKE_ALPHA 11 +#define RE_BAKE_EMIT 12 void RE_Database_Baking(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int type, struct Object *actob); diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h index 865cb056a61..07d24ea6d66 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -37,7 +37,7 @@ struct LampRen; struct VlakRen; struct StrandSegment; struct StrandPoint; -struct ObjectInstanceRen obi; +struct ObjectInstanceRen; struct Isect; /* shadeinput.c */ diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 74ce7957dd7..c1c2fb60abd 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5387,7 +5387,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * float imat[4][4]; FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(fsob, eModifierType_Fluidsim); FluidsimSettings *fss; - float *velarray = NULL; + FluidVertexVelocity *velarray = NULL; /* only one step needed */ if(step) return 1; @@ -5401,14 +5401,14 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * invert_m4_m4(imat, mat); /* set first vertex OK */ - if(!fss->meshSurfNormals) return 0; + if(!fss->meshVelocities) return 0; - if( obr->totvert != GET_INT_FROM_POINTER(fss->meshSurface) ) { + if( obr->totvert != fss->totvert) { //fprintf(stderr, "load_fluidsimspeedvectors - modified fluidsim mesh, not using speed vectors (%d,%d)...\n", obr->totvert, fsob->fluidsimSettings->meshSurface->totvert); // DEBUG return 0; } - velarray = (float *)fss->meshSurfNormals; + velarray = fss->meshVelocities; if(obi->flag & R_TRANSFORMED) mul_m4_m4m4(winmat, obi->mat, re->winmat); @@ -5420,7 +5420,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * so that also small drops/little water volumes return a velocity != 0. But I had no luck in fixing that function - DG */ for(a=0; a<obr->totvert; a++) { - for(j=0;j<3;j++) avgvel[j] += velarray[3*a + j]; + for(j=0;j<3;j++) avgvel[j] += velarray[a].vel[j]; } for(j=0;j<3;j++) avgvel[j] /= (float)(obr->totvert); @@ -5435,7 +5435,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * // get fluid velocity fsvec[3] = 0.; //fsvec[0] = fsvec[1] = fsvec[2] = fsvec[3] = 0.; fsvec[2] = 2.; // NT fixed test - for(j=0;j<3;j++) fsvec[j] = velarray[3*a + j]; + for(j=0;j<3;j++) fsvec[j] = velarray[a].vel[j]; /* (bad) HACK insert average velocity if none is there (see previous comment) */ if((fsvec[0] == 0.0) && (fsvec[1] == 0.0) && (fsvec[2] == 0.0)) diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 74ec52c5dbf..e8f66cf18ef 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -96,7 +96,7 @@ static void RE_rayobject_config_control(RayObject *r, Render *re) } } -RayObject* RE_rayobject_create(Render *re, int type, int size) +static RayObject* RE_rayobject_create(Render *re, int type, int size) { RayObject * res = NULL; @@ -1679,7 +1679,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int /* not used, test function for ambient occlusion (yaf: pathlight) */ /* main problem; has to be called within shading loop, giving unwanted recursion */ -int ray_trace_shadow_rad(ShadeInput *ship, ShadeResult *shr) +static int ray_trace_shadow_rad(ShadeInput *ship, ShadeResult *shr) { static int counter=0, only_one= 0; extern float hashvectf[]; diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 7a34fc0af50..bc6c4795f5c 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -2143,7 +2143,9 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int shade_input_set_shade_texco(shi); - if(!ELEM3(bs->type, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_SHADOW)) + /* only do AO for a full bake (and obviously AO bakes) + AO for light bakes is a leftover and might not be needed */ + if( ELEM3(bs->type, RE_BAKE_ALL, RE_BAKE_AO, RE_BAKE_LIGHT)) shade_samples_do_AO(ssamp); if(shi->mat->nodetree && shi->mat->use_nodes) { @@ -2206,6 +2208,42 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int VECCOPY(shr.combined, shr.shad); shr.alpha = shi->alpha; } + else if(bs->type==RE_BAKE_SPEC_COLOR) { + shr.combined[0]= shi->specr; + shr.combined[1]= shi->specg; + shr.combined[2]= shi->specb; + shr.alpha = 1.0f; + } + else if(bs->type==RE_BAKE_SPEC_INTENSITY) { + shr.combined[0]= + shr.combined[1]= + shr.combined[2]= shi->spec; + shr.alpha = 1.0f; + } + else if(bs->type==RE_BAKE_MIRROR_COLOR) { + shr.combined[0]= shi->mirr; + shr.combined[1]= shi->mirg; + shr.combined[2]= shi->mirb; + shr.alpha = 1.0f; + } + else if(bs->type==RE_BAKE_MIRROR_INTENSITY) { + shr.combined[0]= + shr.combined[1]= + shr.combined[2]= shi->ray_mirror; + shr.alpha = 1.0f; + } + else if(bs->type==RE_BAKE_ALPHA) { + shr.combined[0]= + shr.combined[1]= + shr.combined[2]= shi->alpha; + shr.alpha = 1.0f; + } + else if(bs->type==RE_BAKE_EMIT) { + shr.combined[0]= + shr.combined[1]= + shr.combined[2]= shi->emit; + shr.alpha = 1.0f; + } } if(bs->rect_float) { diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 74c99d1a92f..afe4d5c7e35 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -782,7 +782,7 @@ void free_renderdata_vlaknodes(VlakTableNode *vlaknodes) MEM_freeN(vlaknodes); } -void free_renderdata_strandnodes(StrandTableNode *strandnodes) +static void free_renderdata_strandnodes(StrandTableNode *strandnodes) { int a; diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 12e85af7575..9f5c2c39472 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -210,7 +210,7 @@ static void interpolate_vec4(float *v1, float *v2, float t, float negt, float *v v[3]= negt*v1[3] + t*v2[3]; } -void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float t, ShadeResult *shr, int addpassflag) +static void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float t, ShadeResult *shr, int addpassflag) { float negt= 1.0f - t; @@ -252,7 +252,7 @@ void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float t, Sha } } -void strand_apply_shaderesult_alpha(ShadeResult *shr, float alpha) +static void strand_apply_shaderesult_alpha(ShadeResult *shr, float alpha) { if(alpha < 1.0f) { shr->combined[0] *= alpha; diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c index 919c06d81f7..f645c29a7a5 100644 --- a/source/blender/render/intern/source/sunsky.c +++ b/source/blender/render/intern/source/sunsky.c @@ -113,7 +113,7 @@ static void DirectionToThetaPhi(float *toSun, float *theta, float *phi) * PerezFunction: * compute perez function value based on input paramters * */ -float PerezFunction(struct SunSky *sunsky, const float *lam, float theta, float gamma, float lvz) +static float PerezFunction(struct SunSky *sunsky, const float *lam, float theta, float gamma, float lvz) { float den, num; @@ -313,7 +313,7 @@ void GetSkyXYZRadiancef(struct SunSky* sunsky, const float varg[3], float color_ * turbidity: is atmosphere turbidity * fTau: contains computed attenuated sun light * */ -void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3]) +static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3]) { float fBeta ; float fTauR, fTauA; diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index fc3280db771..8293143a2a6 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -74,7 +74,7 @@ extern struct Render R; /* Recursive test for intersections, from a point inside the mesh, to outside * Number of intersections (depth) determine if a point is inside or outside the mesh */ -int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset, int limit, int depth) +static int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset, int limit, int depth) { if (limit == 0) return depth; @@ -96,7 +96,7 @@ int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset, int l } /* Uses ray tracing to check if a point is inside or outside an ObjectInstanceRen */ -int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co) +static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co) { Isect isect= {{0}}; float dir[3] = {0.0f,0.0f,1.0f}; @@ -350,7 +350,7 @@ static void ms_diffuse(float *x0, float *x, float diff, int *n) //n is the unpad } } -void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Material *ma) +static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Material *ma) { const float diff = ma->vol.ms_diff * 0.001f; /* compensate for scaling for a nicer UI range */ const int simframes = (int)(ma->vol.ms_spread * (float)MAX3(vp->res[0], vp->res[1], vp->res[2])); @@ -538,7 +538,7 @@ static void *vol_precache_part(void *data) pa->done = 1; - return 0; + return NULL; } @@ -676,7 +676,7 @@ static int precache_resolution(Render *re, VolumePrecache *vp, ObjectInstanceRen * in camera space, aligned with the ObjectRen's bounding box. * Resolution is defined by the user. */ -void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *obi, Material *ma) +static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *obi, Material *ma) { VolumePrecache *vp; VolPrecachePart *nextpa, *pa; @@ -709,9 +709,8 @@ void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *obi, Mat vp->data_r = MEM_callocN(sizeof(float)*vp->res[0]*vp->res[1]*vp->res[2], "volume light cache data red channel"); vp->data_g = MEM_callocN(sizeof(float)*vp->res[0]*vp->res[1]*vp->res[2], "volume light cache data green channel"); vp->data_b = MEM_callocN(sizeof(float)*vp->res[0]*vp->res[1]*vp->res[2], "volume light cache data blue channel"); - if (vp->data_r==0 || vp->data_g==0 || vp->data_b==0) { + if (vp->data_r==NULL || vp->data_g==NULL || vp->data_b==NULL) { MEM_freeN(vp); - vp = NULL; return; } diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index dde9dbb8485..09422af7c79 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -305,7 +305,7 @@ float vol_get_density(struct ShadeInput *shi, float *co) /* Color of light that gets scattered out by the volume */ /* Uses same physically based scattering parameter as in transmission calculations, * along with artificial reflection scale/reflection color tint */ -void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co) +static void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co) { float scatter = shi->mat->vol.scattering; float reflection= shi->mat->vol.reflection; @@ -325,7 +325,7 @@ void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co) /* compute emission component, amount of radiance to add per segment * can be textured with 'emit' */ -void vol_get_emission(ShadeInput *shi, float *emission_col, float *co) +static void vol_get_emission(ShadeInput *shi, float *emission_col, float *co) { float emission = shi->mat->vol.emission; VECCOPY(emission_col, shi->mat->vol.emission_col); @@ -343,7 +343,7 @@ void vol_get_emission(ShadeInput *shi, float *emission_col, float *co) * This can possibly use a specific scattering color, * and absorption multiplier factor too, but these parameters are left out for simplicity. * It's easy enough to get a good wide range of results with just these two parameters. */ -void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co) +static void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co) { /* technically absorption, but named transmission color * since it describes the effect of the coloring *after* absorption */ @@ -361,7 +361,7 @@ void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co) /* phase function - determines in which directions the light * is scattered in the volume relative to incoming direction * and view direction */ -float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp) +static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp) { const float normalize = 0.25f; // = 1.f/4.f = M_PI/(4.f*M_PI) @@ -408,7 +408,7 @@ float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp) } /* Compute transmittance = e^(-attenuation) */ -void vol_get_transmittance_seg(ShadeInput *shi, float *tr, float stepsize, float *co, float density) +static void vol_get_transmittance_seg(ShadeInput *shi, float *tr, float stepsize, float *co, float density) { /* input density = density at co */ float tau[3] = {0.f, 0.f, 0.f}; @@ -464,7 +464,7 @@ static void vol_get_transmittance(ShadeInput *shi, float *tr, float *co, float * tr[2] = expf(-tau[2]); } -void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar, float *lacol) +static void vol_shade_one_lamp(struct ShadeInput *shi, float *co, LampRen *lar, float *lacol) { float visifac, lv[3], lampdist; float tr[3]={1.0,1.0,1.0}; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 1b4fff8cd13..e08e681f494 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -95,7 +95,7 @@ void WM_window_open_temp (struct bContext *C, struct rcti *position, int type); int WM_read_homefile_exec(struct bContext *C, struct wmOperator *op); int WM_read_homefile (struct bContext *C, struct ReportList *reports, short from_memory); int WM_write_homefile (struct bContext *C, struct wmOperator *op); -void WM_read_file (struct bContext *C, const char *name, struct ReportList *reports); +void WM_read_file (struct bContext *C, const char *filepath, struct ReportList *reports); int WM_write_file (struct bContext *C, const char *target, int fileflags, struct ReportList *reports, int copy); void WM_read_autosavefile(struct bContext *C); void WM_autosave_init (struct wmWindowManager *wm); @@ -216,7 +216,7 @@ int WM_operator_confirm_message(struct bContext *C, struct wmOperator *op, con /* operator api */ void WM_operator_free (struct wmOperator *op); -void WM_operator_stack_clear(struct bContext *C); +void WM_operator_stack_clear(struct wmWindowManager *wm); struct wmOperatorType *WM_operatortype_find(const char *idnamem, int quiet); struct wmOperatorType *WM_operatortype_first(void); @@ -293,12 +293,6 @@ struct wmGesture *WM_gesture_new(struct bContext *C, struct wmEvent *event, int void WM_gesture_end(struct bContext *C, struct wmGesture *gesture); void WM_gestures_remove(struct bContext *C); - /* radial control operator */ -int WM_radial_control_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event); -int WM_radial_control_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event); -void WM_OT_radial_control_partial(struct wmOperatorType *ot); -void WM_radial_control_string(struct wmOperator *op, char str[], int maxlen); - /* fileselecting support */ void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op); void WM_event_fileselect_event(struct bContext *C, void *ophandle, int eventval); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 8748703ad8e..ab68c6ef4d4 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -335,8 +335,8 @@ typedef struct wmEvent { short type; /* event code itself (short, is also in keymap) */ short val; /* press, release, scrollvalue */ - short x, y; /* mouse pointer position, screen coord */ - short mval[2]; /* region mouse position, name convention pre 2.5 :) */ + int x, y; /* mouse pointer position, screen coord */ + int mval[2]; /* region mouse position, name convention pre 2.5 :) */ short unicode; /* future, ghost? */ char ascii; /* from ghost */ char pad; @@ -344,9 +344,9 @@ typedef struct wmEvent { /* previous state */ short prevtype; short prevval; - short prevx, prevy; + int prevx, prevy; double prevclicktime; - short prevclickx, prevclicky; + int prevclickx, prevclicky; /* modifier states */ short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ @@ -494,7 +494,7 @@ typedef struct wmDrag { struct ImBuf *imb; /* if no icon but imbuf should be drawn around cursor */ float scale; - short sx, sy; + int sx, sy; char opname[240]; /* FILE_MAX */ /* if set, draws operator name*/ } wmDrag; diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 424c13f089f..bcd5cf38f88 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -137,9 +137,8 @@ void wm_operator_register(bContext *C, wmOperator *op) } -void WM_operator_stack_clear(bContext *C) +void WM_operator_stack_clear(wmWindowManager *wm) { - wmWindowManager *wm= CTX_wm_manager(C); wmOperator *op; while((op= wm->operators.first)) { @@ -147,7 +146,7 @@ void WM_operator_stack_clear(bContext *C) WM_operator_free(op); } - WM_event_add_notifier(C, NC_WM|ND_HISTORY, NULL); + WM_main_add_notifier(NC_WM|ND_HISTORY, NULL); } /* ****************************************** */ diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index c94ad74be72..4fe82917705 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -816,11 +816,3 @@ void wm_draw_region_clear(wmWindow *win, ARegion *ar) win->screen->do_draw= 1; } -static void wm_draw_region_modified(wmWindow *win, ARegion *ar) -{ - int drawmethod= wm_automatic_draw_method(win); - - if(ELEM(drawmethod, USER_DRAW_OVERLAP, USER_DRAW_OVERLAP_FLIP)) - ED_region_tag_redraw(ar); -} - diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index feff0393b88..440ade914f0 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2293,7 +2293,7 @@ static void update_tablet_data(wmWindow *win, wmEvent *event) /* imperfect but probably usable... draw/enable drags to other windows */ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *win, wmEvent *evt) { - short mx= evt->x, my= evt->y; + int mx= evt->x, my= evt->y; if(wm->windows.first== wm->windows.last) return NULL; @@ -2310,8 +2310,8 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi return NULL; /* to desktop space */ - mx+= win->posx; - my+= win->posy; + mx += (int)win->posx; + my += (int)win->posy; /* check other windows to see if it has mouse inside */ for(owin= wm->windows.first; owin; owin= owin->next) { @@ -2319,8 +2319,8 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi if(owin!=win) { if(mx-owin->posx >= 0 && my-owin->posy >= 0 && mx-owin->posx <= owin->sizex && my-owin->posy <= owin->sizey) { - evt->x= mx-owin->posx; - evt->y= my-owin->posy; + evt->x= mx - (int)owin->posx; + evt->y= my - (int)owin->posy; return owin; } diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 2783504ae90..ea77fca4712 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -333,7 +333,7 @@ static int wm_read_exotic(Scene *UNUSED(scene), const char *name) return retval; } -void WM_read_file(bContext *C, const char *name, ReportList *reports) +void WM_read_file(bContext *C, const char *filepath, ReportList *reports) { int retval; @@ -345,7 +345,7 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports) /* first try to append data from exotic file formats... */ /* it throws error box when file doesnt exist and returns -1 */ /* note; it should set some error message somewhere... (ton) */ - retval= wm_read_exotic(CTX_data_scene(C), name); + retval= wm_read_exotic(CTX_data_scene(C), filepath); /* we didn't succeed, now try to read Blender file */ if (retval == BKE_READ_EXOTIC_OK_BLEND) { @@ -356,7 +356,7 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports) /* also exit screens and editors */ wm_window_match_init(C, &wmbase); - retval= BKE_read_file(C, name, reports); + retval= BKE_read_file(C, filepath, reports); G.save_over = 1; /* this flag is initialized by the operator but overwritten on read. @@ -416,16 +416,16 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports) else if(retval == BKE_READ_EXOTIC_OK_OTHER) BKE_write_undo(C, "Import file"); else if(retval == BKE_READ_EXOTIC_FAIL_OPEN) { - BKE_reportf(reports, RPT_ERROR, "Can't read file: \"%s\", %s.", name, errno ? strerror(errno) : "Unable to open the file"); + BKE_reportf(reports, RPT_ERROR, "Can't read file: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unable to open the file"); } else if(retval == BKE_READ_EXOTIC_FAIL_FORMAT) { - BKE_reportf(reports, RPT_ERROR, "File format is not supported in file: \"%s\".", name); + BKE_reportf(reports, RPT_ERROR, "File format is not supported in file: \"%s\".", filepath); } else if(retval == BKE_READ_EXOTIC_FAIL_PATH) { - BKE_reportf(reports, RPT_ERROR, "File path invalid: \"%s\".", name); + BKE_reportf(reports, RPT_ERROR, "File path invalid: \"%s\".", filepath); } else { - BKE_reportf(reports, RPT_ERROR, "Unknown error loading: \"%s\".", name); + BKE_reportf(reports, RPT_ERROR, "Unknown error loading: \"%s\".", filepath); BLI_assert(!"invalid 'retval'"); } @@ -709,7 +709,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re { Library *li; int len; - char di[FILE_MAX]; + char filepath[FILE_MAX]; int *thumb= NULL; ImBuf *ibuf_thumb= NULL; @@ -726,14 +726,14 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re return -1; } - BLI_strncpy(di, target, FILE_MAX); - BLI_replace_extension(di, FILE_MAX, ".blend"); + BLI_strncpy(filepath, target, FILE_MAX); + BLI_replace_extension(filepath, FILE_MAX, ".blend"); /* dont use 'target' anymore */ /* send the OnSave event */ for (li= G.main->library.first; li; li= li->id.next) { - if (BLI_path_cmp(li->filepath, di) == 0) { - BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%.200s'", di); + if (BLI_path_cmp(li->filepath, filepath) == 0) { + BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%.200s'", filepath); return -1; } } @@ -754,12 +754,12 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb); /* rename to .blend1, do this as last before write */ - do_history(di, reports); + do_history(filepath, reports); - if (BLO_write_file(CTX_data_main(C), di, fileflags, reports, thumb)) { + if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) { if(!copy) { G.relbase_valid = 1; - BLI_strncpy(G.main->name, di, sizeof(G.main->name)); /* is guaranteed current file */ + BLI_strncpy(G.main->name, filepath, sizeof(G.main->name)); /* is guaranteed current file */ G.save_over = 1; /* disable untitled.blend convention */ } @@ -774,7 +774,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re /* run this function after because the file cant be written before the blend is */ if (ibuf_thumb) { - ibuf_thumb= IMB_thumb_create(di, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb); + ibuf_thumb= IMB_thumb_create(filepath, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb); IMB_freeImBuf(ibuf_thumb); } @@ -798,20 +798,20 @@ int WM_write_homefile(bContext *C, wmOperator *op) { wmWindowManager *wm= CTX_wm_manager(C); wmWindow *win= CTX_wm_window(C); - char tstr[FILE_MAXDIR+FILE_MAXFILE]; + char filepath[FILE_MAXDIR+FILE_MAXFILE]; int fileflags; /* check current window and close it if temp */ if(win->screen->temp) wm_window_close(C, wm, win); - BLI_make_file_string("/", tstr, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); - printf("trying to save homefile at %s ", tstr); + BLI_make_file_string("/", filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); + printf("trying to save homefile at %s ", filepath); /* force save as regular blend file */ fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN); - if(BLO_write_file(CTX_data_main(C), tstr, fileflags, op->reports, NULL) == 0) { + if(BLO_write_file(CTX_data_main(C), filepath, fileflags, op->reports, NULL) == 0) { printf("fail\n"); return OPERATOR_CANCELLED; } @@ -825,7 +825,7 @@ int WM_write_homefile(bContext *C, wmOperator *op) /************************ autosave ****************************/ -void wm_autosave_location(char *filename) +void wm_autosave_location(char *filepath) { char pidstr[32]; #ifdef WIN32 @@ -845,12 +845,12 @@ void wm_autosave_location(char *filename) * If there is no C:\tmp autosave fails. */ if (!BLI_exists(U.tempdir)) { savedir = BLI_get_folder_create(BLENDER_USER_AUTOSAVE, NULL); - BLI_make_file_string("/", filename, savedir, pidstr); + BLI_make_file_string("/", filepath, savedir, pidstr); return; } #endif - BLI_make_file_string("/", filename, U.tempdir, pidstr); + BLI_make_file_string("/", filepath, U.tempdir, pidstr); } void WM_autosave_init(wmWindowManager *wm) @@ -865,7 +865,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w { wmWindow *win; wmEventHandler *handler; - char filename[FILE_MAX]; + char filepath[FILE_MAX]; int fileflags; WM_event_remove_timer(wm, NULL, wm->autosavetimer); @@ -880,13 +880,13 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w } } - wm_autosave_location(filename); + wm_autosave_location(filepath); /* force save as regular blend file */ fileflags = G.fileflags & ~(G_FILE_COMPRESS|G_FILE_AUTOPLAY |G_FILE_LOCK|G_FILE_SIGN); /* no error reporting to console */ - BLO_write_file(CTX_data_main(C), filename, fileflags, NULL, NULL); + BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); /* do timer after file write, just in case file write takes a long time */ wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 2b8b0dd0393..745ae0ae47e 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -61,6 +61,7 @@ #include "BLO_readfile.h" #include "BKE_blender.h" +#include "BKE_brush.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_idprop.h" @@ -1327,10 +1328,20 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev /* op->poll */ static int wm_search_menu_poll(bContext *C) { - if(CTX_wm_window(C)==NULL) return 0; - if(CTX_wm_area(C) && CTX_wm_area(C)->spacetype==SPACE_CONSOLE) return 0; // XXX - so we can use the shortcut in the console - if(CTX_wm_area(C) && CTX_wm_area(C)->spacetype==SPACE_TEXT) return 0; // XXX - so we can use the spacebar in the text editor - if(CTX_data_edit_object(C) && CTX_data_edit_object(C)->type==OB_FONT) return 0; // XXX - so we can use the spacebar for entering text + if(CTX_wm_window(C)==NULL) { + return 0; + } + else { + ScrArea *sa= CTX_wm_area(C); + if(sa) { + if(sa->spacetype==SPACE_CONSOLE) return 0; // XXX - so we can use the shortcut in the console + if(sa->spacetype==SPACE_TEXT) return 0; // XXX - so we can use the spacebar in the text editor + } + else { + Object *editob= CTX_data_edit_object(C); + if(editob && editob->type==OB_FONT) return 0; // XXX - so we can use the spacebar for entering text + } + } return 1; } @@ -2035,6 +2046,8 @@ static void WM_OT_quit_blender(wmOperatorType *ot) /* *********************** */ +#if defined(WIN32) + static int wm_console_toggle_op(bContext *UNUSED(C), wmOperator *UNUSED(op)) { GHOST_toggleConsole(2); @@ -2051,6 +2064,8 @@ static void WM_OT_console_toggle(wmOperatorType *ot) ot->poll= WM_operator_winactive; } +#endif + /* ************ default paint cursors, draw always around cursor *********** */ /* - returns handler to free @@ -2487,7 +2502,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event) } { - short x, y; + int x, y; short *lasso= gesture->customdata; lasso += (2 * gesture->points - 2); @@ -2670,272 +2685,465 @@ void WM_OT_straightline_gesture(wmOperatorType *ot) static const int WM_RADIAL_CONTROL_DISPLAY_SIZE = 200; -typedef struct wmRadialControl { - int mode; - float initial_value, value, max_value; - float col[4], tex_col[4]; +typedef struct { + PropertyType type; + PropertySubType subtype; + PointerRNA ptr, col_ptr, fill_col_ptr, rot_ptr, zoom_ptr, image_id_ptr; + PropertyRNA *prop, *col_prop, *fill_col_prop, *rot_prop, *zoom_prop; + StructRNA *image_id_srna; + float initial_value, current_value, min_value, max_value; int initial_mouse[2]; + unsigned int gltex; + ListBase orig_paintcursors; void *cursor; - GLuint tex; -} wmRadialControl; +} RadialControl; -static void wm_radial_control_paint(bContext *C, int x, int y, void *customdata) +static void radial_control_set_initial_mouse(RadialControl *rc, wmEvent *event) { - wmRadialControl *rc = (wmRadialControl*)customdata; - ARegion *ar = CTX_wm_region(C); - float r1=0.0f, r2=0.0f, r3=0.0f, angle=0.0f; + float d[2] = {0, 0}; + float zoom[2] = {1, 1}; - // int hit = 0; - - if(rc->mode == WM_RADIALCONTROL_STRENGTH) - rc->tex_col[3]= (rc->value + 0.5f); + rc->initial_mouse[0]= event->x; + rc->initial_mouse[1]= event->y; - if(rc->mode == WM_RADIALCONTROL_SIZE) { - r1= rc->value; - r2= rc->initial_value; - r3= r1; - } else if(rc->mode == WM_RADIALCONTROL_STRENGTH) { - r1= (1 - rc->value) * WM_RADIAL_CONTROL_DISPLAY_SIZE; - r2= r3= (float)WM_RADIAL_CONTROL_DISPLAY_SIZE; - } else if(rc->mode == WM_RADIALCONTROL_ANGLE) { - r1= r2= r3= (float)WM_RADIAL_CONTROL_DISPLAY_SIZE; - angle = rc->value; + switch(rc->subtype) { + case PROP_DISTANCE: + d[0] = rc->initial_value; + break; + case PROP_FACTOR: + d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * (1 - rc->initial_value); + break; + case PROP_ANGLE: + d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(rc->initial_value); + d[1] = WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(rc->initial_value); + break; + default: + return; } - /* Keep cursor in the original place */ - x = rc->initial_mouse[0] - ar->winrct.xmin; - y = rc->initial_mouse[1] - ar->winrct.ymin; + if(rc->zoom_prop) { + RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom); + d[0] *= zoom[0]; + d[1] *= zoom[1]; + } - glTranslatef((float)x, (float)y, 0.0f); + rc->initial_mouse[0]-= d[0]; + rc->initial_mouse[1]-= d[1]; +} - glEnable(GL_BLEND); +static void radial_control_set_tex(RadialControl *rc) +{ + ImBuf *ibuf; - if(rc->mode == WM_RADIALCONTROL_ANGLE) { - glRotatef(angle, 0, 0, 1); + switch(RNA_type_to_ID_code(rc->image_id_ptr.type)) { + case ID_BR: + if((ibuf = brush_gen_radial_control_imbuf(rc->image_id_ptr.data))) { + glGenTextures(1, &rc->gltex); + glBindTexture(GL_TEXTURE_2D, rc->gltex); + glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, ibuf->x, ibuf->y, 0, + GL_ALPHA, GL_FLOAT, ibuf->rect_float); + MEM_freeN(ibuf->rect_float); + MEM_freeN(ibuf); + } + break; + default: + break; } +} + +static void radial_control_paint_tex(RadialControl *rc, float radius, float alpha) +{ + float col[3] = {0, 0, 0}; + float rot; - if (rc->tex) { - glBindTexture(GL_TEXTURE_2D, rc->tex); + /* set fill color */ + if(rc->fill_col_prop) + RNA_property_float_get_array(&rc->fill_col_ptr, rc->fill_col_prop, col); + glColor4f(col[0], col[1], col[2], alpha); + + if(rc->gltex) { + glBindTexture(GL_TEXTURE_2D, rc->gltex); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + /* set up rotation if available */ + if(rc->rot_prop) { + rot = RNA_property_float_get(&rc->rot_ptr, rc->rot_prop); + glPushMatrix(); + glRotatef(RAD2DEGF(rot), 0, 0, 1); + } + + /* draw textured quad */ glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); - glColor4fv(rc->tex_col); glTexCoord2f(0,0); - glVertex2f(-r3, -r3); + glVertex2f(-radius, -radius); glTexCoord2f(1,0); - glVertex2f(r3, -r3); + glVertex2f(radius, -radius); glTexCoord2f(1,1); - glVertex2f(r3, r3); + glVertex2f(radius, radius); glTexCoord2f(0,1); - glVertex2f(-r3, r3); + glVertex2f(-radius, radius); glEnd(); glDisable(GL_TEXTURE_2D); + + /* undo rotation */ + if(rc->rot_prop) + glPopMatrix(); + } + else { + /* flat color if no texture available */ + glutil_draw_filled_arc(0, M_PI * 2, radius, 40); } +} - if(rc->mode == WM_RADIALCONTROL_ANGLE) { - glColor4fv(rc->col); - glEnable(GL_LINE_SMOOTH); - glRotatef(-angle, 0, 0, 1); +static void radial_control_paint_cursor(bContext *C, int x, int y, void *customdata) +{ + RadialControl *rc = customdata; + ARegion *ar = CTX_wm_region(C); + float r1=0.0f, r2=0.0f, tex_radius, alpha; + float zoom[2], col[3] = {1, 1, 1}; + + switch(rc->subtype) { + case PROP_DISTANCE: + r1= rc->current_value; + r2= rc->initial_value; + tex_radius= r1; + alpha = 0.75; + break; + case PROP_FACTOR: + r1= (1 - rc->current_value) * WM_RADIAL_CONTROL_DISPLAY_SIZE; + r2= tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE; + alpha = rc->current_value / 2 + 0.5; + break; + case PROP_ANGLE: + r1= r2= tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE; + alpha = 0.75; + break; + default: + break; + } + + /* Keep cursor in the original place */ + x = rc->initial_mouse[0] - ar->winrct.xmin; + y = rc->initial_mouse[1] - ar->winrct.ymin; + glTranslatef((float)x, (float)y, 0.0f); + + glEnable(GL_BLEND); + glEnable(GL_LINE_SMOOTH); + + /* apply zoom if available */ + if(rc->zoom_prop) { + RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom); + glScalef(zoom[0], zoom[1], 1); + } + + /* draw rotated texture */ + radial_control_paint_tex(rc, tex_radius, alpha); + + /* set line color */ + if(rc->col_prop) + RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col); + glColor4f(col[0], col[1], col[2], 0.5); + + if(rc->subtype == PROP_ANGLE) { + glPushMatrix(); + /* draw original angle line */ + glRotatef(RAD2DEGF(rc->initial_value), 0, 0, 1); fdrawline(0.0f, 0.0f, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f); - glRotatef(angle, 0, 0, 1); + /* draw new angle line */ + glRotatef(RAD2DEGF(rc->current_value - rc->initial_value), 0, 0, 1); fdrawline(0.0f, 0.0f, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f); - glDisable(GL_LINE_SMOOTH); + glPopMatrix(); } - glColor4fv(rc->col); + /* draw circles on top */ glutil_draw_lined_arc(0.0, (float)(M_PI*2.0), r1, 40); glutil_draw_lined_arc(0.0, (float)(M_PI*2.0), r2, 40); + glDisable(GL_BLEND); + glDisable(GL_LINE_SMOOTH); } -int WM_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) +/* attempt to retrieve the rna pointer/property from an rna path; + returns 0 for failure, 1 for success, and also 1 if property is not + set */ +static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op, + const char *name, PointerRNA *r_ptr, + PropertyRNA **r_prop, int req_float, + int req_length, int allow_missing) { - wmRadialControl *rc = (wmRadialControl*)op->customdata; - int mode, initial_mouse[2], delta[2]; - float dist; - double new_value = RNA_float_get(op->ptr, "new_value"); - int ret = OPERATOR_RUNNING_MODAL; - // float initial_value = RNA_float_get(op->ptr, "initial_value"); + PropertyRNA *unused_prop; + int len; + char *str; - mode = RNA_enum_get(op->ptr, "mode"); - RNA_int_get_array(op->ptr, "initial_mouse", initial_mouse); + /* get an rna string path from the operator's properties */ + if(!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0))) + return 1; - switch(event->type) { - case MOUSEMOVE: - delta[0]= initial_mouse[0] - event->x; - delta[1]= initial_mouse[1] - event->y; + if(str[0] == '\0') { + MEM_freeN(str); + return 1; + } - //if (mode == WM_RADIALCONTROL_SIZE) - // delta[0]+= initial_value; - //else if(mode == WM_RADIALCONTROL_STRENGTH) - // delta[0]+= WM_RADIAL_CONTROL_DISPLAY_SIZE * (1 - initial_value); - //else if(mode == WM_RADIALCONTROL_ANGLE) { - // delta[0]+= WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(initial_value*M_PI/180.0f); - // delta[1]+= WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(initial_value*M_PI/180.0f); - //} + if(!r_prop) + r_prop = &unused_prop; - dist= sqrtf(delta[0]*delta[0]+delta[1]*delta[1]); + /* get rna from path */ + if(!RNA_path_resolve(ctx_ptr, str, r_ptr, r_prop)) { + MEM_freeN(str); + if(allow_missing) + return 1; + else { + BKE_reportf(op->reports, RPT_ERROR, "Couldn't resolve path %s", name); + return 0; + } + } - if(mode == WM_RADIALCONTROL_SIZE) - new_value = dist; - else if(mode == WM_RADIALCONTROL_STRENGTH) { - new_value = 1 - dist / WM_RADIAL_CONTROL_DISPLAY_SIZE; - } else if(mode == WM_RADIALCONTROL_ANGLE) - new_value = ((int)(atan2f(delta[1], delta[0]) * (float)(180.0 / M_PI)) + 180); - - if(event->ctrl) { - if(mode == WM_RADIALCONTROL_STRENGTH) - new_value = ((int)ceilf(new_value * 10.f) * 10.0f) / 100.f; - else - new_value = ((int)new_value + 5) / 10*10; + /* if property is expected to be a float, check its type */ + if(req_float) { + if(!(*r_prop) || (RNA_property_type(*r_prop) != PROP_FLOAT)) { + MEM_freeN(str); + BKE_reportf(op->reports, RPT_ERROR, + "Property from path %s is not a float", name); + return 0; } - - break; - case ESCKEY: - case RIGHTMOUSE: - ret = OPERATOR_CANCELLED; - break; - case LEFTMOUSE: - case PADENTER: - op->type->exec(C, op); - ret = OPERATOR_FINISHED; - break; } + + /* check property's array length */ + if(*r_prop && (len = RNA_property_array_length(r_ptr, *r_prop)) != req_length) { + MEM_freeN(str); + BKE_reportf(op->reports, RPT_ERROR, + "Property from path %s has length %d instead of %d", + name, len, req_length); + return 0; + } + + /* success */ + MEM_freeN(str); + return 1; +} - /* Clamp */ - if(new_value > rc->max_value) - new_value = rc->max_value; - else if(new_value < 0) - new_value = 0; +/* initialize the rna pointers and properties using rna paths */ +static int radial_control_get_properties(bContext *C, wmOperator *op) +{ + RadialControl *rc = op->customdata; + PointerRNA ctx_ptr; - /* Update paint data */ - rc->value = (float)new_value; + RNA_pointer_create(NULL, &RNA_Context, C, &ctx_ptr); - RNA_float_set(op->ptr, "new_value", rc->value); + if(!radial_control_get_path(&ctx_ptr, op, "data_path", &rc->ptr, &rc->prop, 0, 0, 0)) + return 0; - if(ret != OPERATOR_RUNNING_MODAL) { - WM_paint_cursor_end(CTX_wm_manager(C), rc->cursor); - MEM_freeN(rc); - } + /* data path is required */ + if(!rc->prop) + return 0; - ED_region_tag_redraw(CTX_wm_region(C)); - - //if (ret != OPERATOR_RUNNING_MODAL) { - // wmWindow *win = CTX_wm_window(C); - // WM_cursor_restore(win); - //} + if(!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 1, 0, 0)) + return 0; + if(!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 1, 3, 0)) + return 0; + if(!radial_control_get_path(&ctx_ptr, op, "fill_color_path", &rc->fill_col_ptr, &rc->fill_col_prop, 1, 3, 0)) + return 0; + + /* slightly ugly; allow this property to not resolve + correctly. needed because 3d texture paint shares the same + keymap as 2d image paint */ + if(!radial_control_get_path(&ctx_ptr, op, "zoom_path", &rc->zoom_ptr, &rc->zoom_prop, 1, 2, 1)) + return 0; + + if(!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0, 0)) + return 0; + else if(rc->image_id_ptr.data) { + /* extra check, pointer must be to an ID */ + if(!RNA_struct_is_ID(rc->image_id_ptr.type)) { + BKE_report(op->reports, RPT_ERROR, + "Pointer from path image_id is not an ID"); + return 0; + } + } - return ret; + return 1; } -/* Expects the operator customdata to be an ImBuf (or NULL) */ -int WM_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) { - wmRadialControl *rc = MEM_callocN(sizeof(wmRadialControl), "radial control"); - // wmWindow *win = CTX_wm_window(C); - int mode = RNA_enum_get(op->ptr, "mode"); - float initial_value = RNA_float_get(op->ptr, "initial_value"); - //float initial_size = RNA_float_get(op->ptr, "initial_size"); - int mouse[2]; - - mouse[0]= event->x; - mouse[1]= event->y; + wmWindowManager *wm; + RadialControl *rc; + int min_value_int, max_value_int, step_int; + float step_float, precision; - //if (initial_size == 0) - // initial_size = WM_RADIAL_CONTROL_DISPLAY_SIZE; + if(!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl"))) + return OPERATOR_CANCELLED; - if(mode == WM_RADIALCONTROL_SIZE) { - rc->max_value = 200; - mouse[0]-= (int)initial_value; - } - else if(mode == WM_RADIALCONTROL_STRENGTH) { - rc->max_value = 1; - mouse[0]-= (int)(WM_RADIAL_CONTROL_DISPLAY_SIZE * (1.0f - initial_value)); - } - else if(mode == WM_RADIALCONTROL_ANGLE) { - rc->max_value = 360; - mouse[0]-= (int)(WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(initial_value)); - mouse[1]-= (int)(WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(initial_value)); - initial_value *= 180.0f/(float)M_PI; + if(!radial_control_get_properties(C, op)) { + MEM_freeN(rc); + return OPERATOR_CANCELLED; } - if(op->customdata) { - ImBuf *im = (ImBuf*)op->customdata; - /* Build GL texture */ - glGenTextures(1, &rc->tex); - glBindTexture(GL_TEXTURE_2D, rc->tex); - glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, im->x, im->y, 0, GL_ALPHA, GL_FLOAT, im->rect_float); - MEM_freeN(im->rect_float); - MEM_freeN(im); + /* get type, initial, min, and max values of the property */ + switch((rc->type = RNA_property_type(rc->prop))) { + case PROP_INT: + rc->initial_value = RNA_property_int_get(&rc->ptr, rc->prop); + RNA_property_int_ui_range(&rc->ptr, rc->prop, &min_value_int, + &max_value_int, &step_int); + rc->min_value = min_value_int; + rc->max_value = max_value_int; + break; + case PROP_FLOAT: + rc->initial_value = RNA_property_float_get(&rc->ptr, rc->prop); + RNA_property_float_ui_range(&rc->ptr, rc->prop, &rc->min_value, + &rc->max_value, &step_float, &precision); + break; + default: + BKE_report(op->reports, RPT_ERROR, "Property must be an integer or a float"); + MEM_freeN(rc); + return OPERATOR_CANCELLED; } - RNA_float_get_array(op->ptr, "color", rc->col); - RNA_float_get_array(op->ptr, "texture_color", rc->tex_col); - - RNA_int_set_array(op->ptr, "initial_mouse", mouse); - RNA_float_set(op->ptr, "new_value", initial_value); + /* get subtype of property */ + rc->subtype = RNA_property_subtype(rc->prop); + if(!ELEM3(rc->subtype, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE)) { + BKE_report(op->reports, RPT_ERROR, "Property must be a distance, a factor, or an angle"); + MEM_freeN(rc); + return OPERATOR_CANCELLED; + } - op->customdata = rc; - rc->mode = mode; - rc->initial_value = initial_value; - rc->initial_mouse[0] = mouse[0]; - rc->initial_mouse[1] = mouse[1]; - rc->cursor = WM_paint_cursor_activate(CTX_wm_manager(C), op->type->poll, - wm_radial_control_paint, op->customdata); + rc->current_value = rc->initial_value; + radial_control_set_initial_mouse(rc, event); + radial_control_set_tex(rc); - //WM_cursor_modal(win, CURSOR_NONE); + /* temporarily disable other paint cursors */ + wm = CTX_wm_manager(C); + rc->orig_paintcursors = wm->paintcursors; + wm->paintcursors.first = wm->paintcursors.last = NULL; + + /* add radial control paint cursor */ + rc->cursor = WM_paint_cursor_activate(wm, op->type->poll, + radial_control_paint_cursor, rc); - /* add modal handler */ WM_event_add_modal_handler(C, op); - - WM_radial_control_modal(C, op, event); - + return OPERATOR_RUNNING_MODAL; } -/* Gets a descriptive string of the operation */ -void WM_radial_control_string(wmOperator *op, char str[], int maxlen) +static void radial_control_set_value(RadialControl *rc, float val) { - int mode = RNA_enum_get(op->ptr, "mode"); - float v = RNA_float_get(op->ptr, "new_value"); - - if(mode == WM_RADIALCONTROL_SIZE) - BLI_snprintf(str, maxlen, "Size: %d", (int)v); - else if(mode == WM_RADIALCONTROL_STRENGTH) - BLI_snprintf(str, maxlen, "Strength: %d", (int)v); - else if(mode == WM_RADIALCONTROL_ANGLE) - BLI_snprintf(str, maxlen, "Angle: %d", (int)(v * 180.0f/(float)M_PI)); + switch(rc->type) { + case PROP_INT: + RNA_property_int_set(&rc->ptr, rc->prop, val); + break; + case PROP_FLOAT: + RNA_property_float_set(&rc->ptr, rc->prop, val); + break; + default: + break; + } } -/** Important: this doesn't define an actual operator, it - just sets up the common parts of the radial control op. **/ -void WM_OT_radial_control_partial(wmOperatorType *ot) +static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) { - static EnumPropertyItem radial_mode_items[] = { - {WM_RADIALCONTROL_SIZE, "SIZE", 0, "Size", ""}, - {WM_RADIALCONTROL_STRENGTH, "STRENGTH", 0, "Strength", ""}, - {WM_RADIALCONTROL_ANGLE, "ANGLE", 0, "Angle", ""}, - {0, NULL, 0, NULL, NULL}}; - static float color[4] = {1.0f, 1.0f, 1.0f, 0.5f}; - static float tex_color[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + RadialControl *rc = op->customdata; + wmWindowManager *wm; + float new_value, dist, zoom[2]; + float delta[2], snap, ret = OPERATOR_RUNNING_MODAL; - /* Should be set in custom invoke() */ - RNA_def_float(ot->srna, "initial_value", 0, 0, FLT_MAX, "Initial Value", "", 0, FLT_MAX); + /* TODO: fix hardcoded events */ - /* Set internally, should be used in custom exec() to get final value */ - RNA_def_float(ot->srna, "new_value", 0, 0, FLT_MAX, "New Value", "", 0, FLT_MAX); + snap = event->ctrl; + + switch(event->type) { + case MOUSEMOVE: + delta[0]= rc->initial_mouse[0] - event->x; + delta[1]= rc->initial_mouse[1] - event->y; + + if(rc->zoom_prop) { + RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom); + delta[0] /= zoom[0]; + delta[1] /= zoom[1]; + } + + dist= sqrt(delta[0]*delta[0]+delta[1]*delta[1]); + + /* calculate new value and apply snapping */ + switch(rc->subtype) { + case PROP_DISTANCE: + new_value = dist; + if(snap) new_value = ((int)new_value + 5) / 10*10; + break; + case PROP_FACTOR: + new_value = 1 - dist / WM_RADIAL_CONTROL_DISPLAY_SIZE; + if(snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f; + break; + case PROP_ANGLE: + new_value = atan2(delta[1], delta[0]) + M_PI; + if(snap) new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10*10); + break; + default: + break; + } + + /* clamp and update */ + CLAMP(new_value, rc->min_value, rc->max_value); + radial_control_set_value(rc, new_value); + rc->current_value = new_value; + break; + + case ESCKEY: + case RIGHTMOUSE: + /* cancelled; restore original value */ + radial_control_set_value(rc, rc->initial_value); + ret = OPERATOR_CANCELLED; + break; + + case LEFTMOUSE: + case PADENTER: + /* done; value already set */ + ret = OPERATOR_FINISHED; + break; + } + + ED_region_tag_redraw(CTX_wm_region(C)); + + if(ret != OPERATOR_RUNNING_MODAL) { + wm = CTX_wm_manager(C); + + WM_paint_cursor_end(wm, rc->cursor); + + /* restore original paint cursors */ + wm->paintcursors = rc->orig_paintcursors; + + /* not sure if this is a good notifier to use; + intended purpose is to update the UI so that the + new value is displayed in sliders/numfields */ + WM_event_add_notifier(C, NC_WINDOW, NULL); + + glDeleteTextures(1, &rc->gltex); + + MEM_freeN(rc); + } + + return ret; +} + +static void WM_OT_radial_control(wmOperatorType *ot) +{ + ot->name= "Radial Control"; + ot->idname= "WM_OT_radial_control"; - /* Should be set before calling operator */ - RNA_def_enum(ot->srna, "mode", radial_mode_items, 0, "Mode", ""); + ot->invoke= radial_control_invoke; + ot->modal= radial_control_modal; - /* Internal */ - RNA_def_int_vector(ot->srna, "initial_mouse", 2, NULL, INT_MIN, INT_MAX, "Initial Mouse", "", INT_MIN, INT_MAX); + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; - RNA_def_float_color(ot->srna, "color", 4, color, 0.0f, FLT_MAX, "Color", "Radial control color", 0.0f, 1.0f); - RNA_def_float_color(ot->srna, "texture_color", 4, tex_color, 0.0f, FLT_MAX, "Texture Color", "Radial control texture color", 0.0f, 1.0f); + /* all paths relative to the context */ + RNA_def_string(ot->srna, "data_path", "", 0, "Data Path", "Path of property to be set by the radial control."); + RNA_def_string(ot->srna, "rotation_path", "", 0, "Rotation Path", "Path of property used to rotate the texture display."); + RNA_def_string(ot->srna, "color_path", "", 0, "Color Path", "Path of property used to set the color of the control."); + RNA_def_string(ot->srna, "fill_color_path", "", 0, "Fill Color Path", "Path of property used to set the fill color of the control."); + RNA_def_string(ot->srna, "zoom_path", "", 0, "Zoom Path", "Path of property used to set the zoom level for the control."); + RNA_def_string(ot->srna, "image_id", "", 0, "Image ID", "Path of ID that is used to generate an image for the control."); } /* ************************** timer for testing ***************** */ @@ -3129,6 +3337,7 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_splash); WM_operatortype_append(WM_OT_search_menu); WM_operatortype_append(WM_OT_call_menu); + WM_operatortype_append(WM_OT_radial_control); #if defined(WIN32) WM_operatortype_append(WM_OT_console_toggle); #endif diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h index f73652125b1..fd279c31f3c 100644 --- a/source/blender/windowmanager/wm.h +++ b/source/blender/windowmanager/wm.h @@ -78,7 +78,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt); void wm_autosave_timer_ended(wmWindowManager *wm); void wm_autosave_delete(void); void wm_autosave_read(bContext *C, struct ReportList *reports); -void wm_autosave_location(char *filename); +void wm_autosave_location(char *filepath); /* hack to store circle select size - campbell, must replace with nice operator memory */ #define GESTURE_MEMORY diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index b88c0fd04c1..901aaea3eca 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -127,7 +127,6 @@ endif() extern_openjpeg extern_redcode bf_imbuf_dds - bf_readblenfile bf_dna ge_videotex bf_blenfont diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 2f5d6702e3e..cf2481bc982 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -230,6 +230,7 @@ short ANIM_add_driver(struct ID *id, const char rna_path[], int array_index, sho short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag){return 0;} void ED_space_image_release_buffer(struct SpaceImage *sima, void *lock){} struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **lock_r){return (struct ImBuf *) NULL;} +void ED_space_image_zoom(struct SpaceImage *sima, struct ARegion *ar, float *zoomx, float *zoomy) {} char *ED_info_stats_string(struct Scene *scene){return (char *) NULL;} void ED_area_tag_redraw(struct ScrArea *sa){} void ED_area_tag_refresh(struct ScrArea *sa){} @@ -243,6 +244,7 @@ void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct void ED_view3d_scene_layers_update(struct Main *bmain, struct Scene *scene){} int ED_view3d_scene_layer_set(int lay, const int *values){return 0;} void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar){} +void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist){} void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist){} int text_file_modified(struct Text *text){return 0;} void ED_node_shader_default(struct Material *ma){} diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 13e7bb10e38..965da37df9b 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -192,10 +192,10 @@ if(WITH_PYTHON_MODULE) set_target_properties( blender PROPERTIES - PREFIX "" - OUTPUT_NAME bpy - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/ - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/ # only needed on windows + PREFIX "" + OUTPUT_NAME bpy + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/ + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/ # only needed on windows ) if(WIN32) @@ -203,7 +203,7 @@ if(WITH_PYTHON_MODULE) set_target_properties( blender PROPERTIES - SUFFIX ".pyd" + SUFFIX ".pyd" ) endif() @@ -575,19 +575,19 @@ elseif(WIN32) endif() endif() - if(NOT CMAKE_CL_64) + if(NOT CMAKE_CL_64) install( FILES - ${LIBDIR}/thumbhandler/lib/BlendThumb.dll - DESTINATION ${TARGETDIR}/ - ) - else() + ${LIBDIR}/thumbhandler/lib/BlendThumb.dll + DESTINATION ${TARGETDIR}/ + ) + else() install( FILES - ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll - DESTINATION ${TARGETDIR}/ - ) - endif() + ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll + DESTINATION ${TARGETDIR}/ + ) + endif() elseif(APPLE) set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app) @@ -773,7 +773,6 @@ endif() bf_imbuf_cineon bf_imbuf_openexr bf_imbuf_dds - bf_readblenfile bf_collada bf_intern_bsp bf_intern_bop @@ -813,13 +812,13 @@ endif() bf_intern_mikktspace ) - if(WITH_MOD_CLOTH_ELTOPO) + if(WITH_MOD_CLOTH_ELTOPO) list(APPEND BLENDER_SORTED_LIBS extern_eltopo) - endif() + endif() - if(WITH_BUILTIN_GLEW) + if(WITH_BUILTIN_GLEW) list(APPEND BLENDER_SORTED_LIBS extern_glew) - endif() + endif() if(WITH_BINRELOC) list(APPEND BLENDER_SORTED_LIBS extern_binreloc) diff --git a/source/creator/creator.c b/source/creator/creator.c index cae42302cb2..b91baee63aa 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -153,7 +153,7 @@ char btempdir[FILE_MAX]; #define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d)\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION -/* Initialise callbacks for the modules that need them */ +/* Initialize callbacks for the modules that need them */ static void setCallbacks(void); /* set breakpoints here when running in debug mode, useful to catch floating point errors */ @@ -340,18 +340,6 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data) double PIL_check_seconds_timer(void); -/* XXX This was here to fix a crash when running python scripts - * with -P that used the screen. - * - * static void main_init_screen( void ) -{ - setscreen(G.curscreen); - - if(G.main->scene.first==0) { - set_scene( add_scene("1") ); - } -}*/ - static int end_arguments(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) { return -1; diff --git a/source/darwin/blender.app/Contents/Info.plist b/source/darwin/blender.app/Contents/Info.plist index 2f5d235a619..23941d91075 100644 --- a/source/darwin/blender.app/Contents/Info.plist +++ b/source/darwin/blender.app/Contents/Info.plist @@ -1,53 +1,53 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
-<plist version="0.9">
-<dict>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
-
- <key>CFBundleExecutable</key>
- <string>blender</string>
-
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleSignature</key>
- <string>????</string>
-
- <key>CFBundleIconFile</key>
- <string>blender icon.icns</string>
-
- <key>CFBundleName</key>
- <string>Blender</string>
- <key>CFBundleIdentifier</key>
- <string>org.blenderfoundation.blender</string>
-
- <key>CFBundleVersion</key>
- <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation</string>
- <key>CFBundleShortVersionString</key>
- <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
- <key>CFBundleGetInfoString</key>
- <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation</string>
-
- <key>CFBundleDocumentTypes</key>
- <array>
- <dict>
- <key>CFBundleTypeIconFile</key>
- <string>blender file icon.icns</string>
- <key>CFBundleTypeName</key>
- <string>Blender File</string>
- <key>CFBundleTypeOSTypes</key>
- <array>
- <string>BLND</string>
- </array>
- <key>CFBundleTypeExtensions</key>
- <array>
- <string>blend</string>
- </array>
- <key>CFBundleTypeRole</key>
- <string>Editor</string>
- <key>LSIsAppleDefaultForType</key>
- <true/>
- </dict>
- </array>
-</dict>
-</plist>
+<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + + <key>CFBundleExecutable</key> + <string>blender</string> + + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>????</string> + + <key>CFBundleIconFile</key> + <string>blender icon.icns</string> + + <key>CFBundleName</key> + <string>Blender</string> + <key>CFBundleIdentifier</key> + <string>org.blenderfoundation.blender</string> + + <key>CFBundleVersion</key> + <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation</string> + <key>CFBundleShortVersionString</key> + <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string> + <key>CFBundleGetInfoString</key> + <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation</string> + + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeIconFile</key> + <string>blender file icon.icns</string> + <key>CFBundleTypeName</key> + <string>Blender File</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>BLND</string> + </array> + <key>CFBundleTypeExtensions</key> + <array> + <string>blend</string> + </array> + <key>CFBundleTypeRole</key> + <string>Editor</string> + <key>LSIsAppleDefaultForType</key> + <true/> + </dict> + </array> +</dict> +</plist> diff --git a/source/darwin/blenderplayer.app/Contents/Info.plist b/source/darwin/blenderplayer.app/Contents/Info.plist index f99338d6c47..54364d18866 100644 --- a/source/darwin/blenderplayer.app/Contents/Info.plist +++ b/source/darwin/blenderplayer.app/Contents/Info.plist @@ -1,53 +1,53 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
-<plist version="0.9">
-<dict>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
-
- <key>CFBundleExecutable</key>
- <string>blenderplayer</string>
-
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleSignature</key>
- <string>????</string>
-
- <key>CFBundleIconFile</key>
- <string>blender player icon.icns</string>
-
- <key>CFBundleName</key>
- <string>BlenderPlayer</string>
- <key>CFBundleIdentifier</key>
- <string>org.blenderfoundation.blenderplayer</string>
-
- <key>CFBundleVersion</key>
- <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation</string>
- <key>CFBundleShortVersionString</key>
- <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
- <key>CFBundleGetInfoString</key>
- <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation</string>
-
- <key>CFBundleDocumentTypes</key>
- <array>
- <dict>
- <key>CFBundleTypeIconFile</key>
- <string>blender file icon.icns</string>
- <key>CFBundleTypeName</key>
- <string>Blender File</string>
- <key>CFBundleTypeOSTypes</key>
- <array>
- <string>BLND</string>
- </array>
- <key>CFBundleTypeExtensions</key>
- <array>
- <string>blend</string>
- </array>
- <key>CFBundleTypeRole</key>
- <string>Viewer</string>
- <key>LSIsAppleDefaultForType</key>
- <false/>
- </dict>
- </array>
-</dict>
-</plist>
+<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + + <key>CFBundleExecutable</key> + <string>blenderplayer</string> + + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>????</string> + + <key>CFBundleIconFile</key> + <string>blender player icon.icns</string> + + <key>CFBundleName</key> + <string>BlenderPlayer</string> + <key>CFBundleIdentifier</key> + <string>org.blenderfoundation.blenderplayer</string> + + <key>CFBundleVersion</key> + <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation</string> + <key>CFBundleShortVersionString</key> + <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string> + <key>CFBundleGetInfoString</key> + <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender Foundation</string> + + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeIconFile</key> + <string>blender file icon.icns</string> + <key>CFBundleTypeName</key> + <string>Blender File</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>BLND</string> + </array> + <key>CFBundleTypeExtensions</key> + <array> + <string>blend</string> + </array> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSIsAppleDefaultForType</key> + <false/> + </dict> + </array> +</dict> +</plist> diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 571cc9087b3..4789155dced 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -427,6 +427,13 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c { // first check if we want to exit exitrequested = ketsjiengine->GetExitCode(); + + // Clear screen to border color + // We do this here since we set the canvas to be within the frames. This means the engine + // itself is unaware of the extra space, so we clear the whole region for it. + glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); + glViewport(ar->winrct.xmin, ar->winrct.ymin, ar->winrct.xmax, ar->winrct.ymax); + glClear(GL_COLOR_BUFFER_BIT); // kick the engine bool render = ketsjiengine->NextFrame(); diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index a4fa91469a1..1fb30925446 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -143,9 +143,11 @@ extern "C" { #include "BKE_customdata.h" #include "BKE_cdderivedmesh.h" #include "BKE_DerivedMesh.h" +#include "BKE_material.h" /* give_current_material */ + +extern Material defmaterial; /* material.c */ } -#include "BKE_material.h" /* give_current_material */ /* end of blender include block */ #include "KX_BlenderInputDevice.h" @@ -460,7 +462,9 @@ bool ConvertMaterial( } } } - material->flag[i] |= (mat->ipo!=0)?HASIPO:0; +#if 0 /* this flag isnt used anymore */ + material->flag[i] |= (BKE_animdata_from_id(mat->id) != NULL) ? HASIPO : 0; +#endif /// -------------------------------- // mapping methods material->mapping[i].mapping |= ( mttmp->texco & TEXCO_REFL )?USEREFL:0; @@ -835,6 +839,11 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, else ma = mesh->mat ? mesh->mat[mface->mat_nr]:NULL; + /* ckeck for texface since texface _only_ is used as a fallback */ + if(ma == NULL && tface == NULL) { + ma= &defmaterial; + } + { bool visible = true; bool twoside = false; diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index edf0839f747..389300efc21 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -39,7 +39,6 @@ set(INC ../../../../source/blender/blenfont ../../../../source/blender/blenlib ../../../../source/blender/blenkernel - ../../../../source/blender/readblenfile ../../../../source/blender ../../../../source/blender/makesdna ../../../../source/blender/makesrna diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index a4f1391b1b0..75181b6c330 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -67,7 +67,7 @@ extern "C" #include "DNA_scene_types.h" #include "DNA_userdef_types.h" #include "BLO_readfile.h" -#include "BLO_readblenfile.h" +#include "BLO_runtime.h" #include "IMB_imbuf.h" #include "BKE_text.h" @@ -313,8 +313,8 @@ static BlendFileData *load_game_data(char *progname, char *filename = NULL, char BKE_reports_init(&reports, RPT_STORE); /* try to load ourself, will only work if we are a runtime */ - if (blo_is_a_runtime(progname)) { - bfd= blo_read_runtime(progname, &reports); + if (BLO_is_a_runtime(progname)) { + bfd= BLO_read_runtime(progname, &reports); if (bfd) { bfd->type= BLENFILETYPE_RUNTIME; strcpy(bfd->main->name, progname); @@ -345,7 +345,9 @@ int main(int argc, char** argv) bool fullScreen = false; bool fullScreenParFound = false; bool windowParFound = false; +#ifdef WIN32 bool closeConsole = true; +#endif RAS_IRasterizer::StereoMode stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; bool stereoWindow = false; bool stereoParFound = false; @@ -444,7 +446,7 @@ int main(int argc, char** argv) U.audiochannels = 2; /* if running blenderplayer the last argument can't be parsed since it has to be the filename. */ - isBlenderPlayer = !blo_is_a_runtime(argv[0]); + isBlenderPlayer = !BLO_is_a_runtime(argv[0]); if (isBlenderPlayer) validArguments = argc - 1; else @@ -570,7 +572,9 @@ int main(int argc, char** argv) break; case 'c': i++; +#ifdef WIN32 closeConsole = false; +#endif break; case 's': // stereo i++; diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index 65bd55f95d7..e3ffc1a406b 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -22,7 +22,6 @@ incs = ['.', '#source/blender/blenfont', '#source/blender/blenlib', '#source/blender/blenkernel', - '#source/blender/readblenfile', '#source/blender', '#source/blender/include', '#source/blender/makesdna', diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h index 126135f3d46..ef25c9218a3 100644 --- a/source/gameengine/Ketsji/BL_Material.h +++ b/source/gameengine/Ketsji/BL_Material.h @@ -144,7 +144,7 @@ enum BL_flag USEALPHA=4, // use actual alpha channel TEXALPHA=8, // use alpha combiner functions TEXNEG=16, // negate blending - HASIPO=32, + /*HASIPO=32,*/ // unused, commeted for now. USENEGALPHA=64 }; diff --git a/source/icons/blender.exe.manifest b/source/icons/blender.exe.manifest index bc13bf4c586..a43d11b21a0 100644 --- a/source/icons/blender.exe.manifest +++ b/source/icons/blender.exe.manifest @@ -1,10 +1,10 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
- <security>
- <requestedPrivileges>
- <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
- </requestedPrivileges>
- </security>
- </trustInfo>
-</assembly>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> + <security> + <requestedPrivileges> + <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel> + </requestedPrivileges> + </security> + </trustInfo> +</assembly> |