diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-05-27 02:22:45 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-05-27 02:22:45 +0400 |
commit | b6a9a953bc6aa7d81921a796e8ce1123fdedefc7 (patch) | |
tree | 44c587b017c6915bb750560fb56a0a7782358c07 /doc/python_api | |
parent | a5152b7ca0d6d7f340b1955c0e8a15ba23fda336 (diff) | |
parent | eda0f3b1863e2e41b9913e16af82407b63e145bf (diff) |
Merged changes in the trunk up to revision 47056.
Conflicts resolved:
source/blender/bmesh/bmesh_class.h
source/blender/bmesh/intern/bmesh_construct.c
source/blender/editors/interface/resources.c
source/blender/render/intern/source/convertblender.c
Diffstat (limited to 'doc/python_api')
-rw-r--r-- | doc/python_api/examples/bpy.types.Mesh.py | 2 | ||||
-rw-r--r-- | doc/python_api/rst/bge.render.rst | 42 | ||||
-rw-r--r-- | doc/python_api/rst/include__bmesh.rst | 8 |
3 files changed, 28 insertions, 24 deletions
diff --git a/doc/python_api/examples/bpy.types.Mesh.py b/doc/python_api/examples/bpy.types.Mesh.py index 1ee5118df6d..d30303f3b05 100644 --- a/doc/python_api/examples/bpy.types.Mesh.py +++ b/doc/python_api/examples/bpy.types.Mesh.py @@ -28,7 +28,7 @@ This example script prints the vertices and UV's for each polygon, assumes the a import bpy me = bpy.context.object.data -uv_layer = me.uv.layers.active.data +uv_layer = me.uv_layers.active.data for poly in me.polygons: print("Polygon index: %d, length: %d" % (poly.index, poly.loop_total)) diff --git a/doc/python_api/rst/bge.render.rst b/doc/python_api/rst/bge.render.rst index ddc05ac1d8c..a253b6df26f 100644 --- a/doc/python_api/rst/bge.render.rst +++ b/doc/python_api/rst/bge.render.rst @@ -11,39 +11,41 @@ Intro .. code-block:: python # Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook:: - # To use a mouse movement sensor "Mouse" and a + # To use a mouse movement sensor "Mouse" and a # motion actuator to mouse look: - import bge.render - import bge.logic + import bge # scale sets the speed of motion scale = 1.0, 0.5 - + co = bge.logic.getCurrentController() - obj = co.getOwner() - mouse = co.getSensor("Mouse") - lmotion = co.getActuator("LMove") - wmotion = co.getActuator("WMove") - + obj = co.owner + mouse = co.sensors["Mouse"] + lmotion = co.actuators["LMove"] + wmotion = co.actuators["WMove"] + # Transform the mouse coordinates to see how far the mouse has moved. def mousePos(): - x = (bge.render.getWindowWidth() / 2 - mouse.getXPosition()) * scale[0] - y = (bge.render.getWindowHeight() / 2 - mouse.getYPosition()) * scale[1] + x = (bge.render.getWindowWidth() / 2 - mouse.position[0]) * scale[0] + y = (bge.render.getWindowHeight() / 2 - mouse.position[1]) * scale[1] return (x, y) - + pos = mousePos() - + # Set the amount of motion: X is applied in world coordinates... - lmotion.setTorque(0.0, 0.0, pos[0], False) + wmotion.useLocalTorque = False + wmotion.torque = ((0.0, 0.0, pos[0])) + # ...Y is applied in local coordinates - wmotion.setTorque(-pos[1], 0.0, 0.0, True) - + lmotion.useLocalTorque = True + lmotion.torque = ((-pos[1], 0.0, 0.0)) + # Activate both actuators - bge.logic.addActiveActuator(lmotion, True) - bge.logic.addActiveActuator(wmotion, True) - + co.activate(lmotion) + co.activate(wmotion) + # Centre the mouse - bge.render.setMousePosition(bge.render.getWindowWidth() / 2, bge.render.getWindowHeight() / 2) + bge.render.setMousePosition(int(bge.render.getWindowWidth() / 2), int(bge.render.getWindowHeight() / 2)) ********* Constants diff --git a/doc/python_api/rst/include__bmesh.rst b/doc/python_api/rst/include__bmesh.rst index 212ab4e4708..a55bf71b60f 100644 --- a/doc/python_api/rst/include__bmesh.rst +++ b/doc/python_api/rst/include__bmesh.rst @@ -99,9 +99,11 @@ Here are some examples ... uv_lay = bm.loops.layers.uv.active for face in bm.faces: - for loop in f.loops: - uv = loop[uv_lay] - print("Loop UV: %f, %f" % (uv.x, uv.y)) + for loop in face.loops: + uv = loop[uv_lay].uv + print("Loop UV: %f, %f" % uv[:]) + vert = loop.vert + print("Loop Vert: (%f,%f,%f)" % vert.co[:]) .. code-block:: python |