From e2b2d083e0cd2c738962e2a4535acdfb17f37416 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Sun, 17 Mar 2013 18:09:09 +0000 Subject: Fix "can't paint" bug no.1, painting with black on image editor did not paint. Was own regression when optimizing colour operations. I will not use an alpha bit mask since it may run into portability issues with byte order. --- source/blender/blenkernel/BKE_brush.h | 2 +- source/blender/blenkernel/intern/brush.c | 16 ++++++++-------- source/blender/editors/sculpt_paint/paint_image_2d.c | 4 ++-- source/blender/imbuf/IMB_imbuf_types.h | 1 - source/blender/imbuf/intern/rectop.c | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 3a4684257f6..4dfc70db952 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -72,7 +72,7 @@ float BKE_brush_curve_strength(struct Brush *br, float p, const float len); /* u float BKE_brush_sample_tex_3D(const Scene *scene, struct Brush *br, const float point[3], float rgba[4], const int thread, struct ImagePool *pool); float BKE_brush_sample_tex_2D(const struct Scene *scene, struct Brush *brush, const float xy[2], - float rgba[4], struct ImagePool *pool); + float rgba[4]); void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size, struct ImBuf **imbuf, int use_color_correction); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 6adcdbd2c3e..c594e19b960 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -563,7 +563,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, /* Brush Sampling for 2D brushes. when we unify the brush systems this will be necessarily a separate function */ -float BKE_brush_sample_tex_2D(const Scene *scene, Brush *brush, const float xy[2], float rgba[4], struct ImagePool *pool) +float BKE_brush_sample_tex_2D(const Scene *scene, Brush *brush, const float xy[2], float rgba[4]) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; MTex *mtex = &brush->mtex; @@ -598,7 +598,7 @@ float BKE_brush_sample_tex_2D(const Scene *scene, Brush *brush, const float xy[2 co[1] = y + brush->mtex.ofs[1]; co[2] = 0.0f; - hasrgb = externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, 0, pool); + hasrgb = externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, 0, NULL); if (hasrgb) { rgba[0] = tr; @@ -660,15 +660,15 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf dstf[3] = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); } else if (texfall == 1) { - BKE_brush_sample_tex_2D(scene, brush, xy, dstf, 0); + BKE_brush_sample_tex_2D(scene, brush, xy, dstf); } else if (texfall == 2) { - BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); + BKE_brush_sample_tex_2D(scene, brush, xy, rgba); mul_v3_v3v3(dstf, rgba, brush_rgb); dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); } else { - BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); + BKE_brush_sample_tex_2D(scene, brush, xy, rgba); copy_v3_v3(dstf, brush_rgb); dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); } @@ -695,11 +695,11 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf dst[3] = FTOCHAR(alpha_f); } else if (texfall == 1) { - BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); + BKE_brush_sample_tex_2D(scene, brush, xy, rgba); rgba_float_to_uchar(dst, rgba); } else if (texfall == 2) { - BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); + BKE_brush_sample_tex_2D(scene, brush, xy, rgba); mul_v3_v3(rgba, brush->rgb); alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); @@ -708,7 +708,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf dst[3] = FTOCHAR(alpha_f); } else { - BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0); + BKE_brush_sample_tex_2D(scene, brush, xy, rgba); alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); dst[0] = crgb[0]; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index ed1b25d1b4e..921ef6c2879 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -235,7 +235,7 @@ static void brush_painter_2d_do_partial(BrushPainter *painter, ImBuf *oldtexibuf xy[0] = x + xoff; xy[1] = y + yoff; - BKE_brush_sample_tex_2D(scene, brush, xy, tf, NULL); + BKE_brush_sample_tex_2D(scene, brush, xy, tf); } bf[0] = tf[0] * mf[0]; @@ -266,7 +266,7 @@ static void brush_painter_2d_do_partial(BrushPainter *painter, ImBuf *oldtexibuf xy[0] = x + xoff; xy[1] = y + yoff; - BKE_brush_sample_tex_2D(scene, brush, xy, rgba, NULL); + BKE_brush_sample_tex_2D(scene, brush, xy, rgba); rgba_float_to_uchar(t, rgba); } diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h index a3629d079a3..dde8d4d4ab7 100644 --- a/source/blender/imbuf/IMB_imbuf_types.h +++ b/source/blender/imbuf/IMB_imbuf_types.h @@ -179,7 +179,6 @@ typedef struct ImBuf { * Note that the lower 11 bits is used for storing custom flags */ #define IB_CUSTOM_FLAGS_MASK 0x7ff -#define IB_ALPHA_MASK 0xff #define PNG (1 << 30) #define TGA (1 << 28) diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index 8b60d1a96df..446833ccf3b 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -517,7 +517,7 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx, dr = drect; sr = srect; for (x = width; x > 0; x--, dr++, sr++) { - if (*sr & IB_ALPHA_MASK) + if (((char *)sr)[3]) func((char *)dr, (char *)dr, (char *)sr, ((char *)sr)[3]); } -- cgit v1.2.3 From 16b82845eee4198b2d56aa5a5c373008f5070f7f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Mar 2013 18:30:31 +0000 Subject: code cleanup: add 'const' to headers to quiet msvc warnings, also remove (char *) casts that aren't needed now we're on Python3.3 --- source/blender/blenlib/BLI_path_util.h | 12 ++++---- .../blender/python/generic/bpy_internal_import.c | 2 +- source/blender/python/intern/bpy.c | 2 +- source/blender/python/intern/bpy_driver.c | 4 +-- .../blender/python/intern/bpy_interface_atexit.c | 2 +- source/blender/python/intern/bpy_rna.c | 2 +- source/blender/python/mathutils/mathutils_noise.c | 34 +++++++++++----------- .../gameengine/GameLogic/SCA_PythonController.cpp | 2 +- source/gameengine/Ketsji/KX_PolygonMaterial.cpp | 2 +- source/gameengine/Ketsji/KX_PythonInit.cpp | 6 ++-- source/gameengine/Ketsji/KX_PythonInitTypes.cpp | 6 ++-- source/gameengine/VideoTexture/PyTypeList.cpp | 2 +- source/gameengine/VideoTexture/blendVideoTex.cpp | 12 ++++---- 13 files changed, 44 insertions(+), 44 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 20fc489cbc3..136a51cf55e 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -86,10 +86,10 @@ void BLI_setenv_if_new(const char *env, const char *val); void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file); void BLI_make_exist(char *dir); void BLI_make_existing_file(const char *name); -void BLI_split_dirfile(const char *string, char *dir, char *file, size_t dirlen, size_t filelen); -void BLI_split_dir_part(const char *string, char *dir, size_t dirlen); -void BLI_split_file_part(const char *string, char *file, size_t filelen); -void BLI_join_dirfile(char *string, size_t maxlen, const char *dir, const char *file); +void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen); +void BLI_split_dir_part(const char *string, char *dir, const size_t dirlen); +void BLI_split_file_part(const char *string, char *file, const size_t filelen); +void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file); const char *BLI_path_basename(const char *path); typedef enum bli_rebase_state { @@ -105,7 +105,7 @@ int BLI_add_slash(char *string); void BLI_del_slash(char *string); const char *BLI_first_slash(const char *string); -void BLI_getlastdir(const char *dir, char *last, size_t maxlen); +void BLI_getlastdir(const char *dir, char *last, const size_t maxlen); bool BLI_testextensie(const char *str, const char *ext); bool BLI_testextensie_array(const char *str, const char **ext_array); bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch); @@ -117,7 +117,7 @@ bool BLI_uniquename_cb(bool (*unique_check)(void * arg, const char * name), void BLI_newname(char *name, int add); int BLI_stringdec(const char *string, char *head, char *start, unsigned short *numlen); void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic); -int BLI_split_name_num(char *left, int *nr, const char *name, char delim); +int BLI_split_name_num(char *left, int *nr, const char *name, const char delim); /* make sure path separators conform to system one */ void BLI_clean(char *path) diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 0c0ad50ebe4..734d4b6b83f 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -81,7 +81,7 @@ void bpy_import_init(PyObject *builtins) /* move reload here * XXX, use import hooks */ - mod = PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0); + mod = PyImport_ImportModuleLevel("imp", NULL, NULL, NULL, 0); if (mod) { PyObject *mod_dict = PyModule_GetDict(mod); diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index a0e7c4332e1..36fd78db1b7 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -222,7 +222,7 @@ static PyMethodDef meth_bpy_resource_path = static PyObject *bpy_import_test(const char *modname) { - PyObject *mod = PyImport_ImportModuleLevel((char *)modname, NULL, NULL, NULL, 0); + PyObject *mod = PyImport_ImportModuleLevel(modname, NULL, NULL, NULL, 0); if (mod) { Py_DECREF(mod); } diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index c49794ad37a..72bfda89b64 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -75,14 +75,14 @@ int bpy_pydriver_create_dict(void) } /* add bpy to global namespace */ - mod = PyImport_ImportModuleLevel((char *)"bpy", NULL, NULL, NULL, 0); + mod = PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0); if (mod) { PyDict_SetItemString(bpy_pydriver_Dict, "bpy", mod); Py_DECREF(mod); } /* add noise to global namespace */ - mod = PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0); + mod = PyImport_ImportModuleLevel("mathutils", NULL, NULL, NULL, 0); if (mod) { PyObject *modsub = PyDict_GetItemString(PyModule_GetDict(mod), "noise"); PyDict_SetItemString(bpy_pydriver_Dict, "noise", modsub); diff --git a/source/blender/python/intern/bpy_interface_atexit.c b/source/blender/python/intern/bpy_interface_atexit.c index d1d33a01e55..5c4f6ba327c 100644 --- a/source/blender/python/intern/bpy_interface_atexit.c +++ b/source/blender/python/intern/bpy_interface_atexit.c @@ -57,7 +57,7 @@ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg) * this is intended, but if its problematic it could be changed * - campbell */ - PyObject *atexit_mod = PyImport_ImportModuleLevel((char *)"atexit", NULL, NULL, NULL, 0); + PyObject *atexit_mod = PyImport_ImportModuleLevel("atexit", NULL, NULL, NULL, 0); PyObject *atexit_func = PyObject_GetAttrString(atexit_mod, func_name); PyObject *args = PyTuple_New(1); PyObject *ret; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 0adb5e2e90e..8fe75032a46 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6118,7 +6118,7 @@ static PyObject *pyrna_srna_ExternalType(StructRNA *srna) PyObject *newclass; if (bpy_types_dict == NULL) { - PyObject *bpy_types = PyImport_ImportModuleLevel((char *)"bpy_types", NULL, NULL, NULL, 0); + PyObject *bpy_types = PyImport_ImportModuleLevel("bpy_types", NULL, NULL, NULL, 0); if (bpy_types == NULL) { PyErr_Print(); diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c index 4977663038d..31663bd369d 100644 --- a/source/blender/python/mathutils/mathutils_noise.c +++ b/source/blender/python/mathutils/mathutils_noise.c @@ -870,16 +870,16 @@ PyMODINIT_FUNC PyInit_mathutils_noise_types(void) { PyObject *submodule = PyModule_Create(&M_NoiseTypes_module_def); - PyModule_AddIntConstant(submodule, (char *)"BLENDER", TEX_BLENDER); - PyModule_AddIntConstant(submodule, (char *)"STDPERLIN", TEX_STDPERLIN); - PyModule_AddIntConstant(submodule, (char *)"NEWPERLIN", TEX_NEWPERLIN); - PyModule_AddIntConstant(submodule, (char *)"VORONOI_F1", TEX_VORONOI_F1); - PyModule_AddIntConstant(submodule, (char *)"VORONOI_F2", TEX_VORONOI_F2); - PyModule_AddIntConstant(submodule, (char *)"VORONOI_F3", TEX_VORONOI_F3); - PyModule_AddIntConstant(submodule, (char *)"VORONOI_F4", TEX_VORONOI_F4); - PyModule_AddIntConstant(submodule, (char *)"VORONOI_F2F1", TEX_VORONOI_F2F1); - PyModule_AddIntConstant(submodule, (char *)"VORONOI_CRACKLE", TEX_VORONOI_CRACKLE); - PyModule_AddIntConstant(submodule, (char *)"CELLNOISE", TEX_CELLNOISE); + PyModule_AddIntConstant(submodule, "BLENDER", TEX_BLENDER); + PyModule_AddIntConstant(submodule, "STDPERLIN", TEX_STDPERLIN); + PyModule_AddIntConstant(submodule, "NEWPERLIN", TEX_NEWPERLIN); + PyModule_AddIntConstant(submodule, "VORONOI_F1", TEX_VORONOI_F1); + PyModule_AddIntConstant(submodule, "VORONOI_F2", TEX_VORONOI_F2); + PyModule_AddIntConstant(submodule, "VORONOI_F3", TEX_VORONOI_F3); + PyModule_AddIntConstant(submodule, "VORONOI_F4", TEX_VORONOI_F4); + PyModule_AddIntConstant(submodule, "VORONOI_F2F1", TEX_VORONOI_F2F1); + PyModule_AddIntConstant(submodule, "VORONOI_CRACKLE", TEX_VORONOI_CRACKLE); + PyModule_AddIntConstant(submodule, "CELLNOISE", TEX_CELLNOISE); return submodule; } @@ -900,13 +900,13 @@ PyMODINIT_FUNC PyInit_mathutils_noise_metrics(void) { PyObject *submodule = PyModule_Create(&M_NoiseMetrics_module_def); - PyModule_AddIntConstant(submodule, (char *)"DISTANCE", TEX_DISTANCE); - PyModule_AddIntConstant(submodule, (char *)"DISTANCE_SQUARED", TEX_DISTANCE_SQUARED); - PyModule_AddIntConstant(submodule, (char *)"MANHATTAN", TEX_MANHATTAN); - PyModule_AddIntConstant(submodule, (char *)"CHEBYCHEV", TEX_CHEBYCHEV); - PyModule_AddIntConstant(submodule, (char *)"MINKOVSKY_HALF", TEX_MINKOVSKY_HALF); - PyModule_AddIntConstant(submodule, (char *)"MINKOVSKY_FOUR", TEX_MINKOVSKY_FOUR); - PyModule_AddIntConstant(submodule, (char *)"MINKOVSKY", TEX_MINKOVSKY); + PyModule_AddIntConstant(submodule, "DISTANCE", TEX_DISTANCE); + PyModule_AddIntConstant(submodule, "DISTANCE_SQUARED", TEX_DISTANCE_SQUARED); + PyModule_AddIntConstant(submodule, "MANHATTAN", TEX_MANHATTAN); + PyModule_AddIntConstant(submodule, "CHEBYCHEV", TEX_CHEBYCHEV); + PyModule_AddIntConstant(submodule, "MINKOVSKY_HALF", TEX_MINKOVSKY_HALF); + PyModule_AddIntConstant(submodule, "MINKOVSKY_FOUR", TEX_MINKOVSKY_FOUR); + PyModule_AddIntConstant(submodule, "MINKOVSKY", TEX_MINKOVSKY); return submodule; } diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index c2b1470ae7a..3a9e8ff0bbc 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -270,7 +270,7 @@ void SCA_PythonController::ErrorPrint(const char *error_msg) * their user count. Not to mention holding references to wrapped data. * This is especially bad when the PyObject for the wrapped data is freed, after blender * has already dealocated the pointer */ - PySys_SetObject( (char *)"last_traceback", NULL); + PySys_SetObject("last_traceback", NULL); PyErr_Clear(); /* just to be sure */ } diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp index 5ce370ccdfe..0f53c510cf7 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp @@ -154,7 +154,7 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI { PyErr_Print(); PyErr_Clear(); - PySys_SetObject( (char *)"last_traceback", NULL); + PySys_SetObject("last_traceback", NULL); } } else diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 22715214324..66333a061c5 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1929,14 +1929,14 @@ PyObject *initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur /* mathutils types are used by the BGE even if we don't import them */ { - PyObject *mod= PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0); + PyObject *mod = PyImport_ImportModuleLevel("mathutils", NULL, NULL, NULL, 0); Py_DECREF(mod); } #ifdef WITH_AUDASPACE /* accessing a SoundActuator's sound results in a crash if aud is not initialized... */ { - PyObject *mod= PyImport_ImportModuleLevel((char *)"aud", NULL, NULL, NULL, 0); + PyObject *mod = PyImport_ImportModuleLevel("aud", NULL, NULL, NULL, 0); Py_DECREF(mod); } #endif @@ -1993,7 +1993,7 @@ PyObject *initGamePythonScripting(const STR_String& progname, TPythonSecurityLev #ifdef WITH_AUDASPACE /* accessing a SoundActuator's sound results in a crash if aud is not initialized... */ { - PyObject *mod= PyImport_ImportModuleLevel((char *)"aud", NULL, NULL, NULL, 0); + PyObject *mod= PyImport_ImportModuleLevel("aud", NULL, NULL, NULL, 0); Py_DECREF(mod); } #endif diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp index c6aa436537a..05bdb3463a6 100644 --- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp +++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp @@ -172,9 +172,9 @@ void initPyTypes(void) */ /* For now just do PyType_Ready */ - PyObject *mod= PyModule_New("GameTypes"); - PyObject *dict= PyModule_GetDict(mod); - PyDict_SetItemString(PySys_GetObject((char *)"modules"), (char *)"GameTypes", mod); + PyObject *mod = PyModule_New("GameTypes"); + PyObject *dict = PyModule_GetDict(mod); + PyDict_SetItemString(PySys_GetObject("modules"), "GameTypes", mod); Py_DECREF(mod); diff --git a/source/gameengine/VideoTexture/PyTypeList.cpp b/source/gameengine/VideoTexture/PyTypeList.cpp index 96ac1cc5b6b..99e9ae13e64 100644 --- a/source/gameengine/VideoTexture/PyTypeList.cpp +++ b/source/gameengine/VideoTexture/PyTypeList.cpp @@ -92,6 +92,6 @@ void PyTypeList::reg(PyObject *module) // increase ref count Py_INCREF((*it)->getType()); // add type to module - PyModule_AddObject(module, (char*)(*it)->getName(), (PyObject *)(*it)->getType()); + PyModule_AddObject(module, (*it)->getName(), (PyObject *)(*it)->getType()); } } diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp index 72415026bb9..e23bd1a3231 100644 --- a/source/gameengine/VideoTexture/blendVideoTex.cpp +++ b/source/gameengine/VideoTexture/blendVideoTex.cpp @@ -214,12 +214,12 @@ PyObject *initVideoTexture(void) pyFilterTypes.reg(m); Py_INCREF(&TextureType); - PyModule_AddObject(m, (char*)"Texture", (PyObject *)&TextureType); - PyModule_AddIntConstant(m, (char*)"SOURCE_ERROR", SourceError); - PyModule_AddIntConstant(m, (char*)"SOURCE_EMPTY", SourceEmpty); - PyModule_AddIntConstant(m, (char*)"SOURCE_READY", SourceReady); - PyModule_AddIntConstant(m, (char*)"SOURCE_PLAYING", SourcePlaying); - PyModule_AddIntConstant(m, (char*)"SOURCE_STOPPED", SourceStopped); + PyModule_AddObject(m, "Texture", (PyObject *)&TextureType); + PyModule_AddIntConstant(m, "SOURCE_ERROR", SourceError); + PyModule_AddIntConstant(m, "SOURCE_EMPTY", SourceEmpty); + PyModule_AddIntConstant(m, "SOURCE_READY", SourceReady); + PyModule_AddIntConstant(m, "SOURCE_PLAYING", SourcePlaying); + PyModule_AddIntConstant(m, "SOURCE_STOPPED", SourceStopped); // init last error description Exception::m_lastError = ""; -- cgit v1.2.3 From 09c41019a8ecb259b2376b5c22c99f54b59f8f24 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Mar 2013 19:13:04 +0000 Subject: use const pointers for file loading and booleans for animation system return values passed as pointers. --- source/blender/blenkernel/BKE_blender.h | 6 ++--- source/blender/blenkernel/BKE_fcurve.h | 8 +++---- source/blender/blenkernel/intern/blender.c | 6 ++--- source/blender/blenkernel/intern/fcurve.c | 26 +++++++++++----------- source/blender/blenkernel/intern/fmodifier.c | 10 ++++----- source/blender/blenloader/BLO_readfile.h | 6 ++--- source/blender/blenloader/intern/readblenentry.c | 8 +++---- source/blender/blenloader/intern/readfile.c | 6 ++--- source/blender/blenloader/intern/readfile.h | 4 ++-- source/blender/editors/animation/fmodifier_ui.c | 2 +- source/blender/editors/animation/keyframing.c | 6 ++--- source/blender/editors/armature/pose_slide.c | 2 +- source/blender/editors/interface/interface_anim.c | 12 +++++----- source/blender/editors/render/render_preview.c | 2 +- source/blender/editors/sound/sound_ops.c | 2 +- source/blender/makesrna/intern/rna_fcurve.c | 2 +- .../blender/nodes/composite/node_composite_tree.c | 6 +++-- .../Converter/KX_BlenderSceneConverter.cpp | 6 ++--- source/gameengine/GamePlayer/common/GPC_Engine.cpp | 6 ++--- source/gameengine/GamePlayer/common/GPC_Engine.h | 2 +- 20 files changed, 65 insertions(+), 63 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index d3671516248..a53fc15714e 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -70,7 +70,7 @@ int BKE_read_file(struct bContext *C, const char *filepath, struct ReportList *r #define BKE_READ_FILE_OK 1 /* OK */ #define BKE_READ_FILE_OK_USERPREFS 2 /* OK, and with new user settings */ -int BKE_read_file_from_memory(struct bContext *C, char *filebuf, int filelength, struct ReportList *reports); +int BKE_read_file_from_memory(struct bContext *C, const void *filebuf, int filelength, struct ReportList *reports); int BKE_read_file_from_memfile(struct bContext *C, struct MemFile *memfile, struct ReportList *reports); int BKE_read_file_userdef(const char *filepath, struct ReportList *reports); @@ -105,8 +105,8 @@ extern struct Main *BKE_undo_get_main(struct Scene **scene); /* copybuffer */ void BKE_copybuffer_begin(void); void BKE_copybuffer_tag_ID(struct ID *id); -int BKE_copybuffer_save(char *filename, struct ReportList *reports); - int BKE_copybuffer_paste(struct bContext *C, char *libname, struct ReportList *reports); +int BKE_copybuffer_save(const char *filename, struct ReportList *reports); + int BKE_copybuffer_paste(struct bContext *C, const char *libname, struct ReportList *reports); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 6ce7b952b97..d7ef04195d5 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -182,7 +182,7 @@ void evaluate_value_fmodifiers(ListBase *modifiers, struct FCurve *fcu, float *c void fcurve_bake_modifiers(struct FCurve *fcu, int start, int end); -int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array, float frame, int arraylen, short *exists); +int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array, float frame, int arraylen, bool *r_exists); /* ************** F-Curves API ******************** */ @@ -200,7 +200,7 @@ struct FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int struct FCurve *iter_step_fcurve(struct FCurve *fcu_iter, const char rna_path[]); /* high level function to get an fcurve from C without having the rna */ -struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, char *driven); +struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, bool *r_driven); /* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated * e.g. numMatches = list_find_data_fcurves(matches, &act->curves, "pose.bones[", "MyFancyBone"); @@ -208,12 +208,12 @@ struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, c int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName); /* find an f-curve based on an rna property */ -struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, struct PropertyRNA *prop, int rnaindex, struct bAction **action, int *driven); +struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, struct PropertyRNA *prop, int rnaindex, struct bAction **action, bool *r_driven); /* Binary search algorithm for finding where to 'insert' BezTriple with given frame number. * Returns the index to insert at (data already at that index will be offset if replace is 0) */ -int binarysearch_bezt_index(struct BezTriple array[], float frame, int arraylen, short *replace); +int binarysearch_bezt_index(struct BezTriple array[], float frame, int arraylen, bool *r_replace); /* get the time extents for F-Curve */ void calc_fcurve_range(struct FCurve *fcu, float *min, float *max, diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 82b3b4f5618..fa6aafabe05 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -461,7 +461,7 @@ int BKE_read_file(bContext *C, const char *filepath, ReportList *reports) return (bfd ? retval : BKE_READ_FILE_FAIL); } -int BKE_read_file_from_memory(bContext *C, char *filebuf, int filelength, ReportList *reports) +int BKE_read_file_from_memory(bContext *C, const void *filebuf, int filelength, ReportList *reports) { BlendFileData *bfd; @@ -906,7 +906,7 @@ static void copybuffer_doit(void *UNUSED(handle), Main *UNUSED(bmain), void *vid } /* frees main in end */ -int BKE_copybuffer_save(char *filename, ReportList *reports) +int BKE_copybuffer_save(const char *filename, ReportList *reports) { Main *mainb = MEM_callocN(sizeof(Main), "copybuffer"); ListBase *lbarray[MAX_LIBARRAY], *fromarray[MAX_LIBARRAY]; @@ -959,7 +959,7 @@ int BKE_copybuffer_save(char *filename, ReportList *reports) } /* return success (1) */ -int BKE_copybuffer_paste(bContext *C, char *libname, ReportList *reports) +int BKE_copybuffer_paste(bContext *C, const char *libname, ReportList *reports) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index bc396d218df..594b887d361 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -169,7 +169,7 @@ void copy_fcurves(ListBase *dst, ListBase *src) /* ----------------- Finding F-Curves -------------------------- */ /* high level function to get an fcurve from C without having the rna */ -FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, char *driven) +FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, bool *r_driven) { /* anim vars */ AnimData *adt = BKE_animdata_from_id(id); @@ -180,8 +180,8 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro PropertyRNA *prop; char *path; - if (driven) - *driven = FALSE; + if (r_driven) + *r_driven = false; /* only use the current action ??? */ if (ELEM(NULL, adt, adt->action)) @@ -201,8 +201,8 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro /* if not animated, check if driven */ if ((fcu == NULL) && (adt->drivers.first)) { fcu = list_find_fcurve(&adt->drivers, path, index); - if (fcu && driven) - *driven = TRUE; + if (fcu && r_driven) + *r_driven = true; fcu = NULL; } @@ -305,11 +305,11 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, return matches; } -FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, int *driven) +FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, bool *r_driven) { FCurve *fcu = NULL; - *driven = 0; + *r_driven = false; /* there must be some RNA-pointer + property combon */ if (prop && ptr->id.data && RNA_property_animateable(ptr, prop)) { @@ -331,7 +331,7 @@ FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction fcu = list_find_fcurve(&adt->drivers, path, rnaindex); if (fcu) - *driven = 1; + *r_driven = true; } if (fcu && action) @@ -354,13 +354,13 @@ FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction /* Binary search algorithm for finding where to insert BezTriple. (for use by insert_bezt_fcurve) * Returns the index to insert at (data already at that index will be offset if replace is 0) */ -int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short *replace) +int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, bool *r_replace) { int start = 0, end = arraylen; int loopbreaker = 0, maxloop = arraylen * 2; /* initialize replace-flag first */ - *replace = 0; + *r_replace = false; /* sneaky optimizations (don't go through searching process if...): * - keyframe to be added is to be added out of current bounds @@ -377,7 +377,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short /* 'First' Keyframe (when only one keyframe, this case is used) */ framenum = array[0].vec[1][0]; if (IS_EQT(frame, framenum, BEZT_BINARYSEARCH_THRESH)) { - *replace = 1; + *r_replace = true; return 0; } else if (frame < framenum) @@ -386,7 +386,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short /* 'Last' Keyframe */ framenum = array[(arraylen - 1)].vec[1][0]; if (IS_EQT(frame, framenum, BEZT_BINARYSEARCH_THRESH)) { - *replace = 1; + *r_replace = true; return (arraylen - 1); } else if (frame > framenum) @@ -404,7 +404,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short /* check if exactly equal to midpoint */ if (IS_EQT(frame, midfra, BEZT_BINARYSEARCH_THRESH)) { - *replace = 1; + *r_replace = true; return mid; } diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index c3fc659137d..19912a19d94 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -487,13 +487,13 @@ static FModifierTypeInfo FMI_ENVELOPE = { */ #define BINARYSEARCH_FRAMEEQ_THRESH 0.0001f -int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int arraylen, short *exists) +int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int arraylen, bool *r_exists) { int start = 0, end = arraylen; int loopbreaker = 0, maxloop = arraylen * 2; /* initialize exists-flag first */ - *exists = 0; + *r_exists = false; /* sneaky optimizations (don't go through searching process if...): * - keyframe to be added is to be added out of current bounds @@ -510,7 +510,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array /* 'First' Point (when only one point, this case is used) */ framenum = array[0].time; if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) { - *exists = 1; + *r_exists = true; return 0; } else if (frame < framenum) { @@ -520,7 +520,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array /* 'Last' Point */ framenum = array[(arraylen - 1)].time; if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) { - *exists = 1; + *r_exists = true; return (arraylen - 1); } else if (frame > framenum) { @@ -539,7 +539,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array /* check if exactly equal to midpoint */ if (IS_EQT(frame, midfra, BINARYSEARCH_FRAMEEQ_THRESH)) { - *exists = 1; + *r_exists = true; return mid; } diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 2ee5decdfac..00ff5863e59 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -96,7 +96,7 @@ BlendFileData *BLO_read_from_file(const char *filepath, struct ReportList *repor * indicating the cause of the failure. * \return The data of the file. */ -BlendFileData *BLO_read_from_memory(void *mem, int memsize, struct ReportList *reports); +BlendFileData *BLO_read_from_memory(const void *mem, int memsize, struct ReportList *reports); /** * oldmain is old main, from which we will keep libraries, images, .. @@ -122,7 +122,7 @@ BLO_blendfiledata_free(BlendFileData *bfd); * \return A handle on success, or NULL on failure. */ BlendHandle * -BLO_blendhandle_from_file(char *file, +BLO_blendhandle_from_file(const char *filepath, struct ReportList *reports); /** @@ -134,7 +134,7 @@ BLO_blendhandle_from_file(char *file, */ BlendHandle * -BLO_blendhandle_from_memory(void *mem, +BLO_blendhandle_from_memory(const void *mem, int memsize); /** diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 5111baa06c1..9678dffe5af 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -74,16 +74,16 @@ void BLO_blendhandle_print_sizes(BlendHandle *, void *); /* Access routines used by filesel. */ -BlendHandle *BLO_blendhandle_from_file(char *file, ReportList *reports) +BlendHandle *BLO_blendhandle_from_file(const char *filepath, ReportList *reports) { BlendHandle *bh; - bh = (BlendHandle *)blo_openblenderfile(file, reports); + bh = (BlendHandle *)blo_openblenderfile(filepath, reports); return bh; } -BlendHandle *BLO_blendhandle_from_memory(void *mem, int memsize) +BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize) { BlendHandle *bh; @@ -271,7 +271,7 @@ BlendFileData *BLO_read_from_file(const char *filepath, ReportList *reports) return bfd; } -BlendFileData *BLO_read_from_memory(void *mem, int memsize, ReportList *reports) +BlendFileData *BLO_read_from_memory(const void *mem, int memsize, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 5fe7d692b8f..be2b45a3e12 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1041,7 +1041,7 @@ static int fd_read_gzip_from_memory_init(FileData *fd) return 1; } -FileData *blo_openblendermemory(void *mem, int memsize, ReportList *reports) +FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *reports) { if (!mem || memsizebuffer = mem; fd->buffersize = memsize; @@ -1106,7 +1106,7 @@ void blo_freefiledata(FileData *fd) } if (fd->buffer && !(fd->flags & FD_FLAGS_NOT_MY_BUFFER)) { - MEM_freeN(fd->buffer); + MEM_freeN((void *)fd->buffer); fd->buffer = NULL; } diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index a0895c92b24..46b95434e53 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -54,7 +54,7 @@ typedef struct FileData { int (*read)(struct FileData *filedata, void *buffer, unsigned int size); // variables needed for reading from memory / stream - char *buffer; + const char *buffer; // variables needed for reading from memfile (undo) struct MemFile *memfile; @@ -123,7 +123,7 @@ void blo_split_main(ListBase *mainlist, struct Main *main); BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath); FileData *blo_openblenderfile(const char *filepath, struct ReportList *reports); -FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports); +FileData *blo_openblendermemory(const void *buffer, int buffersize, struct ReportList *reports); FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports); void blo_clear_proxy_pointers_from_lib(Main *oldmain); diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index dc0fba0930f..dcdab8dba37 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -343,7 +343,7 @@ static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(ar /* check that no data exists for the current frame... */ if (env->data) { - short exists = -1; + bool exists; int i = BKE_fcm_envelope_find_index(env->data, (float)(scene->r.cfra), env->totvert, &exists); /* binarysearch_...() will set exists by default to 0, so if it is non-zero, that means that the point exists already */ diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index ed8398b7c8b..bc20311f773 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -237,7 +237,7 @@ int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag) /* are there already keyframes? */ if (fcu->bezt) { - short replace = -1; + bool replace; i = binarysearch_bezt_index(fcu->bezt, bezt->vec[1][0], fcu->totvert, &replace); /* replace an existing keyframe? */ @@ -1055,7 +1055,7 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou /* will only loop once unless the array index was -1 */ for (; array_index < array_index_max; array_index++) { FCurve *fcu = verify_fcurve(act, group, &ptr, rna_path, array_index, 0); - short found = -1; + bool found; int i; /* check if F-Curve exists and/or whether it can be edited */ @@ -1845,7 +1845,7 @@ short fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter) /* we either include all regardless of muting, or only non-muted */ if ((filter & ANIMFILTER_KEYS_MUTED) || (fcu->flag & FCURVE_MUTED) == 0) { - short replace = -1; + bool replace; int i = binarysearch_bezt_index(fcu->bezt, frame, fcu->totvert, &replace); /* binarysearch_bezt_index will set replace to be 0 or 1 diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index 4d6f8f520f5..d19d8084608 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -1081,7 +1081,7 @@ static void pose_propagate_fcurve(wmOperator *op, Object *ob, FCurve *fcu, BezTriple *bezt; float refVal = 0.0f; - short keyExists; + bool keyExists; int i, match; short first = 1; diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index e4c163e9162..3feb563d3ee 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -55,19 +55,19 @@ #include "interface_intern.h" -static FCurve *ui_but_get_fcurve(uiBut *but, bAction **action, int *driven) +static FCurve *ui_but_get_fcurve(uiBut *but, bAction **action, bool *r_driven) { /* for entire array buttons we check the first component, it's not perfect * but works well enough in typical cases */ int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex; - return rna_get_fcurve(&but->rnapoin, but->rnaprop, rnaindex, action, driven); + return rna_get_fcurve(&but->rnapoin, but->rnaprop, rnaindex, action, r_driven); } void ui_but_anim_flag(uiBut *but, float cfra) { FCurve *fcu; - int driven; + bool driven; but->flag &= ~(UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN); @@ -90,7 +90,7 @@ int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen) { FCurve *fcu; ChannelDriver *driver; - int driven; + bool driven; fcu = ui_but_get_fcurve(but, NULL, &driven); @@ -110,7 +110,7 @@ int ui_but_anim_expression_set(uiBut *but, const char *str) { FCurve *fcu; ChannelDriver *driver; - int driven; + bool driven; fcu = ui_but_get_fcurve(but, NULL, &driven); @@ -194,7 +194,7 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) ID *id; bAction *action; FCurve *fcu; - int driven; + bool driven; fcu = ui_but_get_fcurve(but, &action, &driven); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 7802e5460ff..dd5b97a68ed 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -192,7 +192,7 @@ static Main *G_pr_main = NULL; static Main *G_pr_main_cycles = NULL; #ifndef WITH_HEADLESS -static Main *load_main_from_memory(char *blend, int blend_size) +static Main *load_main_from_memory(const void *blend, int blend_size) { const int fileflags = G.fileflags; Main *bmain = NULL; diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index d25fd00514c..3aee9a5e31e 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -221,7 +221,7 @@ static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op) Sequence *seq; Scene *scene = CTX_data_scene(C); struct FCurve *fcu; - char driven; + bool driven; SEQ_BEGIN(scene->ed, seq) { diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index f6f8b14d0e2..2ad8ded4656 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -646,7 +646,7 @@ static FCM_EnvelopeData *rna_FModifierEnvelope_points_add(FModifier *fmod, Repor fed.f1 = fed.f2 = 0; if (env->data) { - short exists = -1; + bool exists; i = BKE_fcm_envelope_find_index(env->data, frame, env->totvert, &exists); if (exists) { BKE_reportf(reports, RPT_ERROR, "Already a control point at frame %.6f", frame); diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index a6592b47e87..999bcb9bba5 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -393,7 +393,8 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node) lb = RNA_struct_type_properties(ptr.type); for (link = lb->first; link; link = link->next) { - int driven, len = 1, index; + int len = 1, index; + bool driven; prop = (PropertyRNA *)link; if (RNA_property_array_check(prop)) @@ -409,7 +410,8 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node) /* now check node sockets */ for (sock = node->inputs.first; sock; sock = sock->next) { - int driven, len = 1, index; + int len = 1, index; + bool driven; RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr); prop = RNA_struct_find_property(&ptr, "default_value"); diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index cd5dec4669d..86e8c9c6e76 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -1050,12 +1050,12 @@ KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFileMemory(void *data, int return LinkBlendFile(bpy_openlib, path, group, scene_merge, err_str, options); } -KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFilePath(const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options) +KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFilePath(const char *filepath, char *group, KX_Scene *scene_merge, char **err_str, short options) { - BlendHandle *bpy_openlib = BLO_blendhandle_from_file((char *)path, NULL); + BlendHandle *bpy_openlib = BLO_blendhandle_from_file(filepath, NULL); // Error checking is done in LinkBlendFile - return LinkBlendFile(bpy_openlib, path, group, scene_merge, err_str, options); + return LinkBlendFile(bpy_openlib, filepath, group, scene_merge, err_str, options); } static void load_datablocks(Main *main_newlib, BlendHandle *bpy_openlib, const char *path, int idcode) diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.cpp b/source/gameengine/GamePlayer/common/GPC_Engine.cpp index 11d648762c8..1a90fb8aca8 100644 --- a/source/gameengine/GamePlayer/common/GPC_Engine.cpp +++ b/source/gameengine/GamePlayer/common/GPC_Engine.cpp @@ -155,14 +155,14 @@ bool GPC_Engine::Start(const char *filename) } -bool GPC_Engine::Start(unsigned char *blenderDataBuffer, - unsigned int blenderDataBufferSize) +bool GPC_Engine::Start(const void *blenderDataBuffer, + unsigned int blenderDataBufferSize) { ReportList reports; BlendFileData *bfd; BKE_reports_init(&reports, RPT_STORE); - bfd= BLO_read_from_memory(blenderDataBuffer, blenderDataBufferSize, &reports); + bfd = BLO_read_from_memory(blenderDataBuffer, blenderDataBufferSize, &reports); BKE_reports_clear(&reports); if (!bfd) { diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.h b/source/gameengine/GamePlayer/common/GPC_Engine.h index 6247bd630bb..3a4fd9c81d6 100644 --- a/source/gameengine/GamePlayer/common/GPC_Engine.h +++ b/source/gameengine/GamePlayer/common/GPC_Engine.h @@ -103,7 +103,7 @@ public: // different prototypes for Unix and Windows void StartLoadingAnimation(); bool Start(const char *filename); // file-on-disk starter - bool Start(unsigned char *blenderDataBuffer, + bool Start(const void *blenderDataBuffer, unsigned int blenderDataBufferSize); // file-in-memory starter void Stop(); -- cgit v1.2.3 From 3dababa7ecab02d0c2be03f2230e479cba7686ad Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Mar 2013 19:55:10 +0000 Subject: code cleanup: name mesh functions more consistently, also use bools for mesh args. --- source/blender/blenkernel/BKE_mesh.h | 28 +++++++------- source/blender/blenkernel/intern/DerivedMesh.c | 2 +- source/blender/blenkernel/intern/cdderivedmesh.c | 2 +- source/blender/blenkernel/intern/mesh.c | 43 +++++++++++----------- source/blender/blenkernel/intern/mesh_validate.c | 34 ++++++++--------- source/blender/blenkernel/intern/subsurf_ccg.c | 4 +- .../blender/blenloader/intern/versioning_legacy.c | 2 +- source/blender/blenloader/intern/writefile.c | 4 +- source/blender/bmesh/intern/bmesh_mesh_conv.c | 4 +- source/blender/collada/MeshImporter.cpp | 6 +-- source/blender/editors/include/ED_view3d.h | 4 +- source/blender/editors/mesh/mesh_data.c | 16 ++++---- source/blender/editors/mesh/meshtools.c | 2 +- source/blender/editors/object/object_modifier.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 2 +- source/blender/editors/space_view3d/space_view3d.c | 18 ++++----- source/blender/editors/space_view3d/view3d_draw.c | 4 +- .../editors/transform/transform_conversions.c | 8 ++-- source/blender/makesrna/intern/rna_mesh.c | 2 +- source/blender/makesrna/intern/rna_mesh_utils.h | 4 +- source/blender/makesrna/intern/rna_object.c | 2 +- source/blender/modifiers/intern/MOD_skin.c | 2 +- 23 files changed, 99 insertions(+), 98 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 398d1fe8545..eb29c49ab84 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -81,7 +81,7 @@ struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob); int BKE_mesh_recalc_tessellation(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata, struct MVert *mvert, int totface, int totloop, int totpoly, - const int do_face_normals); + const bool do_face_normals); /* for forwards compat only quad->tri polys to mface, skip ngons. */ @@ -150,7 +150,7 @@ void BKE_mesh_free(struct Mesh *me, int unlink); struct Mesh *BKE_mesh_add(struct Main *bmain, const char *name); struct Mesh *BKE_mesh_copy_ex(struct Main *bmain, struct Mesh *me); struct Mesh *BKE_mesh_copy(struct Mesh *me); -void mesh_update_customdata_pointers(struct Mesh *me, const short do_ensure_tess_cd); +void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd); void BKE_mesh_make_local(struct Mesh *me); void BKE_mesh_boundbox_calc(struct Mesh *me, float r_loc[3], float r_size[3]); @@ -159,7 +159,7 @@ float (*BKE_mesh_orco_verts_get(struct Object *ob))[3]; void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert); int test_index_face(struct MFace *mface, struct CustomData *mfdata, int mfindex, int nr); struct Mesh *BKE_mesh_from_object(struct Object *ob); -void set_mesh(struct Object *ob, struct Mesh *me); +void BKE_mesh_assign_object(struct Object *ob, struct Mesh *me); void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me); int BKE_mesh_nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *totvert, struct MEdge **alledge, int *totedge, struct MLoop **allloop, struct MPoly **allpoly, @@ -167,7 +167,7 @@ int BKE_mesh_nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *tot int BKE_mesh_nurbs_displist_to_mdata(struct Object *ob, struct ListBase *dispbase, struct MVert **allvert, int *_totvert, struct MEdge **alledge, int *_totedge, struct MLoop **allloop, struct MPoly **allpoly, struct MLoopUV **alluv, int *_totloop, int *_totpoly); -void BKE_mesh_from_nurbs_displist(struct Object *ob, struct ListBase *dispbase, int use_orco_uv); +void BKE_mesh_from_nurbs_displist(struct Object *ob, struct ListBase *dispbase, const bool use_orco_uv); void BKE_mesh_from_nurbs(struct Object *ob); void BKE_mesh_to_curve_nurblist(struct DerivedMesh *dm, struct ListBase *nurblist, const int edge_users_test); void BKE_mesh_to_curve(struct Scene *scene, struct Object *ob); @@ -221,7 +221,7 @@ void BKE_mesh_calc_normals( /* Return a newly MEM_malloc'd array of all the mesh vertex locations * (_numVerts_r_ may be NULL) */ -float (*mesh_getVertexCos(struct Mesh *me, int *numVerts_r))[3]; +float (*mesh_getVertexCos(struct Mesh *me, int *r_numVerts))[3]; /* map from uv vertex to face (for select linked, stitch, uv suburf) */ @@ -280,7 +280,7 @@ typedef struct UvElementMap { * to make that many islands, he can bite me :p */ #define INVALID_ISLAND 0xFFFF -UvVertMap *BKE_mesh_uv_vert_map_make(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, +UvVertMap *BKE_mesh_uv_vert_map_create(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, unsigned int totpoly, unsigned int totvert, int selected, float *limit); UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v); void BKE_mesh_uv_vert_map_free(UvVertMap *vmap); @@ -296,12 +296,12 @@ typedef struct IndexNode { int index; } IndexNode; -void create_vert_poly_map(MeshElemMap **map, int **mem, - const struct MPoly *mface, const struct MLoop *mloop, - int totvert, int totface, int totloop); +void BKE_mesh_vert_poly_map_create(MeshElemMap **map, int **mem, + const struct MPoly *mface, const struct MLoop *mloop, + int totvert, int totface, int totloop); -void create_vert_edge_map(MeshElemMap **map, int **mem, - const struct MEdge *medge, int totvert, int totedge); +void BKE_mesh_vert_edge_map_create(MeshElemMap **map, int **mem, + const struct MEdge *medge, int totvert, int totedge); /* vertex level transformations & checks (no derived mesh) */ @@ -309,7 +309,7 @@ int BKE_mesh_minmax(struct Mesh *me, float r_min[3], float r_max[3]); int BKE_mesh_center_median(struct Mesh *me, float cent[3]); int BKE_mesh_center_bounds(struct Mesh *me, float cent[3]); int BKE_mesh_center_centroid(struct Mesh *me, float cent[3]); -void BKE_mesh_translate(struct Mesh *me, float offset[3], int do_keys); +void BKE_mesh_translate(struct Mesh *me, const float offset[3], const bool do_keys); /* mesh_validate.c */ /* XXX Loop v/e are unsigned, so using max uint_32 value as invalid marker... */ @@ -322,8 +322,8 @@ int BKE_mesh_validate_arrays( struct MLoop *mloops, unsigned int totloop, struct MPoly *mpolys, unsigned int totpoly, struct MDeformVert *dverts, /* assume totvert length */ - const short do_verbose, const short do_fixes); -int BKE_mesh_validate(struct Mesh *me, int do_verbose); + const bool do_verbose, const bool do_fixes); +int BKE_mesh_validate(struct Mesh *me, const int do_verbose); int BKE_mesh_validate_dm(struct DerivedMesh *dm); void BKE_mesh_calc_edges(struct Mesh *mesh, bool update, const bool select); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index f09de138428..b2a5a3a5593 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -542,7 +542,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob) } /* yes, must be before _and_ after tessellate */ - mesh_update_customdata_pointers(&tmp, false); + BKE_mesh_update_customdata_pointers(&tmp, false); /* since 2.65 caller must do! */ // BKE_mesh_tessface_calc(&tmp); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 7f2d9437c3d..0469e6ea787 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -215,7 +215,7 @@ static const MeshElemMap *cdDM_getPolyMap(Object *ob, DerivedMesh *dm) if (!cddm->pmap && ob->type == OB_MESH) { Mesh *me = ob->data; - create_vert_poly_map(&cddm->pmap, &cddm->pmap_mem, + BKE_mesh_vert_poly_map_create(&cddm->pmap, &cddm->pmap_mem, me->mpoly, me->mloop, me->totvert, me->totpoly, me->totloop); } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index b4833cdb53b..de176651c19 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -348,7 +348,7 @@ static void mesh_ensure_tessellation_customdata(Mesh *me) * note that for undo mesh data we want to skip 'ensure_tess_cd' call since * we don't want to store memory for tessface when its only used for older * versions of the mesh. - campbell*/ -static void mesh_update_linked_customdata(Mesh *me, const short do_ensure_tess_cd) +static void mesh_update_linked_customdata(Mesh *me, const bool do_ensure_tess_cd) { if (me->edit_btmesh) BMEdit_UpdateLinkedCustomData(me->edit_btmesh); @@ -360,7 +360,7 @@ static void mesh_update_linked_customdata(Mesh *me, const short do_ensure_tess_c CustomData_bmesh_update_active_layers(&me->fdata, &me->pdata, &me->ldata); } -void mesh_update_customdata_pointers(Mesh *me, const short do_ensure_tess_cd) +void BKE_mesh_update_customdata_pointers(Mesh *me, const bool do_ensure_tess_cd) { mesh_update_linked_customdata(me, do_ensure_tess_cd); @@ -493,7 +493,7 @@ Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me) mesh_tessface_clear_intern(men, FALSE); } - mesh_update_customdata_pointers(men, do_tessface); + BKE_mesh_update_customdata_pointers(men, do_tessface); /* ensure indirect linked data becomes lib-extern */ for (i = 0; i < me->fdata.totlayer; i++) { @@ -622,7 +622,7 @@ void BKE_mesh_make_local(Mesh *me) for (ob = bmain->object.first; ob; ob = ob->id.next) { if (me == ob->data) { if (ob->id.lib == NULL) { - set_mesh(ob, me_new); + BKE_mesh_assign_object(ob, me_new); } } } @@ -825,7 +825,7 @@ Mesh *BKE_mesh_from_object(Object *ob) else return NULL; } -void set_mesh(Object *ob, Mesh *me) +void BKE_mesh_assign_object(Object *ob, Mesh *me) { Mesh *old = NULL; @@ -1194,7 +1194,7 @@ void BKE_mesh_from_metaball(ListBase *lb, Mesh *me) index += 4; } - mesh_update_customdata_pointers(me, TRUE); + BKE_mesh_update_customdata_pointers(me, true); BKE_mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL); @@ -1477,7 +1477,7 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase, /* this may fail replacing ob->data, be sure to check ob->type */ -void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, int use_orco_uv) +void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use_orco_uv) { Main *bmain = G.main; Object *ob1; @@ -2063,7 +2063,7 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh) mesh->medge, mesh->mface, &mesh->totloop, &mesh->totpoly, &mesh->mloop, &mesh->mpoly); - mesh_update_customdata_pointers(mesh, TRUE); + BKE_mesh_update_customdata_pointers(mesh, true); } /* the same as BKE_mesh_convert_mfaces_to_mpolys but oriented to be used in do_versions from readfile.c @@ -2085,7 +2085,7 @@ void BKE_mesh_do_versions_convert_mfaces_to_mpolys(Mesh *mesh) CustomData_bmesh_do_versions_update_active_layers(&mesh->fdata, &mesh->pdata, &mesh->ldata); - mesh_update_customdata_pointers(mesh, TRUE); + BKE_mesh_update_customdata_pointers(mesh, true); } void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata, @@ -2190,12 +2190,12 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData *mloop_r = mloop; } -float (*mesh_getVertexCos(Mesh * me, int *numVerts_r))[3] +float (*mesh_getVertexCos(Mesh * me, int *r_numVerts))[3] { int i, numVerts = me->totvert; float (*cos)[3] = MEM_mallocN(sizeof(*cos) * numVerts, "vertexcos1"); - if (numVerts_r) *numVerts_r = numVerts; + if (r_numVerts) *r_numVerts = numVerts; for (i = 0; i < numVerts; i++) copy_v3_v3(cos[i], me->mvert[i].co); @@ -2207,7 +2207,8 @@ float (*mesh_getVertexCos(Mesh * me, int *numVerts_r))[3] /* this replaces the non bmesh function (in trunk) which takes MTFace's, if we ever need it back we could * but for now this replaces it because its unused. */ -UvVertMap *BKE_mesh_uv_vert_map_make(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, unsigned int totpoly, unsigned int totvert, int selected, float *limit) +UvVertMap *BKE_mesh_uv_vert_map_create(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, + unsigned int totpoly, unsigned int totvert, int selected, float *limit) { UvVertMap *vmap; UvMapVert *buf; @@ -2315,9 +2316,9 @@ void BKE_mesh_uv_vert_map_free(UvVertMap *vmap) /* Generates a map where the key is the vertex and the value is a list * of polys that use that vertex as a corner. The lists are allocated * from one memory pool. */ -void create_vert_poly_map(MeshElemMap **map, int **mem, - const MPoly *mpoly, const MLoop *mloop, - int totvert, int totpoly, int totloop) +void BKE_mesh_vert_poly_map_create(MeshElemMap **map, int **mem, + const MPoly *mpoly, const MLoop *mloop, + int totvert, int totpoly, int totloop) { int i, j; int *indices; @@ -2359,8 +2360,8 @@ void create_vert_poly_map(MeshElemMap **map, int **mem, /* Generates a map where the key is the vertex and the value is a list * of edges that use that vertex as an endpoint. The lists are allocated * from one memory pool. */ -void create_vert_edge_map(MeshElemMap **map, int **mem, - const MEdge *medge, int totvert, int totedge) +void BKE_mesh_vert_edge_map_create(MeshElemMap **map, int **mem, + const MEdge *medge, int totvert, int totedge) { int i, *indices; @@ -2465,7 +2466,7 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata, int totpoly, /* when tessellating to recalculate normals after * we can skip copying here */ - const int do_face_nor_cpy) + const bool do_face_nor_cpy) { /* use this to avoid locking pthread for _every_ polygon * and calling the fill function */ @@ -3335,7 +3336,7 @@ int BKE_mesh_center_centroid(Mesh *me, float cent[3]) return (me->totpoly != 0); } -void BKE_mesh_translate(Mesh *me, float offset[3], int do_keys) +void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys) { int i = me->totvert; MVert *mvert; @@ -3374,9 +3375,9 @@ void BKE_mesh_tessface_calc(Mesh *mesh) mesh->mvert, mesh->totface, mesh->totloop, mesh->totpoly, /* calc normals right after, don't copy from polys here */ - FALSE); + false); - mesh_update_customdata_pointers(mesh, TRUE); + BKE_mesh_update_customdata_pointers(mesh, true); } void BKE_mesh_tessface_ensure(Mesh *mesh) diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 9d16d38220a..90704cb8b7e 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -190,13 +190,13 @@ int BKE_mesh_validate_arrays(Mesh *mesh, MLoop *mloops, unsigned int totloop, MPoly *mpolys, unsigned int totpoly, MDeformVert *dverts, /* assume totvert length */ - const short do_verbose, const short do_fixes) + const bool do_verbose, const bool do_fixes) { -# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; } (void)0 +# define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = true; } (void)0 # define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1) -# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; } (void)0 -# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; } (void)0 +# define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = true; } (void)0 +# define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = true; } (void)0 MVert *mv = mverts; MEdge *me; @@ -205,15 +205,15 @@ int BKE_mesh_validate_arrays(Mesh *mesh, unsigned int i, j; int *v; - short do_edge_free = FALSE; - short do_face_free = FALSE; - short do_polyloop_free = FALSE; /* This regroups loops and polys! */ + bool do_edge_free = false; + bool do_face_free = false; + bool do_polyloop_free = false; /* This regroups loops and polys! */ - short verts_fixed = FALSE; - short vert_weights_fixed = FALSE; - int msel_fixed = FALSE; + bool verts_fixed = false; + bool vert_weights_fixed = false; + bool msel_fixed = false; - int do_edge_recalc = FALSE; + bool do_edge_recalc = false; EdgeHash *edge_hash = BLI_edgehash_new(); @@ -825,7 +825,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, return (verts_fixed || vert_weights_fixed || do_polyloop_free || do_edge_free || do_edge_recalc || msel_fixed); } -static int mesh_validate_customdata(CustomData *data, short do_verbose, const short do_fixes) +static int mesh_validate_customdata(CustomData *data, const bool do_verbose, const bool do_fixes) { int i = 0, has_fixes = 0; @@ -859,7 +859,7 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, CustomData *ldata, CustomData *pdata, - short do_verbose, const short do_fixes) + const bool do_verbose, const short do_fixes) { int vfixed = 0, efixed = 0, lfixed = 0, pfixed = 0; @@ -871,7 +871,7 @@ static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata return vfixed || efixed || lfixed || pfixed; } -int BKE_mesh_validate(Mesh *me, int do_verbose) +int BKE_mesh_validate(Mesh *me, const int do_verbose) { int layers_fixed = 0, arrays_fixed = 0; @@ -887,13 +887,13 @@ int BKE_mesh_validate(Mesh *me, int do_verbose) me->mloop, me->totloop, me->mpoly, me->totpoly, me->dvert, - do_verbose, TRUE); + do_verbose, true); if (layers_fixed || arrays_fixed) { DAG_id_tag_update(&me->id, OB_RECALC_DATA); - return TRUE; + return true; } - return FALSE; + return false; } int BKE_mesh_validate_dm(DerivedMesh *dm) diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index d38a2e56819..ba4a7b20f55 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -295,7 +295,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, float uv[3] = {0.0f, 0.0f, 0.0f}; /* only first 2 values are written into */ limit[0] = limit[1] = STD_UV_CONNECT_LIMIT; - vmap = BKE_mesh_uv_vert_map_make(mpoly, mloop, mloopuv, totface, totvert, 0, limit); + vmap = BKE_mesh_uv_vert_map_create(mpoly, mloop, mloopuv, totface, totvert, 0, limit); if (!vmap) return 0; @@ -2985,7 +2985,7 @@ static const MeshElemMap *ccgDM_getPolyMap(Object *ob, DerivedMesh *dm) if (!ccgdm->multires.mmd && !ccgdm->pmap && ob->type == OB_MESH) { Mesh *me = ob->data; - create_vert_poly_map(&ccgdm->pmap, &ccgdm->pmap_mem, + BKE_mesh_vert_poly_map_create(&ccgdm->pmap, &ccgdm->pmap_mem, me->mpoly, me->mloop, me->totvert, me->totpoly, me->totloop); } diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 0fba8c4b2ab..31410631ce0 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -453,7 +453,7 @@ static void customdata_version_242(Mesh *me) } } - mesh_update_customdata_pointers(me, TRUE); + BKE_mesh_update_customdata_pointers(me, true); } /*only copy render texface layer from active*/ diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 7772bc23097..4f7ec77a8e6 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1869,7 +1869,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase) mesh->totface = BKE_mesh_mpoly_to_mface(&mesh->fdata, &backup_mesh.ldata, &backup_mesh.pdata, mesh->totface, backup_mesh.totloop, backup_mesh.totpoly); - mesh_update_customdata_pointers(mesh, FALSE); + BKE_mesh_update_customdata_pointers(mesh, false); writestruct(wd, ID_ME, "Mesh", 1, mesh); @@ -1906,7 +1906,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase) mesh->totpoly = backup_mesh.totpoly; mesh->totloop = backup_mesh.totloop; /* -- */ - mesh_update_customdata_pointers(mesh, FALSE); + BKE_mesh_update_customdata_pointers(mesh, false); /* --*/ mesh->edit_btmesh = backup_mesh.edit_btmesh; /* keep this after updating custom pointers */ /* restore */ diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 24a06ea3d6f..093234457df 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -628,7 +628,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface) me->cd_flag = BM_mesh_cd_flag_from_bmesh(bm); /* this is called again, 'dotess' arg is used there */ - mesh_update_customdata_pointers(me, 0); + BKE_mesh_update_customdata_pointers(me, 0); i = 0; BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { @@ -768,7 +768,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface) BKE_mesh_tessface_calc(me); } - mesh_update_customdata_pointers(me, do_tessface); + BKE_mesh_update_customdata_pointers(me, do_tessface); { BMEditSelection *selected; diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 71d3ada03dd..b8c70871ea1 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -465,7 +465,7 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len) CustomData_free(&mesh->edata, mesh->totedge); mesh->edata = edata; - mesh_update_customdata_pointers(mesh, FALSE); /* new edges don't change tessellation */ + BKE_mesh_update_customdata_pointers(mesh, false); /* new edges don't change tessellation */ /* set default flags */ medge = &mesh->medge[mesh->totedge]; @@ -1029,7 +1029,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta Mesh *old_mesh = (Mesh *)ob->data; Mesh *new_mesh = uid_mesh_map[*geom_uid]; - set_mesh(ob, new_mesh); + BKE_mesh_assign_object(ob, new_mesh); if (old_mesh->id.us == 0) BKE_libblock_free(&G.main->mesh, old_mesh); @@ -1075,7 +1075,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom) const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId(); Mesh *me = BKE_mesh_add(G.main, (char *)str_geom_id.c_str()); - me->id.us--; // is already 1 here, but will be set later in set_mesh + me->id.us--; // is already 1 here, but will be set later in BKE_mesh_assign_object // store the Mesh pointer to link it later with an Object // mesh_geom_map needed to map mesh to its geometry name (for shape key naming) diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 470bbe616cf..f47374c3169 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -216,7 +216,7 @@ bool ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int struct rctf *r_viewplane, float *r_clipsta, float *r_clipend); void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, - struct rctf *viewborder_r, const bool no_shift); + struct rctf *r_viewborder, const bool no_shift); void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, float r_size[2]); @@ -268,7 +268,7 @@ int edge_inside_circle(const float cent[2], float radius, const float screen_co_ /* get 3d region from context, also if mouse is in header or toolbar */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); -int ED_view3d_context_user_region(struct bContext *C, struct View3D **v3d_r, struct ARegion **ar_r); +int ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_ar); int ED_operator_rv3d_user_region_poll(struct bContext *C); void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 99f526f95f3..68e93fa22f7 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -159,7 +159,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la } else { CustomData_free_layer_active(data, type, tot); - mesh_update_customdata_pointers(me, TRUE); + BKE_mesh_update_customdata_pointers(me, true); } if (!CustomData_has_layer(data, type) && (type == CD_MLOOPCOL && (ob->mode & OB_MODE_VERTEX_PAINT))) @@ -406,7 +406,7 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum_dst); } - mesh_update_customdata_pointers(me, TRUE); + BKE_mesh_update_customdata_pointers(me, true); } /* don't overwrite our copied coords */ @@ -489,7 +489,7 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum); } - mesh_update_customdata_pointers(me, TRUE); + BKE_mesh_update_customdata_pointers(me, true); } DAG_id_tag_update(&me->id, 0); @@ -942,7 +942,7 @@ static void mesh_add_verts(Mesh *mesh, int len) CustomData_free(&mesh->vdata, mesh->totvert); mesh->vdata = vdata; - mesh_update_customdata_pointers(mesh, FALSE); + BKE_mesh_update_customdata_pointers(mesh, false); /* scan the input list and insert the new vertices */ @@ -986,7 +986,7 @@ static void mesh_add_edges(Mesh *mesh, int len) CustomData_free(&mesh->edata, mesh->totedge); mesh->edata = edata; - mesh_update_customdata_pointers(mesh, FALSE); /* new edges don't change tessellation */ + BKE_mesh_update_customdata_pointers(mesh, false); /* new edges don't change tessellation */ /* set default flags */ medge = &mesh->medge[mesh->totedge]; @@ -1016,7 +1016,7 @@ static void mesh_add_tessfaces(Mesh *mesh, int len) CustomData_free(&mesh->fdata, mesh->totface); mesh->fdata = fdata; - mesh_update_customdata_pointers(mesh, TRUE); + BKE_mesh_update_customdata_pointers(mesh, true); /* set default flags */ mface = &mesh->mface[mesh->totface]; @@ -1045,7 +1045,7 @@ static void mesh_add_loops(Mesh *mesh, int len) CustomData_free(&mesh->ldata, mesh->totloop); mesh->ldata = ldata; - mesh_update_customdata_pointers(mesh, TRUE); + BKE_mesh_update_customdata_pointers(mesh, true); mesh->totloop = totloop; } @@ -1070,7 +1070,7 @@ static void mesh_add_polys(Mesh *mesh, int len) CustomData_free(&mesh->pdata, mesh->totpoly); mesh->pdata = pdata; - mesh_update_customdata_pointers(mesh, TRUE); + BKE_mesh_update_customdata_pointers(mesh, true); /* set default flags */ mpoly = &mesh->mpoly[mesh->totpoly]; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 3d4d204299f..e8f55edddab 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -505,7 +505,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) me->pdata = pdata; /* tessface data removed above, no need to update */ - mesh_update_customdata_pointers(me, FALSE); + BKE_mesh_update_customdata_pointers(me, false); /* update normals in case objects with non-uniform scale are joined */ ED_mesh_calc_normals(me); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index d66620c2ff6..c9070dc6205 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1754,7 +1754,7 @@ static Object *modifier_skin_armature_create(struct Scene *scene, arm->edbo = MEM_callocN(sizeof(ListBase), "edbo armature"); mvert_skin = CustomData_get_layer(&me->vdata, CD_MVERT_SKIN); - create_vert_edge_map(&emap, &emap_mem, + BKE_mesh_vert_edge_map_create(&emap, &emap_mem, me->medge, me->totvert, me->totedge); edges_visited = BLI_BITMAP_NEW(me->totedge, "edge_visited"); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 2bdcda1430d..9ba50e95d81 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -354,7 +354,7 @@ static void make_vertexcol(Object *ob) /* single ob */ if (!me->mloopcol) { CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop); } - mesh_update_customdata_pointers(me, TRUE); + BKE_mesh_update_customdata_pointers(me, true); } update_tessface_data(ob, me); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 376622e95a6..156be008a96 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4553,7 +4553,7 @@ void sculpt_dynamic_topology_disable(bContext *C, CustomData_copy(&unode->bm_enter_pdata, &me->pdata, CD_MASK_MESH, CD_DUPLICATE, unode->bm_enter_totpoly); - mesh_update_customdata_pointers(me, FALSE); + BKE_mesh_update_customdata_pointers(me, false); } else { sculptsession_bm_to_me(ob, TRUE); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index d332fb9f8b3..340744839d2 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -159,12 +159,12 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C) /* ideally would return an rv3d but in some cases the region is needed too * so return that, the caller can then access the ar->regiondata */ -int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r) +int ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar) { ScrArea *sa = CTX_wm_area(C); - *v3d_r = NULL; - *ar_r = NULL; + *r_v3d = NULL; + *r_ar = NULL; if (sa && sa->spacetype == SPACE_VIEW3D) { ARegion *ar = CTX_wm_region(C); @@ -173,8 +173,8 @@ int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r) if (ar) { RegionView3D *rv3d = ar->regiondata; if (rv3d && rv3d->viewlock == 0) { - *v3d_r = v3d; - *ar_r = ar; + *r_v3d = v3d; + *r_ar = ar; return 1; } else { @@ -196,14 +196,14 @@ int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r) /* camera/perspective view get priority when the active region is locked */ if (ar_unlock_user) { - *v3d_r = v3d; - *ar_r = ar_unlock_user; + *r_v3d = v3d; + *r_ar = ar_unlock_user; return 1; } if (ar_unlock) { - *v3d_r = v3d; - *ar_r = ar_unlock; + *r_v3d = v3d; + *r_ar = ar_unlock; return 1; } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 8fdc9416513..a4d09fbb794 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1008,9 +1008,9 @@ void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, R } void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, - rctf *viewborder_r, const bool no_shift) + rctf *r_viewborder, const bool no_shift) { - view3d_camera_border(scene, ar, v3d, rv3d, viewborder_r, no_shift, false); + view3d_camera_border(scene, ar, v3d, rv3d, r_viewborder, no_shift, false); } static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float fac) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index b8a39cae381..43c73fd46fc 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1859,7 +1859,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[3][3], } /* loop-in-a-loop I know, but we need it! (ton) */ -static void get_face_center(float cent_r[3], BMVert *eve) +static void get_face_center(float r_cent[3], BMVert *eve) { BMFace *efa; @@ -1867,20 +1867,20 @@ static void get_face_center(float cent_r[3], BMVert *eve) BM_ITER_ELEM (efa, &iter, eve, BM_FACES_OF_VERT) { if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) { - BM_face_calc_center_mean(efa, cent_r); + BM_face_calc_center_mean(efa, r_cent); break; } } } -static void get_edge_center(float cent_r[3], BMVert *eve) +static void get_edge_center(float r_cent[3], BMVert *eve) { BMEdge *eed; BMIter iter; BM_ITER_ELEM (eed, &iter, eve, BM_EDGES_OF_VERT) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { - mid_v3_v3v3(cent_r, eed->v1->co, eed->v2->co); + mid_v3_v3v3(r_cent, eed->v1->co, eed->v2->co); break; } } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index de1e830a3b8..eb9d1af02cb 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -528,7 +528,7 @@ static void rna_CustomDataLayer_active_set(PointerRNA *ptr, CustomData *data, in else CustomData_set_layer_active(ldata, CD_MLOOPUV, n); } - mesh_update_customdata_pointers(me, TRUE); + BKE_mesh_update_customdata_pointers(me, true); } static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type, int render) diff --git a/source/blender/makesrna/intern/rna_mesh_utils.h b/source/blender/makesrna/intern/rna_mesh_utils.h index cfb9f7e8f3d..581c06c2c4e 100644 --- a/source/blender/makesrna/intern/rna_mesh_utils.h +++ b/source/blender/makesrna/intern/rna_mesh_utils.h @@ -110,7 +110,7 @@ CustomData *ldata = rna_mesh_ldata_helper(me); \ CustomData_set_layer_##active_type(ldata, CD_MLOOPUV, a); \ } \ - mesh_update_customdata_pointers(me, TRUE); \ + BKE_mesh_update_customdata_pointers(me, true); \ return; \ } \ } \ @@ -139,7 +139,7 @@ CustomData *ldata = rna_mesh_ldata_helper(me); \ CustomData_set_layer_##active_type(ldata, CD_MLOOPUV, value); \ } \ - mesh_update_customdata_pointers(me, TRUE); \ + BKE_mesh_update_customdata_pointers(me, true); \ } \ } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 531794f7ab4..4b32c4a237a 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -383,7 +383,7 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value) } } else if (ob->type == OB_MESH) { - set_mesh(ob, (Mesh *)id); + BKE_mesh_assign_object(ob, (Mesh *)id); } else { if (ob->data) { diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index c10e10350db..fbd2d3f1200 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -1785,7 +1785,7 @@ static DerivedMesh *base_skin(DerivedMesh *origdm, totvert = origdm->getNumVerts(origdm); totedge = origdm->getNumEdges(origdm); - create_vert_edge_map(&emap, &emapmem, medge, totvert, totedge); + BKE_mesh_vert_edge_map_create(&emap, &emapmem, medge, totvert, totedge); emat = build_edge_mats(nodes, mvert, totvert, medge, emap, totedge); skin_nodes = build_frames(mvert, totvert, nodes, emap, emat); -- cgit v1.2.3 From 7049bf05985e195000441e6fce4825a2a2803250 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Sun, 17 Mar 2013 20:24:47 +0000 Subject: Fix: Setting cursor to semitransparent objects will fail because of clip alpha, added option when drawing depth to disable alpha clip override. We use that in texture paint cursor now. Not too common but may be useful for people dealing with cloning plugins. Reported by kgeogeo on irc, thanks. --- source/blender/editors/include/ED_view3d.h | 2 +- source/blender/editors/sculpt_paint/paint_image_proj.c | 2 +- source/blender/editors/space_view3d/view3d_draw.c | 4 ++-- source/blender/editors/space_view3d/view3d_edit.c | 12 ++++++------ source/blender/editors/space_view3d/view3d_intern.h | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index f47374c3169..12afeb2d343 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -244,7 +244,7 @@ unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const int mval[2 unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y); /* draws and does a 4x4 sample */ -int ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3]); +int ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride); /* only draw so ED_view3d_autodist_simple can be called many times after */ int ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 96916236279..a90e9150345 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -4118,7 +4118,7 @@ int paint_proj_stroke(bContext *C, void *pps, const int prevmval_i[2], const int view3d_operator_needs_opengl(C); - if (!ED_view3d_autodist(scene, ps->ar, v3d, mval_i, cursor)) + if (!ED_view3d_autodist(scene, ps->ar, v3d, mval_i, cursor, false)) return 0; ED_region_tag_redraw(ps->ar); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a4d09fbb794..51f2659fccd 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2235,7 +2235,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d) } -void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *)) +void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *), bool alphaoverride) { RegionView3D *rv3d = ar->regiondata; Base *base; @@ -2247,7 +2247,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *)) /* Setting these temporarily is not nice */ v3d->flag &= ~V3D_SELECT_OUTLINE; - U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */ + U.glalphaclip = alphaoverride ? 0.5 : glalphaclip; /* not that nice but means we wont zoom into billboards */ U.obcenter_dia = 0; setwinmatrixview3d(ar, v3d, NULL); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 8c8332075a2..a8e9c8b6cba 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -457,7 +457,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, const wmEvent *even view3d_operator_needs_opengl(C); /* needed for zbuf drawing */ - if ((vod->use_dyn_ofs = ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) { + if ((vod->use_dyn_ofs = ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true))) { if (rv3d->is_persp) { float my_origin[3]; /* original G.vd->ofs */ float my_pivot[3]; /* view */ @@ -2896,7 +2896,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) /* Get Z Depths, needed for perspective, nice for ortho */ bgl_get_mats(&mats); - draw_depth(scene, ar, v3d, NULL); + draw_depth(scene, ar, v3d, NULL, true); { /* avoid allocating the whole depth buffer */ @@ -3745,7 +3745,7 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2]) if (U.uiflag & USER_ZBUF_CURSOR) { /* maybe this should be accessed some other way */ view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(scene, ar, v3d, mval, fp)) + if (ED_view3d_autodist(scene, ar, v3d, mval, fp, true)) depth_used = TRUE; } @@ -3917,7 +3917,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg } /* XXX todo Zooms in on a border drawn by the user */ -int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3]) +int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride) { bglMats mats; /* ZBuffer depth vars */ float depth_close = FLT_MAX; @@ -3925,7 +3925,7 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2] /* Get Z Depths, needed for perspective, nice for ortho */ bgl_get_mats(&mats); - draw_depth(scene, ar, v3d, NULL); + draw_depth(scene, ar, v3d, NULL, alphaoverride); depth_close = view_autodist_depth_margin(ar, mval, 4); @@ -3952,7 +3952,7 @@ int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) /* Get Z Depths, needed for perspective, nice for ortho */ switch (mode) { case 0: - draw_depth(scene, ar, v3d, NULL); + draw_depth(scene, ar, v3d, NULL, true); break; case 1: draw_depth_gpencil(scene, ar, v3d); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 26ed8e1885c..8bce8cd3e01 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -152,7 +152,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, /* view3d_draw.c */ void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar); -void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (*func)(void *)); +void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (*func)(void *), bool alphaoverride); void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d); void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag); -- cgit v1.2.3 From b19155e76cca879724f7deae2cfd71d19f953229 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 18 Mar 2013 11:34:05 +0000 Subject: Fix #34672: Image sampling line didn't use color management for byte buffers This makes it so sample line (for all image editor, sequencer and compositor) displaying managed color for byte buffers as well. It was simply not implemented before. --- source/blender/editors/include/ED_image.h | 2 +- source/blender/editors/space_image/image_draw.c | 39 +++++++++------------- source/blender/editors/space_image/image_ops.c | 10 ++++-- source/blender/editors/space_node/node_view.c | 9 +++-- .../editors/space_sequencer/sequencer_view.c | 10 ++++-- source/blender/imbuf/IMB_colormanagement.h | 2 ++ source/blender/imbuf/intern/colormanagement.c | 20 +++++++++++ 7 files changed, 62 insertions(+), 30 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 9b726cea56c..11b8aa5e60a 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -79,7 +79,7 @@ int ED_space_image_maskedit_mask_poll(struct bContext *C); void ED_image_update_frame(const struct Main *mainp, int cfra); void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, int color_manage, int use_default_view, int channels, int x, int y, - const unsigned char cp[4], const float fp[4], int *zp, float *zpf); + const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf); #endif /* __ED_IMAGE_H__ */ diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index e69ce56c9d9..f27a99ac44b 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -162,7 +162,7 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar, float zoomx, /* used by node view too */ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_default_view, int channels, int x, int y, - const unsigned char cp[4], const float fp[4], int *zp, float *zpf) + const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf) { char str[256]; float dx = 6; @@ -258,15 +258,23 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def dx += BLF_width(blf_mono_font, str); } - if (color_manage && channels == 4) { - float pixel[4]; + if (color_manage) { + float rgba[4]; + + copy_v3_v3(rgba, linearcol); + if (channels == 3) + rgba[3] = 1.0f; + else + rgba[3] = linearcol[3]; + + (void)color_manage; if (use_default_view) - IMB_colormanagement_pixel_to_display_space_v4(pixel, fp, NULL, &scene->display_settings); + IMB_colormanagement_pixel_to_display_space_v4(rgba, rgba, NULL, &scene->display_settings); else - IMB_colormanagement_pixel_to_display_space_v4(pixel, fp, &scene->view_settings, &scene->display_settings); + IMB_colormanagement_pixel_to_display_space_v4(rgba, rgba, &scene->view_settings, &scene->display_settings); - BLI_snprintf(str, sizeof(str), " | CM R:%-.4f G:%-.4f B:%-.4f", pixel[0], pixel[1], pixel[2]); + BLI_snprintf(str, sizeof(str), " | CM R:%-.4f G:%-.4f B:%-.4f", rgba[0], rgba[1], rgba[2]); BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str); @@ -287,26 +295,11 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def col[3] = 1.0f; } else if (channels == 3) { - if (fp) { - copy_v3_v3(col, fp); - } - else if (cp) { - rgb_uchar_to_float(col, cp); - } - else { - zero_v3(col); - } + copy_v3_v3(col, linearcol); col[3] = 1.0f; } else if (channels == 4) { - if (fp) - copy_v4_v4(col, fp); - else if (cp) { - rgba_uchar_to_float(col, cp); - } - else { - zero_v4(col); - } + copy_v4_v4(col, linearcol); } else { BLI_assert(0); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 54230d35312..7c016cdf3bf 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2079,6 +2079,7 @@ typedef struct ImageSampleInfo { unsigned char col[4]; float colf[4]; + float linearcol[4]; int z; float zf; @@ -2099,7 +2100,7 @@ static void image_sample_draw(const bContext *C, ARegion *ar, void *arg_info) Scene *scene = CTX_data_scene(C); ED_image_draw_info(scene, ar, info->color_manage, info->use_default_view, info->channels, - info->x, info->y, info->colp, info->colfp, info->zp, info->zfp); + info->x, info->y, info->colp, info->colfp, info->linearcol, info->zp, info->zfp); } } @@ -2198,7 +2199,10 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event info->colf[3] = (float)cp[3] / 255.0f; info->colfp = info->colf; - info->color_manage = FALSE; + copy_v4_v4(info->linearcol, info->colf); + IMB_colormanagement_colorspace_to_scene_linear_v4(info->linearcol, false, ibuf->rect_colorspace); + + info->color_manage = TRUE; } if (ibuf->rect_float) { fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x)); @@ -2209,6 +2213,8 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event info->colf[3] = fp[3]; info->colfp = info->colf; + copy_v4_v4(info->linearcol, info->colf); + info->color_manage = TRUE; } diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index a8e84e0a0e5..a2fa7d3caf6 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -56,6 +56,7 @@ #include "MEM_guardedalloc.h" +#include "IMB_colormanagement.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -335,6 +336,7 @@ typedef struct ImageSampleInfo { unsigned char col[4]; float colf[4]; + float linearcol[4]; int z; float zf; @@ -353,7 +355,7 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) if (info->draw) { ED_image_draw_info(scene, ar, info->color_manage, FALSE, info->channels, - info->x, info->y, info->col, info->colf, + info->x, info->y, info->col, info->colf, info->linearcol, info->zp, info->zfp); } } @@ -469,7 +471,10 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) info->colf[2] = (float)cp[2] / 255.0f; info->colf[3] = (float)cp[3] / 255.0f; - info->color_manage = FALSE; + copy_v4_v4(info->linearcol, info->colf); + IMB_colormanagement_colorspace_to_scene_linear_v4(info->linearcol, false, ibuf->rect_colorspace); + + info->color_manage = TRUE; } if (ibuf->rect_float) { fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x)); diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c index 7dcd3a70870..68428cd890f 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.c +++ b/source/blender/editors/space_sequencer/sequencer_view.c @@ -31,6 +31,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_math.h" #include "BLI_utildefines.h" #include "DNA_scene_types.h" @@ -66,6 +67,7 @@ typedef struct ImageSampleInfo { unsigned char col[4]; float colf[4]; + float linearcol[4]; unsigned char *colp; float *colfp; @@ -81,7 +83,8 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) if (info->draw) { ED_image_draw_info(scene, ar, info->color_manage, FALSE, info->channels, - info->x, info->y, info->colp, info->colfp, NULL, NULL); + info->x, info->y, info->colp, info->colfp, + info->linearcol, NULL, NULL); } } @@ -134,7 +137,10 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) info->colf[3] = (float)cp[3] / 255.0f; info->colfp = info->colf; - info->color_manage = FALSE; + copy_v4_v4(info->linearcol, info->colf); + IMB_colormanagement_colorspace_to_scene_linear_v4(info->linearcol, false, ibuf->rect_colorspace); + + info->color_manage = TRUE; } if (ibuf->rect_float) { fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x)); diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index a05f0d5b3e6..b981390582e 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -70,6 +70,8 @@ void IMB_colormanagement_transform_threaded(float *buffer, int width, int height void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspace, const char *to_colorspace); void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], struct ColorSpace *colorspace); +void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], int predivide, struct ColorSpace *colorspace); + void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], struct ColorSpace *colorspace); void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, int predivide); diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 505ba2599df..aa3dd05dbd1 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -1583,6 +1583,26 @@ void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], ColorSpac OCIO_processorApplyRGB(processor, pixel); } +void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], int predivide, ColorSpace *colorspace) +{ + OCIO_ConstProcessorRcPtr *processor; + + if (!colorspace) { + /* should never happen */ + printf("%s: perform conversion from unknown color space\n", __func__); + return; + } + + processor = colorspace_to_scene_linear_processor(colorspace); + + if (processor) { + if (predivide) + OCIO_processorApplyRGBA_predivide(processor, pixel); + else + OCIO_processorApplyRGBA(processor, pixel); + } +} + void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, int predivide) { OCIO_ConstProcessorRcPtr *processor; -- cgit v1.2.3 From 655ed9cc7f237202e8d93b47c7cb12d6fc79d8b0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Mar 2013 11:44:56 +0000 Subject: style cleanup --- source/blender/blenkernel/intern/pbvh_bmesh.c | 10 +++++----- source/blender/bmesh/intern/bmesh_mesh.c | 2 +- source/blender/bmesh/intern/bmesh_polygon.c | 4 ++-- source/blender/collada/AnimationExporter.cpp | 10 +++++----- source/blender/collada/ArmatureImporter.cpp | 2 +- source/blender/collada/ControllerExporter.cpp | 6 +++--- source/blender/collada/GeometryExporter.cpp | 2 +- source/blender/collada/SceneExporter.cpp | 4 ++-- source/blender/editors/sculpt_paint/paint_image.c | 4 ++-- source/blender/editors/space_node/node_draw.c | 2 +- source/blender/editors/space_view3d/view3d_draw.c | 2 +- source/blender/makesdna/DNA_ID.h | 2 +- source/blender/makesrna/intern/rna_nodetree.c | 2 +- source/blender/quicktime/apple/qtkit_export.m | 6 +++--- .../blender/render/intern/raytrace/rayobject_internal.h | 8 ++++---- source/blender/render/intern/source/pipeline.c | 2 +- source/blender/render/intern/source/renderdatabase.c | 2 +- source/blenderplayer/bad_level_call_stubs/stubs.c | 4 ++-- source/gameengine/Converter/BL_ArmatureConstraint.cpp | 4 ++-- source/gameengine/Converter/BL_ArmatureObject.cpp | 16 ++++++++-------- source/gameengine/Converter/BL_BlenderDataConversion.cpp | 4 ++-- source/gameengine/Converter/BL_DeformableGameObject.cpp | 2 +- source/gameengine/Converter/BL_ShapeActionActuator.cpp | 6 +++--- source/gameengine/Ketsji/BL_Action.cpp | 8 ++++---- source/gameengine/Ketsji/KX_ArmatureSensor.cpp | 2 +- source/gameengine/Rasterizer/RAS_MeshObject.cpp | 4 ++-- 26 files changed, 60 insertions(+), 60 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 0ca73b92071..421821f3a2d 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -1288,14 +1288,14 @@ void pbvh_bmesh_print(PBVH *bvh) fprintf(stderr, "bm_face_to_node:\n"); GHASH_ITER (gh_iter, bvh->bm_face_to_node) { fprintf(stderr, " %d -> %d\n", - BM_elem_index_get((BMFace*)BLI_ghashIterator_getKey(&gh_iter)), + BM_elem_index_get((BMFace *)BLI_ghashIterator_getKey(&gh_iter)), GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter))); } fprintf(stderr, "bm_vert_to_node:\n"); GHASH_ITER (gh_iter, bvh->bm_vert_to_node) { fprintf(stderr, " %d -> %d\n", - BM_elem_index_get((BMVert*)BLI_ghashIterator_getKey(&gh_iter)), + BM_elem_index_get((BMVert *)BLI_ghashIterator_getKey(&gh_iter)), GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter))); } @@ -1307,15 +1307,15 @@ void pbvh_bmesh_print(PBVH *bvh) fprintf(stderr, "node %d\n faces:\n", n); GHASH_ITER (gh_iter, node->bm_faces) fprintf(stderr, " %d\n", - BM_elem_index_get((BMFace*)BLI_ghashIterator_getKey(&gh_iter))); + BM_elem_index_get((BMFace *)BLI_ghashIterator_getKey(&gh_iter))); fprintf(stderr, " unique verts:\n"); GHASH_ITER (gh_iter, node->bm_unique_verts) fprintf(stderr, " %d\n", - BM_elem_index_get((BMVert*)BLI_ghashIterator_getKey(&gh_iter))); + BM_elem_index_get((BMVert *)BLI_ghashIterator_getKey(&gh_iter))); fprintf(stderr, " other verts:\n"); GHASH_ITER (gh_iter, node->bm_other_verts) fprintf(stderr, " %d\n", - BM_elem_index_get((BMVert*)BLI_ghashIterator_getKey(&gh_iter))); + BM_elem_index_get((BMVert *)BLI_ghashIterator_getKey(&gh_iter))); } } diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index b9352a25063..55a22fd3613 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -756,7 +756,7 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) BM_ITER_MESH (ed, &iter, bm, BM_EDGES_OF_MESH) { if (vptr_map) { /* printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void *)ed->v1));*/ -/* printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void* )ed->v2));*/ +/* printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void *)ed->v2));*/ ed->v1 = BLI_ghash_lookup(vptr_map, (const void *)ed->v1); ed->v2 = BLI_ghash_lookup(vptr_map, (const void *)ed->v2); } diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 4041fc2c755..d235aaaa622 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -1087,7 +1087,7 @@ void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len) * Small utility functions for fast access * * faster alternative to: - * BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void**)v, 3); + * BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void **)v, 3); */ void BM_face_as_array_vert_tri(BMFace *f, BMVert *r_verts[3]) { @@ -1102,7 +1102,7 @@ void BM_face_as_array_vert_tri(BMFace *f, BMVert *r_verts[3]) /** * faster alternative to: - * BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void**)v, 4); + * BM_iter_as_array(bm, BM_VERTS_OF_FACE, f, (void **)v, 4); */ void BM_face_as_array_vert_quad(BMFace *f, BMVert *r_verts[4]) { diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 48958fbfc90..89bcebc41d6 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -184,7 +184,7 @@ void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vectorfirst; con; con = con->next) { + for (con = (bConstraint *)conlist->first; con; con = con->next) { ListBase targets = {NULL, NULL}; bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); @@ -200,7 +200,7 @@ void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vectorget_constraint_targets(con, &targets); if (cti) { - for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) { + for (ct = (bConstraintTarget *)targets.first; ct; ct = ct->next) { obtar = ct->tar; find_frames(obtar, frames); } @@ -544,7 +544,7 @@ void AnimationExporter::dae_baked_object_animation(std::vector &fra, Obje if (!fra.size()) return; - BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s", (char*)translate_id(ob_name).c_str(), + BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s", (char *)translate_id(ob_name).c_str(), "object_matrix"); openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING); @@ -1535,7 +1535,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[ { ListBase *conlist = get_active_constraints(ob); bConstraint *con; - for (con = (bConstraint*)conlist->first; con; con = con->next) { + for (con = (bConstraint *)conlist->first; con; con = con->next) { ListBase targets = {NULL, NULL}; bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); @@ -1544,7 +1544,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[ bConstraintTarget *ct; Object *obtar; cti->get_constraint_targets(con, &targets); - for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) { + for (ct = (bConstraintTarget *)targets.first; ct; ct = ct->next) { obtar = ct->tar; BKE_animsys_evaluate_animdata(scene, &obtar->id, obtar->adt, ctime, ADT_RECALC_ANIM); BKE_object_where_is_calc_time(scene, obtar, ctime); diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index ed84dee046f..0f8a4e5af76 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -674,7 +674,7 @@ void ArmatureImporter::make_shape_keys() if (source_ob) { - Mesh *source_me = (Mesh*) source_ob->data; + Mesh *source_me = (Mesh *)source_ob->data; //insert key to source mesh Key *key = source_me->key = BKE_key_add((ID *)source_me); key->type = KEY_RELATIVE; diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index 35fcc926bea..71a16df3b26 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -352,7 +352,7 @@ std::string ControllerExporter::add_morph_targets(Key *key, Object *ob) source.prepareToAppendValues(); - KeyBlock * kb = (KeyBlock*)key->block.first; + KeyBlock *kb = (KeyBlock *)key->block.first; //skip the basis kb = kb->next; for (; kb; kb = kb->next) { @@ -381,7 +381,7 @@ std::string ControllerExporter::add_morph_weights(Key *key, Object *ob) source.prepareToAppendValues(); - KeyBlock * kb = (KeyBlock*)key->block.first; + KeyBlock *kb = (KeyBlock *)key->block.first; //skip the basis kb = kb->next; for (; kb; kb = kb->next) { @@ -399,7 +399,7 @@ void ControllerExporter::add_weight_extras(Key *key) // can also try the base element and param alternative COLLADASW::BaseExtraTechnique extra; - KeyBlock * kb = (KeyBlock*)key->block.first; + KeyBlock * kb = (KeyBlock *)key->block.first; //skip the basis kb = kb->next; for (; kb; kb = kb->next) { diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index 6644c46ac86..669b787062a 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -155,7 +155,7 @@ void GeometryExporter::operator()(Object *ob) if (this->export_settings->include_shapekeys) { Key * key = BKE_key_from_object(ob); if (key) { - KeyBlock * kb = (KeyBlock*)key->block.first; + KeyBlock * kb = (KeyBlock *)key->block.first; //skip the basis kb = kb->next; for (; kb; kb = kb->next) { diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp index f3844be525e..89f8bb3226b 100644 --- a/source/blender/collada/SceneExporter.cpp +++ b/source/blender/collada/SceneExporter.cpp @@ -190,7 +190,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce) } if (ob->constraints.first != NULL ) { - bConstraint *con = (bConstraint*) ob->constraints.first; + bConstraint *con = (bConstraint *) ob->constraints.first; while (con) { std::string con_name(id_name(con)); std::string con_tag = con_name + "_constraint"; @@ -216,7 +216,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce) cti->get_constraint_targets(con, &targets); if (cti) { - for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) { + for (ct = (bConstraintTarget *)targets.first; ct; ct = ct->next) { obtar = ct->tar; std::string tar_id(id_name(obtar)); colladaNode.addExtraTechniqueChildParameter("blender",con_tag,"target_id",tar_id); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 144dfa948d0..d94b9372560 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -614,8 +614,8 @@ void PAINT_OT_image_paint(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL, - "Paint Stroke Mode", - "Action taken when a paint stroke is made"); + "Paint Stroke Mode", + "Action taken when a paint stroke is made"); RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index d6a3a6a6a3f..d2cc42b0a56 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1129,7 +1129,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) if (snode->nodetree) { bNode *node; - /* void** highlights = 0; */ /* UNUSED */ + /* void **highlights = 0; */ /* UNUSED */ node_uiblocks_init(C, snode->nodetree); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 51f2659fccd..d18ec225c5f 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2247,7 +2247,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *), boo /* Setting these temporarily is not nice */ v3d->flag &= ~V3D_SELECT_OUTLINE; - U.glalphaclip = alphaoverride ? 0.5 : glalphaclip; /* not that nice but means we wont zoom into billboards */ + U.glalphaclip = alphaoverride ? 0.5f : glalphaclip; /* not that nice but means we wont zoom into billboards */ U.obcenter_dia = 0; setwinmatrixview3d(ar, v3d, NULL); diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 91e98181ab9..8d425f98a25 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -104,7 +104,7 @@ typedef struct IDProperty { /* 2 characters for ID code and 64 for actual name */ #define MAX_ID_NAME 66 -/* There's a nasty circular dependency here.... void* to the rescue! I +/* There's a nasty circular dependency here.... 'void *' to the rescue! I * really wonder why this is needed. */ typedef struct ID { void *next, *prev; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 933b7a78b59..e7c030d5cdf 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -341,7 +341,7 @@ static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr) #define SUBTYPE(socktype, stypename, id, idname) \ { \ - bNodeSocketValue##stypename * value = (bNodeSocketValue##stypename *)sock->default_value; \ + bNodeSocketValue##stypename *value = (bNodeSocketValue##stypename *)sock->default_value; \ if (value->subtype == PROP_##id) \ return &RNA_NodeSocket##stypename##idname; \ } diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m index 4a8a06134c8..7e7c986c6ea 100644 --- a/source/blender/quicktime/apple/qtkit_export.m +++ b/source/blender/quicktime/apple/qtkit_export.m @@ -295,8 +295,8 @@ static OSStatus AudioConverterInputCallback(AudioConverterRef inAudioConverter, qtexport->audioTotalExportedFrames += *ioNumberDataPackets; - AUD_readDevice(qtexport->audioInputDevice, (UInt8*)qtexport->audioInputBuffer, - qtexport->audioInputFormat.mFramesPerPacket * *ioNumberDataPackets); + AUD_readDevice(qtexport->audioInputDevice, (UInt8 *)qtexport->audioInputBuffer, + qtexport->audioInputFormat.mFramesPerPacket * *ioNumberDataPackets); ioData->mBuffers[0].mDataByteSize = qtexport->audioInputFormat.mBytesPerPacket * *ioNumberDataPackets; ioData->mBuffers[0].mData = qtexport->audioInputBuffer; @@ -357,7 +357,7 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R tmpnam(name); strcat(name, extension); - outputFileURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,(UInt8*) name, strlen(name), false); + outputFileURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,(UInt8 *)name, strlen(name), false); if (outputFileURL) { diff --git a/source/blender/render/intern/raytrace/rayobject_internal.h b/source/blender/render/intern/raytrace/rayobject_internal.h index aa8ab8c3da4..07a1cd26c47 100644 --- a/source/blender/render/intern/raytrace/rayobject_internal.h +++ b/source/blender/render/intern/raytrace/rayobject_internal.h @@ -103,12 +103,12 @@ int RE_rayobjectcontrol_test_break(RayObjectControl *c); #define RE_rayobject_isVlakPrimitive(o) ((((intptr_t)o)&3) == 3) /* used to align a given ray object */ -#define RE_rayobject_align(o) ((RayObject*)(((intptr_t)o)&(~3))) +#define RE_rayobject_align(o) ((RayObject *)(((intptr_t)o)&(~3))) /* used to unalign a given ray object */ -#define RE_rayobject_unalignRayFace(o) ((RayObject*)(((intptr_t)o)|1)) -#define RE_rayobject_unalignRayAPI(o) ((RayObject*)(((intptr_t)o)|2)) -#define RE_rayobject_unalignVlakPrimitive(o) ((RayObject*)(((intptr_t)o)|3)) +#define RE_rayobject_unalignRayFace(o) ((RayObject *)(((intptr_t)o)|1)) +#define RE_rayobject_unalignRayAPI(o) ((RayObject *)(((intptr_t)o)|2)) +#define RE_rayobject_unalignVlakPrimitive(o) ((RayObject *)(((intptr_t)o)|3)) /* * This rayobject represents a generic object. With it's own callbacks for raytrace operations. diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 3c4eb814d79..e67c8520e75 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1484,7 +1484,7 @@ static void tag_scenes_for_render(Render *re) if (node->id) { if (!MAIN_VERSION_ATLEAST(re->main, 265, 5)) { if (rlayer_node_uses_alpha(re->scene->nodetree, node)) { - Scene *scene = (Scene*) node->id; + Scene *scene = (Scene *)node->id; if (scene->r.alphamode != R_ALPHAPREMUL) { BKE_reportf(re->reports, RPT_WARNING, "Setting scene %s alpha mode to Premul", scene->id.name + 2); diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 0a8af1c368b..8169250f74f 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -938,7 +938,7 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr) // TABLEINITSIZE, obr->blohalen+TABLEINITSIZE ); temp=obr->bloha; - obr->bloha = (HaloRen**)MEM_callocN(sizeof(void *) * (obr->blohalen + TABLEINITSIZE), "Bloha"); + obr->bloha = (HaloRen **)MEM_callocN(sizeof(void *) * (obr->blohalen + TABLEINITSIZE), "Bloha"); if (temp) memcpy(obr->bloha, temp, obr->blohalen*sizeof(void *)); memset(&(obr->bloha[obr->blohalen]), 0, TABLEINITSIZE * sizeof(void *)); obr->blohalen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/ diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 8be96e5390d..28193b71bbd 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -497,8 +497,8 @@ void WM_operator_properties_free(struct PointerRNA *ptr) {} void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring) {} void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot) {} void WM_operator_properties_sanitize(struct PointerRNA *ptr, const short no_context) {}; -void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType*, void*), void *userdata) {} -void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType*, void*), void *userdata) {} +void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType*, void *), void *userdata) {} +void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType*, void *), void *userdata) {} void WM_operator_bl_idname(char *to, const char *from) {} void WM_operator_py_idname(char *to, const char *from) {} void WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width, int height) {} diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.cpp b/source/gameengine/Converter/BL_ArmatureConstraint.cpp index 379be91b523..131fdaed3ec 100644 --- a/source/gameengine/Converter/BL_ArmatureConstraint.cpp +++ b/source/gameengine/Converter/BL_ArmatureConstraint.cpp @@ -130,10 +130,10 @@ void BL_ArmatureConstraint::ReParent(BL_ArmatureObject* armature) m_constraint = NULL; m_posechannel = NULL; // and locate the constraint - for (pchan = (bPoseChannel*)newpose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { + for (pchan = (bPoseChannel*)newpose->chanbase.first; pchan; pchan = (bPoseChannel*)pchan->next) { if (!strcmp(pchan->name, posechannel)) { // now locate the constraint - for (pcon = (bConstraint*)pchan->constraints.first; pcon; pcon=(bConstraint*)pcon->next) { + for (pcon = (bConstraint *)pchan->constraints.first; pcon; pcon = (bConstraint *)pcon->next) { if (!strcmp(pcon->name, constraint)) { m_constraint = pcon; m_posechannel = pchan; diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index 395a57d753c..55d9decb333 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -100,14 +100,14 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) /* remap pointers */ ghash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "game_copy_pose gh"); - pchan= (bPoseChannel*)src->chanbase.first; - outpchan= (bPoseChannel*)out->chanbase.first; + pchan= (bPoseChannel *)src->chanbase.first; + outpchan= (bPoseChannel *)out->chanbase.first; for (; pchan; pchan=pchan->next, outpchan=outpchan->next) BLI_ghash_insert(ghash, pchan, outpchan); - for (pchan = (bPoseChannel*)out->chanbase.first; pchan; pchan = pchan->next) { - pchan->parent= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->parent); - pchan->child= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->child); + for (pchan = (bPoseChannel *)out->chanbase.first; pchan; pchan = pchan->next) { + pchan->parent= (bPoseChannel *)BLI_ghash_lookup(ghash, pchan->parent); + pchan->child= (bPoseChannel *)BLI_ghash_lookup(ghash, pchan->child); if (copy_constraint) { ListBase listb; @@ -158,8 +158,8 @@ void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/) dstweight = 1.0F; } - schan= (bPoseChannel*)src->chanbase.first; - for (dchan = (bPoseChannel*)dst->chanbase.first; dchan; dchan=(bPoseChannel*)dchan->next, schan= (bPoseChannel*)schan->next) { + schan= (bPoseChannel *)src->chanbase.first; + for (dchan = (bPoseChannel *)dst->chanbase.first; dchan; dchan=(bPoseChannel *)dchan->next, schan= (bPoseChannel *)schan->next) { // always blend on all channels since we don't know which one has been set /* quat interpolation done separate */ if (schan->rotmode == ROT_MODE_QUAT) { @@ -376,7 +376,7 @@ void BL_ArmatureObject::LoadChannels() BL_ArmatureChannel* proxy; m_channelNumber = 0; - for (pchan = (bPoseChannel*)m_pose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { + for (pchan = (bPoseChannel *)m_pose->chanbase.first; pchan; pchan=(bPoseChannel *)pchan->next) { proxy = new BL_ArmatureChannel(this, pchan); m_poseChannels.AddBack(proxy); m_channelNumber++; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index e3fd662e16f..6262f8e48ce 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -2140,7 +2140,7 @@ static void UNUSED_FUNCTION(RBJconstraints)(Object *ob)//not used conlist = get_active_constraints2(ob); if (conlist) { - for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) { + for (curcon = (bConstraint *)conlist->first; curcon; curcon = (bConstraint *)curcon->next) { printf("%i\n",curcon->type); } @@ -2785,7 +2785,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, continue; if (conlist) { - for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) { + for (curcon = (bConstraint *)conlist->first; curcon; curcon = (bConstraint *)curcon->next) { if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) { bRigidBodyJointConstraint *dat=(bRigidBodyJointConstraint *)curcon->data; diff --git a/source/gameengine/Converter/BL_DeformableGameObject.cpp b/source/gameengine/Converter/BL_DeformableGameObject.cpp index 4967401f279..3a4a27a6722 100644 --- a/source/gameengine/Converter/BL_DeformableGameObject.cpp +++ b/source/gameengine/Converter/BL_DeformableGameObject.cpp @@ -94,7 +94,7 @@ bool BL_DeformableGameObject::GetShape(vector &shape) if (key && key->type==KEY_RELATIVE) { KeyBlock *kb; - for (kb = (KeyBlock*)key->block.first; kb; kb = (KeyBlock*)kb->next) + for (kb = (KeyBlock *)key->block.first; kb; kb = (KeyBlock *)kb->next) { shape.push_back(kb->curval); } diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp index d8b4f6aaf1c..4806ed04cc6 100644 --- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp +++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp @@ -176,9 +176,9 @@ void BL_ShapeActionActuator::BlendShape(Key* key, float srcweight) dstweight = 1.0F - srcweight; - for (it=m_blendshape.begin(), kb = (KeyBlock*)key->block.first; + for (it=m_blendshape.begin(), kb = (KeyBlock *)key->block.first; kb && it != m_blendshape.end(); - kb = (KeyBlock*)kb->next, it++) + kb = (KeyBlock *)kb->next, it++) { kb->curval = kb->curval * dstweight + (*it) * srcweight; } @@ -439,7 +439,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) KeyBlock *kb; // We go through and clear out the keyblocks so there isn't any interference // from other shape actions - for (kb=(KeyBlock*)key->block.first; kb; kb=(KeyBlock*)kb->next) + for (kb=(KeyBlock *)key->block.first; kb; kb=(KeyBlock *)kb->next) kb->curval = 0.f; animsys_evaluate_action(m_idptr, m_action, NULL, m_localtime); diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 1a49f76e71a..fa00cafa148 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -239,7 +239,7 @@ bool BL_Action::Play(const char* name, // Now that we have the previous blend shape saved, we can clear out the key to avoid any // further interference. KeyBlock *kb; - for (kb=(KeyBlock*)shape_deformer->GetKey()->block.first; kb; kb=(KeyBlock*)kb->next) + for (kb=(KeyBlock *)shape_deformer->GetKey()->block.first; kb; kb=(KeyBlock *)kb->next) kb->curval = 0.f; } } @@ -358,9 +358,9 @@ void BL_Action::BlendShape(Key* key, float srcweight, std::vector& blends dstweight = 1.0F - srcweight; //printf("Dst: %f\tSrc: %f\n", srcweight, dstweight); - for (it=blendshape.begin(), kb = (KeyBlock*)key->block.first; + for (it=blendshape.begin(), kb = (KeyBlock *)key->block.first; kb && it != blendshape.end(); - kb = (KeyBlock*)kb->next, it++) + kb = (KeyBlock *)kb->next, it++) { //printf("OirgKeys: %f\t%f\n", kb->curval, (*it)); kb->curval = kb->curval * dstweight + (*it) * srcweight; @@ -478,7 +478,7 @@ void BL_Action::Update(float curtime) // We go through and clear out the keyblocks so there isn't any interference // from other shape actions KeyBlock *kb; - for (kb=(KeyBlock*)key->block.first; kb; kb=(KeyBlock*)kb->next) + for (kb=(KeyBlock *)key->block.first; kb; kb=(KeyBlock *)kb->next) kb->curval = 0.f; // Now blend the shape diff --git a/source/gameengine/Ketsji/KX_ArmatureSensor.cpp b/source/gameengine/Ketsji/KX_ArmatureSensor.cpp index 523f3ceeaea..c111a4de0eb 100644 --- a/source/gameengine/Ketsji/KX_ArmatureSensor.cpp +++ b/source/gameengine/Ketsji/KX_ArmatureSensor.cpp @@ -80,7 +80,7 @@ void KX_ArmatureSensor::FindConstraint() for (pchan = (bPoseChannel*)pose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { if (!strcmp(pchan->name, m_posechannel)) { // now locate the constraint - for (pcon = (bConstraint*)pchan->constraints.first; pcon; pcon=(bConstraint*)pcon->next) { + for (pcon = (bConstraint *)pchan->constraints.first; pcon; pcon = (bConstraint *)pcon->next) { if (!strcmp(pcon->name, m_constraintname)) { if (pcon->flag & CONSTRAINT_DISABLE) /* this constraint is not valid, can't use it */ diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.cpp b/source/gameengine/Rasterizer/RAS_MeshObject.cpp index 49b74895302..2af71c5efa9 100644 --- a/source/gameengine/Rasterizer/RAS_MeshObject.cpp +++ b/source/gameengine/Rasterizer/RAS_MeshObject.cpp @@ -115,7 +115,7 @@ RAS_MeshObject::RAS_MeshObject(Mesh* mesh) int count=0; // initialize weight cache for shape objects // count how many keys in this mesh - for (kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) + for (kb= (KeyBlock *)m_mesh->key->block.first; kb; kb= (KeyBlock *)kb->next) count++; m_cacheWeightIndex.resize(count,-1); } @@ -129,7 +129,7 @@ RAS_MeshObject::~RAS_MeshObject() { KeyBlock *kb; // remove the weight cache to avoid memory leak - for (kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) { + for (kb = (KeyBlock *)m_mesh->key->block.first; kb; kb = (KeyBlock *)kb->next) { if (kb->weights) MEM_freeN(kb->weights); kb->weights= NULL; -- cgit v1.2.3 From 0ee5a2b9562bf63144b36253420c48b6e5680b9e Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 18 Mar 2013 12:16:19 +0000 Subject: Just added a comment: To make circle select allow pass-through for view events, several issues have to be tackled. 1) other modal ops run on top (border select), 2) middlemouse is used now 3) and what for tablet/trackpad or people without middlemouse? The MMB deselection for border/circle is not optimal now... needs rethinking this. Better would be to check on non-persistant-modality for circle, to start with gesture style event like lasso or border can do now. --- source/blender/windowmanager/intern/wm_operators.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 8ea507f97e8..530d3bd90c1 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2830,7 +2830,8 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; /* use finish or we don't get an undo */ } } -// /* Allow view navigation??? */ + /* Allow view navigation??? */ + /* note, this gives issues: 1) other modal ops run on top (border select), 2) middlemouse is used now 3) tablet/trackpad? */ // else { // return OPERATOR_PASS_THROUGH; // } -- cgit v1.2.3 From ee692508d916edb31b321dc119f80c2fbe887dea Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 18 Mar 2013 13:57:47 +0000 Subject: Bug fix, irc: Curves widget error: after deleting a point, and click to add a new point, on dragging it the point flipped up 20 pixels. Was caused by changed layout and region view matrix. Solved by storing actual mousecoords instead of mapped ones. --- .../blender/editors/interface/interface_handlers.c | 52 +++++++++++++--------- 1 file changed, 30 insertions(+), 22 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 12a6343c7e7..39aef38fadb 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4158,20 +4158,27 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle return WM_UI_HANDLER_CONTINUE; } -static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, - float mx, float my, const short shift) +static int ui_numedit_but_CURVE(uiBlock *block, uiBut *but, uiHandleButtonData *data, int snap, + int evtx, int evty, const short shift) { CurveMapping *cumap = (CurveMapping *)but->poin; CurveMap *cuma = cumap->cm + cumap->cur; CurveMapPoint *cmp = cuma->curve; - float fx, fy, zoomx, zoomy /*, offsx, offsy */ /* UNUSED */; + float fx, fy, zoomx, zoomy; + int mx, my, dragx, dragy; int a, changed = 0; + /* evtx evty and drag coords are absolute mousecoords, prevents errors when editing when layout changes */ + mx = evtx; + my = evty; + ui_window_to_block(data->region, block, &mx, &my); + dragx = data->draglastx; + dragy = data->draglasty; + ui_window_to_block(data->region, block, &dragx, &dragy); + zoomx = BLI_rctf_size_x(&but->rect) / BLI_rctf_size_x(&cumap->curr); zoomy = BLI_rctf_size_y(&but->rect) / BLI_rctf_size_y(&cumap->curr); - /* offsx = cumap->curr.xmin; */ - /* offsy = cumap->curr.ymin; */ - + if (snap) { float d[2]; @@ -4187,8 +4194,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, const float mval_factor = ui_mouse_scale_warp_factor(shift); int moved_point = 0; /* for ctrl grid, can't use orig coords because of sorting */ - fx = (mx - data->draglastx) / zoomx; - fy = (my - data->draglasty) / zoomy; + fx = (mx - dragx) / zoomx; + fy = (my - dragy) / zoomy; fx *= mval_factor; fy *= mval_factor; @@ -4212,8 +4219,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, curvemapping_changed(cumap, FALSE); if (moved_point) { - data->draglastx = mx; - data->draglasty = my; + data->draglastx = evtx; + data->draglasty = evty; changed = 1; #ifdef USE_CONT_MOUSE_CORRECT @@ -4232,8 +4239,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, data->dragchange = 1; /* mark for selection */ } else { - fx = (mx - data->draglastx) / zoomx; - fy = (my - data->draglasty) / zoomy; + fx = (mx - dragx) / zoomx; + fy = (my - dragy) / zoomy; /* clamp for clip */ if (cumap->flag & CUMA_DO_CLIP) { @@ -4252,8 +4259,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, cumap->curr.xmax -= fx; cumap->curr.ymax -= fy; - data->draglastx = mx; - data->draglasty = my; + data->draglastx = evtx; + data->draglasty = evty; changed = 1; } @@ -4268,7 +4275,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt mx = event->x; my = event->y; ui_window_to_block(data->region, block, &mx, &my); - + if (data->state == BUTTON_STATE_HIGHLIGHT) { if (event->type == LEFTMOUSE && event->val == KM_PRESS) { CurveMapping *cumap = (CurveMapping *)but->poin; @@ -4358,11 +4365,11 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt } data->dragsel = sel; - - data->dragstartx = mx; - data->dragstarty = my; - data->draglastx = mx; - data->draglasty = my; + + data->dragstartx = event->x; + data->dragstarty = event->y; + data->draglastx = event->x; + data->draglasty = event->y; button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); return WM_UI_HANDLER_BREAK; @@ -4370,8 +4377,9 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt } else if (data->state == BUTTON_STATE_NUM_EDITING) { if (event->type == MOUSEMOVE) { - if (mx != data->draglastx || my != data->draglasty) { - if (ui_numedit_but_CURVE(but, data, event->ctrl, mx, my, event->shift)) + if (event->x != data->draglastx || event->y != data->draglasty) { + + if (ui_numedit_but_CURVE(block, but, data, event->ctrl, event->x, event->y, event->shift)) ui_numedit_apply(C, block, but, data); } } -- cgit v1.2.3