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:
authorWillian Padovani Germano <wpgermano@gmail.com>2003-07-22 04:27:03 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2003-07-22 04:27:03 +0400
commitde608898659ea46b1c8dd590cfcd405dc85ccb3f (patch)
tree00ce951d22fea2bd15725325b3e26e104636aa3b
parent9a5cf3cb6679c111794856f038231eab1976826e (diff)
Exppython docs:
- Updates and fixes to the documentation files, only, no code involved.
-rw-r--r--source/blender/python/api2_2x/doc/BGL.py83
-rw-r--r--source/blender/python/api2_2x/doc/Blender.py2
-rw-r--r--source/blender/python/api2_2x/doc/Curve.py11
-rw-r--r--source/blender/python/api2_2x/doc/Draw.py107
-rw-r--r--source/blender/python/api2_2x/doc/Effect.py2
-rw-r--r--source/blender/python/api2_2x/doc/Ipo.py9
-rw-r--r--source/blender/python/api2_2x/doc/Metaball.py5
-rw-r--r--source/blender/python/api2_2x/doc/NMesh.py6
-rw-r--r--source/blender/python/api2_2x/doc/Scene.py18
-rw-r--r--source/blender/python/api2_2x/doc/Types.py35
-rw-r--r--source/blender/python/api2_2x/doc/Window.py18
-rw-r--r--source/blender/python/api2_2x/doc/World.py13
12 files changed, 170 insertions, 139 deletions
diff --git a/source/blender/python/api2_2x/doc/BGL.py b/source/blender/python/api2_2x/doc/BGL.py
index b5f56c0c5d0..eec9961c06b 100644
--- a/source/blender/python/api2_2x/doc/BGL.py
+++ b/source/blender/python/api2_2x/doc/BGL.py
@@ -20,46 +20,45 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
@see: U{www.opengl.org}
Example::
-
- 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
+ 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/api2_2x/doc/Blender.py b/source/blender/python/api2_2x/doc/Blender.py
index fa977d0f82a..4db6044e414 100644
--- a/source/blender/python/api2_2x/doc/Blender.py
+++ b/source/blender/python/api2_2x/doc/Blender.py
@@ -99,4 +99,6 @@ def ReleaseGlobalDict (bool = None):
behavior.
@rtype: int
@return: A bool value (0 or 1) telling the current behavior.
+ @warn: This function was added as a test and there's a good chance that it
+ won't be kept in the future, in favor of a better method.
"""
diff --git a/source/blender/python/api2_2x/doc/Curve.py b/source/blender/python/api2_2x/doc/Curve.py
index 55e7b707762..f8cc36540df 100644
--- a/source/blender/python/api2_2x/doc/Curve.py
+++ b/source/blender/python/api2_2x/doc/Curve.py
@@ -9,13 +9,12 @@ Curve Data
This module provides access to B{Curve Data} objects in Blender.
Example::
-
from Blender import Curve, Object, Scene
- c = Curve.New(). # create new curve data
- cur = Scene.getCurrent(). # get current scene
- ob = Object.New('Curve'). # make curve object
- ob.link(c). # link curve data with this object
- cur.link(ob). # link object into scene
+ c = Curve.New() # create new curve data
+ cur = Scene.getCurrent() # get current scene
+ ob = Object.New('Curve') # make curve object
+ ob.link(c) # link curve data with this object
+ cur.link(ob) # link object into scene
"""
def New ( name = 'CurData'):
diff --git a/source/blender/python/api2_2x/doc/Draw.py b/source/blender/python/api2_2x/doc/Draw.py
index a0135b1bcfd..ffba6863213 100644
--- a/source/blender/python/api2_2x/doc/Draw.py
+++ b/source/blender/python/api2_2x/doc/Draw.py
@@ -12,63 +12,64 @@ scrollbar, plus support for text drawing. It also includes keyboard keys and
mouse button code values in its dictionary (print dir(Blender.Draw)).
Example::
- import Blender
- from Blender import Draw, BGL
- #
- mystring = ""
- mymsg = ""
- toggle = 0
- #
- def event(evt, val): # the function to handle input events
- global mystring, mymsg
+ import Blender
+ from Blender import Draw, BGL
+ #
+ mystring = ""
+ mymsg = ""
+ toggle = 0
+ #
+ def event(evt, val): # the function to handle input events
+ global mystring, mymsg
- if not val: # val = 0: it's a key/mbutton release
- if evt in [Draw.LEFTMOUSE, Draw.MIDDLEMOUSE, Draw.RIGHTMOUSE]:
- mymsg = "You released a mouse button."
- Draw.Redraw(1)
- return
+ if not val: # val = 0: it's a key/mbutton release
+ if evt in [Draw.LEFTMOUSE, Draw.MIDDLEMOUSE, Draw.RIGHTMOUSE]:
+ mymsg = "You released a mouse button."
+ Draw.Redraw(1)
+ return
- if evt == Draw.ESCKEY:
- Draw.Exit() # exit when user presses ESC
- return
+ if evt == Draw.ESCKEY:
+ Draw.Exit() # exit when user presses ESC
+ return
- elif Draw.AKEY <= evt <= Draw.ZKEY: mystring += chr(evt)
- elif evt == Draw.SPACEKEY: mystring += ' '
- elif evt == Draw.BACKSPACEKEY and len(mystring):
- mystring = mystring[:-1]
- else: return # this is important: only re-register if an event was caught
+ elif Draw.AKEY <= evt <= Draw.ZKEY: mystring += chr(evt)
+ elif evt == Draw.SPACEKEY: mystring += ' '
+ elif evt == Draw.BACKSPACEKEY and len(mystring):
+ mystring = mystring[:-1]
+ else: return # this is important: only re-register if an event was caught
+
+ Draw.Register(gui, event, button_event) # re-register to stay in the loop
+ #
+ def button_event(evt): # the function to handle Draw Button events
+ global mymsg, toggle
+ if evt == 1:
+ mymsg = "You pressed the toggle button."
+ toggle = 1 - toggle
+ Draw.Redraw(1)
+ else:
+ Draw.Register(gui, event, button_event)
+ #
+ def gui(): # the function to draw the screen
+ global mystring, mymsg, toggle
+ if len(mystring) > 90: mystring = ""
+ BGL.glClearColor(0,0,1,1)
+ BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
+ BGL.glColor3f(1,1,1)
+ Draw.Toggle("Toggle", 1, 10, 10, 55, 20, toggle,"A toggle button")
+ BGL.glRasterPos2i(72, 16)
+ if toggle: toggle_state = "down"
+ else: toggle_state = "up"
+ Draw.Text("The toggle button is %s." % toggle_state, "small")
+ BGL.glRasterPos2i(10, 230)
+ Draw.Text("Type letters from a to z, ESC to leave.")
+ BGL.glRasterPos2i(20, 200)
+ Draw.Text(mystring)
+ BGL.glColor3f(1,0.4,0.3)
+ BGL.glRasterPos2i(340, 70)
+ Draw.Text(mymsg, "tiny")
+ #
+ Draw.Register(gui, event, button_event) # registering the 3 callbacks
- Draw.Register(gui, event, button_event) # re-register to stay in the loop
- #
- def button_event(evt): # the function to handle Draw Button events
- global mymsg, toggle
- if evt == 1:
- mymsg = "You pressed the toggle button."
- toggle = 1 - toggle
- Draw.Redraw(1)
- else:
- Draw.Register(gui, event, button_event)
- #
- def gui(): # the function to draw the screen
- global mystring, mymsg, toggle
- if len(mystring) > 90: mystring = ""
- BGL.glClearColor(0,0,1,1)
- BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
- BGL.glColor3f(1,1,1)
- Draw.Toggle("Toggle", 1, 10, 10, 55, 20, toggle,"A toggle button")
- BGL.glRasterPos2i(72, 16)
- if toggle: toggle_state = "down"
- else: toggle_state = "up"
- Draw.Text("The toggle button is %s." % toggle_state, "small")
- BGL.glRasterPos2i(10, 230)
- Draw.Text("Type letters from a to z, ESC to leave.")
- BGL.glRasterPos2i(20, 200)
- Draw.Text(mystring)
- BGL.glColor3f(1,0.4,0.3)
- BGL.glRasterPos2i(340, 70)
- Draw.Text(mymsg, "tiny")
- #
- Draw.Register(gui, event, button_event) # registering the 3 callbacks
@warn: Inside the windowing loop (after Draw.Register() has been executed and
before Draw.Exit() is called), don't use the redraw functions from other
modules (Blender and Window). The Draw submodule has its own Draw.Redraw() and
diff --git a/source/blender/python/api2_2x/doc/Effect.py b/source/blender/python/api2_2x/doc/Effect.py
index 3dc5be89bac..f17f8a9ffa9 100644
--- a/source/blender/python/api2_2x/doc/Effect.py
+++ b/source/blender/python/api2_2x/doc/Effect.py
@@ -19,8 +19,8 @@ effect, which can be a wave, particle or build effect. The python API follows
this structure : the Effect module grants access to (the few) data which
are shared between all effects. It has three submodules : Wave, Build, Particle
, which grant r/w access to the real parameters of these effects.
-Example::
+Example::
import Blender
"""
diff --git a/source/blender/python/api2_2x/doc/Ipo.py b/source/blender/python/api2_2x/doc/Ipo.py
index 661e829be57..fc2cb144eff 100644
--- a/source/blender/python/api2_2x/doc/Ipo.py
+++ b/source/blender/python/api2_2x/doc/Ipo.py
@@ -7,13 +7,12 @@ This module provides access to the Ipo Data in Blender.
Example::
-
import Blender
ob = Blender.Ipo.Get('ipo') # retreives an ipo object
- ob.setName('ipo1')
- print ob.name
- print ipo.getRctf()
- ipo.setRctf(1,2,3,4)
+ ob.setName('ipo1')
+ print ob.name
+ print ipo.getRctf()
+ ipo.setRctf(1,2,3,4)
"""
diff --git a/source/blender/python/api2_2x/doc/Metaball.py b/source/blender/python/api2_2x/doc/Metaball.py
index 259c918ca5d..e4f08aa131d 100644
--- a/source/blender/python/api2_2x/doc/Metaball.py
+++ b/source/blender/python/api2_2x/doc/Metaball.py
@@ -6,10 +6,9 @@ The Blender.Metaball submodule
This module provides access to the B{Metaball Data} in Blender.
Example::
-
import Blender
- scene = Blencer.Scene.getCurrent () # get the current scene
- ob = Blender.Metaball.New ('mball') # make metaball
+ scene = Blender.Scene.getCurrent () # get the current scene
+ ob = Blender.Metaball.New ('mball') # make metaball
"""
def New (name):
diff --git a/source/blender/python/api2_2x/doc/NMesh.py b/source/blender/python/api2_2x/doc/NMesh.py
index b66fc0b19f0..37bc15b2d59 100644
--- a/source/blender/python/api2_2x/doc/NMesh.py
+++ b/source/blender/python/api2_2x/doc/NMesh.py
@@ -280,6 +280,12 @@ class NMesh :
@type frame: int
@param frame: The Scene frame where the mesh key should be inserted. If
None, the current frame is used.
+ @warn: This and L{removeAllKeys} were included in this release only to
+ make accessing vertex keys possible, but are not a proper solution.
+ For example, it seems that 'frame' should be kept in the range [1, 100]
+ (the curves can be manually tweaked in the Ipo Curve Editor window in
+ Blender itself later). In the future a complete Key module should be
+ created.
"""
def removeAllKeys():
diff --git a/source/blender/python/api2_2x/doc/Scene.py b/source/blender/python/api2_2x/doc/Scene.py
index 3983735e227..d17e593ad47 100644
--- a/source/blender/python/api2_2x/doc/Scene.py
+++ b/source/blender/python/api2_2x/doc/Scene.py
@@ -9,7 +9,19 @@ Scene
This module provides access to B{Scenes} in Blender.
Example::
-
+ import Blender
+ from Blender import Scene, Object, Camera
+ #
+ camdata = Camera.New('ortho') # create new camera data
+ camdata.setName('newCam')
+ camdata.setLens(16.0)
+ camobj = Object.New('Camera') # create a new camera object
+ camobj.link(camdata) # link data to object
+ scene = Scene.New('NewScene') # create a new scene
+ scene.link(camobj) # link object to scene
+ scene.frameSettings(1, 100 ,1) # set start, end and current frames
+ scene.setWinSize(640, 480) # set the render window dimensions
+ scene.makeCurrent() # make this the current scene
"""
def New (name = 'Scene'):
@@ -71,7 +83,7 @@ class Scene:
"""
Get the current x,y resolution of the render window. These are the
dimensions of the image created by the Blender Renderer.
- @rtype: list
+ @rtype: list of two ints
@return: [width, height].
"""
@@ -79,7 +91,7 @@ class Scene:
"""
Set the width and height of the render window. These are the dimensions
of the image created by the Blender Renderer.
- @type dimensions: list
+ @type dimensions: list of two ints
@param dimensions: The new [width, height] values.
"""
diff --git a/source/blender/python/api2_2x/doc/Types.py b/source/blender/python/api2_2x/doc/Types.py
index 34733849c7a..49c87cde4c3 100644
--- a/source/blender/python/api2_2x/doc/Types.py
+++ b/source/blender/python/api2_2x/doc/Types.py
@@ -7,24 +7,23 @@ The Blender.Types submodule
This module is a dictionary of Blender Python types, for type checking.
Example::
-
- import Blender
- from Blender import Types, Object, NMesh, Camera, Lamp
- #
- objs = Object.Get() # a list of all objects in the current scene
- for o in objs:
- print
- print o, type(o)
- data = o.getData()
- print type(data)
- if type(data) == Types.NMeshType:
- if len(data.verts):
- print "its vertices are obviously of type:", type(data.verts[0])
- print "and its faces:", Types.NMFaceType
- elif type(data) == Types.CameraType:
- print "It's a Camera."
- elif type(data) == Types.LampType:
- print "Let there be light!"
+ import Blender
+ from Blender import Types, Object, NMesh, Camera, Lamp
+ #
+ objs = Object.Get() # a list of all objects in the current scene
+ for o in objs:
+ print
+ print o, type(o)
+ data = o.getData()
+ print type(data)
+ if type(data) == Types.NMeshType:
+ if len(data.verts):
+ print "its vertices are obviously of type:", type(data.verts[0])
+ print "and its faces:", Types.NMFaceType
+ elif type(data) == Types.CameraType:
+ print "It's a Camera."
+ elif type(data) == Types.LampType:
+ print "Let there be light!"
@var ObjectType: Blender Object. The base object, linked to its specific data
at its .data member variable.
diff --git a/source/blender/python/api2_2x/doc/Window.py b/source/blender/python/api2_2x/doc/Window.py
index c4a3bf9d67d..b2d2d8ba0a3 100644
--- a/source/blender/python/api2_2x/doc/Window.py
+++ b/source/blender/python/api2_2x/doc/Window.py
@@ -50,11 +50,27 @@ DrawProgressBar::
DrawProgressBar (1.0, "Finished loading")
+
+@type Types: readonly dictionary
+@var Types: The available Window Types.
+ - VIEW3D
+ - IPO
+ - OOPS
+ - BUTS
+ - FILE
+ - IMAGE
+ - INFO
+ - SEQ
+ - IMASEL
+ - SOUND
+ - ACTION
+ - TEXT
+ - NLA
"""
def Redraw ():
"""
- Force a redraw of a specific Window Type (see Window.Types).
+ Force a redraw of a specific Window Type (see L{Types}).
"""
def RedrawAll ():
diff --git a/source/blender/python/api2_2x/doc/World.py b/source/blender/python/api2_2x/doc/World.py
index e952e58abd1..476ddbdb1a4 100644
--- a/source/blender/python/api2_2x/doc/World.py
+++ b/source/blender/python/api2_2x/doc/World.py
@@ -5,15 +5,14 @@ The Blender.World submodule
INTRODUCTION
-The module world allows you to access all the data of an world.
-Example::
+The module world allows you to access all the data of a Blender World.
+Example::
import Blender
- w = Blender.Get('World') #assume there exists a world named "world"
- print w.GetName()
- w.hor = [1,1,.2]
- print w.Gethor()
-
+ w = Blender.Get('World') #assume there exists a world named "world"
+ print w.getName()
+ w.hor = [1,1,.2]
+ print w.getHor()
"""
def New (name):