Commit Graph

15145 Commits

Author SHA1 Message Date
Campbell Barton
514c78ba39 BGE MouseFocusSensor
- fix for multiple viewpors broke single viewport (both work now)
- python could get uninitialized values from m_prevTargetPoint and m_prevSourcePoint
- getting the RayDirection for python could crash blender trying to normalize a zero length vector.
- added python attributes
- removed unused canvas from the MouseFocusSensor class
2009-04-15 13:50:56 +00:00
Campbell Barton
e8f4d93221 Disable using KX_GameObjects in python that have been removed from the scene (zombie objects) by raising a RuntimeError when accessing methods, attributes or passing to a function.
Common cases of this are when python references an object from the AddObject actuator that has ended, or a scene has been loaded and the old objects freed.

This means some scripts will raise errors now in certain cases but better give the error early rather then failing silently with strange hard to track down behavior & crashes.

Added "isValid" attribute for checking objects are in a scene.

At the moment it uses the SceneGraph Node to check of the objects valid but it might be better to do this in a more generic way so scenes, meshes etc also have this check.
2009-04-15 10:57:28 +00:00
Campbell Barton
19c869ab64 BGE Py Api
importing modules wasnt returning the error from the blender text if it failed.
2009-04-15 08:08:42 +00:00
Campbell Barton
34a617e308 [#7789] 3DS Import , Mesh not correct since Blender 2.44
There is a problem importing 3ds files where I cant find a way to check if the transforms are applied to the vertex locations or not.
Since 2.44 I made the importer assume they were not since you can manually remove transformations, but not reverse.

Nevertheless most 3ds files have the matrix applied, better not give a bad import by default.
Did some research and other 3ds importers (lib3ds for eg), have the same problem and just assume the transformations applied.

3dsMax imports both correctly so there must be a way to tell but I could not link it to the 3ds version or other mesh options.
Added an option to workaround this problem in rare cases where its needed.

- KX_GameObject.cpp & KX_Scene.cpp, clear the dict before removing the reference in case there is a circular reference.
2009-04-15 07:00:11 +00:00
Campbell Barton
efb7dd86ff Fix for own recent reference count error.
- The armature weakref list was  being incref'd twice then decrefed twice (incref and decref were used incorrectly), now only once. My 'fix' broke this.
- In bpy_pydriver_create_dict the 2 refs added from running PyDict_SetItemString twice were undone when clearing the dictionary (added comment)
- changed Py_XDECREF to Py_DECREF int BPY_pyconstraint_update and BPY_pyconstraint_target, Py_XDECREF checs for NULL value which would have crashed blender before it got to Py_XDECREF anyway.
- after every error is reported (PyErr_Print), remove sys.last_traceback and clear the error, I found this fixed certain crashes (usually when starting the game engine or exiting blender), so best do this all the time.

- header_text.c, CcdPhysicsEnvironment.cpp, KX_CameraActuator.cpp - remove some warnings.
2009-04-15 04:34:27 +00:00
Remigiusz Fiedler
4fe917ba26 update for DXF-Importer v1.12, DXF-Exporter v1.29 - 2009.04.11 by migius
- added DWG support, adapted Stani Michiels idea for binding an extern DXF-DWG-converter

The external DXF-DWG converter "dconvertcon.exe" 355kb comes from openDesignAlliance www.opendwg.org, is free, but not opensource, not GPL-compatible (can not be bundled with commercial programs), so must be downloaded and installed in Blender script folder by user. It is a DOS console application, can be started in background mode, works on Windows, and in Wine on Linux and OSX. Version 1.0 (2002) supports conversion between DXF<->DWG for autocad release: 2.5, 2.6, 9, 10, 11, 12, 13, 14, 2000, 2002.
2009-04-15 01:37:50 +00:00
Remigiusz Fiedler
a277b979f2 v1.29 - 2008.12.28 by Yorik van Havre
- modif POLYLINE to support bulge segments
2009-04-14 23:57:14 +00:00
Benoit Bolsee
494f0fa4e7 BGE bug #18522 fixed: Dupligroup offsets don't work in BGE. 2009-04-14 20:54:04 +00:00
Benoit Bolsee
bc355482ab BGE: Keep Sumo and ODE in sync with Bullet at API level, fix a compilation problem in MSVC. 2009-04-14 17:22:14 +00:00
Campbell Barton
c62dfc498d [#18517] Python scripts segfault on loading
own error, EXPP_incr_ret from a macro was an implicit decloration in BGL.c
For some reason this only crashed on 64bit linux

To my defence the BGE makes so many warnings that they become usless, need to improve the situation here at some point.
2009-04-14 17:19:09 +00:00
Ton Roosendaal
bcabc596c9 Bugfix #18108
Another bug in the 'radius per vertex' feature in curves.

If you set front/back face off for curves, and make it bevel or give
depth, the curves should draw as tubes. This feature didn't work in 2.48
either... 

Still unsure about this implementation, campbell can check!
2009-04-14 17:13:21 +00:00
Campbell Barton
3511f8ef9f BGE Physics
Clamp objects min/max velocity.
Accessed with bullet physics from the advanced button with dynamic and rigid body objects.
- useful for preventing unstable physics in cases where objects move too fast.
- can add linear velocity with the motion actuator to give smooth motion transitions, without moving too fast.
- minimum velocity means objects don't stop moving.
- python scripts can adjust these values speedup or throttle velocity in the existing direction.

Also made copy properties from an object with no properties work (in case you want to clear all props)
2009-04-14 12:34:39 +00:00
Campbell Barton
1bc31fc7f9 BGE Bugfix
[#17678] "Mouse over" sensor broken when using viewports

Loop over all the scenes camera viewports and check the mouse is inside the viewport before casting a ray.
2009-04-14 03:08:09 +00:00
Benoit Bolsee
0b8661ab4d BGE: Occlusion culling and other performance improvements.
Added occlusion culling capability in the BGE. 
More info: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.49/Game_Engine#BGE_Scenegraph_improvement
MSVC, scons, cmake, Makefile updated.

Other minor performance improvements:
- The rasterizer was computing the openGL model matrix of the objects too many times
- DBVT view frustrum culling was not properly culling behind the near plane:
  Large objects behind the camera were sent to the GPU
- Remove all references to mesh split/join feature as it is not yet functional
2009-04-13 20:08:33 +00:00
Guillermo S. Romero
6f12e584a9 SVN maintenance. 2009-04-13 19:33:22 +00:00
Campbell Barton
d91d64d807 [#18329] VRML import on indexedfaceset munges some colors (off by one)
Thanks to Ezra Peisach for including a patch in the report.
2009-04-13 06:50:02 +00:00
Campbell Barton
956d120098 Bullet integration uninitialised values.
Erwin, r16812 "Add Fh/Rot Fh to Bullet" - added this function
  ClosestRayResultCallbackNotMe(rayFromWorld,rayToWorld,body,parentBody)
  
  ...but parentBody was being ignored and the m_parent value wasn't being initialized.


Run memset() on CcdConstructionInfo which had some unset members for CreateSphereController() and CreateConeController().
2009-04-13 04:54:12 +00:00
Campbell Barton
1b73d3ce05 mesh proxy attributes from andrecastelo 2009-04-13 03:43:16 +00:00
Campbell Barton
066098dfec this should fix building with mingw 2009-04-12 22:05:09 +00:00
Campbell Barton
5b07f06136 fix some refcounting issues with PyDict_SetItemString 2009-04-12 20:19:27 +00:00
Dalai Felinto
8664e35adf 2DFilter bugfixes:
[#18154] 2dFilter and motion blur should run only once to all the scenes
[#18504] The GL_PROJECTION matrix is being reset by the 2dfilter.
2009-04-12 19:46:50 +00:00
Campbell Barton
5b942b9d5b [#18516] Particle children API for python (Complete).
from Alberto Santos (dnakhain) 
----
This patch complete previous one that I submit with new variables relationated with Particle System children (With variables related to Rough, Kink and Branch).
2009-04-12 17:07:40 +00:00
Campbell Barton
17f35293ee PropertyActuator toggle option didnt run when the Value field was empty. 2009-04-12 16:10:43 +00:00
Campbell Barton
332032fb99 BGE Python API
Support for assigning any Type to a KX_GameObject

so you can do...
 gameOb.follow = otherGameOb
 gameOb[otherGameOb] = distanceTo
 gameOb["path"] = [(x,y,x), (x,y,x)]
 del gameOb[mesh]


* types that cannot be converted into CValue types are written into the KX_GameObject dict
* the KX_GameObject dict is only initialized when needed
* Python properties in this dict cannot be accessed by logic bricks
* dir(ob) and ob.getPropertyNames() return items from both CValue and Py dictionary properties.

Also found that CType was converting python lists to CType Lists but very buggy, would crash after printing the list most times.
Use python lists instead since logic bricks dont deal with lists.
2009-04-12 14:22:51 +00:00
Campbell Barton
ee24c829b5 need strtoll defined as _strtoi64 to build on windows 2009-04-12 10:56:36 +00:00
Campbell Barton
5b306b7541 BGE Python API
added defines PY_SET_ATTR_FAIL, PY_SET_ATTR_MISSING and PY_SET_ATTR_SUCCESS

This is useful when objects that have user defined attributes (GameObject and Scene)
When calling setattr on the parent, a return value of PY_SET_ATTR_FAIL means the attribute exists but failed to be set, so don't set the custom attribute.
2009-04-12 09:56:30 +00:00
Campbell Barton
55d2b184ec added "toggle" an option for the property actuator.
much less hassle then setting up a property sensor and 2 assignment actuators, or through python.
2009-04-12 07:24:04 +00:00
Campbell Barton
33170295c8 use long long rather then int for storing game logic properties.
There were also some problems with int to python conversion
- assigning a PyLong to a KX_GameObject from python would raise an error
- PyLong were coerced into floats when used with internal CValue arithmetic

Changes...
- PyLong is converted into CIntValue for coercing and assigning from python
- CValue's generic GetNumber() function returns a double rather then a float.
- Print an error when a PyType cant be coerced into a CValue

Tested with python, expressions and property sensor.
2009-04-12 06:41:01 +00:00
Campbell Barton
4cd088b105 BGE Py API
- setting the scene attributes would always add to the scenes custom dictionary.
- new CListValue method from_id(id)

so you can store a Game Objects id and use it to get the game object back.

 ob_id = id(gameOb)
 ...
 gameOb = scene.objects.from_id(ob_id)
 
This is useful because names are not always unique.
2009-04-11 20:58:09 +00:00
Campbell Barton
37e53b2e1f bugfix from Moguri, AddReplica wasnt setting the light layer from the parent 2009-04-11 15:59:11 +00:00
Janne Karhu
48514b3d52 Fix for: [#18499] Particle size can only be set in steps of 0.1
- Some button settings were wrong.
2009-04-10 21:07:32 +00:00
Janne Karhu
c1cf50be79 Mesh effector surface option:
- Most mesh particle effectors can now have their effection point taken per particle as the nearest point on the mesh surface.
- This is activated with the "surface" button in the effector field panel.
- Activating the option adds a "surface" entry to the modifier stack where the state of the mesh is read from.

For an example of usage see http://www.youtube.com/watch?v=3XkO1EAmJks.
2009-04-10 19:40:21 +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
a412ce0702 strip indentation from lines of OBJ files.
OBJ's from VMD's molecular visualization program had this.
2009-04-10 14:33:52 +00:00
Campbell Barton
4ff661c989 X3D Import was broken because some arguments from VRML were missing. 2009-04-10 14:09:44 +00:00
Janne Karhu
6121d4b9fe Particle effector falloff maxdist etc. didn't work like it was supposed to. 2009-04-09 23:43:25 +00:00
Benoit Bolsee
5031fe982e BGE API cleanup: ConstraintActuator. 2009-04-09 23:10:12 +00:00
Campbell Barton
ac45472a17 BGE Bugfix
The End key didn't work work at all for the keyboard sensor.
Removed getEventList() since it was added since 2.48a release.
2009-04-09 22:15:26 +00:00
Benoit Bolsee
b0cca7de26 BGE API cleanup: StateActuator. 2009-04-09 21:15:44 +00:00
Benoit Bolsee
09a5ffdf07 BGE API cleanup: sound actuator. 2009-04-09 20:40:12 +00:00
Campbell Barton
4669fa48a8 Added GameKeys.EventToCharacter(event, is_shift) so you can get the character that would be types when pressing a key.
Last commit was made in the pydocs folder only, so this includes changes mentioned in rev 19620.
2009-04-09 16:00:45 +00:00
Campbell Barton
e14e66f041 BGE Py API
- added keyboard senser attribute "events" to replace getEventList()
- fix 2 memory leaks in the python api (was making a list but not returning it)
- setting readonly attributes didnt give a good error message.
2009-04-09 12:53:56 +00:00
Benoit Bolsee
3be2b8995e Remove redundant include GL/glu.h in KX_Dome.cpp. 2009-04-09 10:29:07 +00:00
Campbell Barton
65f65a729a key logging didnt work for alphanum keys -=_+ and |\ since revision 2 and nobody noticed! 2009-04-09 10:28:14 +00:00
Campbell Barton
c29d51f1e8 BGE Text - fix for tab drawing as an @ and not adding white space.
Tab width is always space*4.
2009-04-09 10:05:17 +00:00
Campbell Barton
eacf5b5d6d BGE Text
- multi-line strings for bitmap text 
- keyboard sensor now logs return and pad enter as "\n"

BGE std::vector use in Value.cpp and RAS_MaterialBucket.cpp
The size of a new list is known before making them, reduce re-allocs, though probably not a noticeable speedup.
2009-04-09 09:50:17 +00:00
Campbell Barton
ba4ad93ead Python 2.3 wouldn't compile with BGL. 2009-04-09 01:52:29 +00:00
Benoit Bolsee
5b0d75e831 BGE API cleanup: 2DFilterActuator. 2009-04-08 21:40:55 +00:00
Benoit Bolsee
24f1355d4f Fix gcc compiling problem with C++ syntax in KX_Dome.cpp. 2009-04-08 20:10:27 +00:00
Campbell Barton
1ee970e03b small bge edits
- Only try and remove light objects from the light list.
- Only loop over mesh verts once when getting the bounding box
- dont return None from python attribute localInertia when theres no physics objects. better return a vector still.
- add names to send message PyArg_ParseTuple functions.
2009-04-08 17:40:09 +00:00