diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-07-25 21:51:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-07-25 21:51:30 +0400 |
commit | cadfac5a0f54c2e7086a6c1cf93f90adcbd1b7bb (patch) | |
tree | 5ac97cdf4b8b6e5a829448ad7de34c59e7c35053 | |
parent | cc0abf99632064f9daba60be8867f2addd28b9e8 (diff) | |
parent | 99736f373c12e7ab91f962c738243bddf2d713c6 (diff) |
svn merge -r38000:38200 https://svn.blender.org/svnroot/bf-blender/trunk/blender
114 files changed, 3181 insertions, 2103 deletions
diff --git a/build_files/cmake/cmake_consistency_check.py b/build_files/cmake/cmake_consistency_check.py index b0fd242db4a..c13da8775b3 100755 --- a/build_files/cmake/cmake_consistency_check.py +++ b/build_files/cmake/cmake_consistency_check.py @@ -26,7 +26,7 @@ from cmake_consistency_check_config import IGNORE, UTF8_CHECK, SOURCE_DIR import os -from os.path import join, dirname, normpath, abspath, splitext +from os.path import join, dirname, normpath, splitext print("Scanning:", SOURCE_DIR) @@ -183,7 +183,6 @@ def is_ignore(f): # First do stupid check, do these files exist? print("\nChecking for missing references:") -import sys is_err = False errs = [] for f in (global_h | global_c): diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 50f43a03b8b..d8f5ba9e115 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -565,13 +565,16 @@ def AppIt(target=None, source=None, env=None): cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION) commands.getoutput(cmd) cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,installdir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/ui %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/io %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) commands.getoutput(cmd) + + if binary == 'blender':#not copy everything for blenderplayer + cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) + commands.getoutput(cmd) + cmd = 'cp -R %s/release/ui %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) + commands.getoutput(cmd) + cmd = 'cp -R %s/release/io %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) + commands.getoutput(cmd) + cmd = 'chmod +x %s/%s.app/Contents/MacOS/%s'%(installdir,binary, binary) commands.getoutput(cmd) cmd = 'find %s/%s.app -name .svn -prune -exec rm -rf {} \;'%(installdir, binary) diff --git a/doc/python_api/epy/BGL.py b/doc/python_api/epy/BGL.py deleted file mode 100644 index ce148dc72ba..00000000000 --- a/doc/python_api/epy/BGL.py +++ /dev/null @@ -1,1807 +0,0 @@ -# Blender.BGL module (OpenGL wrapper) - -""" -The Blender.BGL submodule (the OpenGL wrapper). - -B{New}: some GLU functions: L{gluLookAt}, etc. - -The Blender.BGL submodule -========================= -(when accessing it from the Game Engine use BGL instead of Blender.BGL) - -This module wraps OpenGL constants and functions, making them available from -within Blender Python. - -The complete list can be retrieved from the module itself, by listing its -contents: dir(Blender.BGL). A simple search on the net can point to more -than enough material to teach OpenGL programming, from books to many -collections of tutorials. - -The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning -OpenGL}" and the online NeHe tutorials are two of the best resources. - -Example:: - import Blender - from Blender.BGL import * - from Blender import Draw - R = G = B = 0 - A = 1 - title = "Testing BGL + Draw" - instructions = "Use mouse buttons or wheel to change the background color." - quitting = " Press ESC or q to quit." - len1 = Draw.GetStringWidth(title) - len2 = Draw.GetStringWidth(instructions + quitting) - # - def show_win(): - glClearColor(R,G,B,A) # define color used to clear buffers - glClear(GL_COLOR_BUFFER_BIT) # use it to clear the color buffer - glColor3f(0.35,0.18,0.92) # define default color - glBegin(GL_POLYGON) # begin a vertex data list - glVertex2i(165, 158) - glVertex2i(252, 55) - glVertex2i(104, 128) - glEnd() - glColor3f(0.4,0.4,0.4) # change default color - glRecti(40, 96, 60+len1, 113) - glColor3f(1,1,1) - glRasterPos2i(50,100) # move cursor to x = 50, y = 100 - Draw.Text(title) # draw this text there - glRasterPos2i(350,40) # move cursor again - Draw.Text(instructions + quitting) # draw another msg - glBegin(GL_LINE_LOOP) # begin a vertex-data list - glVertex2i(46,92) - glVertex2i(120,92) - glVertex2i(120,115) - glVertex2i(46,115) - glEnd() # close this list - # - def ev(evt, val): # event callback for Draw.Register() - global R,G,B,A # ... it handles input events - if evt == Draw.ESCKEY or evt == Draw.QKEY: - Draw.Exit() # this quits the script - elif not val: return - elif evt == Draw.LEFTMOUSE: R = 1 - R - elif evt == Draw.MIDDLEMOUSE: G = 1 - G - elif evt == Draw.RIGHTMOUSE: B = 1 - B - elif evt == Draw.WHEELUPMOUSE: - R += 0.1 - if R > 1: R = 1 - elif evt == Draw.WHEELDOWNMOUSE: - R -= 0.1 - if R < 0: R = 0 - else: - return # don't redraw if nothing changed - Draw.Redraw(1) # make changes visible. - # - Draw.Register(show_win, ev, None) # start the main loop - -@note: you can use the L{Image} module and L{Image.Image} BPy object to load - and set textures. See L{Image.Image.glLoad} and L{Image.Image.glFree}, - for example. -@see: U{www.opengl.org} -@see: U{nehe.gamedev.net} -""" - -def glAccum(op, value): - """ - Operate on the accumulation buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/accum.html} - - @type op: Enumerated constant - @param op: The accumulation buffer operation. - @type value: float - @param value: a value used in the accumulation buffer operation. - """ - -def glAlphaFunc(func, ref): - """ - Specify the alpha test function - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/alphafunc.html} - - @type func: Enumerated constant - @param func: Specifies the alpha comparison function. - @type ref: float - @param ref: The reference value that incoming alpha values are compared to. - Clamped between 0 and 1. - """ - -def glAreTexturesResident(n, textures, residences): - """ - Determine if textures are loaded in texture memory - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/aretexturesresident.html} - - @type n: int - @param n: Specifies the number of textures to be queried. - @type textures: Buffer object I{type GL_INT} - @param textures: Specifies an array containing the names of the textures to be queried - @type residences: Buffer object I{type GL_INT}(boolean) - @param residences: An array in which the texture residence status in returned.The residence status of a - texture named by an element of textures is returned in the corresponding element of residences. - """ - -def glBegin(mode): - """ - Delimit the vertices of a primitive or a group of like primatives - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html} - - @type mode: Enumerated constant - @param mode: Specifies the primitive that will be create from vertices between glBegin and - glEnd. - """ - -def glBindTexture(target, texture): - """ - Bind a named texture to a texturing target - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bindtexture.html} - - @type target: Enumerated constant - @param target: Specifies the target to which the texture is bound. - @type texture: unsigned int - @param texture: Specifies the name of a texture. - """ - -def glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap): - """ - Draw a bitmap - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bitmap.html} - - @type width, height: int - @param width, height: Specify the pixel width and height of the bitmap image. - @type xorig, yorig: float - @param xorig, yorig: Specify the location of the origin in the bitmap image. The origin is measured - from the lower left corner of the bitmap, with right and up being the positive axes. - @type xmove, ymove: float - @param xmove, ymove: Specify the x and y offsets to be added to the current raster position after - the bitmap is drawn. - @type bitmap: Buffer object I{type GL_BYTE} - @param bitmap: Specifies the address of the bitmap image. - """ - -def glBlendFunc(sfactor, dfactor): - """ - Specify pixel arithmetic - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/blendfunc.html} - - @type sfactor: Enumerated constant - @param sfactor: Specifies how the red, green, blue, and alpha source blending factors are - computed. - @type dfactor: Enumerated constant - @param dfactor: Specifies how the red, green, blue, and alpha destination blending factors are - computed. - """ - -def glCallList(list): - """ - Execute a display list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllist.html} - - @type list: unsigned int - @param list: Specifies the integer name of the display list to be executed. - """ - -def glCallLists(n, type, lists): - """ - Execute a list of display lists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllists.html} - - @type n: int - @param n: Specifies the number of display lists to be executed. - @type type: Enumerated constant - @param type: Specifies the type of values in lists. - @type lists: Buffer object - @param lists: Specifies the address of an array of name offsets in the display list. - The pointer type is void because the offsets can be bytes, shorts, ints, or floats, - depending on the value of type. - """ - -def glClear(mask): - """ - Clear buffers to preset values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clear.html} - - @type mask: Enumerated constant(s) - @param mask: Bitwise OR of masks that indicate the buffers to be cleared. - """ - -def glClearAccum(red, green, blue, alpha): - """ - Specify clear values for the accumulation buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html} - - @type red, green, blue, alpha: float - @param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the - accumulation buffer is cleared. The initial values are all 0. - """ - -def glClearColor(red, green, blue, alpha): - """ - Specify clear values for the color buffers - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html} - - @type red, green, blue, alpha: float - @param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the - color buffers are cleared. The initial values are all 0. - """ - -def glClearDepth(depth): - """ - Specify the clear value for the depth buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cleardepth.html} - - @type depth: int - @param depth: Specifies the depth value used when the depth buffer is cleared. - The initial value is 1. - """ - -def glClearIndex(c): - """ - Specify the clear value for the color index buffers - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearindex.html} - - @type c: float - @param c: Specifies the index used when the color index buffers are cleared. - The initial value is 0. - """ - -def glClearStencil(s): - """ - Specify the clear value for the stencil buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearstencil.html} - - @type s: int - @param s: Specifies the index used when the stencil buffer is cleared. The initial value is 0. - """ - -def glClipPlane (plane, equation): - """ - Specify a plane against which all geometry is clipped - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clipplane.html} - - @type plane: Enumerated constant - @param plane: Specifies which clipping plane is being positioned. - @type equation: Buffer object I{type GL_FLOAT}(double) - @param equation: Specifies the address of an array of four double- precision floating-point - values. These values are interpreted as a plane equation. - """ - -def glColor (red, green, blue, alpha): - """ - B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us, - glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us, - glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv, - glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv, - glColor4uiv, glColor4usv} - - Set a new color. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html} - - @type red, green, blue, alpha: Depends on function prototype. - @param red, green, blue: Specify new red, green, and blue values for the current color. - @param alpha: Specifies a new alpha value for the current color. Included only in the - four-argument glColor4 commands. (With '4' colors only) - """ - -def glColorMask(red, green, blue, alpha): - """ - Enable and disable writing of frame buffer color components - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html} - - @type red, green, blue, alpha: int (boolean) - @param red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be - written into the frame buffer. The initial values are all GL_TRUE, indicating that the - color components can be written. - """ - -def glColorMaterial(face, mode): - """ - Cause a material color to track the current color - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormaterial.html} - - @type face: Enumerated constant - @param face: Specifies whether front, back, or both front and back material parameters should - track the current color. - @type mode: Enumerated constant - @param mode: Specifies which of several material parameters track the current color. - """ - -def glCopyPixels(x, y, width, height, type): - """ - Copy pixels in the frame buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html} - - @type x, y: int - @param x, y: Specify the window coordinates of the lower left corner of the rectangular - region of pixels to be copied. - @type width, height: int - @param width,height: Specify the dimensions of the rectangular region of pixels to be copied. - Both must be non-negative. - @type type: Enumerated constant - @param type: Specifies whether color values, depth values, or stencil values are to be copied. - """ - - def glCopyTexImage2D(target, level, internalformat, x, y, width, height, border): - """ - Copy pixels into a 2D texture image - @see: U{www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type level: int - @param level: Specifies the level-of-detail number. Level 0 is the base image level. - Level n is the nth mipmap reduction image. - @type internalformat: int - @param internalformat: Specifies the number of color components in the texture. - @type width: int - @type x, y: int - @param x, y:Specify the window coordinates of the first pixel that is copied - from the frame buffer. This location is the lower left corner of a rectangular - block of pixels. - @param width: Specifies the width of the texture image. Must be 2n+2(border) for - some integer n. All implementations support texture images that are at least 64 - texels wide. - @type height: int - @param height: Specifies the height of the texture image. Must be 2m+2(border) for - some integer m. All implementations support texture images that are at least 64 - texels high. - @type border: int - @param border: Specifies the width of the border. Must be either 0 or 1. - """ - -def glCullFace(mode): - """ - Specify whether front- or back-facing facets can be culled - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cullface.html} - - @type mode: Enumerated constant - @param mode: Specifies whether front- or back-facing facets are candidates for culling. - """ - -def glDeleteLists(list, range): - """ - Delete a contiguous group of display lists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletelists.html} - - @type list: unsigned int - @param list: Specifies the integer name of the first display list to delete - @type range: int - @param range: Specifies the number of display lists to delete - """ - -def glDeleteTextures(n, textures): - """ - Delete named textures - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html} - - @type n: int - @param n: Specifies the number of textures to be deleted - @type textures: Buffer I{GL_INT} - @param textures: Specifies an array of textures to be deleted - """ - -def glDepthFunc(func): - """ - Specify the value used for depth buffer comparisons - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthfunc.html} - - @type func: Enumerated constant - @param func: Specifies the depth comparison function. - """ - -def glDepthMask(flag): - """ - Enable or disable writing into the depth buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthmask.html} - - @type flag: int (boolean) - @param flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE, - depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer - writing is enabled. - """ - -def glDepthRange(zNear, zFar): - """ - Specify mapping of depth values from normalized device coordinates to window coordinates - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthrange.html} - - @type zNear: int - @param zNear: Specifies the mapping of the near clipping plane to window coordinates. - The initial value is 0. - @type zFar: int - @param zFar: Specifies the mapping of the far clipping plane to window coordinates. - The initial value is 1. - """ - -def glDisable(cap): - """ - Disable server-side GL capabilities - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html} - - @type cap: Enumerated constant - @param cap: Specifies a symbolic constant indicating a GL capability. - """ - -def glDrawBuffer(mode): - """ - Specify which color buffers are to be drawn into - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawbuffer.html} - - @type mode: Enumerated constant - @param mode: Specifies up to four color buffers to be drawn into. - """ - -def glDrawPixels(width, height, format, type, pixels): - """ - Write a block of pixels to the frame buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html} - - @type width, height: int - @param width, height: Specify the dimensions of the pixel rectangle to be - written into the frame buffer. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type for pixels. - @type pixels: Buffer object - @param pixels: Specifies a pointer to the pixel data. - """ - -def glEdgeFlag (flag): - """ - B{glEdgeFlag, glEdgeFlagv} - - Flag edges as either boundary or non-boundary - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/edgeflag.html} - - @type flag: Depends of function prototype - @param flag: Specifies the current edge flag value.The initial value is GL_TRUE. - """ - -def glEnable(cap): - """ - Enable server-side GL capabilities - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html} - - @type cap: Enumerated constant - @param cap: Specifies a symbolic constant indicating a GL capability. - """ - -def glEnd(): - """ - Delimit the vertices of a primitive or group of like primitives - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html} - """ - -def glEndList(): - """ - Create or replace a display list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html} - """ - -def glEvalCoord (u,v): - """ - B{glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv, - glEvalCoord2dv, glEvalCoord2fv} - - Evaluate enabled one- and two-dimensional maps - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalcoord.html} - - @type u: Depends on function prototype. - @param u: Specifies a value that is the domain coordinate u to the basis function defined - in a previous glMap1 or glMap2 command. If the function prototype ends in 'v' then - u specifies a pointer to an array containing either one or two domain coordinates. The first - coordinate is u. The second coordinate is v, which is present only in glEvalCoord2 versions. - @type v: Depends on function prototype. (only with '2' prototypes) - @param v: Specifies a value that is the domain coordinate v to the basis function defined - in a previous glMap2 command. This argument is not present in a glEvalCoord1 command. - """ - -def glEvalMesh (mode, i1, i2): - """ - B{glEvalMesh1 or glEvalMesh2} - - Compute a one- or two-dimensional grid of points or lines - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalmesh.html} - - @type mode: Enumerated constant - @param mode: In glEvalMesh1, specifies whether to compute a one-dimensional - mesh of points or lines. - @type i1, i2: int - @param i1, i2: Specify the first and last integer values for the grid domain variable i. - """ - -def glEvalPoint (i, j): - """ - B{glEvalPoint1 and glEvalPoint2} - - Generate and evaluate a single point in a mesh - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalpoint.html} - - @type i: int - @param i: Specifies the integer value for grid domain variable i. - @type j: int (only with '2' prototypes) - @param j: Specifies the integer value for grid domain variable j (glEvalPoint2 only). - """ - -def glFeedbackBuffer (size, type, buffer): - """ - Controls feedback mode - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/feedbackbuffer.html} - - @type size: int - @param size:Specifies the maximum number of values that can be written into buffer. - @type type: Enumerated constant - @param type:Specifies a symbolic constant that describes the information that - will be returned for each vertex. - @type buffer: Buffer object I{GL_FLOAT} - @param buffer: Returns the feedback data. - """ - -def glFinish(): - """ - Block until all GL execution is complete - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/finish.html} - """ - -def glFlush(): - """ - Force Execution of GL commands in finite time - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/flush.html} - """ - -def glFog (pname, param): - """ - B{glFogf, glFogi, glFogfv, glFogiv} - - Specify fog parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/fog.html} - - @type pname: Enumerated constant - @param pname: Specifies a single-valued fog parameter. If the function prototype - ends in 'v' specifies a fog parameter. - @type param: Depends on function prototype. - @param param: Specifies the value or values to be assigned to pname. GL_FOG_COLOR - requires an array of four values. All other parameters accept an array containing - only a single value. - """ - -def glFrontFace(mode): - """ - Define front- and back-facing polygons - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frontface.html} - - @type mode: Enumerated constant - @param mode: Specifies the orientation of front-facing polygons. - """ - -def glFrustum(left, right, bottom, top, zNear, zFar): - """ - Multiply the current matrix by a perspective matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frustum.html} - - @type left, right: double (float) - @param left, right: Specify the coordinates for the left and right vertical - clipping planes. - @type top, bottom: double (float) - @param top, bottom: Specify the coordinates for the bottom and top horizontal - clipping planes. - @type zNear, zFar: double (float) - @param zNear, zFar: Specify the distances to the near and far depth clipping planes. - Both distances must be positive. - """ - -def glGenLists(range): - """ - Generate a contiguous set of empty display lists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/genlists.html} - - @type range: int - @param range: Specifies the number of contiguous empty display lists to be generated. - """ - -def glGenTextures(n, textures): - """ - Generate texture names - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gentextures.html} - - @type n: int - @param n: Specifies the number of textures name to be generated. - @type textures: Buffer object I{type GL_INT} - @param textures: Specifies an array in which the generated textures names are stored. - """ - -def glGet (pname, param): - """ - B{glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv} - - Return the value or values of a selected parameter - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html} - - @type pname: Enumerated constant - @param pname: Specifies the parameter value to be returned. - @type param: Depends on function prototype. - @param param: Returns the value or values of the specified parameter. - """ - -def glGetClipPlane(plane, equation): - """ - Return the coefficients of the specified clipping plane - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getclipplane.html} - - @type plane: Enumerated constant - @param plane: Specifies a clipping plane. The number of clipping planes depends on the - implementation, but at least six clipping planes are supported. They are identified by - symbolic names of the form GL_CLIP_PLANEi where 0 < i < GL_MAX_CLIP_PLANES. - @type equation: Buffer object I{type GL_FLOAT} - @param equation: Returns four float (double)-precision values that are the coefficients of the - plane equation of plane in eye coordinates. The initial value is (0, 0, 0, 0). - """ - -def glGetError(): - """ - Return error information - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html} - """ - -def glGetLight (light, pname, params): - """ - B{glGetLightfv and glGetLightiv} - - Return light source parameter values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getlight.html} - - @type light: Enumerated constant - @param light: Specifies a light source. The number of possible lights depends on the - implementation, but at least eight lights are supported. They are identified by symbolic - names of the form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. - @type pname: Enumerated constant - @param pname: Specifies a light source parameter for light. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetMap (target, query, v): - """ - B{glGetMapdv, glGetMapfv, glGetMapiv} - - Return evaluator parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmap.html} - - @type target: Enumerated constant - @param target: Specifies the symbolic name of a map. - @type query: Enumerated constant - @param query: Specifies which parameter to return. - @type v: Buffer object. Depends on function prototype. - @param v: Returns the requested data. - """ - -def glGetMaterial (face, pname, params): - """ - B{glGetMaterialfv, glGetMaterialiv} - - Return material parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmaterial.html} - - @type face: Enumerated constant - @param face: Specifies which of the two materials is being queried. - representing the front and back materials, respectively. - @type pname: Enumerated constant - @param pname: Specifies the material parameter to return. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetPixelMap (map, values): - """ - B{glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv} - - Return the specified pixel map - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpixelmap.html} - - @type map: Enumerated constant - @param map: Specifies the name of the pixel map to return. - @type values: Buffer object. Depends on function prototype. - @param values: Returns the pixel map contents. - """ - -def glGetPolygonStipple(mask): - """ - Return the polygon stipple pattern - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpolygonstipple.html} - - @type mask: Buffer object I{type GL_BYTE} - @param mask: Returns the stipple pattern. The initial value is all 1's. - """ - -def glGetString(name): - """ - Return a string describing the current GL connection - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getstring.html} - - @type name: Enumerated constant - @param name: Specifies a symbolic constant. - - """ - -def glGetTexEnv (target, pname, params): - """ - B{glGetTexEnvfv, glGetTexEnviv} - - Return texture environment parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexenv.html} - - @type target: Enumerated constant - @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a texture environment parameter. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetTexGen (coord, pname, params): - """ - B{glGetTexGendv, glGetTexGenfv, glGetTexGeniv} - - Return texture coordinate generation parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexgen.html} - - @type coord: Enumerated constant - @param coord: Specifies a texture coordinate. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the value(s) to be returned. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetTexImage(target, level, format, type, pixels): - """ - Return a texture image - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getteximage.html} - - @type target: Enumerated constant - @param target: Specifies which texture is to be obtained. - @type level: int - @param level: Specifies the level-of-detail number of the desired image. - Level 0 is the base image level. Level n is the nth mipmap reduction image. - @type format: Enumerated constant - @param format: Specifies a pixel format for the returned data. - @type type: Enumerated constant - @param type: Specifies a pixel type for the returned data. - @type pixels: Buffer object. - @param pixels: Returns the texture image. Should be a pointer to an array of the - type specified by type - """ - -def glGetTexLevelParameter (target, level, pname, params): - """ - B{glGetTexLevelParameterfv, glGetTexLevelParameteriv} - - return texture parameter values for a specific level of detail - @see: U{opengl.org/developers/documentation/man_pages/hardcopy/GL/html/gl/gettexlevelparameter.html} - - @type target: Enumerated constant - @param target: Specifies the symbolic name of the target texture. - @type level: int - @param level: Specifies the level-of-detail number of the desired image. - Level 0 is the base image level. Level n is the nth mipmap reduction image. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a texture parameter. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetTexParameter (target, pname, params): - """ - B{glGetTexParameterfv, glGetTexParameteriv} - - Return texture parameter values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexparameter.html} - - @type target: Enumerated constant - @param target: Specifies the symbolic name of the target texture. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name the target texture. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the texture parameters. - """ - -def glHint(target, mode): - """ - Specify implementation-specific hints - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/hint.html} - - @type target: Enumerated constant - @param target: Specifies a symbolic constant indicating the behavior to be - controlled. - @type mode: Enumerated constant - @param mode: Specifies a symbolic constant indicating the desired behavior. - """ - -def glIndex (c): - """ - B{glIndexd, glIndexf, glIndexi, glIndexs, glIndexdv, glIndexfv, glIndexiv, glIndexsv} - - Set the current color index - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/index_.html} - - @type c: Buffer object. Depends on function prototype. - @param c: Specifies a pointer to a one element array that contains the new value for - the current color index. - """ - -def glInitNames(): - """ - Initialize the name stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/initnames.html} - """ - -def glIsEnabled(cap): - """ - Test whether a capability is enabled - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/isenabled.html} - - @type cap: Enumerated constant - @param cap: Specifies a constant representing a GL capability. - """ - -def glIsList(list): - """ - Determine if a name corresponds to a display-list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/islist.html} - - @type list: unsigned int - @param list: Specifies a potential display-list name. - """ - -def glIsTexture(texture): - """ - Determine if a name corresponds to a texture - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/istexture.html} - - @type texture: unsigned int - @param texture: Specifies a value that may be the name of a texture. - """ - -def glLight (light, pname, param): - """ - B{glLightf,glLighti, glLightfv, glLightiv} - - Set the light source parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/light.html} - - @type light: Enumerated constant - @param light: Specifies a light. The number of lights depends on the implementation, - but at least eight lights are supported. They are identified by symbolic names of the - form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. - @type pname: Enumerated constant - @param pname: Specifies a single-valued light source parameter for light. - @type param: Depends on function prototype. - @param param: Specifies the value that parameter pname of light source light will be set to. - If function prototype ends in 'v' specifies a pointer to the value or values that - parameter pname of light source light will be set to. - """ - -def glLightModel (pname, param): - """ - B{glLightModelf, glLightModeli, glLightModelfv, glLightModeliv} - - Set the lighting model parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/lightmodel.html} - - @type pname: Enumerated constant - @param pname: Specifies a single-value light model parameter. - @type param: Depends on function prototype. - @param param: Specifies the value that param will be set to. If function prototype ends in 'v' - specifies a pointer to the value or values that param will be set to. - """ - -def glLineStipple(factor, pattern): - """ - Specify the line stipple pattern - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linestipple.html} - - @type factor: int - @param factor: Specifies a multiplier for each bit in the line stipple pattern. - If factor is 3, for example, each bit in the pattern is used three times before - the next bit in the pattern is used. factor is clamped to the range [1, 256] and - defaults to 1. - @type pattern: unsigned short int - @param pattern: Specifies a 16-bit integer whose bit pattern determines which fragments - of a line will be drawn when the line is rasterized. Bit zero is used first; the default - pattern is all 1's. - """ - -def glLineWidth(width): - """ - Specify the width of rasterized lines. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linewidth.html} - - @type width: float - @param width: Specifies the width of rasterized lines. The initial value is 1. - """ - -def glListBase(base): - """ - Set the display-list base for glCallLists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/listbase.html} - - @type base: unsigned int - @param base: Specifies an integer offset that will be added to glCallLists - offsets to generate display-list names. The initial value is 0. - """ - -def glLoadIdentity(): - """ - Replace the current matrix with the identity matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadidentity.html} - """ - -def glLoadMatrix (m): - """ - B{glLoadMatrixd, glLoadMatixf} - - Replace the current matrix with the specified matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadmatrix.html} - - @type m: Buffer object. Depends on function prototype. - @param m: Specifies a pointer to 16 consecutive values, which are used as the elements - of a 4x4 column-major matrix. - """ - -def glLoadName(name): - """ - Load a name onto the name stack. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadname.html} - - @type name: unsigned int - @param name: Specifies a name that will replace the top value on the name stack. - """ - -def glLogicOp(opcode): - """ - Specify a logical pixel operation for color index rendering - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/logicop.html} - - @type opcode: Enumerated constant - @param opcode: Specifies a symbolic constant that selects a logical operation. - """ - -def glMap1 (target, u1, u2, stride, order, points): - """ - B{glMap1d, glMap1f} - - Define a one-dimensional evaluator - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map1.html} - - @type target: Enumerated constant - @param target: Specifies the kind of values that are generated by the evaluator. - @type u1, u2: Depends on function prototype. - @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord1, to ^, t - he variable that is evaluated by the equations specified by this command. - @type stride: int - @param stride: Specifies the number of floats or float (double)s between the beginning - of one control point and the beginning of the next one in the data structure - referenced in points. This allows control points to be embedded in arbitrary data - structures. The only constraint is that the values for a particular control point must - occupy contiguous memory locations. - @type order: int - @param order: Specifies the number of control points. Must be positive. - @type points: Buffer object. Depends on function prototype. - @param points: Specifies a pointer to the array of control points. - """ - -def glMap2 (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points): - """ - B{glMap2d, glMap2f} - - Define a two-dimensional evaluator - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map2.html} - - @type target: Enumerated constant - @param target: Specifies the kind of values that are generated by the evaluator. - @type u1, u2: Depends on function prototype. - @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord2, to ^, t - he variable that is evaluated by the equations specified by this command. Initially - u1 is 0 and u2 is 1. - @type ustride: int - @param ustride: Specifies the number of floats or float (double)s between the beginning - of control point R and the beginning of control point R ij, where i and j are the u - and v control point indices, respectively. This allows control points to be embedded - in arbitrary data structures. The only constraint is that the values for a particular - control point must occupy contiguous memory locations. The initial value of ustride is 0. - @type uorder: int - @param uorder: Specifies the dimension of the control point array in the u axis. - Must be positive. The initial value is 1. - @type v1, v2: Depends on function prototype. - @param v1, v2: Specify a linear mapping of v, as presented to glEvalCoord2, to ^, - one of the two variables that are evaluated by the equations specified by this command. - Initially, v1 is 0 and v2 is 1. - @type vstride: int - @param vstride: Specifies the number of floats or float (double)s between the beginning of control - point R and the beginning of control point R ij, where i and j are the u and v control - point(indices, respectively. This allows control points to be embedded in arbitrary data - structures. The only constraint is that the values for a particular control point must - occupy contiguous memory locations. The initial value of vstride is 0. - @type vorder: int - @param vorder: Specifies the dimension of the control point array in the v axis. - Must be positive. The initial value is 1. - @type points: Buffer object. Depends on function prototype. - @param points: Specifies a pointer to the array of control points. - """ - -def glMapGrid (un, u1,u2 ,vn, v1, v2): - """ - B{glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f} - - Define a one- or two-dimensional mesh - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/mapgrid.html} - - @type un: int - @param un: Specifies the number of partitions in the grid range interval - [u1, u2]. Must be positive. - @type u1, u2: Depends on function prototype. - @param u1, u2: Specify the mappings for integer grid domain values i=0 and i=un. - @type vn: int - @param vn: Specifies the number of partitions in the grid range interval [v1, v2] - (glMapGrid2 only). - @type v1, v2: Depends on function prototype. - @param v1, v2: Specify the mappings for integer grid domain values j=0 and j=vn - (glMapGrid2 only). - """ - -def glMaterial (face, pname, params): - """ - Specify material parameters for the lighting model. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/material.html} - - @type face: Enumerated constant - @param face: Specifies which face or faces are being updated. Must be one of: - @type pname: Enumerated constant - @param pname: Specifies the single-valued material parameter of the face - or faces that is being updated. Must be GL_SHININESS. - @type params: int - @param params: Specifies the value that parameter GL_SHININESS will be set to. - If function prototype ends in 'v' specifies a pointer to the value or values that - pname will be set to. - """ - -def glMatrixMode(mode): - """ - Specify which matrix is the current matrix. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/matrixmode.html} - - @type mode: Enumerated constant - @param mode: Specifies which matrix stack is the target for subsequent matrix operations. - """ - -def glMultMatrix (m): - """ - B{glMultMatrixd, glMultMatrixf} - - Multiply the current matrix with the specified matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/multmatrix.html} - - @type m: Buffer object. Depends on function prototype. - @param m: Points to 16 consecutive values that are used as the elements of a 4x4 column - major matrix. - """ - -def glNewList(list, mode): - """ - Create or replace a display list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html} - - @type list: unsigned int - @param list: Specifies the display list name - @type mode: Enumerated constant - @param mode: Specifies the compilation mode. - """ - -def glNormal3 (nx, ny, nz, v): - """ - B{Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv, - Normal3s, Normal3sv} - - Set the current normal vector - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/normal.html} - - @type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only) - @param nx, ny, nz: Specify the x, y, and z coordinates of the new current normal. - The initial value of the current normal is the unit vector, (0, 0, 1). - @type v: Buffer object. Depends on function prototype. ('v' prototypes) - @param v: Specifies a pointer to an array of three elements: the x, y, and z coordinates - of the new current normal. - """ - -def glOrtho(left, right, bottom, top, zNear, zFar): - """ - Multiply the current matrix with an orthographic matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/ortho.html} - - @type left, right: double (float) - @param left, right: Specify the coordinates for the left and - right vertical clipping planes. - @type bottom, top: double (float) - @param bottom, top: Specify the coordinates for the bottom and top - horizontal clipping planes. - @type zNear, zFar: double (float) - @param zNear, zFar: Specify the distances to the nearer and farther - depth clipping planes. These values are negative if the plane is to be behind the viewer. - """ - -def glPassThrough(token): - """ - Place a marker in the feedback buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/passthrough.html} - - @type token: float - @param token: Specifies a marker value to be placed in the feedback - buffer following a GL_PASS_THROUGH_TOKEN. - """ - -def glPixelMap (map, mapsize, values): - """ - B{glPixelMapfv, glPixelMapuiv, glPixelMapusv} - - Set up pixel transfer maps - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelmap.html} - - @type map: Enumerated constant - @param map: Specifies a symbolic map name. - @type mapsize: int - @param mapsize: Specifies the size of the map being defined. - @type values: Buffer object. Depends on function prototype. - @param values: Specifies an array of mapsize values. - """ - -def glPixelStore (pname, param): - """ - B{glPixelStoref, glPixelStorei} - - Set pixel storage modes - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelstore.html} - - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the parameter to be set. - Six values affect the packing of pixel data into memory. - Six more affect the unpacking of pixel data from memory. - @type param: Depends on function prototype. - @param param: Specifies the value that pname is set to. - """ - -def glPixelTransfer (pname, param): - """ - B{glPixelTransferf, glPixelTransferi} - - Set pixel transfer modes - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixeltransfer.html} - - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the pixel transfer parameter to be set. - @type param: Depends on function prototype. - @param param: Specifies the value that pname is set to. - """ - -def glPixelZoom(xfactor, yfactor): - """ - Specify the pixel zoom factors - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelzoom.html} - - @type xfactor, yfactor: float - @param xfactor, yfactor: Specify the x and y zoom factors for pixel write operations. - """ - -def glPointSize(size): - """ - Specify the diameter of rasterized points - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pointsize.html} - - @type size: float - @param size: Specifies the diameter of rasterized points. The initial value is 1. - """ - -def glPolygonMode(face, mode): - """ - Select a polygon rasterization mode - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonmode.html} - - @type face: Enumerated constant - @param face: Specifies the polygons that mode applies to. - Must be GL_FRONT for front-facing polygons, GL_BACK for back- facing polygons, - or GL_FRONT_AND_BACK for front- and back-facing polygons. - @type mode: Enumerated constant - @param mode: Specifies how polygons will be rasterized. - The initial value is GL_FILL for both front- and back- facing polygons. - """ - -def glPolygonOffset(factor, units): - """ - Set the scale and units used to calculate depth values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonoffset.html} - - @type factor: float - @param factor: Specifies a scale factor that is used to create a variable depth - offset for each polygon. The initial value is 0. - @type units: float - @param units: Is multiplied by an implementation-specific value to create a constant - depth offset. The initial value is 0. - """ - -def glPolygonStipple(mask): - """ - Set the polygon stippling pattern - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonstipple.html} - - @type mask: Buffer object I{type GL_BYTE} - @param mask: Specifies a pointer to a 32x32 stipple pattern that will be unpacked - from memory in the same way that glDrawPixels unpacks pixels. - """ - -def glPopAttrib(): - """ - Pop the server attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html} - """ - -def glPopClientAttrib(): - """ - Pop the client attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html} - """ - -def glPopMatrix(): - """ - Pop the current matrix stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html} - """ - -def glPopName(): - """ - Pop the name stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html} - """ - -def glPrioritizeTextures(n, textures, priorities): - """ - Set texture residence priority - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/prioritizetextures.html} - - @type n: int - @param n:Specifies the number of textures to be prioritized. - @type textures: Buffer I{type GL_INT} - @param textures: Specifies an array containing the names of the textures to be prioritized. - @type priorities: Buffer I{type GL_FLOAT} - @param priorities: Specifies an array containing the texture priorities. A priority given - in an element of priorities applies to the texture named by the corresponding element of textures. - """ - -def glPushAttrib(mask): - """ - Push the server attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html} - - @type mask: Enumerated constant(s) - @param mask: Specifies a mask that indicates which attributes to save. - """ - -def glPushClientAttrib(mask): - """ - Push the client attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html} - - @type mask: Enumerated constant(s) - @param mask: Specifies a mask that indicates which attributes to save. - """ - -def glPushMatrix(): - """ - Push the current matrix stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html} - """ - -def glPushName(name): - """ - Push the name stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html} - - @type name: unsigned int - @param name: Specifies a name that will be pushed onto the name stack. - """ - -def glRasterPos (x,y,z,w): - """ - B{glRasterPos2d, glRasterPos2f, glRasterPos2i, glRasterPos2s, glRasterPos3d, - glRasterPos3f, glRasterPos3i, glRasterPos3s, glRasterPos4d, glRasterPos4f, - glRasterPos4i, glRasterPos4s, glRasterPos2dv, glRasterPos2fv, glRasterPos2iv, - glRasterPos2sv, glRasterPos3dv, glRasterPos3fv, glRasterPos3iv, glRasterPos3sv, - glRasterPos4dv, glRasterPos4fv, glRasterPos4iv, glRasterPos4sv} - - Specify the raster position for pixel operations - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html} - - @type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only) - @param x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the - raster position. If function prototype ends in 'v' specifies a pointer to an array of two, - three, or four elements, specifying x, y, z, and w coordinates, respectively. - @note: - If you are drawing to the 3d view with a Scriptlink of a space handler - the zoom level of the panels will scale the glRasterPos by the view matrix. - so a X of 10 will not always offset 10 pixels as you would expect. - - To work around this get the scale value of the view matrix and use it to scale your pixel values. - - Workaround:: - - import Blender - from Blender.BGL import * - xval, yval= 100, 40 - # Get the scale of the view matrix - viewMatrix = Buffer(GL_FLOAT, 16) - glGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix) - f = 1/viewMatrix[0] - glRasterPos2f(xval*f, yval*f) # Instead of the usual glRasterPos2i(xval, yval) - """ - -def glReadBuffer(mode): - """ - Select a color buffer source for pixels. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readbuffer.html} - - @type mode: Enumerated constant - @param mode: Specifies a color buffer. - """ - -def glReadPixels(x, y, width, height, format, type, pixels): - """ - Read a block of pixels from the frame buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html} - - @type x, y: int - @param x, y:Specify the window coordinates of the first pixel that is read - from the frame buffer. This location is the lower left corner of a rectangular - block of pixels. - @type width, height: int - @param width, height: Specify the dimensions of the pixel rectangle. width and - height of one correspond to a single pixel. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type of the pixel data. - @type pixels: Buffer object - @param pixels: Returns the pixel data. - """ - -def glRect (x1,y1,x2,y2,v1,v2): - """ - B{glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv} - - Draw a rectangle - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rect.html} - - @type x1, y1: Depends on function prototype. (for non 'v' prototypes only) - @param x1, y1: Specify one vertex of a rectangle - @type x2, y2: Depends on function prototype. (for non 'v' prototypes only) - @param x2, y2: Specify the opposite vertex of the rectangle - @type v1, v2: Depends on function prototype. (for 'v' prototypes only) - @param v1, v2: Specifies a pointer to one vertex of a rectangle and the pointer - to the opposite vertex of the rectangle - """ - -def glRenderMode(mode): - """ - Set rasterization mode - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rendermode.html} - - @type mode: Enumerated constant - @param mode: Specifies the rasterization mode. - """ - -def glRotate (angle, x, y, z): - """ - B{glRotated, glRotatef} - - Multiply the current matrix by a rotation matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html} - - @type angle: Depends on function prototype. - @param angle: Specifies the angle of rotation in degrees. - @type x, y, z: Depends on function prototype. - @param x, y, z: Specify the x, y, and z coordinates of a vector respectively. - """ - -def glScale (x,y,z): - """ - B{glScaled, glScalef} - - Multiply the current matrix by a general scaling matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html} - - @type x, y, z: Depends on function prototype. - @param x, y, z: Specify scale factors along the x, y, and z axes, respectively. - """ - -def glScissor(x,y,width,height): - """ - Define the scissor box - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html} - - @type x, y: int - @param x, y: Specify the lower left corner of the scissor box. Initially (0, 0). - @type width, height: int - @param width height: Specify the width and height of the scissor box. When a - GL context is first attached to a window, width and height are set to the - dimensions of that window. - """ - -def glSelectBuffer(size, buffer): - """ - Establish a buffer for selection mode values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/selectbuffer.html} - - @type size: int - @param size: Specifies the size of buffer - @type buffer: Buffer I{type GL_INT} - @param buffer: Returns the selection data - """ - -def glShadeModel(mode): - """ - Select flat or smooth shading - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/shademodel.html} - - @type mode: Enumerated constant - @param mode: Specifies a symbolic value representing a shading technique. - """ - -def glStencilFuc(func, ref, mask): - """ - Set function and reference value for stencil testing - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilfunc.html} - - @type func: Enumerated constant - @param func:Specifies the test function. - @type ref: int - @param ref:Specifies the reference value for the stencil test. ref is clamped to - the range [0,2n-1], where n is the number of bitplanes in the stencil buffer. - The initial value is 0. - @type mask: unsigned int - @param mask:Specifies a mask that is ANDed with both the reference value and - the stored stencil value when the test is done. The initial value is all 1's. - """ - -def glStencilMask(mask): - """ - Control the writing of individual bits in the stencil planes - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilmask.html} - - @type mask: unsigned int - @param mask: Specifies a bit mask to enable and disable writing of individual bits - in the stencil planes. Initially, the mask is all 1's. - """ - -def glStencilOp(fail, zfail, zpass): - """ - Set stencil test actions - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilop.html} - - @type fail: Enumerated constant - @param fail: Specifies the action to take when the stencil test fails. - The initial value is GL_KEEP. - @type zfail: Enumerated constant - @param zfail: Specifies the stencil action when the stencil test passes, but the - depth test fails. zfail accepts the same symbolic constants as fail. - The initial value is GL_KEEP. - @type zpass: Enumerated constant - @param zpass: Specifies the stencil action when both the stencil test and the - depth test pass, or when the stencil test passes and either there is no depth - buffer or depth testing is not enabled. zpass accepts the same symbolic constants - as fail. The initial value is GL_KEEP. - """ - -def glTexCoord (s,t,r,q,v): - """ - B{glTexCoord1d, glTexCoord1f, glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2f, - glTexCoord2i, glTexCoord2s, glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s, - glTexCoord4d, glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv, - glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2fv, glTexCoord2iv, - glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv, glTexCoord3sv, - glTexCoord4dv, glTexCoord4fv, glTexCoord4iv, glTexCoord4sv} - - Set the current texture coordinates - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html} - - @type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only) - @param s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are - present in all forms of the command. - @type v: Buffer object. Depends on function prototype. (for 'v' prototypes only) - @param v: Specifies a pointer to an array of one, two, three, or four elements, - which in turn specify the s, t, r, and q texture coordinates. - """ - -def glTexEnv (target, pname, param): - """ - B{glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv} - - Set texture environment parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texenv.html} - - @type target: Enumerated constant - @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a single-valued texture environment - parameter. Must be GL_TEXTURE_ENV_MODE. - @type param: Depends on function prototype. - @param param: Specifies a single symbolic constant. If function prototype ends in 'v' - specifies a pointer to a parameter array that contains either a single symbolic - constant or an RGBA color - """ - -def glTexGen (coord, pname, param): - """ - B{glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv} - - Control the generation of texture coordinates - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texgen.html} - - @type coord: Enumerated constant - @param coord: Specifies a texture coordinate. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the texture- coordinate generation function. - @type param: Depends on function prototype. - @param param: Specifies a single-valued texture generation parameter. - If function prototype ends in 'v' specifies a pointer to an array of texture - generation parameters. If pname is GL_TEXTURE_GEN_MODE, then the array must - contain a single symbolic constant. Otherwise, params holds the coefficients - for the texture-coordinate generation function specified by pname. - """ - -def glTexImage1D(target, level, internalformat, width, border, format, type, pixels): - """ - Specify a one-dimensional texture image - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage1d.html} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type level: int - @param level: Specifies the level-of-detail number. Level 0 is the base image level. - Level n is the nth mipmap reduction image. - @type internalformat: int - @param internalformat: Specifies the number of color components in the texture. - @type width: int - @param width: Specifies the width of the texture image. Must be 2n+2(border) for - some integer n. All implementations support texture images that are at least 64 - texels wide. The height of the 1D texture image is 1. - @type border: int - @param border: Specifies the width of the border. Must be either 0 or 1. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type of the pixel data. - @type pixels: Buffer object. - @param pixels: Specifies a pointer to the image data in memory. - """ - -def glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels): - """ - Specify a two-dimensional texture image - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type level: int - @param level: Specifies the level-of-detail number. Level 0 is the base image level. - Level n is the nth mipmap reduction image. - @type internalformat: int - @param internalformat: Specifies the number of color components in the texture. - @type width: int - @param width: Specifies the width of the texture image. Must be 2n+2(border) for - some integer n. All implementations support texture images that are at least 64 - texels wide. - @type height: int - @param height: Specifies the height of the texture image. Must be 2m+2(border) for - some integer m. All implementations support texture images that are at least 64 - texels high. - @type border: int - @param border: Specifies the width of the border. Must be either 0 or 1. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type of the pixel data. - @type pixels: Buffer object. - @param pixels: Specifies a pointer to the image data in memory. - """ - -def glTexParameter (target, pname, param): - """ - B{glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv} - - Set texture parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texparameter.html} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a single-valued texture parameter. - @type param: Depends on function prototype. - @param param: Specifies the value of pname. If function prototype ends in 'v' specifies - a pointer to an array where the value or values of pname are stored. - """ - -def glTranslate (x, y, z): - """ - B{glTranslatef, glTranslated} - - Multiply the current matrix by a translation matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html} - - @type x, y, z: Depends on function prototype. - @param x, y, z: Specify the x, y, and z coordinates of a translation vector. - """ - -def glVertex (x,y,z,w,v): - """ - B{glVertex2d, glVertex2f, glVertex2i, glVertex2s, glVertex3d, glVertex3f, glVertex3i, - glVertex3s, glVertex4d, glVertex4f, glVertex4i, glVertex4s, glVertex2dv, glVertex2fv, - glVertex2iv, glVertex2sv, glVertex3dv, glVertex3fv, glVertex3iv, glVertex3sv, glVertex4dv, - glVertex4fv, glVertex4iv, glVertex4sv} - - Specify a vertex - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html} - - @type x, y, z, w: Depends on function prototype (z and w for '3' and '4' prototypes only) - @param x, y, z, w: Specify x, y, z, and w coordinates of a vertex. Not all parameters - are present in all forms of the command. - @type v: Buffer object. Depends of function prototype (for 'v' prototypes only) - @param v: Specifies a pointer to an array of two, three, or four elements. The - elements of a two-element array are x and y; of a three-element array, x, y, and z; - and of a four-element array, x, y, z, and w. - """ - -def glViewport(x,y,width,height): - """ - Set the viewport - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html} - - @type x, y: int - @param x, y: Specify the lower left corner of the viewport rectangle, - in pixels. The initial value is (0,0). - @type width, height: int - @param width, height: Specify the width and height of the viewport. When a GL context - is first attached to a window, width and height are set to the dimensions of that window. - """ - -def gluPerspective(fovY, aspect, zNear, zFar): - """ - Set up a perspective projection matrix. - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5577288} - - @type fovY: double - @param fovY: Specifies the field of view angle, in degrees, in the y direction. - @type aspect: double - @param aspect: Specifies the aspect ratio that determines the field of view in the x direction. - The aspect ratio is the ratio of x (width) to y (height). - @type zNear: double - @param zNear: Specifies the distance from the viewer to the near clipping plane (always positive). - @type zFar: double - @param zFar: Specifies the distance from the viewer to the far clipping plane (always positive). - """ - -def gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz): - """ - Define a viewing transformation - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5573042} - - @type eyex, eyey, eyez: double - @param eyex, eyey, eyez: Specifies the position of the eye point. - @type centerx, centery, centerz: double - @param centerx, centery, centerz: Specifies the position of the reference point. - @type upx, upy, upz: double - @param upx, upy, upz: Specifies the direction of the up vector. - """ - -def gluOrtho2D(left, right, bottom, top): - """ - Define a 2-D orthographic projection matrix - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} - - @type left, right: double - @param left, right: Specify the coordinates for the left and right vertical clipping planes. - @type bottom, top: double - @param bottom, top: Specify the coordinates for the bottom and top horizontal clipping planes. - """ - -def gluPickMatrix(x, y, width, height, viewport): - """ - Define a picking region - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} - - @type x, y: double - @param x, y: Specify the center of a picking region in window coordinates. - @type width, height: double - @param width, height: Specify the width and height, respectively, of the picking region in window coordinates. - @type viewport: Buffer object. [int] - @param viewport: Specifies the current viewport. - """ - -def gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz): - """ - Map object coordinates to window coordinates. - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} - - @type objx, objy, objz: double - @param objx, objy, objz: Specify the object coordinates. - @type modelMatrix: Buffer object. [double] - @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). - @type projMatrix: Buffer object. [double] - @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). - @type viewport: Buffer object. [int] - @param viewport: Specifies the current viewport (as from a glGetIntegerv call). - @type winx, winy, winz: Buffer object. [double] - @param winx, winy, winz: Return the computed window coordinates. - """ - -def gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, objx, objy, objz): - """ - Map object coordinates to window - coordinates. - @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5582204} - - @type winx, winy, winz: double - @param winx, winy, winz: Specify the window coordinates to be mapped. - @type modelMatrix: Buffer object. [double] - @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). - @type projMatrix: Buffer object. [double] - @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). - @type viewport: Buffer object. [int] - @param viewport: Specifies the current viewport (as from a glGetIntegerv call). - @type objx, objy, objz: Buffer object. [double] - @param objx, objy, objz: Return the computed object coordinates. - """ - -class Buffer: - """ - The Buffer object is simply a block of memory that is delineated and initialized by the - user. Many OpenGL functions return data to a C-style pointer, however, because this - is not possible in python the Buffer object can be used to this end. Wherever pointer - notation is used in the OpenGL functions the Buffer object can be used in it's BGL - wrapper. In some instances the Buffer object will need to be initialized with the template - parameter, while in other instances the user will want to create just a blank buffer - which will be zeroed by default. - - Example with Buffer:: - import Blender - from Blender import BGL - myByteBuffer = BGL.Buffer(BGL.GL_BYTE, [32,32]) - BGL.glGetPolygonStipple(myByteBuffer) - print myByteBuffer.dimensions - print myByteBuffer.list - sliceBuffer = myByteBuffer[0:16] - print sliceBuffer - - @ivar list: The contents of the Buffer. - @ivar dimensions: The size of the Buffer. - """ - - def __init__(type, dimensions, template = None): - """ - This will create a new Buffer object for use with other BGL OpenGL commands. - Only the type of argument to store in the buffer and the dimensions of the buffer - are necessary. Buffers are zeroed by default unless a template is supplied, in - which case the buffer is initialized to the template. - - @type type: int - @param type: The format to store data in. The type should be one of - GL_BYTE, GL_SHORT, GL_INT, or GL_FLOAT. - @type dimensions: An int or sequence object specifying the dimensions of the buffer. - @param dimensions: If the dimensions are specified as an int a linear array will - be created for the buffer. If a sequence is passed for the dimensions, the buffer - becomes n-Dimensional, where n is equal to the number of parameters passed in the - sequence. Example: [256,2] is a two- dimensional buffer while [256,256,4] creates - a three- dimensional buffer. You can think of each additional dimension as a sub-item - of the dimension to the left. i.e. [10,2] is a 10 element array each with 2 sub-items. - [(0,0), (0,1), (1,0), (1,1), (2,0), ...] etc. - @type template: A python sequence object (optional) - @param template: A sequence of matching dimensions which will be used to initialize - the Buffer. If a template is not passed in all fields will be initialized to 0. - @rtype: Buffer object - @return: The newly created buffer as a PyObject. - """ diff --git a/doc/python_api/examples/bge.texture.1.py b/doc/python_api/examples/bge.texture.1.py new file mode 100644 index 00000000000..5b387c8659c --- /dev/null +++ b/doc/python_api/examples/bge.texture.1.py @@ -0,0 +1,38 @@ +""" +Texture replacement +++++++++++++++++++++++ +Example of how to replace a texture in game with an external image. +createTexture() and removeTexture() are to be called from a module Python +Controller. +""" +import bge +from bge import logic +from bge import texture + +def createTexture(cont): + """Create a new Dynamic Texture""" + object = cont.owner + + # get the reference pointer (ID) of the internal texture + ID = VT.materialID(obj, 'IMoriginal.png') + + # create a texture object + object_texture = texture.Texture(object, ID) + + # create a new source with an external image + url = logic.expandPath("//newtexture.jpg") + new_source = texture.ImageFFmpeg(url) + + # the texture has to be stored in a permanent Python object + logic.texture = object_texture + + # update/replace the texture + logic.texture.source = new_source + logic.texture.refresh(False) + +def removeTexture(cont): + """Delete the Dynamic Texture, reversing back the final to its original state.""" + try: + del logic.texture + except: + pass diff --git a/doc/python_api/examples/bge.texture.py b/doc/python_api/examples/bge.texture.py new file mode 100644 index 00000000000..b27c357b1ee --- /dev/null +++ b/doc/python_api/examples/bge.texture.py @@ -0,0 +1,32 @@ +""" +Basic Video Playback +++++++++++++++++++++++ +Example of how to replace a texture in game with a video. It needs to run everyframe +""" +import bge +from bge import texture +from bge import logic + +cont = logic.getCurrentController() +obj = cont.owner + +# the creation of the texture must be done once: save the +# texture object in an attribute of bge.logic module makes it persistent +if not hasattr(logic, 'video'): + + # identify a static texture by name + matID = texture.materialID(obj, 'IMvideo.png') + + # create a dynamic texture that will replace the static texture + logic.video = texture.Texture(obj, matID) + + # define a source of image for the texture, here a movie + movie = logic.expandPath('//trailer_400p.ogg') + logic.video.source = texture.VideoFFmpeg(movie) + logic.video.source.scale = True + + # quick off the movie, but it wont play in the background + logic.video.source.play() + +# you need to call this function every frame to ensure update of the texture. +logic.video.refresh(True)
\ No newline at end of file diff --git a/doc/python_api/examples/blf.py b/doc/python_api/examples/blf.py new file mode 100644 index 00000000000..c91b41bec36 --- /dev/null +++ b/doc/python_api/examples/blf.py @@ -0,0 +1,42 @@ +""" +Hello World Text Example +++++++++++++++++++++++++ +Blender Game Engine example of using the blf module. For this module to work we +need to use the OpenGL wrapper :class:`~bgl` as well. +""" +# import game engine modules +import bge +from bge import render +from bge import logic +# import stand alone modules +import bgl +import blf + +def init(): + """init function - runs once""" + # create a new font object, use external ttf file + font_path = logic.expandPath('//Zeyada.ttf') + # store the font indice - to use later + logic.font_id = blf.load(font_path) + + # set the font drawing routine to run every frame + scene = logic.getCurrentScene() + scene.post_draw=[write] + +def write(): + """write on screen""" + width = render.getWindowWidth() + height = render.getWindowHeight() + + # OpenGL setup + bgl.glMatrixMode(bgl.GL_PROJECTION) + bgl.glLoadIdentity() + bgl.gluOrtho2D(0, width, 0, height) + bgl.glMatrixMode(bgl.GL_MODELVIEW) + bgl.glLoadIdentity() + + # BLF drawing routine + font_id = logic.font_id + blf.position(font_id, (width*0.2), (height*0.3), 0) + blf.size(font_id, 50, 72) + blf.draw(font_id, "Hello World") diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst index 0af4a1184d6..f7163ea928e 100644 --- a/doc/python_api/rst/bge.logic.rst +++ b/doc/python_api/rst/bge.logic.rst @@ -17,7 +17,7 @@ Module to access logic functions, imported automatically into the python control # To get the game object this controller is on: obj = cont.owner -:class:`~bge.types.KX_GameObject` and :class:`~bge.types.KX_Camera` or :class:`bge.types.~KX_LightObject` methods are available depending on the type of object +:class:`~bge.types.KX_GameObject` and :class:`~bge.types.KX_Camera` or :class:`~bge.types.KX_LightObject` methods are available depending on the type of object .. code-block:: python diff --git a/doc/python_api/rst/bge.texture.rst b/doc/python_api/rst/bge.texture.rst new file mode 100644 index 00000000000..49016d1e03d --- /dev/null +++ b/doc/python_api/rst/bge.texture.rst @@ -0,0 +1,451 @@ + +Game Engine bge.texture Module +============================== + +.. note:: + This documentation is still very weak, and needs some help! Right now they are mostly a collection + of the docstrings found in the bge.texture source code + some random places filled with text. + +***** +Intro +***** + +The bge.texture module allows you to manipulate textures during the game. + +Several sources for texture are possible: video files, image files, video capture, memory buffer, camera render or a mix of that. + +The video and image files can be loaded from the internet using an URL instead of a file name. + +In addition, you can apply filters on the images before sending them to the GPU, allowing video effect: blue screen, color band, gray, normal map. + +bge.texture uses FFmpeg to load images and videos. All the formats and codecs that FFmpeg supports are supported by this module, including but not limited to:: + + * AVI + * Ogg + * Xvid + * Theora + * dv1394 camera + * video4linux capture card (this includes many webcams) + * videoForWindows capture card (this includes many webcams) + * JPG + +The principle is simple: first you identify a texture on an existing object using +the :materialID: function, then you create a new texture with dynamic content +and swap the two textures in the GPU. + +The GE is not aware of the substitution and continues to display the object as always, +except that you are now in control of the texture. + +When the texture object is deleted, the new texture is deleted and the old texture restored. + +.. module:: bge.texture + +.. class:: VideoFFmpeg(file [, capture=-1, rate=25.0, width=0, height=0]) + + FFmpeg video source + + .. attribute:: status + video status + + .. attribute:: range + replay range + + .. attribute:: repeat + repeat count, -1 for infinite repeat + + :type: int + + .. attribute:: framerate + frame rate + + :type: float + + .. attribute:: valid + Tells if an image is available + + :type: bool + + .. attribute:: image + image data + + .. attribute:: size + image size + + .. attribute:: scale + fast scale of image (near neighbour) + + .. attribute:: flip + flip image vertically + + .. attribute:: filter + pixel filter + + .. attribute:: preseek + number of frames of preseek + + :type: int + + .. attribute:: deinterlace + deinterlace image + + :type: bool + + .. method:: play() + Play (restart) video + + .. method:: pause() + pause video + + .. method:: stop() + stop video (play will replay it from start) + + .. method:: refresh() + Refresh video - get its status + +.. class:: ImageFFmpeg(file) + + FFmpeg image source + + .. attribute:: status + video status + + .. attribute:: valid + Tells if an image is available + + :type: bool + + .. attribute:: image + image data + + .. attribute:: size + image size + + .. attribute:: scale + fast scale of image (near neighbour) + + .. attribute:: flip + flip image vertically + + .. attribute:: filter + pixel filter + + .. method:: refresh() + Refresh image, i.e. load it + + .. method:: reload([newname]) + Reload image, i.e. reopen it + +.. class:: ImageBuff() + + Image source from image buffer + + .. attribute:: filter + pixel filter + + .. attribute:: flip + flip image vertically + + .. attribute:: image + image data + + .. method:: load(imageBuffer, width, height) + Load image from buffer + + .. method:: plot(imageBuffer, width, height, positionX, positionY) + update image buffer + + .. attribute:: scale + fast scale of image (near neighbour) + + .. attribute:: size + image size + + .. attribute:: valid + bool to tell if an image is available + +.. class:: ImageMirror(scene) + + Image source from mirror + + .. attribute:: alpha + use alpha in texture + + .. attribute:: background + background color + + .. attribute:: capsize + size of render area + + .. attribute:: clip + clipping distance + + .. attribute:: filter + pixel filter + + .. attribute:: flip + flip image vertically + + .. attribute:: image + image data + + .. method:: refresh(imageMirror) + Refresh image - invalidate its current content + + .. attribute:: scale + fast scale of image (near neighbour) + + .. attribute:: size + image size + + .. attribute:: valid + bool to tell if an image is available + + .. attribute:: whole + use whole viewport to render + +.. class:: ImageMix() + + Image mixer + + .. attribute:: filter + pixel filter + + .. attribute:: flip + flip image vertically + + .. method:: getSource(imageMix) + get image source + + .. method:: getWeight(imageMix) + get image source weight + + .. attribute:: image + image data + + .. method:: refresh(imageMix) + Refresh image - invalidate its current content + + .. attribute:: scale + fast scale of image (near neighbour) + + .. method:: setSource(imageMix) + set image source + + .. method:: setWeight(imageMix) + set image source weight + + .. attribute:: valid + bool to tell if an image is available + +.. class:: ImageRender(scene, camera) + + Image source from render + + .. attribute:: alpha + use alpha in texture + + .. attribute:: background + background color + + .. attribute:: capsize + size of render area + + .. attribute:: filter + pixel filter + + .. attribute:: flip + flip image vertically + + .. attribute:: image + image data + + .. method:: refresh(imageRender) + Refresh image - invalidate its current content + + .. attribute:: scale + fast scale of image (near neighbour) + + .. attribute:: size + image size + + .. attribute:: valid + bool to tell if an image is available + + .. attribute:: whole + use whole viewport to render + +.. class:: ImageViewport() + + Image source from viewport + + .. attribute:: alpha + use alpha in texture + + .. attribute:: capsize + size of viewport area being captured + + .. attribute:: filter + pixel filter + + .. attribute:: flip + flip image vertically + + .. attribute:: image + image data + + .. attribute:: position + upper left corner of captured area + + .. method:: refresh(imageViewport) + Refresh image - invalidate its current content + + .. attribute:: scale + fast scale of image (near neighbour) + + .. attribute:: size + image size + + .. attribute:: valid + bool to tell if an image is available + + .. attribute:: whole + use whole viewport to capture + +.. class:: Texture(gameObj) + + Texture objects + + .. attribute:: bindId + OpenGL Bind Name + + .. method:: close(texture) + Close dynamic texture and restore original + + .. attribute:: mipmap + mipmap texture + + .. method:: refresh(texture) + Refresh texture from source + + .. attribute:: source + source of texture + +.. class:: FilterBGR24() + + Source filter BGR24 objects + +.. class:: FilterBlueScreen() + + Filter for Blue Screen objects + + .. attribute:: color + blue screen color + + .. attribute:: limits + blue screen color limits + + .. attribute:: previous + previous pixel filter + +.. class:: FilterColor() + + Filter for color calculations + + .. attribute:: matrix + matrix [4][5] for color calculation + + .. attribute:: previous + previous pixel filter + +.. class:: FilterGray() + + Filter for gray scale effect + + .. attribute:: previous + previous pixel filter + +.. class:: FilterLevel() + + Filter for levels calculations + + .. attribute:: levels + levels matrix [4] (min, max) + + .. attribute:: previous + previous pixel filter + +.. class:: FilterNormal() + + Filter for Blue Screen objects + + .. attribute:: colorIdx + index of color used to calculate normal (0 - red, 1 - green, 2 - blue) + + .. attribute:: depth + depth of relief + + .. attribute:: previous + previous pixel filter + +.. class:: FilterRGB24() + + Returns a new input filter object to be used with :class:'ImageBuff' object when the image passed + to the ImageBuff.load() function has the 3-bytes pixel format BGR. + +.. class:: FilterRGBA32() + + Source filter RGBA32 objects + +.. function:: getLastError() + Last error that occurred in a bge.texture function. + + :return: the description of the last error occurred in a bge.texture function. + :rtype: string + +.. function:: imageToArray(image,mode) + Returns a :class:`~bgl.buffer` corresponding to the current image stored in a texture source object. + + :arg image: Image source object. + :type image: object of type :class:'VideoFFmpeg', :class:'ImageFFmpeg', :class:'ImageBuff', :class:'ImageMix', :class:'ImageRender', :class:'ImageMirror' or :class:'ImageViewport' + :arg mode: optional argument representing the pixel format. +| You can use the characters R, G, B for the 3 color channels, A for the alpha channel, +| 0 to force a fixed 0 color channel and 1 to force a fixed 255 color channel. +| Example: "BGR" will return 3 bytes per pixel with the Blue, Green and Red channels in that order. +| "RGB1" will return 4 bytes per pixel with the Red, Green, Blue channels in that order and the alpha channel forced to 255. +| The default mode is "RGBA". + + :type mode: string + :rtype: :class:`~bgl.buffer` + :return: A object representing the image as one dimensional array of bytes of size (pixel_size*width*height), + line by line starting from the bottom of the image. The pixel size and format is determined by the mode + parameter. + +.. function materialID(object,name) + Returns a numeric value that can be used in :class:'Texture' to create a dynamic texture. + + The value corresponds to an internal material number that uses the texture identified + by name. name is a string representing a texture name with IM prefix if you want to + identify the texture directly. This method works for basic tex face and for material, + provided the material has a texture channel using that particular texture in first + position of the texture stack. name can also have MA prefix if you want to identify + the texture by material. In that case the material must have a texture channel in first + position. + + If the object has no material that matches name, it generates a runtime error. Use try/except to catch the exception. + + Ex: bge.texture.materialID(obj, 'IMvideo.png') + + :arg object: the game object that uses the texture you want to make dynamic + :type object: game object + :arg name: name of the texture/material you want to make dynamic. + :type name: string + :rtype: integer + +.. function setLogFile(filename) + Sets the name of a text file in which runtime error messages will be written, in addition to the printing + of the messages on the Python console. Only the runtime errors specific to the VideoTexture module + are written in that file, ordinary runtime time errors are not written. + + :arg filename: name of error log file + :type filename: string + :rtype: integer diff --git a/doc/python_api/rst/bgl.rst b/doc/python_api/rst/bgl.rst new file mode 100644 index 00000000000..743f1c33e27 --- /dev/null +++ b/doc/python_api/rst/bgl.rst @@ -0,0 +1,1888 @@ + +bgl module (OpenGL wrapper) +=========================== + +.. module:: bgl + +This module wraps OpenGL constants and functions, making them available from +within Blender Python. + +The complete list can be retrieved from the module itself, by listing its +contents: dir(bgl). A simple search on the net can point to more +than enough material to teach OpenGL programming, from books to many +collections of tutorials. + +The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning +OpenGL}" and the online NeHe tutorials are two of the best resources. + +..note:: + You can use the :class:`Image` type to load and set textures. + See :class:`Image.gl_load` and :class:`Image.gl_load`, + for example. + `OpenGL.org <http://www.opengl.org>`_ + `NeHe GameDev <nehe.gamedev.net>`_ + + +.. function:: glAccum(op, value): + + Operate on the accumulation buffer. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/accum.html>`_ + + :type op: Enumerated constant + :arg op: The accumulation buffer operation. + :type value: float + :arg value: a value used in the accumulation buffer operation. + + +.. function:: glAlphaFunc(func, ref): + + Specify the alpha test function. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/alphafunc.html>`_ + + :type func: Enumerated constant + :arg func: Specifies the alpha comparison function. + :type ref: float + :arg ref: The reference value that incoming alpha values are compared to. + Clamped between 0 and 1. + + +.. function:: glAreTexturesResident(n, textures, residences): + + Determine if textures are loaded in texture memory + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/aretexturesresident.html>`_ + + :type n: int + :arg n: Specifies the number of textures to be queried. + :type textures: :class:`Buffer` object I{type GL_INT} + :arg textures: Specifies an array containing the names of the textures to be queried + :type residences: :class:`Buffer` object I{type GL_INT}(boolean) + :arg residences: An array in which the texture residence status in returned. + The residence status of a texture named by an element of textures is + returned in the corresponding element of residences. + + +.. function:: glBegin(mode): + + Delimit the vertices of a primitive or a group of like primatives + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies the primitive that will be create from vertices between glBegin and + glEnd. + + +.. function:: glBindTexture(target, texture): + + Bind a named texture to a texturing target + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bindtexture.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the target to which the texture is bound. + :type texture: unsigned int + :arg texture: Specifies the name of a texture. + + +.. function:: glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap): + + Draw a bitmap + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bitmap.html>`_ + + :type width, height: int + :arg width, height: Specify the pixel width and height of the bitmap image. + :type xorig, yorig: float + :arg xorig, yorig: Specify the location of the origin in the bitmap image. The origin is measured + from the lower left corner of the bitmap, with right and up being the positive axes. + :type xmove, ymove: float + :arg xmove, ymove: Specify the x and y offsets to be added to the current raster position after + the bitmap is drawn. + :type bitmap: :class:`Buffer` object I{type GL_BYTE} + :arg bitmap: Specifies the address of the bitmap image. + + +.. function:: glBlendFunc(sfactor, dfactor): + + Specify pixel arithmetic + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/blendfunc.html>`_ + + :type sfactor: Enumerated constant + :arg sfactor: Specifies how the red, green, blue, and alpha source blending factors are + computed. + :type dfactor: Enumerated constant + :arg dfactor: Specifies how the red, green, blue, and alpha destination + blending factors are computed. + + +.. function:: glCallList(list): + + Execute a display list + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllist.html>`_ + + :type list: unsigned int + :arg list: Specifies the integer name of the display list to be executed. + + +.. function:: glCallLists(n, type, lists): + + Execute a list of display lists + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllists.html>`_ + + :type n: int + :arg n: Specifies the number of display lists to be executed. + :type type: Enumerated constant + :arg type: Specifies the type of values in lists. + :type lists: :class:`Buffer` object + :arg lists: Specifies the address of an array of name offsets in the display list. + The pointer type is void because the offsets can be bytes, shorts, ints, or floats, + depending on the value of type. + + +.. function:: glClear(mask): + + Clear buffers to preset values + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clear.html>`_ + + :type mask: Enumerated constant(s) + :arg mask: Bitwise OR of masks that indicate the buffers to be cleared. + + +.. function:: glClearAccum(red, green, blue, alpha): + + Specify clear values for the accumulation buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html>`_ + + :type red, green, blue, alpha: float + :arg red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the + accumulation buffer is cleared. The initial values are all 0. + + +.. function:: glClearColor(red, green, blue, alpha): + + Specify clear values for the color buffers + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html>`_ + + :type red, green, blue, alpha: float + :arg red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the + color buffers are cleared. The initial values are all 0. + + +.. function:: glClearDepth(depth): + + Specify the clear value for the depth buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cleardepth.html>`_ + + :type depth: int + :arg depth: Specifies the depth value used when the depth buffer is cleared. + The initial value is 1. + + +.. function:: glClearIndex(c): + + Specify the clear value for the color index buffers + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearindex.html>`_ + + :type c: float + :arg c: Specifies the index used when the color index buffers are cleared. + The initial value is 0. + + +.. function:: glClearStencil(s): + + Specify the clear value for the stencil buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearstencil.html>`_ + + :type s: int + :arg s: Specifies the index used when the stencil buffer is cleared. The initial value is 0. + + +.. function:: glClipPlane (plane, equation): + + Specify a plane against which all geometry is clipped + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clipplane.html>`_ + + :type plane: Enumerated constant + :arg plane: Specifies which clipping plane is being positioned. + :type equation: :class:`Buffer` object I{type GL_FLOAT}(double) + :arg equation: Specifies the address of an array of four double- precision + floating-point values. These values are interpreted as a plane equation. + + +.. function:: glColor (red, green, blue, alpha): + + B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us, + glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us, + glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv, + glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv, + glColor4uiv, glColor4usv} + + Set a new color. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html>`_ + + :type red, green, blue, alpha: Depends on function prototype. + :arg red, green, blue: Specify new red, green, and blue values for the current color. + :arg alpha: Specifies a new alpha value for the current color. Included only in the + four-argument glColor4 commands. (With '4' colors only) + + +.. function:: glColorMask(red, green, blue, alpha): + + Enable and disable writing of frame buffer color components + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html>`_ + + :type red, green, blue, alpha: int (boolean) + :arg red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be + written into the frame buffer. The initial values are all GL_TRUE, indicating that the + color components can be written. + + +.. function:: glColorMaterial(face, mode): + + Cause a material color to track the current color + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormaterial.html>`_ + + :type face: Enumerated constant + :arg face: Specifies whether front, back, or both front and back material parameters should + track the current color. + :type mode: Enumerated constant + :arg mode: Specifies which of several material parameters track the current color. + + +.. function:: glCopyPixels(x, y, width, height, type): + + Copy pixels in the frame buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html>`_ + + :type x, y: int + :arg x, y: Specify the window coordinates of the lower left corner of the rectangular + region of pixels to be copied. + :type width, height: int + :arg width,height: Specify the dimensions of the rectangular region of pixels to be copied. + Both must be non-negative. + :type type: Enumerated constant + :arg type: Specifies whether color values, depth values, or stencil values are to be copied. + + + def glCopyTexImage2D(target, level, internalformat, x, y, width, height, border): + + Copy pixels into a 2D texture image + + .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml>`_ + + :type target: Enumerated constant + :arg target: Specifies the target texture. + :type level: int + :arg level: Specifies the level-of-detail number. Level 0 is the base image level. + Level n is the nth mipmap reduction image. + :type internalformat: int + :arg internalformat: Specifies the number of color components in the texture. + :type width: int + :type x, y: int + :arg x, y: Specify the window coordinates of the first pixel that is copied + from the frame buffer. This location is the lower left corner of a rectangular + block of pixels. + :arg width: Specifies the width of the texture image. Must be 2n+2(border) for + some integer n. All implementations support texture images that are at least 64 + texels wide. + :type height: int + :arg height: Specifies the height of the texture image. Must be 2m+2(border) for + some integer m. All implementations support texture images that are at least 64 + texels high. + :type border: int + :arg border: Specifies the width of the border. Must be either 0 or 1. + + +.. function:: glCullFace(mode): + + Specify whether front- or back-facing facets can be culled + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cullface.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies whether front- or back-facing facets are candidates for culling. + + +.. function:: glDeleteLists(list, range): + + Delete a contiguous group of display lists + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletelists.html>`_ + + :type list: unsigned int + :arg list: Specifies the integer name of the first display list to delete + :type range: int + :arg range: Specifies the number of display lists to delete + + +.. function:: glDeleteTextures(n, textures): + + Delete named textures + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html>`_ + + :type n: int + :arg n: Specifies the number of textures to be deleted + :type textures: :class:`Buffer` I{GL_INT} + :arg textures: Specifies an array of textures to be deleted + + +.. function:: glDepthFunc(func): + + Specify the value used for depth buffer comparisons + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthfunc.html>`_ + + :type func: Enumerated constant + :arg func: Specifies the depth comparison function. + + +.. function:: glDepthMask(flag): + + Enable or disable writing into the depth buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthmask.html>`_ + + :type flag: int (boolean) + :arg flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE, + depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer + writing is enabled. + + +.. function:: glDepthRange(zNear, zFar): + + Specify mapping of depth values from normalized device coordinates to window coordinates + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthrange.html>`_ + + :type zNear: int + :arg zNear: Specifies the mapping of the near clipping plane to window coordinates. + The initial value is 0. + :type zFar: int + :arg zFar: Specifies the mapping of the far clipping plane to window coordinates. + The initial value is 1. + + +.. function:: glDisable(cap): + + Disable server-side GL capabilities + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html>`_ + + :type cap: Enumerated constant + :arg cap: Specifies a symbolic constant indicating a GL capability. + + +.. function:: glDrawBuffer(mode): + + Specify which color buffers are to be drawn into + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawbuffer.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies up to four color buffers to be drawn into. + + +.. function:: glDrawPixels(width, height, format, type, pixels): + + Write a block of pixels to the frame buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html>`_ + + :type width, height: int + :arg width, height: Specify the dimensions of the pixel rectangle to be + written into the frame buffer. + :type format: Enumerated constant + :arg format: Specifies the format of the pixel data. + :type type: Enumerated constant + :arg type: Specifies the data type for pixels. + :type pixels: :class:`Buffer` object + :arg pixels: Specifies a pointer to the pixel data. + + +.. function:: glEdgeFlag (flag): + + B{glEdgeFlag, glEdgeFlagv} + + Flag edges as either boundary or non-boundary + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/edgeflag.html>`_ + + :type flag: Depends of function prototype + :arg flag: Specifies the current edge flag value.The initial value is GL_TRUE. + + +.. function:: glEnable(cap): + + Enable server-side GL capabilities + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html>`_ + + :type cap: Enumerated constant + :arg cap: Specifies a symbolic constant indicating a GL capability. + + +.. function:: glEnd(): + + Delimit the vertices of a primitive or group of like primitives + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html>`_ + + +.. function:: glEndList(): + + Create or replace a display list + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html>`_ + + +.. function:: glEvalCoord (u,v): + + B{glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv, + glEvalCoord2dv, glEvalCoord2fv} + + Evaluate enabled one- and two-dimensional maps + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalcoord.html>`_ + + :type u: Depends on function prototype. + :arg u: Specifies a value that is the domain coordinate u to the basis function defined + in a previous glMap1 or glMap2 command. If the function prototype ends in 'v' then + u specifies a pointer to an array containing either one or two domain coordinates. The first + coordinate is u. The second coordinate is v, which is present only in glEvalCoord2 versions. + :type v: Depends on function prototype. (only with '2' prototypes) + :arg v: Specifies a value that is the domain coordinate v to the basis function defined + in a previous glMap2 command. This argument is not present in a glEvalCoord1 command. + + +.. function:: glEvalMesh (mode, i1, i2): + + B{glEvalMesh1 or glEvalMesh2} + + Compute a one- or two-dimensional grid of points or lines + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalmesh.html>`_ + + :type mode: Enumerated constant + :arg mode: In glEvalMesh1, specifies whether to compute a one-dimensional + mesh of points or lines. + :type i1, i2: int + :arg i1, i2: Specify the first and last integer values for the grid domain variable i. + + +.. function:: glEvalPoint (i, j): + + B{glEvalPoint1 and glEvalPoint2} + + Generate and evaluate a single point in a mesh + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalpoint.html>`_ + + :type i: int + :arg i: Specifies the integer value for grid domain variable i. + :type j: int (only with '2' prototypes) + :arg j: Specifies the integer value for grid domain variable j (glEvalPoint2 only). + + +.. function:: glFeedbackBuffer (size, type, buffer): + + Controls feedback mode + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/feedbackbuffer.html>`_ + + :type size: int + :arg size: Specifies the maximum number of values that can be written into buffer. + :type type: Enumerated constant + :arg type: Specifies a symbolic constant that describes the information that + will be returned for each vertex. + :type buffer: :class:`Buffer` object I{GL_FLOAT} + :arg buffer: Returns the feedback data. + + +.. function:: glFinish(): + + Block until all GL execution is complete + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/finish.html>`_ + + +.. function:: glFlush(): + + Force Execution of GL commands in finite time + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/flush.html>`_ + + +.. function:: glFog (pname, param): + + B{glFogf, glFogi, glFogfv, glFogiv} + + Specify fog parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/fog.html>`_ + + :type pname: Enumerated constant + :arg pname: Specifies a single-valued fog parameter. If the function prototype + ends in 'v' specifies a fog parameter. + :type param: Depends on function prototype. + :arg param: Specifies the value or values to be assigned to pname. GL_FOG_COLOR + requires an array of four values. All other parameters accept an array containing + only a single value. + + +.. function:: glFrontFace(mode): + + Define front- and back-facing polygons + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frontface.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies the orientation of front-facing polygons. + + +.. function:: glFrustum(left, right, bottom, top, zNear, zFar): + + Multiply the current matrix by a perspective matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frustum.html>`_ + + :type left, right: double (float) + :arg left, right: Specify the coordinates for the left and right vertical + clipping planes. + :type top, bottom: double (float) + :arg top, bottom: Specify the coordinates for the bottom and top horizontal + clipping planes. + :type zNear, zFar: double (float) + :arg zNear, zFar: Specify the distances to the near and far depth clipping planes. + Both distances must be positive. + + +.. function:: glGenLists(range): + + Generate a contiguous set of empty display lists + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/genlists.html>`_ + + :type range: int + :arg range: Specifies the number of contiguous empty display lists to be generated. + + +.. function:: glGenTextures(n, textures): + + Generate texture names + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gentextures.html>`_ + + :type n: int + :arg n: Specifies the number of textures name to be generated. + :type textures: :class:`Buffer` object I{type GL_INT} + :arg textures: Specifies an array in which the generated textures names are stored. + + +.. function:: glGet (pname, param): + + B{glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv} + + Return the value or values of a selected parameter + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html>`_ + + :type pname: Enumerated constant + :arg pname: Specifies the parameter value to be returned. + :type param: Depends on function prototype. + :arg param: Returns the value or values of the specified parameter. + + +.. function:: glGetClipPlane(plane, equation): + + Return the coefficients of the specified clipping plane + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getclipplane.html>`_ + + :type plane: Enumerated constant + :arg plane: Specifies a clipping plane. The number of clipping planes depends on the + implementation, but at least six clipping planes are supported. They are identified by + symbolic names of the form GL_CLIP_PLANEi where 0 < i < GL_MAX_CLIP_PLANES. + :type equation: :class:`Buffer` object I{type GL_FLOAT} + :arg equation: Returns four float (double)-precision values that are the coefficients of the + plane equation of plane in eye coordinates. The initial value is (0, 0, 0, 0). + + +.. function:: glGetError(): + + Return error information + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html>`_ + + +.. function:: glGetLight (light, pname, params): + + B{glGetLightfv and glGetLightiv} + + Return light source parameter values + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getlight.html>`_ + + :type light: Enumerated constant + :arg light: Specifies a light source. The number of possible lights depends on the + implementation, but at least eight lights are supported. They are identified by symbolic + names of the form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. + :type pname: Enumerated constant + :arg pname: Specifies a light source parameter for light. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the requested data. + + +.. function:: glGetMap (target, query, v): + + B{glGetMapdv, glGetMapfv, glGetMapiv} + + Return evaluator parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmap.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the symbolic name of a map. + :type query: Enumerated constant + :arg query: Specifies which parameter to return. + :type v: :class:`Buffer` object. Depends on function prototype. + :arg v: Returns the requested data. + + +.. function:: glGetMaterial (face, pname, params): + + B{glGetMaterialfv, glGetMaterialiv} + + Return material parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmaterial.html>`_ + + :type face: Enumerated constant + :arg face: Specifies which of the two materials is being queried. + representing the front and back materials, respectively. + :type pname: Enumerated constant + :arg pname: Specifies the material parameter to return. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the requested data. + + +.. function:: glGetPixelMap (map, values): + + B{glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv} + + Return the specified pixel map + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpixelmap.html>`_ + + :type map: Enumerated constant + :arg map: Specifies the name of the pixel map to return. + :type values: :class:`Buffer` object. Depends on function prototype. + :arg values: Returns the pixel map contents. + + +.. function:: glGetPolygonStipple(mask): + + Return the polygon stipple pattern + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpolygonstipple.html>`_ + + :type mask: :class:`Buffer` object I{type GL_BYTE} + :arg mask: Returns the stipple pattern. The initial value is all 1's. + + +.. function:: glGetString(name): + + Return a string describing the current GL connection + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getstring.html>`_ + + :type name: Enumerated constant + :arg name: Specifies a symbolic constant. + + + +.. function:: glGetTexEnv (target, pname, params): + + B{glGetTexEnvfv, glGetTexEnviv} + + Return texture environment parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexenv.html>`_ + + :type target: Enumerated constant + :arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of a texture environment parameter. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the requested data. + + +.. function:: glGetTexGen (coord, pname, params): + + B{glGetTexGendv, glGetTexGenfv, glGetTexGeniv} + + Return texture coordinate generation parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexgen.html>`_ + + :type coord: Enumerated constant + :arg coord: Specifies a texture coordinate. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of the value(s) to be returned. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the requested data. + + +.. function:: glGetTexImage(target, level, format, type, pixels): + + Return a texture image + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getteximage.html>`_ + + :type target: Enumerated constant + :arg target: Specifies which texture is to be obtained. + :type level: int + :arg level: Specifies the level-of-detail number of the desired image. + Level 0 is the base image level. Level n is the nth mipmap reduction image. + :type format: Enumerated constant + :arg format: Specifies a pixel format for the returned data. + :type type: Enumerated constant + :arg type: Specifies a pixel type for the returned data. + :type pixels: :class:`Buffer` object. + :arg pixels: Returns the texture image. Should be a pointer to an array of the + type specified by type + + +.. function:: glGetTexLevelParameter (target, level, pname, params): + + B{glGetTexLevelParameterfv, glGetTexLevelParameteriv} + + return texture parameter values for a specific level of detail + + .. seealso:: U{opengl.org/developers/documentation/man_pages/hardcopy/GL/html/gl/gettexlevelparameter.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the symbolic name of the target texture. + :type level: int + :arg level: Specifies the level-of-detail number of the desired image. + Level 0 is the base image level. Level n is the nth mipmap reduction image. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of a texture parameter. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the requested data. + + +.. function:: glGetTexParameter (target, pname, params): + + B{glGetTexParameterfv, glGetTexParameteriv} + + Return texture parameter values + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexparameter.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the symbolic name of the target texture. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name the target texture. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the texture parameters. + + +.. function:: glHint(target, mode): + + Specify implementation-specific hints + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/hint.html>`_ + + :type target: Enumerated constant + :arg target: Specifies a symbolic constant indicating the behavior to be + controlled. + :type mode: Enumerated constant + :arg mode: Specifies a symbolic constant indicating the desired behavior. + + +.. function:: glIndex(c): + + B{glIndexd, glIndexf, glIndexi, glIndexs, glIndexdv, glIndexfv, glIndexiv, glIndexsv} + + Set the current color index + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/index_.html>`_ + + :type c: :class:`Buffer` object. Depends on function prototype. + :arg c: Specifies a pointer to a one element array that contains the new value for + the current color index. + + +.. function:: glInitNames(): + + Initialize the name stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/initnames.html>`_ + + +.. function:: glIsEnabled(cap): + + Test whether a capability is enabled + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/isenabled.html>`_ + + :type cap: Enumerated constant + :arg cap: Specifies a constant representing a GL capability. + + +.. function:: glIsList(list): + + Determine if a name corresponds to a display-list + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/islist.html>`_ + + :type list: unsigned int + :arg list: Specifies a potential display-list name. + + +.. function:: glIsTexture(texture): + + Determine if a name corresponds to a texture + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/istexture.html>`_ + + :type texture: unsigned int + :arg texture: Specifies a value that may be the name of a texture. + + +.. function:: glLight (light, pname, param): + + B{glLightf,glLighti, glLightfv, glLightiv} + + Set the light source parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/light.html>`_ + + :type light: Enumerated constant + :arg light: Specifies a light. The number of lights depends on the implementation, + but at least eight lights are supported. They are identified by symbolic names of the + form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. + :type pname: Enumerated constant + :arg pname: Specifies a single-valued light source parameter for light. + :type param: Depends on function prototype. + :arg param: Specifies the value that parameter pname of light source light will be set to. + If function prototype ends in 'v' specifies a pointer to the value or values that + parameter pname of light source light will be set to. + + +.. function:: glLightModel (pname, param): + + B{glLightModelf, glLightModeli, glLightModelfv, glLightModeliv} + + Set the lighting model parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/lightmodel.html>`_ + + :type pname: Enumerated constant + :arg pname: Specifies a single-value light model parameter. + :type param: Depends on function prototype. + :arg param: Specifies the value that param will be set to. If function prototype ends in 'v' + specifies a pointer to the value or values that param will be set to. + + +.. function:: glLineStipple(factor, pattern): + + Specify the line stipple pattern + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linestipple.html>`_ + + :type factor: int + :arg factor: Specifies a multiplier for each bit in the line stipple pattern. + If factor is 3, for example, each bit in the pattern is used three times before + the next bit in the pattern is used. factor is clamped to the range [1, 256] and + defaults to 1. + :type pattern: unsigned short int + :arg pattern: Specifies a 16-bit integer whose bit pattern determines which fragments + of a line will be drawn when the line is rasterized. Bit zero is used first; the default + pattern is all 1's. + + +.. function:: glLineWidth(width): + + Specify the width of rasterized lines. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linewidth.html>`_ + + :type width: float + :arg width: Specifies the width of rasterized lines. The initial value is 1. + + +.. function:: glListBase(base): + + Set the display-list base for glCallLists + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/listbase.html>`_ + + :type base: unsigned int + :arg base: Specifies an integer offset that will be added to glCallLists + offsets to generate display-list names. The initial value is 0. + + +.. function:: glLoadIdentity(): + + Replace the current matrix with the identity matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadidentity.html>`_ + + +.. function:: glLoadMatrix (m): + + B{glLoadMatrixd, glLoadMatixf} + + Replace the current matrix with the specified matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadmatrix.html>`_ + + :type m: :class:`Buffer` object. Depends on function prototype. + :arg m: Specifies a pointer to 16 consecutive values, which are used as the elements + of a 4x4 column-major matrix. + + +.. function:: glLoadName(name): + + Load a name onto the name stack. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadname.html>`_ + + :type name: unsigned int + :arg name: Specifies a name that will replace the top value on the name stack. + + +.. function:: glLogicOp(opcode): + + Specify a logical pixel operation for color index rendering + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/logicop.html>`_ + + :type opcode: Enumerated constant + :arg opcode: Specifies a symbolic constant that selects a logical operation. + + +.. function:: glMap1 (target, u1, u2, stride, order, points): + + B{glMap1d, glMap1f} + + Define a one-dimensional evaluator + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map1.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the kind of values that are generated by the evaluator. + :type u1, u2: Depends on function prototype. + :arg u1,u2: Specify a linear mapping of u, as presented to glEvalCoord1, to ^, t + he variable that is evaluated by the equations specified by this command. + :type stride: int + :arg stride: Specifies the number of floats or float (double)s between the beginning + of one control point and the beginning of the next one in the data structure + referenced in points. This allows control points to be embedded in arbitrary data + structures. The only constraint is that the values for a particular control point must + occupy contiguous memory locations. + :type order: int + :arg order: Specifies the number of control points. Must be positive. + :type points: :class:`Buffer` object. Depends on function prototype. + :arg points: Specifies a pointer to the array of control points. + + +.. function:: glMap2 (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points): + + B{glMap2d, glMap2f} + + Define a two-dimensional evaluator + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map2.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the kind of values that are generated by the evaluator. + :type u1, u2: Depends on function prototype. + :arg u1,u2: Specify a linear mapping of u, as presented to glEvalCoord2, to ^, t + he variable that is evaluated by the equations specified by this command. Initially + u1 is 0 and u2 is 1. + :type ustride: int + :arg ustride: Specifies the number of floats or float (double)s between the beginning + of control point R and the beginning of control point R ij, where i and j are the u + and v control point indices, respectively. This allows control points to be embedded + in arbitrary data structures. The only constraint is that the values for a particular + control point must occupy contiguous memory locations. The initial value of ustride is 0. + :type uorder: int + :arg uorder: Specifies the dimension of the control point array in the u axis. + Must be positive. The initial value is 1. + :type v1, v2: Depends on function prototype. + :arg v1, v2: Specify a linear mapping of v, as presented to glEvalCoord2, + to ^, one of the two variables that are evaluated by the equations + specified by this command. Initially, v1 is 0 and v2 is 1. + :type vstride: int + :arg vstride: Specifies the number of floats or float (double)s between the + beginning of control point R and the beginning of control point R ij, + where i and j are the u and v control point(indices, respectively. + This allows control points to be embedded in arbitrary data structures. + The only constraint is that the values for a particular control point must + occupy contiguous memory locations. The initial value of vstride is 0. + :type vorder: int + :arg vorder: Specifies the dimension of the control point array in the v axis. + Must be positive. The initial value is 1. + :type points: :class:`Buffer` object. Depends on function prototype. + :arg points: Specifies a pointer to the array of control points. + + +.. function:: glMapGrid (un, u1,u2 ,vn, v1, v2): + + B{glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f} + + Define a one- or two-dimensional mesh + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/mapgrid.html>`_ + + :type un: int + :arg un: Specifies the number of partitions in the grid range interval + [u1, u2]. Must be positive. + :type u1, u2: Depends on function prototype. + :arg u1, u2: Specify the mappings for integer grid domain values i=0 and i=un. + :type vn: int + :arg vn: Specifies the number of partitions in the grid range interval + [v1, v2] (glMapGrid2 only). + :type v1, v2: Depends on function prototype. + :arg v1, v2: Specify the mappings for integer grid domain values j=0 and j=vn + (glMapGrid2 only). + + +.. function:: glMaterial (face, pname, params): + + Specify material parameters for the lighting model. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/material.html>`_ + + :type face: Enumerated constant + :arg face: Specifies which face or faces are being updated. Must be one of: + :type pname: Enumerated constant + :arg pname: Specifies the single-valued material parameter of the face + or faces that is being updated. Must be GL_SHININESS. + :type params: int + :arg params: Specifies the value that parameter GL_SHININESS will be set to. + If function prototype ends in 'v' specifies a pointer to the value or values that + pname will be set to. + + +.. function:: glMatrixMode(mode): + + Specify which matrix is the current matrix. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/matrixmode.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies which matrix stack is the target for subsequent matrix operations. + + +.. function:: glMultMatrix (m): + + B{glMultMatrixd, glMultMatrixf} + + Multiply the current matrix with the specified matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/multmatrix.html>`_ + + :type m: :class:`Buffer` object. Depends on function prototype. + :arg m: Points to 16 consecutive values that are used as the elements of a 4x4 column + major matrix. + + +.. function:: glNewList(list, mode): + + Create or replace a display list + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html>`_ + + :type list: unsigned int + :arg list: Specifies the display list name + :type mode: Enumerated constant + :arg mode: Specifies the compilation mode. + + +.. function:: glNormal3 (nx, ny, nz, v): + + B{Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv, + Normal3s, Normal3sv} + + Set the current normal vector + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/normal.html>`_ + + :type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only) + :arg nx, ny, nz: Specify the x, y, and z coordinates of the new current normal. + The initial value of the current normal is the unit vector, (0, 0, 1). + :type v: :class:`Buffer` object. Depends on function prototype. ('v' prototypes) + :arg v: Specifies a pointer to an array of three elements: the x, y, and z coordinates + of the new current normal. + + +.. function:: glOrtho(left, right, bottom, top, zNear, zFar): + + Multiply the current matrix with an orthographic matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/ortho.html>`_ + + :type left, right: double (float) + :arg left, right: Specify the coordinates for the left and + right vertical clipping planes. + :type bottom, top: double (float) + :arg bottom, top: Specify the coordinates for the bottom and top + horizontal clipping planes. + :type zNear, zFar: double (float) + :arg zNear, zFar: Specify the distances to the nearer and farther + depth clipping planes. These values are negative if the plane is to be behind the viewer. + + +.. function:: glPassThrough(token): + + Place a marker in the feedback buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/passthrough.html>`_ + + :type token: float + :arg token: Specifies a marker value to be placed in the feedback + buffer following a GL_PASS_THROUGH_TOKEN. + + +.. function:: glPixelMap (map, mapsize, values): + + B{glPixelMapfv, glPixelMapuiv, glPixelMapusv} + + Set up pixel transfer maps + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelmap.html>`_ + + :type map: Enumerated constant + :arg map: Specifies a symbolic map name. + :type mapsize: int + :arg mapsize: Specifies the size of the map being defined. + :type values: :class:`Buffer` object. Depends on function prototype. + :arg values: Specifies an array of mapsize values. + + +.. function:: glPixelStore (pname, param): + + B{glPixelStoref, glPixelStorei} + + Set pixel storage modes + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelstore.html>`_ + + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of the parameter to be set. + Six values affect the packing of pixel data into memory. + Six more affect the unpacking of pixel data from memory. + :type param: Depends on function prototype. + :arg param: Specifies the value that pname is set to. + + +.. function:: glPixelTransfer (pname, param): + + B{glPixelTransferf, glPixelTransferi} + + Set pixel transfer modes + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixeltransfer.html>`_ + + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of the pixel transfer parameter to be set. + :type param: Depends on function prototype. + :arg param: Specifies the value that pname is set to. + + +.. function:: glPixelZoom(xfactor, yfactor): + + Specify the pixel zoom factors + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelzoom.html>`_ + + :type xfactor, yfactor: float + :arg xfactor, yfactor: Specify the x and y zoom factors for pixel write operations. + + +.. function:: glPointSize(size): + + Specify the diameter of rasterized points + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pointsize.html>`_ + + :type size: float + :arg size: Specifies the diameter of rasterized points. The initial value is 1. + + +.. function:: glPolygonMode(face, mode): + + Select a polygon rasterization mode + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonmode.html>`_ + + :type face: Enumerated constant + :arg face: Specifies the polygons that mode applies to. + Must be GL_FRONT for front-facing polygons, GL_BACK for back- facing + polygons, or GL_FRONT_AND_BACK for front- and back-facing polygons. + :type mode: Enumerated constant + :arg mode: Specifies how polygons will be rasterized. + The initial value is GL_FILL for both front- and back- facing polygons. + + +.. function:: glPolygonOffset(factor, units): + + Set the scale and units used to calculate depth values + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonoffset.html>`_ + + :type factor: float + :arg factor: Specifies a scale factor that is used to create a variable depth + offset for each polygon. The initial value is 0. + :type units: float + :arg units: Is multiplied by an implementation-specific value to create a + constant depth offset. The initial value is 0. + + +.. function:: glPolygonStipple(mask): + + Set the polygon stippling pattern + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonstipple.html>`_ + + :type mask: :class:`Buffer` object I{type GL_BYTE} + :arg mask: Specifies a pointer to a 32x32 stipple pattern that will be unpacked + from memory in the same way that glDrawPixels unpacks pixels. + + +.. function:: glPopAttrib(): + + Pop the server attribute stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html>`_ + + +.. function:: glPopClientAttrib(): + + Pop the client attribute stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html>`_ + + +.. function:: glPopMatrix(): + + Pop the current matrix stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html>`_ + + +.. function:: glPopName(): + + Pop the name stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html>`_ + + +.. function:: glPrioritizeTextures(n, textures, priorities): + + Set texture residence priority + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/prioritizetextures.html>`_ + + :type n: int + :arg n: Specifies the number of textures to be prioritized. + :type textures: :class:`Buffer` I{type GL_INT} + :arg textures: Specifies an array containing the names of the textures to be prioritized. + :type priorities: :class:`Buffer` I{type GL_FLOAT} + :arg priorities: Specifies an array containing the texture priorities. + A priority given in an element of priorities applies to the texture named + by the corresponding element of textures. + + +.. function:: glPushAttrib(mask): + + Push the server attribute stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html>`_ + + :type mask: Enumerated constant(s) + :arg mask: Specifies a mask that indicates which attributes to save. + + +.. function:: glPushClientAttrib(mask): + + Push the client attribute stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html>`_ + + :type mask: Enumerated constant(s) + :arg mask: Specifies a mask that indicates which attributes to save. + + +.. function:: glPushMatrix(): + + Push the current matrix stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html>`_ + + +.. function:: glPushName(name): + + Push the name stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html>`_ + + :type name: unsigned int + :arg name: Specifies a name that will be pushed onto the name stack. + + +.. function:: glRasterPos (x,y,z,w): + + B{glRasterPos2d, glRasterPos2f, glRasterPos2i, glRasterPos2s, glRasterPos3d, + glRasterPos3f, glRasterPos3i, glRasterPos3s, glRasterPos4d, glRasterPos4f, + glRasterPos4i, glRasterPos4s, glRasterPos2dv, glRasterPos2fv, glRasterPos2iv, + glRasterPos2sv, glRasterPos3dv, glRasterPos3fv, glRasterPos3iv, glRasterPos3sv, + glRasterPos4dv, glRasterPos4fv, glRasterPos4iv, glRasterPos4sv} + + Specify the raster position for pixel operations + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html>`_ + + :type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only) + :arg x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the + raster position. If function prototype ends in 'v' specifies a pointer to an array of two, + three, or four elements, specifying x, y, z, and w coordinates, respectively. + + .. note:: + + If you are drawing to the 3d view with a Scriptlink of a space handler + the zoom level of the panels will scale the glRasterPos by the view matrix. + so a X of 10 will not always offset 10 pixels as you would expect. + + To work around this get the scale value of the view matrix and use it to scale your pixel values. + + .. code-block:: python + + import Blender + from Blender.BGL import * + xval, yval= 100, 40 + # Get the scale of the view matrix + viewMatrix = Buffer(GL_FLOAT, 16) + glGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix) + f = 1/viewMatrix[0] + glRasterPos2f(xval*f, yval*f) # Instead of the usual glRasterPos2i(xval, yval) + + +.. function:: glReadBuffer(mode): + + Select a color buffer source for pixels. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readbuffer.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies a color buffer. + + +.. function:: glReadPixels(x, y, width, height, format, type, pixels): + + Read a block of pixels from the frame buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html>`_ + + :type x, y: int + :arg x, y: Specify the window coordinates of the first pixel that is read + from the frame buffer. This location is the lower left corner of a rectangular + block of pixels. + :type width, height: int + :arg width, height: Specify the dimensions of the pixel rectangle. width and + height of one correspond to a single pixel. + :type format: Enumerated constant + :arg format: Specifies the format of the pixel data. + :type type: Enumerated constant + :arg type: Specifies the data type of the pixel data. + :type pixels: :class:`Buffer` object + :arg pixels: Returns the pixel data. + + +.. function:: glRect (x1,y1,x2,y2,v1,v2): + + B{glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv} + + Draw a rectangle + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rect.html>`_ + + :type x1, y1: Depends on function prototype. (for non 'v' prototypes only) + :arg x1, y1: Specify one vertex of a rectangle + :type x2, y2: Depends on function prototype. (for non 'v' prototypes only) + :arg x2, y2: Specify the opposite vertex of the rectangle + :type v1, v2: Depends on function prototype. (for 'v' prototypes only) + :arg v1, v2: Specifies a pointer to one vertex of a rectangle and the pointer + to the opposite vertex of the rectangle + + +.. function:: glRenderMode(mode): + + Set rasterization mode + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rendermode.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies the rasterization mode. + + +.. function:: glRotate (angle, x, y, z): + + B{glRotated, glRotatef} + + Multiply the current matrix by a rotation matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html>`_ + + :type angle: Depends on function prototype. + :arg angle: Specifies the angle of rotation in degrees. + :type x, y, z: Depends on function prototype. + :arg x, y, z: Specify the x, y, and z coordinates of a vector respectively. + + +.. function:: glScale (x,y,z): + + B{glScaled, glScalef} + + Multiply the current matrix by a general scaling matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html>`_ + + :type x, y, z: Depends on function prototype. + :arg x, y, z: Specify scale factors along the x, y, and z axes, respectively. + + +.. function:: glScissor(x,y,width,height): + + Define the scissor box + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html>`_ + + :type x, y: int + :arg x, y: Specify the lower left corner of the scissor box. Initially (0, 0). + :type width, height: int + :arg width height: Specify the width and height of the scissor box. When a + GL context is first attached to a window, width and height are set to the + dimensions of that window. + + +.. function:: glSelectBuffer(size, buffer): + + Establish a buffer for selection mode values + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/selectbuffer.html>`_ + + :type size: int + :arg size: Specifies the size of buffer + :type buffer: :class:`Buffer` I{type GL_INT} + :arg buffer: Returns the selection data + + +.. function:: glShadeModel(mode): + + Select flat or smooth shading + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/shademodel.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies a symbolic value representing a shading technique. + + +.. function:: glStencilFuc(func, ref, mask): + + Set function and reference value for stencil testing + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilfunc.html>`_ + + :type func: Enumerated constant + :arg func: Specifies the test function. + :type ref: int + :arg ref: Specifies the reference value for the stencil test. ref is clamped + to the range [0,2n-1], where n is the number of bitplanes in the stencil + buffer. The initial value is 0. + :type mask: unsigned int + :arg mask: Specifies a mask that is ANDed with both the reference value and + the stored stencil value when the test is done. The initial value is all 1's. + + +.. function:: glStencilMask(mask): + + Control the writing of individual bits in the stencil planes + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilmask.html>`_ + + :type mask: unsigned int + :arg mask: Specifies a bit mask to enable and disable writing of individual bits + in the stencil planes. Initially, the mask is all 1's. + + +.. function:: glStencilOp(fail, zfail, zpass): + + Set stencil test actions + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilop.html>`_ + + :type fail: Enumerated constant + :arg fail: Specifies the action to take when the stencil test fails. + The initial value is GL_KEEP. + :type zfail: Enumerated constant + :arg zfail: Specifies the stencil action when the stencil test passes, but the + depth test fails. zfail accepts the same symbolic constants as fail. + The initial value is GL_KEEP. + :type zpass: Enumerated constant + :arg zpass: Specifies the stencil action when both the stencil test and the + depth test pass, or when the stencil test passes and either there is no + depth buffer or depth testing is not enabled. zpass accepts the same + symbolic constants + as fail. The initial value is GL_KEEP. + + +.. function:: glTexCoord (s,t,r,q,v): + + B{glTexCoord1d, glTexCoord1f, glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2f, + glTexCoord2i, glTexCoord2s, glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s, + glTexCoord4d, glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv, + glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2fv, glTexCoord2iv, + glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv, glTexCoord3sv, + glTexCoord4dv, glTexCoord4fv, glTexCoord4iv, glTexCoord4sv} + + Set the current texture coordinates + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html>`_ + + :type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only) + :arg s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are + present in all forms of the command. + :type v: :class:`Buffer` object. Depends on function prototype. (for 'v' prototypes only) + :arg v: Specifies a pointer to an array of one, two, three, or four elements, + which in turn specify the s, t, r, and q texture coordinates. + + +.. function:: glTexEnv (target, pname, param): + + B{glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv} + + Set texture environment parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texenv.html>`_ + + :type target: Enumerated constant + :arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of a single-valued texture environment + parameter. Must be GL_TEXTURE_ENV_MODE. + :type param: Depends on function prototype. + :arg param: Specifies a single symbolic constant. If function prototype ends in 'v' + specifies a pointer to a parameter array that contains either a single + symbolic constant or an RGBA color + + +.. function:: glTexGen (coord, pname, param): + + B{glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv} + + Control the generation of texture coordinates + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texgen.html>`_ + + :type coord: Enumerated constant + :arg coord: Specifies a texture coordinate. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of the texture- coordinate generation function. + :type param: Depends on function prototype. + :arg param: Specifies a single-valued texture generation parameter. + If function prototype ends in 'v' specifies a pointer to an array of texture + generation parameters. If pname is GL_TEXTURE_GEN_MODE, then the array must + contain a single symbolic constant. Otherwise, params holds the coefficients + for the texture-coordinate generation function specified by pname. + + +.. function:: glTexImage1D(target, level, internalformat, width, border, format, type, pixels): + + Specify a one-dimensional texture image + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage1d.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the target texture. + :type level: int + :arg level: Specifies the level-of-detail number. Level 0 is the base image level. + Level n is the nth mipmap reduction image. + :type internalformat: int + :arg internalformat: Specifies the number of color components in the texture. + :type width: int + :arg width: Specifies the width of the texture image. Must be 2n+2(border) + for some integer n. All implementations support texture images that are + at least 64 texels wide. The height of the 1D texture image is 1. + :type border: int + :arg border: Specifies the width of the border. Must be either 0 or 1. + :type format: Enumerated constant + :arg format: Specifies the format of the pixel data. + :type type: Enumerated constant + :arg type: Specifies the data type of the pixel data. + :type pixels: :class:`Buffer` object. + :arg pixels: Specifies a pointer to the image data in memory. + + +.. function:: glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels): + + Specify a two-dimensional texture image + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the target texture. + :type level: int + :arg level: Specifies the level-of-detail number. Level 0 is the base image level. + Level n is the nth mipmap reduction image. + :type internalformat: int + :arg internalformat: Specifies the number of color components in the texture. + :type width: int + :arg width: Specifies the width of the texture image. Must be 2n+2(border) + for some integer n. All implementations support texture images that are at + least 64 texels wide. + :type height: int + :arg height: Specifies the height of the texture image. Must be 2m+2(border) for + some integer m. All implementations support texture images that are at + least 64 texels high. + :type border: int + :arg border: Specifies the width of the border. Must be either 0 or 1. + :type format: Enumerated constant + :arg format: Specifies the format of the pixel data. + :type type: Enumerated constant + :arg type: Specifies the data type of the pixel data. + :type pixels: :class:`Buffer` object. + :arg pixels: Specifies a pointer to the image data in memory. + + +.. function:: glTexParameter (target, pname, param): + + B{glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv} + + Set texture parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texparameter.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the target texture. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of a single-valued texture parameter. + :type param: Depends on function prototype. + :arg param: Specifies the value of pname. If function prototype ends in 'v' specifies + a pointer to an array where the value or values of pname are stored. + + +.. function:: glTranslate (x, y, z): + + B{glTranslatef, glTranslated} + + Multiply the current matrix by a translation matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html>`_ + + :type x, y, z: Depends on function prototype. + :arg x, y, z: Specify the x, y, and z coordinates of a translation vector. + + +.. function:: glVertex (x,y,z,w,v): + + B{glVertex2d, glVertex2f, glVertex2i, glVertex2s, glVertex3d, glVertex3f, glVertex3i, + glVertex3s, glVertex4d, glVertex4f, glVertex4i, glVertex4s, glVertex2dv, glVertex2fv, + glVertex2iv, glVertex2sv, glVertex3dv, glVertex3fv, glVertex3iv, glVertex3sv, glVertex4dv, + glVertex4fv, glVertex4iv, glVertex4sv} + + Specify a vertex + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html>`_ + + :type x, y, z, w: Depends on function prototype (z and w for '3' and '4' prototypes only) + :arg x, y, z, w: Specify x, y, z, and w coordinates of a vertex. Not all parameters + are present in all forms of the command. + :type v: :class:`Buffer` object. Depends of function prototype (for 'v' + prototypes only) + :arg v: Specifies a pointer to an array of two, three, or four elements. The + elements of a two-element array are x and y; of a three-element array, + x, y, and z; and of a four-element array, x, y, z, and w. + + +.. function:: glViewport(x,y,width,height): + + Set the viewport + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html>`_ + + :type x, y: int + :arg x, y: Specify the lower left corner of the viewport rectangle, + in pixels. The initial value is (0,0). + :type width, height: int + :arg width, height: Specify the width and height of the viewport. When a GL + context is first attached to a window, width and height are set to the + dimensions of that window. + + +.. function:: gluPerspective(fovY, aspect, zNear, zFar): + + Set up a perspective projection matrix. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5577288} + + :type fovY: double + :arg fovY: Specifies the field of view angle, in degrees, in the y direction. + :type aspect: double + :arg aspect: Specifies the aspect ratio that determines the field of view in the x direction. + The aspect ratio is the ratio of x (width) to y (height). + :type zNear: double + :arg zNear: Specifies the distance from the viewer to the near clipping plane (always positive). + :type zFar: double + :arg zFar: Specifies the distance from the viewer to the far clipping plane (always positive). + + +.. function:: gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz): + + Define a viewing transformation. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5573042} + + :type eyex, eyey, eyez: double + :arg eyex, eyey, eyez: Specifies the position of the eye point. + :type centerx, centery, centerz: double + :arg centerx, centery, centerz: Specifies the position of the reference point. + :type upx, upy, upz: double + :arg upx, upy, upz: Specifies the direction of the up vector. + + +.. function:: gluOrtho2D(left, right, bottom, top): + + Define a 2-D orthographic projection matrix. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} + + :type left, right: double + :arg left, right: Specify the coordinates for the left and right vertical clipping planes. + :type bottom, top: double + :arg bottom, top: Specify the coordinates for the bottom and top horizontal clipping planes. + + +.. function:: gluPickMatrix(x, y, width, height, viewport): + + Define a picking region. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} + + :type x, y: double + :arg x, y: Specify the center of a picking region in window coordinates. + :type width, height: double + :arg width, height: Specify the width and height, respectively, of the picking region in window coordinates. + :type viewport: :class:`Buffer` object. [int] + :arg viewport: Specifies the current viewport. + + +.. function:: gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz): + + Map object coordinates to window coordinates. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} + + :type objx, objy, objz: double + :arg objx, objy, objz: Specify the object coordinates. + :type modelMatrix: :class:`Buffer` object. [double] + :arg modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). + :type projMatrix: :class:`Buffer` object. [double] + :arg projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). + :type viewport: :class:`Buffer` object. [int] + :arg viewport: Specifies the current viewport (as from a glGetIntegerv call). + :type winx, winy, winz: :class:`Buffer` object. [double] + :arg winx, winy, winz: Return the computed window coordinates. + + +.. function:: gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, objx, objy, objz): + + Map object coordinates to window coordinates. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5582204} + + :type winx, winy, winz: double + :arg winx, winy, winz: Specify the window coordinates to be mapped. + :type modelMatrix: :class:`Buffer` object. [double] + :arg modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). + :type projMatrix: :class:`Buffer` object. [double] + :arg projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). + :type viewport: :class:`Buffer` object. [int] + :arg viewport: Specifies the current viewport (as from a glGetIntegerv call). + :type objx, objy, objz: :class:`Buffer` object. [double] + :arg objx, objy, objz: Return the computed object coordinates. + + +class Buffer: + + The Buffer object is simply a block of memory that is delineated and initialized by the + user. Many OpenGL functions return data to a C-style pointer, however, because this + is not possible in python the Buffer object can be used to this end. Wherever pointer + notation is used in the OpenGL functions the Buffer object can be used in it's BGL + wrapper. In some instances the Buffer object will need to be initialized with the template + parameter, while in other instances the user will want to create just a blank buffer + which will be zeroed by default. + + Example with Buffer:: + import Blender + from Blender import BGL + myByteBuffer = BGL.Buffer(BGL.GL_BYTE, [32,32]) + BGL.glGetPolygonStipple(myByteBuffer) + print myByteBuffer.dimensions + print myByteBuffer.list + sliceBuffer = myByteBuffer[0:16] + print sliceBuffer + + .. attribute:: list + + The contents of the Buffer. + + .. attribute:: dimensions + + The size of the Buffer. + + .. method:: __init__(type, dimensions, template = None): + + This will create a new Buffer object for use with other BGL OpenGL commands. + Only the type of argument to store in the buffer and the dimensions of the buffer + are necessary. Buffers are zeroed by default unless a template is supplied, in + which case the buffer is initialized to the template. + + :type type: int + :arg type: The format to store data in. The type should be one of + GL_BYTE, GL_SHORT, GL_INT, or GL_FLOAT. + :type dimensions: An int or sequence object specifying the dimensions of the buffer. + :arg dimensions: If the dimensions are specified as an int a linear array will + be created for the buffer. If a sequence is passed for the dimensions, the buffer + becomes n-Dimensional, where n is equal to the number of parameters passed in the + sequence. Example: [256,2] is a two- dimensional buffer while [256,256,4] creates + a three- dimensional buffer. You can think of each additional dimension as a sub-item + of the dimension to the left. i.e. [10,2] is a 10 element array each with 2 sub-items. + [(0,0), (0,1), (1,0), (1,1), (2,0), ...] etc. + :type template: A python sequence object (optional) + :arg template: A sequence of matching dimensions which will be used to initialize + the Buffer. If a template is not passed in all fields will be initialized to 0. + :rtype: Buffer object + :return: The newly created buffer as a PyObject. + diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 0112007ca7f..94578c6a545 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -67,7 +67,7 @@ if 1: else: # for testing so doc-builds dont take so long. EXCLUDE_MODULES = ( - # "bpy.context", + "bpy.context", "bpy.app", "bpy.path", "bpy.data", @@ -76,10 +76,10 @@ else: "bpy.context", "bpy.types", # supports filtering "bpy.ops", # supports filtering - #"bpy_extras", + "bpy_extras", "bge", "aud", - "bgl", + #"bgl", "blf", "mathutils", "mathutils.geometry", @@ -1028,8 +1028,8 @@ def rna2sphinx(BASEPATH): fw(" mathutils.rst\n\n") if "mathutils.geometry" not in EXCLUDE_MODULES: fw(" mathutils.geometry.rst\n\n") - # XXX TODO - #fw(" bgl.rst\n\n") + if "bgl" not in EXCLUDE_MODULES: + fw(" bgl.rst\n\n") if "blf" not in EXCLUDE_MODULES: fw(" blf.rst\n\n") if "aud" not in EXCLUDE_MODULES: @@ -1159,14 +1159,16 @@ def rna2sphinx(BASEPATH): import mathutils.geometry as module pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities") - if "mathutils.geometry" not in EXCLUDE_MODULES: + if "blf" not in EXCLUDE_MODULES: import blf as module pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing") - # XXX TODO - #import bgl as module - #pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper") - #del module + if "bgl" not in EXCLUDE_MODULES: + #import bgl as module + #pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper") + #del module + import shutil + shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bgl.rst"), BASEPATH) if "aud" not in EXCLUDE_MODULES: import aud as module diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 69423f2dfbf..bb3d6e3aee3 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1498,15 +1498,18 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) GHOST_TInt32 x_mouse= mousePos.x; GHOST_TInt32 y_mouse= mousePos.y; GHOST_TInt32 x_accum, y_accum, x_cur, y_cur, x, y; - GHOST_Rect bounds, correctedBounds; + GHOST_Rect bounds, windowBounds, correctedBounds; /* fallback to window bounds */ if(window->getCursorGrabBounds(bounds)==GHOST_kFailure) window->getClientBounds(bounds); //Switch back to Cocoa coordinates orientation (y=0 at botton,the same as blender internal btw!), and to client coordinates - window->screenToClient(bounds.m_l, bounds.m_b, correctedBounds.m_l, correctedBounds.m_b); - window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_t); + window->getClientBounds(windowBounds); + window->screenToClient(bounds.m_l, bounds.m_b, correctedBounds.m_l, correctedBounds.m_t); + window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_b); + correctedBounds.m_b = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_b; + correctedBounds.m_t = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_t; //Update accumulation counts window->getCursorGrabAccum(x_accum, y_accum); diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index c53bf7de36c..49c330dfd58 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -1175,8 +1175,10 @@ convertXKey( GXMAP(type,XF86XK_AudioPrev, GHOST_kKeyMediaFirst); GXMAP(type,XF86XK_AudioRewind, GHOST_kKeyMediaFirst); GXMAP(type,XF86XK_AudioNext, GHOST_kKeyMediaLast); +#ifdef XF86XK_AudioForward /* Debian lenny's XF86keysym.h has no XF86XK_AudioForward define */ GXMAP(type,XF86XK_AudioForward, GHOST_kKeyMediaLast); #endif +#endif /* some extra sun cruft (NICE KEYBOARD!) */ #ifdef __sun__ diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h index 0ec3c6f5700..f979313af5c 100644 --- a/intern/ghost/intern/GHOST_WindowNULL.h +++ b/intern/ghost/intern/GHOST_WindowNULL.h @@ -54,7 +54,7 @@ public: const bool stereoVisual, const GHOST_TUns16 numOfAASamples ) : - GHOST_Window(title,left,top,width,height,state,type,stereoVisual,numOfAASamples), + GHOST_Window(width,height,state,type,stereoVisual,numOfAASamples), m_system (system) { setTitle(title); diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt new file mode 100644 index 00000000000..f834b55b387 --- /dev/null +++ b/intern/ghost/test/CMakeLists.txt @@ -0,0 +1,155 @@ + +cmake_policy(SET CMP0003 NEW) +cmake_policy(SET CMP0005 NEW) + +cmake_minimum_required(VERSION 2.8) + +# ----------------------------------------------------------------------------- +# Macros + + +# stub macro, does nothing +macro(blender_add_lib + name + sources + includes + includes_sys + ) + +endmacro() + +# suffix relative paths so we can use external cmake files +macro(suffix_relpaths + new_files files prefix) + + set(${new_files}) + foreach(_file ${files}) + if(IS_ABSOLUTE _file) + list(APPEND ${new_files} ${_file}) + else() + list(APPEND ${new_files} "${prefix}${_file}") + endif() + endforeach() + unset(_file) +endmacro() + + +# ----------------------------------------------------------------------------- +# Libraries + +# ghost +include(${CMAKE_SOURCE_DIR}/../CMakeLists.txt) +suffix_relpaths(INC_NEW "${INC}" "../") +suffix_relpaths(SRC_NEW "${SRC}" "../") +include_directories(${INC_NEW}) +add_library(ghost_lib ${SRC_NEW}) + +# string +include(${CMAKE_SOURCE_DIR}/../../string/CMakeLists.txt) +suffix_relpaths(INC_NEW "${INC}" "../../string/") +suffix_relpaths(SRC_NEW "${SRC}" "../../string/") +include_directories(${INC_NEW}) +add_library(string_lib ${SRC_NEW}) + +# guardedalloc +include(${CMAKE_SOURCE_DIR}/../../guardedalloc/CMakeLists.txt) +suffix_relpaths(INC_NEW "${INC}" "../../guardedalloc/") +suffix_relpaths(SRC_NEW "${SRC}" "../../guardedalloc/") +include_directories(${INC_NEW}) +add_library(guardedalloc_lib ${SRC_NEW}) + +# blenfont +include(${CMAKE_SOURCE_DIR}/../../../source/blender/blenfont/CMakeLists.txt) +suffix_relpaths(INC_NEW "${INC}" "../../../source/blender/blenfont/") +suffix_relpaths(SRC_NEW "${SRC}" "../../../source/blender/blenfont/") +include_directories(${INC_NEW}) +add_library(blenfont_lib ${SRC_NEW}) + +# grr, blenfont needs BLI +include_directories( + "../../../source/blender/blenlib" + "../../../source/blender/blenloader" + ) +add_library(bli_lib + "../../../source/blender/blenlib/intern/fileops.c" + "../../../source/blender/blenlib/intern/rct.c" + "../../../source/blender/blenlib/intern/string.c" + "../../../source/blender/blenlib/intern/listbase.c" + "../../../source/blender/blenlib/intern/storage.c" + "../../../source/blender/blenlib/intern/path_util.c" + "../../../source/blender/blenlib/intern/BLI_dynstr.c" + "../../../source/blender/blenlib/intern/BLI_linklist.c" + "../../../source/blender/blenlib/intern/BLI_memarena.c" + ) + + +find_package(OpenGL REQUIRED) + +find_package(Freetype REQUIRED) + +include_directories(${CMAKE_SOURCE_DIR}/../) +include_directories(${OPENGL_INCLUDE_DIR}) +include_directories(${FREETYPE_INCLUDE_DIRS}) +include_directories(${CMAKE_SOURCE_DIR}/../../../source/blender/blenfont) + +if(UNIX AND NOT APPLE) + find_package(X11 REQUIRED) + + set(PLATFORM_LINKLIBS + ${X11_X11_LIB} + ${X11_Xinput_LIB} + ) +endif() + +# ----------------------------------------------------------------------------- +# Executables + + +# Gears (C) +add_executable(gears_c + ${CMAKE_SOURCE_DIR}/gears/GHOST_C-Test.c) + +target_link_libraries(gears_c + ghost_lib + string_lib + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} + ${PLATFORM_LINKLIBS} + ) + + +# Gears (C++) +add_executable(gears_cpp + ${CMAKE_SOURCE_DIR}/gears/GHOST_Test.cpp) + +target_link_libraries(gears_cpp + ghost_lib + string_lib + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} + ${PLATFORM_LINKLIBS} + ) + + +# MultiTest (C) +add_executable(multitest_c + ${CMAKE_SOURCE_DIR}/../../../source/blender/editors/datafiles/bfont.ttf.c + ${CMAKE_SOURCE_DIR}/multitest/Basic.c + ${CMAKE_SOURCE_DIR}/multitest/EventToBuf.c + ${CMAKE_SOURCE_DIR}/multitest/MultiTest.c + ${CMAKE_SOURCE_DIR}/multitest/ScrollBar.c + ${CMAKE_SOURCE_DIR}/multitest/Util.c + ${CMAKE_SOURCE_DIR}/multitest/WindowData.c +) + +target_link_libraries(multitest_c + blenfont_lib + bli_lib + ghost_lib + string_lib + guardedalloc_lib + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} + ${FREETYPE_LIBRARY} + ${PLATFORM_LINKLIBS} + ) diff --git a/intern/ghost/test/gears/GHOST_C-Test.c b/intern/ghost/test/gears/GHOST_C-Test.c index b34a37132b6..c582d205258 100644 --- a/intern/ghost/test/gears/GHOST_C-Test.c +++ b/intern/ghost/test/gears/GHOST_C-Test.c @@ -474,6 +474,7 @@ int main(int argc, char** argv) 200, GHOST_kWindowStateNormal, GHOST_kDrawingContextTypeOpenGL, + FALSE, FALSE); if (!sMainWindow) { @@ -490,6 +491,7 @@ int main(int argc, char** argv) 200, GHOST_kWindowStateNormal, GHOST_kDrawingContextTypeOpenGL, + FALSE, FALSE); if (!sSecondaryWindow) { diff --git a/intern/ghost/test/gears/GHOST_Test.cpp b/intern/ghost/test/gears/GHOST_Test.cpp index 6e269e1cede..930faf463b6 100644 --- a/intern/ghost/test/gears/GHOST_Test.cpp +++ b/intern/ghost/test/gears/GHOST_Test.cpp @@ -428,7 +428,7 @@ Application::Application(GHOST_ISystem* system) // Create the main window STR_String title1 ("gears - main window"); m_mainWindow = system->createWindow(title1, 10, 64, 320, 200, GHOST_kWindowStateNormal, - GHOST_kDrawingContextTypeOpenGL, true /* stereo flag */); + GHOST_kDrawingContextTypeOpenGL, false, false); if (!m_mainWindow) { std::cout << "could not create main window\n"; @@ -438,7 +438,7 @@ Application::Application(GHOST_ISystem* system) // Create a secondary window STR_String title2 ("gears - secondary window"); m_secondaryWindow = system->createWindow(title2, 340, 64, 320, 200, GHOST_kWindowStateNormal, - GHOST_kDrawingContextTypeOpenGL, false /* stereo flag */); + GHOST_kDrawingContextTypeOpenGL, false, false); if (!m_secondaryWindow) { cout << "could not create secondary window\n"; exit(-1); diff --git a/intern/smoke/intern/WAVELET_NOISE.h b/intern/smoke/intern/WAVELET_NOISE.h index b556b4a2e66..66dfb95d143 100644 --- a/intern/smoke/intern/WAVELET_NOISE.h +++ b/intern/smoke/intern/WAVELET_NOISE.h @@ -45,6 +45,11 @@ #include <MERSENNETWISTER.h> +#ifdef WIN32 +#include <float.h> +#define isnan _isnan +#endif + // Tile file header, update revision upon any change done to the noise generator static const char tilefile_headerstring[] = "Noise Tile File rev. "; static const char tilefile_revision[] = "001"; @@ -69,7 +74,7 @@ static void downsampleX(float *from, float *to, int n){ const float *a = &downCoeffs[16]; for (int i = 0; i < n / 2; i++) { to[i] = 0; - for (int k = 2 * i - 16; k <= 2 * i + 16; k++) + for (int k = 2 * i - 16; k < 2 * i + 16; k++) to[i] += a[k - 2 * i] * from[modFast128(k)]; } } @@ -79,7 +84,7 @@ static void downsampleY(float *from, float *to, int n){ const float *a = &downCoeffs[16]; for (int i = 0; i < n / 2; i++) { to[i * n] = 0; - for (int k = 2 * i - 16; k <= 2 * i + 16; k++) + for (int k = 2 * i - 16; k < 2 * i + 16; k++) to[i * n] += a[k - 2 * i] * from[modFast128(k) * n]; } } @@ -89,7 +94,7 @@ static void downsampleZ(float *from, float *to, int n){ const float *a = &downCoeffs[16]; for (int i = 0; i < n / 2; i++) { to[i * n * n] = 0; - for (int k = 2 * i - 16; k <= 2 * i + 16; k++) + for (int k = 2 * i - 16; k < 2 * i + 16; k++) to[i * n * n] += a[k - 2 * i] * from[modFast128(k) * n * n]; } } @@ -262,6 +267,14 @@ static bool loadTile(float* const noiseTileData, std::string filename) printf("loadTile: Noise tile '%s' is wrong size %d.\n", filename.c_str(), (int)bread); return false; } + + // check for invalid nan tile data that could be generated. bug is now + // fixed, but invalid files may still hang around + if (isnan(noiseTileData[0])) { + printf("loadTile: Noise tile '%s' contains nan values.\n", filename.c_str()); + return false; + } + return true; } diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index 6dcc5d7b285..9c48dc89f83 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -65,4 +65,4 @@ def _main(): _main() -del _main
\ No newline at end of file +del _main diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index cf099016aee..8ed50972c54 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -105,9 +105,9 @@ def edge_face_count(mesh): :return: list face users for each item in mesh.edges. :rtype: list """ - edge_face_count_dict = edge_face_count_dict(mesh) + edge_face_count = edge_face_count_dict(mesh) get = dict.get - return [get(edge_face_count_dict, ed.key, 0) for ed in mesh.edges] + return [get(edge_face_count, ed.key, 0) for ed in mesh.edges] def edge_loops_from_faces(mesh, faces=None, seams=()): diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py index 996b38ae571..8dca30e54df 100644 --- a/release/scripts/startup/bl_operators/mesh.py +++ b/release/scripts/startup/bl_operators/mesh.py @@ -81,8 +81,8 @@ class MeshMirrorUV(bpy.types.Operator): @classmethod def poll(cls, context): - ob = context.active_object - return (ob and ob.type == 'MESH') + obj = context.active_object + return (obj and obj.type == 'MESH' and obj.data.uv_textures.active) def execute(self, context): DIR = (self.direction == 'NEGATIVE') @@ -120,12 +120,7 @@ class MeshMirrorUV(bpy.types.Operator): if j is not None: vmap[i] = j - active_uv_layer = None - for lay in mesh.uv_textures: - if lay.active: - active_uv_layer = lay.data - break - + active_uv_layer = mesh.uv_textures.active.data fuvs = [(uv.uv1, uv.uv2, uv.uv3, uv.uv4) for uv in active_uv_layer] fuvs_cpy = [(uv[0].copy(), uv[1].copy(), uv[2].copy(), uv[3].copy()) for uv in fuvs] diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py index a8bb3227b3c..074f204d50e 100644 --- a/release/scripts/startup/bl_operators/object_quick_effects.py +++ b/release/scripts/startup/bl_operators/object_quick_effects.py @@ -132,7 +132,7 @@ class QuickExplode(bpy.types.Operator): fake_context = bpy.context.copy() obj_act = context.active_object - if obj_act.type != 'MESH': + if obj_act is None or obj_act.type != 'MESH': self.report({'ERROR'}, "Active object is not a mesh") return {'CANCELLED'} diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 8c966825aee..618a88f0879 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -290,9 +290,8 @@ class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel): @classmethod def poll(cls, context): - ob = context.active_object - - return (context.mode == 'EDIT_MESH') and ob and ob.type == 'MESH' + obj = context.object + return (context.mode == 'EDIT_MESH') and obj and obj.type == 'MESH' def draw(self, context): layout = self.layout diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 31da9598641..45c15bd1ce6 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -729,6 +729,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel): col.prop(mat, "use_vertex_color_paint") col.prop(mat, "use_vertex_color_light") col.prop(mat, "use_object_color") + col.prop(mat, "pass_index") class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 7d4b78396bd..4c92296dacd 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -878,7 +878,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel): col.prop(part, "billboard_tilt_random", text="Random", slider=True) col = row.column() col.prop(part, "billboard_offset") - + row = layout.row() col = row.column() col.prop(part, "billboard_size", text="Scale") diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index 54ca18ef828..6d36db29a6c 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -141,6 +141,7 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel): col.prop(rl, "use_pass_uv") col.prop(rl, "use_pass_mist") col.prop(rl, "use_pass_object_index") + col.prop(rl, "use_pass_material_index") col.prop(rl, "use_pass_color") col = split.column() diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 9c31b172ee9..c598788006c 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -883,7 +883,7 @@ class USERPREF_PT_addons(bpy.types.Panel): if user_script_path is not None: user_addon_paths.append(os.path.join(user_script_path(), "addons")) user_addon_paths.append(os.path.join(bpy.utils.resource_path('USER'), "scripts", "addons")) - + for path in user_addon_paths: if bpy.path.is_subdir(mod.__file__, path): return True @@ -1001,8 +1001,7 @@ class USERPREF_PT_addons(bpy.types.Panel): for i in range(4 - tot_row): split.separator() - - + # Append missing scripts # First collect scripts that are used but have no script file. diff --git a/source/blender/avi/AVI_avi.h b/source/blender/avi/AVI_avi.h index 85685e2bd4c..1446971a8ac 100644 --- a/source/blender/avi/AVI_avi.h +++ b/source/blender/avi/AVI_avi.h @@ -55,11 +55,12 @@ #ifndef __AVI_H__ #define __AVI_H__ +#include "MEM_sys_types.h" #include <stdio.h> /* for FILE */ typedef struct _AviChunk { int fcc; - int size; + int64_t size; } AviChunk; typedef struct _AviList { @@ -185,16 +186,16 @@ typedef struct _AviMovie { #define AVI_MOVIE_READ 0 #define AVI_MOVIE_WRITE 1 - unsigned long size; + int64_t size; AviMainHeader *header; AviStreamRec *streams; AviIndexEntry *entries; int index_entries; - int movi_offset; - int read_offset; - long *offset_table; + int64_t movi_offset; + int64_t read_offset; + int64_t *offset_table; /* Local data goes here */ int interlace; diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt index b62e0cc5afd..bae61fd678b 100644 --- a/source/blender/avi/CMakeLists.txt +++ b/source/blender/avi/CMakeLists.txt @@ -27,6 +27,7 @@ set(INC . ../../../intern/guardedalloc + ../blenlib ) set(INC_SYS diff --git a/source/blender/avi/SConscript b/source/blender/avi/SConscript index 0bf8c3c74db..4d2ce8fd845 100644 --- a/source/blender/avi/SConscript +++ b/source/blender/avi/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('intern/*.c') -incs = '. #/intern/guardedalloc' +incs = '. #/intern/guardedalloc ../blenlib' incs += ' ' + env['BF_JPEG_INC'] env.BlenderLib ('bf_avi', sources, Split(incs), [], libtype=['core','player'], priority = [190,120] ) diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index 82bf3a3d21b..ff3aafbf065 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -42,6 +42,9 @@ #include <ctype.h> #include "MEM_guardedalloc.h" +#include "MEM_sys_types.h" + +#include "BLI_winstuff.h" #include "AVI_avi.h" #include "avi_intern.h" @@ -593,7 +596,6 @@ AviError AVI_open_movie (const char *name, AviMovie *movie) { movie->movi_offset = ftell (movie->fp); movie->read_offset = movie->movi_offset; - if (AVI_DEBUG) printf ("movi_offset is %d\n", movie->movi_offset); /* Read in the index if the file has one, otherwise create one */ if (movie->header->Flags & AVIF_HASINDEX) { @@ -707,8 +709,8 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) { AviList list; AviChunk chunk; int i; - int header_pos1, header_pos2; - int stream_pos1, stream_pos2; + int64_t header_pos1, header_pos2; + int64_t stream_pos1, stream_pos2; movie->type = AVI_MOVIE_WRITE; movie->fp = fopen (name, "wb"); @@ -718,7 +720,7 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) { if (movie->fp == NULL) return AVI_ERROR_OPEN; - movie->offset_table = (long *) MEM_mallocN ((1+streams*2) * sizeof (long),"offsettable"); + movie->offset_table = (int64_t *) MEM_mallocN ((1+streams*2) * sizeof (int64_t),"offsettable"); for (i=0; i < 1 + streams*2; i++) movie->offset_table[i] = -1L; @@ -897,7 +899,7 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...) { AviIndexEntry *temp; va_list ap; int stream; - long rec_off; + int64_t rec_off; AviFormat format; void *buffer; int size; diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c index edb708d8a69..96c62843436 100644 --- a/source/blender/avi/intern/options.c +++ b/source/blender/avi/intern/options.c @@ -40,6 +40,8 @@ #include "avi_intern.h" #include "endian.h" +#include "BLI_winstuff.h" + /* avi_set_compress_options gets its own file... now don't WE feel important? */ AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) { diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index cbf7e941387..9261df46338 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -51,7 +51,7 @@ extern "C" { /* used by packaging tools */ /* can be left blank, otherwise a,b,c... etc with no quotes */ -#define BLENDER_VERSION_CHAR +#define BLENDER_VERSION_CHAR a /* alpha/beta/rc/release, docs use this */ #define BLENDER_VERSION_CYCLE release diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index a126f405d09..e44b5d96852 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -88,6 +88,7 @@ typedef struct bNodeType { /* this line is set on startup of blender */ void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); + void (*uifuncbut)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); const char *(*labelfunc)(struct bNode *); void (*initfunc)(struct bNode *); @@ -319,9 +320,10 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMaterial *mat); #define RRES_OUT_REFRACT 12 #define RRES_OUT_INDIRECT 13 #define RRES_OUT_INDEXOB 14 -#define RRES_OUT_MIST 15 -#define RRES_OUT_EMIT 16 -#define RRES_OUT_ENV 17 +#define RRES_OUT_INDEXMA 15 +#define RRES_OUT_MIST 16 +#define RRES_OUT_EMIT 17 +#define RRES_OUT_ENV 18 /* note: types are needed to restore callbacks, don't change values */ #define CMP_NODE_VIEWER 201 diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c index 1543532c8bd..c9b746cec33 100644 --- a/source/blender/blenkernel/intern/BME_tools.c +++ b/source/blender/blenkernel/intern/BME_tools.c @@ -1003,7 +1003,7 @@ static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defg } /* edge pass */ - threshold = (float)cos((angle + 0.00001) * M_PI / 180.0); + threshold = (float)cos((angle + 0.001) * M_PI / 180.0); for (e=bm->edges.first; e; e=e->next) { e->tflag1 = BME_BEVEL_ORIG; weight = 0.0; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index be19275e522..09b705dc37b 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -720,12 +720,13 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i /* note, if you check on layer here, render goes wrong... it still deforms verts and uses parent imat */ if(go->ob!=ob) { - /* Group Dupli Offset, should apply after everything else */ - if (group->dupli_ofs[0] || group->dupli_ofs[1] || group->dupli_ofs[2]) { + /* group dupli offset, should apply after everything else */ + if(!is_zero_v3(group->dupli_ofs)) { copy_m4_m4(tmat, go->ob->obmat); sub_v3_v3v3(tmat[3], tmat[3], group->dupli_ofs); mul_m4_m4m4(mat, tmat, ob->obmat); - } else { + } + else { mul_m4_m4m4(mat, go->ob->obmat, ob->obmat); } @@ -1392,7 +1393,17 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p if(part->ren_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) { for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) { - mul_m4_m4m4(tmat, oblist[b]->obmat, pamat); + + /* group dupli offset, should apply after everything else */ + if(!is_zero_v3(part->dup_group->dupli_ofs)) { + copy_m4_m4(tmat, oblist[b]->obmat); + sub_v3_v3v3(tmat[3], tmat[3], part->dup_group->dupli_ofs); + mul_m4_m4m4(tmat, tmat, pamat); + } + else { + mul_m4_m4m4(tmat, oblist[b]->obmat, pamat); + } + mul_mat3_m4_fl(tmat, size*scale); if(par_space_mat) mul_m4_m4m4(mat, tmat, par_space_mat); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 334f018efc9..2f29074834b 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -867,6 +867,10 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb) if(ma->strand_surfnor > 0.0f) ma->mode_l |= MA_STR_SURFDIFF; + + /* parses the geom+tex nodes */ + if(ma->nodetree && ma->use_nodes) + ntreeShaderGetTexcoMode(ma->nodetree, r_mode, &ma->texco, &ma->mode_l); } static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode, float *amb) @@ -887,8 +891,6 @@ static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode init_render_nodetree((bNodeTree *)node->id, basemat, r_mode, amb); } } - /* parses the geom+tex nodes */ - ntreeShaderGetTexcoMode(ntree, r_mode, &basemat->texco, &basemat->mode_l); } void init_render_material(Material *mat, int r_mode, float *amb) diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 64e374fe4c0..518ee3c341a 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3156,6 +3156,8 @@ static void force_hidden_passes(bNode *node, int passflag) if(!(passflag & SCE_PASS_INDIRECT)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXOB); if(!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL; + sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXMA); + if(!(passflag & SCE_PASS_INDEXMA)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_MIST); if(!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL; sock= BLI_findlink(&node->outputs, RRES_OUT_EMIT); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 451e576979a..2cdb5ecd5d3 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3670,7 +3670,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1); birthtime = pa->time; - dietime = birthtime + pa->lifetime; + dietime = pa->dietime; /* store this, so we can do multiple loops over particles */ pa->state.time = dfra; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 64893bb0b5b..6b92c6e9540 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2124,7 +2124,8 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra { Object *ob; PointCache *cache; - float offset, time, nexttime; + /* float offset; unused for now */ + float time, nexttime; /* TODO: this has to be sorter out once bsystem_time gets redone, */ /* now caches can handle interpolating etc. too - jahka */ @@ -2152,13 +2153,18 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra *startframe= cache->startframe; *endframe= cache->endframe; - // XXX ipoflag is depreceated - old animation system stuff - if (/*(ob->ipoflag & OB_OFFS_PARENT) &&*/ (ob->partype & PARSLOW)==0) { + /* TODO: time handling with object offsets and simulated vs. cached + * particles isn't particularly easy, so for now what you see is what + * you get. In the future point cache could handle the whole particle + * system timing. */ +#if 0 + if ((ob->partype & PARSLOW)==0) { offset= give_timeoffset(ob); *startframe += (int)(offset+0.5f); *endframe += (int)(offset+0.5f); } +#endif } /* verify cached_frames array is up to date */ diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 6ff57b08724..b5bab6f15be 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -39,6 +39,10 @@ #include <math.h> #include "BLI_math_inline.h" +#ifdef __sun__ +#include <ieeefp.h> /* for finite() */ +#endif + #ifndef M_PI #define M_PI 3.14159265358979323846 #endif diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index d0eb3c7d67d..e0c819c2dba 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -98,6 +98,15 @@ extern "C" { typedef unsigned int mode_t; #endif +/* use functions that take a 64 bit offset for files larger than 4GB */ +#ifndef FREE_WINDOWS +#include <stdio.h> +#define fseek(stream, offset, origin) _fseeki64(stream, offset, origin) +#define ftell(stream) _ftelli64(stream) +#define lseek(fd, offset, origin) _lseeki64(fd, offset, origin) +#define tell(fd) _telli64(fd) +#endif + /* mingw using _SSIZE_T_ to declare ssize_t type */ #ifndef _SSIZE_T_ #define _SSIZE_T_ diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index adacf916fc1..993af3cd794 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -430,7 +430,7 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2], l2[1] - l1[1] }; - const float a= dot_v3v3(ldir, ldir); + const float a= dot_v2v2(ldir, ldir); const float b= 2.0f * (ldir[0] * (l1[0] - sp[0]) + diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index af87707fb90..80b85661762 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1024,26 +1024,6 @@ static int get_path_system(char *targetpath, const char *folder_name, const char } } -#if defined(WIN32) && BLENDER_VERSION < 258 - -static int path_have_257_script_install(void) -{ - const int ver= BLENDER_VERSION; - char path[FILE_MAX] = ""; - char system_pyfile[FILE_MAX]; - - if (get_path_user(path, "scripts", NULL, "BLENDER_USER_SCRIPTS", ver)) { - BLI_join_dirfile(system_pyfile, sizeof(system_pyfile), path, "modules/bpy_types.py"); - - if (BLI_exists(system_pyfile)) - return 1; - } - - return 0; -} - -#endif - /* get a folder out of the 'folder_id' presets for paths */ /* returns the path if found, NULL string if not */ char *BLI_get_folder(int folder_id, const char *subfolder) @@ -1076,20 +1056,7 @@ char *BLI_get_folder(int folder_id, const char *subfolder) return NULL; case BLENDER_USER_SCRIPTS: -#if defined(WIN32) && BLENDER_VERSION < 258 - /* if we have a 2.57 installation, then we may have system script - * files in the user configuration folder. avoid using that folder - * if they are there, until the version gets bumped to 2.58, so - * we can be sure that folder only has addons etc. */ - if (path_have_257_script_install()) { - if (get_path_local(path, "scripts", subfolder, ver)) break; - } - else -#endif - { - if (get_path_user(path, "scripts", subfolder, "BLENDER_USER_SCRIPTS", ver)) break; - } - + if (get_path_user(path, "scripts", subfolder, "BLENDER_USER_SCRIPTS", ver)) break; return NULL; case BLENDER_SYSTEM_SCRIPTS: diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index e9db148e992..41eedef8835 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -478,7 +478,7 @@ LinkNode *BLI_read_file_as_lines(const char *name) FILE *fp= fopen(name, "r"); LinkNode *lines= NULL; char *buf; - int size; + int64_t size; if (!fp) return NULL; diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c index d139fb1ab71..be7682a63d4 100644 --- a/source/blender/blenlib/intern/uvproject.c +++ b/source/blender/blenlib/intern/uvproject.c @@ -70,7 +70,7 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci) vec2d[0]= pv4[0]; vec2d[1]= pv4[2]; target[0]= angle * ((float)M_PI / uci->camangle); - target[1]= pv4[1] / (len_v2(vec2d) * uci->camsize); + target[1]= pv4[1] / (len_v2(vec2d) * (uci->camsize * 2.0f)); } } else { @@ -146,7 +146,11 @@ UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, fl uci.camangle= lens_to_angle(camera->lens) / 2.0f; uci.camsize= uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale; - if (invert_m4_m4(uci.caminv, ob->obmat)) { + /* account for scaled cameras */ + copy_m4_m4(uci.caminv, ob->obmat); + normalize_m4(uci.caminv); + + if (invert_m4(uci.caminv)) { UvCameraInfo *uci_pt; /* normal projection */ @@ -169,8 +173,8 @@ UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, fl } /* include 0.5f here to move the UVs into the center */ - uci.shiftx = 0.5f - camera->shiftx; - uci.shifty = 0.5f - camera->shifty; + uci.shiftx = 0.5f - (camera->shiftx * uci.xasp); + uci.shifty = 0.5f - (camera->shifty * uci.yasp); uci_pt= MEM_mallocN(sizeof(UvCameraInfo), "UvCameraInfo"); *uci_pt= uci; diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 90c3cfbb001..ad9098db3d8 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -89,14 +89,14 @@ void ArmatureExporter::add_instance_controller(Object *ob) ins.add(); } -void ArmatureExporter::export_controllers(Scene *sce) +void ArmatureExporter::export_controllers(Scene *sce, bool export_selected) { scene = sce; openLibrary(); GeometryFunctor gf; - gf.forEachMeshObjectInScene<ArmatureExporter>(sce, *this); + gf.forEachMeshObjectInScene<ArmatureExporter>(sce, *this, export_selected); closeLibrary(); } @@ -351,12 +351,17 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase bPoseChannel *pchan = get_pose_channel(pose, def->name); + float pose_mat[4][4]; float mat[4][4]; float world[4][4]; float inv_bind_mat[4][4]; + // pose_mat is the same as pchan->pose_mat, but without the rotation + unit_m4(pose_mat); + translate_m4(pose_mat, pchan->pose_head[0], pchan->pose_head[1], pchan->pose_head[2]); + // make world-space matrix, pose_mat is armature-space - mul_m4_m4m4(world, pchan->pose_mat, ob_arm->obmat); + mul_m4_m4m4(world, pose_mat, ob_arm->obmat); invert_m4_m4(mat, world); converter.mat4_to_dae(inv_bind_mat, mat); diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h index f72e5244a36..f4488942f7b 100644 --- a/source/blender/collada/ArmatureExporter.h +++ b/source/blender/collada/ArmatureExporter.h @@ -65,7 +65,7 @@ public: void add_instance_controller(Object *ob); - void export_controllers(Scene *sce); + void export_controllers(Scene *sce, bool export_selected); void operator()(Object *ob); diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp index f8fa0fd55c0..6ce9eb782d3 100644 --- a/source/blender/collada/CameraExporter.cpp +++ b/source/blender/collada/CameraExporter.cpp @@ -42,24 +42,25 @@ CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryCameras(sw){} template<class Functor> -void forEachCameraObjectInScene(Scene *sce, Functor &f) +void forEachCameraObjectInScene(Scene *sce, Functor &f, bool export_selected) { Base *base= (Base*) sce->base.first; while(base) { Object *ob = base->object; - if (ob->type == OB_CAMERA && ob->data) { + if (ob->type == OB_CAMERA && ob->data + && !(export_selected && !(ob->flag & SELECT))) { f(ob, sce); } base= base->next; } } -void CamerasExporter::exportCameras(Scene *sce) +void CamerasExporter::exportCameras(Scene *sce, bool export_selected) { openLibrary(); - forEachCameraObjectInScene(sce, *this); + forEachCameraObjectInScene(sce, *this, export_selected); closeLibrary(); } diff --git a/source/blender/collada/CameraExporter.h b/source/blender/collada/CameraExporter.h index 922eaf6b1d0..999a6ddd3e5 100644 --- a/source/blender/collada/CameraExporter.h +++ b/source/blender/collada/CameraExporter.h @@ -40,7 +40,7 @@ class CamerasExporter: COLLADASW::LibraryCameras { public: CamerasExporter(COLLADASW::StreamWriter *sw); - void exportCameras(Scene *sce); + void exportCameras(Scene *sce, bool export_selected); void operator()(Object *ob, Scene *sce); }; diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 00daac60281..e6e0953680c 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -170,7 +170,7 @@ public: SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm) : COLLADASW::LibraryVisualScenes(sw), arm_exporter(arm) {} - void exportScene(Scene *sce) { + void exportScene(Scene *sce, bool export_selected) { // <library_visual_scenes> <visual_scene> std::string id_naming = id_name(sce); openVisualScene(translate_id(id_naming), id_naming); @@ -179,7 +179,7 @@ public: //forEachMeshObjectInScene(sce, *this); //forEachCameraObjectInScene(sce, *this); //forEachLampObjectInScene(sce, *this); - exportHierarchy(sce); + exportHierarchy(sce, export_selected); // </visual_scene> </library_visual_scenes> closeVisualScene(); @@ -187,7 +187,7 @@ public: closeLibrary(); } - void exportHierarchy(Scene *sce) + void exportHierarchy(Scene *sce, bool export_selected) { Base *base= (Base*) sce->base.first; while(base) { @@ -198,8 +198,11 @@ public: case OB_MESH: case OB_CAMERA: case OB_LAMP: - case OB_EMPTY: case OB_ARMATURE: + case OB_EMPTY: + if (export_selected && !(ob->flag & SELECT)) { + break; + } // write nodes.... writeNodes(ob, sce); break; @@ -929,7 +932,7 @@ protected: } }; -void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename) +void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool selected) { PointerRNA sceneptr, unit_settings; PropertyRNA *system; /* unused , *scale; */ @@ -1011,31 +1014,31 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename) // <library_cameras> if(has_object_type(sce, OB_CAMERA)) { CamerasExporter ce(&sw); - ce.exportCameras(sce); + ce.exportCameras(sce, selected); } // <library_lights> if(has_object_type(sce, OB_LAMP)) { LightsExporter le(&sw); - le.exportLights(sce); + le.exportLights(sce, selected); } // <library_images> ImagesExporter ie(&sw, filename); - ie.exportImages(sce); + ie.exportImages(sce, selected); // <library_effects> EffectsExporter ee(&sw); - ee.exportEffects(sce); + ee.exportEffects(sce, selected); // <library_materials> MaterialsExporter me(&sw); - me.exportMaterials(sce); + me.exportMaterials(sce, selected); // <library_geometries> if(has_object_type(sce, OB_MESH)) { GeometryExporter ge(&sw); - ge.exportGeom(sce); + ge.exportGeom(sce, selected); } // <library_animations> @@ -1045,12 +1048,12 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename) // <library_controllers> ArmatureExporter arm_exporter(&sw); if(has_object_type(sce, OB_ARMATURE)) { - arm_exporter.export_controllers(sce); + arm_exporter.export_controllers(sce, selected); } // <library_visual_scenes> SceneExporter se(&sw, &arm_exporter); - se.exportScene(sce); + se.exportScene(sce, selected); // <scene> std::string scene_name(translate_id(id_name(sce))); diff --git a/source/blender/collada/DocumentExporter.h b/source/blender/collada/DocumentExporter.h index 9d6d2114cd8..923313c4ed9 100644 --- a/source/blender/collada/DocumentExporter.h +++ b/source/blender/collada/DocumentExporter.h @@ -34,7 +34,7 @@ struct Scene; class DocumentExporter { public: - void exportCurrentScene(Scene *sce, const char* filename); + void exportCurrentScene(Scene *sce, const char* filename, bool selected); void exportScenes(const char* filename); }; diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index 74756859d3b..f51330165f3 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -78,12 +78,12 @@ bool EffectsExporter::hasEffects(Scene *sce) return false; } -void EffectsExporter::exportEffects(Scene *sce) +void EffectsExporter::exportEffects(Scene *sce, bool export_selected) { if(hasEffects(sce)) { openLibrary(); MaterialFunctor mf; - mf.forEachMaterialInScene<EffectsExporter>(sce, *this); + mf.forEachMaterialInScene<EffectsExporter>(sce, *this, export_selected); closeLibrary(); } diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h index 2b25d1b889f..86143ae4d07 100644 --- a/source/blender/collada/EffectExporter.h +++ b/source/blender/collada/EffectExporter.h @@ -47,7 +47,7 @@ class EffectsExporter: COLLADASW::LibraryEffects { public: EffectsExporter(COLLADASW::StreamWriter *sw); - void exportEffects(Scene *sce); + void exportEffects(Scene *sce, bool export_selected); void operator()(Material *ma, Object *ob); diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index 5df5ab99b91..b724844b1ec 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -47,13 +47,13 @@ GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryGeometries(sw) {} -void GeometryExporter::exportGeom(Scene *sce) +void GeometryExporter::exportGeom(Scene *sce, bool export_selected) { openLibrary(); mScene = sce; GeometryFunctor gf; - gf.forEachMeshObjectInScene<GeometryExporter>(sce, *this); + gf.forEachMeshObjectInScene<GeometryExporter>(sce, *this, export_selected); closeLibrary(); } diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h index 0b9abaebc25..7f3426a1915 100644 --- a/source/blender/collada/GeometryExporter.h +++ b/source/blender/collada/GeometryExporter.h @@ -60,7 +60,7 @@ class GeometryExporter : COLLADASW::LibraryGeometries public: GeometryExporter(COLLADASW::StreamWriter *sw); - void exportGeom(Scene *sce); + void exportGeom(Scene *sce, bool export_selected); void operator()(Object *ob); @@ -102,14 +102,15 @@ struct GeometryFunctor { // f should have // void operator()(Object* ob) template<class Functor> - void forEachMeshObjectInScene(Scene *sce, Functor &f) + void forEachMeshObjectInScene(Scene *sce, Functor &f, bool export_selected) { Base *base= (Base*) sce->base.first; while(base) { Object *ob = base->object; - if (ob->type == OB_MESH && ob->data) { + if (ob->type == OB_MESH && ob->data + && !(export_selected && !(ob->flag && SELECT))) { f(ob); } base= base->next; diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index b7a5ef4c4e4..8e426e9dba8 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -71,12 +71,12 @@ bool ImagesExporter::hasImages(Scene *sce) return false; } -void ImagesExporter::exportImages(Scene *sce) +void ImagesExporter::exportImages(Scene *sce, bool export_selected) { if(hasImages(sce)) { openLibrary(); MaterialFunctor mf; - mf.forEachMaterialInScene<ImagesExporter>(sce, *this); + mf.forEachMaterialInScene<ImagesExporter>(sce, *this, export_selected); closeLibrary(); } diff --git a/source/blender/collada/ImageExporter.h b/source/blender/collada/ImageExporter.h index 04e3010dc7a..6b81c099259 100644 --- a/source/blender/collada/ImageExporter.h +++ b/source/blender/collada/ImageExporter.h @@ -47,7 +47,7 @@ class ImagesExporter: COLLADASW::LibraryImages public: ImagesExporter(COLLADASW::StreamWriter *sw, const char* filename); - void exportImages(Scene *sce); + void exportImages(Scene *sce, bool export_selected); void operator()(Material *ma, Object *ob); private: bool hasImages(Scene *sce); diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp index 13eb62ca969..c2cc0c1e157 100644 --- a/source/blender/collada/LightExporter.cpp +++ b/source/blender/collada/LightExporter.cpp @@ -38,13 +38,14 @@ #include "collada_internal.h" template<class Functor> -void forEachLampObjectInScene(Scene *sce, Functor &f) +void forEachLampObjectInScene(Scene *sce, Functor &f, bool export_selected) { Base *base= (Base*) sce->base.first; while(base) { Object *ob = base->object; - if (ob->type == OB_LAMP && ob->data) { + if (ob->type == OB_LAMP && ob->data + && !(export_selected && !(ob->flag & SELECT))) { f(ob); } base= base->next; @@ -53,11 +54,11 @@ void forEachLampObjectInScene(Scene *sce, Functor &f) LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryLights(sw){} -void LightsExporter::exportLights(Scene *sce) +void LightsExporter::exportLights(Scene *sce, bool export_selected) { openLibrary(); - forEachLampObjectInScene(sce, *this); + forEachLampObjectInScene(sce, *this, export_selected); closeLibrary(); } diff --git a/source/blender/collada/LightExporter.h b/source/blender/collada/LightExporter.h index 3706582e52c..2ae1a19fdb1 100644 --- a/source/blender/collada/LightExporter.h +++ b/source/blender/collada/LightExporter.h @@ -41,7 +41,7 @@ class LightsExporter: COLLADASW::LibraryLights { public: LightsExporter(COLLADASW::StreamWriter *sw); - void exportLights(Scene *sce); + void exportLights(Scene *sce, bool export_selected); void operator()(Object *ob); private: bool exportBlenderProfile(COLLADASW::Light &cla, Lamp *la); diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp index 0030f2a6285..a44fa6802f2 100644 --- a/source/blender/collada/MaterialExporter.cpp +++ b/source/blender/collada/MaterialExporter.cpp @@ -35,12 +35,12 @@ MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryMaterials(sw){} -void MaterialsExporter::exportMaterials(Scene *sce) +void MaterialsExporter::exportMaterials(Scene *sce, bool export_selected) { openLibrary(); MaterialFunctor mf; - mf.forEachMaterialInScene<MaterialsExporter>(sce, *this); + mf.forEachMaterialInScene<MaterialsExporter>(sce, *this, export_selected); closeLibrary(); } diff --git a/source/blender/collada/MaterialExporter.h b/source/blender/collada/MaterialExporter.h index 033c8526346..0a7a276d857 100644 --- a/source/blender/collada/MaterialExporter.h +++ b/source/blender/collada/MaterialExporter.h @@ -49,7 +49,7 @@ class MaterialsExporter: COLLADASW::LibraryMaterials { public: MaterialsExporter(COLLADASW::StreamWriter *sw); - void exportMaterials(Scene *sce); + void exportMaterials(Scene *sce, bool export_selected); void operator()(Material *ma, Object *ob); }; @@ -86,11 +86,11 @@ struct MaterialFunctor { // f should have // void operator()(Material* ma) template<class Functor> - void forEachMaterialInScene(Scene *sce, Functor &f) + void forEachMaterialInScene(Scene *sce, Functor &f, bool export_selected) { ForEachMaterialFunctor<Functor> matfunc(&f); GeometryFunctor gf; - gf.forEachMeshObjectInScene<ForEachMaterialFunctor<Functor> >(sce, matfunc); + gf.forEachMeshObjectInScene<ForEachMaterialFunctor<Functor> >(sce, matfunc, export_selected); } }; diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index d1977d15fb2..760fb2359a4 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -144,15 +144,18 @@ void WVDataWrapper::print() } #endif -void UVDataWrapper::getUV(int uv_index[2], float *uv) +void UVDataWrapper::getUV(int uv_index, float *uv) { + int stride = mVData->getStride(0); + if(stride==0) stride = 2; + switch(mVData->getType()) { case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT: { COLLADAFW::ArrayPrimitiveType<float>* values = mVData->getFloatValues(); if (values->empty()) return; - uv[0] = (*values)[uv_index[0]]; - uv[1] = (*values)[uv_index[1]]; + uv[0] = (*values)[uv_index*stride]; + uv[1] = (*values)[uv_index*stride + 1]; } break; @@ -160,8 +163,8 @@ void UVDataWrapper::getUV(int uv_index[2], float *uv) { COLLADAFW::ArrayPrimitiveType<double>* values = mVData->getDoubleValues(); if (values->empty()) return; - uv[0] = (float)(*values)[uv_index[0]]; - uv[1] = (float)(*values)[uv_index[1]]; + uv[0] = (float)(*values)[uv_index*stride]; + uv[1] = (float)(*values)[uv_index*stride + 1]; } break; @@ -197,54 +200,36 @@ void MeshImporter::rotate_face_indices(MFace *mface) { void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs, COLLADAFW::IndexList& index_list, unsigned int *tris_indices) { - int uv_indices[4][2]; - // per face vertex indices, this means for quad we have 4 indices, not 8 COLLADAFW::UIntValuesArray& indices = index_list.getIndices(); - // make indices into FloatOrDoubleArray - for (int i = 0; i < 3; i++) { - int uv_index = indices[tris_indices[i]]; - uv_indices[i][0] = uv_index * 2; - uv_indices[i][1] = uv_index * 2 + 1; - } - - uvs.getUV(uv_indices[0], mtface->uv[0]); - uvs.getUV(uv_indices[1], mtface->uv[1]); - uvs.getUV(uv_indices[2], mtface->uv[2]); + uvs.getUV(indices[tris_indices[0]], mtface->uv[0]); + uvs.getUV(indices[tris_indices[1]], mtface->uv[1]); + uvs.getUV(indices[tris_indices[2]], mtface->uv[2]); } void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs, COLLADAFW::IndexList& index_list, int index, bool quad) { - int uv_indices[4][2]; - // per face vertex indices, this means for quad we have 4 indices, not 8 COLLADAFW::UIntValuesArray& indices = index_list.getIndices(); - // make indices into FloatOrDoubleArray - for (int i = 0; i < (quad ? 4 : 3); i++) { - int uv_index = indices[index + i]; - uv_indices[i][0] = uv_index * 2; - uv_indices[i][1] = uv_index * 2 + 1; - } - - uvs.getUV(uv_indices[0], mtface->uv[0]); - uvs.getUV(uv_indices[1], mtface->uv[1]); - uvs.getUV(uv_indices[2], mtface->uv[2]); + uvs.getUV(indices[index + 0], mtface->uv[0]); + uvs.getUV(indices[index + 1], mtface->uv[1]); + uvs.getUV(indices[index + 2], mtface->uv[2]); - if (quad) uvs.getUV(uv_indices[3], mtface->uv[3]); + if (quad) uvs.getUV(indices[index + 3], mtface->uv[3]); #ifdef COLLADA_DEBUG /*if (quad) { fprintf(stderr, "face uv:\n" - "((%d, %d), (%d, %d), (%d, %d), (%d, %d))\n" + "((%d, %d, %d, %d))\n" "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n", - uv_indices[0][0], uv_indices[0][1], - uv_indices[1][0], uv_indices[1][1], - uv_indices[2][0], uv_indices[2][1], - uv_indices[3][0], uv_indices[3][1], + indices[index + 0], + indices[index + 1], + indices[index + 2], + indices[index + 3], mtface->uv[0][0], mtface->uv[0][1], mtface->uv[1][0], mtface->uv[1][1], @@ -253,12 +238,12 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs, } else { fprintf(stderr, "face uv:\n" - "((%d, %d), (%d, %d), (%d, %d))\n" + "((%d, %d, %d))\n" "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n", - uv_indices[0][0], uv_indices[0][1], - uv_indices[1][0], uv_indices[1][1], - uv_indices[2][0], uv_indices[2][1], + indices[index + 0], + indices[index + 1], + indices[index + 2], mtface->uv[0][0], mtface->uv[0][1], mtface->uv[1][0], mtface->uv[1][1], diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h index 20fdb0dcc6e..88ee0e46c33 100644 --- a/source/blender/collada/MeshImporter.h +++ b/source/blender/collada/MeshImporter.h @@ -69,7 +69,7 @@ public: void print(); #endif - void getUV(int uv_index[2], float *uv); + void getUV(int uv_index, float *uv); }; class MeshImporter : public MeshImporterBase diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index 51caf62f6e7..c15e608c360 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -51,7 +51,7 @@ extern "C" return 1; } - int collada_export(Scene *sce, const char *filepath) + int collada_export(Scene *sce, const char *filepath, int selected) { DocumentExporter exp; @@ -64,7 +64,7 @@ extern "C" } /* end! */ - exp.exportCurrentScene(sce, filepath); + exp.exportCurrentScene(sce, filepath, selected); return 1; } diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h index a167784e217..915a77354e3 100644 --- a/source/blender/collada/collada.h +++ b/source/blender/collada/collada.h @@ -39,7 +39,7 @@ extern "C" { * both return 1 on success, 0 on error */ int collada_import(bContext *C, const char *filepath); - int collada_export(Scene *sce, const char *filepath); + int collada_export(Scene *sce, const char *filepath, int selected); #ifdef __cplusplus } #endif diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp index 9cb6a227fc9..27397c3008e 100644 --- a/source/blender/collada/collada_internal.cpp +++ b/source/blender/collada/collada_internal.cpp @@ -265,7 +265,7 @@ std::string get_light_id(Object *ob) std::string get_joint_id(Bone *bone, Object *ob_arm) { - return translate_id(bone->name); + return translate_id(/*id_name(ob_arm) + "_" +*/ bone->name); } std::string get_camera_id(Object *ob) diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index c6e55427034..b3338396598 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -50,6 +50,7 @@ #include "BKE_main.h" #include "BKE_report.h" #include "BKE_scene.h" +#include "BKE_screen.h" #include "WM_api.h" #include "WM_types.h" @@ -1416,7 +1417,9 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot) static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op)) { + bScreen *sc= CTX_wm_screen(C); Scene *scene= CTX_data_scene(C); + Object *ob = CTX_data_active_object(C); ListBase *markers= ED_context_get_markers(C); TimeMarker *marker; @@ -1424,10 +1427,15 @@ static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op)) if(marker == NULL) return OPERATOR_CANCELLED; - marker->camera= scene->camera; + marker->camera= ob; + + /* camera may have changes */ + scene_camera_switch_update(scene); + BKE_screen_view3d_scene_sync(sc); WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL); + WM_event_add_notifier(C, NC_SCENE|NA_EDITED, scene); /* so we get view3d redraws */ return OPERATOR_FINISHED; } diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 284bbb2f3de..bfca5453bc5 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3535,6 +3535,11 @@ static int convertspline(short type, Nurb *nu) return 0; } +void ED_nurb_set_spline_type(Nurb *nu, int type) +{ + convertspline(type, nu); +} + static int set_spline_type_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 6a92ee2e056..d78d2846572 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -71,6 +71,7 @@ int mouse_nurb (struct bContext *C, const int mval[2], int extend); struct Nurb *add_nurbs_primitive(struct bContext *C, float mat[4][4], int type, int newob); int isNurbsel (struct Nurb *nu); +void ED_nurb_set_spline_type(struct Nurb *nu, int type); int join_curve_exec (struct bContext *C, struct wmOperator *op); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 30c0f552b72..8aed0d58a07 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -74,8 +74,8 @@ #define MENU_ITEM_HEIGHT 20 #define MENU_SEP_HEIGHT 6 -#define PRECISION_FLOAT_MAX 7 -#define PRECISION_FLOAT_MAX_POW 10000000 /* pow(10, PRECISION_FLOAT_MAX) */ +#define PRECISION_FLOAT_MAX 6 +#define PRECISION_FLOAT_MAX_POW 1000000 /* pow(10, PRECISION_FLOAT_MAX) */ /* avoid unneeded calls to ui_get_but_val */ #define UI_BUT_VALUE_UNSET DBL_MAX diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 99a31e039c8..e9ec4ccc66d 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1895,7 +1895,15 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } if(event->ascii && (retval == WM_UI_HANDLER_CONTINUE)) { - changed= ui_textedit_type_ascii(but, data, event->ascii); + char ascii = event->ascii; + + /* exception that's useful for number buttons, some keyboard + numpads have a comma instead of a period */ + if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) + if(event->type == PADPERIOD && ascii == ',') + ascii = '.'; + + changed= ui_textedit_type_ascii(but, data, ascii); retval= WM_UI_HANDLER_BREAK; } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 32a20e82d2f..25dbb68a258 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -33,6 +33,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_key_types.h" #include "DNA_scene_types.h" #include "DNA_userdef_types.h" @@ -2104,6 +2105,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe } else if(itemptr->type == &RNA_ShapeKey) { Object *ob= (Object*)activeptr->data; + Key *key= (Key*)itemptr->data; split= uiLayoutSplit(sub, 0.75f, 0); @@ -2111,7 +2113,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe uiBlockSetEmboss(block, UI_EMBOSSN); row= uiLayoutRow(split, 1); - if(i == 0) uiItemL(row, "", ICON_NONE); + if(i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE); else uiItemR(row, itemptr, "value", 0, "", ICON_NONE); if(ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index d89856b4268..e9702af070c 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -402,6 +402,8 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M { ModifierTypeInfo *mti= modifierType_getInfo(md->type); + md->scene= scene; + if (mti->isDisabled && mti->isDisabled(md, 0)) { BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply"); return 0; @@ -461,6 +463,8 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, { ModifierTypeInfo *mti= modifierType_getInfo(md->type); + md->scene= scene; + if (mti->isDisabled && mti->isDisabled(md, 0)) { BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply"); return 0; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index bf21c4c0f62..c5ddcf2b229 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1659,6 +1659,7 @@ void ED_object_single_users(Main *bmain, Scene *scene, int full) if(full) { single_obdata_users(bmain, scene, 0); + single_object_action_users(scene, 0); single_mat_users_expand(bmain); single_tex_users_expand(bmain); } diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 18703bcec6a..48963d9f5db 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -827,6 +827,8 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys if(key->flag & PEK_TAG) mkey->flag |= PEK_TAG; + + mkey->length = key->length; } if(point->flag & PEP_TAG) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index a55f9101a0f..3256112426b 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -438,8 +438,6 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock); if(ibuf) { - short ibuf_free= FALSE; - /* color -> greyscale */ /* editing directly would alter the render view */ if(scene->r.planes == 8) { @@ -447,8 +445,15 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) IMB_color_to_bw(ibuf_bw); // IMB_freeImBuf(ibuf); /* owned by the image */ ibuf= ibuf_bw; - - ibuf_free= TRUE; + } + else { + /* this is lightweight & doesnt re-alloc the buffers, only do this + * to save the correct bit depth since the image is always RGBA */ + ImBuf *ibuf_cpy= IMB_allocImBuf(ibuf->x, ibuf->y, scene->r.planes, 0); + ibuf_cpy->rect= ibuf->rect; + ibuf_cpy->rect_float= ibuf->rect_float; + ibuf_cpy->zbuf_float= ibuf->zbuf_float; + ibuf= ibuf_cpy; } if(BKE_imtype_is_movie(scene->r.imtype)) { @@ -472,9 +477,8 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) } } - if(ibuf_free) { - IMB_freeImBuf(ibuf); - } + /* imbuf knows which rects are not part of ibuf */ + IMB_freeImBuf(ibuf); } BKE_image_release_ibuf(oglrender->ima, lock); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 17cfc7d8f95..1bf2c3d89bd 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -423,6 +423,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA * /* only once called */ static void node_shader_set_butfunc(bNodeType *ntype) { + ntype->uifuncbut = NULL; switch(ntype->type) { /* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */ @@ -472,6 +473,7 @@ static void node_shader_set_butfunc(bNodeType *ntype) default: ntype->uifunc= NULL; } + if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc; } /* ****************** BUTTON CALLBACKS FOR COMPOSITE NODES ***************** */ @@ -1036,6 +1038,32 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C } } +static void node_composit_buts_colorbalance_but(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "correction_method", 0, NULL, ICON_NONE); + + if (RNA_enum_get(ptr, "correction_method")== 0) { + + uiTemplateColorWheel(layout, ptr, "lift", 1, 1, 0, 1); + uiItemR(layout, ptr, "lift", 0, NULL, ICON_NONE); + + uiTemplateColorWheel(layout, ptr, "gamma", 1, 1, 1, 1); + uiItemR(layout, ptr, "gamma", 0, NULL, ICON_NONE); + + uiTemplateColorWheel(layout, ptr, "gain", 1, 1, 1, 1); + uiItemR(layout, ptr, "gain", 0, NULL, ICON_NONE); + } else { + uiTemplateColorWheel(layout, ptr, "offset", 1, 1, 0, 1); + uiItemR(layout, ptr, "offset", 0, NULL, ICON_NONE); + + uiTemplateColorWheel(layout, ptr, "power", 1, 1, 0, 1); + uiItemR(layout, ptr, "power", 0, NULL, ICON_NONE); + + uiTemplateColorWheel(layout, ptr, "slope", 1, 1, 0, 1); + uiItemR(layout, ptr, "slope", 0, NULL, ICON_NONE); + } +} + static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { @@ -1050,6 +1078,7 @@ static void node_composit_buts_ycc(uiLayout *layout, bContext *UNUSED(C), Pointe /* only once called */ static void node_composit_set_butfunc(bNodeType *ntype) { + ntype->uifuncbut = NULL; switch(ntype->type) { /* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */ @@ -1184,6 +1213,7 @@ static void node_composit_set_butfunc(bNodeType *ntype) break; case CMP_NODE_COLORBALANCE: ntype->uifunc=node_composit_buts_colorbalance; + ntype->uifuncbut=node_composit_buts_colorbalance_but; break; case CMP_NODE_HUECORRECT: ntype->uifunc=node_composit_buts_huecorrect; @@ -1198,6 +1228,8 @@ static void node_composit_set_butfunc(bNodeType *ntype) default: ntype->uifunc= NULL; } + if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc; + } /* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */ @@ -1308,6 +1340,7 @@ static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), Poin /* only once called */ static void node_texture_set_butfunc(bNodeType *ntype) { + ntype->uifuncbut = NULL; if( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) { ntype->uifunc = node_texture_buts_proc; } @@ -1352,6 +1385,7 @@ static void node_texture_set_butfunc(bNodeType *ntype) default: ntype->uifunc= NULL; } + if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc; } /* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */ diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 684961f2606..4b989a78fab 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -118,8 +118,8 @@ static void active_node_panel(const bContext *C, Panel *pa) uiItemS(layout); /* draw this node's settings */ - if (node->typeinfo && node->typeinfo->uifunc) - node->typeinfo->uifunc(layout, (bContext *)C, &ptr); + if (node->typeinfo && node->typeinfo->uifuncbut) + node->typeinfo->uifuncbut(layout, (bContext *)C, &ptr); } /* ******************* node buttons registration ************** */ diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 0ce6b5d2ce2..93dc96cf9c0 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -480,6 +480,10 @@ static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, Sc te->name= "Index Object"; te->directdata= &srl->passflag; + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXMA)); + te->name= "Index Material"; + te->directdata= &srl->passflag; + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_RGBA)); te->name= "Color"; te->directdata= &srl->passflag; @@ -4902,7 +4906,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio outliner_draw_selection(ar, soops, &soops->tree, &starty); // grey hierarchy lines - UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.2f); + UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.4f); starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y/2-OL_Y_OFFSET; startx= 6; outliner_draw_hierarchy(soops, &soops->tree, startx, &starty); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 119c5da309e..594d2942e8f 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -643,10 +643,12 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline if (G.moving && (seq->flag & SELECT)) { if(seq->flag & SEQ_OVERLAP) { col[0]= 255; col[1]= col[2]= 40; - } else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120); + } + else + UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120+outline_tint); } - - UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint); + else + UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint); glColor3ubv((GLubyte *)col); @@ -969,7 +971,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) /* loop through strips, checking for those that are visible */ for (seq= ed->seqbasep->first; seq; seq= seq->next) { /* boundbox and selection tests for NOT drawing the strip... */ - if ((seq->flag & SELECT) == sel) continue; + if ((seq->flag & SELECT) != sel) continue; else if (seq == last_seq) continue; else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue; else if (MAX2(seq->enddisp, seq->start+seq->len) < v2d->cur.xmin) continue; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index c8965c4d3db..b7a7b6b5412 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -124,6 +124,7 @@ typedef struct TransSeq { int startstill, endstill; int startdisp, enddisp; int startofs, endofs; + int anim_startofs, anim_endofs; /* int final_left, final_right; */ /* UNUSED */ int len; } TransSeq; @@ -729,8 +730,10 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) ts.endstill= seq->endstill; ts.startdisp= seq->startdisp; ts.enddisp= seq->enddisp; - ts.startofs= seq->anim_startofs; - ts.endofs= seq->anim_endofs; + ts.startofs= seq->startofs; + ts.endofs= seq->endofs; + ts.anim_startofs= seq->anim_startofs; + ts.anim_endofs= seq->anim_endofs; ts.len= seq->len; /* First Strip! */ @@ -780,7 +783,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) if ((seqn->startstill) && (cutframe == seqn->start + 1)) { seqn->start = ts.start; seqn->startstill= ts.start- cutframe; - seqn->anim_endofs = ts.endofs; + seqn->anim_endofs = ts.anim_endofs; seqn->endstill = ts.endstill; } @@ -789,8 +792,9 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) seqn->start = cutframe; seqn->startstill = 0; seqn->startofs = 0; + seqn->endofs = ts.endofs; seqn->anim_startofs += cutframe - ts.start; - seqn->anim_endofs = ts.endofs; + seqn->anim_endofs = ts.anim_endofs; seqn->endstill = ts.endstill; } @@ -825,6 +829,8 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) ts.enddisp= seq->enddisp; ts.startofs= seq->startofs; ts.endofs= seq->endofs; + ts.anim_startofs= seq->anim_startofs; + ts.anim_endofs= seq->anim_endofs; ts.len= seq->len; /* First Strip! */ @@ -1778,19 +1784,21 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) /* new seq */ se = give_stripelem(seq, cfra); - seq_new= alloc_sequence(ed->seqbasep, start_ofs, seq->machine); + seq_new= seq_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME); + BLI_addtail(&ed->seqbase, seq_new); + + seq_new->start= start_ofs; seq_new->type= SEQ_IMAGE; seq_new->len = 1; seq_new->endstill = step-1; /* new strip */ - seq_new->strip= strip_new= MEM_callocN(sizeof(Strip)*1, "strip"); + strip_new= seq_new->strip; strip_new->len= 1; strip_new->us= 1; - strncpy(strip_new->dir, seq->strip->dir, FILE_MAXDIR-1); /* new stripdata */ - strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem"); + se_new= strip_new->stripdata; BLI_strncpy(se_new->name, se->name, sizeof(se_new->name)); calc_sequence(scene, seq_new); @@ -1802,8 +1810,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) } /* XXX, COPY FCURVES */ - strncpy(seq_new->name+2, seq->name+2, sizeof(seq->name)-2); - seqbase_unique_name_recursive(&scene->ed->seqbase, seq_new); cfra++; start_ofs += step; diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 02a7ea890f5..ad621257602 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -197,8 +197,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag) case PCHAN_COLOR_CONSTS: { if ( (bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS) ) { - if (constflag & PCHAN_HAS_STRIDE) glColor4ub(0, 0, 200, 80); - else if (constflag & PCHAN_HAS_TARGET) glColor4ub(255, 150, 0, 80); + if (constflag & PCHAN_HAS_TARGET) glColor4ub(255, 150, 0, 80); else if (constflag & PCHAN_HAS_IK) glColor4ub(255, 255, 0, 80); else if (constflag & PCHAN_HAS_SPLINEIK) glColor4ub(200, 255, 0, 80); else if (constflag & PCHAN_HAS_CONST) glColor4ub(0, 255, 120, 80); @@ -269,8 +268,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag) { /* inner part in background color or constraint */ if ( (constflag) && ((bcolor==NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS)) ) { - if (constflag & PCHAN_HAS_STRIDE) glColor3ub(0, 0, 200); - else if (constflag & PCHAN_HAS_TARGET) glColor3ub(255, 150, 0); + if (constflag & PCHAN_HAS_TARGET) glColor3ub(255, 150, 0); else if (constflag & PCHAN_HAS_IK) glColor3ub(255, 255, 0); else if (constflag & PCHAN_HAS_SPLINEIK) glColor3ub(200, 255, 0); else if (constflag & PCHAN_HAS_CONST) glColor3ub(0, 255, 120); @@ -1865,9 +1863,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, constflag= pchan->constflag; if (pchan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE)) constflag |= PCHAN_HAS_ACTION; - if (pchan->flag & POSE_STRIDE) - constflag |= PCHAN_HAS_STRIDE; - + /* set color-set to use */ set_pchan_colorset(ob, pchan); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index f228653aa79..fa1fcb6c150 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -5407,7 +5407,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, void initTimeTranslate(TransInfo *t) { /* this tool is only really available in the Action Editor... */ - if (t->spacetype != SPACE_ACTION) { + if (!ELEM(t->spacetype, SPACE_ACTION, SPACE_SEQ)) { t->state = TRANS_CANCEL; } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index e9bced385c4..8e72f3405a3 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -699,7 +699,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob) for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { bone = pchan->bone; if (PBONE_VISIBLE(arm, bone)) { - if ((bone->flag & BONE_SELECTED) && !(ob->proxy && pchan->bone->layer & arm->layer_protected)) + if ((bone->flag & BONE_SELECTED)) bone->flag |= BONE_TRANSFORM; else bone->flag &= ~BONE_TRANSFORM; diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 31a7194ea02..218e90af717 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -279,6 +279,7 @@ int calc_manipulator_stats(const bContext *C) ARegion *ar= CTX_wm_region(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); + ToolSettings *ts = CTX_data_tool_settings(C); View3D *v3d= sa->spacedata.first; RegionView3D *rv3d= ar->regiondata; Base *base; @@ -312,6 +313,7 @@ int calc_manipulator_stats(const bContext *C) calc_tw_center(scene, vec); totsel= 1; } else { +#if 1 /* OLD CODE */ /* do vertices for center, and if still no normal found, use vertex normals */ BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) { if(BM_TestHFlag(eve, BM_SELECT)) { @@ -319,6 +321,68 @@ int calc_manipulator_stats(const bContext *C) calc_tw_center(scene, eve->co); } } + +#else // BMESH_TODO + /* do vertices/edges/faces for center depending on selection + mode. note we can't use just vertex selection flag because + it is not flush down on changes */ + if(ts->selectmode & SCE_SELECT_VERTEX) { + for(eve= em->verts.first; eve; eve= eve->next) { + if(eve->f & SELECT) { + totsel++; + calc_tw_center(scene, eve->co); + } + } + } + else if(ts->selectmode & SCE_SELECT_EDGE) { + EditEdge *eed; + + for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0; + for(eed= em->edges.first; eed; eed= eed->next) { + if(eed->h==0 && (eed->f & SELECT)) { + if(!eed->v1->f1) { + eed->v1->f1= 1; + totsel++; + calc_tw_center(scene, eed->v1->co); + } + if(!eed->v2->f1) { + eed->v2->f1= 1; + totsel++; + calc_tw_center(scene, eed->v2->co); + } + } + } + } + else { + EditFace *efa; + + for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0; + for(efa= em->faces.first; efa; efa= efa->next) { + if(efa->h==0 && (efa->f & SELECT)) { + if(!efa->v1->f1) { + efa->v1->f1= 1; + totsel++; + calc_tw_center(scene, efa->v1->co); + } + if(!efa->v2->f1) { + efa->v2->f1= 1; + totsel++; + calc_tw_center(scene, efa->v2->co); + } + if(!efa->v3->f1) { + efa->v3->f1= 1; + totsel++; + calc_tw_center(scene, efa->v3->co); + } + if(efa->v4 && !efa->v4->f1) { + efa->v4->f1= 1; + totsel++; + calc_tw_center(scene, efa->v4->co); + } + } + } + } +#endif } } /* end editmesh */ else if (obedit->type==OB_ARMATURE){ diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index fe85f63e109..6db8dcc06cf 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -113,6 +113,7 @@ const char *imb_ext_movie[] = { ".m4v", ".m2v", ".m2t", + ".m2ts", ".mts", ".mv", ".avs", diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 1489593f7f6..060b1bf42d1 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -161,7 +161,7 @@ typedef struct Material { int mapto_textured; /* render-time cache to optimise texture lookups */ short shadowonly_flag; /* "shadowsonly" type */ - short pad; + short index; /* custom index for render passes */ ListBase gpumaterial; /* runtime */ } Material; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 100a66d209f..f351a48b998 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -201,6 +201,7 @@ typedef struct SceneRenderLayer { #define SCE_PASS_RAYHITS (1<<15) #define SCE_PASS_EMIT (1<<16) #define SCE_PASS_ENVIRONMENT (1<<17) +#define SCE_PASS_INDEXMA (1<<18) /* note, srl->passflag is treestore element 'nr' in outliner, short still... */ diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index e83161b8c62..d9fbdd7caf2 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2839,7 +2839,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro } /* editable check */ - if(RNA_property_editable(&itemptr, iprop)) { + if(!set || RNA_property_editable(&itemptr, iprop)) { if(a+itemlen > in.len) { BKE_reportf(reports, RPT_ERROR, "Array length mismatch (got %d, expected more).", in.len); err= 1; diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 2060f75f9de..0310ce917d4 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -509,6 +509,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) prop= RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_UNSIGNED); if(editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update"); + else RNA_def_property_update(prop, 0, "rna_Armature_update_data"); RNA_def_property_float_sdna(prop, NULL, "rad_head"); //RNA_def_property_range(prop, 0, 1000); // XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid); RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3); @@ -516,6 +517,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) prop= RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_UNSIGNED); if(editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update"); + else RNA_def_property_update(prop, 0, "rna_Armature_update_data"); RNA_def_property_float_sdna(prop, NULL, "rad_tail"); //RNA_def_property_range(prop, 0, 1000); // XXX range is 0 to lim, where lim= 10000.0f*MAX2(1.0, view3d->grid); RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3); diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 594295ba817..f2811e7320b 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -281,8 +281,7 @@ static int rna_Nurb_length(PointerRNA *ptr) static void rna_Nurb_type_set(PointerRNA *ptr, int value) { Nurb *nu= (Nurb*)ptr->data; - nu->type = value; - // XXX - TODO change datatypes + ED_nurb_set_spline_type(nu, value); } static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) @@ -1448,7 +1447,6 @@ static void rna_def_curve_nurb(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Radius Interpolation", "The type of radius interpolation for Bezier curves"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - // XXX - switching type probably needs comprehensive recalc of data like in 2.4x prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, curve_type_items); RNA_def_property_enum_funcs(prop, NULL, "rna_Nurb_type_set", NULL); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index b86a91967a6..f407aba82fb 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -1675,7 +1675,12 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Light Group", "Limit lighting to lamps in this Group"); RNA_def_property_update(prop, 0, "rna_Material_update"); - + + prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "index"); + RNA_def_property_ui_text(prop, "Pass Index", "Index # for the IndexMA render pass"); + RNA_def_property_update(prop, NC_OBJECT, NULL); + /* flags */ prop= RNA_def_property(srna, "use_light_group_exclusive", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index bd5a6d823a0..8b85b7e1e28 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -271,11 +271,16 @@ static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *base, Object *ob) { /* try to avoid scene sort */ - if((ob->lay & scene->lay) && (base->lay & scene->lay)) { + if(scene == NULL) { + /* pass - unlikely but when running scripts on startup it happens */ + } + else if((ob->lay & scene->lay) && (base->lay & scene->lay)) { /* pass */ - } else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) { + } + else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) { /* pass */ - } else { + } + else { DAG_scene_sort(bmain, scene); } } @@ -285,7 +290,7 @@ static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) Object *ob= (Object*)ptr->id.data; Base *base; - base= object_in_scene(ob, scene); + base= scene ? object_in_scene(ob, scene) : NULL; if(!base) return; diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 949415fbf29..47c8435cc46 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -585,6 +585,25 @@ static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *value pchan_apply_mat4(pchan, (float (*)[4])values, FALSE); /* no compat for predictable result */ } +static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values) +{ + bPoseChannel *pchan= (bPoseChannel*)ptr->data; + Object *ob= (Object*)ptr->id.data; + float umat[4][4]= MAT4_UNITY; + float tmat[4][4]; + + /* recalculate pose matrix with only parent transformations, + * bone loc/sca/rot is ignored, scene and frame are not used. */ + where_is_pose_bone(NULL, ob, pchan, 0.0f, FALSE); + + /* find the matrix, need to remove the bone transforms first so this is + * calculated as a matrix to set rather then a difference ontop of whats + * already there. */ + pchan_apply_mat4(pchan, umat, FALSE); + armature_mat_pose_to_bone(pchan, (float (*)[4])values, tmat); + pchan_apply_mat4(pchan, tmat, FALSE); /* no compat for predictable result */ +} + #else static void rna_def_bone_group(BlenderRNA *brna) @@ -830,8 +849,9 @@ static void rna_def_pose_channel(BlenderRNA *brna) prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "pose_mat"); RNA_def_property_multi_array(prop, 2, matrix_dimsize); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL); RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix after constraints and drivers are applied (object space)"); + RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); /* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */ prop= RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 3a6cebef178..e3e3296cb70 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -388,6 +388,7 @@ static void rna_def_render_pass(BlenderRNA *brna) {SCE_PASS_MIST, "MIST", 0, "Mist", ""}, {SCE_PASS_EMIT, "EMIT", 0, "Emit", ""}, {SCE_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""}, + {SCE_PASS_INDEXMA, "MATERIAL_INDEX", 0, "Material Index", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "RenderPass", NULL); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index cdecddbd6c4..904f4cc1b2f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1517,6 +1517,12 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop= RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA); + RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop= RNA_def_property(srna, "use_pass_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA); RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color pass"); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index c2194636cd3..1220c4f34a1 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -85,9 +85,9 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ #include "../../collada/collada.h" -static void rna_Scene_collada_export(Scene *scene, const char *filepath) +static void rna_Scene_collada_export(Scene *scene, const char *filepath, int selected) { - collada_export(scene, filepath); + collada_export(scene, filepath, selected); } #endif @@ -112,6 +112,7 @@ void RNA_api_scene(StructRNA *srna) /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ func= RNA_def_function(srna, "collada_export", "rna_Scene_collada_export"); parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file."); + parm= RNA_def_boolean(func, "selected", 0, "Export only selected", "Export only selected elements."); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */ RNA_def_function_ui_description(func, "Export to collada file."); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c index 3caaad26bae..a5f256054cd 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c @@ -53,6 +53,7 @@ static bNodeSocketType cmp_node_rlayers_out[]= { { SOCK_RGBA, 0, "Refract", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 0, "Indirect", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VALUE, 0, "IndexOB", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VALUE, 0, "IndexMA", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_VALUE, 0, "Mist", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 0, "Emit", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 0, "Environment",0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -211,6 +212,8 @@ static void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack * out[RRES_OUT_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDIRECT); if(out[RRES_OUT_INDEXOB]->hasoutput) out[RRES_OUT_INDEXOB]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXOB); + if(out[RRES_OUT_INDEXMA]->hasoutput) + out[RRES_OUT_INDEXMA]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXMA); if(out[RRES_OUT_MIST]->hasoutput) out[RRES_OUT_MIST]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_MIST); if(out[RRES_OUT_EMIT]->hasoutput) @@ -326,7 +329,7 @@ static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, in CompBuf *buf; int buftype= CB_VEC3; - if(ELEM3(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST)) + if(ELEM4(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST, SCE_PASS_INDEXMA)) buftype= CB_VAL; else if(passcode==SCE_PASS_VECTOR) buftype= CB_VEC4; @@ -373,6 +376,8 @@ static void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStac out[RRES_OUT_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDIRECT); if(out[RRES_OUT_INDEXOB]->hasoutput) out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB); + if(out[RRES_OUT_INDEXMA]->hasoutput) + out[RRES_OUT_INDEXMA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXMA); if(out[RRES_OUT_MIST]->hasoutput) out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST); if(out[RRES_OUT_EMIT]->hasoutput) diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c b/source/blender/nodes/intern/TEX_nodes/TEX_texture.c index d4d77b5fd5a..c58595866af 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_texture.c @@ -49,18 +49,18 @@ static bNodeSocketType outputs[]= { static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) { + Tex *nodetex = (Tex *)node->id; static float red[] = {1,0,0,1}; static float white[] = {1,1,1,1}; - float *co = p->co; - - Tex *nodetex = (Tex *)node->id; + float co[3], dxt[3], dyt[3]; + + copy_v3_v3(co, p->co); + copy_v3_v3(dxt, p->dxt); + copy_v3_v3(dyt, p->dyt); if(node->custom2 || node->need_exec==0) { /* this node refers to its own texture tree! */ - QUATCOPY( - out, - (fabs(co[0] - co[1]) < .01) ? white : red - ); + QUATCOPY(out, (fabs(co[0] - co[1]) < .01) ? white : red ); } else if(nodetex) { TexResult texres; @@ -70,9 +70,9 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor tex_input_rgba(col1, in[0], p, thread); tex_input_rgba(col2, in[1], p, thread); - + texres.nor = nor; - textype = multitex_nodes(nodetex, co, p->dxt, p->dyt, p->osatex, + textype = multitex_nodes(nodetex, co, dxt, dyt, p->osatex, &texres, thread, 0, p->shi, p->mtex); if(textype & TEX_RGB) { diff --git a/source/blender/python/generic/mathutils_geometry.c b/source/blender/python/generic/mathutils_geometry.c index 55c1e69d558..26844a5003d 100644 --- a/source/blender/python/generic/mathutils_geometry.c +++ b/source/blender/python/generic/mathutils_geometry.c @@ -680,7 +680,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO PyObject *ret= PyTuple_New(2); - switch(isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) { + switch(isect_line_sphere_v2(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) { case 1: if(!(!clip || (((lambda= line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a= FALSE; use_b= FALSE; diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 51bf02ad37f..422d55ecefe 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -209,8 +209,6 @@ void BPY_python_start(int argc, const char **argv) Py_Initialize(); - bpy_intern_string_init(); - // PySys_SetArgv(argc, argv); // broken in py3, not a huge deal /* sigh, why do python guys not have a char** version anymore? :( */ { @@ -233,6 +231,8 @@ void BPY_python_start(int argc, const char **argv) PyImport_ExtendInittab(bpy_internal_modules); #endif + bpy_intern_string_init(); + /* bpy.* and lets us import it */ BPy_init_modules(); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 1d4014aac3e..b9006b390ab 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -383,6 +383,10 @@ static const char *get_pass_name(int passtype, int channel) if(channel==-1) return "IndexOB"; return "IndexOB.X"; } + if(passtype == SCE_PASS_INDEXMA) { + if(channel==-1) return "IndexMA"; + return "IndexMA.X"; + } if(passtype == SCE_PASS_MIST) { if(channel==-1) return "Mist"; return "Mist.Z"; @@ -448,6 +452,9 @@ static int passtype_from_name(char *str) if(strcmp(str, "IndexOB")==0) return SCE_PASS_INDEXOB; + if(strcmp(str, "IndexMA")==0) + return SCE_PASS_INDEXMA; + if(strcmp(str, "Mist")==0) return SCE_PASS_MIST; @@ -631,7 +638,9 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop, int render_layer_add_pass(rr, rl, 3, SCE_PASS_REFRACT); if(srl->passflag & SCE_PASS_INDEXOB) render_layer_add_pass(rr, rl, 1, SCE_PASS_INDEXOB); - if(srl->passflag & SCE_PASS_MIST) + if(srl->passflag & SCE_PASS_INDEXMA) + render_layer_add_pass(rr, rl, 1, SCE_PASS_INDEXMA); + if(srl->passflag & SCE_PASS_MIST) render_layer_add_pass(rr, rl, 1, SCE_PASS_MIST); if(rl->passflag & SCE_PASS_RAYHITS) render_layer_add_pass(rr, rl, 4, SCE_PASS_RAYHITS); diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 6747784b21a..3aca334cffe 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -515,6 +515,14 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset, *fp= (float)shi->obr->ob->index; } break; + case SCE_PASS_INDEXMA: + /* no filter */ + if(shi->vlr) { + fp= rpass->rect + offset; + if(*fp==0.0f) + *fp= (float)shi->mat->index; + } + break; case SCE_PASS_MIST: /* */ col= &shr->mist; @@ -619,6 +627,12 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult *fp= (float)shi->obr->ob->index; } break; + case SCE_PASS_INDEXMA: + if(shi->vlr) { + fp= rpass->rect + offset; + *fp= (float)shi->mat->index; + } + break; case SCE_PASS_MIST: fp= rpass->rect + offset; *fp= shr->mist; diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 2702b7e5145..eab66aaf2ec 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -771,7 +771,8 @@ void shade_input_set_uv(ShadeInput *shi) t00= v3[axis1]-v1[axis1]; t01= v3[axis2]-v1[axis2]; t10= v3[axis1]-v2[axis1]; t11= v3[axis2]-v2[axis2]; - detsh= 1.0f/(t00*t11-t10*t01); + detsh= (t00*t11-t10*t01); + detsh= (detsh != 0.0f)? 1.0f/detsh: 0.0f; t00*= detsh; t01*=detsh; t10*=detsh; t11*=detsh; @@ -1272,8 +1273,9 @@ void shade_input_set_shade_texco(ShadeInput *shi) s11= ho3[1]/ho3[3] - ho2[1]/ho2[3]; detsh= s00*s11-s10*s01; - s00/= detsh; s01/=detsh; - s10/=detsh; s11/=detsh; + detsh= (detsh != 0.0f)? 1.0f/detsh: 0.0f; + s00*= detsh; s01*=detsh; + s10*=detsh; s11*=detsh; /* recalc u and v again */ hox= x/Zmulx -1.0f; @@ -1455,7 +1457,7 @@ int shade_samples(ShadeSample *ssamp, PixStr *ps, int x, int y) shade_samples_do_AO(ssamp); /* if shade (all shadepinputs have same passflag) */ - if(ssamp->shi[0].passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB)) { + if(ssamp->shi[0].passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB|SCE_PASS_INDEXMA)) { for(samp=0; samp<ssamp->tot; samp++, shi++, shr++) { shade_input_set_shade_texco(shi); diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 98dbb796f5b..13d9ead79e8 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -3497,7 +3497,7 @@ static void add_transp_obindex(RenderLayer *rl, int offset, Object *ob) RenderPass *rpass; for(rpass= rl->passes.first; rpass; rpass= rpass->next) { - if(rpass->passtype == SCE_PASS_INDEXOB) { + if(rpass->passtype == SCE_PASS_INDEXOB||rpass->passtype == SCE_PASS_INDEXMA) { float *fp= rpass->rect + offset; *fp= (float)ob->index; break; @@ -3820,7 +3820,7 @@ static int shade_tra_samples(ShadeSample *ssamp, StrandShadeCache *cache, int x, shade_samples_do_AO(ssamp); /* if shade (all shadepinputs have same passflag) */ - if(shi->passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB)) { + if(shi->passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB|SCE_PASS_INDEXMA)) { for(samp=0; samp<ssamp->tot; samp++, shi++, shr++) { shade_input_set_shade_texco(shi); shade_input_do_shade(shi, shr); @@ -4115,7 +4115,14 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas add_transp_obindex(rlpp[a], od, obr->ob); } } - + if(addpassflag & SCE_PASS_INDEXMA) { + ObjectRen *obr= R.objectinstance[zrow[totface-1].obi].obr; + if(obr->ob) { + for(a= 0; a<totfullsample; a++) + add_transp_obindex(rlpp[a], od, obr->ob); + } + } + /* for each mask-sample we alpha-under colors. then in end it's added using filter */ memset(samp_shr, 0, sizeof(ShadeResult)*osa); for(a=0; a<osa; a++) { diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index e0cfb86ce05..aabaf6d4055 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -635,8 +635,9 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt) char err_out[256]= "unknown"; *thumb_pt= NULL; - - if(G.background || scene->camera==NULL) + + /* scene can be NULL if running a script at startup and calling the save operator */ + if(G.background || scene==NULL || scene->camera==NULL) return NULL; /* gets scaled to BLEN_THUMB_SIZE */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f65485b84dd..35afdf29b53 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2004,6 +2004,8 @@ static void WM_OT_save_mainfile(wmOperatorType *ot) static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { + int selected = 0; + if(!RNA_property_is_set(op->ptr, "filepath")) { char filepath[FILE_MAX]; BLI_strncpy(filepath, G.main->name, sizeof(filepath)); @@ -2020,6 +2022,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED static int wm_collada_export_exec(bContext *C, wmOperator *op) { char filename[FILE_MAX]; + int selected; if(!RNA_property_is_set(op->ptr, "filepath")) { BKE_report(op->reports, RPT_ERROR, "No filename given"); @@ -2027,7 +2030,8 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) } RNA_string_get(op->ptr, "filepath", filename); - if(collada_export(CTX_data_scene(C), filename)) { + selected = RNA_boolean_get(op->ptr, "selected"); + if(collada_export(CTX_data_scene(C), filename, selected)) { return OPERATOR_FINISHED; } else { @@ -2045,6 +2049,8 @@ static void WM_OT_collada_export(wmOperatorType *ot) ot->poll= WM_operator_winactive; WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH); + RNA_def_boolean(ot->srna, "selected", 0, "Export only selected", + "Export only selected elements"); } /* function used for WM_OT_save_mainfile too */ diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index 05d06ac0130..931165690e5 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -141,6 +141,10 @@ endif() bf_intern_mikktspace ) + if(WITH_MOD_CLOTH_ELTOPO) + list(APPEND BLENDER_SORTED_LIBS extern_eltopo) + endif() + if(WITH_BUILTIN_GLEW) list(APPEND BLENDER_SORTED_LIBS extern_glew) endif() diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 8d70ae4e63d..ee92ec3cac6 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -68,6 +68,7 @@ struct Mesh; struct ModifierData; struct MultiresModifierData; struct NodeBlurData; +struct Nurb; struct Object; struct PBVHNode; struct Render; @@ -310,7 +311,8 @@ float ED_rollBoneToVector(struct EditBone *bone, float new_up_axis[3]){return 0. void ED_space_image_size(struct SpaceImage *sima, int *width, int *height){} struct ListBase *ED_curve_editnurbs(struct Curve *cu){return NULL;} -void free_curve_editNurb (struct Curve *cu){}; +void free_curve_editNurb (struct Curve *cu){} +void ED_nurb_set_spline_type(struct Nurb *nu, int type){} void EM_selectmode_set(struct EditMesh *em){} int EM_texFaceCheck(struct EditMesh *em){return 0;} diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 6d1957b6df4..23884b925b2 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -231,7 +231,17 @@ else() set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}) endif() -# install target + +# ----------------------------------------------------------------------------- +# Install Targets + +set(BLENDER_TEXT_FILES + ${CMAKE_SOURCE_DIR}/release/text/GPL-license.txt + ${CMAKE_SOURCE_DIR}/release/text/Python-license.txt + ${CMAKE_SOURCE_DIR}/release/text/copyright.txt + ${CMAKE_SOURCE_DIR}/release/text/readme.html +) + if(UNIX AND NOT APPLE) if(WITH_INSTALL_PORTABLE) @@ -274,9 +284,8 @@ if(UNIX AND NOT APPLE) ) install( - DIRECTORY ${CMAKE_SOURCE_DIR}/release/text + FILES ${BLENDER_TEXT_FILES} DESTINATION ${TARGETDIR} - PATTERN ".svn" EXCLUDE ) else() @@ -332,9 +341,8 @@ if(UNIX AND NOT APPLE) DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1 ) install( - DIRECTORY ${CMAKE_SOURCE_DIR}/release/text + FILES ${BLENDER_TEXT_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender - PATTERN ".svn" EXCLUDE ) endif() @@ -409,9 +417,8 @@ elseif(WIN32) ) install( # same as linux!, deduplicate - DIRECTORY ${CMAKE_SOURCE_DIR}/release/text + FILES ${BLENDER_TEXT_FILES} DESTINATION ${TARGETDIR} - PATTERN ".svn" EXCLUDE ) install( # same as linux!, deduplicate @@ -630,9 +637,9 @@ elseif(APPLE) endmacro() # install release and app files - install_dir( - ${CMAKE_SOURCE_DIR}/release/text/ - \${TARGETDIR} + install( + FILES ${BLENDER_TEXT_FILES} + DESTINATION ${TARGETDIR} ) install( @@ -697,6 +704,12 @@ elseif(APPLE) endif() endif() +unset(BLENDER_TEXT_FILES) + + +# ----------------------------------------------------------------------------- +# Setup link libs + add_dependencies(blender makesdna) get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS) diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 14048c70516..cbbeb9419d1 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -64,6 +64,7 @@ extern "C" #include "BKE_node.h" #include "BKE_report.h" #include "BKE_library.h" +#include "BLI_threads.h" #include "BLI_blenlib.h" #include "DNA_scene_types.h" #include "DNA_userdef_types.h" @@ -399,7 +400,11 @@ int main(int argc, char** argv) ::DisposeNibReference(nibRef); */ #endif // __APPLE__ - + + // We don't use threads directly in the BGE, but we need to call this so things like + // freeing up GPU_Textures works correctly. + BLI_threadapi_init(); + RNA_init(); init_nodesystem(); diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index e3ffc1a406b..de063f5e297 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -40,6 +40,8 @@ incs = ['.', '#source/blender/gpu', '#extern/glew/include'] +incs.append(env['BF_PTHREADS_INC']) + defs = [ 'GLEW_STATIC' ] if env['WITH_BF_PYTHON']: diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index c8a6ae5a6d0..a927de60cd8 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -327,7 +327,7 @@ static PyObject* gPyLoadGlobalDict(PyObject*) { char marshal_path[512]; char *marshal_buffer = NULL; - unsigned int marshal_length; + size_t marshal_length; FILE *fp = NULL; int result; @@ -338,7 +338,7 @@ static PyObject* gPyLoadGlobalDict(PyObject*) if (fp) { // obtain file size: fseek (fp, 0, SEEK_END); - marshal_length = ftell(fp); + marshal_length = (size_t)ftell(fp); rewind(fp); marshal_buffer = (char*)malloc (sizeof(char)*marshal_length); diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index 48053aa9d96..d1696223ec6 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -172,21 +172,21 @@ add_test(import_stl_knot_max_simplified ${TEST_BLENDER_EXE} add_test(import_x3d_cube ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/color_cube.x3d'\) - --md5=2ed64325dd3d62be6ce43c64219376ec --md5_method=SCENE + --md5=3fae9be004199c145941cd3f9f80ad7b --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_x3d_cube.blend ) add_test(import_x3d_teapot ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/teapot.x3d'\) - --md5=8b8b386900b8e3d2c036a38c625f4079 --md5_method=SCENE + --md5=8ee196c71947dce4199d55698501691e --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_x3d_teapot.blend ) add_test(import_x3d_suzanne_material ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/suzanne_material.x3d'\) - --md5=999129ba835f0ccb98c4bb299f6c2fef --md5_method=SCENE + --md5=3edea1353257d8b5a5f071942f417be6 --md5_method=SCENE --write-blend=${TEST_OUT_DIR}/import_x3d_suzanne_material.blend ) @@ -196,7 +196,7 @@ add_test(export_x3d_cube ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_cube.x3d',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_x3d_cube.x3d - --md5=30d2b056c004144cd4a0d172484a66f3 --md5_method=FILE + --md5=6ae36be272d6f84c697e84a8b6463273 --md5_method=FILE ) add_test(export_x3d_nurbs ${TEST_BLENDER_EXE} @@ -204,7 +204,7 @@ add_test(export_x3d_nurbs ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_nurbs.x3d',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_x3d_nurbs.x3d - --md5=7c15afe7b0cf007b842a925508b7d966 --md5_method=FILE + --md5=2d5bcf43cf7b6fbbef1c8cc566968fe5 --md5_method=FILE ) add_test(export_x3d_all_objects ${TEST_BLENDER_EXE} @@ -212,7 +212,7 @@ add_test(export_x3d_all_objects ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_all_objects.x3d',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_x3d_all_objects.x3d - --md5=d7d6574e833f3f051b65ef4577485fa9 --md5_method=FILE + --md5=bba48ca191e8891adb27c59ed4ce4735 --md5_method=FILE ) |