Commit Graph

14513 Commits

Author SHA1 Message Date
Benoit Bolsee
bd81d96b78 Video Texture: missing newlines at the end of several files. 2008-11-01 15:58:49 +00:00
Benoit Bolsee
5cb16c2d03 Video Texture: remove support for capture device, the linux ffmpeg repository is not ready yet. 2008-11-01 15:42:03 +00:00
Brecht Van Lommel
00b02f055a Patch 17909: 2D Filter texture coordinates changes, by Dalai Felinto:
* The second opengl texture coordinate (gl_TexCoord[1]) are now filled
  in as well, and will give canvas coordinates from 0.0 to 1.0. The
  first texture coordinates still give the coordinates in the texture
  that is being used, which may not match the canvas exactly, so both
  coordinates are needed.
* Also optimization to allow using smaller texture sizes with multiple
  smaller viewports.
* Print the detailed GLSL shader errors (once), for easier debugging.
2008-11-01 14:00:16 +00:00
Benoit Bolsee
54401d36aa BGE Video Texture: fix constant initializer problem with Exception description. Uniformized the line ending. 2008-11-01 12:48:46 +00:00
Remigiusz Fiedler
b590b121d3 fix a bug in matrix.invert() for 2x2 matrices
reported by Hans in http://blenderartists.org/forum/showthread.php?t=139748
2008-11-01 11:35:08 +00:00
Benoit Bolsee
48fb0edc78 Fix Cmake for MSVC 32bit 2008-11-01 11:15:13 +00:00
Benoit Bolsee
a8c4eef326 VideoTexture module.
The only compilation system that works for sure is the MSVC project files. I've tried my best to
update the other compilation system but I count on the community to check and fix them.
 
This is Zdeno Miklas video texture plugin ported to trunk. 
The original plugin API is maintained (can be found here http://home.scarlet.be/~tsi46445/blender/blendVideoTex.html)
EXCEPT for the following:

The module name is changed to VideoTexture (instead of blendVideoTex).

A new (and only) video source is now available: VideoFFmpeg()
You must pass 1 to 4 arguments when you create it (you can use named arguments):

VideoFFmpeg(file) : play a video file
VideoFFmpeg(file, capture, rate, width, height) : start a live video capture

file:
In the first form, file is a video file name, relative to startup directory.
It can also be a URL, FFmpeg will happily stream a video from a network source.
In the second form, file is empty or is a hint for the format of the video capture.
In Windows, file is ignored and should be empty or not specified.
In Linux, ffmpeg supports two types of device: VideoForLinux and DV1394. 
The user specifies the type of device with the file parameter:
   [<device_type>][:<standard>]
   <device_type> : 'v4l' for VideoForLinux, 'dv1394' for DV1394; default to 'v4l'
   <standard>    : 'pal', 'secam' or 'ntsc', default to 'ntsc'
The driver name is constructed automatically from the device types:
   v4l   : /dev/video<capture>
   dv1394: /dev/dv1394/<capture>
If you have different driver name, you can specify the driver name explicitely 
instead of device type. Examples of valid file parameter:
   /dev/v4l/video0:pal
   /dev/ieee1394/1:ntsc
   dv1394:ntsc
   v4l:pal
   :secam

capture: 
Defines the index number of the capture source, starting from 0. The first capture device is always 0.
The VideoTexutre modules knows that you want to start a live video capture when you set this parameter to a number >= 0. Setting this parameter < 0 indicates a video file playback. Default value is -1.

rate: 
the capture frame rate, by default 25 frames/sec

width: 
height: 
Width and height of the video capture in pixel, default value 0.
In Windows you must specify these values and they must fit with the capture device capability. 
For example, if you have a webcam that can capture at 160x120, 320x240 or 640x480, 
you must specify one of these couple of values or the opening of the video source will fail.
In Linux, default values are provided by the VideoForLinux driver if you don't specify width and height.

Simple example
**************
1. Texture definition script:

import VideoTexture

contr = GameLogic.getCurrentController()
obj = contr.getOwner()
if not hasattr(GameLogic, 'video'):
	matID = VideoTexture.materialID(obj, 'MAVideoMat')
	GameLogic.video = VideoTexture.Texture(obj, matID)
	GameLogic.vidSrc = VideoTexture.VideoFFmpeg('trailer_400p.ogg')
	# Streaming is also possible:
	#GameLogic.vidSrc = VideoTexture.VideoFFmpeg('http://10.32.1.10/trailer_400p.ogg')
	GameLogic.vidSrc.repeat = -1
	# If the video dimensions are not a power of 2, scaling must be done before
	# sending the texture to the GPU. This is done by default with gluScaleImage()
	# but you can also use a faster, but less precise, scaling by setting scale
	# to True. Best approach is to convert the video offline and set the dimensions right.
	GameLogic.vidSrc.scale = True
	# FFmpeg always delivers the video image upside down, so flipping is enabled automatically
	#GameLogic.vidSrc.flip = True

if contr.getSensors()[0].isPositive():
	GameLogic.video.source = GameLogic.vidSrc
	GameLogic.vidSrc.play()


2. Texture refresh script:

obj = GameLogic.getCurrentController().getOwner()
if hasattr(GameLogic, 'video') != 0:
  GameLogic.video.refresh(True)

You can download this demo here: 
http://home.scarlet.be/~tsi46445/blender/VideoTextureDemo.blend
http://home.scarlet.be/~tsi46445/blender/trailer_400p.ogg
2008-10-31 22:35:52 +00:00
Benoit Bolsee
77b4c66cc3 Preparation to VideoTexture: everything but the VideoTexture module itself.
Rename PHY_GetActiveScene() to KX_GetActiveScene(): more logical name
Add KX_GetActiveEngine()

new KX_KetsjiEngine::GetClockTime(void) to return current 
render frame time: if the CPU does not keep up with the 
frame rate, up to 5 consecutive logic frames are processed 
between each render frame, so that the logic system stays 
accurate even if the graphic system is slow. For the video 
texture module, it is important to stay in sync with the
render frame: no need to update the texture for logic frame.

BL_Texture::swapTexture(): texture id manipulation
BL_Texture::getTex() : return material texture

Enable video support in ffmpeg for Linux.
2008-10-31 21:06:48 +00:00
Benoit Bolsee
8585813693 Update MSVC project files 2008-10-31 20:50:07 +00:00
Nathan Letwory
44efce4f66 * remove unreferenced var 2008-10-31 20:47:30 +00:00
Nathan Letwory
3f7535d3c3 * silence compiler about warnings for C++ files a bit more.
- from what I can see now, the larger part of warnings is now about conversions "possible loss of data" (ie. double to float, etc).
2008-10-31 20:35:14 +00:00
Nathan Letwory
027d86b9ff * doc update 2008-10-31 16:33:42 +00:00
Kent Mein
25a2753877 This is coverity issue CID: 456
fixes a buffer overrun issue.

Kent
2008-10-31 14:15:35 +00:00
Martin Poirier
68cde07b99 corrections to the C_WARN and CC_WARN variables for scons config. I didn't actually changed what the flags were, just the format, but Platform Maintainers, please check. 2008-10-31 13:58:59 +00:00
Martin Poirier
457b1118a2 Fix compile flags in linux config to fit Nathan's changes.
Warning to others: Those flags are lists now, be careful and update other configs if needed.
2008-10-31 00:23:01 +00:00
Nathan Letwory
0bd7934be7 * Minimum SCons version is now 1.0.0
- Code has been changed to reflect this (ie. deprecated functions are not anymore used)
* clean up the C and C++ compiler flags mess.
  - in the environment construction of BlenderLib all the compile flag governing options have been split in the *C*, *CC* and *CXX* containing equivalents.
    C is for C compiler only flags. CC is for C and C++ compiler flags and CXX is for C++ compiler only flags.
    All the platform default config files need to be double checked and fixed wherever it looks necessary. Either DIY, or send me a note with needed changes.
  - a start for the BlenderLib parameter list has been made - all the SConscripts need to be checked and modified to hand in flags properly.
* A theeth request: make -jN settable in the config file.
  - I give you BF_NUMJOBS, which is set to 1 by default. In your user-config.py, set BF_NUMJOBS=4 to have 4 parallel jobs handled. Yay.
2008-10-30 23:55:07 +00:00
Nathan Letwory
dca18fc332 * Build aborts when giving options on command-line when WITH_BF_DOCS=True
- make sure epydoc generation doesn't get a fit over options given on scons command-line -> don't use arguments from command-line.
2008-10-30 18:56:20 +00:00
Martin Poirier
00f3021b68 Build fix (C90): Declaration after statement 2008-10-30 16:38:32 +00:00
Brecht Van Lommel
baf98b098c Fix for dependency graph cycle print, regular "Parent" relation was
incorrectly printed as "Curve Parent".
2008-10-30 16:03:38 +00:00
Daniel Genrich
4f39255759 Bugfix for [#17879] Speed vectors/velocity data not working on ALL fluids. 2008-10-30 11:51:15 +00:00
Martin Poirier
35680bbda6 EditVert hash *is* used elsewhere in the code, so just to be safe, use a scratch array instead.
This is actually much safer than juggling values in the tmp union all the time.
2008-10-29 18:57:28 +00:00
Kent Mein
4cee77b822 This is a fix for coverity issue CID: 517
Basically the code was referencing var[-1] it wasn't using it
but also did not need to be set in those cases.  So I moved
the assignments so it skips the -1 case.

Kent
2008-10-29 17:45:02 +00:00
Campbell Barton
22bcbc5742 fix for more disable python defines,
FTOCHAR didnt have brackets around the value. FTOCHAR(a+b) didnt work, FTOCHAR((a+b)) did.
2008-10-29 16:49:51 +00:00
Martin Poirier
481831bd27 merging harmonic-skeleton branch into trunk. All changes are hidden behind a disabled define, nothing to see here 2008-10-28 22:53:48 +00:00
Martin Poirier
4baa2d7800 merge 17206:17211 2008-10-28 20:26:38 +00:00
Campbell Barton
07a1971ced error in DISABLE_PYTHON defines 2008-10-28 20:19:25 +00:00
Kent Mein
dca5192974 Fixes blenderplayer for dds stuff
Kent
2008-10-28 19:53:54 +00:00
Campbell Barton
ac4ff83ca6 added scons option BF_WITH_PYTHON (defined as DISABLE_PYTHON) 2008-10-28 18:47:13 +00:00
Martin Poirier
025e4b046a merge 17122:17206 2008-10-28 18:47:01 +00:00
Martin Poirier
d1e90606c7 Add compile time define to disable skeleton generation and retargetting UI (disabled by default).
This is done to make merging make in trunk painless.
2008-10-28 18:33:53 +00:00
Kent Mein
705a248c75 Updated cmake so it has the option to use WITH_DDS
Kent
2008-10-28 18:33:34 +00:00
Campbell Barton
c71430d072 bpy access to image premul was missing. 2008-10-28 02:03:13 +00:00
Ken Hughes
5cd569ed0e Python API
----------
Bugfix #17911: Mesh.getFromObject() incorrectly decremented the mesh's
material user refcount when the material was linked to the object.
2008-10-28 00:01:20 +00:00
Campbell Barton
2e96728843 face transp option CLIP wasnt added to the py api.
added gameObject.replaceMesh(meshname)  - needed this for an automatically generated scene where 100's of objects would have needed logic bricks automatically added. Quicker to run replace mesh on all of them from 1 script.
2008-10-27 15:47:58 +00:00
Brecht Van Lommel
71260b6603 Fix for crash reading a peach file, chubbychestnut.blend. A do_versions
conversion was reading the mtex array in a library linked material. It
is however not guaranteed that direct_link_* was called  on the material
yet, so the array pointer is not always valid and it can crash.
2008-10-27 15:22:55 +00:00
Joshua Leung
780a5438a2 Bugfixes:
* #17900 - IK Constraint was not included regardless of what Visual-Keying method was used
* Deleting a Bone Group now corrects indices of those groups that occurred after the one that was deleted
* No more click-a-mania - Delete all vertex groups from a Mesh (Ctrl-Shift-G menu)
2008-10-26 09:41:59 +00:00
Campbell Barton
0dc22dc65e fix for [#17895] Python-generated Curves can't be beveled
radius and weight's values were not initialized for nurbs curves

for 2.48a just use set radius from curve specials menu to work around this.
2008-10-26 08:06:48 +00:00
Campbell Barton
c11c299d59 default opengl static locations was to try /usr/libGL.a, use the oprngl lib path instead - /usr/X11R6/lib/libGL.a 2008-10-22 16:43:38 +00:00
Ton Roosendaal
f005bb1a2a Missing NULL check causes crash on Ikey when no active object.
Error is bad enough to go for a retag... hrmf!

Report from Ernesto (der|kunstler) Mndez in irc. Thanks a lot!
2008-10-22 16:13:30 +00:00
Ton Roosendaal
fbecf0cadc New splash c file (now gimp png) and bumped version to 2.48.1 to make it
even a bit more clear.

After this commit we'll tag svn (gasp!) and then go build!
2008-10-22 11:50:12 +00:00
Ton Roosendaal
d4e2c48faa Part one of the release update commit 2008-10-22 11:48:26 +00:00
Nathan Letwory
2ecf987dc6 * Minor cleanup of SCons files
- cleanup of boolean usage - use True and False now instead of 'true'/'false' or 0/1
- changed SConscripts accordingly
2008-10-22 11:28:10 +00:00
Campbell Barton
688cc11302 added an option for python Draw.UIBlock(func, mouse_exit) so moving the mouse outside the popup wont close it.
Stops FBX Export and OBJ I/O from flickering a lot.
2008-10-22 08:21:43 +00:00
Campbell Barton
69c6bd604c make sure BPY_Err_Handle clears python errors, even if the exception cant be printed. Added PyErr_Clear() incase there are other references to exception data (sys.exc_info() from python) 2008-10-22 07:09:15 +00:00
Nathan Letwory
5987488fd0 * comment fix 2008-10-22 07:02:30 +00:00
Joilnen Leite
09e4bb058c 2008-10-22 05:35:23 +00:00
Joilnen Leite
0026247ee2 2008-10-22 05:33:45 +00:00
Campbell Barton
18f2d484d9 missing undo for vgroup operations, countall was running twice from select/deselect and DAG_object_flush_update isnt needed for changed selections. 2008-10-22 04:42:00 +00:00
Campbell Barton
59a30d822f fix for [#17878] Scripts operating on blender objects don't clear memory after a crash
This is an interesting bug since it is likely the cause of many other suspicious python crashes in blender.

sys.last_traceback would store references to PyObjects at the point of the crash.
it would only free these when sys.last_traceback was set again or on exit.

This caused many crashes in the BGE while testing since python would end up freeing invalid game objects -
When running scripts with errors, Blender would crash every 2-5 runs - in my test just now it crashed after 4 trys.

It could also segfault blender, when (for eg) you run a script that has objects referenced. then load a new file and run another script that raises an error.
In this case all the invalid Blender-Object's user counts would be decremented, even though none of the pointers were still valid.
2008-10-22 03:10:00 +00:00
Campbell Barton
4936e09cdf add a way for external scripts to call X3D/VRML importer and deal with unknown node types. 2008-10-21 23:14:40 +00:00