diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-12 04:38:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-12 04:38:57 +0400 |
commit | ca662d0fd651ad0fa159bbeacb31a49f11f37526 (patch) | |
tree | 11aec4952e6d3478b8755850accb300c86591875 /source | |
parent | 07687cef7dcfda9e6f668e491515b61c072d82c9 (diff) | |
parent | 56460a0340b6afdb26fa19eb5bd92eda1a1693aa (diff) |
svn merge -r40124:40140 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source')
20 files changed, 94 insertions, 92 deletions
diff --git a/source/blender/editors/include/ED_navmesh_conversion.h b/source/blender/blenkernel/BKE_navmesh_conversion.h index 71b60cc4e4a..acb3c2963a9 100644 --- a/source/blender/editors/include/ED_navmesh_conversion.h +++ b/source/blender/blenkernel/BKE_navmesh_conversion.h @@ -27,12 +27,8 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifndef NAVMESH_CONVERSION_H -#define NAVMESH_CONVERSION_H - -#ifdef __cplusplus -extern "C" { -#endif +#ifndef BKE_NAVMESH_CONVERSION_H +#define BKE_NAVMESH_CONVERSION_H struct DerivedMesh; @@ -65,32 +61,4 @@ bool polyIsConvex(const unsigned short* p, const int vertsPerPoly, const float* int polyFindVertex(const unsigned short* p, const int vertsPerPoly, unsigned short vertexIdx); float distPointToSegmentSq(const float* point, const float* a, const float* b); - -inline int bit(int a, int b) -{ - return (a & (1 << b)) >> b; -} - -inline void intToCol(int i, float* col) -{ - int r = bit(i, 0) + bit(i, 3) * 2 + 1; - int g = bit(i, 1) + bit(i, 4) * 2 + 1; - int b = bit(i, 2) + bit(i, 5) * 2 + 1; - col[0] = 1 - r*63.0f/255.0f; - col[1] = 1 - g*63.0f/255.0f; - col[2] = 1 - b*63.0f/255.0f; -} - -inline float area2(const float* a, const float* b, const float* c) -{ - return (b[0] - a[0]) * (c[2] - a[2]) - (c[0] - a[0]) * (b[2] - a[2]); -} -inline bool left(const float* a, const float* b, const float* c) -{ - return area2(a, b, c) < 0; -} - -#ifdef __cplusplus -} -#endif #endif //NAVMESH_CONVERSION_H diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 9b233db29dd..58f9c88ed21 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -357,6 +357,16 @@ if(WITH_LZMA) add_definitions(-DWITH_LZMA) endif() +if(WITH_GAMEENGINE) + list(APPEND INC_SYS + ../../../extern/recastnavigation/Recast/Include + ) + list(APPEND SRC + intern/navmesh_conversion.cpp + BKE_navmesh_conversion.h + ) +endif() + if(MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") endif() diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index ca7dfcaa355..5da24bc43be 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -1,7 +1,8 @@ #!/usr/bin/python Import ('env') +import os -sources = env.Glob('intern/*.c') +sources = env.Glob('intern/*.c') + env.Glob('intern/*.cpp') incs = '. #/intern/guardedalloc #/intern/memutil ../editors/include' incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager' @@ -91,6 +92,12 @@ if env['WITH_BF_LZMA']: incs += ' #/extern/lzma' defs.append('WITH_LZMA') +if env['WITH_BF_GAMEENGINE']: + incs += ' #/extern/recastnavigation/Recast/Include' + defs.append('WITH_GAMEENGINE') +else: + sources.remove('intern' + os.sep + 'navmesh_conversion.cpp') + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/editors/util/navmesh_conversion.cpp b/source/blender/blenkernel/intern/navmesh_conversion.cpp index 8b3fee59e1a..245a2b23091 100644 --- a/source/blender/editors/util/navmesh_conversion.cpp +++ b/source/blender/blenkernel/intern/navmesh_conversion.cpp @@ -26,18 +26,28 @@ * * ***** END GPL LICENSE BLOCK ***** */ + #include <math.h> #include "Recast.h" - extern "C"{ -#include "ED_navmesh_conversion.h" +#include "BKE_navmesh_conversion.h" #include "DNA_meshdata_types.h" #include "BKE_cdderivedmesh.h" #include "BLI_math.h" } +inline float area2(const float* a, const float* b, const float* c) +{ + return (b[0] - a[0]) * (c[2] - a[2]) - (c[0] - a[0]) * (b[2] - a[2]); +} + +inline bool left(const float* a, const float* b, const float* c) +{ + return area2(a, b, c) < 0; +} + int polyNumVerts(const unsigned short* p, const int vertsPerPoly) { int nv = 0; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index dbb2e7860c5..a3237da6234 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1260,7 +1260,7 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int size_flags = seq->strip->proxy->build_size_flags; /* only use proxies, if they are enabled (even if present!) */ - if (psize != IMB_PROXY_NONE && ((size_flags & psize) != psize)) { + if (psize == IMB_PROXY_NONE || ((size_flags & psize) != psize)) { return NULL; } diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 53c9fc4d82c..1e7c18dc6ac 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -531,7 +531,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) bConstraint *con= NULL; short searchtype= VISUALKEY_NONE; short has_parent = FALSE; - char *identifier= NULL; + const char *identifier= NULL; /* validate data */ // TODO: this check is probably not needed, but it won't hurt @@ -548,7 +548,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) Object *ob= (Object *)ptr->data; con= ob->constraints.first; - identifier= (char *)RNA_property_identifier(prop); + identifier= RNA_property_identifier(prop); has_parent= (ob->parent != NULL); } else if (ptr->type == &RNA_PoseBone) { @@ -556,7 +556,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) bPoseChannel *pchan= (bPoseChannel *)ptr->data; con= pchan->constraints.first; - identifier= (char *)RNA_property_identifier(prop); + identifier= RNA_property_identifier(prop); has_parent= (pchan->parent != NULL); } @@ -565,12 +565,18 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) return 0; /* location or rotation identifiers only... */ - if (strstr(identifier, "location")) + if(identifier == NULL) { + printf("%s failed: NULL identifier\n", __func__); + return 0; + } + else if (strstr(identifier, "location")) { searchtype= VISUALKEY_LOC; - else if (strstr(identifier, "rotation")) + } + else if (strstr(identifier, "rotation")) { searchtype= VISUALKEY_ROT; + } else { - printf("visualkey_can_use() failed: identifier - '%s' \n", identifier); + printf("%s failed: identifier - '%s' \n", __func__, identifier); return 0; } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3e3e6da188e..59bbe67a8e2 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -334,7 +334,7 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index) } /* create buttons for an item with an RNA array */ -static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int h, int expand, int slider, int toggle, int icon_only) +static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int UNUSED(h), int expand, int slider, int toggle, int icon_only) { uiStyle *style= layout->root->style; uiBut *but; @@ -407,7 +407,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in if (totdim != 2) return; /* only 2D matrices supported in UI so far */ w /= dim_size[0]; - h /= dim_size[1]; + /* h /= dim_size[1]; */ /* UNUSED */ for(a=0; a<len; a++) { col= a % dim_size[0]; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 7382188d62a..c7ada4a5801 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1158,8 +1158,8 @@ void filelist_from_main(struct FileList *filelist) /* XXXXX TODO: if databrowse F4 or append/link filelist->hide_parent has to be set */ if (!filelist->hide_parent) filelist->numfiles+= 1; - filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry)); - + filelist->filelist= filelist->numfiles > 0 ? (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry)) : NULL; + files = filelist->filelist; if (!filelist->hide_parent) { diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index c33316620eb..e9b45da6bce 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -226,7 +226,7 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh SpaceNla *snla = (SpaceNla *)ac->sl; View2D *v2d= &ac->ar->v2d; rctf rectf; - float ymin=(float)(-NLACHANNEL_HEIGHT(snla)), ymax=0; + float ymin /* =(float)(-NLACHANNEL_HEIGHT(snla)) */ /* UNUSED */, ymax=0; /* convert border-region to view coordinates */ UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin+2, &rectf.xmin, &rectf.ymin); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 751a92c811e..c4fb9c2f3d6 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -5309,9 +5309,13 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, { /* snap key to nearest frame? */ if (autosnap == SACTSNAP_FRAME) { + +#if 0 /* 'doTime' disabled for now */ + const Scene *scene= t->scene; const short doTime= 0; //getAnimEdit_DrawTime(t); // NOTE: this works, but may be confusing behaviour given the option's label, hence disabled const double secf= FPS; +#endif double val; /* convert frame to nla-action time (if needed) */ @@ -5320,11 +5324,17 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, else val= *(td->val); +#if 0 /* 'doTime' disabled for now */ + /* do the snapping to nearest frame/second */ - if (doTime) + if (doTime) { val= (float)( floor((val/secf) + 0.5f) * secf ); + } else +#endif + { val= (float)( floor(val+0.5f) ); + } /* convert frame out of nla-action time */ if (adt) diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index 97f5d508d26..843af272362 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -89,16 +89,4 @@ set(SRC ../include/UI_view2d.h ) -if(WITH_GAMEENGINE) - list(APPEND INC - ../../../../extern/recastnavigation/Recast/Include - ) - - list(APPEND SRC - navmesh_conversion.cpp - - ../include/ED_navmesh_conversion.h - ) -endif() - blender_add_lib(bf_editor_util "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/util/SConscript b/source/blender/editors/util/SConscript index 04d783e1ee1..16501c59551 100644 --- a/source/blender/editors/util/SConscript +++ b/source/blender/editors/util/SConscript @@ -1,15 +1,11 @@ #!/usr/bin/python Import ('env') -sources = env.Glob('*.c') + env.Glob('*.cpp') +sources = env.Glob('*.c') incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../makesrna ../../bmesh' -incs += ' #extern/recastnavigation/Recast/Include' incs += ' ../../blenloader' -if not env['WITH_BF_GAMEENGINE']: - sources.remove('navmesh_conversion.cpp') - env.BlenderLib ( 'bf_editors_util', sources, Split(incs), [], libtype=['core','player'], priority=[330,210] ) diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 9a35e9762df..5147698927b 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -124,7 +124,6 @@ if(WITH_GAMEENGINE) list(APPEND INC ../gpu ../../../extern/recastnavigation/Recast/Include - ../editors/include # XXX - BAD LEVEL CALL, REMOVE BEFORE RELEASE ) endif() diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript index d6f1d5108f8..635fd2100ba 100644 --- a/source/blender/modifiers/SConscript +++ b/source/blender/modifiers/SConscript @@ -7,8 +7,7 @@ incs = '. ./intern' incs += ' #/intern/guardedalloc #/intern/decimation/extern #/intern/bsp/extern #/intern/elbeem/extern #/extern/glew/include' incs += ' ../render/extern/include ../blenloader ../bmesh' incs += ' ../include ../blenlib ../makesdna ../makesrna ../blenkernel ../blenkernel/intern' -incs += ' ../editors/include ../gpu' -incs += ' #extern/recastnavigation/Recast/Include' +incs += ' ../gpu' incs += ' ' + env['BF_ZLIB_INC'] @@ -21,6 +20,10 @@ defs += ['WITH_MOD_DECIMATE'] if env['BF_NO_ELBEEM']: defs.append('DISABLE_ELBEEM') +if env['WITH_BF_GAMEENGINE']: + incs += ' #/extern/recastnavigation/Recast/Include' + defs.append('WITH_GAMEENGINE') + env.BlenderLib ( libname = 'bf_modifiers', sources = sources, includes = Split(incs), defines=defs, libtype=['core','player'], priority = [80, 40] ) diff --git a/source/blender/modifiers/intern/MOD_navmesh.cpp b/source/blender/modifiers/intern/MOD_navmesh.cpp index d32281c12b6..927085033fc 100644 --- a/source/blender/modifiers/intern/MOD_navmesh.cpp +++ b/source/blender/modifiers/intern/MOD_navmesh.cpp @@ -34,11 +34,10 @@ extern "C"{ #ifdef WITH_GAMEENGINE -# include "ED_navmesh_conversion.h" -# include "BIF_gl.h" +# include "BKE_navmesh_conversion.h" +# include "GL/glew.h" # include "GPU_buffers.h" # include "GPU_draw.h" -# include "UI_resources.h" #endif #include "DNA_mesh_types.h" @@ -54,6 +53,22 @@ extern "C"{ #include "BKE_customdata.h" #include "MEM_guardedalloc.h" +inline int bit(int a, int b) +{ + return (a & (1 << b)) >> b; +} + +inline void intToCol(int i, float* col) +{ + int r = bit(i, 0) + bit(i, 3) * 2 + 1; + int g = bit(i, 1) + bit(i, 4) * 2 + 1; + int b = bit(i, 2) + bit(i, 5) * 2 + 1; + col[0] = 1 - r*63.0f/255.0f; + col[1] = 1 - g*63.0f/255.0f; + col[2] = 1 - b*63.0f/255.0f; +} + + static void initData(ModifierData *md) { /* NavMeshModifierData *nmmd = (NavMeshModifierData*) md; */ /* UNUSED */ diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index c50005bef67..28f0f983454 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -107,8 +107,7 @@ void ntreeGPUMaterialNodes(bNodeTree *ntree, GPUMaterial *mat) { bNodeTreeExec *exec; - if(!ntree->execdata) - exec = ntreeShaderBeginExecTree(ntree, 1); + exec = ntreeShaderBeginExecTree(ntree, 1); ntreeExecGPUNodes(exec, mat, 1); diff --git a/source/creator/creator.c b/source/creator/creator.c index 67109d04baa..8f21920c799 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -571,22 +571,17 @@ static int set_output(int argc, const char **argv, void *data) static int set_engine(int argc, const char **argv, void *data) { bContext *C = data; - if (argc >= 1) - { - if (!strcmp(argv[1],"help")) - { + if (argc >= 2) { + if (!strcmp(argv[1], "help")) { RenderEngineType *type = NULL; - - for( type = R_engines.first; type; type = type->next ) - { + printf("Blender Engine Listing:\n"); + for( type = R_engines.first; type; type = type->next ) { printf("\t%s\n", type->idname); } exit(0); } - else - { - if (CTX_data_scene(C)==NULL) - { + else { + if (CTX_data_scene(C)==NULL) { printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n"); } else { @@ -603,7 +598,7 @@ static int set_engine(int argc, const char **argv, void *data) } else { - printf("\nEngine not specified.\n"); + printf("\nEngine not specified, give 'help' for a list of available engines.\n"); return 0; } } diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 4b2d828fe81..9d8b1781869 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -59,7 +59,6 @@ set(INC_SYS ${GLEW_INCLUDE_PATH} ../../../extern/recastnavigation/Recast/Include ../../../extern/recastnavigation/Detour/Include - ../../blender/editors/include ) set(SRC diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp index 26990f6e82b..f72c98fb4bf 100644 --- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp +++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp @@ -38,9 +38,7 @@ extern "C" { #include "BKE_customdata.h" #include "BKE_cdderivedmesh.h" #include "BKE_DerivedMesh.h" - - -#include "ED_navmesh_conversion.h" +#include "BKE_navmesh_conversion.h" } #include "KX_PythonInit.h" diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 7c9785c24e7..9b453ed76d5 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -21,7 +21,6 @@ incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common' incs += ' #source/gameengine/Physics/Dummy' incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #source/blender/gpu' incs += ' #extern/recastnavigation/Recast/Include #extern/recastnavigation/Detour/Include' -incs += ' #source/blender/editors/include' incs += ' ' + env['BF_BULLET_INC'] incs += ' ' + env['BF_OPENGL_INC'] |