Commit Graph

15519 Commits

Author SHA1 Message Date
Campbell Barton
33b974ee43 BGE Py API
- Deprecation warnings for using attribute access

- Added dictionary functions to KX_GameObject and ListValue
    ob.get(key, default=None)
    ob.has_key(key)
 ob.has_key is important since there was no way to do something like hasattr(ob, "attr") which can be replaced by ob.has_key("attr") - (both still work of course).
 ob.get is just useful in many cases where you want a property if it exists but can fallback to a default.

- CListValue::FindValue was adding a reference but the ~3 places it was used were releasing the reference. added a FindValue that accepts a const char* type to avoid converting python strings to STR_String.
2009-05-26 16:15:40 +00:00
Brecht Van Lommel
7e48820a97 Fix for bug #18788: vector math node subtract did not work,
patch by Matt D., thanks.
2009-05-26 15:01:06 +00:00
Ton Roosendaal
33304d022d Bugfix #18801
Third transparent shadow bug... this time it's a Material Node, which
has mirror + transp-shadow on, and when it traces its own material it 
enters an eternal loop...

Raytracing + shading + materialnode combo really needs work!
2009-05-26 13:46:08 +00:00
Peter Schlaile
137b3e1dc5 == Sequencer ==
This adds a per preview option to set render sizes (which proxy size is used).
That makes it possible to have 
* several small preview screens which update really fast using the proxy files
* one large output screen that operates in full resolution

Since most of the time not all input strips are considered when calculating
an output screen, this is a big win.

Also: one can disable a preview screen completely using this option.

Other use cases: vector + chromaviews don't always need full resolution 
pictures and work equally well on proxy files!

This option finally makes my working setup _completely_ realtime :)
2009-05-26 12:57:16 +00:00
Campbell Barton
e93d1ba8e7 Misc warnings
- Removed/Commented some unused vars
- CValue::GetPropertyText() could return a temp reference to a variable on the stack, option wasnt used anywhere so removed.
- KX_ConstraintWrapper::GetConstraintId allows args but ignored them
- KX_ConstraintWrapper::PySetParam didnt return NULL on an error (messing up pythons exceptions).
- BLI_natstrcmp didnt return 0 when the while loop exited
2009-05-26 10:44:14 +00:00
Ton Roosendaal
ca4d741ce9 Bugfix: (discovered by course participant :)
Brush option "Clone" didn't read linked Clone Image from file.
No idea how this ever could work even... even for Undo it
would crash.
2009-05-26 08:30:28 +00:00
Campbell Barton
7ba91ddcc3 BGE Script template for a python module (set EOL to native this time)
BGE PyAPI use defines for error return values
 - del gameOb['var'] error message was wrong.
2009-05-26 07:41:34 +00:00
Ken Hughes
5f82855a07 Interface
---------
Fixing typo in TimeOffset tooltip.
2009-05-26 00:14:22 +00:00
Stefan Gartner
bbed7918c8 IRIX: use python 2.5 by default 2009-05-25 23:35:29 +00:00
Stefan Gartner
25c564c7c3 tiny fix for irix: use putenv instead of setenv 2009-05-25 23:20:38 +00:00
Ken Hughes
ca39228fb7 Interface
---------
Bugfix 18811: long filenames caused stack corruption in BLI_adddirstrings().
2009-05-25 16:09:22 +00:00
Campbell Barton
ca8497d001 * UI tweaks to python controller (more space for module name), setParent actuator use less space
* object_drop.py - option to orient to face normal (useful for scattering objects over terrain), accounts for normal flipping and can adjust the orientation %.
2009-05-25 11:39:09 +00:00
Campbell Barton
2fa8504dd1 BGE Joystick Hat Bugfix
bug reported by blenderage on blenderartist (found other bugs too).

- "All Hat Events" didnt work.
- Multiple hats didnt work
- use a menu with direction names rather then have the user guess. disallow zero as a direction.
- Allow up to 4 hats (was 2).
- Python api was clamping the axis to 2, maximum is currently JOYAXIS_MAX - 16
- New python attributes hatValues and hatSingle, match axis functions.
- Use SDL Axis events to fill in the axis and hat array rather then filling in every axis with SDL_JoystickGetAxis for each axis event.
2009-05-25 06:24:23 +00:00
Campbell Barton
2a9d9605d0 Pressing the '~' key in the ipo view didnt store the view state in the ipo curves as clicking on the ipo channel names does. 2009-05-25 03:06:03 +00:00
Campbell Barton
3053ce1a8c [#18819] save and load globalDictionary actuators don't load the proper files in 2.49 RC3
For this actuator to be useful it needs to use the first opened blendfile as the base name for the configuration file.
A recent fix that made the gp_GamePythonPath always match the current loaded blend file made this actuator work differently.

keep the original filename to use for making the config name so you can load the config between loading blendfiles.
2009-05-25 02:39:05 +00:00
Campbell Barton
1af059b642 [#18808] Unstable results of Pack Margin in UV editor
was scaling the margin by the area twice
2009-05-25 02:11:18 +00:00
Campbell Barton
3ceed4cfb2 [#18731] trouble with the python api in assigning script constraint's target.
- Setting the constraint script from python didnt update the target count
- Setting objects didnt work at all, since it checked the input sequence for being an BPy_Object type (rather then an item in the sequence)
2009-05-25 01:45:35 +00:00
Campbell Barton
1266e0f2bf quick fix still allowed for possible crash, check for valid newlibadr return value in the while loop. 2009-05-25 01:00:17 +00:00
Campbell Barton
b7653ba542 missing null check, would crash blender when loading some files 2009-05-25 00:31:41 +00:00
Campbell Barton
48abe5a66e utility script for cleaning ipos animation curves,
used in YoFrankie to reduce file size for large actions
2009-05-25 00:30:06 +00:00
Campbell Barton
fe85bdd040 - BGE Py API, any py function/attribute that took a KX_GameObject would not accept a KX_Light or KX_Camera (bad oversight on my part)
- Typo in occlusion variable init "m_buffer == NULL;" -> "m_buffer = NULL;"

CcdPhysicsEnvironment.cpp and CcdPhysicsController.cpp had too many warnings, fixed most of them.
2009-05-24 23:43:10 +00:00
Benoit Bolsee
323052068a VideoTexture: exception in C++ was not returning an error in Python. Added function name ini PyArg_ParseTuple. 2009-05-24 23:12:38 +00:00
Peter Schlaile
4e0e720158 == Sequencer ==
This fixes a stupid mistake in proxy handling with custom files:
CFRA not calculated correctly for proxy...
2009-05-24 19:54:35 +00:00
Dalai Felinto
4f7264ee52 Action actuator default value changed from 0.0 to 1.0. Bookmark renamed to Mark and other small logic tooltip changes
- IPOs and actions start it's frame counting in frame 1, not zero.
- Talked with Ben and we agreed to rename the "bookmark" feature before an official release.
- some English typos.
- removed all period in the end of tooltips for consistency's sake.

* note:
I resisted one more time to the temptation of alphabetical ordering the Sensors and Actuators.

That will be the first thing I would like to do after we are done with 2.49 :)
It really annoys me as a user.
2009-05-24 19:21:54 +00:00
Ken Hughes
2f0ec4b7fc User Interface
--------------
Bugfix 18817: DataBrowse for MTex used Material IDs instead of Texture IDs.
2009-05-24 16:22:09 +00:00
Peter Schlaile
e5509b98ce == Sequencer ==
Made relative paths work with custom proxy files.
2009-05-24 14:14:58 +00:00
Peter Schlaile
95e14ac4d3 == Sequencer ==
Fixed output rescaling, when changing between preview proxy rendering
and final resolution.
2009-05-24 14:11:16 +00:00
Peter Schlaile
ea94f8ab8a == Sequencer ==
This adds custom proxy file storage to the sequencer.
Reasoning: sometimes low resolution versions are already available as a
seperate file built by the capture application.
So there is no real reason to make blender build it's own seperate proxy.

This also somewhat fixes (aehm works around :) )
[#13632] Creating Proxy Takes Over Process, Should be Background

Since now you can just fire up ffmpeg to build your proxies in the background.
(You could have done before and build a directory of jpeg files, but then you
would have to rename all the files since otherwise things are off by one...)
2009-05-24 13:41:37 +00:00
Benoit Bolsee
e41eeaa045 BGE: renamed sensor type enum to avoid conflict with mingw (NEAR was causing the problem). 2009-05-24 12:53:49 +00:00
Erwin Coumans
83bb096f24 + renamed pad3 to m_contactProcessingThreshold (thanks Campbell Barton/ideasman for confirming it is ok to rename it)
+ fixed Python method, PyArg_ParseTuple already checks for errors, no returning of NULL, thanks Campbell too)
+ added linear/angular spring for each of the 6DOFs of a generic 6dof constraint.  This makes the generic 6dof constraint very versatile.
2009-05-24 06:31:47 +00:00
Dalai Felinto
45f2463c83 Patch #18815: BGE: More updates to deprecation documentation and 2.49 conversion script by Alex Frases(z0r)
- Fixed some deprecation warnings in documentation.
 - Added more conversions to script.
 - Added more attributes to script todo list.
 - Print out name of text buffer when encountering an error in batch mode.
 - Refactor: Simplified attribute map.
 - Added notImplemented function to print warnings for missing conversions. References documentation.
2009-05-24 04:45:10 +00:00
Erwin Coumans
52b0a2b3db PhysicsConstraints.createConstraint:
allow to dynamically create rigid body constraints while disable collision detection between connected bodies, pass as 10th argument the flag 128

PhysiPython KX_ConstraintWrapper, setParam
export setParam(paramIndex,paramValue0,paramValue1) for Physics constraints
paramIndex 0,1,2 are linear limits, 3,4,5 are angular limits, 6,7,8 are linear motors, 9,10,11 are angular motors

For example:
disableConnectedBodies=128
cons = PhysicsConstraints.createConstraint(oid,rid,generic6dof,pivotInAx,pivotInAy,pivotInAz,angleX,angleY,angleZ,disableConnectedBodies)
#params 0,1,2 are linear limits, low,high value. if low > high then disable limit
cons.setParam(0,0,0)

I will provide an example .blend for Blender 2.49
2009-05-24 01:55:24 +00:00
Erwin Coumans
4922dd0339 fix generic 6dof constraint support -> convert 3 values into euler angles and convert those into a full constraint frame
(same values as Rigid Body constraint Generic 6DOF values), and add 'setLimit' support for generic 6DOF constraint. todo: enableMotor
2009-05-24 00:42:40 +00:00
Erwin Coumans
eb8c5f3272 Set default constraint solver mode more compatible to Blender 2.48 settings, this fixes rigid body stacking in this blend file:
http://blenderartists.org/forum/showpost.php?p=1382653&postcount=102

(todo: expose this setting in World setting GUI)

Expose contact processing threshold in Advanced GUI, next to rigid body margin, called CPT.
Default to 1, makes rigid body stacking a bit more stable, smaller values makes sliding easier (at the cost of easier jittering).
Disabled for 'dynamic' objects that don't rotate, because characters etc. always need smooth sliding.
2009-05-23 22:35:47 +00:00
Erwin Coumans
a96ce9453f Minor fixes in Bullet/constraint solving
Should  make generic 6DOF constraint more useable, and rigid body stacking more stable (warmstarting was accidently switched off)
If time allows, a few more minor last-minute 2.49 fixes might follow.
Check out http://bulletphysics.com/constraintsTutorial.blend
2009-05-23 20:02:12 +00:00
Peter Schlaile
2de8f6e328 == Sequencer ==
Fix for the fix: SDL_PauseAudio() doesn't really wait for callback to finish
which can lead to random segfaults if we set audio_scene to 0 afterwards.

So we don't do that.
2009-05-23 19:36:11 +00:00
Benoit Bolsee
5441323dca BGE: fix memleaks.
SCA_RandomActuator: The random generator was shared between replicas and not deleted. Added ref counting between replicas to allow deletion at the end.
KX_Camera: The scenegraph node was not deleted for temporary cameras (ImageMirror and shadow), causing 500 bytes leak per frame and per shadow light.
KX_GameActuator: Global dictionary buffer was not deleted after saving.
KX_MotionState: The motion state for compound child was not deleted
KX_ReplaceMeshActuator: The mesh was unnecessarily converted for each actuator and not deleted, causing large memleak.

After these fix, YoFrankie runs without memleak.
2009-05-23 14:46:43 +00:00
Benoit Bolsee
6d8d7cd768 BGE: Random sensor will produce true random sequence of events when seed is set to 0 in the GUI (the actual seed value is stored in the sensor seed attribute). Positive values will use fixed pseudo random sequence. 2009-05-23 14:40:36 +00:00
Benoit Bolsee
4e3248fb91 FIX memleak in mmap(). 2009-05-23 14:21:11 +00:00
Peter Schlaile
443df708e2 == Sequencer ==
This fixes:
[#18373] WAV with IPO CURVE: Clicking in playback

by adding linear interpolation between frames. (Old IPOs were only calculated
once per frame which will lead to clicking on steep curves)
2009-05-23 07:37:02 +00:00
Campbell Barton
3820e4f3db BGE PyController module reloading didnt check that the base of the function was a module (could be a class). 2009-05-23 04:56:37 +00:00
Campbell Barton
cfa2b4f0a5 [#18802] BGE conversion script: more attributes; updated GameTypes.py
Patch from Alex Fraser (z0r)

 - All attributes in the conversion map have been checked against the docs. More ambiguities have been resolved.
 - Added option to convert all text buffers in Blender.
 - Updated GameTypes.py: there were inconsistencies.

The script works well (causes no errors) with 0_FPS_Template.blend and vehicle_demo.blend from the
physics-2.43-physics-testfiles pack.

Caveats:
 - Conversions were checked against other deprecated attributes. I may have missed some cases where a deprecated attribute
has the same name as a non-deprecated attribute. I did catch a few though.
 - As with the last version, the conversion is purely text-based and doesn't compile the code. It's easy to create a
script that would break on conversion.

Still, it should get you 90% of the way to a converted script.
2009-05-23 03:19:47 +00:00
Ken Hughes
89049782de Python API
----------
Fix incorrect exception message.
2009-05-22 17:01:32 +00:00
Campbell Barton
794826feae Update to the bolt/nut script, I also replaced some loops with list-comprehension and use mesh.transform(matrix) rather then transforming every vert in a loop.
V2.00 22/05/09 by Aaron Keith

- Better error checking.
- Lock Nut and Hex Nut meshes added.
- Pre-sets for common metric bolts and nuts.
- Improved GUI.
- Meshes scaled to a smaller size
- Fixed bug when using crest and root percent other than 10%
- Can now create meshes in Edit Mode.  This will add to the 
  current mesh and align with the current view.
2009-05-22 12:31:27 +00:00
Campbell Barton
66ed4325f4 the debug option for BGE scripts only reloaded modules but not packages submodules.
Now reload all the submodules too.

It was also hiding the error message if there was a syntax error which wasnt so helpful.
2009-05-22 09:48:05 +00:00
Dalai Felinto
ec60c74f08 Fix for: energy IPO not supported in glsl mode (reported in the forum).
in fact I redid part of the last "fix", making it working properly now.

Before we were changing Lamp->la . This is the Blender Lamp, we shouldn't touch it.
So this part of the code is correct now.

Things that could be tackled:
- color attribute is returning negative values when NEGATIVE is toggled
- objects with no material (default gray one) still don't support lamp spots (not spot lamp but the spot of the lamps)
2009-05-22 06:12:18 +00:00
Campbell Barton
612f3b3266 Removed use of CrossVecs, DotVecs, CrossQuats and DotQuats
for all scripts except import_dxf and colladaImEx/translator.py
2009-05-22 03:45:46 +00:00
Campbell Barton
e191618cb5 - Deprecated Mathutils.CrossVecs(v1,v2) for v1.cross(v2), (same with .DotVecs -> v1.dot(v2), for CrossQuats and DotQuats too)
- Grouped Mathutils deprecated functions
- Dont include source code in bpy epydocs
2009-05-22 03:22:56 +00:00
Benoit Bolsee
7f5acd6875 BGE remove parent: unparented object keeps the linear and angular velocity it had while being parented. 2009-05-21 19:38:49 +00:00
Benoit Bolsee
036ebc5523 BGE: GUI control over frame rate, logic rate, physics rate and physics subrate.
Four new buttons in World settings to control frame rate:
fps:  Nominal frame rate in frame per second.
      Also sets the physics timestep = 1/fps
phys: Maximum number of physics timestep per game frame in case
      the actual fps is less than nominal. This allows the 
      physics to keep up with real time even if the graphics slows
      down the game.
sub:  Fixed number of simulation substeps per physic timestep.
      Improves the precision of the physics simulation. Useful for
      fast moving objects for example.
log:  Maximum number of logic steps per game frame in case the 
      actual fps is less than nominal. This allows the logic
      system to follow the physics simulation. 
      Upper bound = phys 
      (setting the value higher than phys has no effect).
      On games with heavy logic system, it is useful to set this
      value to 1, to keep logic time under control.

All these values were already accessible from Python except phys:

GameLogic.getMaxPhysicsFrame():
	Gets the maximum number of physics frame per render frame.

GameLogic.setMaxPhysicsFrame(phys):
	Sets the maximum number of physics timestep that are executed per render frame.
	Higher value allows physics to keep up with realtime even if graphics slows down the game.
	Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate)
	maxphysics/ticrate is the maximum delay of the renderer that physics can compensate.
      phys: integer
2009-05-21 18:10:19 +00:00