Commit Graph

15212 Commits

Author SHA1 Message Date
Campbell Barton
5553d2c014 BGE C++ API
PyObjectPlus::ProcessReplica() is now called when any of its subclasses are replicated.

This is important because PyObjectPlus::ProcessReplica() NULL's the 'm_proxy' python pointer I added recently.
Without this a replicated subclass of PyObjectPlus could have an invalid pointer (crashing the BGE).

This change also means CValue::AddDataToReplica() can be moved into CValue::ProcessReplica() since ProcessReplica is always called.
2009-04-22 14:42:00 +00:00
Campbell Barton
a8592d09d0 BGE C++ API
Some functions used
	ProcessReplica(replica);
others
	replica->ProcessReplica()

Use the second method everywhere so the PyObjectPlus's ProcessReplica() can be called from its subclasses.

Note that PyObjectPlus's ProcessReplica isnt used yet.
2009-04-22 12:16:41 +00:00
Ton Roosendaal
c09b1a985c bugfix #18187
Using "Key Alpha" didn't work when using MBlur render. The accumulation
code was assuming regular alpha then. Now it corrects for it.

Still it's a bit of a weak spot in Blender's render system. I will look 
in the future to make this a real post process; converting all RGBA 
buffers in the system, including for all passes, to "key alpha". 
Combined with that our compositor should become alpha type aware too. 
Everything in Blender assumes premul alpha, which still just will work 
best in general...
2009-04-22 11:54:43 +00:00
Campbell Barton
785b784e09 BGE Python API
improved how attribute errors are set so each classes py_getattro function dosnt need to set an error if the attribute doesn't exist.
Now py_base_getattro sets an error on a NULL return value when no errors are set to avoid setting errors at multiple levels.
2009-04-22 09:47:57 +00:00
Campbell Barton
95038048a2 [#18577] LightWave (.lwo) Exporter Object Names are Incorrect
patch from Philip Alldredge (cilcoder), slightly modified
2009-04-22 09:08:57 +00:00
Nathan Letwory
88c58d6b2d BGE
* the ternary form refused to compile properly with msvc, rewrite a bit.
2009-04-22 06:30:32 +00:00
Campbell Barton
0145a93f24 Patch from Mitchell Stokes for KX_Light to use attrdef's
Added type access to the SCA_PropertyActuator, added missing function in library docs.
2009-04-21 23:15:18 +00:00
Benoit Bolsee
221f589f51 BGE bug #18521 fixed: Dupligroups + Bullet Softbodies are broken. 2009-04-21 21:33:03 +00:00
Guillermo S. Romero
094b3e81f6 Balance comment markers. 2009-04-21 18:41:45 +00:00
Guillermo S. Romero
2db9f14ccd Documentation. 2009-04-21 17:58:28 +00:00
Guillermo S. Romero
41eb029bb9 Old "divide by zero" bug and remove debug printf. 2009-04-21 17:40:39 +00:00
Guillermo S. Romero
c5756a9822 Compile warnings, typos and some clarifications. 2009-04-21 17:37:07 +00:00
Guillermo S. Romero
95b43536f6 Some Makefile changes still laying around. 2009-04-21 17:24:16 +00:00
Nicholas Bishop
a82a6bedc5 Fix for bug #17457. This bug relates to files that have missing multires vertex data.
The fix is, if the file was saved on the highest multires level, then mesh contains a copy of the vertices anyway, and we can just copy it back into multires.

Otherwise, multires is removed from the mesh to avoid a crash.
2009-04-21 16:58:25 +00:00
Ton Roosendaal
6c33cc9bae Bugfix #18550
"Copy constraints" should increase ipo user count.
2009-04-21 15:38:53 +00:00
Ton Roosendaal
5d0fb28f74 bugfix #18543
Using feature XRay + Transparent could crash on undo/redo, the
view3d afterdraw was still storing data here whilst it shouldn't...

Reason was that object got added twice actually... but only freed
once. Also caused weird flashy display.

Note to Brecht for merging: skip this one, I'll fix it in 2.5 too.
2009-04-21 15:22:41 +00:00
Campbell Barton
4cf2863a8f SHD_dynamic had gen_utils functions from Mathutils, removing 2009-04-21 13:44:24 +00:00
Daniel Genrich
aff2a11110 Fix for missing include using CMake 2009-04-21 13:34:33 +00:00
Ton Roosendaal
ca78b6ee8b Bugfix #18519
MultiLayer save (F3) crashes when no rendering/layers exist, happens for
opengl preview render. It now survives, saving empty file and prints error.

Better solution for later: render profiles!
2009-04-21 13:30:58 +00:00
Campbell Barton
8b69260f00 hope this lets py2.3 build again 2009-04-21 12:48:49 +00:00
Campbell Barton
aa3c9ad0d8 needed to remove gen_utils functions from Mathutils.c 2009-04-21 12:42:37 +00:00
Benoit Bolsee
d11a5bbef2 BGE: Support mesh modifiers in the game engine.
Realtime modifiers applied on mesh objects will be supported in 
the game engine with the following limitations:

- Only real time modifiers are supported (basically all of them!)
- Virtual modifiers resulting from parenting are not supported: 
  armature, curve, lattice. You can still use these modifiers 
  (armature is really not recommended) but in non parent mode. 
  The BGE has it's own parenting capability for armature.
- Modifiers are computed on the host (using blender modifier
  stack).
- Modifiers are statically evaluated: any possible time dependency
  in the modifiers is not supported (don't know enough about
  modifiers to be more specific).
- Modifiers are reevaluated if the underlying mesh is deformed
  due to shape action or armature action. Beware that this is 
  very CPU intensive; modifiers should really be used for static
  objects only.
- Physics is still based on the original mesh: if you have a 
  mirror modifier, the physic shape will be limited to one half
  of the resulting object. Therefore, the modifiers should 
  preferably be used on graphic objects.
- Scripts have no access to the modified mesh. 
- Modifiers that are based on objects interaction (boolean,..)
  will not be dependent on the objects position in the GE.
  What you see in the 3D view is what you get in the GE regardless
  on the object position, velocity, etc.

Besides that, the feature is compatible with all the BGE features
that affect meshes: armature action, shape action, relace mesh, 
VideoTexture, add object, dupligroup.

Known problems:
- This feature is a bit hacky: the BGE uses the derived mesh draw 
  functions to display the object. This drawing method is a
  bit slow and is not 100% compatible with the BGE. There may
  be some problems in multi-texture mode: the multi-texture
  coordinates are not sent to the GPU. 
  Texface and GLSL on the other hand should be fully supported.
- Culling is still based on the extend of the original mesh. 
  If you have a modifer that extends the size of the mesh, 
  the object may disappear while still in the view frustrum.
- Derived mesh is not shared between replicas.
  The derived mesh is allocated and computed for each object
  with modifiers, regardless if they are static replicas.
- Display list are not created on objects with modifiers.
  
I should be able to fix the above problems before release.
However, the feature is already useful for game development.
Once you are ready to release the game, you can apply the modifiers
to get back display list support and mesh sharing capability.

MSVC, scons, Cmake, makefile updated.

Enjoy
/benoit
2009-04-21 11:01:09 +00:00
Campbell Barton
3e7cbd5388 Blender Python API
- Removed the gen_utils.c dependency from Mathutils (since gen_utils wont go into 2.5 but mathutils will), repalced with python functions.
- removed Blender.Mathutils.Point, since it was not documented, the C api never used it, none of our scripts used it (and I never saw a script that used it).
2009-04-21 09:44:29 +00:00
Benoit Bolsee
6c5e18ca98 Fix compilation error in MSVC. 2009-04-21 09:38:27 +00:00
Benoit Bolsee
106b5a435c BGE: show profile in millisecond in addition to percentage. 2009-04-21 09:20:47 +00:00
Campbell Barton
2d054e00b0 Blender Python API
use getseter's for quat and euler types attributes, python3 compatible module initialization for Mathutils and BGL.
2009-04-21 07:16:29 +00:00
Campbell Barton
70dae5f493 [#18557] incorrect alpha IPO behavior in game engine
from Louis-Dominique Dubeau (zenoparadox)
report contained fix, ancient bug from rev2.
2009-04-21 01:59:14 +00:00
Campbell Barton
720f7a8b69 use PyList_SET_ITEM instead of PyList_SetItem,
PyList_SetItem does error checking and decref's existing values, PyList_SET_ITEM is a macro for direct assignment, only for use on new lists.
2009-04-20 23:27:53 +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
Benoit Bolsee
2d0d06f642 BGE VideoTexture: fix bug with VideoTexture.materialID() since recent commit. 2009-04-20 21:20:33 +00:00
Daniel Genrich
6afaab654d Bugfix for [#18554] Time + Scale Node Crash 2009-04-20 18:31:48 +00:00
Ton Roosendaal
449e9a454d Bugfix 18558
In OSX, using spin/extrude etc. buttons, with more than 1 3d window open,
should turn cursor in a Question Mark to indicate you have to tell which
window to use (yes weak, but that's 2.4x!). OSX didn't support that type
of cursor, so no hint happened. Now uses the 'hand' icon for osx... no
nicer one is there afaik.
2009-04-20 18:23:46 +00:00
Daniel Genrich
d76a6f5231 Booleans: Fix for "no faces" error, reported by alxarch, thanks! 2009-04-20 13:18:54 +00:00
Campbell Barton
dee32d0b3f BGE Python API
- initialize pythons sys.argv in the blenderplayer
- ignore all arguments after a single " - " in the blenderplayer (like in blender), so args can be passed to the game.
- add a utility function PyOrientationTo() - to take a Py euler, quat or 3x3 matrix and convert into a C++ MT_Matrix3x3.
- add utility function ConvertPythonToMesh to get a RAS_MeshObject from a KX_MeshProxy or a name.
- Added error prefix arguments to ConvertPythonToGameObject, ConvertPythonToMesh and PyOrientationTo so the error messages can include what function they came from.
- deprecated brick.getOwner() for the "owner" attribute.
2009-04-20 09:13:59 +00:00
Campbell Barton
9078ce5da2 Scons epydos changed options
- no source code since this is only useful if the epydocs contain code, ours are only docstrings.
- set inheritance to included so you dont have to search up the classes to find available functions.
- SConstruct, isolate the exception for importing epydoc.
- Added a print to the SConscript files otherwise it looks like nothings happening.
2009-04-19 22:02:48 +00:00
Nathan Letwory
fcdbbee208 SCons / epydoc support
* properly detect if epydoc is installed.
  patch by Brandano
2009-04-19 21:26:29 +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
d78eec9319 2009-04-19 20:09:05 +00:00
Joseph Eagar
084efe0703 added a python26.zip file, and also made scons pick which zip to use based on the python version 2009-04-19 19:36:04 +00:00
Daniel Genrich
7144838606 Compile fixed for Win64.
Please check if that also compiles on win32.
2009-04-19 19:31:32 +00:00
Daniel Genrich
b36514a3be Booleans:
- Enable e.g. subsurf before boolean modifier
- Fix editmode crash
2009-04-19 18:18:52 +00:00
Daniel Genrich
904483c96c Booleans: Should work with modifier stack now. Please report (new) problems. Thanks 2009-04-19 17:47:09 +00:00
Campbell Barton
6bc162e679 BGE Python API
removed redundant (PyObject *self) argument from python functions that are not exposed to python directly.
2009-04-19 17:29:07 +00:00
Benoit Bolsee
fe08da3b4c BGE: fix Pyfrom_id to work on w64. 2009-04-19 17:26:03 +00:00
Daniel Genrich
7f15445629 Fix for libopenjpeg to enable win64 compile (is in their tracker and will most likely be included in next release) 2009-04-19 16:35:20 +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
Campbell Barton
8d2cb5bea4 BGE Python API
This changes how the BGE classes and Python work together, which hasnt changed since blender went opensource.
The main difference is PyObjectPlus - the base class for most game engine classes, no longer inherit from PyObject, and cannot be cast to a PyObject.

This has the advantage that the BGE does not have to keep 2 reference counts valid for C++ and Python.

Previously C++ classes would never be freed while python held a reference, however this reference could be problematic eg: a GameObject that isnt in a scene anymore should not be used by python, doing so could even crash blender in some cases.

Instead PyObjectPlus has a member "PyObject *m_proxy" which is lazily initialized when python needs it. m_proxy reference counts are managed by python, though it should never be freed while the C++ class exists since it holds a reference to avoid making and freeing it all the time.
When the C++ class is free'd it sets the m_proxy reference to NULL, If python accesses this variable it will raise a RuntimeError, (check the isValid attribute to see if its valid without raising an error).
- This replaces the m_zombie bool and IsZombie() tests added recently.

In python return values that used to be..
 return value->AddRef();
Are now
 return value->GetProxy();
or...
 return value->NewProxy(true); // true means python owns this C++ value which will be deleted when the PyObject is freed
2009-04-19 12:46:39 +00:00
Campbell Barton
92cea7c1b1 KX_MeshProxy "numPolygons" and "numMaterials" attributes were using the "materials" attribute function, error made recently when converting attributes. 2009-04-19 06:48:27 +00:00
Campbell Barton
d2ec468cd3 Hidden faces were not rendering displayed in the game engine, only the invisible face flag should be used for this.
Hiding faces is a editing option like selection and should not change rendering, it wasn't even working right because meshes without UVs ignored it.
I thought this was needed for compatibility with old files but just noticed this messes up 2 of the files in demos-2.42.zip
2009-04-19 06:29:15 +00:00
Nathan Letwory
e4611218ab BPy
* access to sample buffers count of Lamp
2009-04-19 00:09:47 +00:00