From ee84084f990da866c15a7b24e7c5945050c4a720 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 8 Mar 2012 05:36:05 +0000 Subject: style cleanup: pep8 + picky edits --- doc/python_api/sphinx_doc_gen.py | 34 +++++++++++----------- intern/cycles/blender/addon/enums.py | 31 ++++++++++---------- intern/cycles/blender/addon/ui.py | 4 +++ release/scripts/modules/bpy_types.py | 4 ++- .../startup/bl_operators/uvcalc_follow_active.py | 2 +- .../scripts/startup/bl_ui/properties_data_curve.py | 1 - .../startup/bl_ui/properties_data_modifier.py | 2 +- release/scripts/startup/bl_ui/space_view3d.py | 6 ++-- source/blender/blenkernel/intern/subsurf_ccg.c | 2 +- source/blender/blenlib/CMakeLists.txt | 1 + source/blender/editors/space_view3d/drawobject.c | 2 +- source/blender/makesrna/intern/CMakeLists.txt | 1 + 12 files changed, 48 insertions(+), 42 deletions(-) diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 7cfcfcf6085..a4fa27fd90d 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -79,6 +79,7 @@ PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows' SCRIPT_DIR = os.path.dirname(__file__) + def handle_args(): ''' Parse the args passed to Blender after "--", ignored by Blender @@ -127,7 +128,6 @@ def handle_args(): help="Write the rst file of the bpy module (default=False)", required=False) - # parse only the args passed after '--' argv = [] if "--" in sys.argv: @@ -227,7 +227,7 @@ RNA_BLACKLIST = { def sphinx_dirs(): ''' - Directories where we write rst files for Sphinx + Directories where we write rst files for Sphinx ''' if not os.path.exists(ARGS.output_dir): os.mkdir(ARGS.output_dir) @@ -237,7 +237,7 @@ def sphinx_dirs(): sphinx_in_tmp = sphinx_in + "-tmp" if not os.path.exists(sphinx_in): os.mkdir(sphinx_in) - + return sphinx_in, sphinx_in_tmp, sphinx_out SPHINX_THEME = ARGS.sphinx_theme @@ -258,7 +258,7 @@ version_strings = [str(v) for v in bpy.app.version] BLENDER_VERSION_DOTS = ".".join(version_strings) # '2.62.1' if bpy.app.build_revision != b"Unknown": # converting bytes to strings, due to #30154 - BLENDER_VERSION_DOTS += " r" + str(bpy.app.build_revision, 'utf_8') # '2.62.1 r44584' + BLENDER_VERSION_DOTS += " r" + str(bpy.app.build_revision, 'utf_8') # '2.62.1 r44584' BLENDER_VERSION_PDF = "_".join(version_strings) # '2_62_1' if bpy.app.version_cycle == "release": @@ -1203,9 +1203,9 @@ def pyrna2sphinx(basepath): else: url_base = API_BASEURL - fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0], - url_base, - location[0], + fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0], + url_base, + location[0], location[1])) file.close() @@ -1221,7 +1221,7 @@ def write_sphinx_conf_py(basepath): filepath = os.path.join(basepath, "conf.py") file = open(filepath, "w", encoding="utf-8") fw = file.write - + fw("project = 'Blender'\n") # fw("master_doc = 'index'\n") fw("copyright = u'Blender Foundation'\n") @@ -1238,7 +1238,7 @@ def write_sphinx_conf_py(basepath): # not helpful since the source is 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") @@ -1283,26 +1283,26 @@ def write_rst_contents(basepath): fw("\n") fw(".. toctree::\n") fw(" :maxdepth: 1\n\n") - + app_modules = [ "bpy.context", # note: not actually a module "bpy.data", # note: not actually a module "bpy.ops", "bpy.types", - + # py modules "bpy.utils", "bpy.path", "bpy.app", "bpy.app.handlers", - + # C modules "bpy.props" ] for mod in app_modules: if mod not in EXCLUDE_MODULES: fw(" %s\n\n" % mod) - + fw("==================\n") fw("Standalone Modules\n") fw("==================\n") @@ -1475,12 +1475,12 @@ def write_rst_importable_modules(basepath): def copy_handwritten_rsts(basepath): - + # info docs if not EXCLUDE_INFO_DOCS: for info, info_desc in INFO_DOCS: shutil.copy2(os.path.join(RST_DIR, info), basepath) - + # TODO put this docs in blender's code and use import as per modules above handwritten_modules = [ "bge.types", @@ -1522,13 +1522,13 @@ def rna2sphinx(basepath): pycontext2sphinx(basepath) # internal modules - write_rst_bpy(basepath) # bpy, disabled by default + write_rst_bpy(basepath) # bpy, disabled by default write_rst_types_index(basepath) # bpy.types write_rst_ops_index(basepath) # bpy.ops pyrna2sphinx(basepath) # bpy.types.* and bpy.ops.* write_rst_data(basepath) # bpy.data write_rst_importable_modules(basepath) - + # copy the other rsts copy_handwritten_rsts(basepath) diff --git a/intern/cycles/blender/addon/enums.py b/intern/cycles/blender/addon/enums.py index 889a8f03552..b4b1646c10d 100644 --- a/intern/cycles/blender/addon/enums.py +++ b/intern/cycles/blender/addon/enums.py @@ -21,37 +21,36 @@ from . import engine devices = ( - ("CPU", "CPU", "Use CPU for rendering"), - ("GPU", "GPU Compute", "Use GPU compute device for rendering, configured in user preferences")) + ('CPU', "CPU", "Use CPU for rendering"), + ('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in user preferences")) feature_set = ( - ("SUPPORTED", "Supported", "Only use finished and supported features"), - ("EXPERIMENTAL", "Experimental", "Use experimental and incomplete features that might be broken or change in the future"), + ('SUPPORTED', "Supported", "Only use finished and supported features"), + ('EXPERIMENTAL', "Experimental", "Use experimental and incomplete features that might be broken or change in the future"), ) shading_systems = ( - ("GPU_COMPATIBLE", "GPU Compatible", "Restricted shading system compatible with GPU rendering"), - ("OSL", "Open Shading Language", "Open Shading Language shading system that only runs on the CPU"), + ('GPU_COMPATIBLE', "GPU Compatible", "Restricted shading system compatible with GPU rendering"), + ('OSL', "Open Shading Language", "Open Shading Language shading system that only runs on the CPU"), ) displacement_methods = ( - ("BUMP", "Bump", "Bump mapping to simulate the appearance of displacement"), - ("TRUE", "True", "Use true displacement only, requires fine subdivision"), - ("BOTH", "Both", "Combination of displacement and bump mapping"), + ('BUMP', "Bump", "Bump mapping to simulate the appearance of displacement"), + ('TRUE', "True", "Use true displacement only, requires fine subdivision"), + ('BOTH', "Both", "Combination of displacement and bump mapping"), ) bvh_types = ( - ("DYNAMIC_BVH", "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"), - ("STATIC_BVH", "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"), + ('DYNAMIC_BVH', "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"), + ('STATIC_BVH', "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"), ) filter_types = ( - ("BOX", "Box", "Box filter"), - ("GAUSSIAN", "Gaussian", "Gaussian filter"), + ('BOX', "Box", "Box filter"), + ('GAUSSIAN', "Gaussian", "Gaussian filter"), ) aperture_types = ( - ("RADIUS", "Radius", "Directly change the size of the aperture"), - ("FSTOP", "F/stop", "Change the size of the aperture by f/stops"), + ('RADIUS', "Radius", "Directly change the size of the aperture"), + ('FSTOP', "F/stop", "Change the size of the aperture by f/stops"), ) - diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index a8f499cf324..5897ddb6358 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -489,6 +489,7 @@ class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel): if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'): layout.prop(world, "horizon_color", text="Color") + class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel): bl_label = "Volume" bl_context = "world" @@ -507,6 +508,7 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel): world = context.world panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume') + class CyclesWorld_PT_ambient_occlusion(CyclesButtonsPanel, Panel): bl_label = "Ambient Occlusion" bl_context = "world" @@ -529,6 +531,7 @@ class CyclesWorld_PT_ambient_occlusion(CyclesButtonsPanel, Panel): split.prop(light, "ao_factor", text="Factor") split.prop(light, "distance", text="Distance") + class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel): bl_label = "Settings" bl_context = "world" @@ -551,6 +554,7 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel): row.active = cworld.sample_as_light row.prop(cworld, "sample_map_resolution") + class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel): bl_label = "Surface" bl_context = "material" diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index a43d26b2c89..8c02e845071 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -446,6 +446,7 @@ class MeshFace(StructRNA): ord_ind(verts[3], verts[0]), ) + class MeshPolygon(StructRNA): __slots__ = () @@ -453,7 +454,7 @@ class MeshPolygon(StructRNA): def edge_keys(self): verts = self.vertices[:] vlen = len(self.vertices) - return [ord_ind(verts[i], verts[(i+1) % vlen]) for i in range(vlen)] + return [ord_ind(verts[i], verts[(i + 1) % vlen]) for i in range(vlen)] @property def loops(self): @@ -461,6 +462,7 @@ class MeshPolygon(StructRNA): end = start + self.loop_total return range(start, end) + class Text(bpy_types.ID): __slots__ = () diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index 0df86a3869e..d2a5d83c188 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -54,7 +54,7 @@ def extend(obj, operator, EXTEND_MODE): def face_edge_vs(vi): vlen = len(vi) - return [(vi[i], vi[(i+1) % vlen]) for i in range(vlen)] + return [(vi[i], vi[(i + 1) % vlen]) for i in range(vlen)] vidx_source = face_source.vertices vidx_target = face_target.vertices diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py index fb365ea1fa4..b8e531dd729 100644 --- a/release/scripts/startup/bl_ui/properties_data_curve.py +++ b/release/scripts/startup/bl_ui/properties_data_curve.py @@ -197,7 +197,6 @@ class DATA_PT_pathanim(CurveButtonsPanelCurve, Panel): layout.prop(curve, "path_duration", text="Frames") layout.prop(curve, "eval_time") - # these are for paths only row = layout.row() row.prop(curve, "use_path_follow") diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index f3e4942f732..2dad06836f3 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -126,7 +126,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): split = layout.split() split.prop(md, "use_even_offset") split.prop(md, "use_distance_offset") - # -- end + # -- end layout.label(text="Limit Method:") layout.row().prop(md, "limit_method", expand=True) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index aee9c20d25c..e639300998a 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -527,10 +527,10 @@ class VIEW3D_MT_select_edit_mesh(Menu): layout.separator() - layout.operator("mesh.select_by_number_vertices", text = "By Number of Verts") + layout.operator("mesh.select_by_number_vertices", text="By Number of Verts") if context.scene.tool_settings.mesh_select_mode[2] == False: layout.operator("mesh.select_non_manifold", text="Non Manifold") - layout.operator("mesh.select_loose_verts", text = "Loose Verts/Edges") + layout.operator("mesh.select_loose_verts", text="Loose Verts/Edges") layout.operator("mesh.select_similar", text="Similar") layout.separator() @@ -1032,7 +1032,7 @@ class VIEW3D_MT_object_game(Menu): layout.operator("object.game_property_clear") - + # ********** Brush menu ********** class VIEW3D_MT_brush(Menu): bl_label = "Brush" diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 75636ab5c23..5ca2e876e28 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -3012,7 +3012,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, has_edge_origindex = CustomData_has_layer(&ccgdm->dm.edgeData, CD_ORIGINDEX); - faceNum = 0; + loopindex = loopindex2 = 0; //current loop index for (index = 0; index < totface; index++) { CCGFace *f = ccgdm->faceMap[index].face; diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 76019f01030..d69ecbe325b 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -103,6 +103,7 @@ set(SRC BLI_dynlib.h BLI_dynstr.h BLI_edgehash.h + BLI_editVert.h BLI_fileops.h BLI_fileops_types.h BLI_fnmatch.h diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 73e7bbc6e90..aad6530f049 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1562,7 +1562,7 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D for (track= tracksbase->first; track; track= track->next) { int selected= TRACK_SELECTED(track); - if ((draw_selected && !selected) || (draw_selected && !selected)) + if (draw_selected && !selected) continue; if ((track->flag&TRACK_HAS_BUNDLE)==0) diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 2782aa8aca5..6f8e7656a83 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -280,6 +280,7 @@ set(SRC rna_internal.h rna_internal_types.h rna_nodetree_types.h + rna_mesh_utils.h ) blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}") -- cgit v1.2.3