diff options
Diffstat (limited to 'source')
46 files changed, 355 insertions, 155 deletions
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index 2852b8161c8..12d71827136 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -235,15 +235,11 @@ void BLF_lang_set(const char *str) else { short_locale_utf8 = BLI_sprintfN("%s.UTF-8", short_locale); } + bl_locale_set(short_locale_utf8); + MEM_freeN((void *)short_locale_utf8); } else { - short_locale_utf8 = short_locale; - } - - bl_locale_set(short_locale_utf8); - - if (short_locale[0]) { - MEM_freeN((void *)short_locale_utf8); + bl_locale_set(short_locale); } #else (void)str; diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 0f3f4ef1018..0230eaf92bc 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -124,16 +124,16 @@ void IDP_UnlinkProperty(struct IDProperty *prop); #define IDP_Array(prop) ((prop)->data.pointer) /* C11 const correctness for casts */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) -# define IDP_Float(prop) _Generic(prop, \ +# define IDP_Float(prop) _Generic((prop), \ IDProperty *: (*(float *)&(prop)->data.val), \ const IDProperty *: (*(const float *)&(prop)->data.val)) -# define IDP_Double(prop) _Generic(prop, \ +# define IDP_Double(prop) _Generic((prop), \ IDProperty *: (*(double *)&(prop)->data.val), \ const IDProperty *: (*(const double *)&(prop)->data.val)) -# define IDP_String(prop) _Generic(prop, \ +# define IDP_String(prop) _Generic((prop), \ IDProperty *: ((char *) (prop)->data.pointer), \ const IDProperty *: ((const char *) (prop)->data.pointer)) -# define IDP_IDPArray(prop) _Generic(prop, \ +# define IDP_IDPArray(prop) _Generic((prop), \ IDProperty *: ((IDProperty *) (prop)->data.pointer), \ const IDProperty *: ((const IDProperty *) (prop)->data.pointer)) #else diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 4633636c914..5ee82bb5842 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -2403,7 +2403,7 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt) /* Overview of how this system works: * 1) Depsgraph sorts data as necessary, so that data is in an order that means - * that all dependencies are resolved before dependants. + * that all dependencies are resolved before dependents. * 2) All normal animation is evaluated, so that drivers have some basis values to * work with * a. NLA stacks are done first, as the Active Actions act as 'tweaking' tracks diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index 37857993400..3cd26dacebd 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -107,7 +107,7 @@ typedef struct BPathRemap_Data { int count_failed; } BPathRemap_Data; -static bool makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char *path_src) +static bool bpath_relative_convert_visit_cb(void *userdata, char *path_dst, const char *path_src) { BPathRemap_Data *data = (BPathRemap_Data *)userdata; @@ -133,6 +133,7 @@ static bool makeFilesRelative_visit_cb(void *userdata, char *path_dst, const cha void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *reports) { BPathRemap_Data data = {NULL}; + const int flag = BKE_BPATH_TRAVERSE_SKIP_LIBRARY; if (basedir[0] == '\0') { printf("%s: basedir='', this is a bug\n", __func__); @@ -142,14 +143,14 @@ void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *re data.basedir = basedir; data.reports = reports; - BKE_bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data); + BKE_bpath_traverse_main(bmain, bpath_relative_convert_visit_cb, flag, (void *)&data); BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO, "Total files %d | Changed %d | Failed %d", data.count_tot, data.count_changed, data.count_failed); } -static bool makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char *path_src) +static bool bpath_absolute_convert_visit_cb(void *userdata, char *path_dst, const char *path_src) { BPathRemap_Data *data = (BPathRemap_Data *)userdata; @@ -176,6 +177,7 @@ static bool makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const cha void BKE_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *reports) { BPathRemap_Data data = {NULL}; + const int flag = BKE_BPATH_TRAVERSE_SKIP_LIBRARY; if (basedir[0] == '\0') { printf("%s: basedir='', this is a bug\n", __func__); @@ -185,7 +187,7 @@ void BKE_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *re data.basedir = basedir; data.reports = reports; - BKE_bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data); + BKE_bpath_traverse_main(bmain, bpath_absolute_convert_visit_cb, flag, (void *)&data); BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO, "Total files %d | Changed %d | Failed %d", diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 83b6d6c61d6..d244dcc931f 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -731,7 +731,7 @@ void BKE_mesh_loop_tangents(Mesh *mesh, const char *uvmap, float (*r_looptangent } BKE_mesh_loop_tangents_ex(mesh->mvert, mesh->totvert, mesh->mloop, r_looptangents, - loopnors, loopuvs, mesh->totloop, mesh->mpoly, mesh->totpoly, reports); + loopnors, loopuvs, mesh->totloop, mesh->mpoly, mesh->totpoly, reports); } /** \} */ diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 9790394cd99..19e45142960 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -430,7 +430,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short return (strip->end + (strip->actstart * scale - cframe)) / scale; } else { /* if (mode == NLATIME_CONVERT_EVAL) */ - if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, ((int)strip->repeat))) { + if (IS_EQF((float)cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) { /* this case prevents the motion snapping back to the first frame at the end of the strip * by catching the case where repeats is a whole number, which means that the end of the strip * could also be interpreted as the end of the start of a repeat @@ -453,7 +453,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short return strip->actstart + (cframe - strip->start) / scale; } else { /* if (mode == NLATIME_CONVERT_EVAL) */ - if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, ((int)strip->repeat))) { + if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) { /* this case prevents the motion snapping back to the first frame at the end of the strip * by catching the case where repeats is a whole number, which means that the end of the strip * could also be interpreted as the end of the start of a repeat diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 5281b0b9b74..98a197b9e02 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1994,17 +1994,20 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4]) * we divide the curvetime calculated in the previous step by the length of the path, to get a time * factor, which then gets clamped to lie within 0.0 - 1.0 range */ - if (IS_EQF(cu->pathlen, 0.0f) == 0) + if (cu->pathlen) { ctime = cu->ctime / cu->pathlen; - else + } + else { ctime = cu->ctime; + } CLAMP(ctime, 0.0f, 1.0f); } else { ctime = BKE_scene_frame_get(scene); - if (IS_EQF(cu->pathlen, 0.0f) == 0) + if (cu->pathlen) { ctime /= cu->pathlen; + } CLAMP(ctime, 0.0f, 1.0f); } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 622ec25a7e1..dedf5e8bd72 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -2225,7 +2225,7 @@ static ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, con init_data.out = out; IMB_processor_apply_threaded(out->y, sizeof(RenderEffectThread), &init_data, - render_effect_execute_init_handle, render_effect_execute_do_thread); + render_effect_execute_init_handle, render_effect_execute_do_thread); return out; } diff --git a/source/blender/blenlib/BLI_stackdefines.h b/source/blender/blenlib/BLI_stackdefines.h index 24cb043cd43..da9bf5ea04c 100644 --- a/source/blender/blenlib/BLI_stackdefines.h +++ b/source/blender/blenlib/BLI_stackdefines.h @@ -36,7 +36,7 @@ # define _STACK_SWAP_TOTALLOC(stack_a, stack_b) SWAP(unsigned int, _##stack_a##_totalloc, _##stack_b##_totalloc) #else # define STACK_DECLARE(stack) unsigned int _##stack##_index -# define STACK_INIT(stack, tot) ((void)stack, (void)((_##stack##_index) = 0), (void)(tot)) +# define STACK_INIT(stack, tot) ((void)stack, (void)((_##stack##_index) = 0), (void)(0 ? tot : 0)) # define _STACK_SIZETEST(stack, off) (void)(stack), (void)(off) # define _STACK_SWAP_TOTALLOC(stack_a, stack_b) (void)(stack_a), (void)(stack_b) #endif @@ -57,9 +57,12 @@ #define STACK_PEEK_PTR(stack) (BLI_assert(_##stack##_index), &((stack)[_##stack##_index - 1])) /** remove any item from the stack, take care, re-orders */ #define STACK_REMOVE(stack, i) \ - _STACK_BOUNDSTEST(stack, i); \ - if (--_##stack##_index != i) { \ - stack[i] = stack[_##stack##_index]; \ + { \ + const unsigned int _i = i; \ + _STACK_BOUNDSTEST(stack, _i); \ + if (--_##stack##_index != _i) { \ + stack[_i] = stack[_##stack##_index]; \ + } \ } (void)0 #ifdef __GNUC__ #define STACK_SWAP(stack_a, stack_b) { \ diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index fcc7ac34a9e..683b3c4c438 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -49,7 +49,7 @@ _17_, _18_, _19_, _20_, _21_, _22_, _23_, _24_, _25_, _26_, _27_, _28_, _29_, _30_, _31_, _32_, \ count, ...) count #define _VA_NARGS_EXPAND(args) _VA_NARGS_RETURN_COUNT args -#define _VA_NARGS_COUNT_MAX16(...) _VA_NARGS_EXPAND((__VA_ARGS__, \ +#define _VA_NARGS_COUNT_MAX32(...) _VA_NARGS_EXPAND((__VA_ARGS__, \ 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, \ 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) #define _VA_NARGS_OVERLOAD_MACRO2(name, count) name##count @@ -57,8 +57,7 @@ #define _VA_NARGS_OVERLOAD_MACRO(name, count) _VA_NARGS_OVERLOAD_MACRO1(name, count) /* --- expose for re-use --- */ #define VA_NARGS_CALL_OVERLOAD(name, ...) \ - _VA_NARGS_GLUE(_VA_NARGS_OVERLOAD_MACRO(name, _VA_NARGS_COUNT_MAX16(__VA_ARGS__)), (__VA_ARGS__)) - + _VA_NARGS_GLUE(_VA_NARGS_OVERLOAD_MACRO(name, _VA_NARGS_COUNT_MAX32(__VA_ARGS__)), (__VA_ARGS__)) /* useful for finding bad use of min/max */ #if 0 @@ -157,7 +156,7 @@ * ... the compiler optimizes away the temp var */ #ifdef __GNUC__ #define CHECK_TYPE(var, type) { \ - typeof(var) *__tmp; \ + typeof(var) *__tmp; \ __tmp = (type *)NULL; \ (void)__tmp; \ } (void)0 @@ -181,8 +180,14 @@ #endif /* can be used in simple macros */ -#define CHECK_TYPE_INLINE(val, type) \ - ((void)(((type)0) != (val))) +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) +# define CHECK_TYPE_INLINE(val, type) \ + (void)((void)(((type)0) != (0 ? (val) : ((type)0))), \ + _Generic((val), type: 0, const type: 0)) +#else +# define CHECK_TYPE_INLINE(val, type) \ + ((void)(((type)0) != (0 ? (val) : ((type)0)))) +#endif #define CHECK_TYPE_NONCONST(var) { \ void *non_const = 0 ? (var) : NULL; \ @@ -374,13 +379,13 @@ #define IN_RANGE_INCL(a, b, c) ((b < c) ? ((b <= a && a <= c) ? 1 : 0) : ((c <= a && a <= b) ? 1 : 0)) /* unpack vector for args */ -#define UNPACK2(a) ((a)[0]), ((a)[1]) -#define UNPACK3(a) ((a)[0]), ((a)[1]), ((a)[2]) -#define UNPACK4(a) ((a)[0]), ((a)[1]), ((a)[2]), ((a)[3]) -/* op may be '&' or '*' */ -#define UNPACK2OP(op, a) op((a)[0]), op((a)[1]) -#define UNPACK3OP(op, a) op((a)[0]), op((a)[1]), op((a)[2]) -#define UNPACK4OP(op, a) op((a)[0]), op((a)[1]), op((a)[2]), op((a)[3]) +#define UNPACK2(a) ((a)[0]), ((a)[1]) +#define UNPACK3(a) UNPACK2(a), ((a)[2]) +#define UNPACK4(a) UNPACK3(a), ((a)[3]) +/* pre may be '&', '*' or func, post may be '->member' */ +#define UNPACK2_EX(pre, a, post) (pre((a)[0])post), (pre((a)[1])post) +#define UNPACK3_EX(pre, a, post) UNPACK2_EX(pre, a, post), (pre((a)[2])post) +#define UNPACK4_EX(pre, a, post) UNPACK3_EX(pre, a, post), (pre((a)[3])post) /* array helpers */ #define ARRAY_LAST_ITEM(arr_start, arr_dtype, tot) \ diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index 9c5f2ad7542..abf15d57cf7 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -354,7 +354,7 @@ int BLI_countlist(const ListBase *listbase) } /** - * Returns the nth element of \a listbase, numbering from 1. + * Returns the nth element of \a listbase, numbering from 0. */ void *BLI_findlink(const ListBase *listbase, int number) { @@ -372,7 +372,7 @@ void *BLI_findlink(const ListBase *listbase, int number) } /** - * Returns the nth-last element of \a listbase, numbering from 1. + * Returns the nth-last element of \a listbase, numbering from 0. */ void *BLI_rfindlink(const ListBase *listbase, int number) { @@ -390,7 +390,7 @@ void *BLI_rfindlink(const ListBase *listbase, int number) } /** - * Returns the position of \a vlink within \a listbase, numbering from 1, or -1 if not found. + * Returns the position of \a vlink within \a listbase, numbering from 0, or -1 if not found. */ int BLI_findindex(const ListBase *listbase, const void *vlink) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d5eebdb12d2..7b2aaade713 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -434,8 +434,7 @@ void blo_join_main(ListBase *mainlist) while ((tojoin = mainl->next)) { add_main_to_main(mainl, tojoin); BLI_remlink(mainlist, tojoin); - MEM_freeN(tojoin->eval_ctx); - MEM_freeN(tojoin); + BKE_main_free(tojoin); } } diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index b73e1feb0c1..557cc147f19 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -2232,7 +2232,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) } if (sce->r.mode & R_PANORAMA) { - /* all these checks to ensure saved files with svn version keep working... */ + /* all these checks to ensure saved files between released versions keep working... */ if (sce->r.xsch < sce->r.ysch) { Object *obc = blo_do_versions_newlibadr(fd, lib, sce->camera); if (obc && obc->type == OB_CAMERA) { diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 9c539e2dd1c..4bcdd4d9e34 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -39,7 +39,7 @@ set(INC ../nodes/intern ../render/extern/include ../render/intern/include - ../../../intern/opencl + ../../../extern/clew/include ../../../intern/guardedalloc ) @@ -540,4 +540,6 @@ list(APPEND INC data_to_c(${CMAKE_CURRENT_SOURCE_DIR}/operations/COM_OpenCLKernels.cl ${CMAKE_CURRENT_BINARY_DIR}/operations/COM_OpenCLKernels.cl.h SRC) +add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS) + blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h index 2cf2c690d3e..9b22444cf7f 100644 --- a/source/blender/compositor/COM_compositor.h +++ b/source/blender/compositor/COM_compositor.h @@ -208,7 +208,7 @@ extern "C" { * * @see ExecutionGroup.execute Execute a complete ExecutionGroup. Halts until finished or breaked by user * @see ExecutionGroup.scheduleChunkWhenPossible Tries to schedule a single chunk, - * checks if all input data is available. Can trigger dependant chunks to be calculated + * checks if all input data is available. Can trigger dependent chunks to be calculated * @see ExecutionGroup.scheduleAreaWhenPossible Tries to schedule an area. This can be multiple chunks * (is called from [@ref ExecutionGroup.scheduleChunkWhenPossible]) * @see ExecutionGroup.scheduleChunk Schedule a chunk on the WorkScheduler diff --git a/source/blender/compositor/SConscript b/source/blender/compositor/SConscript index 073b100e156..eab40873f64 100644 --- a/source/blender/compositor/SConscript +++ b/source/blender/compositor/SConscript @@ -26,7 +26,7 @@ # ***** END GPL LICENSE BLOCK ***** Import ('env') -defs = ['GLEW_STATIC'] +defs = ['GLEW_STATIC', 'CL_USE_DEPRECATED_OPENCL_1_1_APIS'] sources_intern = env.Glob('intern/*.cpp') sources_nodes = env.Glob('nodes/*.cpp') @@ -37,7 +37,7 @@ incs = [ 'intern', 'nodes', 'operations', - '#/intern/opencl', + '#/extern/clew/include', '../blenkernel', '../blenlib', '../imbuf', diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index b2b8f03c476..d9c16615fb6 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -38,7 +38,7 @@ extern "C" { #include "COM_MemoryProxy.h" #include "COM_SocketReader.h" -#include "OCL_opencl.h" +#include "clew.h" using std::list; using std::min; diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp index 2cfc10cff29..c5b663d2aef 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp @@ -103,7 +103,7 @@ void OpenCLDevice::COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel ker if (offsetIndex != -1) { cl_int error; rcti *rect = memoryBuffer->getRect(); - cl_int2 offset = {rect->xmin, rect->ymin}; + cl_int2 offset = {{rect->xmin, rect->ymin}}; error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -114,7 +114,7 @@ void OpenCLDevice::COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offse { if (offsetIndex != -1) { cl_int error; - cl_int2 offset = {(cl_int)operation->getWidth(), (cl_int)operation->getHeight()}; + cl_int2 offset = {{(cl_int)operation->getWidth(), (cl_int)operation->getHeight()}}; error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -154,7 +154,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo bool breaked = false; for (offsety = 0; offsety < height && (!breaked); offsety += localSize) { - offset[1] = offsety; + offset.y = offsety; if (offsety + localSize < height) { size[1] = localSize; } @@ -169,7 +169,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo else { size[0] = width - offsetx; } - offset[0] = offsetx; + offset.x = offsetx; error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h index 50cc6f25f70..94df2f2b44c 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.h +++ b/source/blender/compositor/intern/COM_OpenCLDevice.h @@ -26,7 +26,7 @@ class OpenCLDevice; #define _COM_OpenCLDevice_h #include "COM_Device.h" -#include "OCL_opencl.h" +#include "clew.h" #include "COM_WorkScheduler.h" #include "COM_ReadBufferOperation.h" diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index d60f9cb7f10..e1016731c7f 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -28,7 +28,7 @@ #include "COM_CPUDevice.h" #include "COM_OpenCLDevice.h" #include "COM_OpenCLKernels.cl.h" -#include "OCL_opencl.h" +#include "clew.h" #include "COM_WriteBufferOperation.h" #include "MEM_guardedalloc.h" @@ -274,7 +274,7 @@ bool WorkScheduler::hasGPUDevices() #endif } -static void clContextError(const char *errinfo, const void *private_info, size_t cb, void *user_data) +static void CL_CALLBACK clContextError(const char *errinfo, const void *private_info, size_t cb, void *user_data) { printf("OPENCL error: %s\n", errinfo); } @@ -326,7 +326,7 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads) g_context = NULL; g_program = NULL; - if (!OCL_init()) /* this will check for errors and skip if already initialized */ + if (clewInit() != CLEW_SUCCESS) /* this will check for errors and skip if already initialized */ return; if (clCreateContextFromType) { diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp index 99655c67a3f..ec9ef6c7e68 100644 --- a/source/blender/compositor/intern/COM_compositor.cpp +++ b/source/blender/compositor/intern/COM_compositor.cpp @@ -32,7 +32,7 @@ extern "C" { #include "COM_compositor.h" #include "COM_ExecutionSystem.h" #include "COM_WorkScheduler.h" -#include "OCL_opencl.h" +#include "clew.h" #include "COM_MovieDistortionOperation.h" static ThreadMutex s_compositorMutex; diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp index 0cea2a7183f..67f52934b13 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp @@ -109,8 +109,8 @@ void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, cl_kernel directionalBlurKernel = device->COM_clCreateKernel("directionalBlurKernel", NULL); cl_int iterations = pow(2.0f, this->m_data->iter); - cl_float2 ltxy = {this->m_tx, this->m_ty}; - cl_float2 centerpix = {this->m_center_x_pix, this->m_center_y_pix}; + cl_float2 ltxy = {{this->m_tx, this->m_ty}}; + cl_float2 centerpix = {{this->m_center_x_pix, this->m_center_y_pix}}; cl_float lsc = this->m_sc; cl_float lrot = this->m_rot; diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index cbc60b5091d..32a1e77b9a7 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -335,12 +335,11 @@ void MathModuloOperation::executePixelSampled(float output[4], float x, float y, void MathAbsoluteOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { - float inputValue1[4]; + float inputValue1[4]; - this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); - output[0] = fabs(inputValue1[0]); + output[0] = fabs(inputValue1[0]); - clampIfNeeded(output); + clampIfNeeded(output); } - diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h index 05d2bb054d3..32cd19f1fb9 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.h +++ b/source/blender/compositor/operations/COM_MathBaseOperation.h @@ -165,8 +165,8 @@ public: class MathAbsoluteOperation : public MathBaseOperation { public: - MathAbsoluteOperation() : MathBaseOperation() {} - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + MathAbsoluteOperation() : MathBaseOperation() {} + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; #endif diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 97078043dc9..b6ab0407711 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -901,10 +901,10 @@ static void rearrange_animchannels_filter_visible(ListBase *anim_data_visible, b { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale, *ale_next; - int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); + int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); /* get all visible channels */ - ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); + ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* now, only keep the ones that are of the types we are interested in */ for (ale = anim_data.first; ale; ale = ale_next) { diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 27ca3039638..0609fcc29e8 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -307,7 +307,7 @@ static int poselib_sanitize_exec(bContext *C, wmOperator *op) /* check if any pose matches this */ /* TODO: don't go looking through the list like this every time... */ for (marker = act->markers.first; marker; marker = marker->next) { - if (IS_EQ(marker->frame, (double)ak->cfra)) { + if (IS_EQ((double)marker->frame, (double)ak->cfra)) { marker->flag = -1; break; } diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h index 4258bbcd359..9fa603966b6 100644 --- a/source/blender/editors/include/BIF_gl.h +++ b/source/blender/editors/include/BIF_gl.h @@ -61,14 +61,14 @@ void cpack(unsigned int x); #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) # define glMultMatrixf(x) \ - glMultMatrixf(_Generic(x, \ + glMultMatrixf(_Generic((x), \ float *: (float *)(x), \ float (*)[4]: (float *)(x), \ const float *: (float *)(x), \ const float (*)[4]: (float *)(x)) \ ) # define glLoadMatrixf(x) \ - glLoadMatrixf(_Generic(x, \ + glLoadMatrixf(_Generic((x), \ float *: (float *)(x), \ float (*)[4]: (float *)(x)) \ ) diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 430c80446b5..dceede7a540 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -56,6 +56,7 @@ struct bContext; struct bPoseChannel; struct bScreen; struct bglMats; +struct rctf; struct rcti; struct wmOperator; struct wmOperatorType; @@ -270,7 +271,7 @@ bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], con /* select */ #define MAXPICKBUF 10000 -short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input, bool do_nearest); +short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const struct rcti *input, bool do_nearest); /* view3d_select.c */ float ED_view3d_select_dist_px(void); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b3f13ccdb35..3be0c9c0524 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -385,7 +385,7 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val) } } -static bool ui_but_is_editable(const uiBut *but) +bool ui_but_is_editable(const uiBut *but) { return !ELEM(but->type, LABEL, SEPR, SEPRLINE, ROUNDBOX, LISTBOX, PROGRESSBAR); } @@ -7199,6 +7199,17 @@ void ui_button_activate_do(bContext *C, ARegion *ar, uiBut *but) ui_do_button(C, but->block, but, &event); } +/** + * Simulate moving the mouse over a button (or navigating to it with arrow keys). + * + * exported so menus can start with a highlighted button, + * even if the mouse isnt over it + */ +void ui_button_activate_over(bContext *C, ARegion *ar, uiBut *but) +{ + button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); +} + void ui_button_execute_begin(struct bContext *UNUSED(C), struct ARegion *ar, uiBut *but, void **active_back) { /* note: ideally we would not have to change 'but->active' however @@ -7261,12 +7272,20 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) retval = WM_UI_HANDLER_CONTINUE; break; case MOUSEMOVE: - /* verify if we are still over the button, if not exit */ - if (!ui_mouse_inside_button(ar, but, event->x, event->y)) { - data->cancel = true; - button_activate_state(C, but, BUTTON_STATE_EXIT); + { + uiBut *but_other = ui_but_find_mouse_over(ar, event); + bool exit = false; + + if (!ui_block_is_menu(block) && + !ui_mouse_inside_button(ar, but, event->x, event->y)) + { + exit = true; } - else if (ui_but_find_mouse_over(ar, event) != but) { + else if (but_other && ui_but_is_editable(but_other) && (but_other != but)) { + exit = true; + } + + if (exit) { data->cancel = true; button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -7277,6 +7296,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) } break; + } case TIMER: { /* handle tooltip timer */ @@ -7860,6 +7880,22 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock int retval; if (but) { + /* Its possible there is an active menu item NOT under the mouse, + * in this case ignore mouse clicks outside the button (but Enter etc is accepted) */ + if (event->val == KM_RELEASE) { + /* pass, needed so we can exit active menu-items when click-dragging out of them */ + } + else if (!ui_mouse_inside_region(but->active->region, event->x, event->y)) { + /* pass, needed to click-exit outside of non-flaoting menus */ + } + else if ((event->type != MOUSEMOVE) && ISMOUSE(event->type)) { + if (!ui_mouse_inside_button(but->active->region, but, event->x, event->y)) { + but = NULL; + } + } + } + + if (but) { ScrArea *ctx_area = CTX_wm_area(C); ARegion *ctx_region = CTX_wm_region(C); @@ -8268,6 +8304,10 @@ static int ui_handle_menu_event( (inside && is_floating && inside_title)) { if (!but || !ui_mouse_inside_button(ar, but, event->x, event->y)) { + if (but) { + button_timers_tooltip_remove(C, but); + } + menu->is_grab = true; copy_v2_v2_int(menu->grab_xy_prev, &event->x); retval = WM_UI_HANDLER_BREAK; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index fa8b6b1ffee..7d03aaea6b3 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -552,6 +552,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol PointerRNA *ui_handle_afterfunc_add_operator(struct wmOperatorType *ot, int opcontext, bool create_props); extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val); extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but); +extern void ui_button_activate_over(struct bContext *C, struct ARegion *ar, uiBut *but); extern void ui_button_execute_begin(struct bContext *C, struct ARegion *ar, uiBut *but, void **active_back); extern void ui_button_execute_end(struct bContext *C, struct ARegion *ar, uiBut *but, void *active_back); extern void ui_button_active_free(const struct bContext *C, uiBut *but); @@ -559,6 +560,7 @@ extern bool ui_button_is_active(struct ARegion *ar) ATTR_WARN_UNUSED_RESULT; extern int ui_button_open_menu_direction(uiBut *but); extern void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, const bool restore); extern uiBut *ui_but_find_activated(struct ARegion *ar); +bool ui_but_is_editable(const uiBut *but); void ui_button_clipboard_free(void); void ui_panel_menu(struct bContext *C, ARegion *ar, Panel *pa); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 32b073ba269..458aca444cb 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -262,28 +262,43 @@ static void UI_OT_unset_property_button(wmOperatorType *ot) /* Copy To Selected Operator ------------------------ */ -static bool copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb, bool *use_path) +static bool copy_to_selected_list( + bContext *C, PointerRNA *ptr, PropertyRNA *prop, + ListBase *r_lb, bool *r_use_path_from_id, char **r_path) { - *use_path = false; + *r_use_path_from_id = false; + *r_path = NULL; - if (RNA_struct_is_a(ptr->type, &RNA_EditBone)) - *lb = CTX_data_collection_get(C, "selected_editable_bones"); - else if (RNA_struct_is_a(ptr->type, &RNA_PoseBone)) - *lb = CTX_data_collection_get(C, "selected_pose_bones"); - else if (RNA_struct_is_a(ptr->type, &RNA_Sequence)) - *lb = CTX_data_collection_get(C, "selected_editable_sequences"); - else { + if (RNA_struct_is_a(ptr->type, &RNA_EditBone)) { + *r_lb = CTX_data_collection_get(C, "selected_editable_bones"); + } + else if (RNA_struct_is_a(ptr->type, &RNA_PoseBone)) { + *r_lb = CTX_data_collection_get(C, "selected_pose_bones"); + } + else if (RNA_struct_is_a(ptr->type, &RNA_Sequence)) { + *r_lb = CTX_data_collection_get(C, "selected_editable_sequences"); + } + else if (ptr->id.data) { ID *id = ptr->id.data; - if (id && GS(id->name) == ID_OB) { - *lb = CTX_data_collection_get(C, "selected_editable_objects"); - *use_path = true; + if (GS(id->name) == ID_OB) { + *r_lb = CTX_data_collection_get(C, "selected_editable_objects"); + *r_use_path_from_id = true; + *r_path = RNA_path_from_ID_to_property(ptr, prop); } - else { - return false; + else if (GS(id->name) == ID_SCE) { + /* Sequencer's ID is scene :/ */ + /* Try to recursively find an RNA_Sequence ancestor, to handle situations like T41062... */ + if ((*r_path = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_Sequence)) != NULL) { + *r_lb = CTX_data_collection_get(C, "selected_editable_sequences"); + } } + return (*r_path != NULL); } - + else { + return false; + } + return true; } @@ -307,47 +322,54 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll) /* if there is a valid property that is editable... */ if (ptr.data && prop) { char *path = NULL; - bool use_path; + bool use_path_from_id; CollectionPointerLink *link; ListBase lb; - if (!copy_to_selected_list(C, &ptr, &lb, &use_path)) + if (!copy_to_selected_list(C, &ptr, prop, &lb, &use_path_from_id, &path)) return success; - if (!use_path || (path = RNA_path_from_ID_to_property(&ptr, prop))) { - for (link = lb.first; link; link = link->next) { - if (link->ptr.data != ptr.data) { - if (use_path) { - lprop = NULL; - RNA_id_pointer_create(link->ptr.id.data, &idptr); - RNA_path_resolve_property(&idptr, path, &lptr, &lprop); - } - else { - lptr = link->ptr; - lprop = prop; - } + for (link = lb.first; link; link = link->next) { + if (link->ptr.data != ptr.data) { + if (use_path_from_id) { + /* Path relative to ID. */ + lprop = NULL; + RNA_id_pointer_create(link->ptr.id.data, &idptr); + RNA_path_resolve_property(&idptr, path, &lptr, &lprop); + } + else if (path) { + /* Path relative to elements from list. */ + lprop = NULL; + RNA_path_resolve_property(&link->ptr, path, &lptr, &lprop); + } + else { + lptr = link->ptr; + lprop = prop; + } - if (lprop == prop) { - if (RNA_property_editable(&lptr, lprop)) { - if (poll) { + if (lptr.data == ptr.data) { + /* lptr might not be the same as link->ptr! */ + continue; + } + + if (lprop == prop) { + if (RNA_property_editable(&lptr, lprop)) { + if (poll) { + success = true; + break; + } + else { + if (RNA_property_copy(&lptr, &ptr, prop, (all) ? -1 : index)) { + RNA_property_update(C, &lptr, prop); success = true; - break; - } - else { - if (RNA_property_copy(&lptr, &ptr, prop, (all) ? -1 : index)) { - RNA_property_update(C, &lptr, prop); - success = true; - } } } } } } - - if (path) - MEM_freeN(path); } + MEM_SAFE_FREE(path); BLI_freelistN(&lb); } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 85bf15e15cf..3629c72ce49 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1872,7 +1872,7 @@ static void ui_update_block_buts_rgb(uiBlock *block, const float rgb[3], bool is if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart); rgb_float_to_uchar(rgb_gamma_uchar, rgb_gamma); - BLI_snprintf(col, sizeof(col), "%02X%02X%02X", UNPACK3OP((unsigned int), rgb_gamma_uchar)); + BLI_snprintf(col, sizeof(col), "%02X%02X%02X", UNPACK3_EX((unsigned int), rgb_gamma_uchar, )); strcpy(bt->poin, col); } @@ -2160,7 +2160,7 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper } rgb_float_to_uchar(rgb_gamma_uchar, rgb_gamma); - BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", UNPACK3OP((unsigned int), rgb_gamma_uchar)); + BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", UNPACK3_EX((unsigned int), rgb_gamma_uchar, )); yco = -3.0f * UI_UNIT_Y; bt = uiDefBut(block, TEX, 0, IFACE_("Hex: "), 0, yco, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)")); @@ -2408,6 +2408,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); if (pup->popup) { + uiBut *but_activate = NULL; uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT); uiBlockSetDirection(block, direction); @@ -2421,6 +2422,10 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi * block to be under the mouse */ offset[0] = -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect)); offset[1] = -(bt->rect.ymin + 0.5f * UI_UNIT_Y); + + if (ui_but_is_editable(bt)) { + but_activate = bt; + } } else { /* position mouse at 0.8*width of the button and below the tile @@ -2430,6 +2435,20 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi offset[0] = min_ii(offset[0], -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect))); offset[1] = 2.1 * UI_UNIT_Y; + + for (bt = block->buttons.first; bt; bt = bt->next) { + if (ui_but_is_editable(bt)) { + but_activate = bt; + break; + } + } + } + + /* in rare cases this is needed since moving the popup + * to be within the window bounds may move it away from the mouse, + * This ensures we set an item to be active. */ + if (but_activate) { + ui_button_activate_over(C, handle->region, but_activate); } block->minbounds = minwidth; diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index 4d2ea0e64f4..a4130540b1b 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -250,7 +250,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr) row = uiLayoutRow(box, false); split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT); - uiItemL(split, IFACE_("Transformation Type"), ICON_NONE); + uiItemL(split, IFACE_("Transformation Type"), ICON_NONE); uiItemR(split, imfptr, "export_transformation_type_selection", 0, "", ICON_NONE); row = uiLayoutRow(box, false); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 3b60bbbb37e..93956128b84 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -596,7 +596,7 @@ static int editmode_toggle_poll(bContext *C) if ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT)) return 0; - return (ELEM(ob->type, OB_MESH, OB_ARMATURE, OB_FONT, OB_MBALL, OB_LATTICE, OB_SURF, OB_CURVE)); + return OB_TYPE_SUPPORT_EDITMODE(ob->type); } void OBJECT_OT_editmode_toggle(wmOperatorType *ot) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 8d39632e210..13e010d2f97 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -7183,7 +7183,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short if (ob->restrictflag & OB_RESTRICT_RENDER) return; - if (!has_particles && (ob->transflag & OB_DUPLI)) + if (!has_particles && (ob->transflag & (OB_DUPLI & ~OB_DUPLIFRAMES))) return; } } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 1d3371abd92..4ca9eea578c 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -465,11 +465,13 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip) * properties are always being edited, weak */ viewlock = rv3d->viewlock; - if ((viewlock & RV3D_LOCKED) == 0) + if ((viewlock & RV3D_LOCKED) == 0) { + do_clip = (viewlock & RV3D_BOXCLIP) != 0; viewlock = 0; - else if ((viewlock & RV3D_BOXVIEW) == 0) { - viewlock &= ~RV3D_BOXCLIP; + } + else if ((viewlock & RV3D_BOXVIEW) == 0 && (viewlock & RV3D_BOXCLIP) != 0) { do_clip = true; + viewlock &= ~RV3D_BOXCLIP; } for (; ar; ar = ar->prev) { diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index d3f233905c4..012f9185d8b 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -130,15 +130,15 @@ typedef struct TransDataExtension { // float drotAxis[3]; /* Initial object drotAxis, TODO: not yet implemented */ float dquat[4]; /* Initial object dquat */ float dscale[3]; /* Initial object dscale */ - float *rot; /* Rotation of the data to transform (Faculative) */ + float *rot; /* Rotation of the data to transform */ float irot[3]; /* Initial rotation */ - float *quat; /* Rotation quaternion of the data to transform (Faculative) */ + float *quat; /* Rotation quaternion of the data to transform */ float iquat[4]; /* Initial rotation quaternion */ - float *rotAngle; /* Rotation angle of the data to transform (Faculative) */ + float *rotAngle; /* Rotation angle of the data to transform */ float irotAngle; /* Initial rotation angle */ - float *rotAxis; /* Rotation axis of the data to transform (Faculative) */ + float *rotAxis; /* Rotation axis of the data to transform */ float irotAxis[4]; /* Initial rotation axis */ - float *size; /* Size of the data to transform (Faculative) */ + float *size; /* Size of the data to transform */ float isize[3]; /* Initial size */ float obmat[4][4]; /* Object matrix */ float l_smtx[3][3]; /* use instead of td->smtx, It is the same but without the 'bone->bone_mat', see TD_PBONE_LOCAL_MTX_C */ diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 47fbfbe3eba..56b12fcdcda 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -86,7 +86,7 @@ void ED_editors_init(bContext *C) /* This is called during initialization, so we don't want to store any reports */ ReportList *reports = CTX_wm_reports(C); - int reports_flag_prev = reports->flag &= ~RPT_STORE; + int reports_flag_prev = reports->flag & ~RPT_STORE; SWAP(int, reports->flag, reports_flag_prev); diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp index 7239b1b4a7b..1ef29792d56 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp @@ -186,9 +186,9 @@ PyDoc_STRVAR(CurvePoint_fedge_doc, static PyObject *CurvePoint_fedge_get(BPy_CurvePoint *self, void *UNUSED(closure)) { - SVertex *A = self->cp->A(); - Interface0D *B = (Interface0D *)self->cp->B(); - return Any_BPy_Interface1D_from_Interface1D(*(A->getFEdge(*B))); + SVertex *A = self->cp->A(); + Interface0D *B = (Interface0D *)self->cp->B(); + return Any_BPy_Interface1D_from_Interface1D(*(A->getFEdge(*B))); } PyDoc_STRVAR(CurvePoint_t2d_doc, diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 0cd463555d7..61f095fac08 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -616,7 +616,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, } mat_orig_to_new = MEM_mallocN(sizeof(*mat_orig_to_new) * dm->totmat, - "GPU_buffer_setup.mat_orig_to_new"); + "GPU_buffer_setup.mat_orig_to_new"); cur_index_per_mat = MEM_mallocN(sizeof(int) * object->totmaterial, "GPU_buffer_setup.cur_index_per_mat"); for (i = 0; i < object->totmaterial; i++) { diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index cb6d17ab6c7..1ba24f5d7d4 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -237,7 +237,7 @@ typedef struct PreviewImage { # undef GS #endif // #define GS(a) (*((short *)(a))) -#define GS(a) (CHECK_TYPE_INLINE(a, const char *), (*((short *)(a)))) +#define GS(a) (CHECK_TYPE_INLINE(a, char *), (*((short *)(a)))) #define ID_NEW(a) if ( (a) && (a)->id.newid ) (a) = (void *)(a)->id.newid #define ID_NEW_US(a) if ( (a)->id.newid) { (a) = (void *)(a)->id.newid; (a)->id.us++; } diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index a2bbaf67c1a..ba2dd8b5d69 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -927,9 +927,22 @@ bool RNA_path_resolve_property(PointerRNA *ptr, const char *path, bool RNA_path_resolve_property_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index); +typedef struct PropertyElemRNA PropertyElemRNA; +struct PropertyElemRNA { + PropertyElemRNA *next, *prev; + PointerRNA ptr; + PropertyRNA *prop; + int index; +}; +bool RNA_path_resolve_elements(PointerRNA *ptr, const char *path, struct ListBase *r_elements); + char *RNA_path_from_ID_to_struct(PointerRNA *ptr); char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop); +char *RNA_path_resolve_from_type_to_property( + struct PointerRNA *ptr, struct PropertyRNA *prop, + const struct StructRNA *type); + char *RNA_path_full_ID_py(struct ID *id); char *RNA_path_full_struct_py(struct PointerRNA *ptr); char *RNA_path_full_property_py(struct PointerRNA *ptr, struct PropertyRNA *prop, int index); diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index c0c045593ca..83fe56102ac 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -625,6 +625,10 @@ static void rna_def_library(BlenderRNA *brna) prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Library"); RNA_def_property_ui_text(prop, "Parent", ""); + + prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "packedfile"); + RNA_def_property_ui_text(prop, "Packed File", ""); } void RNA_def_ID(BlenderRNA *brna) { diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 271f9079162..8c76edd2f17 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4015,11 +4015,14 @@ static bool rna_path_parse_array_index(const char **path, PointerRNA *ptr, Prope } static bool rna_path_parse(PointerRNA *ptr, const char *path, - PointerRNA *r_ptr, PropertyRNA **r_prop, int *index, + PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index, + ListBase *r_elements, const bool eval_pointer) { PropertyRNA *prop; PointerRNA curptr; + PropertyElemRNA *prop_elem = NULL; + int index = -1; char fixedbuf[256]; int type; @@ -4061,6 +4064,14 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path, if (!prop) return false; + if (r_elements) { + prop_elem = MEM_mallocN(sizeof(PropertyElemRNA), __func__); + prop_elem->ptr = curptr; + prop_elem->prop = prop; + prop_elem->index = -1; /* index will be added later, if needed. */ + BLI_addtail(r_elements, prop_elem); + } + type = RNA_property_type(prop); /* now look up the value of this property if it is a pointer or @@ -4076,7 +4087,7 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path, curptr = nextptr; prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */ - if (index) *index = -1; + index = -1; } break; } @@ -4093,21 +4104,38 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path, curptr = nextptr; prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */ - if (index) *index = -1; + index = -1; } break; } default: - if (index) { - if (!rna_path_parse_array_index(&path, &curptr, prop, index)) + if (r_index || prop_elem) { + if (!rna_path_parse_array_index(&path, &curptr, prop, &index)) { return false; + } + + if (prop_elem) { + prop_elem->index = index; + } } break; } } - *r_ptr = curptr; - *r_prop = prop; + if (r_ptr) + *r_ptr = curptr; + if (r_prop) + *r_prop = prop; + if (r_index) + *r_index = index; + + if (prop_elem && (prop_elem->ptr.data != curptr.data || prop_elem->prop != prop || prop_elem->index != index)) { + PropertyElemRNA *prop_elem = MEM_mallocN(sizeof(PropertyElemRNA), __func__); + prop_elem->ptr = curptr; + prop_elem->prop = prop; + prop_elem->index = index; + BLI_addtail(r_elements, prop_elem); + } return true; } @@ -4120,7 +4148,7 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path, */ bool RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop) { - if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, true)) + if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, true)) return false; return r_ptr->data != NULL; @@ -4134,7 +4162,7 @@ bool RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prop */ bool RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index) { - if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, true)) + if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, true)) return false; return r_ptr->data != NULL; @@ -4149,7 +4177,7 @@ bool RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, */ bool RNA_path_resolve_property(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop) { - if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, false)) + if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, false)) return false; return r_ptr->data != NULL && *r_prop != NULL; @@ -4165,12 +4193,25 @@ bool RNA_path_resolve_property(PointerRNA *ptr, const char *path, PointerRNA *r_ */ bool RNA_path_resolve_property_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index) { - if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, false)) + if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, false)) return false; return r_ptr->data != NULL && *r_prop != NULL; } +/** + * Resolve the given RNA Path into a linked list of PropertyElemRNA's. + * + * To be used when complex operations over path are needed, like e.g. get relative paths, to avoid too much + * string operations. + * + * \return True if there was no error while resolving the path + * \note Assumes all pointers provided are valid + */ +bool RNA_path_resolve_elements(PointerRNA *ptr, const char *path, ListBase *r_elements) +{ + return rna_path_parse(ptr, path, NULL, NULL, NULL, r_elements, false); +} char *RNA_path_append(const char *path, PointerRNA *UNUSED(ptr), PropertyRNA *prop, int intkey, const char *strkey) { @@ -4498,6 +4539,47 @@ char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop) } /** + * \return the path to given ptr/prop from the closest ancestor of given type, if any (else return NULL). + */ +char *RNA_path_resolve_from_type_to_property( + PointerRNA *ptr, PropertyRNA *prop, + const StructRNA *type) +{ + /* Try to recursively find an "type"'d ancestor, + * to handle situations where path from ID is not enough. */ + PointerRNA idptr; + ListBase path_elems = {NULL}; + char *path = NULL; + char *full_path = RNA_path_from_ID_to_property(ptr, prop); + + if (full_path == NULL) { + return NULL; + } + + RNA_id_pointer_create(ptr->id.data, &idptr); + + if (RNA_path_resolve_elements(&idptr, full_path, &path_elems)) { + PropertyElemRNA *prop_elem; + + for (prop_elem = path_elems.last; prop_elem; prop_elem = prop_elem->prev) { + if (RNA_struct_is_a(prop_elem->ptr.type, type)) { + char *ref_path = RNA_path_from_ID_to_struct(&prop_elem->ptr); + if (ref_path) { + path = BLI_strdup(full_path + strlen(ref_path) + 1); /* +1 for the linking '.' */ + MEM_freeN(ref_path); + } + break; + } + } + + BLI_freelistN(&path_elems); + } + + MEM_freeN(full_path); + return path; +} + +/** * Get the ID as a python representation, eg: * bpy.data.foo["bar"] */ diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 8ec69997b48..83b7a81c649 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -417,7 +417,7 @@ void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values); #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) # define USE_RNA_RANGE_CHECK # define TYPEOF_MAX(x) \ - _Generic(x, \ + _Generic((x), \ bool: 1, \ char: CHAR_MAX, signed char: SCHAR_MAX, unsigned char: UCHAR_MAX, \ signed short: SHRT_MAX, unsigned short: USHRT_MAX, \ @@ -425,7 +425,7 @@ void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values); float: FLT_MAX, double: DBL_MAX) # define TYPEOF_MIN(x) \ - _Generic(x, \ + _Generic((x), \ bool: 0, \ char: CHAR_MIN, signed char: SCHAR_MIN, unsigned char: 0, \ signed short: SHRT_MIN, unsigned short: 0, \ diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index e0365f9ea6c..188fb01d23d 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -228,3 +228,9 @@ if(WITH_PLAYER) endif() setup_liblinks(blenderplayer) + +# We put CLEW and CUEW here because OPENSUBDIV_LIBRARIES dpeends on them.. +if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV) + target_link_libraries(blenderplayer "extern_clew") + target_link_libraries(blenderplayer "extern_cuew") +endif() |