diff options
author | Nick Samarin <nicks1987@bigmir.net> | 2010-10-03 20:28:28 +0400 |
---|---|---|
committer | Nick Samarin <nicks1987@bigmir.net> | 2010-10-03 20:28:28 +0400 |
commit | 90ab716cd5214b23f98fa7bc31b5df002a198fa7 (patch) | |
tree | 8427f09c85826fbdb8187e1868c6bc95f8a20e5c /source/gameengine | |
parent | ee0f4e8d76f603a9f3a5f6b037ad4b98084cda42 (diff) | |
parent | cfc4399ab3dfd2ec3346ec087e835664e04b1599 (diff) |
synched with trunk at revision 32129
Diffstat (limited to 'source/gameengine')
129 files changed, 943 insertions, 713 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index a83ec7e132f..5a0522a9aa6 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -32,7 +32,7 @@ #include <stdlib.h> #include <stdio.h> -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // don't show stl-warnings #pragma warning (disable:4786) #endif @@ -72,6 +72,7 @@ extern "C" { /***/ #include "DNA_view3d_types.h" #include "DNA_screen_types.h" +#include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" #include "BKE_global.h" #include "BKE_report.h" @@ -154,6 +155,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c bgl::InitExtensions(true); + // VBO code for derived mesh is not compatible with BGE (couldn't find why), so disable + int disableVBO = (U.gameflags & USER_DISABLE_VBO); + U.gameflags |= USER_DISABLE_VBO; + do { View3D *v3d= CTX_wm_view3d(C); @@ -388,9 +393,15 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->InitDome(scene->gm.dome.res, scene->gm.dome.mode, scene->gm.dome.angle, scene->gm.dome.resbuf, scene->gm.dome.tilt, scene->gm.dome.warptext); // initialize 3D Audio Settings - AUD_set3DSetting(AUD_3DS_SPEED_OF_SOUND, scene->audio.speed_of_sound); - AUD_set3DSetting(AUD_3DS_DOPPLER_FACTOR, scene->audio.doppler_factor); - AUD_set3DSetting(AUD_3DS_DISTANCE_MODEL, scene->audio.distance_model); + AUD_setSpeedOfSound(scene->audio.speed_of_sound); + AUD_setDopplerFactor(scene->audio.doppler_factor); + AUD_setDistanceModel(AUD_DistanceModel(scene->audio.distance_model)); + + // from see blender.c: + // FIXME: this version patching should really be part of the file-reading code, + // but we still get too many unrelated data-corruption crashes otherwise... + if (blenderdata->versionfile < 250) + do_versions_ipos_to_animato(blenderdata); if (sceneconverter) { @@ -557,6 +568,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME); + if (!disableVBO) + U.gameflags &= ~USER_DISABLE_VBO; + if (bfd) BLO_blendfiledata_free(bfd); BLI_strncpy(G.sce, oldsce, sizeof(G.sce)); diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt index 57d28561647..853cba543a4 100644 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ b/source/gameengine/BlenderRoutines/CMakeLists.txt @@ -44,7 +44,7 @@ IF(WITH_FFMPEG) ENDIF(WITH_FFMPEG) IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) + LIST(APPEND INC ${PYTHON_INC}) ELSE(WITH_PYTHON) ADD_DEFINITIONS(-DDISABLE_PYTHON) ENDIF(WITH_PYTHON) diff --git a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h index 5bdf0ccd81d..b7f7be4a279 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h @@ -29,7 +29,7 @@ #ifndef __KX_BLENDERINPUTDEVICE #define __KX_BLENDERINPUTDEVICE -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning(disable : 4786) // shut off 255 char limit debug template warning #endif diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp index e8cb25af868..bc7996a98c0 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp @@ -26,7 +26,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // annoying warnings about truncated STL debug info #pragma warning (disable :4786) #endif diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp index c3e3935fca5..0326b53dfb1 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp @@ -26,7 +26,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // annoying warnings about truncated STL debug info #pragma warning (disable :4786) #endif diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h index 9a7d9c7bcc0..517e0713352 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h @@ -30,7 +30,7 @@ #ifndef __KX_BLENDERRENDERTOOLS #define __KX_BLENDERRENDERTOOLS -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // don't show stl-warnings #pragma warning (disable:4786) #endif diff --git a/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp b/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp index 813869dd032..a6a9ee2133f 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp @@ -28,11 +28,14 @@ #include "KX_ISystem.h" -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable :4786) -#include <windows.h> #endif //WIN32 +#ifdef WIN32 +#include <windows.h> +#endif + #include <iostream> #include <stdio.h> #include "KX_BlenderInputDevice.h" diff --git a/source/gameengine/BlenderRoutines/Makefile b/source/gameengine/BlenderRoutines/Makefile index 4a437aff97d..3d0f5344c74 100644 --- a/source/gameengine/BlenderRoutines/Makefile +++ b/source/gameengine/BlenderRoutines/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript index e5b263ad930..f53fc509c6d 100644 --- a/source/gameengine/BlenderRoutines/SConscript +++ b/source/gameengine/BlenderRoutines/SConscript @@ -26,9 +26,9 @@ if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] + incs += ' ' + env['BF_PYTHON_INC'] else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') incs += ' ' + env['BF_BULLET_INC'] incs += ' ' + env['BF_OPENGL_INC'] diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp index 424c8441c0e..8f5ec230486 100644 --- a/source/gameengine/Converter/BL_ArmatureChannel.cpp +++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp @@ -197,8 +197,7 @@ int BL_ArmatureChannel::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUT PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef) { - BL_ArmatureChannel* self= static_cast<BL_ArmatureChannel*>(self_v); - bPoseChannel* pchan = self->m_posechannel; + bPoseChannel* pchan = static_cast<bPoseChannel*>(self_v); // decompose the pose matrix in euler rotation float rest_mat[3][3]; float pose_mat[3][3]; diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index 7dd2543e89d..97d6b6efd27 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -30,6 +30,7 @@ #include "BL_ArmatureObject.h" #include "BL_ActionActuator.h" #include "KX_BlenderSceneConverter.h" +#include "MEM_guardedalloc.h" #include "BLI_blenlib.h" #include "BLI_ghash.h" #include "BLI_math.h" diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h index 6ad7de03489..646e9d45365 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.h +++ b/source/gameengine/Converter/BL_ArmatureObject.h @@ -94,7 +94,7 @@ public: BL_ArmatureConstraint* GetConstraint(int index); // for pose channel python API void LoadChannels(); - size_t GetChannelNumber() const { return m_constraintNumber; } + size_t GetChannelNumber() const { return m_channelNumber; } BL_ArmatureChannel* GetChannel(bPoseChannel* channel); BL_ArmatureChannel* GetChannel(const char* channel); BL_ArmatureChannel* GetChannel(int index); diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 832e33cb4b6..926452d61d6 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -28,7 +28,7 @@ * Convert blender data to ketsji */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif @@ -1573,6 +1573,15 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, objprop.m_boundobject.c.m_height = 2.f*bb.m_extends[2]; break; } + case OB_BOUND_CAPSULE: + { + objprop.m_boundclass = KX_BOUNDCAPSULE; + objprop.m_boundobject.c.m_radius = MT_max(bb.m_extends[0], bb.m_extends[1]); + objprop.m_boundobject.c.m_height = 2.f*(bb.m_extends[2]-objprop.m_boundobject.c.m_radius); + if (objprop.m_boundobject.c.m_height < 0.f) + objprop.m_boundobject.c.m_height = 0.f; + break; + } } } @@ -2635,7 +2644,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, sumolist->Release(); // convert world - KX_WorldInfo* worldinfo = new BlenderWorldInfo(blenderscene->world); + KX_WorldInfo* worldinfo = new BlenderWorldInfo(blenderscene, blenderscene->world); converter->RegisterWorldInfo(worldinfo); kxscene->SetWorldInfo(worldinfo); diff --git a/source/gameengine/Converter/BL_DeformableGameObject.h b/source/gameengine/Converter/BL_DeformableGameObject.h index 5d16e3ba1a8..076bfaeb458 100644 --- a/source/gameengine/Converter/BL_DeformableGameObject.h +++ b/source/gameengine/Converter/BL_DeformableGameObject.h @@ -30,7 +30,7 @@ #ifndef BL_DEFORMABLEGAMEOBJECT #define BL_DEFORMABLEGAMEOBJECT -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning #endif //WIN32 diff --git a/source/gameengine/Converter/BL_MeshDeformer.cpp b/source/gameengine/Converter/BL_MeshDeformer.cpp index 332c6fee2cf..25dd8678e60 100644 --- a/source/gameengine/Converter/BL_MeshDeformer.cpp +++ b/source/gameengine/Converter/BL_MeshDeformer.cpp @@ -28,7 +28,7 @@ * Simple deformation controller that restores a mesh to its rest position */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // This warning tells us about truncation of __long__ stl-generated names. // It can occasionally cause DevStudio to have internal compiler warnings. #pragma warning( disable : 4786 ) diff --git a/source/gameengine/Converter/BL_MeshDeformer.h b/source/gameengine/Converter/BL_MeshDeformer.h index 50bad254b42..48878d3f084 100644 --- a/source/gameengine/Converter/BL_MeshDeformer.h +++ b/source/gameengine/Converter/BL_MeshDeformer.h @@ -36,7 +36,7 @@ #include "MT_Point3.h" #include <stdlib.h> -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning #endif //WIN32 diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp index 5ccf8de29b1..f1f30938577 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.cpp +++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp @@ -27,7 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif //WIN32 diff --git a/source/gameengine/Converter/BL_ModifierDeformer.h b/source/gameengine/Converter/BL_ModifierDeformer.h index 6e0ede8e62f..49998f36ccb 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.h +++ b/source/gameengine/Converter/BL_ModifierDeformer.h @@ -30,7 +30,7 @@ #ifndef BL_MODIFIERDEFORMER #define BL_MODIFIERDEFORMER -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning #endif //WIN32 diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp index 1a90001adca..2fc78646d92 100644 --- a/source/gameengine/Converter/BL_ShapeDeformer.cpp +++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp @@ -27,7 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif //WIN32 diff --git a/source/gameengine/Converter/BL_ShapeDeformer.h b/source/gameengine/Converter/BL_ShapeDeformer.h index 98bd4a1b4ba..b3b0996c27b 100644 --- a/source/gameengine/Converter/BL_ShapeDeformer.h +++ b/source/gameengine/Converter/BL_ShapeDeformer.h @@ -30,7 +30,7 @@ #ifndef BL_SHAPEDEFORMER #define BL_SHAPEDEFORMER -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning #endif //WIN32 diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp index c6e371dc0bf..748df4c2e41 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.cpp +++ b/source/gameengine/Converter/BL_SkinDeformer.cpp @@ -27,7 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif //WIN32 diff --git a/source/gameengine/Converter/BL_SkinDeformer.h b/source/gameengine/Converter/BL_SkinDeformer.h index df7e8f6dffc..f8483519eb2 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.h +++ b/source/gameengine/Converter/BL_SkinDeformer.h @@ -30,7 +30,7 @@ #ifndef BL_SKINDEFORMER #define BL_SKINDEFORMER -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning #endif //WIN32 diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp index 47653519cfd..f0d6083a8fa 100644 --- a/source/gameengine/Converter/BlenderWorldInfo.cpp +++ b/source/gameengine/Converter/BlenderWorldInfo.cpp @@ -2,7 +2,7 @@ * $Id$ * ***** BEGIN GPL LICENSE BLOCK ***** * - * This program is free software; you can redistribute it and/or + * This program is free software; you can [0]istribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. @@ -55,11 +55,13 @@ #include "DNA_world_types.h" #include "DNA_screen_types.h" +#include "BLI_math.h" + #include "BKE_global.h" /* end of blender include block */ -BlenderWorldInfo::BlenderWorldInfo(struct World* blenderworld) +BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World* blenderworld) { if (blenderworld) { @@ -71,27 +73,24 @@ BlenderWorldInfo::BlenderWorldInfo(struct World* blenderworld) m_hasmist = true; m_miststart = blenderworld->miststa; m_mistdistance = blenderworld->mistdist; - m_mistred = blenderworld->horr; - m_mistgreen = blenderworld->horg; - m_mistblue = blenderworld->horb; + copy_v3_v3(m_mistcolor, &blenderworld->horr); } else { m_hasmist = false; m_miststart = 0.0; m_mistdistance = 0.0; - m_mistred = 0.0; - m_mistgreen = 0.0; - m_mistblue = 0.0; + zero_v3(m_mistcolor); } - m_backgroundred = blenderworld->horr; - m_backgroundgreen = blenderworld->horg; - m_backgroundblue = blenderworld->horb; - - m_ambientred = blenderworld->ambr; - m_ambientgreen = blenderworld->ambg; - m_ambientblue = blenderworld->ambb; + copy_v3_v3(m_backgroundcolor, &blenderworld->horr); + copy_v3_v3(m_ambientcolor, &blenderworld->ambr); + + if(blenderscene->r.color_mgt_flag & R_COLOR_MANAGEMENT) { + linearrgb_to_srgb_v3_v3(m_mistcolor, m_mistcolor); + linearrgb_to_srgb_v3_v3(m_backgroundcolor, m_backgroundcolor); + linearrgb_to_srgb_v3_v3(m_ambientcolor, m_ambientcolor); + } } else { @@ -123,37 +122,37 @@ bool BlenderWorldInfo::hasMist() float BlenderWorldInfo::getBackColorRed() { - return m_backgroundred; + return m_backgroundcolor[0]; } float BlenderWorldInfo::getBackColorGreen() { - return m_backgroundgreen; + return m_backgroundcolor[1]; } float BlenderWorldInfo::getBackColorBlue() { - return m_backgroundblue; + return m_backgroundcolor[2]; } float BlenderWorldInfo::getAmbientColorRed() { - return m_ambientred; + return m_ambientcolor[0]; } float BlenderWorldInfo::getAmbientColorGreen() { - return m_ambientgreen; + return m_ambientcolor[1]; } float BlenderWorldInfo::getAmbientColorBlue() { - return m_ambientblue; + return m_ambientcolor[2]; } float BlenderWorldInfo::getMistStart() @@ -172,21 +171,21 @@ float BlenderWorldInfo::getMistDistance() float BlenderWorldInfo::getMistColorRed() { - return m_mistred; + return m_mistcolor[0]; } float BlenderWorldInfo::getMistColorGreen() { - return m_mistgreen; + return m_mistcolor[1]; } float BlenderWorldInfo::getMistColorBlue() { - return m_mistblue; + return m_mistcolor[2]; } @@ -210,7 +209,7 @@ BlenderWorldInfo::setMistDistance( BlenderWorldInfo::setMistColorRed( float d ) { - m_mistred = d; + m_mistcolor[0] = d; } @@ -218,7 +217,7 @@ BlenderWorldInfo::setMistColorRed( BlenderWorldInfo::setMistColorGreen( float d ) { - m_mistgreen = d; + m_mistcolor[1] = d; } @@ -226,5 +225,5 @@ BlenderWorldInfo::setMistColorGreen( BlenderWorldInfo::setMistColorBlue( float d ) { - m_mistblue = d; + m_mistcolor[2] = d; } diff --git a/source/gameengine/Converter/BlenderWorldInfo.h b/source/gameengine/Converter/BlenderWorldInfo.h index b500c55a7f2..a430e18223e 100644 --- a/source/gameengine/Converter/BlenderWorldInfo.h +++ b/source/gameengine/Converter/BlenderWorldInfo.h @@ -35,23 +35,17 @@ class BlenderWorldInfo : public KX_WorldInfo { bool m_hasworld; - float m_backgroundred; - float m_backgroundgreen; - float m_backgroundblue; + float m_backgroundcolor[3]; bool m_hasmist; float m_miststart; float m_mistdistance; - float m_mistred; - float m_mistgreen; - float m_mistblue; + float m_mistcolor[3]; - float m_ambientred; - float m_ambientgreen; - float m_ambientblue; + float m_ambientcolor[3]; public: - BlenderWorldInfo(struct World* blenderworld); + BlenderWorldInfo(struct Scene *blenderscene, struct World* blenderworld); ~BlenderWorldInfo(); bool hasWorld(); diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index 135ed820c4f..65483eff9b4 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -65,7 +65,7 @@ SET(INC ) IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) + LIST(APPEND INC ${PYTHON_INC}) ELSE(WITH_PYTHON) ADD_DEFINITIONS(-DDISABLE_PYTHON) ENDIF(WITH_PYTHON) diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 0575c55846b..f50fb6838e3 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -26,8 +26,8 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 - #pragma warning (disable:4786) // suppress stl-MSVC debug info warning +#if defined(WIN32) && !defined(FREE_WINDOWS) +#pragma warning (disable:4786) // suppress stl-MSVC debug info warning #endif #include "KX_Scene.h" @@ -100,6 +100,7 @@ extern "C" extern "C" { #include "BKE_context.h" #include "BLO_readfile.h" + #include "BKE_idcode.h" #include "BKE_report.h" #include "DNA_space_types.h" #include "DNA_windowmanager_types.h" /* report api */ @@ -931,14 +932,29 @@ Main* KX_BlenderSceneConverter::GetMainDynamicPath(const char *path) return NULL; } -bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, KX_Scene *scene_merge, char **err_str) +bool KX_BlenderSceneConverter::LinkBlendFileMemory(void *data, int length, const char *path, char *group, KX_Scene *scene_merge, char **err_str) +{ + BlendHandle *bpy_openlib = BLO_blendhandle_from_memory(data, length); + + // Error checking is done in LinkBlendFile + return LinkBlendFile(bpy_openlib, path, group, scene_merge, err_str); +} + +bool KX_BlenderSceneConverter::LinkBlendFilePath(const char *path, char *group, KX_Scene *scene_merge, char **err_str) +{ + BlendHandle *bpy_openlib = BLO_blendhandle_from_file( (char *)path ); + + // Error checking is done in LinkBlendFile + return LinkBlendFile(bpy_openlib, path, group, scene_merge, err_str); +} + +bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const char *path, char *group, KX_Scene *scene_merge, char **err_str) { bContext *C; Main *main_newlib; /* stored as a dynamic 'main' until we free it */ Main *main_tmp= NULL; /* created only for linking, then freed */ LinkNode *names = NULL; - BlendHandle *bpy_openlib = NULL; /* ptr to the open .blend file */ - int idcode= BLO_idcode_from_name(group); + int idcode= BKE_idcode_from_name(group); short flag= 0; /* dont need any special options */ ReportList reports; static char err_local[255]; @@ -955,7 +971,6 @@ bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, KX_S return false; } - bpy_openlib = BLO_blendhandle_from_file( (char *)path ); if(bpy_openlib==NULL) { snprintf(err_local, sizeof(err_local), "could not open blendfile \"%s\"\n", path); *err_str= err_local; diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h index 23d506c98ff..20f3f863563 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.h +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h @@ -142,7 +142,9 @@ public: struct Main* GetMainDynamicPath(const char *path); vector<struct Main*> &GetMainDynamic(); - bool LinkBlendFile(const char *path, char *group, KX_Scene *scene_merge, char **err_str); + bool LinkBlendFileMemory(void *data, int length, const char *path, char *group, KX_Scene *scene_merge, char **err_str); + bool LinkBlendFilePath(const char *path, char *group, KX_Scene *scene_merge, char **err_str); + bool LinkBlendFile(struct BlendHandle *bpy_openlib, const char *path, char *group, KX_Scene *scene_merge, char **err_str); bool MergeScene(KX_Scene *to, KX_Scene *from); RAS_MeshObject *ConvertMeshSpecial(KX_Scene* kx_scene, Main *maggie, const char *name); bool FreeBlendFile(struct Main *maggie); diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 0d70836e54c..d765c89c5aa 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -28,7 +28,7 @@ * Convert Blender actuators for use in the GameEngine */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif //WIN32 diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp index d65fee93a12..20597d46e82 100644 --- a/source/gameengine/Converter/KX_ConvertSensors.cpp +++ b/source/gameengine/Converter/KX_ConvertSensors.cpp @@ -30,7 +30,7 @@ #include <stdio.h> -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif //WIN32 @@ -39,7 +39,7 @@ #include "KX_ConvertSensors.h" /* This little block needed for linking to Blender... */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #include "BLI_winstuff.h" #endif diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index c983c8a5100..774efb3879d 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -26,8 +26,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 - +#if defined(WIN32) && !defined(FREE_WINDOWS) // don't show stl-warnings #pragma warning (disable:4786) #endif diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp index 9d58a16ddfc..bace00a872d 100644 --- a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp +++ b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp @@ -27,7 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif //WIN32 diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.h b/source/gameengine/Converter/KX_SoftBodyDeformer.h index ce3f695ef11..76874bdc782 100644 --- a/source/gameengine/Converter/KX_SoftBodyDeformer.h +++ b/source/gameengine/Converter/KX_SoftBodyDeformer.h @@ -30,7 +30,7 @@ #ifndef KX_SOFTBODYDEFORMER #define KX_SOFTBODYDEFORMER -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning #endif //WIN32 diff --git a/source/gameengine/Converter/Makefile b/source/gameengine/Converter/Makefile index b6da47930d3..142841b2b36 100644 --- a/source/gameengine/Converter/Makefile +++ b/source/gameengine/Converter/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript index 7c7a109a345..36657367621 100644 --- a/source/gameengine/Converter/SConscript +++ b/source/gameengine/Converter/SConscript @@ -25,12 +25,12 @@ incs += ' #extern/recastnavigation/Detour/Include' incs += ' ' + env['BF_BULLET_INC'] if env['BF_DEBUG']: - if env['OURPLATFORM'] in ('win32-mingw', 'win32-vc', 'win64-vc'): - defs.append('_DEBUG') - + if env['OURPLATFORM'] in ('win32-mingw', 'win32-vc', 'win64-vc'): + defs.append('_DEBUG') + if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] + incs += ' ' + env['BF_PYTHON_INC'] else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Expressions/CMakeLists.txt b/source/gameengine/Expressions/CMakeLists.txt index 85b5daa3b4a..126192d2188 100644 --- a/source/gameengine/Expressions/CMakeLists.txt +++ b/source/gameengine/Expressions/CMakeLists.txt @@ -37,7 +37,7 @@ SET(INC ) IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) + LIST(APPEND INC ${PYTHON_INC}) ELSE(WITH_PYTHON) ADD_DEFINITIONS(-DDISABLE_PYTHON) ENDIF(WITH_PYTHON) diff --git a/source/gameengine/Expressions/Makefile b/source/gameengine/Expressions/Makefile index 09512c3ae87..892a8c2b246 100644 --- a/source/gameengine/Expressions/Makefile +++ b/source/gameengine/Expressions/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index 7afa85c8c31..625549a272e 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -319,9 +319,6 @@ typedef struct KX_PYATTRIBUTE_DEF { } m_typeCheck; } PyAttributeDef; -#define KX_PYATTRIBUTE_DUMMY(name) \ - { name, KX_PYATTRIBUTE_TYPE_DUMMY, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, 0, 0, 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } - #define KX_PYATTRIBUTE_BOOL_RW(name,object,field) \ { name, KX_PYATTRIBUTE_TYPE_BOOL, KX_PYATTRIBUTE_RW, 0, 1, 0.f, 0.f, false, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {&((object *)0)->field, NULL, NULL, NULL, NULL, NULL, NULL} } #define KX_PYATTRIBUTE_BOOL_RW_CHECK(name,object,field,function) \ diff --git a/source/gameengine/Expressions/SConscript b/source/gameengine/Expressions/SConscript index 94af9dcfec8..007d6373c77 100644 --- a/source/gameengine/Expressions/SConscript +++ b/source/gameengine/Expressions/SConscript @@ -8,8 +8,8 @@ incs ='. #source/kernel/gen_system #intern/guardedalloc #intern/string #intern/m defs = [] if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] + incs += ' ' + env['BF_PYTHON_INC'] else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') env.BlenderLib ( 'bf_expressions', sources, Split(incs), defs, libtype=['core','player'], priority = [360,80], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h index 2bb9e39cafc..009d95ee4d2 100644 --- a/source/gameengine/Expressions/Value.h +++ b/source/gameengine/Expressions/Value.h @@ -13,7 +13,7 @@ * */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) #endif //WIN32 diff --git a/source/gameengine/Expressions/VectorValue.cpp b/source/gameengine/Expressions/VectorValue.cpp index 59ff601746f..c7b0db4a8f9 100644 --- a/source/gameengine/Expressions/VectorValue.cpp +++ b/source/gameengine/Expressions/VectorValue.cpp @@ -12,7 +12,7 @@ * */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) #endif diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index 93183dafeee..84d915847e9 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -43,7 +43,7 @@ ELSE(WITH_SDL) ENDIF(WITH_SDL) IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) + LIST(APPEND INC ${PYTHON_INC}) ELSE(WITH_PYTHON) ADD_DEFINITIONS(-DDISABLE_PYTHON) ENDIF(WITH_PYTHON) diff --git a/source/gameengine/GameLogic/Joystick/Makefile b/source/gameengine/GameLogic/Joystick/Makefile index 02def1cec62..5ab297824dd 100644 --- a/source/gameengine/GameLogic/Joystick/Makefile +++ b/source/gameengine/GameLogic/Joystick/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/GameLogic/Makefile b/source/gameengine/GameLogic/Makefile index ba1e1c25ee7..9c8bd73cdc0 100644 --- a/source/gameengine/GameLogic/Makefile +++ b/source/gameengine/GameLogic/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp b/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp index 9a6ed25a203..db741040ccc 100644 --- a/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp +++ b/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp @@ -61,4 +61,4 @@ void SCA_ActuatorEventManager::UpdateFrame() { (*it)->Update(); } -}
\ No newline at end of file +} diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp index 0f3b81a057e..e364225af3d 100644 --- a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp +++ b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp @@ -29,7 +29,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // This warning tells us about truncation of __long__ stl-generated names. // It can occasionally cause DevStudio to have internal compiler warnings. #pragma warning( disable : 4786 ) diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp index 701bcb2fc2f..6cad801e429 100644 --- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp +++ b/source/gameengine/GameLogic/SCA_DelaySensor.cpp @@ -29,7 +29,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // This warning tells us about truncation of __long__ stl-generated names. // It can occasionally cause DevStudio to have internal compiler warnings. #pragma warning( disable : 4786 ) diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp index bff02326c9c..fada69848b2 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.cpp +++ b/source/gameengine/GameLogic/SCA_ISensor.cpp @@ -357,9 +357,8 @@ PyAttributeDef SCA_ISensor::Attributes[] = { KX_PYATTRIBUTE_RO_FUNCTION("triggered", SCA_ISensor, pyattr_get_triggered), KX_PYATTRIBUTE_RO_FUNCTION("positive", SCA_ISensor, pyattr_get_positive), KX_PYATTRIBUTE_RO_FUNCTION("status", SCA_ISensor, pyattr_get_status), - //KX_PYATTRIBUTE_TODO("links"), - //KX_PYATTRIBUTE_TODO("posTicks"), - //KX_PYATTRIBUTE_TODO("negTicks"), + KX_PYATTRIBUTE_RO_FUNCTION("pos_ticks", SCA_ISensor, pyattr_get_posTicks), + KX_PYATTRIBUTE_RO_FUNCTION("neg_ticks", SCA_ISensor, pyattr_get_negTicks), { NULL } //Sentinel }; @@ -401,6 +400,18 @@ PyObject* SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF return PyLong_FromSsize_t(status); } +PyObject* SCA_ISensor::pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v); + return PyLong_FromLong(self->GetPosTicks()); +} + +PyObject* SCA_ISensor::pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v); + return PyLong_FromLong(self->GetNegTicks()); +} + int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v); diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h index 42d06d856b6..2d3a3ef08a0 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.h +++ b/source/gameengine/GameLogic/SCA_ISensor.h @@ -167,6 +167,18 @@ public: return m_prev_state; } + /** get the number of ticks since the last positive pulse */ + int GetPosTicks() + { + return m_pos_ticks; + } + + /** get the number of ticks since the last negative pulse */ + int GetNegTicks() + { + return m_neg_ticks; + } + /** Resume sensing. */ void Resume(); @@ -185,6 +197,9 @@ public: static PyObject* pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static int pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index 5ab42ae7608..29a6a73b865 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -290,7 +290,6 @@ PyAttributeDef SCA_JoystickSensor::Attributes[] = { KX_PYATTRIBUTE_RO_FUNCTION("numButtons", SCA_JoystickSensor, pyattr_get_num_buttons), KX_PYATTRIBUTE_RO_FUNCTION("numHats", SCA_JoystickSensor, pyattr_get_num_hats), KX_PYATTRIBUTE_RO_FUNCTION("connected", SCA_JoystickSensor, pyattr_get_connected), - //KX_PYATTRIBUTE_TODO("events"), { NULL } //Sentinel }; diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h index c5f377eeb44..9ddb62df361 100644 --- a/source/gameengine/GameLogic/SCA_LogicManager.h +++ b/source/gameengine/GameLogic/SCA_LogicManager.h @@ -30,7 +30,7 @@ #ifndef __KX_LOGICMANAGER #define __KX_LOGICMANAGER -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) #endif diff --git a/source/gameengine/GameLogic/SCA_MouseManager.cpp b/source/gameengine/GameLogic/SCA_MouseManager.cpp index f7f9a566c8d..1241bd07229 100644 --- a/source/gameengine/GameLogic/SCA_MouseManager.cpp +++ b/source/gameengine/GameLogic/SCA_MouseManager.cpp @@ -30,7 +30,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // This warning tells us about truncation of __long__ stl-generated names. // It can occasionally cause DevStudio to have internal compiler warnings. #pragma warning( disable : 4786 ) diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 48fdcb3eb44..1f05846abe4 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -178,7 +178,7 @@ PyObject* SCA_PythonController::sPyGetCurrentController(PyObject *self) { if(m_sCurrentController==NULL) { - PyErr_SetString(PyExc_SystemError, "GameLogic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt."); + PyErr_SetString(PyExc_SystemError, "bge.logic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt."); return NULL; } return m_sCurrentController->GetProxy(); diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp index 7951a749254..3d5d3568335 100644 --- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp +++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp @@ -33,11 +33,17 @@ SCA_PythonKeyboard::SCA_PythonKeyboard(SCA_IInputDevice* keyboard) : PyObjectPlus(), m_keyboard(keyboard) { +#ifndef DISABLE_PYTHON + m_event_dict = PyDict_New(); +#endif } SCA_PythonKeyboard::~SCA_PythonKeyboard() { - /* intentionally empty */ +#ifndef DISABLE_PYTHON + PyDict_Clear(m_event_dict); + Py_DECREF(m_event_dict); +#endif } #ifndef DISABLE_PYTHON @@ -81,24 +87,15 @@ PyAttributeDef SCA_PythonKeyboard::Attributes[] = { PyObject* SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_PythonKeyboard* self = static_cast<SCA_PythonKeyboard*>(self_v); - - PyObject* resultlist = PyList_New(0); for (int i=SCA_IInputDevice::KX_BEGINKEY; i<=SCA_IInputDevice::KX_ENDKEY; i++) { const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i); - - if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) - { - PyObject* keypair = PyTuple_New(2); - PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i)); - PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status)); - PyList_Append(resultlist, keypair); - } + PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status)); } - - return resultlist; + Py_INCREF(self->m_event_dict); + return self->m_event_dict; } #endif diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.h b/source/gameengine/GameLogic/SCA_PythonKeyboard.h index 0b353ac444c..260835155e6 100644 --- a/source/gameengine/GameLogic/SCA_PythonKeyboard.h +++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.h @@ -30,7 +30,11 @@ class SCA_PythonKeyboard : public PyObjectPlus { Py_Header; +private: class SCA_IInputDevice *m_keyboard; +#ifndef DISABLE_PYTHON + PyObject* m_event_dict; +#endif public: SCA_PythonKeyboard(class SCA_IInputDevice* keyboard); virtual ~SCA_PythonKeyboard(); diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp index 041a0169879..936ee2ff5c4 100644 --- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp +++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp @@ -35,11 +35,17 @@ SCA_PythonMouse::SCA_PythonMouse(SCA_IInputDevice* mouse, RAS_ICanvas* canvas) m_mouse(mouse), m_canvas(canvas) { +#ifndef DISABLE_PYTHON + m_event_dict = PyDict_New(); +#endif } SCA_PythonMouse::~SCA_PythonMouse() { - /* intentionally empty */ +#ifndef DISABLE_PYTHON + PyDict_Clear(m_event_dict); + Py_DECREF(m_event_dict); +#endif } #ifndef DISABLE_PYTHON @@ -72,7 +78,6 @@ PyTypeObject SCA_PythonMouse::Type = { }; PyMethodDef SCA_PythonMouse::Methods[] = { -// KX_PYMETHODTABLE(SCA_PythonMouse, show), {NULL,NULL} //Sentinel }; @@ -86,26 +91,18 @@ PyAttributeDef SCA_PythonMouse::Attributes[] = { PyObject* SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v); - - PyObject* resultlist = PyList_New(0); - + for (int i=SCA_IInputDevice::KX_BEGINMOUSE; i<=SCA_IInputDevice::KX_ENDMOUSE; i++) { const SCA_InputEvent & inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i); - - if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) - { - PyObject* keypair = PyTuple_New(2); - PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i)); - PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status)); - PyList_Append(resultlist, keypair); - } + PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status)); } - - return resultlist; + Py_INCREF(self->m_event_dict); + return self->m_event_dict; } + PyObject* SCA_PythonMouse::pyattr_get_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_PythonMouse* self = static_cast<SCA_PythonMouse*>(self_v); diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.h b/source/gameengine/GameLogic/SCA_PythonMouse.h index c73e6683fc8..9e1085e6bec 100644 --- a/source/gameengine/GameLogic/SCA_PythonMouse.h +++ b/source/gameengine/GameLogic/SCA_PythonMouse.h @@ -30,8 +30,12 @@ class SCA_PythonMouse : public PyObjectPlus { Py_Header; +private: class SCA_IInputDevice *m_mouse; class RAS_ICanvas *m_canvas; +#ifndef DISABLE_PYTHON + PyObject* m_event_dict; +#endif public: SCA_PythonMouse(class SCA_IInputDevice* mouse, class RAS_ICanvas* canvas); virtual ~SCA_PythonMouse(); diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp index d794a4f1227..8b99fd669a9 100644 --- a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp +++ b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp @@ -26,8 +26,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 - +#if defined(WIN32) && !defined(FREE_WINDOWS) // This warning tells us about truncation of __long__ stl-generated names. // It can occasionally cause DevStudio to have internal compiler warnings. #pragma warning( disable : 4786 ) diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript index 3840754ed06..507bb7f0bdd 100644 --- a/source/gameengine/GameLogic/SConscript +++ b/source/gameengine/GameLogic/SConscript @@ -10,17 +10,17 @@ incs += ' #/source/gameengine/Rasterizer #/source/gameengine/SceneGraph' defs = [] if env['WITH_BF_SDL']: - incs += ' ' + env['BF_SDL_INC'] + incs += ' ' + env['BF_SDL_INC'] else: - defs.append('DISABLE_SDL') + defs.append('DISABLE_SDL') if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] + incs += ' ' + env['BF_PYTHON_INC'] else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - if env['BF_DEBUG']: - defs.append('_DEBUG') + if env['BF_DEBUG']: + defs.append('_DEBUG') env.BlenderLib ( 'bf_logic', sources, Split(incs), defs, libtype=['core','player'], priority=[330,65], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/GamePlayer/Makefile b/source/gameengine/GamePlayer/Makefile index c4f78f23117..30a13f26503 100644 --- a/source/gameengine/GamePlayer/Makefile +++ b/source/gameengine/GamePlayer/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/GamePlayer/common/Makefile b/source/gameengine/GamePlayer/common/Makefile index e1b07a226f6..e28cacb826a 100644 --- a/source/gameengine/GamePlayer/common/Makefile +++ b/source/gameengine/GamePlayer/common/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/GamePlayer/common/SConscript b/source/gameengine/GamePlayer/common/SConscript index b66d644f9f5..7a16e950b36 100644 --- a/source/gameengine/GamePlayer/common/SConscript +++ b/source/gameengine/GamePlayer/common/SConscript @@ -42,7 +42,7 @@ incs = ['.', '#source/blender/misc', '#source/blender/blenloader', '#source/blender/gpu', - '#extern/glew/include'] + '#extern/glew/include'] #This is all plugin stuff! #if sys.platform=='win32': @@ -61,9 +61,9 @@ incs = ['.', defs = [ 'GLEW_STATIC' ] if env['WITH_BF_PYTHON']: - incs += Split(env['BF_PYTHON_INC']) + incs += Split(env['BF_PYTHON_INC']) else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') incs += Split(env['BF_PNG_INC']) incs += Split(env['BF_ZLIB_INC']) diff --git a/source/gameengine/GamePlayer/common/unix/Makefile b/source/gameengine/GamePlayer/common/unix/Makefile index c86f61b45d8..db29a087b28 100644 --- a/source/gameengine/GamePlayer/common/unix/Makefile +++ b/source/gameengine/GamePlayer/common/unix/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/GamePlayer/common/windows/Makefile b/source/gameengine/GamePlayer/common/windows/Makefile index 3f1deb05f3a..200f84dd3e6 100644 --- a/source/gameengine/GamePlayer/common/windows/Makefile +++ b/source/gameengine/GamePlayer/common/windows/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 71507642226..d1b8fb12336 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -370,6 +370,7 @@ bool GPG_Application::startFullScreen( fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual); m_mainWindow->setCursorVisibility(false); + m_mainWindow->setState(GHOST_kWindowStateFullScreen); success = initEngine(m_mainWindow, stereoMode); if (success) { diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 9cdee2a340c..9c0b5a24aeb 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -161,17 +161,29 @@ static BOOL scr_saver_init(int argc, char **argv) #endif /* WIN32 */ -void usage(const char* program) +void usage(const char* program, bool isBlenderPlayer) { const char * consoleoption; + const char * filename = ""; + const char * pathname = ""; + #ifdef _WIN32 consoleoption = "-c "; #else consoleoption = ""; #endif + + if (isBlenderPlayer) { + filename = "filename.blend"; +#ifdef _WIN32 + pathname = "c:\\"; +#else + pathname = "//home//user//"; +#endif + } printf("usage: %s [-w [w h l t]] [-f [fw fh fb ff]] %s[-g gamengineoptions] " - "[-s stereomode] filename.blend\n", program, consoleoption); + "[-s stereomode] %s\n", program, consoleoption, filename); printf(" -h: Prints this command summary\n\n"); printf(" -w: display in a window\n"); printf(" --Optional parameters--\n"); @@ -227,8 +239,8 @@ void usage(const char* program) printf("\n"); printf(" - : all arguments after this are ignored, allowing python to access them from sys.argv\n"); printf("\n"); - printf("example: %s -w 320 200 10 10 -g noaudio c:\\loadtest.blend\n", program); - printf("example: %s -g show_framerate = 0 c:\\loadtest.blend\n", program); + printf("example: %s -w 320 200 10 10 -g noaudio%s%s\n", program, pathname, filename); + printf("example: %s -g show_framerate = 0 %s%s\n", program, pathname, filename); } static void get_filename(int argc, char **argv, char *filename) @@ -337,8 +349,8 @@ int main(int argc, char** argv) int fullScreenBpp = 32; int fullScreenFrequency = 60; GHOST_TEmbedderWindowID parentWindow = 0; - - + bool isBlenderPlayer = false; + int validArguments=0; #ifdef __linux__ #ifdef __alpha__ @@ -412,7 +424,14 @@ int main(int argc, char** argv) U.audioformat = 0x24; U.audiochannels = 2; - for (i = 1; (i < argc) && !error + /* if running blenderplayer the last argument can't be parsed since it has to be the filename. */ + isBlenderPlayer = !blo_is_a_runtime(argv[0]); + if (isBlenderPlayer) + validArguments = argc - 1; + else + validArguments = argc; + + for (i = 1; (i < validArguments) && !error #ifdef WIN32 && scr_saver_mode == SCREEN_SAVER_MODE_NONE #endif @@ -436,14 +455,14 @@ int main(int argc, char** argv) // Parse game options { i++; - if (i < argc) + if (i <= validArguments) { char* paramname = argv[i]; // Check for single value versus assignment - if (i+1 < argc && (*(argv[i+1]) == '=')) + if (i+1 <= validArguments && (*(argv[i+1]) == '=')) { i++; - if (i + 1 < argc) + if (i + 1 <= validArguments) { i++; // Assignment @@ -479,14 +498,14 @@ int main(int argc, char** argv) i++; fullScreen = true; fullScreenParFound = true; - if ((i + 2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-') + if ((i + 2) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') { fullScreenWidth = atoi(argv[i++]); fullScreenHeight = atoi(argv[i++]); - if ((i + 1) <= argc && argv[i][0] != '-') + if ((i + 1) <= validArguments && argv[i][0] != '-') { fullScreenBpp = atoi(argv[i++]); - if ((i + 1) <= argc && argv[i][0] != '-') + if ((i + 1) <= validArguments && argv[i][0] != '-') fullScreenFrequency = atoi(argv[i++]); } } @@ -497,11 +516,11 @@ int main(int argc, char** argv) fullScreen = false; windowParFound = true; - if ((i + 2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-') + if ((i + 2) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') { windowWidth = atoi(argv[i++]); windowHeight = atoi(argv[i++]); - if ((i +2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-') + if ((i + 2) <= validArguments && argv[i][0] != '-' && argv[i+1][0] != '-') { windowLeft = atoi(argv[i++]); windowTop = atoi(argv[i++]); @@ -510,14 +529,19 @@ int main(int argc, char** argv) break; case 'h': - usage(argv[0]); + usage(argv[0], isBlenderPlayer); return 0; break; #ifndef _WIN32 case 'i': i++; - if ( (i + 1) < argc ) - parentWindow = atoi(argv[i++]); + if ( (i + 1) <= validArguments ) + parentWindow = atoi(argv[i++]); + else { + error = true; + printf("error: too few options for parent window argument.\n"); + } + #ifndef NDEBUG printf("XWindows ID = %d\n", parentWindow); #endif //NDEBUG @@ -529,7 +553,7 @@ int main(int argc, char** argv) break; case 's': // stereo i++; - if ((i + 1) < argc) + if ((i + 1) <= validArguments) { stereomode = (RAS_IRasterizer::StereoMode) atoi(argv[i]); if (stereomode < RAS_IRasterizer::RAS_STEREO_NOSTEREO || stereomode >= RAS_IRasterizer::RAS_STEREO_MAXSTEREO) @@ -575,7 +599,7 @@ int main(int argc, char** argv) stereoFlag = STEREO_DOME; stereomode = RAS_IRasterizer::RAS_STEREO_DOME; i++; - if ((i + 1) < argc) + if ((i + 1) <= validArguments) { if(!strcmp(argv[i], "angle")){ i++; @@ -631,7 +655,7 @@ int main(int argc, char** argv) if (error ) { - usage(argv[0]); + usage(argv[0], isBlenderPlayer); return 0; } @@ -714,7 +738,7 @@ int main(int argc, char** argv) //::printf("game data loaded from %s\n", filename); if (!bfd) { - usage(argv[0]); + usage(argv[0], isBlenderPlayer); error = true; exitcode = KX_EXIT_REQUEST_QUIT_GAME; } diff --git a/source/gameengine/GamePlayer/ghost/Makefile b/source/gameengine/GamePlayer/ghost/Makefile index a7fcf46b695..b2fcd2ac1ff 100644 --- a/source/gameengine/GamePlayer/ghost/Makefile +++ b/source/gameengine/GamePlayer/ghost/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index 2269b6400e3..41520a06c66 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -43,9 +43,9 @@ incs = ['.', defs = [ 'GLEW_STATIC' ] if env['WITH_BF_PYTHON']: - incs += Split(env['BF_PYTHON_INC']) + incs += Split(env['BF_PYTHON_INC']) else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index a4f9dffb360..18ee86cea13 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -73,7 +73,7 @@ ELSE(WITH_SDL) ENDIF(WITH_SDL) IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) + LIST(APPEND INC ${PYTHON_INC}) ELSE(WITH_PYTHON) ADD_DEFINITIONS(-DDISABLE_PYTHON) ENDIF(WITH_PYTHON) diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt index ce3d8fa22fc..106d1a84a92 100644 --- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt +++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt @@ -39,7 +39,7 @@ SET(INC ) IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) + LIST(APPEND INC ${PYTHON_INC}) ELSE(WITH_PYTHON) ADD_DEFINITIONS(-DDISABLE_PYTHON) ENDIF(WITH_PYTHON) diff --git a/source/gameengine/Ketsji/KXNetwork/Makefile b/source/gameengine/Ketsji/KXNetwork/Makefile index 365ed8fc9c3..aebbd7921cb 100644 --- a/source/gameengine/Ketsji/KXNetwork/Makefile +++ b/source/gameengine/Ketsji/KXNetwork/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Ketsji/KXNetwork/SConscript b/source/gameengine/Ketsji/KXNetwork/SConscript index 64d00489c89..e7f98ff5850 100644 --- a/source/gameengine/Ketsji/KXNetwork/SConscript +++ b/source/gameengine/Ketsji/KXNetwork/SConscript @@ -10,8 +10,8 @@ incs += ' #source/gameengine/Network #source/gameengine/SceneGraph' defs = [] if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] + incs += ' ' + env['BF_PYTHON_INC'] else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') env.BlenderLib ( 'bf_network', Split(sources), Split(incs), defines=defs,libtype=['core','player'], priority=[400,125], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index 2ef7e55429f..d88997e2128 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -794,9 +794,9 @@ PyMethodDef KX_BlenderMaterial::Methods[] = }; PyAttributeDef KX_BlenderMaterial::Attributes[] = { - //KX_PYATTRIBUTE_TODO("shader"), - //KX_PYATTRIBUTE_TODO("materialIndex"), - //KX_PYATTRIBUTE_TODO("blending"), + KX_PYATTRIBUTE_RO_FUNCTION("shader", KX_BlenderMaterial, pyattr_get_shader), + KX_PYATTRIBUTE_RO_FUNCTION("material_index", KX_BlenderMaterial, pyattr_get_materialIndex), + KX_PYATTRIBUTE_RW_FUNCTION("blending", KX_BlenderMaterial, pyattr_get_blending, pyattr_set_blending), { NULL } //Sentinel }; @@ -822,6 +822,37 @@ PyTypeObject KX_BlenderMaterial::Type = { py_base_new }; +PyObject* KX_BlenderMaterial::pyattr_get_shader(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v); + return self->PygetShader(NULL, NULL); +} + +PyObject* KX_BlenderMaterial::pyattr_get_materialIndex(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v); + return PyLong_FromSsize_t(self->GetMaterialIndex()); +} + +PyObject* KX_BlenderMaterial::pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v); + unsigned int* bfunc = self->getBlendFunc(); + return Py_BuildValue("(ll)", (long int)bfunc[0], (long int)bfunc[1]); +} + +int KX_BlenderMaterial::pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v); + PyObject* obj = self->PysetBlending(value, NULL); + if(obj) + { + Py_DECREF(obj); + return 0; + } + return -1; +} + KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()") { if( !GLEW_ARB_fragment_shader) { @@ -908,7 +939,7 @@ static unsigned int GL_array[11] = { GL_SRC_ALPHA_SATURATE }; -KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( GameLogic.src, GameLogic.dest)") +KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( bge.logic.src, bge.logic.dest)") { unsigned int b[2]; if(PyArg_ParseTuple(args, "ii:setBlending", &b[0], &b[1])) diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h index 5bf62ff6b7c..239e334f68a 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.h +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h @@ -79,6 +79,9 @@ public: Image * getImage (unsigned int idx) { return (idx < MAXTEX && mMaterial) ? mMaterial->img[idx] : NULL; } + unsigned int* getBlendFunc() { + return mBlendFunc; + } // for ipos void UpdateIPO( MT_Vector4 rgba, MT_Vector3 specrgb, @@ -99,6 +102,11 @@ public: // -------------------------------- virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); } + static PyObject* pyattr_get_shader(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_materialIndex(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static int pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + KX_PYMETHOD_DOC( KX_BlenderMaterial, getShader ); KX_PYMETHOD_DOC( KX_BlenderMaterial, getMaterialIndex ); KX_PYMETHOD_DOC( KX_BlenderMaterial, getTexture ); diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 36b90411e1f..2402baf92ac 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -553,8 +553,8 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum, "\tcenter = the center of the sphere (in world coordinates.)\n" "\tradius = the radius of the sphere\n\n" "\tExample:\n" -"\timport GameLogic\n\n" -"\tco = GameLogic.getCurrentController()\n" +"\timport bge.logic\n\n" +"\tco = bge.logic.getCurrentController()\n" "\tcam = co.GetOwner()\n\n" "\t# A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]\n" "\tif (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):\n" @@ -586,8 +586,8 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum, "\tinside/outside/intersects this camera's viewing frustum.\n\n" "\tbox = a list of the eight (8) corners of the box (in world coordinates.)\n\n" "\tExample:\n" -"\timport GameLogic\n\n" -"\tco = GameLogic.getCurrentController()\n" +"\timport bge.logic\n\n" +"\tco = bge.logic.getCurrentController()\n" "\tcam = co.GetOwner()\n\n" "\tbox = []\n" "\tbox.append([-1.0, -1.0, -1.0])\n" @@ -630,8 +630,8 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum, "\treturns 1 if the given point is inside this camera's viewing frustum.\n\n" "\tpoint = The point to test (in world coordinates.)\n\n" "\tExample:\n" -"\timport GameLogic\n\n" -"\tco = GameLogic.getCurrentController()\n" +"\timport bge.logic\n\n" +"\tco = bge.logic.getCurrentController()\n" "\tcam = co.GetOwner()\n\n" "\t# Test point [0.0, 0.0, 0.0]" "\tif (cam.pointInsideFrustum([0.0, 0.0, 0.0])):\n" diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp index 8af6e63f343..b1baa5fe9e1 100644 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp @@ -110,8 +110,14 @@ PyMethodDef KX_ConstraintWrapper::Methods[] = { }; PyAttributeDef KX_ConstraintWrapper::Attributes[] = { - //KX_PYATTRIBUTE_TODO("constraintId"), + KX_PYATTRIBUTE_RO_FUNCTION("constraint_id", KX_ConstraintWrapper, pyattr_get_constraintId), { NULL } //Sentinel }; +PyObject* KX_ConstraintWrapper::pyattr_get_constraintId(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_ConstraintWrapper* self= static_cast<KX_ConstraintWrapper*>(self_v); + return self->PyGetConstraintId(); +} + #endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.h b/source/gameengine/Ketsji/KX_ConstraintWrapper.h index 530ecf16fed..db9543c23ae 100644 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.h +++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.h @@ -44,6 +44,8 @@ public: KX_PYMETHOD_NOARGS(KX_ConstraintWrapper,GetConstraintId); KX_PYMETHOD(KX_ConstraintWrapper,SetParam); KX_PYMETHOD(KX_ConstraintWrapper,GetParam); + + static PyObject* pyattr_get_constraintId(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); #endif private: diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h index 879bcd472c6..ca20aa6b618 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h @@ -53,7 +53,8 @@ typedef enum { KX_BOUNDCONE, KX_BOUNDMESH, KX_BOUNDPOLYTOPE, - KX_BOUND_DYN_MESH + KX_BOUND_DYN_MESH, + KX_BOUNDCAPSULE } KX_BoundBoxClass; struct KX_BoxBounds @@ -168,4 +169,3 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro #endif #endif //KX_CONVERTPHYSICSOBJECTS - diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index 44ae032179b..061220ce0c1 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -26,7 +26,7 @@ * * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif @@ -184,6 +184,14 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, bm = shapeInfo->CreateBulletShape(ci.m_margin); break; } + case KX_BOUNDCAPSULE: + { + shapeInfo->m_radius = objprop->m_boundobject.c.m_radius; + shapeInfo->m_height = objprop->m_boundobject.c.m_height; + shapeInfo->m_shapeType = PHY_SHAPE_CAPSULE; + bm = shapeInfo->CreateBulletShape(ci.m_margin); + break; + } case KX_BOUNDMESH: { // mesh shapes can be shared, check first if we already have a shape on that mesh diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 94258088e9f..44d7827db6a 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -2049,11 +2049,11 @@ void KX_Dome::RenderDomeFrame(KX_Scene* scene, KX_Camera* cam, int i) m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), 1.0); cam->SetModelviewMatrix(viewmat); - scene->CalculateVisibleMeshes(m_rasterizer,cam); - scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools); - // restore the original orientation cam->NodeSetLocalOrientation(camori); cam->NodeUpdateGS(0.f); + + scene->CalculateVisibleMeshes(m_rasterizer,cam); + scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools); } diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index d135e3d9d7b..e955c344f0a 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -34,7 +34,7 @@ typedef unsigned __int64 uint_ptr; typedef unsigned long uint_ptr; #endif -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // This warning tells us about truncation of __long__ stl-generated names. // It can occasionally cause DevStudio to have internal compiler warnings. #pragma warning( disable : 4786 ) diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index c0683ae0b4e..5d7f3948a61 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -31,7 +31,7 @@ #ifndef __KX_GAMEOBJECT #define __KX_GAMEOBJECT -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // get rid of this stupid "warning 'this' used in initialiser list", generated by VC when including Solid/Sumo #pragma warning (disable : 4355) #endif diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp index 1d4c64483f5..abe63a68e79 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp +++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp @@ -34,7 +34,7 @@ typedef unsigned __int64 uint_ptr; typedef unsigned long uint_ptr; #endif -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // This warning tells us about truncation of __long__ stl-generated names. // It can occasionally cause DevStudio to have internal compiler warnings. #pragma warning( disable : 4786 ) diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 2d9f4bbadf3..1e8e896cff6 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -28,7 +28,7 @@ * The engine ties all game modules together. */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif //WIN32 @@ -237,7 +237,7 @@ void KX_KetsjiEngine::SetRasterizer(RAS_IRasterizer* rasterizer) #ifndef DISABLE_PYTHON /* - * At the moment the GameLogic module is imported into 'pythondictionary' after this function is called. + * At the moment the bge.logic module is imported into 'pythondictionary' after this function is called. * if this function ever changes to assign a copy, make sure the game logic module is imported into this dictionary before hand. */ void KX_KetsjiEngine::SetPyNamespace(PyObject* pythondictionary) @@ -968,44 +968,17 @@ void KX_KetsjiEngine::DoSound(KX_Scene* scene) KX_Camera* cam = scene->GetActiveCamera(); if (!cam) return; - MT_Point3 listenerposition = cam->NodeGetWorldPosition(); - MT_Vector3 listenervelocity = cam->GetLinearVelocity(); - MT_Matrix3x3 listenerorientation = cam->NodeGetWorldOrientation(); - { - AUD_3DData data; - float f; - - listenerorientation.getValue3x3(data.orientation); - listenerposition.getValue(data.position); - listenervelocity.getValue(data.velocity); - - f = data.position[1]; - data.position[1] = data.position[2]; - data.position[2] = -f; - - f = data.velocity[1]; - data.velocity[1] = data.velocity[2]; - data.velocity[2] = -f; + float f[4]; - f = data.orientation[1]; - data.orientation[1] = data.orientation[2]; - data.orientation[2] = -f; + cam->NodeGetWorldPosition().getValue(f); + AUD_setListenerLocation(f); - f = data.orientation[3]; - data.orientation[3] = -data.orientation[6]; - data.orientation[6] = f; + cam->GetLinearVelocity().getValue(f); + AUD_setListenerVelocity(f); - f = data.orientation[4]; - data.orientation[4] = -data.orientation[8]; - data.orientation[8] = -f; - - f = data.orientation[5]; - data.orientation[5] = data.orientation[7]; - data.orientation[7] = f; - - AUD_updateListener(&data); - } + cam->NodeGetWorldOrientation().getRotation().getValue(f); + AUD_setListenerOrientation(f); } diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index ac20b4f2f56..e282d7ac375 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -26,8 +26,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 - +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp index 63771ae08dc..19114c86c98 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp @@ -28,7 +28,7 @@ * KX_MouseFocusSensor determines mouse in/out/over events. */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // This warning tells us about truncation of __long__ stl-generated names. // It can occasionally cause DevStudio to have internal compiler warnings. #pragma warning( disable : 4786 ) diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp index 837c79c77b3..9395e57e68b 100644 --- a/source/gameengine/Ketsji/KX_PolyProxy.cpp +++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp @@ -72,90 +72,19 @@ PyMethodDef KX_PolyProxy::Methods[] = { }; PyAttributeDef KX_PolyProxy::Attributes[] = { - /* All dummy's so they come up in a dir() */ - //KX_PYATTRIBUTE_TODO("DummyProps"), - KX_PYATTRIBUTE_DUMMY("matname"), - KX_PYATTRIBUTE_DUMMY("texture"), - KX_PYATTRIBUTE_DUMMY("material"), - KX_PYATTRIBUTE_DUMMY("matid"), - KX_PYATTRIBUTE_DUMMY("v1"), - KX_PYATTRIBUTE_DUMMY("v2"), - KX_PYATTRIBUTE_DUMMY("v3"), - KX_PYATTRIBUTE_DUMMY("v4"), - KX_PYATTRIBUTE_DUMMY("visible"), - KX_PYATTRIBUTE_DUMMY("collide"), + KX_PYATTRIBUTE_RO_FUNCTION("material_name", KX_PolyProxy, pyattr_get_material_name), + KX_PYATTRIBUTE_RO_FUNCTION("texture_name", KX_PolyProxy, pyattr_get_texture_name), + KX_PYATTRIBUTE_RO_FUNCTION("material", KX_PolyProxy, pyattr_get_material), + KX_PYATTRIBUTE_RO_FUNCTION("material_id", KX_PolyProxy, pyattr_get_material_id), + KX_PYATTRIBUTE_RO_FUNCTION("v1", KX_PolyProxy, pyattr_get_v1), + KX_PYATTRIBUTE_RO_FUNCTION("v2", KX_PolyProxy, pyattr_get_v2), + KX_PYATTRIBUTE_RO_FUNCTION("v3", KX_PolyProxy, pyattr_get_v3), + KX_PYATTRIBUTE_RO_FUNCTION("v4", KX_PolyProxy, pyattr_get_v4), + KX_PYATTRIBUTE_RO_FUNCTION("visible", KX_PolyProxy, pyattr_get_visible), + KX_PYATTRIBUTE_RO_FUNCTION("collide", KX_PolyProxy, pyattr_get_collide), { NULL } //Sentinel }; -#if 0 -PyObject* KX_PolyProxy::py_getattro(PyObject *attr) -{ - char *attr_str= _PyUnicode_AsString(attr); - if (!strcmp(attr_str, "matname")) - { - return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName()); - } - if (!strcmp(attr_str, "texture")) - { - return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName()); - } - if (!strcmp(attr_str, "material")) - { - RAS_IPolyMaterial *polymat = m_polygon->GetMaterial()->GetPolyMaterial(); - if(polymat->GetFlag() & RAS_BLENDERMAT) - { - KX_BlenderMaterial* mat = static_cast<KX_BlenderMaterial*>(polymat); - return mat->GetProxy(); - } - else - { - KX_PolygonMaterial* mat = static_cast<KX_PolygonMaterial*>(polymat); - return mat->GetProxy(); - } - } - if (!strcmp(attr_str, "matid")) - { - // we'll have to scan through the material bucket of the mes and compare with - // the one of the polygon - RAS_MaterialBucket* polyBucket = m_polygon->GetMaterial(); - unsigned int matid; - for (matid=0; matid<(unsigned int)m_mesh->NumMaterials(); matid++) - { - RAS_MeshMaterial* meshMat = m_mesh->GetMeshMaterial(matid); - if (meshMat->m_bucket == polyBucket) - // found it - break; - } - return PyLong_FromSsize_t(matid); - } - if (!strcmp(attr_str, "v1")) - { - return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 0)); - } - if (!strcmp(attr_str, "v2")) - { - return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 1)); - } - if (!strcmp(attr_str, "v3")) - { - return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 2)); - } - if (!strcmp(attr_str, "v4")) - { - return PyLong_FromSsize_t(((m_polygon->VertexCount()>3)?m_polygon->GetVertexOffsetAbs(m_mesh, 3):0)); - } - if (!strcmp(attr_str, "visible")) - { - return PyLong_FromSsize_t(m_polygon->IsVisible()); - } - if (!strcmp(attr_str, "collide")) - { - return PyLong_FromSsize_t(m_polygon->IsCollider()); - } - // py_getattro_up(CValue); // XXX -- todo, make all these attributes -} -#endif - KX_PolyProxy::KX_PolyProxy(const RAS_MeshObject*mesh, RAS_Polygon* polygon) : m_polygon(polygon), m_mesh((RAS_MeshObject*)mesh) @@ -179,7 +108,75 @@ CValue* KX_PolyProxy::GetReplica() { return NULL;} // stuff for python integration -KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex, +PyObject* KX_PolyProxy::pyattr_get_material_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v); + return self->PygetMaterialName(); +} + +PyObject* KX_PolyProxy::pyattr_get_texture_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v); + return self->PygetTextureName(); +} + +PyObject* KX_PolyProxy::pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v); + return self->PygetMaterial(); +} + +PyObject* KX_PolyProxy::pyattr_get_material_id(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v); + return self->PygetMaterialIndex(); +} + +PyObject* KX_PolyProxy::pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v); + + return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0)); +} + +PyObject* KX_PolyProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v); + + return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1)); +} + +PyObject* KX_PolyProxy::pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v); + + return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2)); +} + +PyObject* KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v); + + if (3 < self->m_polygon->VertexCount()) + { + return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3)); + } + return PyLong_FromSsize_t(0); +} + +PyObject* KX_PolyProxy::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v); + return self->PyisVisible(); +} + +PyObject* KX_PolyProxy::pyattr_get_collide(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v); + return self->PyisCollider(); +} + +KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex, "getMaterialIndex() : return the material index of the polygon in the mesh\n") { RAS_MaterialBucket* polyBucket = m_polygon->GetMaterial(); diff --git a/source/gameengine/Ketsji/KX_PolyProxy.h b/source/gameengine/Ketsji/KX_PolyProxy.h index 97d89b37435..3e669630e30 100644 --- a/source/gameengine/Ketsji/KX_PolyProxy.h +++ b/source/gameengine/Ketsji/KX_PolyProxy.h @@ -54,6 +54,16 @@ public: // stuff for python integration + static PyObject* pyattr_get_material_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_texture_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_material_id(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_collide(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getMaterialIndex) KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getNumVertex) diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp index dacc74f139f..63204b16e8b 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp @@ -233,7 +233,7 @@ PyAttributeDef KX_PolygonMaterial::Attributes[] = { KX_PYATTRIBUTE_FLOAT_RW("shininess", 0.0f, 1000.0f, KX_PolygonMaterial, m_shininess), KX_PYATTRIBUTE_FLOAT_RW("specularity", 0.0f, 1000.0f, KX_PolygonMaterial, m_specularity), - KX_PYATTRIBUTE_RW_FUNCTION("diffuse", KX_PolygonMaterial, pyattr_get_texture, pyattr_set_diffuse), + KX_PYATTRIBUTE_RW_FUNCTION("diffuse", KX_PolygonMaterial, pyattr_get_diffuse, pyattr_set_diffuse), KX_PYATTRIBUTE_RW_FUNCTION("specular",KX_PolygonMaterial, pyattr_get_specular, pyattr_set_specular), KX_PYATTRIBUTE_RO_FUNCTION("tface", KX_PolygonMaterial, pyattr_get_tface), /* How the heck is this even useful??? - Campbell */ diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp index 59d1c197cf3..12f88331d15 100644 --- a/source/gameengine/Ketsji/KX_PyMath.cpp +++ b/source/gameengine/Ketsji/KX_PyMath.cpp @@ -28,7 +28,7 @@ * Initialize Python thingies. */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif //WIN32 diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 871d6821dd4..38a9229814d 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -30,7 +30,7 @@ #include "GL/glew.h" -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif //WIN32 @@ -38,6 +38,7 @@ extern "C" { #include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */ + #include "py_capi_utils.h" #include "mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use. #include "geometry.h" // Blender.Geometry module copied here so the blenderlayer can use. #include "bgl.h" @@ -45,6 +46,10 @@ extern "C" { #include "marshal.h" /* python header for loading/saving dicts */ } + +#define WITH_PYTHON +#include "AUD_PyInit.h" + #endif #include "KX_PythonInit.h" @@ -120,7 +125,7 @@ extern "C" { #include "KX_BlenderSceneConverter.h" #include "KX_MeshProxy.h" /* for creating a new library of mesh objects */ extern "C" { - #include "BLO_readfile.h" + #include "BKE_idcode.h" } #include "NG_NetworkScene.h" //Needed for sendMessage() @@ -271,8 +276,8 @@ static PyObject* gPyRestartGame(PyObject*) } static char gPySaveGlobalDict_doc[] = -"saveGlobalDict()\n\ -Saves GameLogic.globalDict to a file"; + "saveGlobalDict()\n" + "Saves bge.logic.globalDict to a file"; static PyObject* gPySaveGlobalDict(PyObject*) { @@ -308,8 +313,8 @@ static PyObject* gPySaveGlobalDict(PyObject*) } static char gPyLoadGlobalDict_doc[] = -"LoadGlobalDict()\n\ -Loads GameLogic.globalDict from a file"; + "LoadGlobalDict()\n" + "Loads bge.logic.globalDict from a file"; static PyObject* gPyLoadGlobalDict(PyObject*) { @@ -384,15 +389,6 @@ static PyObject* gPyGetSpectrum(PyObject*) return resultlist; } - -static PyObject* gPyStopDSP(PyObject*, PyObject* args) -{ - PyErr_SetString(PyExc_RuntimeError, "no audio device available"); - return NULL; - - Py_RETURN_NONE; -} - static PyObject* gPySetLogicTicRate(PyObject*, PyObject* args) { float ticrate; @@ -640,13 +636,28 @@ static PyObject *gLibLoad(PyObject*, PyObject* args) KX_Scene *kx_scene= gp_KetsjiScene; char *path; char *group; + Py_buffer py_buffer; + py_buffer.buf = NULL; char *err_str= NULL; - if (!PyArg_ParseTuple(args,"ss:LibLoad",&path, &group)) + if (!PyArg_ParseTuple(args,"ss|y*:LibLoad",&path, &group, &py_buffer)) return NULL; - if(kx_scene->GetSceneConverter()->LinkBlendFile(path, group, kx_scene, &err_str)) { - Py_RETURN_TRUE; + if (!py_buffer.buf) + { + if(kx_scene->GetSceneConverter()->LinkBlendFilePath(path, group, kx_scene, &err_str)) { + Py_RETURN_TRUE; + } + } + else + { + + if(kx_scene->GetSceneConverter()->LinkBlendFileMemory(py_buffer.buf, py_buffer.len, path, group, kx_scene, &err_str)) { + PyBuffer_Release(&py_buffer); + Py_RETURN_TRUE; + } + + PyBuffer_Release(&py_buffer); } if(err_str) { @@ -675,7 +686,7 @@ static PyObject *gLibNew(PyObject*, PyObject* args) return NULL; } - idcode= BLO_idcode_from_name(group); + idcode= BKE_idcode_from_name(group); if(idcode==0) { PyErr_Format(PyExc_ValueError, "invalid group given \"%s\"", group); return NULL; @@ -761,7 +772,6 @@ static struct PyMethodDef game_methods[] = { {"getRandomFloat",(PyCFunction) gPyGetRandomFloat, METH_NOARGS, (const char *)gPyGetRandomFloat_doc}, {"setGravity",(PyCFunction) gPySetGravity, METH_O, (const char *)"set Gravitation"}, {"getSpectrum",(PyCFunction) gPyGetSpectrum, METH_NOARGS, (const char *)"get audio spectrum"}, - {"stopDSP",(PyCFunction) gPyStopDSP, METH_VARARGS, (const char *)"stop using the audio dsp (for performance reasons)"}, {"getMaxLogicFrame", (PyCFunction) gPyGetMaxLogicFrame, METH_NOARGS, (const char *)"Gets the max number of logic frame per render frame"}, {"setMaxLogicFrame", (PyCFunction) gPySetMaxLogicFrame, METH_VARARGS, (const char *)"Sets the max number of logic frame per render frame"}, {"getMaxPhysicsFrame", (PyCFunction) gPyGetMaxPhysicsFrame, METH_NOARGS, (const char *)"Gets the max number of physics frame per render frame"}, @@ -944,7 +954,6 @@ static PyObject* gPyDisableMist(PyObject*) Py_RETURN_NONE; } - static PyObject* gPySetMistStart(PyObject*, PyObject* args) { @@ -1241,7 +1250,7 @@ static struct PyMethodDef rasterizer_methods[] = { // Initialization function for the module (*must* be called initGameLogic) static char GameLogic_module_documentation[] = -"This is the Python API for the game engine of GameLogic" +"This is the Python API for the game engine of bge.logic" ; static char Rasterizer_module_documentation[] = @@ -1322,7 +1331,6 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack KX_MACRO_addTypesToDict(d, KX_PROPSENSOR_EXPRESSION, SCA_PropertySensor::KX_PROPSENSOR_EXPRESSION); /* 3. Constraint actuator */ - /* XXX, TODO NXBGE, move constants names from KX_ACT_CONSTRAINT_foo to KX_CONSTRAINTACT_foo */ KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_LOCX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCX); KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_LOCY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCY); KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_LOCZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCZ); @@ -1338,18 +1346,18 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ORIX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX); KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ORIY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIY); KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ORIZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIZ); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHPX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPX); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHPY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPY); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHPZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPZ); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHNX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNX); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHNY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNY); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHNZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNZ); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_NORMAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_NORMAL); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_MATERIAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_MATERIAL); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_PERMANENT, KX_ConstraintActuator::KX_ACT_CONSTRAINT_PERMANENT); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_DISTANCE, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DISTANCE); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_LOCAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCAL); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_DOROTFH, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DOROTFH); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHPX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPX); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHPY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPY); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHPZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPZ); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHNX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNX); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHNY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNY); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_FHNZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNZ); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_NORMAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_NORMAL); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_MATERIAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_MATERIAL); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_PERMANENT, KX_ConstraintActuator::KX_ACT_CONSTRAINT_PERMANENT); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DISTANCE, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DISTANCE); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_LOCAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCAL); + KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DOROTFH, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DOROTFH); /* 4. Ipo actuator, simple part */ KX_MACRO_addTypesToDict(d, KX_IPOACT_PLAY, KX_IpoActuator::KX_ACT_IPO_PLAY); @@ -1602,7 +1610,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack // Check for errors if (PyErr_Occurred()) { - Py_FatalError("can't initialize module GameLogic"); + Py_FatalError("can't initialize module bge.logic"); } return m; @@ -1933,7 +1941,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur PyObjectPlus::ClearDeprecationWarning(); - return bpy_namespace_dict_new(NULL); + return PyC_DefaultNameSpace(NULL); } void exitGamePlayerPythonScripting() @@ -1969,7 +1977,7 @@ PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLev PyObjectPlus::NullDeprecationWarning(); - return bpy_namespace_dict_new(NULL); + return PyC_DefaultNameSpace(NULL); } void exitGamePythonScripting() @@ -1999,7 +2007,6 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main * PyDict_SetItemString(PyModule_GetDict(*gameLogic), "globalDict", pyGlobalDict); // Same as importing the module. *gameLogic_keys = PyDict_Keys(PyModule_GetDict(*gameLogic)); - PyDict_SetItemString(dictionaryobject, "GameLogic", *gameLogic); // Same as importing the module. initGameKeys(); initPythonConstraintBinding(); @@ -2007,10 +2014,11 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main * initGeometry(); initBGL(); initBLF(); + AUD_initPython(); initVideoTexture(); /* could be done a lot more nicely, but for now a quick way to get bge.* working */ - PyRun_SimpleString("__import__('sys').modules['bge']=[mod for mod in (type(__builtins__)('bge'), ) if mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')}) is None][0]"); + PyRun_SimpleString("sys = __import__('sys');mod = sys.modules['bge'] = type(sys)('bge');mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes'), 'texture':__import__('VideoTexture')});"); } static struct PyModuleDef Rasterizer_module_def = { @@ -2358,15 +2366,15 @@ int saveGamePythonConfig( char **marshal_buffer) memcpy(*marshal_buffer, marshal_cstring, marshal_length); Py_DECREF(pyGlobalDictMarshal); } else { - printf("Error, GameLogic.globalDict could not be marshal'd\n"); + printf("Error, bge.logic.globalDict could not be marshal'd\n"); } } else { - printf("Error, GameLogic.globalDict was removed\n"); + printf("Error, bge.logic.globalDict was removed\n"); } Py_DECREF(gameLogic); } else { PyErr_Clear(); - printf("Error, GameLogic failed to import GameLogic.globalDict will be lost\n"); + printf("Error, bge.logic failed to import bge.logic.globalDict will be lost\n"); } return marshal_length; } @@ -2398,7 +2406,7 @@ int loadGamePythonConfig(char *marshal_buffer, int marshal_length) } } else { PyErr_Clear(); - printf("Error, GameLogic failed to import GameLogic.globalDict will be lost\n"); + printf("Error, bge.logic failed to import bge.logic.globalDict will be lost\n"); } } return 0; diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index cbd4b96f566..f755e87fee0 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -28,7 +28,7 @@ * Ketsji scene. Holds references to all scene data. */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif //WIN32 diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 7f9b090d680..9ebb36578c4 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -31,6 +31,7 @@ */ #include "KX_SoundActuator.h" +#include "AUD_C-API.h" #include "KX_GameObject.h" #include "KX_PyMath.h" // needed for PyObjectFrom() #include <iostream> @@ -75,23 +76,20 @@ void KX_SoundActuator::play() // this is the sound that will be played and not deleted afterwards AUD_Sound* sound = m_sound; - // this sounds are for temporary stacked sounds, will be deleted if not NULL + // this sound is for temporary stacked sounds, will be deleted if not NULL AUD_Sound* sound2 = NULL; - AUD_Sound* sound3 = NULL; + + bool loop = false; switch (m_type) { case KX_SOUNDACT_LOOPBIDIRECTIONAL: case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: - // create a ping pong sound on sound2 stacked on the orignal sound - sound2 = AUD_pingpongSound(sound); - // create a loop sound on sound3 stacked on the pingpong sound and let that one play (save it to sound) - sound = sound3 = AUD_loopSound(sound2); - break; + sound = sound2 = AUD_pingpongSound(sound); + // fall through case KX_SOUNDACT_LOOPEND: case KX_SOUNDACT_LOOPSTOP: - // create a loop sound on sound2 stacked on the pingpong sound and let that one play (save it to sound) - sound = sound2 = AUD_loopSound(sound); + loop = true; break; case KX_SOUNDACT_PLAYSTOP: case KX_SOUNDACT_PLAYEND: @@ -102,28 +100,27 @@ void KX_SoundActuator::play() if(m_is3d) { // sound shall be played 3D - m_handle = AUD_play3D(sound, 0); - - AUD_set3DSourceSetting(m_handle, AUD_3DSS_MAX_GAIN, m_3d.max_gain); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_MIN_GAIN, m_3d.min_gain); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_REFERENCE_DISTANCE, m_3d.reference_distance); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_MAX_DISTANCE, m_3d.max_distance); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_ROLLOFF_FACTOR, m_3d.rolloff_factor); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_CONE_INNER_ANGLE, m_3d.cone_inner_angle); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_CONE_OUTER_ANGLE, m_3d.cone_outer_angle); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_CONE_OUTER_GAIN, m_3d.cone_outer_gain); + m_handle = AUD_play(sound, 0); + + AUD_setRelative(m_handle, false); + AUD_setVolumeMaximum(m_handle, m_3d.max_gain); + AUD_setVolumeMinimum(m_handle, m_3d.min_gain); + AUD_setDistanceReference(m_handle, m_3d.reference_distance); + AUD_setDistanceMaximum(m_handle, m_3d.max_distance); + AUD_setAttenuation(m_handle, m_3d.rolloff_factor); + AUD_setConeAngleInner(m_handle, m_3d.cone_inner_angle); + AUD_setConeAngleOuter(m_handle, m_3d.cone_outer_angle); + AUD_setConeVolumeOuter(m_handle, m_3d.cone_outer_gain); } else m_handle = AUD_play(sound, 0); + if(loop) + AUD_setLoop(m_handle, -1); AUD_setSoundPitch(m_handle, m_pitch); AUD_setSoundVolume(m_handle, m_volume); m_isplaying = true; - // now we unload the pingpong and loop sounds, as we don't need them anymore - // the started sound will continue playing like it was created, don't worry! - if(sound3) - AUD_unload(sound3); if(sound2) AUD_unload(sound2); } @@ -183,7 +180,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) case KX_SOUNDACT_LOOPBIDIRECTIONAL: { // stop the looping so that the sound stops when it finished - AUD_setLoop(m_handle, 0, -1); + AUD_setLoop(m_handle, 0); break; } default: @@ -215,39 +212,15 @@ bool KX_SoundActuator::Update(double curtime, bool frame) { if(m_is3d) { - AUD_3DData data; - float f; - ((KX_GameObject*)this->GetParent())->NodeGetWorldPosition().getValue(data.position); - ((KX_GameObject*)this->GetParent())->GetLinearVelocity().getValue(data.velocity); - ((KX_GameObject*)this->GetParent())->NodeGetWorldOrientation().getValue3x3(data.orientation); - - /* - * The 3D data from blender has to be transformed for OpenAL: - * - In blender z is up and y is forwards - * - In OpenAL y is up and z is backwards - * We have to do that for all 5 vectors. - */ - f = data.position[1]; - data.position[1] = data.position[2]; - data.position[2] = -f; - - f = data.velocity[1]; - data.velocity[1] = data.velocity[2]; - data.velocity[2] = -f; - - f = data.orientation[1]; - data.orientation[1] = data.orientation[2]; - data.orientation[2] = -f; - - f = data.orientation[4]; - data.orientation[4] = data.orientation[5]; - data.orientation[5] = -f; - - f = data.orientation[7]; - data.orientation[7] = data.orientation[8]; - data.orientation[8] = -f; - - AUD_update3DSource(m_handle, &data); + KX_GameObject* obj = (KX_GameObject*)this->GetParent(); + float f[4]; + + obj->NodeGetWorldPosition().getValue(f); + AUD_setSourceLocation(m_handle, f); + obj->GetLinearVelocity().getValue(f); + AUD_setSourceVelocity(m_handle, f); + obj->NodeGetWorldOrientation().getRotation().getValue(f); + AUD_setSourceOrientation(m_handle, f); } result = true; } @@ -300,19 +273,18 @@ PyMethodDef KX_SoundActuator::Methods[] = { PyAttributeDef KX_SoundActuator::Attributes[] = { KX_PYATTRIBUTE_BOOL_RO("is3D", KX_SoundActuator, m_is3d), - KX_PYATTRIBUTE_RW_FUNCTION("maxGain3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("minGain3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("referenceDistance3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("maxDistance3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("rolloffFactor3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("coneInnerAngle3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("coneOuterAngle3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("coneOuterGain3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - + KX_PYATTRIBUTE_RW_FUNCTION("volume_maximum", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), + KX_PYATTRIBUTE_RW_FUNCTION("volume_minimum", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), + KX_PYATTRIBUTE_RW_FUNCTION("distance_reference", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), + KX_PYATTRIBUTE_RW_FUNCTION("distance_maximum", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), + KX_PYATTRIBUTE_RW_FUNCTION("attenuation", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), + KX_PYATTRIBUTE_RW_FUNCTION("cone_angle_inner", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), + KX_PYATTRIBUTE_RW_FUNCTION("cone_angle_outer", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), + KX_PYATTRIBUTE_RW_FUNCTION("cone_volume_outer", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), + KX_PYATTRIBUTE_RW_FUNCTION("time", KX_SoundActuator, pyattr_get_audposition, pyattr_set_audposition), KX_PYATTRIBUTE_RW_FUNCTION("volume", KX_SoundActuator, pyattr_get_gain, pyattr_set_gain), KX_PYATTRIBUTE_RW_FUNCTION("pitch", KX_SoundActuator, pyattr_get_pitch, pyattr_set_pitch), - KX_PYATTRIBUTE_RW_FUNCTION("rollOffFactor", KX_SoundActuator, pyattr_get_rollOffFactor, pyattr_set_rollOffFactor), KX_PYATTRIBUTE_ENUM_RW("mode",KX_SoundActuator::KX_SOUNDACT_NODEF+1,KX_SoundActuator::KX_SOUNDACT_MAX-1,false,KX_SoundActuator,m_type), { NULL } //Sentinel }; @@ -358,28 +330,28 @@ PyObject* KX_SoundActuator::pyattr_get_3d_property(void *self, const struct KX_P const char* prop = attrdef->m_name; float result_value = 0.0; - if(!strcmp(prop, "maxGain3D")) { + if(!strcmp(prop, "volume_maximum")) { result_value = actuator->m_3d.max_gain; - } else if (!strcmp(prop, "minGain3D")) { + } else if (!strcmp(prop, "volume_minimum")) { result_value = actuator->m_3d.min_gain; - } else if (!strcmp(prop, "referenceDistance3D")) { + } else if (!strcmp(prop, "distance_reference")) { result_value = actuator->m_3d.reference_distance; - } else if (!strcmp(prop, "maxDistance3D")) { + } else if (!strcmp(prop, "distance_maximum")) { result_value = actuator->m_3d.max_distance; - } else if (!strcmp(prop, "rolloffFactor3D")) { + } else if (!strcmp(prop, "attenuation")) { result_value = actuator->m_3d.rolloff_factor; - } else if (!strcmp(prop, "coneInnerAngle3D")) { + } else if (!strcmp(prop, "cone_angle_inner")) { result_value = actuator->m_3d.cone_inner_angle; - } else if (!strcmp(prop, "coneOuterAngle3D")) { + } else if (!strcmp(prop, "cone_angle_outer")) { result_value = actuator->m_3d.cone_outer_angle; - } else if (!strcmp(prop, "coneOuterGain3D")) { + } else if (!strcmp(prop, "cone_volume_outer")) { result_value = actuator->m_3d.cone_outer_gain; } else { @@ -423,66 +395,63 @@ PyObject* KX_SoundActuator::pyattr_get_pitch(void *self, const struct KX_PYATTRI return result; } -PyObject* KX_SoundActuator::pyattr_get_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self); - float rollofffactor = actuator->m_3d.rolloff_factor; - PyObject* result = PyFloat_FromDouble(rollofffactor); - - return result; -} - int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self); const char* prop = attrdef->m_name; float prop_value = 0.0; - AUD_3DSourceSetting setting = AUD_3DSS_NONE; if (!PyArg_Parse(value, "f", &prop_value)) return PY_SET_ATTR_FAIL; - // update the internal value - if(!strcmp(prop, "maxGain3D")) { + // if sound is working and 3D, set the new setting + if(!actuator->m_is3d) + return PY_SET_ATTR_FAIL; + + if(!strcmp(prop, "volume_maximum")) { actuator->m_3d.max_gain = prop_value; - setting = AUD_3DSS_MAX_GAIN; + if(actuator->m_handle) + AUD_setVolumeMaximum(actuator->m_handle, prop_value); - } else if (!strcmp(prop, "minGain3D")) { + } else if (!strcmp(prop, "volume_minimum")) { actuator->m_3d.min_gain = prop_value; - setting = AUD_3DSS_MIN_GAIN; + if(actuator->m_handle) + AUD_setVolumeMinimum(actuator->m_handle, prop_value); - } else if (!strcmp(prop, "referenceDistance3D")) { + } else if (!strcmp(prop, "distance_reference")) { actuator->m_3d.reference_distance = prop_value; - setting = AUD_3DSS_REFERENCE_DISTANCE; + if(actuator->m_handle) + AUD_setDistanceReference(actuator->m_handle, prop_value); - } else if (!strcmp(prop, "maxDistance3D")) { + } else if (!strcmp(prop, "distance_maximum")) { actuator->m_3d.max_distance = prop_value; - setting = AUD_3DSS_MAX_DISTANCE; + if(actuator->m_handle) + AUD_setDistanceMaximum(actuator->m_handle, prop_value); - } else if (!strcmp(prop, "rolloffFactor3D")) { + } else if (!strcmp(prop, "attenuation")) { actuator->m_3d.rolloff_factor = prop_value; - setting = AUD_3DSS_ROLLOFF_FACTOR; + if(actuator->m_handle) + AUD_setAttenuation(actuator->m_handle, prop_value); - } else if (!!strcmp(prop, "coneInnerAngle3D")) { + } else if (!!strcmp(prop, "cone_angle_inner")) { actuator->m_3d.cone_inner_angle = prop_value; - setting = AUD_3DSS_CONE_INNER_ANGLE; + if(actuator->m_handle) + AUD_setConeAngleInner(actuator->m_handle, prop_value); - } else if (!strcmp(prop, "coneOuterAngle3D")) { + } else if (!strcmp(prop, "cone_angle_outer")) { actuator->m_3d.cone_outer_angle = prop_value; - setting = AUD_3DSS_CONE_OUTER_ANGLE; + if(actuator->m_handle) + AUD_setConeAngleOuter(actuator->m_handle, prop_value); - } else if (!strcmp(prop, "coneOuterGain3D")) { + } else if (!strcmp(prop, "cone_volume_outer")) { actuator->m_3d.cone_outer_gain = prop_value; - setting = AUD_3DSS_CONE_OUTER_GAIN; + if(actuator->m_handle) + AUD_setConeVolumeOuter(actuator->m_handle, prop_value); } else { return PY_SET_ATTR_FAIL; - } + } - // if sound is working and 3D, set the new setting - if(actuator->m_handle && actuator->m_is3d && setting != AUD_3DSS_NONE) - AUD_set3DSourceSetting(actuator->m_handle, setting, prop_value); - return PY_SET_ATTR_SUCCESS; } @@ -527,18 +496,4 @@ int KX_SoundActuator::pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_D return PY_SET_ATTR_SUCCESS; } -int KX_SoundActuator::pyattr_set_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self); - float rollofffactor = 1.0; - if (!PyArg_Parse(value, "f", &rollofffactor)) - return PY_SET_ATTR_FAIL; - - actuator->m_3d.rolloff_factor = rollofffactor; - if(actuator->m_handle) - AUD_set3DSourceSetting(actuator->m_handle, AUD_3DSS_ROLLOFF_FACTOR, rollofffactor); - - return PY_SET_ATTR_SUCCESS; -} - #endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h index 1eaea276191..c175a184a15 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.h +++ b/source/gameengine/Ketsji/KX_SoundActuator.h @@ -58,7 +58,7 @@ class KX_SoundActuator : public SCA_IActuator float m_pitch; bool m_is3d; KX_3DSoundSettings m_3d; - AUD_Handle* m_handle; + AUD_Channel* m_handle; void play(); @@ -107,14 +107,12 @@ public: static int pyattr_set_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static int pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static int pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static int pyattr_set_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static int pyattr_set_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static PyObject* pyattr_get_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); #endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h index b020683bfc6..f4eb4d18ab3 100644 --- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h +++ b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h @@ -30,7 +30,7 @@ #ifndef __KX_TIME_CATEGORY_LOGGER_H #define __KX_TIME_CATEGORY_LOGGER_H -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) // suppress stl-MSVC debug info warning #endif diff --git a/source/gameengine/Ketsji/KX_TimeLogger.h b/source/gameengine/Ketsji/KX_TimeLogger.h index 058b1c2b6c7..9a5c124a462 100644 --- a/source/gameengine/Ketsji/KX_TimeLogger.h +++ b/source/gameengine/Ketsji/KX_TimeLogger.h @@ -30,7 +30,7 @@ #ifndef __KX_TIME_LOGGER_H #define __KX_TIME_LOGGER_H -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) // suppress stl-MSVC debug info warning #endif diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp index 652bf5eafed..09630ad2851 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.cpp +++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp @@ -73,247 +73,359 @@ PyMethodDef KX_VertexProxy::Methods[] = { }; PyAttributeDef KX_VertexProxy::Attributes[] = { - //KX_PYATTRIBUTE_TODO("DummyProps"), + KX_PYATTRIBUTE_RW_FUNCTION("x", KX_VertexProxy, pyattr_get_x, pyattr_set_x), + KX_PYATTRIBUTE_RW_FUNCTION("y", KX_VertexProxy, pyattr_get_y, pyattr_set_y), + KX_PYATTRIBUTE_RW_FUNCTION("z", KX_VertexProxy, pyattr_get_z, pyattr_set_z), - KX_PYATTRIBUTE_DUMMY("x"), - KX_PYATTRIBUTE_DUMMY("y"), - KX_PYATTRIBUTE_DUMMY("z"), + KX_PYATTRIBUTE_RW_FUNCTION("r", KX_VertexProxy, pyattr_get_r, pyattr_set_r), + KX_PYATTRIBUTE_RW_FUNCTION("g", KX_VertexProxy, pyattr_get_g, pyattr_set_g), + KX_PYATTRIBUTE_RW_FUNCTION("b", KX_VertexProxy, pyattr_get_b, pyattr_set_b), + KX_PYATTRIBUTE_RW_FUNCTION("a", KX_VertexProxy, pyattr_get_a, pyattr_set_a), - KX_PYATTRIBUTE_DUMMY("r"), - KX_PYATTRIBUTE_DUMMY("g"), - KX_PYATTRIBUTE_DUMMY("b"), - KX_PYATTRIBUTE_DUMMY("a"), + KX_PYATTRIBUTE_RW_FUNCTION("u", KX_VertexProxy, pyattr_get_u, pyattr_set_u), + KX_PYATTRIBUTE_RW_FUNCTION("v", KX_VertexProxy, pyattr_get_v, pyattr_set_v), - KX_PYATTRIBUTE_DUMMY("u"), - KX_PYATTRIBUTE_DUMMY("v"), + KX_PYATTRIBUTE_RW_FUNCTION("u2", KX_VertexProxy, pyattr_get_u2, pyattr_set_u2), + KX_PYATTRIBUTE_RW_FUNCTION("v2", KX_VertexProxy, pyattr_get_v2, pyattr_set_v2), - KX_PYATTRIBUTE_DUMMY("u2"), - KX_PYATTRIBUTE_DUMMY("v2"), + KX_PYATTRIBUTE_RW_FUNCTION("XYZ", KX_VertexProxy, pyattr_get_XYZ, pyattr_set_XYZ), + KX_PYATTRIBUTE_RW_FUNCTION("UV", KX_VertexProxy, pyattr_get_UV, pyattr_set_UV), - KX_PYATTRIBUTE_DUMMY("XYZ"), - KX_PYATTRIBUTE_DUMMY("UV"), - - KX_PYATTRIBUTE_DUMMY("color"), - KX_PYATTRIBUTE_DUMMY("colour"), - - KX_PYATTRIBUTE_DUMMY("normal"), + KX_PYATTRIBUTE_RW_FUNCTION("color", KX_VertexProxy, pyattr_get_color, pyattr_set_color), + KX_PYATTRIBUTE_RW_FUNCTION("normal", KX_VertexProxy, pyattr_get_normal, pyattr_set_normal), { NULL } //Sentinel }; -#if 0 -PyObject* -KX_VertexProxy::py_getattro(PyObject *attr) -{ - char *attr_str= _PyUnicode_AsString(attr); - if (attr_str[1]=='\0') { // Group single letters - // pos - if (attr_str[0]=='x') - return PyFloat_FromDouble(m_vertex->getXYZ()[0]); - if (attr_str[0]=='y') - return PyFloat_FromDouble(m_vertex->getXYZ()[1]); - if (attr_str[0]=='z') - return PyFloat_FromDouble(m_vertex->getXYZ()[2]); - - // Col - if (attr_str[0]=='r') - return PyFloat_FromDouble(m_vertex->getRGBA()[0]/255.0); - if (attr_str[0]=='g') - return PyFloat_FromDouble(m_vertex->getRGBA()[1]/255.0); - if (attr_str[0]=='b') - return PyFloat_FromDouble(m_vertex->getRGBA()[2]/255.0); - if (attr_str[0]=='a') - return PyFloat_FromDouble(m_vertex->getRGBA()[3]/255.0); - - // UV - if (attr_str[0]=='u') - return PyFloat_FromDouble(m_vertex->getUV1()[0]); - if (attr_str[0]=='v') - return PyFloat_FromDouble(m_vertex->getUV1()[1]); - } - - - if (!strcmp(attr_str, "XYZ")) - return PyObjectFrom(MT_Vector3(m_vertex->getXYZ())); - - if (!strcmp(attr_str, "UV")) - return PyObjectFrom(MT_Point2(m_vertex->getUV1())); - - if (!strcmp(attr_str, "color") || !strcmp(attr_str, "colour")) - { - const unsigned char *colp = m_vertex->getRGBA(); - MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]); - color /= 255.0; - return PyObjectFrom(color); - } +PyObject* KX_VertexProxy::pyattr_get_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getXYZ()[0]); +} - if (!strcmp(attr_str, "normal")) - { - return PyObjectFrom(MT_Vector3(m_vertex->getNormal())); - } +PyObject* KX_VertexProxy::pyattr_get_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getXYZ()[1]); +} - py_getattro_up(CValue); +PyObject* KX_VertexProxy::pyattr_get_z(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getXYZ()[2]); } -#endif +PyObject* KX_VertexProxy::pyattr_get_r(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getRGBA()[0]/255.0); +} -#if 0 -int KX_VertexProxy::py_setattro(PyObject *attr, PyObject *pyvalue) +PyObject* KX_VertexProxy::pyattr_get_g(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { - char *attr_str= _PyUnicode_AsString(attr); - if (PySequence_Check(pyvalue)) - { - if (!strcmp(attr_str, "XYZ")) - { - MT_Point3 vec; - if (PyVecTo(pyvalue, vec)) - { - m_vertex->SetXYZ(vec); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - return PY_SET_ATTR_FAIL; - } + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getRGBA()[1]/255.0); +} - if (!strcmp(attr_str, "UV")) - { - MT_Point2 vec; - if (PyVecTo(pyvalue, vec)) - { - m_vertex->SetUV(vec); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - return PY_SET_ATTR_FAIL; - } +PyObject* KX_VertexProxy::pyattr_get_b(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getRGBA()[2]/255.0); +} - if (!strcmp(attr_str, "color") || !strcmp(attr_str, "colour")) - { - MT_Vector4 vec; - if (PyVecTo(pyvalue, vec)) - { - m_vertex->SetRGBA(vec); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - return PY_SET_ATTR_FAIL; - } +PyObject* KX_VertexProxy::pyattr_get_a(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getRGBA()[3]/255.0); +} - if (!strcmp(attr_str, "normal")) - { - MT_Vector3 vec; - if (PyVecTo(pyvalue, vec)) - { - m_vertex->SetNormal(vec); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - return PY_SET_ATTR_FAIL; - } - } - - if (PyFloat_Check(pyvalue)) - { - float val = PyFloat_AsDouble(pyvalue); - // pos - MT_Point3 pos(m_vertex->getXYZ()); - if (!strcmp(attr_str, "x")) +PyObject* KX_VertexProxy::pyattr_get_u(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getUV1()[0]); +} + +PyObject* KX_VertexProxy::pyattr_get_v(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getUV1()[1]); +} + +PyObject* KX_VertexProxy::pyattr_get_u2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getUV2()[0]); +} + +PyObject* KX_VertexProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyFloat_FromDouble(self->m_vertex->getUV2()[1]); +} + +PyObject* KX_VertexProxy::pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyObjectFrom(MT_Vector3(self->m_vertex->getXYZ())); +} + +PyObject* KX_VertexProxy::pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyObjectFrom(MT_Point2(self->m_vertex->getUV1())); +} + +PyObject* KX_VertexProxy::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + const unsigned char *colp = self->m_vertex->getRGBA(); + MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]); + color /= 255.0; + return PyObjectFrom(color); +} + +PyObject* KX_VertexProxy::pyattr_get_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + return PyObjectFrom(MT_Vector3(self->m_vertex->getNormal())); +} + +int KX_VertexProxy::pyattr_set_x(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + MT_Point3 pos(self->m_vertex->getXYZ()); pos.x() = val; - m_vertex->SetXYZ(pos); - m_mesh->SetMeshModified(true); + self->m_vertex->SetXYZ(pos); + self->m_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } + return PY_SET_ATTR_FAIL; +} - if (!strcmp(attr_str, "y")) +int KX_VertexProxy::pyattr_set_y(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + MT_Point3 pos(self->m_vertex->getXYZ()); pos.y() = val; - m_vertex->SetXYZ(pos); - m_mesh->SetMeshModified(true); + self->m_vertex->SetXYZ(pos); + self->m_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } + return PY_SET_ATTR_FAIL; +} - if (!strcmp(attr_str, "z")) +int KX_VertexProxy::pyattr_set_z(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + MT_Point3 pos(self->m_vertex->getXYZ()); pos.z() = val; - m_vertex->SetXYZ(pos); - m_mesh->SetMeshModified(true); + self->m_vertex->SetXYZ(pos); + self->m_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } + return PY_SET_ATTR_FAIL; +} - // uv - MT_Point2 uv = m_vertex->getUV1(); - if (!strcmp(attr_str, "u")) +int KX_VertexProxy::pyattr_set_u(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + MT_Point2 uv = self->m_vertex->getUV1(); uv[0] = val; - m_vertex->SetUV(uv); - m_mesh->SetMeshModified(true); + self->m_vertex->SetUV(uv); + self->m_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } + return PY_SET_ATTR_FAIL; +} - if (!strcmp(attr_str, "v")) +int KX_VertexProxy::pyattr_set_v(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + MT_Point2 uv = self->m_vertex->getUV1(); uv[1] = val; - m_vertex->SetUV(uv); - m_mesh->SetMeshModified(true); + self->m_vertex->SetUV(uv); + self->m_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } + return PY_SET_ATTR_FAIL; +} - // uv - MT_Point2 uv2 = m_vertex->getUV2(); - if (!strcmp(attr_str, "u2")) +int KX_VertexProxy::pyattr_set_u2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + MT_Point2 uv = self->m_vertex->getUV2(); uv[0] = val; - m_vertex->SetUV2(uv); - m_mesh->SetMeshModified(true); - return 0; + self->m_vertex->SetUV2(uv); + self->m_mesh->SetMeshModified(true); + return PY_SET_ATTR_SUCCESS; } + return PY_SET_ATTR_FAIL; +} - if (!strcmp(attr_str, "v2")) +int KX_VertexProxy::pyattr_set_v2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + MT_Point2 uv = self->m_vertex->getUV2(); uv[1] = val; - m_vertex->SetUV2(uv); - m_mesh->SetMeshModified(true); + self->m_vertex->SetUV2(uv); + self->m_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } + return PY_SET_ATTR_FAIL; +} - // col - unsigned int icol = *((const unsigned int *)m_vertex->getRGBA()); - unsigned char *cp = (unsigned char*) &icol; - val *= 255.0; - if (!strcmp(attr_str, "r")) +int KX_VertexProxy::pyattr_set_r(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA()); + unsigned char *cp = (unsigned char*) &icol; + val *= 255.0; cp[0] = (unsigned char) val; - m_vertex->SetRGBA(icol); - m_mesh->SetMeshModified(true); + self->m_vertex->SetRGBA(icol); + self->m_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } - if (!strcmp(attr_str, "g")) + return PY_SET_ATTR_FAIL; +} + +int KX_VertexProxy::pyattr_set_g(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA()); + unsigned char *cp = (unsigned char*) &icol; + val *= 255.0; cp[1] = (unsigned char) val; - m_vertex->SetRGBA(icol); - m_mesh->SetMeshModified(true); + self->m_vertex->SetRGBA(icol); + self->m_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } - if (!strcmp(attr_str, "b")) + return PY_SET_ATTR_FAIL; +} + +int KX_VertexProxy::pyattr_set_b(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA()); + unsigned char *cp = (unsigned char*) &icol; + val *= 255.0; cp[2] = (unsigned char) val; - m_vertex->SetRGBA(icol); - m_mesh->SetMeshModified(true); + self->m_vertex->SetRGBA(icol); + self->m_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } - if (!strcmp(attr_str, "a")) + return PY_SET_ATTR_FAIL; +} + +int KX_VertexProxy::pyattr_set_a(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PyFloat_Check(value)) { + float val = PyFloat_AsDouble(value); + unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA()); + unsigned char *cp = (unsigned char*) &icol; + val *= 255.0; cp[3] = (unsigned char) val; - m_vertex->SetRGBA(icol); - m_mesh->SetMeshModified(true); + self->m_vertex->SetRGBA(icol); + self->m_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } - } + return PY_SET_ATTR_FAIL; +} - return CValue::py_setattro(attr, pyvalue); +int KX_VertexProxy::pyattr_set_XYZ(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PySequence_Check(value)) + { + MT_Point3 vec; + if (PyVecTo(value, vec)) + { + self->m_vertex->SetXYZ(vec); + self->m_mesh->SetMeshModified(true); + return PY_SET_ATTR_SUCCESS; + } + } + return PY_SET_ATTR_FAIL; +} + +int KX_VertexProxy::pyattr_set_UV(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PySequence_Check(value)) + { + MT_Point2 vec; + if (PyVecTo(value, vec)) + { + self->m_vertex->SetUV(vec); + self->m_mesh->SetMeshModified(true); + return PY_SET_ATTR_SUCCESS; + } + } + return PY_SET_ATTR_FAIL; +} + +int KX_VertexProxy::pyattr_set_color(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PySequence_Check(value)) + { + MT_Vector4 vec; + if (PyVecTo(value, vec)) + { + self->m_vertex->SetRGBA(vec); + self->m_mesh->SetMeshModified(true); + return PY_SET_ATTR_SUCCESS; + } + } + return PY_SET_ATTR_FAIL; +} + +int KX_VertexProxy::pyattr_set_normal(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v); + if (PySequence_Check(value)) + { + MT_Vector3 vec; + if (PyVecTo(value, vec)) + { + self->m_vertex->SetNormal(vec); + self->m_mesh->SetMeshModified(true); + return PY_SET_ATTR_SUCCESS; + } + } + return PY_SET_ATTR_FAIL; } -#endif KX_VertexProxy::KX_VertexProxy(KX_MeshProxy*mesh, RAS_TexVert* vertex) : m_vertex(vertex), diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h b/source/gameengine/Ketsji/KX_VertexProxy.h index 08fe0e7e2f8..b39d3ecb7d4 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.h +++ b/source/gameengine/Ketsji/KX_VertexProxy.h @@ -56,6 +56,37 @@ public: // stuff for python integration + static PyObject* pyattr_get_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_z(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_r(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_g(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_b(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_a(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_u(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_v(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_u2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static int pyattr_set_x(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_y(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_z(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_u(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_v(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_u2(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_v2(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_r(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_g(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_b(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_a(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_XYZ(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_UV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_color(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static int pyattr_set_normal(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + KX_PYMETHOD_NOARGS(KX_VertexProxy,GetXYZ); KX_PYMETHOD_O(KX_VertexProxy,SetXYZ); KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV); diff --git a/source/gameengine/Ketsji/Makefile b/source/gameengine/Ketsji/Makefile index 1a7ec415382..79c8626d295 100644 --- a/source/gameengine/Ketsji/Makefile +++ b/source/gameengine/Ketsji/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 694175e8aca..37193d7cc77 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -28,18 +28,18 @@ incs += ' ' + env['BF_OPENGL_INC'] if env['WITH_BF_SDL']: incs += ' ' + env['BF_SDL_INC'] else: - defs.append('DISABLE_SDL') + defs.append('DISABLE_SDL') if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] + incs += ' ' + env['BF_PYTHON_INC'] else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') if env['WITH_BF_FFMPEG']: - defs.append('WITH_FFMPEG') - + defs.append('WITH_FFMPEG') + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): - if env['BF_DEBUG']: - defs.append('_DEBUG') # for Python + if env['BF_DEBUG']: + defs.append('_DEBUG') # for Python env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Makefile b/source/gameengine/Makefile index bcb4b9098e7..0fdac2acce2 100644 --- a/source/gameengine/Makefile +++ b/source/gameengine/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Network/LoopBackNetwork/Makefile b/source/gameengine/Network/LoopBackNetwork/Makefile index 690fd644094..236c28b0f23 100644 --- a/source/gameengine/Network/LoopBackNetwork/Makefile +++ b/source/gameengine/Network/LoopBackNetwork/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Network/Makefile b/source/gameengine/Network/Makefile index c6b22276113..99a047c8b95 100644 --- a/source/gameengine/Network/Makefile +++ b/source/gameengine/Network/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Network/TerraplayNetwork/Makefile b/source/gameengine/Network/TerraplayNetwork/Makefile index d987263d433..d5a4c86740b 100644 --- a/source/gameengine/Network/TerraplayNetwork/Makefile +++ b/source/gameengine/Network/TerraplayNetwork/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index fd1a62d8997..421a9fc64b8 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -2027,6 +2027,11 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b collisionShape->setMargin(margin); break; + case PHY_SHAPE_CAPSULE: + collisionShape = new btCapsuleShapeZ(m_radius, m_height); + collisionShape->setMargin(margin); + break; + case PHY_SHAPE_MESH: // Let's use the latest btScaledBvhTriangleMeshShape: it allows true sharing of // triangle mesh information between duplicates => drastic performance increase when @@ -2162,4 +2167,3 @@ CcdShapeConstructionInfo::~CcdShapeConstructionInfo() } } - diff --git a/source/gameengine/Physics/Bullet/Makefile b/source/gameengine/Physics/Bullet/Makefile index 433d1df3d2f..0514565534d 100644 --- a/source/gameengine/Physics/Bullet/Makefile +++ b/source/gameengine/Physics/Bullet/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript index 976c6825351..f58085ab354 100644 --- a/source/gameengine/Physics/Bullet/SConscript +++ b/source/gameengine/Physics/Bullet/SConscript @@ -23,8 +23,8 @@ incs += ' ' + env['BF_BULLET_INC'] defs = [] if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] + incs += ' ' + env['BF_PYTHON_INC'] else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Physics/Dummy/Makefile b/source/gameengine/Physics/Dummy/Makefile index 0e36266ae09..9a600a0365f 100644 --- a/source/gameengine/Physics/Dummy/Makefile +++ b/source/gameengine/Physics/Dummy/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Physics/Makefile b/source/gameengine/Physics/Makefile index da0d4cafd2e..f5f914c2ac2 100644 --- a/source/gameengine/Physics/Makefile +++ b/source/gameengine/Physics/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Physics/common/Makefile b/source/gameengine/Physics/common/Makefile index f87da383520..369699e1b90 100644 --- a/source/gameengine/Physics/common/Makefile +++ b/source/gameengine/Physics/common/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Physics/common/PHY_DynamicTypes.h b/source/gameengine/Physics/common/PHY_DynamicTypes.h index 08d94a2850a..cc0f06a58cf 100644 --- a/source/gameengine/Physics/common/PHY_DynamicTypes.h +++ b/source/gameengine/Physics/common/PHY_DynamicTypes.h @@ -138,6 +138,7 @@ typedef enum PHY_ShapeType { PHY_SHAPE_SPHERE, PHY_SHAPE_CYLINDER, PHY_SHAPE_CONE, + PHY_SHAPE_CAPSULE, PHY_SHAPE_MESH, PHY_SHAPE_POLYTOPE, PHY_SHAPE_COMPOUND, @@ -148,4 +149,3 @@ typedef enum PHY_ShapeType { typedef float PHY_Vector3[3]; #endif //__PHY_DYNAMIC_TYPES - diff --git a/source/gameengine/PyDoc/PhysicsConstraints.py b/source/gameengine/PyDoc/PhysicsConstraints.py index 2859aedd2d1..01c922583e6 100644 --- a/source/gameengine/PyDoc/PhysicsConstraints.py +++ b/source/gameengine/PyDoc/PhysicsConstraints.py @@ -291,4 +291,4 @@ def setNumTimeSubSteps(numSubStep): # Does something # # @rtype: -# """
\ No newline at end of file +# """ diff --git a/source/gameengine/PyDoc/VideoTexture.py b/source/gameengine/PyDoc/VideoTexture.py index c74bd4f0f16..80ac1f4392a 100644 --- a/source/gameengine/PyDoc/VideoTexture.py +++ b/source/gameengine/PyDoc/VideoTexture.py @@ -215,4 +215,4 @@ def VideoFFmpeg(): Does something @rtype: - """
\ No newline at end of file + """ diff --git a/source/gameengine/PyDoc/bge.logic.rst b/source/gameengine/PyDoc/bge.logic.rst index a10733569f3..a7eb5635d0f 100644 --- a/source/gameengine/PyDoc/bge.logic.rst +++ b/source/gameengine/PyDoc/bge.logic.rst @@ -173,14 +173,16 @@ General functions Restarts the current game by reloading the .blend file (the last saved version, not what is currently running). -.. function:: LibLoad(blend, type) +.. function:: LibLoad(blend, type, data) Converts the all of the datablocks of the given type from the given blend. - :arg blend: The path to the blend file + :arg blend: The path to the blend file (or the name to use for the library if data is supplied) :type blend: string :arg type: The datablock type (currently only "Scene" and "Mesh" are supported) :type type: string + :arg data: Binary data from a blend file (optional) + :type data: bytes .. function:: LibNew(name, type, data) diff --git a/source/gameengine/PyDoc/bge.types.rst b/source/gameengine/PyDoc/bge.types.rst index 028b4fa72f3..96ba8d278f1 100644 --- a/source/gameengine/PyDoc/bge.types.rst +++ b/source/gameengine/PyDoc/bge.types.rst @@ -71,9 +71,9 @@ Game Engine bge.types Module .. attribute:: events - A list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). + A dictionary containing the status of each keyboard event or key. (read-only). - :type: list [[:ref:`keycode<keyboard-keys>`, :ref:`status<input-status>`], ...] + :type: dictionary {:ref:`keycode<keyboard-keys>`::ref:`status<input-status>`, ...} .. class:: SCA_PythonMouse(PyObjectPlus) @@ -81,9 +81,9 @@ Game Engine bge.types Module .. attribute:: events - a list of pressed buttons that have either been pressed, or just released, or are active this frame. (read-only). + a dictionary containing the status of each mouse event. (read-only). - :type: list [[:ref:`keycode<mouse-keys>`, :ref:`status<input-status>`], ...] + :type: dictionary {:ref:`keycode<mouse-keys>`::ref:`status<input-status>`, ...} .. attribute:: position diff --git a/source/gameengine/PyDoc/how_to_build_win.txt b/source/gameengine/PyDoc/how_to_build_win.txt index 018a28a9bfd..5610ced3b2a 100644 --- a/source/gameengine/PyDoc/how_to_build_win.txt +++ b/source/gameengine/PyDoc/how_to_build_win.txt @@ -13,4 +13,4 @@ C:\Python26\python.exe C:\Python26\Scripts\epydoc.py --debug -v -o BPY_GE --url 4) run your created batch file. If everything goes well it creates a folder named BPY_GE with all the generated documentation. -Documentation valid in March of 2010 - Blender 2.5alpha2
\ No newline at end of file +Documentation valid in March of 2010 - Blender 2.5alpha2 diff --git a/source/gameengine/Rasterizer/Makefile b/source/gameengine/Rasterizer/Makefile index c877e423a71..d800a02b181 100644 --- a/source/gameengine/Rasterizer/Makefile +++ b/source/gameengine/Rasterizer/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp index 32fb1e31780..42cdb9659e6 100644 --- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp +++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp @@ -26,7 +26,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // don't show these anoying STL warnings #pragma warning (disable:4786) #endif diff --git a/source/gameengine/Rasterizer/RAS_Deformer.h b/source/gameengine/Rasterizer/RAS_Deformer.h index 17c2cb4695e..f61ac7ea18a 100644 --- a/source/gameengine/Rasterizer/RAS_Deformer.h +++ b/source/gameengine/Rasterizer/RAS_Deformer.h @@ -30,7 +30,7 @@ #ifndef RAS_DEFORMER #define RAS_DEFORMER -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning #endif //WIN32 diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index ebca97a806a..32ba28bc395 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -29,7 +29,7 @@ #ifndef __RAS_IRASTERIZER #define __RAS_IRASTERIZER -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) #endif diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp index 14acd0259da..ef9bf4e22b7 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp @@ -28,8 +28,11 @@ #include "RAS_MaterialBucket.h" -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) +#endif + +#ifdef WIN32 #include <windows.h> #endif // WIN32 diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.h b/source/gameengine/Rasterizer/RAS_MeshObject.h index 5a834bf26b0..11499b4fbcb 100644 --- a/source/gameengine/Rasterizer/RAS_MeshObject.h +++ b/source/gameengine/Rasterizer/RAS_MeshObject.h @@ -29,7 +29,7 @@ #ifndef __RAS_MESHOBJECT #define __RAS_MESHOBJECT -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) // disable the STL warnings ("debug information length > 255") #pragma warning (disable:4786) #endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile index aedbc2705f0..357bdf9d99b 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index f2f70c68068..e531264eaec 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -29,7 +29,7 @@ #ifndef __RAS_OPENGLRASTERIZER #define __RAS_OPENGLRASTERIZER -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) #endif diff --git a/source/gameengine/Rasterizer/RAS_Polygon.cpp b/source/gameengine/Rasterizer/RAS_Polygon.cpp index b038d3bf31a..ab31bb59c36 100644 --- a/source/gameengine/Rasterizer/RAS_Polygon.cpp +++ b/source/gameengine/Rasterizer/RAS_Polygon.cpp @@ -26,7 +26,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -#ifdef WIN32 +#if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable:4786) #endif diff --git a/source/gameengine/Rasterizer/SConscript b/source/gameengine/Rasterizer/SConscript index 8bc99f1596e..a78a0289d98 100644 --- a/source/gameengine/Rasterizer/SConscript +++ b/source/gameengine/Rasterizer/SConscript @@ -9,8 +9,8 @@ incs = '. #intern/guardedalloc #source/kernel/gen_system #intern/string #intern/ defs = [ 'GLEW_STATIC' ] if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] + incs += ' ' + env['BF_PYTHON_INC'] else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), defs, libtype=['core','player'], priority=[350,70], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/SceneGraph/Makefile b/source/gameengine/SceneGraph/Makefile index acec1b729e8..8a797ae5a0e 100644 --- a/source/gameengine/SceneGraph/Makefile +++ b/source/gameengine/SceneGraph/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt index 3af514ca0de..34a32328e29 100644 --- a/source/gameengine/VideoTexture/CMakeLists.txt +++ b/source/gameengine/VideoTexture/CMakeLists.txt @@ -58,7 +58,7 @@ IF(WITH_FFMPEG) ENDIF(WITH_FFMPEG) IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) + LIST(APPEND INC ${PYTHON_INC}) ELSE(WITH_PYTHON) ADD_DEFINITIONS(-DDISABLE_PYTHON) ENDIF(WITH_PYTHON) diff --git a/source/gameengine/VideoTexture/Makefile b/source/gameengine/VideoTexture/Makefile index 1cb147860cd..af3417eef02 100644 --- a/source/gameengine/VideoTexture/Makefile +++ b/source/gameengine/VideoTexture/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. # All rights reserved. diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript index 70c7dfc6d3a..21a5f8ce3fe 100644 --- a/source/gameengine/VideoTexture/SConscript +++ b/source/gameengine/VideoTexture/SConscript @@ -16,13 +16,13 @@ incs += ' #intern/guardedalloc #extern/glew/include' defs = [] if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw'): - if env['BF_DEBUG']: - defs.append('_DEBUG') + if env['BF_DEBUG']: + defs.append('_DEBUG') if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] + incs += ' ' + env['BF_PYTHON_INC'] else: - defs.append('DISABLE_PYTHON') + defs.append('DISABLE_PYTHON') if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') |