Commit Graph

40 Commits

Author SHA1 Message Date
Campbell Barton
81dfdf8374 ifdef's for future py3 support, after this adding py3 can mostly be done with defines or batch renaming funcs (with the exception of CListValue slicing)
.
No changes for py2.x.
2009-04-29 16:54:45 +00:00
Campbell Barton
217bbb7800 BGE Python API
Separate getting a normal attribute and getting __dict__, was having to do too a check for __dict__ on each class (multiple times per getattro call from python) when its not used that often.
2009-04-20 23:17:52 +00:00
Campbell Barton
f5fc4ebdd8 BGE Python API
- More verbose error messages.
- BL_Shader wasnt setting error messages on some errors
- FilterNormal depth attribute was checking for float which is bad because scripts often expect ints assigned to float attributes.
- Added a check to PyVecTo for a tuple rather then always using a generic python sequence. On my system this is over 2x faster with an optmized build.
2009-04-19 21:01:12 +00:00
Campbell Barton
7dbc9dc719 BGE Python API cleanup - no functionality changes
- comments to PyObjectPlus.h
- remove unused/commented junk.
- renamed PyDestructor to py_base_dealloc for consistency
- all the PyTypeObject's were still using the sizeof() their class, can use sizeof(PyObjectPlus_Proxy) now which is smaller too.
2009-04-19 14:57:52 +00:00
Andre Susano Pinto
2fff90bbb4 Added function name to many of the PyArg_ParseTuple calls in gameengine
This way python raises more useful messages.
2009-04-10 16:45:19 +00:00
Campbell Barton
53e721305e BGE Python API
- made camera use PyAttributeDef's
- removed unneeded duplicate matrix type checks
- fixed own bug (added since 2.48a) that broke a converting 4x4 matrix to a PyObject
2009-04-05 06:08:41 +00:00
Campbell Barton
fd2b115678 Python BGE API
- Initialize python types with PyType_Ready, which adds methods to the type dictionary.
- use Pythons get/setattro (uses a python string for the attribute rather then char*). Using basic C strings seems nice but internally python converts them to python strings and discards them for most functions that accept char arrays.
- Method lookups use the PyTypes dictionary (should be faster then Py_FindMethod)
- Renamed __getattr -> py_base_getattro, _getattr -> py_getattro, __repr -> py_base_repr, py_delattro, py_getattro_self etc.

From here is possible to put all the parent classes methods into each python types dictionary to avoid nested lookups (api has 4 levels of lookups in some places), tested this but its not ready yet.

Simple tests for getting a method within a loop show this to be between 0.5 and 3.2x faster then using Py_FindMethod()
2009-04-03 14:51:06 +00:00
Campbell Barton
d573e9c539 BGE Python api
Added the method into the PyType so python knows about the methods (its supposed to work this way).
This means in the future the api can use PyType_Ready() to store the methods in the types dictionary.
Python3 removes Py_FindMethod and we should not be using it anyway since its not that efficient.
2009-04-03 04:12:20 +00:00
Campbell Barton
c785532bec Py BGE API
Python dir(ob) for game types now includes attributes names,
* Use "__dict__" rather then "__methods__" attribute to be Python 3.0 compatible
* Added _getattr_dict() for getting the method and attribute names from a PyObject, rather then building it in the macro.
* Added place holder *::Attribute array, needed for the _getattr_up macro.
2009-02-26 09:04:06 +00:00
Campbell Barton
2eb85c01f3 remove warnings for the BGE
- variables that shadow vers declared earlier
- Py_Fatal print an error to the stderr
- gcc was complaining about the order of initialized vars (for classes)
- const return values for ints and bools didnt do anything.
- braces for ambiguous if  statements
2009-02-25 03:26:02 +00:00
Campbell Barton
9d5c2af1d1 * removed typedefs that were not used (from anonymous enums and structs)
* Missed some cases of using a 'char *' as an attribute
* replace BGE's Py_Return macro with Pythons Py_RETURN_NONE
* other minor warnings removed
2009-02-21 12:43:24 +00:00
Campbell Barton
cdec2b3d15 BGE Python API
Use 'const char *' rather then the C++ 'STR_String' type for the attribute identifier of python attributes.

Each attribute and method access from python was allocating and freeing the string.
A simple test with getting an attribute a loop shows this speeds up attribute lookups a bit over 2x.
2009-02-19 13:42:07 +00:00
Campbell Barton
f510057fef [#17600] char* -> const char*
Thanks to Sean Bartell (wtachi), was causing many many warnings which distracted from the real problems.
2008-09-20 11:08:35 +00:00
Kent Mein
115cf18bed converted my gen_utils.h fix to PyObjectPlus.h
Also added a fix for PyMarshal_WriteObjectToString

Now I just need to figure out linking of the gameengine on my imac.

Kent
2008-09-06 14:13:31 +00:00
Kent Mein
8675ff6d1d Trying to keep things compiling on my imac (10.4.11)
I'm getting this error now:
GPG_Application.cpp: In member function 'void GPG_Application::stopEngine()':
/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3/marshal.h:12: error: too many arguments to function 'PyObject* PyMarshal_WriteObjectToString(PyObject*)'
GPG_Application.cpp:720: error: at this point in file

Are we offically not supporint older versions of python now? :)

Kent
2008-09-06 02:46:11 +00:00
Brecht Van Lommel
cb89decfdc Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:

* GLSL support in the viewport and game engine, enable in the game
  menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
  gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
  storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.

* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
  An extra texture slot shows up once the last slot is used.

* Memory limit for undo, not enabled by default yet because it
  needs the .B.blend to be changed.
* Multiple undo for image painting.

* An offset for dupligroups, so not all objects in a group have to
  be at the origin.
2008-09-04 20:51:28 +00:00
Campbell Barton
3f2cb6e878 game engine python api
* removed macros that were not used much, some misleading.
* removed error string setting calls that overwrote the error set by PyArg_ParseTuple with a less useful one.
* use python macros Py_RETURN_NONE, Py_RETURN_TRUE, Py_RETURN_FALSE
2008-08-14 03:23:36 +00:00
Campbell Barton
b0958b6646 Checked all cases where PyArg_ParseTuple is used in blenders game engine and made sure all will raise errors when called with invalid args. 2008-07-01 16:43:46 +00:00
Brecht Van Lommel
272a91f754 Merge of apricot branch game engine changes into trunk, excluding GLSL.
GLEW
====

Added the GLEW opengl extension library into extern/, always compiled
into Blender now. This is much nicer than doing this kind of extension
management manually, and will be used in the game engine, for GLSL, and
other opengl extensions.

* According to the GLEW website it works on Windows, Linux, Mac OS X,
  FreeBSD, Irix, and Solaris. There might still be platform specific
  issues due to this commit, so let me know and I'll look into it.
* This means also that all extensions will now always be compiled in,
  regardless of the glext.h on the platform where compilation happens.

Game Engine
===========

Refactoring of the use of opengl extensions and other drawing code
in the game engine, and cleaning up some hacks related to GLSL
integration. These changes will be merged into trunk too after this.

The game engine graphics demos & apricot level survived my tests,
but this could use some good testing of course.

For users: please test with the options "Generate Display Lists" and
"Vertex Arrays" enabled, these should be the fastest and are supposed
to be "unreliable", but if that's the case that's probably due to bugs
that can be fixed.

* The game engine now also uses GLEW for extensions, replacing the
  custom opengl extensions code that was there. Removes a lot of
  #ifdef's, but the runtime checks stay of course.
* Removed the WITHOUT_GLEXT environment variable. This was added to
  work around a specific bug and only disabled multitexturing anyway.
  It might also have caused a slowdown since it was retrieving the
  environment variable for every vertex in immediate mode (bug #13680).

* Refactored the code to allow drawing skinned meshes with vertex
  arrays too, removing some specific immediate mode drawing functions
  for this that only did extra normal calculation. Now it always splits
  vertices of flat faces instead.
* Refactored normal recalculation with some minor optimizations,
  required for the above change.
* Removed some outdated code behind the __NLA_OLDDEFORM #ifdef.
* Fixed various bugs in setting of multitexture coordinates and vertex
  attributes for vertex arrays. These were not being enabled/disabled
  correct according to the opengl spec, leading to crashes. Also tangent
  attributes used an immediate mode call for vertex arrays, which can't
  work.
* Fixed use of uninitialized variable in RAS_TexVert.
* Exporting skinned meshes was doing O(n^2) lookups for vertices and
  deform weights, now uses same trick as regular meshes.
2008-06-17 10:27:34 +00:00
Benoit Bolsee
1fc1fb117e BGE: fix compilation error with 2D filters on System without GL extenstion: add conditional compile statements 2008-04-18 22:22:50 +00:00
Kent Mein
b73ba9c181 This commit reverts the #include <mesa/glu.h>
stuff used for peach to the standard <GL/glu.h>
the mesa stuff was needed for the machines for peach but its
not the stanard location of the headers, now that its not
needed were switching it back.

Kent
2008-04-02 15:03:03 +00:00
Kent Mein
7b2e348d4f This is a modified version of this patch:
[#7660] Solaris 10 x86 support (Makefiles)

Hopefully it will not mess up anything for anyone else.  I removed
some hardcoded static libs and made NAN_*_LIB definitions so they could be 
overridden, to allow greater flexability.

Let me know if there are any problems/questions.

Kent
2007-12-05 16:58:52 +00:00
Charlie Carley
92f1d59b44 Test commit... 2007-05-29 07:46:07 +00:00
Charlie Carley
557360224f Klockwork (http://www.klocwork.com) report; game engine fixes, related to 'Use Blender Materials'
/source/gameengine/Ketsji/BL_Material.cpp;16;18;Critical;1;
/source/gameengine/Ketsji/BL_Shader.cpp;293;30;Critical;1;
/source/gameengine/Ketsji/BL_Shader.cpp;314;30;Critical;1;
/source/gameengine/Ketsji/BL_Shader.cpp;341;30;Critical;1;
/source/gameengine/Ketsji/BL_Shader.cpp;1264;40;Critical;1;
/source/gameengine/Ketsji/BL_Shader.cpp;1194;40;Critical;1;
/source/gameengine/Ketsji/BL_Shader.cpp;916;30;Critical;1;
/source/gameengine/Ketsji/KX_BlenderMaterial.cpp;257;24;Critical;1;
/source/gameengine/Ketsji/KX_BlenderMaterial.cpp;262;24;Critical;1;
/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp;195;24;Error;3;
/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp;1209;16;Critical;1;
2007-01-21 04:45:44 +00:00
Erwin Coumans
13e0d22d89 a lot of work in a few small changes to improve penetration depth. and some fixes in shaders from Charlie. 2006-04-13 05:11:34 +00:00
Erwin Coumans
8dbe14b70b applied Charlies patch, reverted some GLSL shader stuff, improved penetration depth estimate. 2006-04-11 05:57:30 +00:00
Erwin Coumans
36f498aae0 made some gfx debug code win32 specific 2006-04-03 01:28:43 +00:00
Erwin Coumans
d537ce9b25 commented out some asserts that don't work multiplatform 2006-04-02 22:36:15 +00:00
Erwin Coumans
6839ec6640 applied Charlies patch for game engine graphics. display list support, and bumpmapping shader improvements. 2006-04-02 21:04:20 +00:00
Jean-Luc Peurière
8bc0060835 added proper casts to get things compiling with gcc 4.0 Os X 2006-02-14 23:52:47 +00:00
Erwin Coumans
e4790aef46 Improved OpenGL Shader Language support for game engine. The python interface is much simplified. Drawback is that scripts need to be updated next release. Testfiles:
http://www.continuousphysics.com/ftp/pub/test/index.php?dir=blender/&file=demos-2.42.zip

patch by Charlie Carley (snailrose @ elysiun.com)
2006-02-13 05:45:32 +00:00
Brecht Van Lommel
24446906bc Use ALsizei/GLsizei to fix compile errors on mac / gcc 4.x. 2006-01-29 21:29:14 +00:00
Erwin Coumans
e3512ab335 assert caused compile problems too :( 2006-01-18 06:48:28 +00:00
Erwin Coumans
5b8b745cba fixed an ordering issue caused by previous commit 2006-01-18 06:46:56 +00:00
Erwin Coumans
85c58bfa8a attempt to fix reported problems with glsl shader on OS X (and other platforms). instead of continuous printing errors, it should just print once, and delete the shaders.
also, disabled the asynchronous logicbrick update, it reportedly causes jitter.
2006-01-18 06:04:11 +00:00
Jean-Luc Peurière
77c4eef90b after much suffering, got GE build and work almost cleanly on Os X
(with make, need to confirm with scons)

after cleaning the changes are in fact minimal, but the situation
is still quite a bit hackish.

Game engine coders, there is also quite a number of warnings that
need to be fixed.

current situation is that everything seems to work, but GLSL shaders
spew a lot of errors on console and blender may crash on exit when
a GLSL shader was used. ARB stuff works fine.
2006-01-16 22:27:30 +00:00
Erwin Coumans
6f3e593105 more graphics patches from Snailrose,
remove constraint fixed,
Bullet timestep now subdivides Blender game engine timestep, so it runs 60 hertz,
SphereShape reverted to old style, so no support for non-uniform scaled spheres for now,
2006-01-15 11:34:55 +00:00
Erwin Coumans
fbc977e48c attempt to avoid nameclashes (although it is already in a namespace) -> extension names renamed from glXXX to blXXX. 2006-01-11 13:31:45 +00:00
Erwin Coumans
b7be6620d6 applied patch from snailrose, related to multi-platform OpenGL extensions. 2006-01-10 06:34:42 +00:00
Erwin Coumans
c94455c14d more linux game engine work. hopefully works now! 2006-01-08 09:37:15 +00:00