Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/doc/epy/BGL.py1807
-rw-r--r--source/blender/python/doc/epy/Geometry.py189
-rw-r--r--source/blender/python/doc/epy/IDProp.py132
-rw-r--r--source/blender/python/doc/epy/Mathutils.py156
-rw-r--r--source/blender/python/doc/epy/testbgl.py45
-rw-r--r--source/blender/python/doc/examples/bpy.data.py29
-rw-r--r--source/blender/python/doc/examples/mathutils.Euler.py3
-rw-r--r--source/blender/python/doc/examples/mathutils.Matrix.py3
-rw-r--r--source/blender/python/doc/examples/mathutils.Quaternion.py3
-rw-r--r--source/blender/python/doc/examples/mathutils.Vector.py55
-rw-r--r--source/blender/python/doc/examples/mathutils.py18
-rw-r--r--source/blender/python/doc/sphinx_doc_gen.py862
-rwxr-xr-xsource/blender/python/doc/sphinx_doc_gen.sh35
-rw-r--r--source/blender/python/generic/IDProp.c9
-rw-r--r--source/blender/python/generic/bgl.c10
-rw-r--r--source/blender/python/generic/blf_api.c27
-rw-r--r--source/blender/python/generic/bpy_internal_import.c17
-rw-r--r--source/blender/python/generic/geometry.c26
-rw-r--r--source/blender/python/generic/mathutils.c6
-rw-r--r--source/blender/python/generic/mathutils_color.c19
-rw-r--r--source/blender/python/generic/mathutils_euler.c25
-rw-r--r--source/blender/python/generic/mathutils_matrix.c17
-rw-r--r--source/blender/python/generic/mathutils_quat.c21
-rw-r--r--source/blender/python/generic/mathutils_vector.c4
-rw-r--r--source/blender/python/generic/noise.c66
-rw-r--r--source/blender/python/intern/bpy.c10
-rw-r--r--source/blender/python/intern/bpy_app.c66
-rw-r--r--source/blender/python/intern/bpy_array.c10
-rw-r--r--source/blender/python/intern/bpy_interface.c4
-rw-r--r--source/blender/python/intern/bpy_operator.c10
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c59
-rw-r--r--source/blender/python/intern/bpy_rna.h2
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c3
34 files changed, 252 insertions, 3498 deletions
diff --git a/source/blender/python/doc/epy/BGL.py b/source/blender/python/doc/epy/BGL.py
deleted file mode 100644
index ce148dc72ba..00000000000
--- a/source/blender/python/doc/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/source/blender/python/doc/epy/Geometry.py b/source/blender/python/doc/epy/Geometry.py
deleted file mode 100644
index d0c4dfdfd8d..00000000000
--- a/source/blender/python/doc/epy/Geometry.py
+++ /dev/null
@@ -1,189 +0,0 @@
-# Blender.Geometry module and its subtypes
-
-"""
-The Blender.Geometry submodule.
-
-Geometry
-========
-(when accessing it from the Game Engine use Geometry instead of Blender.Geometry)
-
-This new module provides access to a geometry function.
-"""
-
-def Intersect(vec1, vec2, vec3, ray, orig, clip=1):
- """
- Return the intersection between a ray and a triangle, if possible, return None otherwise.
- @type vec1: Vector object.
- @param vec1: A 3d vector, one corner of the triangle.
- @type vec2: Vector object.
- @param vec2: A 3d vector, one corner of the triangle.
- @type vec3: Vector object.
- @param vec3: A 3d vector, one corner of the triangle.
- @type ray: Vector object.
- @param ray: A 3d vector, the orientation of the ray. the length of the ray is not used, only the direction.
- @type orig: Vector object.
- @param orig: A 3d vector, the origin of the ray.
- @type clip: integer
- @param clip: if 0, don't restrict the intersection to the area of the triangle, use the infinite plane defined by the triangle.
- @rtype: Vector object
- @return: The intersection between a ray and a triangle, if possible, None otherwise.
- """
-
-def TriangleArea(vec1, vec2, vec3):
- """
- Return the area size of the 2D or 3D triangle defined.
- @type vec1: Vector object.
- @param vec1: A 2d or 3d vector, one corner of the triangle.
- @type vec2: Vector object.
- @param vec2: A 2d or 3d vector, one corner of the triangle.
- @type vec3: Vector object.
- @param vec3: A 2d or 3d vector, one corner of the triangle.
- @rtype: float
- @return: The area size of the 2D or 3D triangle defined.
- """
-
-def TriangleNormal(vec1, vec2, vec3):
- """
- Return the normal of the 3D triangle defined.
- @type vec1: Vector object.
- @param vec1: A 3d vector, one corner of the triangle.
- @type vec2: Vector object.
- @param vec2: A 3d vector, one corner of the triangle.
- @type vec3: Vector object.
- @param vec3: A 3d vector, one corner of the triangle.
- @rtype: float
- @return: The normal of the 3D triangle defined.
- """
-
-def QuadNormal(vec1, vec2, vec3, vec4):
- """
- Return the normal of the 3D quad defined.
- @type vec1: Vector object.
- @param vec1: A 3d vector, the first vertex of the quad.
- @type vec2: Vector object.
- @param vec2: A 3d vector, the second vertex of the quad.
- @type vec3: Vector object.
- @param vec3: A 3d vector, the third vertex of the quad.
- @type vec4: Vector object.
- @param vec4: A 3d vector, the fourth vertex of the quad.
- @rtype: float
- @return: The normal of the 3D quad defined.
- """
-
-def LineIntersect(vec1, vec2, vec3, vec4):
- """
- Return a tuple with the points on each line respectively closest to the other
- (when both lines intersect, both vector hold the same value).
- The lines are evaluated as infinite lines in space, the values returned may not be between the 2 points given for each line.
- @type vec1: Vector object.
- @param vec1: A 3d vector, one point on the first line.
- @type vec2: Vector object.
- @param vec2: A 3d vector, another point on the first line.
- @type vec3: Vector object.
- @param vec3: A 3d vector, one point on the second line.
- @type vec4: Vector object.
- @param vec4: A 3d vector, another point on the second line.
- @rtype: (Vector object, Vector object)
- @return: A tuple with the points on each line respectively closest to the other.
- """
-
-def PolyFill(polylines):
- """
- Takes a list of polylines and calculates triangles that would fill in the polylines.
- Multiple lines can be used to make holes inside a polyline, or fill in 2 separate lines at once.
- @type polylines: List of lists containing vectors, each representing a closed polyline.
- @rtype: list
- @return: a list if tuples each a tuple of 3 ints representing a triangle indexing the points given.
- @note: 2D Vectors will have an assumed Z axis of zero, 4D Vectors W axis is ignored.
- @note: The order of points in a polyline effect the direction returned triangles face, reverse the order of a polyline to flip the normal of returned faces.
-
- I{B{Example:}}
-
- The example below creates 2 polylines and fills them in with faces, then makes a mesh in the current scene::
- import Blender
- Vector= Blender.mathutils.Vector
-
- # Outline of 5 points
- polyline1= [Vector(-2.0, 1.0, 1.0), Vector(-1.0, 2.0, 1.0), Vector(1.0, 2.0, 1.0), Vector(1.0, -1.0, 1.0), Vector(-1.0, -1.0, 1.0)]
- polyline2= [Vector(-1, 1, 1.0), Vector(0, 1, 1.0), Vector(0, 0, 1.0), Vector(-1.0, 0.0, 1.0)]
- fill= Blender.Geometry.PolyFill([polyline1, polyline2])
-
- # Make a new mesh and add the truangles into it
- me= Blender.Mesh.New()
- me.verts.extend(polyline1)
- me.verts.extend(polyline2)
- me.faces.extend(fill) # Add the faces, they reference the verts in polyline 1 and 2
-
- scn = Blender.Scene.GetCurrent()
- ob = scn.objects.new(me)
- Blender.Redraw()
- """
-
-def LineIntersect2D(vec1, vec2, vec3, vec4):
- """
- Takes 2 lines vec1, vec2 for the 2 points of the first line and vec2, vec3 for the 2 points of the second line.
- @rtype: Vector
- @return: a 2D Vector for the intersection or None where there is no intersection.
- """
-
-def ClosestPointOnLine(pt, vec1, vec2):
- """
- Takes 2 lines vec1, vec2 for the 2 points of the first line and vec2, vec3 for the 2 points of the second line.
- @rtype: tuple
- @return: a tuple containing a vector and a float, the vector is the closest point on the line, the float is the position on the line, between 0 and 1 the point is on the line.
- """
-
-def PointInTriangle2D(pt, tri_pt1, tri_pt2, tri_pt3):
- """
- Takes 4 vectors (one for the test point and 3 for the triangle)
- This is a 2d function so only X and Y are used, Z and W will be ignored.
- @rtype: int
- @return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection.
- """
-
-def PointInQuad2D(pt, quad_pt1, quad_pt2, quad_pt3):
- """
- Takes 5 vectors (one for the test point and 5 for the quad)
- This is a 2d function so only X and Y are used, Z and W will be ignored.
- @rtype: int
- @return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection.
- """
-
-def BoxPack2D(boxlist):
- """
- Takes a list of 2D boxes and packs them into a square.
- Each box in boxlist must be a list of at least 4 items - [x,y,w,h], after running this script,
- the X and Y values in each box will be moved to packed, non overlapping locations.
-
- Example::
-
- # Make 500 random boxes, pack them and make a mesh from it
- from Blender import Geometry, Scene, Mesh
- import random
- boxes = []
- for i in xrange(500):
- boxes.append( [0,0, random.random()+0.1, random.random()+0.1] )
- boxsize = Geometry.BoxPack2D(boxes)
- print 'BoxSize', boxsize
- me = Mesh.New()
- for x in boxes:
- me.verts.extend([(x[0],x[1], 0), (x[0],x[1]+x[3], 0), (x[0]+x[2],x[1]+x[3], 0), (x[0]+x[2],x[1], 0) ])
- v1= me.verts[-1]
- v2= me.verts[-2]
- v3= me.verts[-3]
- v4= me.verts[-4]
- me.faces.extend([(v1,v2,v3,v4)])
- scn = Scene.GetCurrent()
- scn.objects.new(me)
-
- @note: Each boxlist item can be longer then 4, the extra items are ignored and stay untouched.
- @rtype: tuple
- @return: a tuple pair - (width, height) of all the packed boxes.
- """
-def BezierInterp(vec_knot_1, vec_handle_1, vec_handle_2, vec_knot_2, resolution):
- """
- Takes 4 vectors representing a bezier curve and returns a list of vector points.
- @note: any vector size is supported, the largest dimension from the input will be used for all returned vectors/
- @rtype: list
- @return: a list of vectors the size of resolution including the start and end points (vec_knot_1 and vec_knot_2)
- """
diff --git a/source/blender/python/doc/epy/IDProp.py b/source/blender/python/doc/epy/IDProp.py
deleted file mode 100644
index 1fc26d7f65b..00000000000
--- a/source/blender/python/doc/epy/IDProp.py
+++ /dev/null
@@ -1,132 +0,0 @@
-class IDGroup:
- """
- The IDGroup Type
- ================
- This type supports both iteration and the []
- operator to get child ID properties.
-
- You can also add new properties using the [] operator.
- For example::
-
- group['a float!'] = 0.0
- group['an int!'] = 0
- group['a string!'] = "hi!"
- group['an array!'] = [0, 0, 1.0, 0]
-
- group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2],
- "another subgroup": {"a": 0.0, "str": "bleh"}}
-
- Note that for arrays, the array type defaults to int unless a float is found
- while scanning the template list; if any floats are found, then the whole
- array is float. Note that double-precision floating point numbers are used for
- python-created float ID properties and arrays (though the internal C api does
- support single-precision floats, and the python code will read them).
-
- You can also delete properties with the del operator. For example:
-
- del group['property']
-
- To get the type of a property, use the type() operator, for example::
-
- if type(group['bleh']) == str: pass
-
- To tell if the property is a group or array type, import the Blender.Types module and test
- against IDGroupType and IDArrayType, like so::
-
- from Blender.Types import IDGroupType, IDArrayType.
-
- if type(group['bleghr']) == IDGroupType:
- (do something)
-
- @ivar name: The name of the property
- @type name: string
- """
-
- def pop(item):
- """
- Pop an item from the group property.
- @type item: string
- @param item: The item name.
- @rtype: can be dict, list, int, float or string.
- @return: The removed property.
- """
-
- def update(updatedict):
- """
- Updates items in the dict, similar to normal python
- dictionary method .update().
- @type updatedict: dict
- @param updatedict: A dict of simple types to derive updated/new IDProperties from.
- @rtype: None
- @return: None
- """
-
- def keys():
- """
- Returns a list of the keys in this property group.
- @rtype: list of strings.
- @return: a list of the keys in this property group.
- """
-
- def values():
- """
- Returns a list of the values in this property group.
-
- Note that unless a value is itself a property group or an array, you
- cannot change it by changing the values in this list, you must change them
- in the parent property group.
-
- For example,
-
- group['some_property'] = new_value
-
- . . .is correct, while,
-
- values = group.values()
- values[0] = new_value
-
- . . .is wrong.
-
- @rtype: list of strings.
- @return: a list of the values in this property group.
- """
-
- def iteritems():
- """
- Implements the python dictionary iteritmes method.
-
- For example::
-
- for k, v in group.iteritems():
- print "Property name: " + k
- print "Property value: " + str(v)
-
- @rtype: an iterator that spits out items of the form [key, value]
- @return: an iterator.
- """
-
- def convert_to_pyobject():
- """
- Converts the entire property group to a purely python form.
-
- @rtype: dict
- @return: A python dictionary representing the property group
- """
-
-class IDArray:
- """
- The IDArray Type
- ================
-
- @ivar type: returns the type of the array, can be either IDP_Int or IDP_Float
- """
-
- def __getitem__(index):
- pass
-
- def __setitem__(index, value):
- pass
-
- def __len__():
- pass
-
diff --git a/source/blender/python/doc/epy/Mathutils.py b/source/blender/python/doc/epy/Mathutils.py
deleted file mode 100644
index 17a227f729a..00000000000
--- a/source/blender/python/doc/epy/Mathutils.py
+++ /dev/null
@@ -1,156 +0,0 @@
-# Blender.mathutils module and its subtypes
-
-
-
-class Vector:
- """
-
- @attention: Vector data can be wrapped or non-wrapped. When a object is wrapped it
- means that the object will give you direct access to the data inside of blender. Modification
- of this object will directly change the data inside of blender. To copy a wrapped object
- you need to use the object's constructor. If you copy and object by assignment you will not get
- a second copy but a second reference to the same data. Only certain functions will return
- wrapped data. This will be indicated in the method description.
- """
-
- def __init__(list = None):
- """
- Create a new 2d, 3d, or 4d Vector object from a list of floating point numbers.
- @note: that python uses higher precission floating point numbers, so values assigned to a vector may have some rounding error.
-
-
- Example::
- v = Vector(1,0,0)
- v = Vector(myVec)
- v = Vector(list)
- @type list: PyList of float or int
- @param list: The list of values for the Vector object. Can be a sequence or raw numbers.
- Must be 2, 3, or 4 values. The list is mapped to the parameters as [x,y,z,w].
- @rtype: Vector object.
- @return: It depends wheter a parameter was passed:
- - (list): Vector object initialized with the given values;
- - (): An empty 3 dimensional vector.
- """
-
-class Euler:
- """
- The Euler object
- ================
- This object gives access to Eulers in Blender.
- @note: You can access a euler object like a sequence
- - x = euler[0]
- @note: Comparison operators can be done:
- - ==, != test numeric values within epsilon
- @attention: Euler data can be wrapped or non-wrapped. When a object is wrapped it
- means that the object will give you direct access to the data inside of blender. Modification
- of this object will directly change the data inside of blender. To copy a wrapped object
- you need to use the object's constructor. If you copy and object by assignment you will not get
- a second copy but a second reference to the same data. Only certain functions will return
- wrapped data. This will be indicated in the method description.
- """
-
- def __init__(list = None):
- """
- Create a new euler object.
-
- Example::
- euler = Euler(45,0,0)
- euler = Euler(myEuler)
- euler = Euler(sequence)
- @type list: PyList of float/int
- @param list: 3d list to initialize euler
- @rtype: Euler object
- @return: Euler representing heading, pitch, bank.
- @note: Values are in degrees.
- """
-
-class Quaternion:
- """
- The Quaternion object
- =====================
- This object gives access to Quaternions in Blender.
- @note: Comparison operators can be done:
- - ==, != test numeric values within epsilon
- @note: Math can be performed on Quaternion classes
- - quat + quat
- - quat - quat
- - quat * float/int
- - quat * vec
- - quat * quat
- @note: You can access a quaternion object like a sequence
- - x = quat[0]
- @attention: Quaternion data can be wrapped or non-wrapped. When a object is wrapped it
- means that the object will give you direct access to the data inside of blender. Modification
- of this object will directly change the data inside of blender. To copy a wrapped object
- you need to use the object's constructor. If you copy and object by assignment you will not get
- a second copy but a second reference to the same data. Only certain functions will return
- wrapped data. This will be indicated in the method description.
- """
-
- def __init__(list, angle = None):
- """
- Create a new quaternion object from initialized values.
-
- Example::
- quat = Quaternion(1,2,3,4)
- quat = Quaternion(axis, angle)
- quat = Quaternion()
- quat = Quaternion(180, list)
-
- @type list: PyList of int/float
- @param list: A 3d or 4d list to initialize quaternion.
- 4d if intializing [w,x,y,z], 3d if used as an axis of rotation.
- @type angle: float (optional)
- @param angle: An arbitrary rotation amount around 'list'.
- List is used as an axis of rotation in this case.
- @rtype: New quaternion object.
- @return: It depends wheter a parameter was passed:
- - (list/angle): Quaternion object initialized with the given values;
- - (): An identity 4 dimensional quaternion.
- """
-
-class Matrix:
- """
- The Matrix Object
- =================
- @note: Math can be performed on Matrix classes
- - mat + mat
- - mat - mat
- - mat * float/int
- - mat * vec
- - mat * mat
- @note: Comparison operators can be done:
- - ==, != test numeric values within epsilon
- @note: You can access a quaternion object like a 2d sequence
- - x = matrix[0][1]
- - vector = matrix[2]
- @attention: Quaternion data can be wrapped or non-wrapped. When a object is wrapped it
- means that the object will give you direct access to the data inside of blender. Modification
- of this object will directly change the data inside of blender. To copy a wrapped object
- you need to use the object's constructor. If you copy and object by assignment you will not get
- a second copy but a second reference to the same data. Only certain functions will return
- wrapped data. This will be indicated in the method description.
- """
-
- def __init__(list1 = None, list2 = None, list3 = None, list4 = None):
- """
- Create a new matrix object from initialized values.
-
- Example::
- matrix = Matrix([1,1,1],[0,1,0],[1,0,0])
- matrix = Matrix(mat)
- matrix = Matrix(seq1, seq2, vector)
-
- @type list1: PyList of int/float
- @param list1: A 2d,3d or 4d list.
- @type list2: PyList of int/float
- @param list2: A 2d,3d or 4d list.
- @type list3: PyList of int/float
- @param list3: A 2d,3d or 4d list.
- @type list4: PyList of int/float
- @param list4: A 2d,3d or 4d list.
- @rtype: New matrix object.
- @return: It depends wheter a parameter was passed:
- - (list1, etc.): Matrix object initialized with the given values;
- - (): An empty 3 dimensional matrix.
- """
diff --git a/source/blender/python/doc/epy/testbgl.py b/source/blender/python/doc/epy/testbgl.py
deleted file mode 100644
index e895d01df69..00000000000
--- a/source/blender/python/doc/epy/testbgl.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Testing the BGL module
-
-import Blender
-from Blender.BGL import *
-from Blender import Draw
-
-R = G = B = 0
-A = 1
-
-instructions = "Hold mouse buttons to change the background color."
-quitting = " Press ESC or q to quit."
-
-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(1,1,1) # change default color
- glRasterPos2i(50,100) # move cursor to x = 50, y = 100
- Draw.Text("Testing BGL + Draw") # draw this text there
- glRasterPos2i(350,20) # 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
- glColor3f(0.35,0.18,0.92) # change default color again
- glBegin(GL_POLYGON) # another list, for a polygon
- glVertex2i(315, 292)
- glVertex2i(412, 200)
- glVertex2i(264, 256)
- glEnd()
- Draw.Redraw(1) # make changes visible.
-
-def ev(evt, val): # this is a 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 evt == Draw.LEFTMOUSE: R = 1 - R
- elif evt == Draw.MIDDLEMOUSE: G = 1 - G
- elif evt == Draw.RIGHTMOUSE: B = 1 - B
- else:
- Draw.Register(show_win, ev, None)
-
-Draw.Register(show_win, ev, None) # start the main loop
diff --git a/source/blender/python/doc/examples/bpy.data.py b/source/blender/python/doc/examples/bpy.data.py
deleted file mode 100644
index fc1145a523f..00000000000
--- a/source/blender/python/doc/examples/bpy.data.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import bpy
-
-
-# print all objects
-for obj in bpy.data.objects:
- print(obj.name)
-
-
-# print all scene names in a list
-print(bpy.data.scenes.keys())
-
-
-# remove mesh Cube
-if "Cube" in bpy.data.meshes:
- mesh = bpy.data.meshes["Cube"]
- print("removing mesh", mesh)
- bpy.data.meshes.unlink(mesh)
-
-
-# write images into a file next to the blend
-import os
-file = open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w')
-
-for image in bpy.data.images:
- file.write("%s %dx%d\n" % (image.filepath, image.size[0], image.size[1]))
-
-file.close()
-
-
diff --git a/source/blender/python/doc/examples/mathutils.Euler.py b/source/blender/python/doc/examples/mathutils.Euler.py
deleted file mode 100644
index bc7702c1d53..00000000000
--- a/source/blender/python/doc/examples/mathutils.Euler.py
+++ /dev/null
@@ -1,3 +0,0 @@
-import mathutils
-
-# todo
diff --git a/source/blender/python/doc/examples/mathutils.Matrix.py b/source/blender/python/doc/examples/mathutils.Matrix.py
deleted file mode 100644
index bc7702c1d53..00000000000
--- a/source/blender/python/doc/examples/mathutils.Matrix.py
+++ /dev/null
@@ -1,3 +0,0 @@
-import mathutils
-
-# todo
diff --git a/source/blender/python/doc/examples/mathutils.Quaternion.py b/source/blender/python/doc/examples/mathutils.Quaternion.py
deleted file mode 100644
index bc7702c1d53..00000000000
--- a/source/blender/python/doc/examples/mathutils.Quaternion.py
+++ /dev/null
@@ -1,3 +0,0 @@
-import mathutils
-
-# todo
diff --git a/source/blender/python/doc/examples/mathutils.Vector.py b/source/blender/python/doc/examples/mathutils.Vector.py
deleted file mode 100644
index fb00e8aead6..00000000000
--- a/source/blender/python/doc/examples/mathutils.Vector.py
+++ /dev/null
@@ -1,55 +0,0 @@
-import mathutils
-
-# zero length vector
-vec = mathutils.Vector((0, 0, 1))
-
-# unit length vector
-vec_a = vec.copy().normalize()
-
-vec_b = mathutils.Vector((0, 1, 2))
-
-vec2d = mathutils.Vector((1, 2))
-vec3d = mathutils.Vector((1, 0, 0))
-vec4d = vec_a.copy().resize4D()
-
-# other mathutuls types
-quat = mathutils.Quaternion()
-matrix = mathutils.Matrix()
-
-# Comparison operators can be done on Vector classes:
-
-# greater and less then test vector length.
-vec_a > vec_b
-vec_a >= vec_b
-vec_a < vec_b
-vec_a <= vec_b
-
-# ==, != test vector values e.g. 1,2,3 != 3,2,1 even if they are the same length
-vec_a == vec_b
-vec_a != vec_b
-
-
-# Math can be performed on Vector classes
-vec_a + vec_b
-vec_a - vec_b
-vec_a * vec_b
-vec_a * 10.0
-vec_a * matrix
-vec_a * vec_b
-vec_a * quat
--vec_a
-
-
-# You can access a vector object like a sequence
-x = vec_a[0]
-len(vec)
-vec_a[:] = vec_b
-vec2d[:] = vec3d[:2]
-
-
-# Vectors support 'swizzle' operations
-# See http://en.wikipedia.org/wiki/Swizzling_(computer_graphics)
-vec.xyz = vec.zyx
-vec.xy = vec4d.zw
-vec.xyz = vec4d.wzz
-vec4d.wxyz = vec.yxyx
diff --git a/source/blender/python/doc/examples/mathutils.py b/source/blender/python/doc/examples/mathutils.py
deleted file mode 100644
index 02f69515f21..00000000000
--- a/source/blender/python/doc/examples/mathutils.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import mathutils
-from math import radians
-
-vec = mathutils.Vector((1.0, 2.0, 3.0))
-
-mat_rot = mathutils.Matrix.Rotation(radians(90), 4, 'X')
-mat_trans = mathutils.Matrix.Translation(vec)
-
-mat = mat_trans * mat_rot
-mat.invert()
-
-mat3 = mat.rotation_part()
-quat1 = mat.to_quat()
-quat2 = mat3.to_quat()
-
-angle = quat1.difference(quat2)
-
-print(angle)
diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py
deleted file mode 100644
index b20cd74f82a..00000000000
--- a/source/blender/python/doc/sphinx_doc_gen.py
+++ /dev/null
@@ -1,862 +0,0 @@
- # ***** BEGIN GPL LICENSE BLOCK *****
- #
- # This program is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public License
- # as published by the Free Software Foundation; either version 2
- # of the License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software Foundation,
- # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- #
- # Contributor(s): Campbell Barton
- #
- # #**** END GPL LICENSE BLOCK #****
-
-script_help_msg = '''
-Usage,
-run this script from blenders root path once you have compiled blender
- ./blender.bin -b -P /b/source/blender/python/doc/sphinx_doc_gen.py
-
-This will generate python files in "./source/blender/python/doc/sphinx-in"
-Generate html docs by running...
-
- sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
-
-
-For PDF generation
-
- sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
- cd source/blender/python/doc/sphinx-out
- make
-'''
-
-# import rpdb2; rpdb2.start_embedded_debugger('test')
-
-import os
-import inspect
-import bpy
-import rna_info
-reload(rna_info)
-
-# lame, python wont give some access
-ClassMethodDescriptorType = type(dict.__dict__['fromkeys'])
-MethodDescriptorType = type(dict.get)
-GetSetDescriptorType = type(int.real)
-
-EXAMPLE_SET = set()
-EXAMPLE_SET_USED = set()
-
-_BPY_STRUCT_FAKE = "bpy_struct"
-_BPY_FULL_REBUILD = False
-
-def undocumented_message(module_name, type_name, identifier):
- message = "Undocumented (`contribute " \
- "<http://wiki.blender.org/index.php/Dev:2.5/Py/API/Documentation/Contribute" \
- "?action=edit&section=new&preload=Dev:2.5/Py/API/Documentation/Contribute/Howto-message" \
- "&preloadtitle=%s.%s.%s>`_)\n\n" % (module_name, type_name, identifier)
- return message
-
-
-def range_str(val):
- '''
- Converts values to strings for the range directive.
- (unused function it seems)
- '''
- if val < -10000000: return '-inf'
- if val > 10000000: return 'inf'
- if type(val)==float:
- return '%g' % val
- else:
- return str(val)
-
-
-def write_example_ref(ident, fw, example_id, ext="py"):
- if example_id in EXAMPLE_SET:
- fw("%s.. literalinclude:: ../examples/%s.%s\n\n" % (ident, example_id, ext))
- EXAMPLE_SET_USED.add(example_id)
- else:
- if bpy.app.debug:
- print("\tskipping example:", example_id)
-
-
-def write_indented_lines(ident, fn, text, strip=True):
- '''
- Apply same indentation to all lines in a multilines text.
- '''
- if text is None:
- return
- for l in text.split("\n"):
- if strip:
- fn(ident + l.strip() + "\n")
- else:
- fn(ident + l + "\n")
-
-
-def pymethod2sphinx(ident, fw, identifier, py_func):
- '''
- class method to sphinx
- '''
- arg_str = inspect.formatargspec(*inspect.getargspec(py_func))
- if arg_str.startswith("(self, "):
- arg_str = "(" + arg_str[7:]
- func_type = "method"
- elif arg_str.startswith("(cls, "):
- arg_str = "(" + arg_str[6:]
- func_type = "classmethod"
- else:
- func_type = "staticmethod"
-
- fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str))
- if py_func.__doc__:
- write_indented_lines(ident + " ", fw, py_func.__doc__)
- fw("\n")
-
-
-def pyfunc2sphinx(ident, fw, identifier, py_func, is_class=True):
- '''
- function or class method to sphinx
- '''
- arg_str = inspect.formatargspec(*inspect.getargspec(py_func))
-
- if not is_class:
- func_type = "function"
-
- # ther rest are class methods
- elif arg_str.startswith("(self, "):
- arg_str = "(" + arg_str[7:]
- func_type = "method"
- elif arg_str.startswith("(cls, "):
- arg_str = "(" + arg_str[6:]
- func_type = "classmethod"
- else:
- func_type = "staticmethod"
-
- fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str))
- if py_func.__doc__:
- write_indented_lines(ident + " ", fw, py_func.__doc__.strip())
- fw("\n")
-
-
-def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):
- if identifier.startswith("_"):
- return
-
- doc = descr.__doc__
- if not doc:
- doc = undocumented_message(module_name, type_name, identifier)
-
- if type(descr) == GetSetDescriptorType:
- fw(ident + ".. attribute:: %s\n\n" % identifier)
- write_indented_lines(ident + " ", fw, doc, False)
- elif type(descr) in (MethodDescriptorType, ClassMethodDescriptorType):
- write_indented_lines(ident, fw, doc, False)
- else:
- raise TypeError("type was not GetSetDescriptorType, MethodDescriptorType or ClassMethodDescriptorType")
-
- write_example_ref(ident, fw, module_name + "." + type_name + "." + identifier)
- fw("\n")
-
-
-def py_c_func2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_class=True):
- '''
- c defined function to sphinx.
- '''
-
- # dump the docstring, assume its formatted correctly
- if py_func.__doc__:
- write_indented_lines(ident, fw, py_func.__doc__, False)
- fw("\n")
- else:
- fw(ident + ".. function:: %s()\n\n" % identifier)
- fw(ident + " " + undocumented_message(module_name, type_name, identifier))
-
-
-def pyprop2sphinx(ident, fw, identifier, py_prop):
- '''
- python property to sphinx
- '''
- # readonly properties use "data" directive, variables use "attribute" directive
- if py_prop.fset is None:
- fw(ident + ".. data:: %s\n\n" % identifier)
- else:
- fw(ident + ".. attribute:: %s\n\n" % identifier)
- write_indented_lines(ident + " ", fw, py_prop.__doc__)
- if py_prop.fset is None:
- fw(ident + " (readonly)\n\n")
-
-
-def pymodule2sphinx(BASEPATH, module_name, module, title):
- import types
- attribute_set = set()
- filepath = os.path.join(BASEPATH, module_name + ".rst")
-
- file = open(filepath, "w")
-
- fw = file.write
-
- fw(title + "\n")
- fw(("=" * len(title)) + "\n\n")
-
- fw(".. module:: %s\n\n" % module_name)
-
- if module.__doc__:
- # Note, may contain sphinx syntax, dont mangle!
- fw(module.__doc__.strip())
- fw("\n\n")
-
- write_example_ref("", fw, module_name)
-
- # write members of the module
- # only tested with PyStructs which are not exactly modules
- for key, descr in sorted(type(module).__dict__.items()):
- if type(descr) == types.MemberDescriptorType:
- if descr.__doc__:
- fw(".. data:: %s\n\n" % key)
- write_indented_lines(" ", fw, descr.__doc__, False)
- attribute_set.add(key)
- fw("\n")
- del key, descr
-
- classes = []
-
- for attribute in sorted(dir(module)):
- if not attribute.startswith("_"):
-
- if attribute in attribute_set:
- continue
-
- if attribute.startswith("n_"): # annoying exception, needed for bpy.app
- continue
-
- value = getattr(module, attribute)
-
- value_type = type(value)
-
- if value_type == types.FunctionType:
- pyfunc2sphinx("", fw, attribute, value, is_class=False)
- elif value_type in (types.BuiltinMethodType, types.BuiltinFunctionType): # both the same at the moment but to be future proof
- # note: can't get args from these, so dump the string as is
- # this means any module used like this must have fully formatted docstrings.
- py_c_func2sphinx("", fw, module_name, module, attribute, value, is_class=False)
- elif value_type == type:
- classes.append((attribute, value))
- elif value_type in (bool, int, float, str, tuple):
- # constant, not much fun we can do here except to list it.
- # TODO, figure out some way to document these!
- fw(".. data:: %s\n\n" % attribute)
- write_indented_lines(" ", fw, "constant value %s" % repr(value), False)
- fw("\n")
- else:
- print("\tnot documenting %s.%s" % (module_name, attribute))
- continue
-
- attribute_set.add(attribute)
- # TODO, more types...
-
- # write collected classes now
- for (type_name, value) in classes:
- # May need to be its own function
- fw(".. class:: %s\n\n" % type_name)
- if value.__doc__:
- write_indented_lines(" ", fw, value.__doc__, False)
- fw("\n")
- write_example_ref(" ", fw, module_name + "." + type_name)
-
- descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("__")]
-
- for key, descr in descr_items:
- if type(descr) == ClassMethodDescriptorType:
- py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
-
- for key, descr in descr_items:
- if type(descr) == MethodDescriptorType:
- py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
-
- for key, descr in descr_items:
- if type(descr) == GetSetDescriptorType:
- py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
-
- fw("\n\n")
-
- file.close()
-
-
-
-def rna2sphinx(BASEPATH):
-
- structs, funcs, ops, props = rna_info.BuildRNAInfo()
-
- try:
- os.mkdir(BASEPATH)
- except:
- pass
-
- # conf.py - empty for now
- filepath = os.path.join(BASEPATH, "conf.py")
- file = open(filepath, "w")
- fw = file.write
-
-
- version_string = bpy.app.version_string.split("(")[0]
- if bpy.app.build_revision != "Unknown":
- version_string = version_string + " r" + bpy.app.build_revision
-
- # for use with files
- version_string_fp = "_".join(str(v) for v in bpy.app.version)
-
- fw("project = 'Blender'\n")
- # fw("master_doc = 'index'\n")
- fw("copyright = u'Blender Foundation'\n")
- fw("version = '%s - UNSTABLE API'\n" % version_string)
- fw("release = '%s - UNSTABLE API'\n" % version_string)
- fw("html_theme = 'blender-org'\n")
- fw("html_theme_path = ['../']\n")
- fw("html_favicon = 'favicon.ico'\n")
- # not helpful since the source us generated, adds to upload size.
- fw("html_copy_source = False\n")
- fw("\n")
- # needed for latex, pdf gen
- fw("latex_documents = [ ('contents', 'contents.tex', 'Blender Index', 'Blender Foundation', 'manual'), ]\n")
- fw("latex_paper_size = 'a4paper'\n")
- file.close()
-
-
- filepath = os.path.join(BASEPATH, "contents.rst")
- file = open(filepath, "w")
- fw = file.write
-
- fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n")
- fw(" Blender Documentation contents\n")
- fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n")
- fw("\n")
- fw("This document is an API reference for Blender %s. built %s.\n" % (version_string, bpy.app.build_date))
- fw("\n")
- fw("An introduction to Blender and Python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n")
- fw("\n")
- fw("`A PDF version of this document is also available <blender_python_reference_%s.pdf>`__\n" % version_string_fp)
- fw("\n")
- fw(".. warning:: The Python API in Blender is **UNSTABLE**, It should only be used for testing, any script written now may break in future releases.\n")
- fw(" \n")
- fw(" The following areas are subject to change.\n")
- fw(" * operator names and arguments\n")
- fw(" * render api\n")
- fw(" * function calls with the data api (any function calls with values accessed from bpy.data), including functions for importing and exporting meshes\n")
- fw(" * class registration (Operator, Panels, Menus, Headers)\n")
- fw(" * modules: bpy.props, blf)\n")
- fw(" * members in the bpy.context have to be reviewed\n")
- fw(" * python defined modal operators, especially drawing callbacks are highly experemental\n")
- fw(" \n")
- fw(" These parts of the API are relatively stable and are unlikely to change significantly\n")
- fw(" * data API, access to attributes of blender data such as mesh verts, material color, timeline frames and scene objects\n")
- fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n")
- fw(" * modules: bgl, mathutils and geometry\n")
- fw(" * game engine modules\n")
- fw("\n")
-
- fw("===================\n")
- fw("Application Modules\n")
- fw("===================\n")
- fw("\n")
- fw(".. toctree::\n")
- fw(" :maxdepth: 1\n\n")
- fw(" bpy.data.rst\n\n") # note: not actually a module
- fw(" bpy.ops.rst\n\n")
- fw(" bpy.types.rst\n\n")
-
- # py modules
- fw(" bpy.utils.rst\n\n")
- fw(" bpy.path.rst\n\n")
- fw(" bpy.app.rst\n\n")
-
- # C modules
- fw(" bpy.props.rst\n\n")
-
- fw("==================\n")
- fw("Standalone Modules\n")
- fw("==================\n")
- fw("\n")
- fw(".. toctree::\n")
- fw(" :maxdepth: 1\n\n")
-
-
- fw(" mathutils.rst\n\n")
- fw(" blf.rst\n\n")
- fw(" aud.rst\n\n")
-
- # game engine
- fw("===================\n")
- fw("Game Engine Modules\n")
- fw("===================\n")
- fw("\n")
- fw(".. toctree::\n")
- fw(" :maxdepth: 1\n\n")
- fw(" bge.types.rst\n\n")
- fw(" bge.logic.rst\n\n")
- fw(" bge.render.rst\n\n")
- fw(" bge.events.rst\n\n")
-
- file.close()
-
-
- # internal modules
- filepath = os.path.join(BASEPATH, "bpy.ops.rst")
- file = open(filepath, "w")
- fw = file.write
- fw("Operators (bpy.ops)\n")
- fw("===================\n\n")
- fw(".. toctree::\n")
- fw(" :glob:\n\n")
- fw(" bpy.ops.*\n\n")
- file.close()
-
- filepath = os.path.join(BASEPATH, "bpy.types.rst")
- file = open(filepath, "w")
- fw = file.write
- fw("Types (bpy.types)\n")
- fw("=================\n\n")
- fw(".. toctree::\n")
- fw(" :glob:\n\n")
- fw(" bpy.types.*\n\n")
- file.close()
-
-
- # not actually a module, only write this file so we
- # can reference in the TOC
- filepath = os.path.join(BASEPATH, "bpy.data.rst")
- file = open(filepath, "w")
- fw = file.write
- fw("Data Access (bpy.data)\n")
- fw("======================\n\n")
- fw(".. module:: bpy\n")
- fw("\n")
- fw("This module is used for all blender/python access.\n")
- fw("\n")
- fw(".. literalinclude:: ../examples/bpy.data.py\n")
- fw("\n")
- fw(".. data:: data\n")
- fw("\n")
- fw(" Access to blenders internal data\n")
- fw("\n")
- fw(" :type: :class:`bpy.types.BlendData`\n")
- file.close()
-
- EXAMPLE_SET_USED.add("bpy.data")
-
-
- # python modules
- from bpy import utils as module
- pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
-
- from bpy import path as module
- pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities (bpy.path)")
-
- # C modules
- from bpy import app as module
- pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data (bpy.app)")
-
- from bpy import props as module
- pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions (bpy.props)")
-
- import mathutils as module
- pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)")
- del module
-
- import blf as module
- pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
- del module
-
- import aud as module
- pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)")
- del module
-
- # game engine
- import shutil
- # copy2 keeps time/date stamps
- shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.types.rst"), BASEPATH)
- shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.logic.rst"), BASEPATH)
- shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.render.rst"), BASEPATH)
- shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.events.rst"), BASEPATH)
-
-
- if 0:
- filepath = os.path.join(BASEPATH, "bpy.rst")
- file = open(filepath, "w")
- fw = file.write
-
- fw("\n")
-
- title = ":mod:`bpy` --- Blender Python Module"
- fw("%s\n%s\n\n" % (title, "=" * len(title)))
- fw(".. module:: bpy.types\n\n")
- file.close()
-
- def write_param(ident, fw, prop, is_return=False):
- if is_return:
- id_name = "return"
- id_type = "rtype"
- kwargs = {"as_ret": True, "class_fmt": ":class:`%s`"}
- identifier = ""
- else:
- id_name = "arg"
- id_type = "type"
- kwargs = {"as_arg": True, "class_fmt": ":class:`%s`"}
- identifier = " %s" % prop.identifier
-
- type_descr = prop.get_type_description(**kwargs)
- if prop.name or prop.description:
- fw(ident + ":%s%s: %s\n" % (id_name, identifier, ", ".join(val for val in (prop.name, prop.description) if val)))
- fw(ident + ":%s%s: %s\n" % (id_type, identifier, type_descr))
-
- def write_struct(struct):
- #if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"):
- # return
-
- #if not struct.identifier == "Object":
- # return
-
- filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % struct.identifier)
- file = open(filepath, "w")
- fw = file.write
-
- base_id = getattr(struct.base, "identifier", "")
-
- if _BPY_STRUCT_FAKE:
- if not base_id:
- base_id = _BPY_STRUCT_FAKE
-
- if base_id:
- title = "%s(%s)" % (struct.identifier, base_id)
- else:
- title = struct.identifier
-
- fw("%s\n%s\n\n" % (title, "=" * len(title)))
-
- fw(".. module:: bpy.types\n\n")
-
- base_ids = [base.identifier for base in struct.get_bases()]
-
- if _BPY_STRUCT_FAKE:
- base_ids.append(_BPY_STRUCT_FAKE)
-
- base_ids.reverse()
-
- if base_ids:
- if len(base_ids) > 1:
- fw("base classes --- ")
- else:
- fw("base class --- ")
-
- fw(", ".join((":class:`%s`" % base_id) for base_id in base_ids))
- fw("\n\n")
-
- subclass_ids = [s.identifier for s in structs.values() if s.base is struct if not rna_info.rna_id_ignore(s.identifier)]
- if subclass_ids:
- fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in subclass_ids) + "\n\n")
-
- base_id = getattr(struct.base, "identifier", "")
-
- if _BPY_STRUCT_FAKE:
- if not base_id:
- base_id = _BPY_STRUCT_FAKE
-
- if base_id:
- fw(".. class:: %s(%s)\n\n" % (struct.identifier, base_id))
- else:
- fw(".. class:: %s\n\n" % struct.identifier)
-
- fw(" %s\n\n" % struct.description)
-
- # properties sorted in alphabetical order
- sorted_struct_properties = struct.properties[:]
- sorted_struct_properties.sort(key=lambda prop: prop.identifier)
-
- for prop in sorted_struct_properties:
- type_descr = prop.get_type_description(class_fmt=":class:`%s`")
- # readonly properties use "data" directive, variables properties use "attribute" directive
- if 'readonly' in type_descr:
- fw(" .. data:: %s\n\n" % prop.identifier)
- else:
- fw(" .. attribute:: %s\n\n" % prop.identifier)
- if prop.description:
- fw(" %s\n\n" % prop.description)
- fw(" :type: %s\n\n" % type_descr)
-
- # python attributes
- py_properties = struct.get_py_properties()
- py_prop = None
- for identifier, py_prop in py_properties:
- pyprop2sphinx(" ", fw, identifier, py_prop)
- del py_properties, py_prop
-
- for func in struct.functions:
- args_str = ", ".join(prop.get_arg_default(force=False) for prop in func.args)
-
- fw(" .. %s:: %s(%s)\n\n" % ("classmethod" if func.is_classmethod else "method", func.identifier, args_str))
- fw(" %s\n\n" % func.description)
-
- for prop in func.args:
- write_param(" ", fw, prop)
-
- if len(func.return_values) == 1:
- write_param(" ", fw, func.return_values[0], is_return=True)
- elif func.return_values: # multiple return values
- fw(" :return (%s):\n" % ", ".join(prop.identifier for prop in func.return_values))
- for prop in func.return_values:
- type_descr = prop.get_type_description(as_ret=True, class_fmt=":class:`%s`")
- descr = prop.description
- if not descr:
- descr = prop.name
- fw(" `%s`, %s, %s\n\n" % (prop.identifier, descr, type_descr))
-
- fw("\n")
-
-
- # python methods
- py_funcs = struct.get_py_functions()
- py_func = None
-
- for identifier, py_func in py_funcs:
- pyfunc2sphinx(" ", fw, identifier, py_func, is_class=True)
- del py_funcs, py_func
-
- lines = []
-
- if struct.base or _BPY_STRUCT_FAKE:
- bases = list(reversed(struct.get_bases()))
-
- # props
- lines[:] = []
-
- if _BPY_STRUCT_FAKE:
- descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")]
-
- if _BPY_STRUCT_FAKE:
- for key, descr in descr_items:
- if type(descr) == GetSetDescriptorType:
- lines.append(" * :class:`%s.%s`\n" % (_BPY_STRUCT_FAKE, key))
-
- for base in bases:
- for prop in base.properties:
- lines.append(" * :class:`%s.%s`\n" % (base.identifier, prop.identifier))
-
- for identifier, py_prop in base.get_py_properties():
- lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier))
-
- for identifier, py_prop in base.get_py_properties():
- lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier))
-
- if lines:
- fw(".. rubric:: Inherited Properties\n\n")
-
- fw(".. hlist::\n")
- fw(" :columns: 2\n\n")
-
- for line in lines:
- fw(line)
- fw("\n")
-
-
- # funcs
- lines[:] = []
-
- if _BPY_STRUCT_FAKE:
- for key, descr in descr_items:
- if type(descr) == MethodDescriptorType:
- lines.append(" * :class:`%s.%s`\n" % (_BPY_STRUCT_FAKE, key))
-
- for base in bases:
- for func in base.functions:
- lines.append(" * :class:`%s.%s`\n" % (base.identifier, func.identifier))
- for identifier, py_func in base.get_py_functions():
- lines.append(" * :class:`%s.%s`\n" % (base.identifier, identifier))
-
- if lines:
- fw(".. rubric:: Inherited Functions\n\n")
-
- fw(".. hlist::\n")
- fw(" :columns: 2\n\n")
-
- for line in lines:
- fw(line)
- fw("\n")
-
- lines[:] = []
-
-
- if struct.references:
- # use this otherwise it gets in the index for a normal heading.
- fw(".. rubric:: References\n\n")
-
- fw(".. hlist::\n")
- fw(" :columns: 2\n\n")
-
- for ref in struct.references:
- ref_split = ref.split(".")
- if len(ref_split) > 2:
- ref = ref_split[-2] + "." + ref_split[-1]
- fw(" * :class:`%s`\n" % ref)
- fw("\n")
-
-
- for struct in structs.values():
- # TODO, rna_info should filter these out!
- if "_OT_" in struct.identifier:
- continue
- write_struct(struct)
-
- # special case, bpy_struct
- if _BPY_STRUCT_FAKE:
- filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % _BPY_STRUCT_FAKE)
- file = open(filepath, "w")
- fw = file.write
-
- fw("%s\n" % _BPY_STRUCT_FAKE)
- fw("=" * len(_BPY_STRUCT_FAKE) + "\n")
- fw("\n")
- fw(".. module:: bpy.types\n")
- fw("\n")
-
- subclass_ids = [s.identifier for s in structs.values() if s.base is None if not rna_info.rna_id_ignore(s.identifier)]
- if subclass_ids:
- fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in sorted(subclass_ids)) + "\n\n")
-
- fw(".. class:: %s\n\n" % _BPY_STRUCT_FAKE)
- fw(" built-in base class for all classes in bpy.types.\n\n")
- fw(" .. note::\n\n")
- fw(" Note that bpy.types.%s is not actually available from within blender, it only exists for the purpose of documentation.\n\n" % _BPY_STRUCT_FAKE)
-
- descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")]
-
- for key, descr in descr_items:
- if type(descr) == MethodDescriptorType: # GetSetDescriptorType, GetSetDescriptorType's are not documented yet
- py_descr2sphinx(" ", fw, descr, "bpy.types", _BPY_STRUCT_FAKE, key)
-
- for key, descr in descr_items:
- if type(descr) == GetSetDescriptorType:
- py_descr2sphinx(" ", fw, descr, "bpy.types", _BPY_STRUCT_FAKE, key)
-
-
- # operators
- def write_ops():
- API_BASEURL='https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts'
- fw = None
- last_mod = ''
-
- for op_key in sorted(ops.keys()):
- op = ops[op_key]
-
- if last_mod != op.module_name:
- filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op.module_name)
- file = open(filepath, "w")
- fw = file.write
-
- title = "%s Operators" % (op.module_name[0].upper() + op.module_name[1:])
- fw("%s\n%s\n\n" % (title, "=" * len(title)))
-
- fw(".. module:: bpy.ops.%s\n\n" % op.module_name)
- last_mod = op.module_name
-
- args_str = ", ".join(prop.get_arg_default(force=True) for prop in op.args)
- fw(".. function:: %s(%s)\n\n" % (op.func_name, args_str))
-
- # if the description isn't valid, we output the standard warning
- # with a link to the wiki so that people can help
- if not op.description or op.description == "(undocumented operator)":
- operator_description = undocumented_message('bpy.ops',op.module_name,op.func_name)
- else:
- operator_description = op.description
-
- fw(" %s\n\n" % operator_description)
- for prop in op.args:
- write_param(" ", fw, prop)
- if op.args:
- fw("\n")
-
- location = op.get_location()
- if location != (None, None):
- fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0],API_BASEURL,location[0],location[1]))
-
- write_ops()
-
- file.close()
-
-def main():
- import bpy
- if 'bpy' not in dir():
- print("\nError, this script must run from inside blender2.5")
- print(script_help_msg)
- else:
- import shutil
-
- path_in = 'source/blender/python/doc/sphinx-in'
- path_out = 'source/blender/python/doc/sphinx-out'
- path_examples = 'source/blender/python/doc/examples'
- # only for partial updates
- path_in_tmp = path_in + "-tmp"
-
- if not os.path.exists(path_in):
- os.mkdir(path_in)
-
- for f in os.listdir(path_examples):
- if f.endswith(".py"):
- EXAMPLE_SET.add(os.path.splitext(f)[0])
-
-
- # only for full updates
- if _BPY_FULL_REBUILD:
- shutil.rmtree(path_in, True)
- shutil.rmtree(path_out, True)
- else:
- # write here, then move
- shutil.rmtree(path_in_tmp, True)
-
- rna2sphinx(path_in_tmp)
-
- if not _BPY_FULL_REBUILD:
- import filecmp
-
- # now move changed files from 'path_in_tmp' --> 'path_in'
- file_list_path_in = set(os.listdir(path_in))
- file_list_path_in_tmp = set(os.listdir(path_in_tmp))
-
- # remove deprecated files that have been removed.
- for f in sorted(file_list_path_in):
- if f not in file_list_path_in_tmp:
- print("\tdeprecated: %s" % f)
- os.remove(os.path.join(path_in, f))
-
- # freshen with new files.
- for f in sorted(file_list_path_in_tmp):
- f_from = os.path.join(path_in_tmp, f)
- f_to = os.path.join(path_in, f)
-
- do_copy = True
- if f in file_list_path_in:
- if filecmp.cmp(f_from, f_to):
- do_copy = False
-
- if do_copy:
- print("\tupdating: %s" % f)
- shutil.copy(f_from, f_to)
- '''else:
- print("\tkeeping: %s" % f) # eh, not that useful'''
-
-
- EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
- if EXAMPLE_SET_UNUSED:
- print("\nUnused examples found in '%s'..." % path_examples)
- for f in EXAMPLE_SET_UNUSED:
- print(" %s.py" % f)
- print(" %d total\n" % len(EXAMPLE_SET_UNUSED))
-
- import sys
- sys.exit()
-
-if __name__ == '__main__':
- main()
diff --git a/source/blender/python/doc/sphinx_doc_gen.sh b/source/blender/python/doc/sphinx_doc_gen.sh
deleted file mode 100755
index 607803d16d5..00000000000
--- a/source/blender/python/doc/sphinx_doc_gen.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-# run from the blender source dir
-# bash source/blender/python/doc/sphinx_doc_gen.sh
-# ssh upload means you need an account on the server
-
-BLENDER="./blender.bin"
-SSH_HOST="ideasman42@emo.blender.org"
-SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation" # blender_python_api_VERSION, added after
-
-# sed string from hell, 'Blender 2.53 (sub 1) Build' --> '2_53_1'
-# "_".join(str(v) for v in bpy.app.version)
-# custom blender vars
-blender_srcdir=$(dirname $0)/../../../../
-blender_version=$(grep BLENDER_VERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9)
-blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9)
-BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion
-
-BLENDER_VERSION=`$BLENDER --version | cut -f2-4 -d" " | sed 's/(//g' | sed 's/)//g' | sed 's/ sub /./g' | sed 's/\./_/g'`
-SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION
-
-# dont delete existing docs, now partial updates are used for quick builds.
-$BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py
-
-# html
-sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
-cp source/blender/python/doc/sphinx-out/contents.html source/blender/python/doc/sphinx-out/index.html
-ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*'
-rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
-
-# pdf
-sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
-cd source/blender/python/doc/sphinx-out
-make
-cd ../../../../../
-rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c
index 9d865b1c63e..c64be00093c 100644
--- a/source/blender/python/generic/IDProp.c
+++ b/source/blender/python/generic/IDProp.c
@@ -24,6 +24,7 @@
*/
#include "BKE_idprop.h"
+#include "BKE_utildefines.h"
#include "IDProp.h"
#include "MEM_guardedalloc.h"
@@ -177,12 +178,12 @@ int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value)
return 0;
}
-PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *bleh)
+PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *UNUSED(closure))
{
return PyUnicode_FromString(self->prop->name);
}
-static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh)
+static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUSED(closure))
{
char *st;
if (!PyUnicode_Check(value)) {
@@ -860,7 +861,7 @@ PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent)
static PyObject *IDArray_repr(BPy_IDArray *self)
{
- return PyUnicode_FromString("(ID Array)");
+ return PyUnicode_FromFormat("(ID Array [%d])", self->prop->len);
}
@@ -1071,7 +1072,7 @@ static PyObject *IDGroup_Iter_iterself(PyObject *self)
static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
{
- return PyUnicode_FromString("(ID Property Group)");
+ return PyUnicode_FromFormat("(ID Property Group Iter \"%s\")", self->group->prop->name);
}
static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 8ac2107f8d2..86b7bc522fe 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -35,6 +35,8 @@
#include <GL/glew.h>
#include "MEM_guardedalloc.h"
+#include "BKE_utildefines.h"
+
static char Method_Buffer_doc[] =
"(type, dimensions, [template]) - Create a new Buffer object\n\n\
(type) - The format to store data in\n\
@@ -51,7 +53,7 @@ For example, passing [100, 100] will create a 2 dimensional\n\
square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\
buffer which is twice as deep as it is wide or high.";
-static PyObject *Method_Buffer( PyObject * self, PyObject * args );
+static PyObject *Method_Buffer( PyObject * self, PyObject *args );
/* Buffer sequence methods */
@@ -99,7 +101,7 @@ PyTypeObject BGL_bufferType = {
/* #ifndef __APPLE__ */
#define BGL_Wrap(nargs, funcname, ret, arg_list) \
-static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
+static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\
arg_def##nargs arg_list; \
ret_def_##ret; \
if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
@@ -108,7 +110,7 @@ static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
}
#define BGLU_Wrap(nargs, funcname, ret, arg_list) \
-static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
+static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\
arg_def##nargs arg_list; \
ret_def_##ret; \
if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
@@ -181,7 +183,7 @@ Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuf
}
#define MAX_DIMENSIONS 256
-static PyObject *Method_Buffer (PyObject *self, PyObject *args)
+static PyObject *Method_Buffer (PyObject *UNUSED(self), PyObject *args)
{
PyObject *length_ob= NULL, *template= NULL;
Buffer *buffer;
diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c
index a5f5f8815c7..66d8cdd923a 100644
--- a/source/blender/python/generic/blf_api.c
+++ b/source/blender/python/generic/blf_api.c
@@ -26,6 +26,7 @@
#include "blf_api.h"
#include "../../blenfont/BLF_api.h"
+#include "BKE_utildefines.h"
static char py_blf_position_doc[] =
".. function:: position(fontid, x, y, z)\n"
@@ -41,7 +42,7 @@ static char py_blf_position_doc[] =
" :arg z: Z axis position to draw the text.\n"
" :type z: float\n";
-static PyObject *py_blf_position(PyObject *self, PyObject *args)
+static PyObject *py_blf_position(PyObject *UNUSED(self), PyObject *args)
{
int fontid;
float x, y, z;
@@ -67,7 +68,7 @@ static char py_blf_size_doc[] =
" :arg dpi: dots per inch value to use for drawing.\n"
" :type dpi: int\n";
-static PyObject *py_blf_size(PyObject *self, PyObject *args)
+static PyObject *py_blf_size(PyObject *UNUSED(self), PyObject *args)
{
int fontid, size, dpi;
@@ -90,7 +91,7 @@ static char py_blf_aspect_doc[] =
" :arg aspect: The aspect ratio for text drawing to use.\n"
" :type aspect: float\n";
-static PyObject *py_blf_aspect(PyObject *self, PyObject *args)
+static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args)
{
float aspect;
int fontid;
@@ -114,7 +115,7 @@ static char py_blf_blur_doc[] =
" :arg radius: The radius for blurring text (in pixels).\n"
" :type radius: int\n";
-static PyObject *py_blf_blur(PyObject *self, PyObject *args)
+static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args)
{
int blur, fontid;
@@ -137,7 +138,7 @@ static char py_blf_draw_doc[] =
" :arg text: the text to draw.\n"
" :type text: string\n";
-static PyObject *py_blf_draw(PyObject *self, PyObject *args)
+static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args)
{
char *text;
int fontid;
@@ -162,7 +163,7 @@ static char py_blf_dimensions_doc[] =
" :return: the width and height of the text.\n"
" :rtype: tuple of 2 floats\n";
-static PyObject *py_blf_dimensions(PyObject *self, PyObject *args)
+static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
{
char *text;
float r_width, r_height;
@@ -196,7 +197,7 @@ static char py_blf_clipping_doc[] =
" :arg ymax: Clip the drawing area by these bounds.\n"
" :type ymax: float\n";
-static PyObject *py_blf_clipping(PyObject *self, PyObject *args)
+static PyObject *py_blf_clipping(PyObject *UNUSED(self), PyObject *args)
{
float xmin, ymin, xmax, ymax;
int fontid;
@@ -219,7 +220,7 @@ static char py_blf_disable_doc[] =
" :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
" :type option: int\n";
-static PyObject *py_blf_disable(PyObject *self, PyObject *args)
+static PyObject *py_blf_disable(PyObject *UNUSED(self), PyObject *args)
{
int option, fontid;
@@ -241,7 +242,7 @@ static char py_blf_enable_doc[] =
" :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
" :type option: int\n";
-static PyObject *py_blf_enable(PyObject *self, PyObject *args)
+static PyObject *py_blf_enable(PyObject *UNUSED(self), PyObject *args)
{
int option, fontid;
@@ -263,7 +264,7 @@ static char py_blf_rotation_doc[] =
" :arg angle: The angle for text drawing to use.\n"
" :type angle: float\n";
-static PyObject *py_blf_rotation(PyObject *self, PyObject *args)
+static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
{
float angle;
int fontid;
@@ -294,7 +295,7 @@ static char py_blf_shadow_doc[] =
" :arg a: Shadow color (alpha channel 0.0 - 1.0).\n"
" :type a: float\n";
-static PyObject *py_blf_shadow(PyObject *self, PyObject *args)
+static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args)
{
int level, fontid;
float r, g, b, a;
@@ -324,7 +325,7 @@ static char py_blf_shadow_offset_doc[] =
" :arg y: Horizontal shadow offset value in pixels.\n"
" :type y: float\n";
-static PyObject *py_blf_shadow_offset(PyObject *self, PyObject *args)
+static PyObject *py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args)
{
int x, y, fontid;
@@ -346,7 +347,7 @@ static char py_blf_load_doc[] =
" :return: the new font's fontid or -1 if there was an error.\n"
" :rtype: integer\n";
-static PyObject *py_blf_load(PyObject *self, PyObject *args)
+static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
{
char* filename;
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 394c388394a..3ee0c76a44a 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -30,9 +30,10 @@
#include "DNA_text_types.h"
#include "MEM_guardedalloc.h"
+#include "BKE_utildefines.h" /* UNUSED */
#include "BKE_text.h" /* txt_to_buf */
#include "BKE_main.h"
-#include "BKE_global.h" /* grr, only for G.sce */
+#include "BKE_global.h" /* grr, only for G.main->name */
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
@@ -61,7 +62,7 @@ void bpy_import_main_set(struct Main *maggie)
/* returns a dummy filename for a textblock so we can tell what file a text block comes from */
void bpy_text_filename_get(char *fn, Text *text)
{
- sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.sce, text->id.name+2);
+ sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.main->name, text->id.name+2);
/* XXX, this is a bug in python's Py_CompileString()!
the string encoding should not be required to be utf-8
@@ -191,24 +192,24 @@ PyObject *bpy_text_reimport( PyObject *module, int *found )
}
-static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * kw)
+static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw)
{
PyObject *exception, *err, *tb;
char *name;
int found= 0;
PyObject *globals = NULL, *locals = NULL, *fromlist = NULL;
- PyObject *newmodule;
+ int level= -1; /* relative imports */
+ PyObject *newmodule;
//PyObject_Print(args, stderr, 0);
- int dummy_val; /* what does this do?*/
static char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", 0};
if( !PyArg_ParseTupleAndKeywords( args, kw, "s|OOOi:bpy_import_meth", kwlist,
- &name, &globals, &locals, &fromlist, &dummy_val) )
+ &name, &globals, &locals, &fromlist, &level) )
return NULL;
/* import existing builtin modules or modules that have been imported already */
- newmodule = PyImport_ImportModuleEx( name, globals, locals, fromlist );
+ newmodule= PyImport_ImportModuleLevel(name, globals, locals, fromlist, level);
if(newmodule)
return newmodule;
@@ -244,7 +245,7 @@ static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * k
* our reload() module, to handle reloading in-memory scripts
*/
-static PyObject *blender_reload( PyObject * self, PyObject * module )
+static PyObject *blender_reload(PyObject *UNUSED(self), PyObject * module)
{
PyObject *exception, *err, *tb;
PyObject *newmodule = NULL;
diff --git a/source/blender/python/generic/geometry.c b/source/blender/python/generic/geometry.c
index 0e98760314d..e0583cc0028 100644
--- a/source/blender/python/generic/geometry.c
+++ b/source/blender/python/generic/geometry.c
@@ -60,7 +60,7 @@ static char M_Geometry_BezierInterp_doc[] = "";
//---------------------------------INTERSECTION FUNCTIONS--------------------
//----------------------------------geometry.Intersect() -------------------
-static PyObject *M_Geometry_Intersect( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_Intersect(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *ray, *ray_off, *vec1, *vec2, *vec3;
float dir[3], orig[3], v1[3], v2[3], v3[3], e1[3], e2[3], pvec[3], tvec[3], qvec[3];
@@ -133,7 +133,7 @@ static PyObject *M_Geometry_Intersect( PyObject * self, PyObject * args )
}
//----------------------------------geometry.LineIntersect() -------------------
/* Line-Line intersection using algorithm from mathworld.wolfram.com */
-static PyObject *M_Geometry_LineIntersect( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_LineIntersect(PyObject *UNUSED(self), PyObject* args)
{
PyObject * tuple;
VectorObject *vec1, *vec2, *vec3, *vec4;
@@ -201,7 +201,7 @@ static PyObject *M_Geometry_LineIntersect( PyObject * self, PyObject * args )
//---------------------------------NORMALS FUNCTIONS--------------------
//----------------------------------geometry.QuadNormal() -------------------
-static PyObject *M_Geometry_QuadNormal( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_QuadNormal(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1;
VectorObject *vec2;
@@ -252,7 +252,7 @@ static PyObject *M_Geometry_QuadNormal( PyObject * self, PyObject * args )
}
//----------------------------geometry.TriangleNormal() -------------------
-static PyObject *M_Geometry_TriangleNormal( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_TriangleNormal(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1, *vec2, *vec3;
float v1[3], v2[3], v3[3], e1[3], e2[3], n[3];
@@ -289,7 +289,7 @@ static PyObject *M_Geometry_TriangleNormal( PyObject * self, PyObject * args )
//--------------------------------- AREA FUNCTIONS--------------------
//----------------------------------geometry.TriangleArea() -------------------
-static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_TriangleArea(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1, *vec2, *vec3;
float v1[3], v2[3], v3[3];
@@ -335,7 +335,7 @@ static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args )
/*----------------------------------geometry.PolyFill() -------------------*/
/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */
-static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq )
+static PyObject *M_Geometry_PolyFill(PyObject *UNUSED(self), PyObject * polyLineSeq )
{
PyObject *tri_list; /*return this list of tri's */
PyObject *polyLine, *polyVec;
@@ -450,7 +450,7 @@ static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq )
}
-static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_LineIntersect2D(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *line_a1, *line_a2, *line_b1, *line_b2;
float a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y, xi, yi, a1,a2,b1,b2, newvec[2];
@@ -548,7 +548,7 @@ static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args )
Py_RETURN_NONE;
}
-static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_ClosestPointOnLine(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt, *line_1, *line_2;
float pt_in[3], pt_out[3], l1[3], l2[3];
@@ -586,7 +586,7 @@ static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args
return ret;
}
-static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_PointInTriangle2D(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3;
@@ -606,7 +606,7 @@ static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args
return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec));
}
-static PyObject *M_Geometry_PointInQuad2D( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_PointInQuad2D(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4;
@@ -690,7 +690,7 @@ static void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
}
-static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist )
+static PyObject *M_Geometry_BoxPack2D(PyObject *UNUSED(self), PyObject * boxlist )
{
boxPack *boxarray = NULL;
float tot_width, tot_height;
@@ -718,7 +718,7 @@ static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist )
return Py_BuildValue( "ff", tot_width, tot_height);
}
-static PyObject *M_Geometry_BezierInterp( PyObject * self, PyObject * args )
+static PyObject *M_Geometry_BezierInterp(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2;
int resolu;
@@ -767,7 +767,7 @@ static PyObject *M_Geometry_BezierInterp( PyObject * self, PyObject * args )
return list;
}
-static PyObject *M_Geometry_BarycentricTransform(PyObject * self, PyObject * args)
+static PyObject *M_Geometry_BarycentricTransform(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *vec_pt;
VectorObject *vec_t1_tar, *vec_t2_tar, *vec_t3_tar;
diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c
index e81bc0cf239..c1f24e413c8 100644
--- a/source/blender/python/generic/mathutils.c
+++ b/source/blender/python/generic/mathutils.c
@@ -61,6 +61,8 @@
#include "BLI_math.h"
+#include "BKE_utildefines.h"
+
//-------------------------DOC STRINGS ---------------------------
static char M_Mathutils_doc[] =
"This module provides access to matrices, eulers, quaternions and vectors.";
@@ -203,7 +205,7 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index)
/* BaseMathObject generic functions for all mathutils types */
char BaseMathObject_Owner_doc[] = "The item this is wrapping or None (readonly).";
-PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type )
+PyObject *BaseMathObject_getOwner(BaseMathObject *self, void *UNUSED(closure))
{
PyObject *ret= self->cb_user ? self->cb_user : Py_None;
Py_INCREF(ret);
@@ -211,7 +213,7 @@ PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type )
}
char BaseMathObject_Wrapped_doc[] = "True when this object wraps external data (readonly).\n\n:type: boolean";
-PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void *type )
+PyObject *BaseMathObject_getWrapped(BaseMathObject *self, void *UNUSED(closure))
{
return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1:0);
}
diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c
index 57d2838238c..26af8a38f6d 100644
--- a/source/blender/python/generic/mathutils_color.c
+++ b/source/blender/python/generic/mathutils_color.c
@@ -31,10 +31,15 @@
//----------------------------------mathutils.Color() -------------------
//makes a new color for you to play with
-static PyObject *Color_new(PyTypeObject * type, PyObject * args, PyObject * kwargs)
+static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
float col[3]= {0.0f, 0.0f, 0.0f};
+ if(kwds && PyDict_Size(kwds)) {
+ PyErr_SetString(PyExc_TypeError, "mathutils.Color(): takes no keyword args");
+ return NULL;
+ }
+
switch(PyTuple_GET_SIZE(args)) {
case 0:
break;
@@ -83,7 +88,7 @@ static char Color_copy_doc[] =
"\n"
" .. note:: use this to get a copy of a wrapped color with no reference to the original data.\n";
-static PyObject *Color_copy(ColorObject * self, PyObject *args)
+static PyObject *Color_copy(ColorObject *self)
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -158,7 +163,7 @@ static PyObject* Color_richcmpr(PyObject *objectA, PyObject *objectB, int compar
//---------------------SEQUENCE PROTOCOLS------------------------
//----------------------------len(object)------------------------
//sequence length
-static int Color_len(ColorObject * self)
+static int Color_len(ColorObject *UNUSED(self))
{
return COLOR_SIZE;
}
@@ -394,7 +399,7 @@ static int Color_setChannelHSV(ColorObject * self, PyObject * value, void * type
}
/* color channel (HSV), color.h/s/v */
-static PyObject *Color_getHSV(ColorObject * self, void *type)
+static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure))
{
float hsv[3];
PyObject *ret;
@@ -411,7 +416,7 @@ static PyObject *Color_getHSV(ColorObject * self, void *type)
return ret;
}
-static int Color_setHSV(ColorObject * self, PyObject * value, void * type)
+static int Color_setHSV(ColorObject * self, PyObject * value, void *UNUSED(closure))
{
float hsv[3];
@@ -452,8 +457,8 @@ static PyGetSetDef Color_getseters[] = {
//-----------------------METHOD DEFINITIONS ----------------------
static struct PyMethodDef Color_methods[] = {
- {"__copy__", (PyCFunction) Color_copy, METH_VARARGS, Color_copy_doc},
- {"copy", (PyCFunction) Color_copy, METH_VARARGS, Color_copy_doc},
+ {"__copy__", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc},
+ {"copy", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c
index f85578dd31d..c7091347493 100644
--- a/source/blender/python/generic/mathutils_euler.c
+++ b/source/blender/python/generic/mathutils_euler.c
@@ -39,7 +39,7 @@
//----------------------------------mathutils.Euler() -------------------
//makes a new euler for you to play with
-static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwargs)
+static PyObject *Euler_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
{
PyObject *seq= NULL;
char *order_str= NULL;
@@ -47,6 +47,11 @@ static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwar
float eul[EULER_SIZE]= {0.0f, 0.0f, 0.0f};
short order= EULER_ORDER_XYZ;
+ if(kwds && PyDict_Size(kwds)) {
+ PyErr_SetString(PyExc_TypeError, "mathutils.Euler(): takes no keyword args");
+ return NULL;
+ }
+
if(!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str))
return NULL;
@@ -313,7 +318,7 @@ static char Euler_copy_doc[] =
"\n"
" .. note:: use this to get a copy of a wrapped euler with no reference to the original data.\n";
-static PyObject *Euler_copy(EulerObject * self, PyObject *args)
+static PyObject *Euler_copy(EulerObject *self)
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -388,7 +393,7 @@ static PyObject* Euler_richcmpr(PyObject *objectA, PyObject *objectB, int compar
//---------------------SEQUENCE PROTOCOLS------------------------
//----------------------------len(object)------------------------
//sequence length
-static int Euler_len(EulerObject * self)
+static int Euler_len(EulerObject *UNUSED(self))
{
return EULER_SIZE;
}
@@ -411,7 +416,7 @@ static PyObject *Euler_item(EulerObject * self, int i)
}
//----------------------------object[]-------------------------
//sequence accessor (set)
-static int Euler_ass_item(EulerObject * self, int i, PyObject * value)
+static int Euler_ass_item(EulerObject * self, int i, PyObject *value)
{
float f = PyFloat_AsDouble(value);
@@ -577,18 +582,18 @@ static PyMappingMethods Euler_AsMapping = {
/*
* euler axis, euler.x/y/z
*/
-static PyObject *Euler_getAxis( EulerObject * self, void *type )
+static PyObject *Euler_getAxis(EulerObject *self, void *type )
{
return Euler_item(self, GET_INT_FROM_POINTER(type));
}
-static int Euler_setAxis( EulerObject * self, PyObject * value, void * type )
+static int Euler_setAxis(EulerObject *self, PyObject *value, void *type)
{
return Euler_ass_item(self, GET_INT_FROM_POINTER(type), value);
}
/* rotation order */
-static PyObject *Euler_getOrder(EulerObject *self, void *type)
+static PyObject *Euler_getOrder(EulerObject *self, void *UNUSED(closure))
{
const char order[][4] = {"XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"};
@@ -598,7 +603,7 @@ static PyObject *Euler_getOrder(EulerObject *self, void *type)
return PyUnicode_FromString(order[self->order-EULER_ORDER_XYZ]);
}
-static int Euler_setOrder( EulerObject * self, PyObject * value, void * type )
+static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closure))
{
char *order_str= _PyUnicode_AsString(value);
short order= euler_order_from_string(order_str, "euler.order");
@@ -634,8 +639,8 @@ static struct PyMethodDef Euler_methods[] = {
{"to_quat", (PyCFunction) Euler_ToQuat, METH_NOARGS, Euler_ToQuat_doc},
{"rotate_axis", (PyCFunction) Euler_rotate_axis, METH_VARARGS, Euler_rotate_axis_doc},
{"make_compatible", (PyCFunction) Euler_MakeCompatible, METH_O, Euler_MakeCompatible_doc},
- {"__copy__", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc},
- {"copy", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc},
+ {"__copy__", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc},
+ {"copy", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c
index 3b8c7d3122a..9476e8127b6 100644
--- a/source/blender/python/generic/mathutils_matrix.c
+++ b/source/blender/python/generic/mathutils_matrix.c
@@ -108,7 +108,7 @@ Mathutils_Callback mathutils_matrix_vector_cb = {
//----------------------------------mathutils.Matrix() -----------------
//mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc.
//create a new matrix type
-static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *Matrix_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
{
PyObject *argObject, *m, *s;
MatrixObject *mat;
@@ -117,6 +117,11 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
float scalar;
+ if(kwds && PyDict_Size(kwds)) {
+ PyErr_SetString(PyExc_TypeError, "mathutils.Matrix(): takes no keyword args");
+ return NULL;
+ }
+
argSize = PyTuple_GET_SIZE(args);
if(argSize > MATRIX_MAX_DIM) { //bad arg nums
PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n");
@@ -1142,7 +1147,7 @@ static char Matrix_copy_doc[] =
" :return: an instance of itself\n"
" :rtype: :class:`Matrix`\n";
-PyObject *Matrix_copy(MatrixObject * self)
+PyObject *Matrix_copy(MatrixObject *self)
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -1680,17 +1685,17 @@ static PyNumberMethods Matrix_NumMethods = {
0, /* nb_index */
};
-static PyObject *Matrix_getRowSize( MatrixObject * self, void *type )
+static PyObject *Matrix_getRowSize(MatrixObject *self, void *UNUSED(closure))
{
return PyLong_FromLong((long) self->rowSize);
}
-static PyObject *Matrix_getColSize( MatrixObject * self, void *type )
+static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure))
{
return PyLong_FromLong((long) self->colSize);
}
-static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type )
+static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure))
{
float mat[3][3];
@@ -1710,7 +1715,7 @@ static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type )
return PyFloat_FromDouble(mat3_to_scale(mat));
}
-static PyObject *Matrix_getIsNegative( MatrixObject * self, void *type )
+static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure))
{
if(!BaseMath_ReadCallback(self))
return NULL;
diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c
index 553844b6ee5..37f20ebbe31 100644
--- a/source/blender/python/generic/mathutils_quat.c
+++ b/source/blender/python/generic/mathutils_quat.c
@@ -352,7 +352,7 @@ static char Quaternion_copy_doc[] =
"\n"
" .. note:: use this to get a copy of a wrapped quaternion with no reference to the original data.\n";
-static PyObject *Quaternion_copy(QuaternionObject * self)
+static PyObject *Quaternion_copy(QuaternionObject *self)
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -429,7 +429,7 @@ static PyObject* Quaternion_richcmpr(PyObject *objectA, PyObject *objectB, int c
//---------------------SEQUENCE PROTOCOLS------------------------
//----------------------------len(object)------------------------
//sequence length
-static int Quaternion_len(QuaternionObject * self)
+static int Quaternion_len(QuaternionObject *UNUSED(self))
{
return QUAT_SIZE;
}
@@ -772,7 +772,7 @@ static int Quaternion_setAxis( QuaternionObject * self, PyObject * value, void *
return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value);
}
-static PyObject *Quaternion_getMagnitude( QuaternionObject * self, void *type )
+static PyObject *Quaternion_getMagnitude(QuaternionObject * self, void *UNUSED(closure))
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -780,7 +780,7 @@ static PyObject *Quaternion_getMagnitude( QuaternionObject * self, void *type )
return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat)));
}
-static PyObject *Quaternion_getAngle( QuaternionObject * self, void *type )
+static PyObject *Quaternion_getAngle(QuaternionObject * self, void *UNUSED(closure))
{
if(!BaseMath_ReadCallback(self))
return NULL;
@@ -788,7 +788,7 @@ static PyObject *Quaternion_getAngle( QuaternionObject * self, void *type )
return PyFloat_FromDouble(2.0 * (saacos(self->quat[0])));
}
-static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void * type)
+static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void *UNUSED(closure))
{
float axis[3];
float angle;
@@ -821,7 +821,7 @@ static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void *
return 0;
}
-static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *type)
+static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(closure))
{
float axis[3];
float angle;
@@ -842,7 +842,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *type)
return (PyObject *) newVectorObject(axis, 3, Py_NEW, NULL);
}
-static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *type)
+static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
{
float axis[3];
float angle;
@@ -872,12 +872,17 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *
}
//----------------------------------mathutils.Quaternion() --------------
-static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *Quaternion_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
{
PyObject *seq= NULL;
float angle = 0.0f;
float quat[QUAT_SIZE]= {0.0f, 0.0f, 0.0f, 0.0f};
+ if(kwds && PyDict_Size(kwds)) {
+ PyErr_SetString(PyExc_TypeError, "mathutils.Quaternion(): takes no keyword args");
+ return NULL;
+ }
+
if(!PyArg_ParseTuple(args, "|Of:mathutils.Quaternion", &seq, &angle))
return NULL;
diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c
index 1fe2518c6ef..84f41b6e66a 100644
--- a/source/blender/python/generic/mathutils_vector.c
+++ b/source/blender/python/generic/mathutils_vector.c
@@ -45,7 +45,7 @@ static PyObject *Vector_ToTupleExt(VectorObject *self, int ndigits);
//----------------------------------mathutils.Vector() ------------------
// Supports 2D, 3D, and 4D vector objects both int and float values
// accepted. Mixed float and int values accepted. Ints are parsed to float
-static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
{
float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f};
int size= 3; /* default to a 3D vector */
@@ -1445,7 +1445,7 @@ static int Vector_setAxis(VectorObject *self, PyObject * value, void * type )
}
/* vector.length */
-static PyObject *Vector_getLength(VectorObject *self, void *type )
+static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure))
{
double dot = 0.0f;
int i;
diff --git a/source/blender/python/generic/noise.c b/source/blender/python/generic/noise.c
index 4a09cbb58d8..a9bbc016a54 100644
--- a/source/blender/python/generic/noise.c
+++ b/source/blender/python/generic/noise.c
@@ -39,6 +39,8 @@
#include "BLI_blenlib.h"
#include "DNA_texture_types.h"
+
+#include "BKE_utildefines.h"
/*-----------------------------------------*/
/* 'mersenne twister' random number generator */
@@ -207,12 +209,12 @@ static void randuvec(float v[3])
v[2] = 1.f;
}
-static PyObject *Noise_random(PyObject * self)
+static PyObject *Noise_random(PyObject *UNUSED(self))
{
return PyFloat_FromDouble(frand());
}
-static PyObject *Noise_random_unit_vector(PyObject * self)
+static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self))
{
float v[3] = {0.0f, 0.0f, 0.0f};
randuvec(v);
@@ -223,7 +225,7 @@ static PyObject *Noise_random_unit_vector(PyObject * self)
/* Random seed init. Only used for MT random() & randuvec() */
-static PyObject *Noise_seed_set(PyObject * self, PyObject * args)
+static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args)
{
int s;
if(!PyArg_ParseTuple(args, "i:seed_set", &s))
@@ -236,7 +238,7 @@ static PyObject *Noise_seed_set(PyObject * self, PyObject * args)
/* General noise */
-static PyObject *Noise_noise(PyObject * self, PyObject * args)
+static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z;
int nb = 1;
@@ -260,7 +262,7 @@ static void noise_vector(float x, float y, float z, int nb, float v[3])
nb) - 1.0);
}
-static PyObject *Noise_vector(PyObject * self, PyObject * args)
+static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, v[3];
int nb = 1;
@@ -296,7 +298,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
return out;
}
-static PyObject *Noise_turbulence(PyObject * self, PyObject * args)
+static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z;
int oct, hd, nb = 1;
@@ -340,7 +342,7 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb,
}
}
-static PyObject *Noise_turbulence_vector(PyObject * self, PyObject * args)
+static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, v[3];
int oct, hd, nb = 1;
@@ -355,7 +357,7 @@ static PyObject *Noise_turbulence_vector(PyObject * self, PyObject * args)
/* F. Kenton Musgrave's fractal functions */
-static PyObject *Noise_fractal(PyObject * self, PyObject * args)
+static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct;
int nb = 1;
@@ -366,7 +368,7 @@ static PyObject *Noise_fractal(PyObject * self, PyObject * args)
/*------------------------------------------------------------------------*/
-static PyObject *Noise_multi_fractal(PyObject * self, PyObject * args)
+static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct;
int nb = 1;
@@ -378,7 +380,7 @@ static PyObject *Noise_multi_fractal(PyObject * self, PyObject * args)
/*------------------------------------------------------------------------*/
-static PyObject *Noise_vl_vector(PyObject * self, PyObject * args)
+static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, d;
int nt1 = 1, nt2 = 1;
@@ -389,7 +391,7 @@ static PyObject *Noise_vl_vector(PyObject * self, PyObject * args)
/*-------------------------------------------------------------------------*/
-static PyObject *Noise_hetero_terrain(PyObject * self, PyObject * args)
+static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct, ofs;
int nb = 1;
@@ -401,7 +403,7 @@ static PyObject *Noise_hetero_terrain(PyObject * self, PyObject * args)
/*-------------------------------------------------------------------------*/
-static PyObject *Noise_hybrid_multi_fractal(PyObject * self, PyObject * args)
+static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct, ofs, gn;
int nb = 1;
@@ -413,7 +415,7 @@ static PyObject *Noise_hybrid_multi_fractal(PyObject * self, PyObject * args)
/*------------------------------------------------------------------------*/
-static PyObject *Noise_ridged_multi_fractal(PyObject * self, PyObject * args)
+static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, H, lac, oct, ofs, gn;
int nb = 1;
@@ -424,7 +426,7 @@ static PyObject *Noise_ridged_multi_fractal(PyObject * self, PyObject * args)
/*-------------------------------------------------------------------------*/
-static PyObject *Noise_voronoi(PyObject * self, PyObject * args)
+static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, da[4], pa[12];
int dtype = 0;
@@ -441,7 +443,7 @@ static PyObject *Noise_voronoi(PyObject * self, PyObject * args)
/*-------------------------------------------------------------------------*/
-static PyObject *Noise_cell(PyObject * self, PyObject * args)
+static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z;
if(!PyArg_ParseTuple(args, "(fff):cell", &x, &y, &z))
@@ -452,7 +454,7 @@ static PyObject *Noise_cell(PyObject * self, PyObject * args)
/*--------------------------------------------------------------------------*/
-static PyObject *Noise_cell_vector(PyObject * self, PyObject * args)
+static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args)
{
float x, y, z, ca[3];
if(!PyArg_ParseTuple(args, "(fff):cell_vector", &x, &y, &z))
@@ -603,22 +605,22 @@ look like anything from an earthquake to a very nervous or maybe even drunk came
/* Just in case, declarations for a header file */
/*
-static PyObject *Noise_random(PyObject *self);
-static PyObject *Noise_random_unit_vector(PyObject *self);
-static PyObject *Noise_seed_set(PyObject *self, PyObject *args);
-static PyObject *Noise_noise(PyObject *self, PyObject *args);
-static PyObject *Noise_vector(PyObject *self, PyObject *args);
-static PyObject *Noise_turbulence(PyObject *self, PyObject *args);
-static PyObject *Noise_turbulence_vector(PyObject *self, PyObject *args);
-static PyObject *Noise_fractal(PyObject *self, PyObject *args);
-static PyObject *Noise_multi_fractal(PyObject *self, PyObject *args);
-static PyObject *Noise_vl_vector(PyObject *self, PyObject *args);
-static PyObject *Noise_hetero_terrain(PyObject *self, PyObject *args);
-static PyObject *Noise_hybrid_multi_fractal(PyObject *self, PyObject *args);
-static PyObject *Noise_ridged_multi_fractal(PyObject *self, PyObject *args);
-static PyObject *Noise_voronoi(PyObject *self, PyObject *args);
-static PyObject *Noise_cell(PyObject *self, PyObject *args);
-static PyObject *Noise_cell_vector(PyObject *self, PyObject *args);
+static PyObject *Noise_random(PyObject *UNUSED(self));
+static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self));
+static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args);
+static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args);
*/
static PyMethodDef NoiseMethods[] = {
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 69b5faceca0..afcf7e757e6 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -34,7 +34,9 @@
#include "BLI_path_util.h"
#include "BLI_bpath.h"
-
+
+#include "BKE_utildefines.h"
+
/* external util modules */
#include "../generic/geometry.h"
#include "../generic/bgl.h"
@@ -51,7 +53,7 @@ static char bpy_script_paths_doc[] =
" :return: (system, user) strings will be empty when not found.\n"
" :rtype: tuple of strigs\n";
-PyObject *bpy_script_paths(PyObject *self)
+PyObject *bpy_script_paths(PyObject *UNUSED(self))
{
PyObject *ret= PyTuple_New(2);
char *path;
@@ -73,7 +75,7 @@ static char bpy_blend_paths_doc[] =
" :type absolute: boolean\n"
" :return: path list.\n"
" :rtype: list of strigs\n";
-static PyObject *bpy_blend_paths(PyObject * self, PyObject *args, PyObject *kw)
+static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
struct BPathIterator bpi;
PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe */
@@ -124,7 +126,7 @@ static char bpy_user_resource_doc[] =
" :type subdir: string\n"
" :return: a path.\n"
" :rtype: string\n";
-static PyObject *bpy_user_resource(PyObject * self, PyObject *args, PyObject *kw)
+static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
char *type;
char *subdir= NULL;
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 78658a611a3..39494678a12 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -26,16 +26,22 @@
#include "BLI_path_util.h"
+#include "BKE_utildefines.h"
#include "BKE_blender.h"
#include "BKE_global.h"
#include "structseq.h"
+#include "../generic/py_capi_utils.h"
+
#ifdef BUILD_DATE
extern char build_date[];
extern char build_time[];
extern char build_rev[];
extern char build_platform[];
extern char build_type[];
+extern char build_cflags[];
+extern char build_cxxflags[];
+extern char build_linkflags[];
#endif
static PyTypeObject BlenderAppType;
@@ -44,7 +50,6 @@ static PyStructSequence_Field app_info_fields[] = {
{"version", "The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"},
{"version_string", "The Blender version formatted as a string"},
{"binary_path", "The location of blenders executable, useful for utilities that spawn new instances"},
- {"debug", "Boolean, set when blender is running in debug mode (started with -d)"},
{"background", "Boolean, True when blender is running without a user interface (started with -b)"},
/* buildinfo */
@@ -53,6 +58,9 @@ static PyStructSequence_Field app_info_fields[] = {
{"build_revision", "The subversion revision this blender instance was built with"},
{"build_platform", "The platform this blender instance was built for"},
{"build_type", "The type of build (Release, Debug)"},
+ {"build_cflags", ""},
+ {"build_cxxflags", ""},
+ {"build_linkflags", ""},
{0}
};
@@ -85,7 +93,6 @@ static PyObject *make_app_info(void)
SetObjItem(Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
SetStrItem(bprogname);
- SetObjItem(PyBool_FromLong(G.f & G_DEBUG));
SetObjItem(PyBool_FromLong(G.background));
/* build info */
@@ -95,12 +102,18 @@ static PyObject *make_app_info(void)
SetStrItem(build_rev);
SetStrItem(build_platform);
SetStrItem(build_type);
+ SetStrItem(build_cflags);
+ SetStrItem(build_cxxflags);
+ SetStrItem(build_linkflags);
#else
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
+ SetStrItem("Unknown");
+ SetStrItem("Unknown");
+ SetStrItem("Unknown");
#endif
#undef SetIntItem
@@ -114,10 +127,51 @@ static PyObject *make_app_info(void)
return app_info;
}
+/* a few getsets because it makes sense for them to be in bpy.app even though
+ * they are not static */
+static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure))
+{
+ return PyBool_FromLong(G.f & G_DEBUG);
+}
+
+static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
+{
+ int param= PyObject_IsTrue(value);
+
+ if(param < 0) {
+ PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False");
+ return -1;
+ }
+
+ if(param) G.f |= G_DEBUG;
+ else G.f &= ~G_DEBUG;
+
+ return 0;
+}
+
+static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure))
+{
+ extern char btempdir[];
+ return PyC_UnicodeFromByte(btempdir);
+}
+
+PyGetSetDef bpy_app_debug_getset= {"debug", bpy_app_debug_get, bpy_app_debug_set, "Boolean, set when blender is running in debug mode (started with -d)", NULL};
+PyGetSetDef bpy_app_tempdir_getset= {"tempdir", bpy_app_tempdir_get, NULL, "String, the temp directory used by blender (read-only)", NULL};
+
+static void py_struct_seq_getset_init(void)
+{
+ /* tricky dynamic members, not to py-spec! */
+
+ PyDict_SetItemString(BlenderAppType.tp_dict, bpy_app_debug_getset.name, PyDescr_NewGetSet(&BlenderAppType, &bpy_app_debug_getset));
+ PyDict_SetItemString(BlenderAppType.tp_dict, bpy_app_tempdir_getset.name, PyDescr_NewGetSet(&BlenderAppType, &bpy_app_tempdir_getset));
+}
+/* end dynamic bpy.app */
+
+
PyObject *BPY_app_struct(void)
{
PyObject *ret;
-
+
PyStructSequence_InitType(&BlenderAppType, &app_info_desc);
ret= make_app_info();
@@ -125,6 +179,10 @@ PyObject *BPY_app_struct(void)
/* prevent user from creating new instances */
BlenderAppType.tp_init = NULL;
BlenderAppType.tp_new = NULL;
-
+
+ /* kindof a hack ontop of PyStructSequence */
+ py_struct_seq_getset_init();
+
return ret;
}
+
diff --git a/source/blender/python/intern/bpy_array.c b/source/blender/python/intern/bpy_array.c
index 6d971d8708e..d219757b777 100644
--- a/source/blender/python/intern/bpy_array.c
+++ b/source/blender/python/intern/bpy_array.c
@@ -237,7 +237,7 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int
return data;
}
-static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix)
+static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix)
{
int totdim, dim_size[MAX_ARRAY_DIMENSION];
int totitem;
@@ -358,18 +358,18 @@ static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *
RNA_property_boolean_set_index(ptr, prop, index, *(int*)value);
}
-int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix)
+int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix)
{
int ret;
switch (RNA_property_type(prop)) {
case PROP_FLOAT:
- ret= py_to_array(py, ptr, prop, parms, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
+ ret= py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
break;
case PROP_INT:
- ret= py_to_array(py, ptr, prop, parms, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
+ ret= py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
break;
case PROP_BOOLEAN:
- ret= py_to_array(py, ptr, prop, parms, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
+ ret= py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
break;
default:
PyErr_SetString(PyExc_TypeError, "not an array type");
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index bc79ba94756..3ff0d86b433 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -43,6 +43,7 @@
#include "BLI_math_base.h"
#include "BLI_string.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "BKE_text.h"
#include "BKE_font.h" /* only for utf8towchar */
@@ -104,7 +105,8 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
}
}
-void bpy_context_clear(bContext *C, PyGILState_STATE *gilstate)
+/* context should be used but not now because it causes some bugs */
+void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate)
{
py_call_level--;
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 2b475a57de6..3ffa78dab70 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -40,7 +40,7 @@
#include "MEM_guardedalloc.h"
#include "BKE_report.h"
-static PyObject *pyop_poll( PyObject * self, PyObject * args)
+static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
char *opname;
@@ -80,7 +80,7 @@ static PyObject *pyop_poll( PyObject * self, PyObject * args)
return ret;
}
-static PyObject *pyop_call( PyObject * self, PyObject * args)
+static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
int error_val = 0;
@@ -196,7 +196,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args)
}
-static PyObject *pyop_as_string( PyObject * self, PyObject * args)
+static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
PointerRNA ptr;
@@ -248,7 +248,7 @@ static PyObject *pyop_as_string( PyObject * self, PyObject * args)
return pybuf;
}
-static PyObject *pyop_dir(PyObject *self)
+static PyObject *pyop_dir(PyObject *UNUSED(self))
{
PyObject *list = PyList_New(0), *name;
wmOperatorType *ot;
@@ -262,7 +262,7 @@ static PyObject *pyop_dir(PyObject *self)
return list;
}
-static PyObject *pyop_getrna(PyObject *self, PyObject *value)
+static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value)
{
wmOperatorType *ot;
PointerRNA ptr;
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 6d16896fb16..fa1aeacbc42 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -84,7 +84,7 @@ void macro_wrapper(wmOperatorType *ot, void *userdata)
operator_properties_init(ot);
}
-PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args)
+PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
{
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 93106d5400f..a3b0c4739c4 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -58,7 +58,7 @@
#include "../generic/IDProp.h" /* for IDprop lookups */
#include "../generic/py_capi_utils.h"
-static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix);
+static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix);
static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length);
static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self);
static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self);
@@ -135,7 +135,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
return 1;
}
-static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int index)
+static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
@@ -146,7 +146,7 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int
return 1;
}
-static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int index)
+static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
@@ -176,7 +176,7 @@ Mathutils_Callback mathutils_rna_array_cb = {
/* bpyrna matrix callbacks */
static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */
-static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype)
+static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
@@ -187,7 +187,7 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype)
return 1;
}
-static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype)
+static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
{
BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
@@ -864,7 +864,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
break;
}
} else {
- if (pyrna_py_to_prop(ptr, prop, NULL, NULL, item, error_prefix)) {
+ if (pyrna_py_to_prop(ptr, prop, NULL, item, error_prefix)) {
error_val= -1;
break;
}
@@ -918,7 +918,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func)
-static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix)
+static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix)
{
/* XXX hard limits should be checked here */
int type = RNA_property_type(prop);
@@ -941,7 +941,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p
return -1;
}
/* done getting the length */
- ok= pyrna_py_to_array(ptr, prop, parms, data, value, error_prefix);
+ ok= pyrna_py_to_array(ptr, prop, data, value, error_prefix);
if (!ok) {
/* PyErr_Format(PyExc_AttributeError, "%.200s %s", error_prefix, error_str); */
@@ -964,7 +964,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p
else
param = PyLong_AsLong( value );
- if( param < 0 || param > 1) {
+ if(param < 0) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
return -1;
} else {
@@ -1391,7 +1391,7 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons
}
/* static PyObject *pyrna_prop_array_subscript_str(BPy_PropertyRNA *self, char *keyname) */
-static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length)
+static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop)
{
PointerRNA newptr;
PyObject *list = PyList_New(stop - start);
@@ -1513,7 +1513,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
return PyList_New(0);
}
else if (step == 1) {
- return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop, len);
+ return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop);
}
else {
PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported with rna");
@@ -2431,7 +2431,7 @@ static char pyrna_struct_type_recast_doc[] =
" :return: a new instance of this object with the type initialized again.\n"
" :rtype: subclass of :class:`bpy_struct`";
-static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self, PyObject *args)
+static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self)
{
PointerRNA r_ptr;
RNA_pointer_recast(&self->ptr, &r_ptr);
@@ -2751,7 +2751,7 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec
PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported");
return -1;
}
- return pyrna_py_to_prop(&self->ptr, prop, NULL, NULL, value, "bpy_struct: item.attr = val:");
+ return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr = val:");
}
else {
return PyObject_GenericSetAttr((PyObject *)self, pyname, value);
@@ -2835,7 +2835,7 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna
else if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
if ((prop = RNA_struct_find_property(&r_ptr, name))) {
/* pyrna_py_to_prop sets its own exceptions */
- return pyrna_py_to_prop(&r_ptr, prop, NULL, NULL, value, "BPy_PropertyRNA - Attribute (setattr):");
+ return pyrna_py_to_prop(&r_ptr, prop, NULL, value, "BPy_PropertyRNA - Attribute (setattr):");
}
}
@@ -3409,7 +3409,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
* todo - also accept useful args */
-static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
+static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) {
BPy_StructRNA *base;
@@ -3432,7 +3432,7 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject
/* only needed for subtyping, so a new class gets a valid BPy_StructRNA
* todo - also accept useful args */
-static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
+static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) {
BPy_PropertyRNA *base;
@@ -3454,15 +3454,14 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *k
}
}
-PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *prop, void *data)
+PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
{
PyObject *ret;
int type = RNA_property_type(prop);
int flag = RNA_property_flag(prop);
- int a;
if(RNA_property_array_check(ptr, prop)) {
- int len;
+ int a, len;
if (flag & PROP_DYNAMIC) {
ParameterDynAlloc *data_alloc= data;
@@ -3705,7 +3704,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
continue;
}
- err= pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, "");
+ err= pyrna_py_to_prop(&funcptr, parm, iter.data, item, "");
if(err!=0) {
/* the error generated isnt that useful, so generate it again with a useful prefix
@@ -3718,7 +3717,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
else
snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with argument %d, \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), i, parm_id);
- pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, error_prefix);
+ pyrna_py_to_prop(&funcptr, parm, iter.data, item, error_prefix);
break;
}
@@ -3823,13 +3822,13 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
flag= RNA_property_flag(parm);
if (flag & PROP_OUTPUT)
- PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, &parms, parm, iter.data));
+ PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, parm, iter.data));
}
RNA_parameter_list_end(&iter);
}
else
- ret= pyrna_param_to_py(&funcptr, &parms, pret_single, retdata_single);
+ ret= pyrna_param_to_py(&funcptr, pret_single, retdata_single);
/* possible there is an error in conversion */
if(ret==NULL)
@@ -5013,7 +5012,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
if(strcmp(identifier, rna_attr) == 0) { \
item= PyObject_GetAttrString(py_class, py_attr); \
if(item && item != Py_None) { \
- if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) { \
+ if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) { \
Py_DECREF(item); \
return -1; \
} \
@@ -5037,7 +5036,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
else {
Py_DECREF(item); /* no need to keep a ref, the class owns it */
- if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0)
+ if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0)
return -1;
}
}
@@ -5157,7 +5156,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
continue;
}
- parmitem= pyrna_param_to_py(&funcptr, parms, parm, iter.data);
+ parmitem= pyrna_param_to_py(&funcptr, parm, iter.data);
PyTuple_SET_ITEM(args, i, parmitem);
i++;
}
@@ -5192,7 +5191,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
err= -1;
}
else if(ret_len==1) {
- err= pyrna_py_to_prop(&funcptr, pret_single, parms, retdata_single, ret, "calling class function:");
+ err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, "calling class function:");
}
else if (ret_len > 1) {
@@ -5215,7 +5214,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
/* only useful for single argument returns, we'll need another list loop for multiple */
if (flag & PROP_OUTPUT) {
- err= pyrna_py_to_prop(&funcptr, parm, parms, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:");
+ err= pyrna_py_to_prop(&funcptr, parm, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:");
if(err)
break;
}
@@ -5329,7 +5328,7 @@ void pyrna_free_types(void)
* - Should still be fixed - Campbell
* */
-static PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class)
+static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_class)
{
bContext *C= NULL;
ReportList reports;
@@ -5426,7 +5425,7 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN
return 0;
}
-static PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class)
+static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_class)
{
bContext *C= NULL;
StructUnregisterFunc unreg;
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 7f750f94242..77b602b6f83 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -99,7 +99,7 @@ void pyrna_alloc_types(void);
void pyrna_free_types(void);
/* primitive type conversion */
-int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix);
+int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix);
int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix);
PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index);
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index b2a7511f998..81d6e0cd4da 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -27,6 +27,7 @@
#include "bpy_util.h"
#include "DNA_screen_types.h"
+#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "ED_space_api.h"
@@ -34,7 +35,7 @@
#define RNA_CAPSULE_ID "RNA_HANDLE"
#define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED"
-void cb_region_draw(const bContext *C, ARegion *ar, void *customdata)
+void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata)
{
PyObject *cb_func, *cb_args, *result;
PyGILState_STATE gilstate;