[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38804] trunk/blender: pep8 cleanup, also print message when attempting to run in animation player mode.
Campbell Barton
ideasman42 at gmail.com
Fri Jul 29 03:24:05 CEST 2011
Revision: 38804
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38804
Author: campbellbarton
Date: 2011-07-29 01:24:03 +0000 (Fri, 29 Jul 2011)
Log Message:
-----------
pep8 cleanup, also print message when attempting to run in animation player mode.
Modified Paths:
--------------
trunk/blender/build_files/cmake/cmake_consistency_check.py
trunk/blender/build_files/cmake/cmake_netbeans_project.py
trunk/blender/build_files/cmake/cmake_qtcreator_project.py
trunk/blender/doc/python_api/examples/bge.constraints.py
trunk/blender/doc/python_api/examples/bge.texture.1.py
trunk/blender/doc/python_api/examples/bge.texture.py
trunk/blender/doc/python_api/examples/blf.py
trunk/blender/release/scripts/modules/addon_utils.py
trunk/blender/release/scripts/modules/bpy/__init__.py
trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
trunk/blender/release/scripts/modules/bpy_extras/mesh_utils.py
trunk/blender/release/scripts/startup/bl_operators/object_align.py
trunk/blender/release/scripts/startup/bl_ui/properties_world.py
trunk/blender/release/scripts/startup/bl_ui/space_info.py
trunk/blender/release/scripts/startup/bl_ui/space_node.py
trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
trunk/blender/release/scripts/templates/batch_export.py
trunk/blender/release/scripts/templates/ui_menu.py
trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
trunk/blender/source/creator/creator.c
trunk/blender/source/tests/check_deprecated.py
Modified: trunk/blender/build_files/cmake/cmake_consistency_check.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_consistency_check.py 2011-07-29 00:08:39 UTC (rev 38803)
+++ trunk/blender/build_files/cmake/cmake_consistency_check.py 2011-07-29 01:24:03 UTC (rev 38804)
@@ -42,9 +42,9 @@
l = data[i]
ws = l[:len(l) - len(l.lstrip())]
-
+
data[i] = "%s%s\n" % (ws, text)
-
+
file_handle = open(f, 'w')
file_handle.writelines(data)
file_handle.close()
@@ -182,13 +182,13 @@
if new_path_rel != l:
print("overly relative path:\n %s:%d\n %s\n %s" % (f, i, l, new_path_rel))
-
+
## Save time. just replace the line
# replace_line(f, i - 1, new_path_rel)
-
+
else:
raise Exception("non existant include %s:%d -> %s" % (f, i, new_file))
-
+
# print(new_file)
global_h.update(set(sources_h))
@@ -206,7 +206,7 @@
if ff not in sources_c:
print(" missing: " + ff)
'''
-
+
# reset
sources_h[:] = []
sources_c[:] = []
Modified: trunk/blender/build_files/cmake/cmake_netbeans_project.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_netbeans_project.py 2011-07-29 00:08:39 UTC (rev 38803)
+++ trunk/blender/build_files/cmake/cmake_netbeans_project.py 2011-07-29 01:24:03 UTC (rev 38804)
@@ -30,8 +30,19 @@
Windows not supported so far
"""
-from project_info import *
+from project_info import (SIMPLE_PROJECTFILE,
+ SOURCE_DIR,
+ CMAKE_DIR,
+ PROJECT_DIR,
+ source_list,
+ is_project_file,
+ is_c_header,
+ is_py,
+ cmake_advanced_info,
+ cmake_compiler_defines,
+ )
+
import os
from os.path import join, dirname, normpath, relpath, exists
Modified: trunk/blender/build_files/cmake/cmake_qtcreator_project.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_qtcreator_project.py 2011-07-29 00:08:39 UTC (rev 38803)
+++ trunk/blender/build_files/cmake/cmake_qtcreator_project.py 2011-07-29 01:24:03 UTC (rev 38804)
@@ -31,7 +31,17 @@
python .~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake
"""
-from project_info import *
+from project_info import (SIMPLE_PROJECTFILE,
+ SOURCE_DIR,
+ CMAKE_DIR,
+ PROJECT_DIR,
+ source_list,
+ is_project_file,
+ is_c_header,
+ is_py,
+ cmake_advanced_info,
+ cmake_compiler_defines,
+ )
import os
import sys
Modified: trunk/blender/doc/python_api/examples/bge.constraints.py
===================================================================
--- trunk/blender/doc/python_api/examples/bge.constraints.py 2011-07-29 00:08:39 UTC (rev 38803)
+++ trunk/blender/doc/python_api/examples/bge.constraints.py 2011-07-29 01:24:03 UTC (rev 38804)
@@ -8,11 +8,11 @@
# 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_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)
Modified: trunk/blender/doc/python_api/examples/bge.texture.1.py
===================================================================
--- trunk/blender/doc/python_api/examples/bge.texture.1.py 2011-07-29 00:08:39 UTC (rev 38803)
+++ trunk/blender/doc/python_api/examples/bge.texture.1.py 2011-07-29 01:24:03 UTC (rev 38804)
@@ -6,29 +6,31 @@
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:
Modified: trunk/blender/doc/python_api/examples/bge.texture.py
===================================================================
--- trunk/blender/doc/python_api/examples/bge.texture.py 2011-07-29 00:08:39 UTC (rev 38803)
+++ trunk/blender/doc/python_api/examples/bge.texture.py 2011-07-29 01:24:03 UTC (rev 38804)
@@ -9,14 +9,14 @@
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 @@
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()
Modified: trunk/blender/doc/python_api/examples/blf.py
===================================================================
--- trunk/blender/doc/python_api/examples/blf.py 2011-07-29 00:08:39 UTC (rev 38803)
+++ trunk/blender/doc/python_api/examples/blf.py 2011-07-29 01:24:03 UTC (rev 38804)
@@ -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 @@
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")
Modified: trunk/blender/release/scripts/modules/addon_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/addon_utils.py 2011-07-29 00:08:39 UTC (rev 38803)
+++ trunk/blender/release/scripts/modules/addon_utils.py 2011-07-29 01:24:03 UTC (rev 38804)
@@ -33,6 +33,7 @@
error_duplicates = False
+
def paths():
# RELEASE SCRIPTS: official scripts distributed in Blender releases
paths = _bpy.utils.script_paths("addons")
Modified: trunk/blender/release/scripts/modules/bpy/__init__.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/__init__.py 2011-07-29 00:08:39 UTC (rev 38803)
+++ trunk/blender/release/scripts/modules/bpy/__init__.py 2011-07-29 01:24:03 UTC (rev 38804)
@@ -43,6 +43,7 @@
# fake operator module
ops = ops.ops_fake_module
+
def _main():
import sys as _sys
Modified: trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_extras/io_utils.py 2011-07-29 00:08:39 UTC (rev 38803)
+++ trunk/blender/release/scripts/modules/bpy_extras/io_utils.py 2011-07-29 01:24:03 UTC (rev 38804)
@@ -159,14 +159,19 @@
raise Exception("invalid axis arguments passed, "
"can't use up/forward on the same axis.")
- value = reduce(int.__or__, (_axis_convert_num[a] << (i * 3) for i, a in enumerate((from_forward, from_up, to_forward, to_up))))
+ value = reduce(int.__or__, (_axis_convert_num[a] << (i * 3)
+ for i, a in enumerate((from_forward,
+ from_up,
+ to_forward,
+ to_up,
+ ))))
for i, axis_lut in enumerate(_axis_convert_lut):
if value in axis_lut:
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list