Commit Graph

15387 Commits

Author SHA1 Message Date
Ken Hughes
40fa6b0f37 Fix some spelling errors. 2009-05-04 16:03:54 +00:00
Diego Borghetti
0999cf406a Fix crash because XSetInputFocus fail.
Some WM send a WM_TAKE_FOCUS event before the window is really mapped
(for example, change from virtual desktop), because of this, the call
to XSetInputFocus fail and close Blender.
2009-05-04 15:31:28 +00:00
Daniel Genrich
42d571bf19 Fix for msvc compile error reported by Wahooney - thanks 2009-05-04 14:41:25 +00:00
Campbell Barton
3226b33e48 python geometry function Geometry.BezierInterp(vec_knot_1, vec_handle_1, vec_handle_2, vec_knot_2, resolution)
can use 2D-4D vectors

Also made 3ds import give a message when no python installed
2009-05-04 13:01:18 +00:00
Campbell Barton
2f7cd19ff5 print BGE Py api warnings only once to avoid flooding the terminal and slowing the game down too much, resets on loading scenes/blendfiles and restarting the game engine. 2009-05-04 08:55:54 +00:00
Campbell Barton
9248da811e gcc4.4 needed this to build 2009-05-04 08:17:18 +00:00
Benoit Bolsee
3abb8e8e68 BGE performance: second round of scenegraph improvement.
Use dynamic linked list to handle scenegraph rather than dumb scan
of the whole tree. The performance improvement depends on the fraction
of moving objects. If most objects are static, the speed up is 
considerable. The following table compares the time spent on 
scenegraph before and after this commit on a scene with 10000 objects
in various configuratons:

Scenegraph time (ms)              Before         After
(includes culling)

All objects static,               8.8            1.7  
all visible but small fraction          
in the view frustrum

All objects static,               7,5            0.01
all invisible.

All objects moving,               14.1           8.4
all visible but small fraction
in the view frustrum

This tables shows that static and invisible objects take no CPU at all
for scenegraph and culling. In the general case, this commit will 
speed up the scenegraph between 2x and 5x. Compared to 2.48a, it should
be between 4x and 10x faster. Further speed up is possible by making
the scenegraph cache-friendly.

Next round of performance improvement will be on the rasterizer: use
the same dynamic linked list technique for the mesh slots.
2009-05-03 22:29:00 +00:00
Benoit Bolsee
2aa3c932d0 BGE performance: use inline function as much as possible in scenegraph and logic to avoid function call. 2009-05-03 21:51:57 +00:00
Benoit Bolsee
20888482ae BGE: fix a crash with previous scene destruction speed up commit when sensors and controllers are cross connected between objects. 2009-05-03 21:42:39 +00:00
Campbell Barton
f67ffd137d fix for a problem with setUV2 reported by cthames on blenderartist
http://blenderartists.org/forum/showpost.php?p=1369757&postcount=35
there was an undocumented second arg but may as well allow a single vector arg like setUV()
2009-05-03 20:47:29 +00:00
Campbell Barton
d85bbb8070 on second thought its less trouble to make a python script that makes all the getset's in the array, apologies to Alex for suggesting this be dynamic :/
included python script to print out getsets as a comment
2009-05-03 19:47:13 +00:00
Campbell Barton
8a83aff9f5 [#18678] Swizzle properties for Mathutils.Vector
patch from Alex Fraser (z0r)

eg.
  - vec.xyz = vec.zyx
  - vec.xy = vec.zw
  - vec.xxy = vec.wzz
  - vec.yzyz = vec.yxyx

See http://en.wikipedia.org/wiki/Swizzling_(computer_graphics)

made some minor modifications to this patch.

tested access times and adding 336 attributes to vectors doesn't make a noticeable differences to speed of existing axis attributes (x,y,z,w) - thanks to python dict lookups.
2009-05-03 17:52:03 +00:00
Ton Roosendaal
03a0770df5 Bugfix #17929
Old bug (2.42): when using node material, transparent shadow did not work.
It was missing to set the proper 'pass flag'.

Do note an important difference with non-node materials for 'transparent shadow'. 
If there are no nodes, it uses the color from the unshaded material. When it has 
nodes, it uses the color output from the entire node tree, which is typically 
from shaded materials. The latter is because node shaders have no support for 
shade passes yet (it only outputs rgb + a).
2009-05-03 17:48:32 +00:00
Ton Roosendaal
56b8ce2ec1 Bugfix 18671 revisted
Node editor didn't support editing non-material texture node trees.
Campbell pointed me to fact it's been used already, like for brush
painting. However, this only worked via linking the texture to a
material... hackish stuff.

Now the Node Editor supports all other Textures too, with three extra
icon buttons to define which.

- Active Object: for textures linked to Materials or Lamps
- World: textures from Scene world.
- Brush: textures from active Brush 

The latter can only be set and used when in Paint or Sculpt mode:

- Paint mode: in Image window, Paint Tool panel, set active brush
- Sculpt mode: in EditButtons, Texture panel, select empty slot, add texture.

Note that refreshes of previews in Node Editor is not always happening on
switching contextes. Just click a socket to refresh view.
2009-05-03 13:22:26 +00:00
Brecht Van Lommel
c35299363f Fix for bug #18659: glsl math material node, "tangent" option didn't work. 2009-05-03 13:17:37 +00:00
Ton Roosendaal
b89126dbe8 Bugfix #18676
Map a texture to Material Ambient factor didn't work. 
Probably not since 2.42 or so... :)
2009-05-03 12:06:43 +00:00
Ton Roosendaal
12a5c03d16 Bugfix #18671
Texture Nodes: the option to use nodes was also visible for textures
on world, lamp, brush. Since it only works for Materials now, I've made
the button disappear then.
2009-05-03 11:25:09 +00:00
Campbell Barton
22b501c791 fixes for bugs submitted by BGE users, fixes by myself and Mitchell Stokes
- when the attribute check function failed it didnt set an error raising a SystemError instead
- Rasterizer.getMaterialMode would never return KX_BLENDER_MULTITEX_MATERIAL
- PropertySensor value attribute checking function was always returning a fail.
- Vertex Self Shadow python script didnt update for meshes with modifiers.
2009-05-03 09:21:58 +00:00
Campbell Barton
b0ec497f39 [#18492] Old 3dView painting does't work anymore.
use flag the wrong way
2009-05-03 09:03:47 +00:00
Campbell Barton
6b0f7c741e [#18191] VSE: when moving a project containing a relative path Audio RAM strip, it is still pointing old file
Its a bit silly its not using the name from the file selector alredy (which has been made relative), but this fixes the bug.
2009-05-02 21:11:48 +00:00
Campbell Barton
490dad89d5 fix for a painting bug where disabled culling & occlusion would not paint onto backfaces
also use the math floating point functions sqrt -> sqrtf, fmod -> fmodf etc.
2009-05-02 19:46:54 +00:00
Campbell Barton
40fc1d2af7 BGE PyController module type.
- Added support for any number of attributes, this means packages are supported automatically.
 so as well as "myModule.myFunc" you can do "myPackage.myModule.myFunc", nested packages work too.
- pass the controller to the python function as an argument for functions that take 1 arg, this check is only done at startup so it wont slow things down.

added support for
2009-05-02 15:09:06 +00:00
Campbell Barton
41f42099ac BGE Py API patch from Mitchell Stokes, add distance attribute to the radar sensor, dont use 'continue' because its a python keyword.
removed (ssizeobjargproc) it breaks py2.3
2009-05-02 04:53:01 +00:00
Campbell Barton
ef20036b84 BGE Py API patch from Mitchell Stokes, adds extra attributes and docs 2009-05-02 02:40:11 +00:00
Benoit Bolsee
07abb9dee2 BGE performance:
- Vast performance increase when removing scene containing large number of 
  objects: the sensor/controller map was updated for each deleted object, 
  causing massive slow down when the number of objects was large (O(n^2)).
- Use reference when scanning the sensor map => avoid useless copy.
- Remove dynamically the object bounding box from the DBVT when the object
  is invisible => faster culling.
2009-05-01 20:34:23 +00:00
Benoit Bolsee
e13a089d91 BGE: work around a problem with DBVT culling when graphic objects are rescaled. This happens when objects with very diverse scale are instantiated with dupligroup. The problem remains when the objects are rescaled during the game. The effect of the problem is an inefficient culling: objects can have a bounding box larger than needed. Patch to fix the problem is filed at Bullet forum. 2009-05-01 19:02:23 +00:00
Benoit Bolsee
672492f563 BGE: New function GameLogic.setMaxLogicFrame() to allow better control over the time spent on logic.
This function sets the maximum number of logic frame executed per render frame.
Valid values: 1..5

This function is useful to control the amount of processing consumed by logic.
By default, up to 5 logic frames can be executed per render frame. This is fine
as long as the time spent on logic is negligible compared to the render time. 
If it's not the case, the default value will drag the performance of the game
down by executing unnecessary logic frames that take up most of the CPU time. 

You can avoid that by lowering the value with this function. 
The drawback is less precision in the logic system to physics and I/O activity.
	
Note that it does not affect the physics system: physics will still run 
at full frame rate (actually up to 5 times the ticrate).
You can further control the render frame rate with GameLogic.setLogicTicRate().
2009-05-01 16:35:06 +00:00
Kent Mein
1c6cd47f2b Fix linking issue with gameplayer.
Kent
2009-05-01 15:19:47 +00:00
Campbell Barton
742ddade12 [#18654] different behaviour if script is called from (1) Menu (2) TextEditor (3) ScriptsWindow [including crash!]
bugfix, simple NULL check
2009-05-01 14:19:56 +00:00
Campbell Barton
bb3fa18a95 add blendfile dirs to the sys.path without the scripts subdir 2009-05-01 04:55:40 +00:00
Benoit Bolsee
36d0e2649e BGE bug fix: when a dynamic object is parented to a compound shape and then unparented, it jumps at the position it had before the parenting. 2009-04-30 20:02:22 +00:00
Benoit Bolsee
2ec50d7bb2 BGE bug #18091: Hitbox of object X doesn't move along when object X is parented to object Y. 2009-04-30 19:00:17 +00:00
Dalai Felinto
8570071e40 supporting warp data files with tabs instead of spaces. 2009-04-30 15:27:38 +00:00
Campbell Barton
fdf6ea916d added Geometry as a BGE module, removed its dependency on gen_utils.c 2009-04-30 12:45:13 +00:00
Campbell Barton
b14dc8f3d9 enable game engine and player by default 2009-04-30 10:41:39 +00:00
Nathan Letwory
a8a0af4f6a SCons
* add missing arguments
2009-04-30 10:18:50 +00:00
Ton Roosendaal
de2cc4d14d Second trial to get an OK menu work to allow people to decide whether
or not to use a 2.5+ saved file in 2.49. Apparently the msvc linker
was choking on it?
2009-04-30 10:11:37 +00:00
Benoit Bolsee
81ea467091 BGE fux #17796: Glsl + bones + set smooth = bug on vertext groups. 2009-04-30 08:02:26 +00:00
Campbell Barton
b5b24ee521 BGE Python sys.path for the blenderplayer and blender
sys.path is the search path for python modules. This is useful so people making games can put all their scripts in a folder and be sure they will always load into the BGE.

for each blend file a scripts directory is added to the path
 /home/me/foo.blend
will look for modules in...
 /home/me/scripts/*.py 

It could also default to look for modules in the same directory as the blend file but I think this is messy.
Added a note in the tooltip about //scripts so its not such a hidden feature.

This works by storing the original sys.path, then adding the paths for the blendfile and all its libs,
when a new blendfile is loaded, the original sys.path is restored before adding the blendfiles paths again so the sys.path wont get junk in it.

One problem with this - when using linked libs the module names must be unique else it will load the wrong module for one of the controllers.

also fixed 2 bugs
- sys.path in the blenderplayer was growing by 1 for every file load in blenderplayer
- the relative path (gp_GamePythonPath), wasnt being set when loading files in the blenderlayer (as I wrongly said in the last commit).
2009-04-30 08:01:31 +00:00
Dalai Felinto
939290b59c BGE 2dFilters: Revert of part of own commit [rev. 19687]
Therefore we still need to find a better way to solve this problem:
[#18154] 2dFilter and motion blur should run only once to all the scenes:
http://projects.blender.org/tracker/?func=detail&aid=18154&group_id=9&atid=127
2009-04-30 03:46:31 +00:00
Dalai Felinto
5908e2aa77 BGE Dome update. Spurious black seams (finally) fixed.
The solution is a hack. It's a workaround for another bug (#18655).
Now it's working in all modes: fullscreen, maximized screen and gameplayer.

* small change to always set the perspective mode as true during dome mode.
2009-04-30 02:41:07 +00:00
Campbell Barton
199341ad7b 2 BGE bugs from 2.48 fixed
- the gp_GamePythonPath relative path variable wasnt updated when loading new files.
- missing NULL check for scene crashed blender when it failed to load a file.
Both problems dont affect blenderplayer
2009-04-30 02:07:08 +00:00
Campbell Barton
1782be5c72 Not sure why this INCREF is needed since making a replica wont use the m_bytecode so why should it add a user?
Removed in 19974 but that crashes YoFrankie so adding back in for now.
2009-04-30 00:51:11 +00:00
Campbell Barton
a625f5e476 error in last commit 2009-04-29 23:59:59 +00:00
Martin Poirier
6a155b5c07 use BLO_sys_types.h instead, it's windows proof 2009-04-29 23:43:12 +00:00
Campbell Barton
1e7df58519 python modules in the game engine could point to builtin modules like GameLogic that was cleared.
I added module clearing before there was checks for invalid python objects, so now its not needed for BGE Builtin types at least.

also made the builtin modules get re-used if they already exist and clear all user modules when the game engine finishes so with Module-Py-Controllers the referenced modules are at least up to date when pressing Pkey.
2009-04-29 23:39:27 +00:00
Martin Poirier
537b080379 missing stdint.h include 2009-04-29 23:33:04 +00:00
Nathan Letwory
ebf631b3fe * instead of using okee() (breaking builds) use error() in 250 subversion handling in 2.49 2009-04-29 22:09:28 +00:00
Nathan Letwory
4d7017b423 * make sure header file agrees with editfont.c (unsigned long -> uintptr_t), following commit by Genscher r19983 2009-04-29 20:56:27 +00:00
Nathan Letwory
39caa9898c * fix linking problem for mingw with setenv/_putenv_s, here we use putenv("key=val"); 2009-04-29 20:09:08 +00:00