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
path: root/doc
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-07-30 01:28:18 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-07-30 01:28:18 +0400
commit29f214f7f31bf7490b0c2795ad716ce5a9dc1818 (patch)
treefa9cb969c253e58c71c0dd61e89731f185849030 /doc
parentce1c78e18bf41115a8a149dd85115292c1919bea (diff)
parent6a27da310c61b3372d565060506221a5afb9fe43 (diff)
Merging up to trunk r38834.
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/examples/bge.constraints.py12
-rw-r--r--doc/python_api/examples/bge.texture.1.py16
-rw-r--r--doc/python_api/examples/bge.texture.py10
-rw-r--r--doc/python_api/examples/blf.py15
-rw-r--r--doc/python_api/examples/mathutils.Vector.py13
-rwxr-xr-xdoc/python_api/sphinx_doc_gen.sh7
6 files changed, 41 insertions, 32 deletions
diff --git a/doc/python_api/examples/bge.constraints.py b/doc/python_api/examples/bge.constraints.py
index 4cd967310cc..de2f7e0a39d 100644
--- a/doc/python_api/examples/bge.constraints.py
+++ b/doc/python_api/examples/bge.constraints.py
@@ -8,11 +8,11 @@ from bge import constraints
# get object list
objects = logic.getCurrentScene().objects
-
+
# get object named Object1 and Object 2
object_1 = objects["Object1"]
object_2 = objects["Object2"]
-
+
# want to use Edge constraint type
constraint_type = 2
@@ -31,7 +31,7 @@ edge_angle_y = 1.0
edge_angle_z = 0.0
# create an edge constraint
-constraints.createConstraint( physics_id_1, physics_id_2,
- constraint_type,
- edge_position_x, edge_position_y, edge_position_z,
- edge_angle_x, edge_angle_y, edge_angle_z )
+constraints.createConstraint(physics_id_1, physics_id_2,
+ constraint_type,
+ edge_position_x, edge_position_y, edge_position_z,
+ edge_angle_x, edge_angle_y, edge_angle_z)
diff --git a/doc/python_api/examples/bge.texture.1.py b/doc/python_api/examples/bge.texture.1.py
index 74b37e72994..faa0ae736e8 100644
--- a/doc/python_api/examples/bge.texture.1.py
+++ b/doc/python_api/examples/bge.texture.1.py
@@ -6,29 +6,31 @@ createTexture() and removeTexture() are to be called from a module Python
Controller.
"""
from bge import logic
-from bge import texture
+from bge import texture
+
def createTexture(cont):
"""Create a new Dynamic Texture"""
object = cont.owner
-
+
# get the reference pointer (ID) of the internal texture
ID = texture.materialID(obj, 'IMoriginal.png')
-
- # create a texture object
+
+ # create a texture object
object_texture = texture.Texture(object, ID)
-
+
# create a new source with an external image
url = logic.expandPath("//newtexture.jpg")
new_source = texture.ImageFFmpeg(url)
-
+
# the texture has to be stored in a permanent Python object
logic.texture = object_texture
-
+
# update/replace the texture
logic.texture.source = new_source
logic.texture.refresh(False)
+
def removeTexture(cont):
"""Delete the Dynamic Texture, reversing back the final to its original state."""
try:
diff --git a/doc/python_api/examples/bge.texture.py b/doc/python_api/examples/bge.texture.py
index 0ec9aa16bca..70e4d6d9377 100644
--- a/doc/python_api/examples/bge.texture.py
+++ b/doc/python_api/examples/bge.texture.py
@@ -9,14 +9,14 @@ from bge import logic
cont = logic.getCurrentController()
obj = cont.owner
-
-# the creation of the texture must be done once: save the
+
+# the creation of the texture must be done once: save the
# texture object in an attribute of bge.logic module makes it persistent
if not hasattr(logic, 'video'):
-
+
# identify a static texture by name
matID = texture.materialID(obj, 'IMvideo.png')
-
+
# create a dynamic texture that will replace the static texture
logic.video = texture.Texture(obj, matID)
@@ -24,7 +24,7 @@ if not hasattr(logic, 'video'):
movie = logic.expandPath('//trailer_400p.ogg')
logic.video.source = texture.VideoFFmpeg(movie)
logic.video.source.scale = True
-
+
# quick off the movie, but it wont play in the background
logic.video.source.play()
diff --git a/doc/python_api/examples/blf.py b/doc/python_api/examples/blf.py
index 3ab7f789ce8..f6e87cf488d 100644
--- a/doc/python_api/examples/blf.py
+++ b/doc/python_api/examples/blf.py
@@ -1,6 +1,7 @@
"""
Hello World Text Example
++++++++++++++++++++++++
+
Blender Game Engine example of using the blf module. For this module to work we
need to use the OpenGL wrapper :class:`~bgl` as well.
"""
@@ -11,31 +12,33 @@ from bge import logic
import bgl
import blf
+
def init():
"""init function - runs once"""
# create a new font object, use external ttf file
font_path = logic.expandPath('//Zeyada.ttf')
- # store the font indice - to use later
+ # store the font indice - to use later
logic.font_id = blf.load(font_path)
- # set the font drawing routine to run every frame
+ # set the font drawing routine to run every frame
scene = logic.getCurrentScene()
- scene.post_draw=[write]
+ scene.post_draw = [write]
+
def write():
"""write on screen"""
width = render.getWindowWidth()
height = render.getWindowHeight()
-
+
# OpenGL setup
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glLoadIdentity()
bgl.gluOrtho2D(0, width, 0, height)
bgl.glMatrixMode(bgl.GL_MODELVIEW)
bgl.glLoadIdentity()
-
+
# BLF drawing routine
font_id = logic.font_id
- blf.position(font_id, (width*0.2), (height*0.3), 0)
+ blf.position(font_id, (width * 0.2), (height * 0.3), 0)
blf.size(font_id, 50, 72)
blf.draw(font_id, "Hello World")
diff --git a/doc/python_api/examples/mathutils.Vector.py b/doc/python_api/examples/mathutils.Vector.py
index 880b4ef2590..bf1fc70353f 100644
--- a/doc/python_api/examples/mathutils.Vector.py
+++ b/doc/python_api/examples/mathutils.Vector.py
@@ -1,15 +1,15 @@
import mathutils
# zero length vector
-vec = mathutils.Vector((0, 0, 1))
+vec = mathutils.Vector((0.0, 0.0, 1.0))
# unit length vector
vec_a = vec.copy().normalize()
-vec_b = mathutils.Vector((0, 1, 2))
+vec_b = mathutils.Vector((0.0, 1.0, 2.0))
-vec2d = mathutils.Vector((1, 2))
-vec3d = mathutils.Vector((1, 0, 0))
+vec2d = mathutils.Vector((1.0, 2.0))
+vec3d = mathutils.Vector((1.0, 0.0, 0.0))
vec4d = vec_a.to_4d()
# other mathutuls types
@@ -34,9 +34,9 @@ vec_a + vec_b
vec_a - vec_b
vec_a * vec_b
vec_a * 10.0
-vec_a * matrix
+matrix * vec_a
+quat * vec_a
vec_a * vec_b
-vec_a * quat
-vec_a
@@ -44,6 +44,7 @@ vec_a * quat
x = vec_a[0]
len(vec)
vec_a[:] = vec_b
+vec_a[:] = 1.0, 2.0, 3.0
vec2d[:] = vec3d[:2]
diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh
index 5f23ca395b6..a3befe1b7cb 100755
--- a/doc/python_api/sphinx_doc_gen.sh
+++ b/doc/python_api/sphinx_doc_gen.sh
@@ -38,8 +38,11 @@ cp $SPHINXBASE/sphinx-out/contents.html $SPHINXBASE/sphinx-out/index.html
ssh $SSH_USER@emo.blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*'
rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
-# symlink the dir to a static URL
-ssh $SSH_USER@emo.blender.org 'rm '$SSH_UPLOAD'/250PythonDoc && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/250PythonDoc'
+## symlink the dir to a static URL
+#ssh $SSH_USER@emo.blender.org 'rm '$SSH_UPLOAD'/250PythonDoc && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/250PythonDoc'
+
+# better redirect
+ssh $SSH_USER@emo.blender.org 'echo "<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\" content=\"0;url=../blender_python_api_'$BLENDER_VERSION'/\"></head><body>Redirecting...</body></html>" > '$SSH_UPLOAD'/250PythonDoc/index.html'
# pdf
sphinx-build -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out