freestyle lineset `tag` attribute was defined but not used, also some code cleanup.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 7 Apr 2013 01:38:03 +0000 (01:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 7 Apr 2013 01:38:03 +0000 (01:38 +0000)
21 files changed:
intern/cycles/blender/addon/ui.py
release/scripts/modules/bpy/utils.py
release/scripts/modules/bpy_extras/mesh_utils.py
release/scripts/modules/bpy_extras/object_utils.py
release/scripts/startup/bl_operators/object.py
release/scripts/startup/bl_ui/properties_freestyle.py
release/scripts/startup/bl_ui/properties_object.py
release/scripts/startup/bl_ui/properties_paint_common.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_node.py
release/scripts/startup/bl_ui/space_view3d.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/compositor/operations/COM_MixHueOperation.cpp
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/render/render_shading.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/python/bmesh/bmesh_py_ops.c
source/blender/render/intern/source/convertblender.c
source/tests/bl_load_addons.py
source/tests/pep8.py

index bd5e1b81ab6e40f62f37bdc110dfee5f272574d1..564a62f257dc23f6591adcdf382b8bf6ffbaeb01 100644 (file)
@@ -267,6 +267,7 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
             row.prop(rl, "name")
         row.prop(rd, "use_single_layer", text="", icon_only=True)
 
+
 class CyclesRender_PT_layer_options(CyclesButtonsPanel, Panel):
     bl_label = "Layer"
     bl_context = "render_layer"
@@ -297,7 +298,8 @@ class CyclesRender_PT_layer_options(CyclesButtonsPanel, Panel):
         col = split.column()
         col.prop(rl, "samples")
         col.prop(rl, "use_sky", "Use Environment")
-        
+
+
 class CyclesRender_PT_layer_passes(CyclesButtonsPanel, Panel):
     bl_label = "Passes"
     bl_context = "render_layer"
index 9c4117f0953fe34406f3bd219d93f25c66c0cc89..b78105dedb5818d28cf0e406b6cde40295fa3969 100644 (file)
@@ -654,8 +654,9 @@ def make_rna_paths(struct_name, prop_name, enum_name):
     :type prop_name: string
     :arg enum_name: Name of a RNA enum identifier.
     :type enum_name: string
-    :return: A triple of three "RNA paths" (most_complete_path, "struct.prop", "struct.prop:'enum'").
-             If no enum_name is given, the third element will always be void.
+    :return: A triple of three "RNA paths"
+       (most_complete_path, "struct.prop", "struct.prop:'enum'").
+       If no enum_name is given, the third element will always be void.
     :rtype: tuple of strings
     """
     src = src_rna = src_enum = ""
index f4fdfece947f8b4f3e9e1846eb4385f072a82745..d905964e71cbf68ab6e2b34c8f336c8b92e58fca 100644 (file)
@@ -328,10 +328,12 @@ def ngon_tessellate(from_data, indices, fix_loops=True):
     fgon to create from existing verts.
 
     from_data: either a mesh, or a list/tuple of vectors.
-    :arg indices: a list of indices to use this list is the ordered closed polyline
+    :arg indices: a list of indices to use this list
+       is the ordered closed polyline
        to fill, and can be a subset of the data given.
     :type indices: list
-    :arg fix_loops: If this is enabled polylines that use loops to make multiple
+    :arg fix_loops: If this is enabled polylines
+       that use loops to make multiple
        polylines are delt with correctly.
     :type fix_loops: bool
     """
index ab5dc3e6aeef6cd21499a649fab7e843032c424c..786b7b5460ef8c170ebb64b14900ae1cb9dc207e 100644 (file)
@@ -191,7 +191,8 @@ class AddObjectHelper:
 
 def object_add_grid_scale(context):
     """
-    Return scale which should be applied on object data to align it to grid scale
+    Return scale which should be applied on object
+    data to align it to grid scale
     """
 
     space_data = context.space_data
index ae6b80865dd12e58872d919ebf0136045e0b4ca1..b57594d14f98b503178e3788f6571514764523ec 100644 (file)
@@ -473,7 +473,8 @@ class ShapeTransfer(Operator):
 
 
 class JoinUVs(Operator):
-    """Transfer UV Layouts from active to selected objects (needs matching geometry)"""
+    """Transfer UV Layouts from active to selected objects """ \
+    """(needs matching geometry)"""
     bl_idname = "object.join_uvs"
     bl_label = "Transfer UV Layouts"
 
index 523c58bfac353344c74ca7843ba1ee0320cf9f27..f3434525b8211ccff9609c23390a85b10015ba17 100644 (file)
@@ -93,7 +93,7 @@ class RENDERLAYER_UL_linesets(UIList):
             layout.label("", icon_value=icon)
 
 ##ifdef WITH_FREESTYLE
-#      else if (RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer) || 
+#      else if (RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer) ||
 #               RNA_struct_is_a(itemptr->type, &RNA_FreestyleLineSet)) {
 ##else
 #      else if (RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer)) {
index 7c32e72b3e3eecfcc1bf19d2055f9ed479770e9f..ff8cf6ee1970e0654dcb935640b3ee379ddaba12 100644 (file)
@@ -222,9 +222,9 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel):
         col = split.column()
         col.prop(obj, "show_name", text="Name")
         col.prop(obj, "show_axis", text="Axis")
-        
+
         obj_type = obj.type
-        
+
         if obj_type in {'MESH', 'CURVE', 'SURFACE', 'META', 'FONT'}:
             # Makes no sense for cameras, armtures, etc.!
             col.prop(obj, "show_wire", text="Wire")
index b130a8a275d457c70f8ebbbb5669f86a55988367..f2566b2f2f5a9cc13bfbab4a563fcf04f5930cf7 100644 (file)
@@ -82,7 +82,7 @@ def brush_texture_settings(layout, brush, sculpt):
     else:
         layout.row().prop(tex_slot, "tex_paint_map_mode", text="")
         layout.separator()
-    
+
     if tex_slot.map_mode == 'STENCIL':
         layout.operator("brush.stencil_fit_image_aspect")
 
index 3537ca62d93bd7cb47386950482976fcf3f54734..48af461a82ef5b81c3105f668c33cba0337f1292 100644 (file)
@@ -786,7 +786,7 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
         col = layout.column()
 
         col.label(text="Stroke Method:")
-        
+
         col.prop(brush, "stroke_method", text="")
 
         if brush.use_anchor:
@@ -804,7 +804,6 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
             row.prop(brush, "spacing", text="Spacing")
             row.prop(brush, "use_pressure_spacing", toggle=True, text="")
 
-
         col = layout.column()
         col.separator()
 
index ac76b988e055c7ec66c5a75b1923d96549dff5fb..8a115c0df0d96b6bdf978a5a9d3034be45af4e12 100644 (file)
@@ -151,7 +151,7 @@ class NODE_MT_select(Menu):
         layout.operator("node.select_all", text="Inverse").action = 'INVERT'
         layout.operator("node.select_linked_from")
         layout.operator("node.select_linked_to")
-       
+
         layout.separator()
 
         layout.operator("node.select_same_type")
index be601d0b6a17736e83db0c070010dc789bf326af..c36297a197cb70743a4d658f2986eb0746b46590 100644 (file)
@@ -1641,12 +1641,12 @@ class VIEW3D_MT_pose_specials(Menu):
 
     def draw(self, context):
         layout = self.layout
-        
-        layout.operator("paint.weight_from_bones", text="Assign Automatic from Bones").type="AUTOMATIC"
-        layout.operator("paint.weight_from_bones", text="Assign from Bone Envelopes").type="ENVELOPES"
-        
+
+        layout.operator("paint.weight_from_bones", text="Assign Automatic from Bones").type = 'AUTOMATIC'
+        layout.operator("paint.weight_from_bones", text="Assign from Bone Envelopes").type = 'ENVELOPES'
+
         layout.separator()
-        
+
         layout.operator("pose.select_constraint_target")
         layout.operator("pose.flip_names")
         layout.operator("pose.paths_calculate")
index ff368a682e95627308d1eaa0cefa679e2aba875f..302120963058e1848a67f88232babc6b90c5e231 100644 (file)
@@ -707,7 +707,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
 
             row = col.row(align=True)
+
             col.prop(brush, "vertex_tool", text="Blend")
 
         # Vertex Paint Mode #
@@ -815,7 +815,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
         col = layout.column()
 
         col.label(text="Stroke Method:")
-        
+
         if context.sculpt_object:
             col.prop(brush, "sculpt_stroke_method", text="")
         else:
@@ -880,6 +880,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
             sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
             sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
 
+
 class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
     bl_label = "Curve"
     bl_options = {'DEFAULT_CLOSED'}
index 8f898cf8ecff77854a19f2568c98319c5d087ec4..12cd16bb73b419a01303b9695968dbb1f73c6895 100644 (file)
@@ -58,7 +58,7 @@ void MixHueOperation::executePixel(float output[4], float x, float y, PixelSampl
                output[2] = valuem * (inputColor1[2]) + value * tmpb;
        }
        else {
-                       copy_v3_v3(output, inputColor1);
+               copy_v3_v3(output, inputColor1);
        }
        output[3] = inputColor1[3];
 
index 4f691efe95068cfce77e95ea9580c6885cae3903..f46721ddd623218db198e5b30041a05e73425701 100644 (file)
@@ -3901,7 +3901,7 @@ static int edbm_mark_freestyle_edge(bContext *C, wmOperator *op)
        }
 
        DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -3918,7 +3918,7 @@ void MESH_OT_mark_freestyle_edge(wmOperatorType *ot)
        ot->poll = ED_operator_editmesh;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
 }
@@ -3962,7 +3962,7 @@ static int edbm_mark_freestyle_face_exec(bContext *C, wmOperator *op)
        }
 
        DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -3979,7 +3979,7 @@ void MESH_OT_mark_freestyle_face(wmOperatorType *ot)
        ot->poll = ED_operator_editmesh;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
 }
index 5652d4c4b71744a8f7a8e9dd8557fa7fba462a92..62b73b5b0c23bf85c5facf6413116b31443ce681 100644 (file)
@@ -1137,7 +1137,7 @@ void SCENE_OT_freestyle_modifier_copy(wmOperatorType *ot)
        ot->poll = freestyle_active_lineset_poll;
 
        /* flags */
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int freestyle_modifier_move_exec(bContext *C, wmOperator *op)
index d8f3f2827c52c1310aff705fc12f5e7f9edbbb4b..c3b8cc0b2752b98430f13676fce72a06ba37a996 100644 (file)
@@ -643,7 +643,7 @@ static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *UNUSED(op))
                orig_area = aspx*aspy;
                stencil_area = br->stencil_dimension[0]*br->stencil_dimension[1];
 
-               factor = sqrt(stencil_area/orig_area);
+               factor = sqrt(stencil_area / orig_area);
 
                br->stencil_dimension[0] = factor*aspx;
                br->stencil_dimension[1] = factor*aspy;
index a2f9b554d3f7d12a31619f2d8f431cfd7c041300..b9fb269638a4ceddef028385c20b0fc54ba9775c 100644 (file)
@@ -1949,6 +1949,10 @@ void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_struct_sdna(srna, "Main");
        RNA_def_struct_ui_text(srna, "Main Line Styles", "Collection of line styles");
 
+       func = RNA_def_function(srna, "tag", "rna_Main_linestyle_tag");
+       parm = RNA_def_boolean(func, "value", 0, "Value", "");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+
        func = RNA_def_function(srna, "new", "rna_Main_linestyles_new");
        RNA_def_function_ui_description(func, "Add a new line style instance to the main database");
        parm = RNA_def_string(func, "name", "FreestyleLineStyle", 0, "", "New name for the datablock");
index 234dd1e5fecc736b2dab2f5900217b83ab3421e5..8826baf81b72c48e6124fce5a45fa9e65e0590aa 100644 (file)
@@ -102,7 +102,7 @@ static char *bmp_slots_as_args(const BMOSlotType slot_types[BMO_OP_MAX_SLOTS], c
                }
                BLI_dynstr_appendf(dyn_str, i ? ", %.*s=%s" : "%.*s=%s", name_len, slot_types[i].name, value);
                i++;
-       };
+       }
 
        ret = BLI_dynstr_get_cstring(dyn_str);
        BLI_dynstr_free(dyn_str);
index aaaab319cc8c39cf1ca53f241fcda7fc9bd569d3..95bd967e56e0c0c8175487d6c4b05a8dbc95fc61 100644 (file)
@@ -2731,7 +2731,8 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
                                        if (ffa) {
                                                int index = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, a) : a;
                                                vlr->freestyle_face_mark= (ffa[index].flag & FREESTYLE_FACE_MARK) ? 1 : 0;
-                                       } else {
+                                       }
+                                       else {
                                                vlr->freestyle_face_mark= 0;
                                        }
 #endif
@@ -3398,8 +3399,10 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
                if (need_origindex) {
                        index_vert_orig = dm->getVertDataArray(dm, CD_ORIGINDEX);
                        /* double lookup for faces -> polys */
+#ifdef WITH_FREESTYLE
                        index_mf_to_mpoly = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
                        index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+#endif
                }
 
                for (a=0; a<totvert; a++, mvert++) {
@@ -3506,20 +3509,22 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
                                                        {
                                                                int edge_mark = 0;
 
-                                                               if(has_freestyle_edge_mark(edge_hash, v1, v2)) edge_mark |= R_EDGE_V1V2;
-                                                               if(has_freestyle_edge_mark(edge_hash, v2, v3)) edge_mark |= R_EDGE_V2V3;
+                                                               if (has_freestyle_edge_mark(edge_hash, v1, v2)) edge_mark |= R_EDGE_V1V2;
+                                                               if (has_freestyle_edge_mark(edge_hash, v2, v3)) edge_mark |= R_EDGE_V2V3;
                                                                if (!v4) {
-                                                                       if(has_freestyle_edge_mark(edge_hash, v3, v1)) edge_mark |= R_EDGE_V3V1;
-                                                               } else {
-                                                                       if(has_freestyle_edge_mark(edge_hash, v3, v4)) edge_mark |= R_EDGE_V3V4;
-                                                                       if(has_freestyle_edge_mark(edge_hash, v4, v1)) edge_mark |= R_EDGE_V4V1;
+                                                                       if (has_freestyle_edge_mark(edge_hash, v3, v1)) edge_mark |= R_EDGE_V3V1;
+                                                               }
+                                                               else {
+                                                                       if (has_freestyle_edge_mark(edge_hash, v3, v4)) edge_mark |= R_EDGE_V3V4;
+                                                                       if (has_freestyle_edge_mark(edge_hash, v4, v1)) edge_mark |= R_EDGE_V4V1;
                                                                }
                                                                vlr->freestyle_edge_mark= edge_mark;
                                                        }
                                                        if (ffa) {
                                                                int index = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, a) : a;
                                                                vlr->freestyle_face_mark= (ffa[index].flag & FREESTYLE_FACE_MARK) ? 1 : 0;
-                                                       } else {
+                                                       }
+                                                       else {
                                                                vlr->freestyle_face_mark= 0;
                                                        }
 #endif
index 83bdfb42c95e8f87bd8dc2b62dd57422fe0f58b4..f04ae64ee73f4c4a382e2abcbb90f6387e0ab04a 100644 (file)
@@ -51,7 +51,7 @@ def test_load_addons():
         addon_utils.enable(mod_name)
         if mod_name not in addons:
             addons_fail.append(mod_name)
-    
+
     if addons_fail:
         print("addons failed to load (%d):" % len(addons_fail))
         for mod_name in addons_fail:
@@ -94,7 +94,7 @@ def reload_addons(do_reload=True, do_reverse=True):
 def main():
     # first load addons, print a list of all addons that fail
     test_load_addons()
-    
+
     reload_addons(do_reload=False, do_reverse=False)
     reload_addons(do_reload=False, do_reverse=True)
     reload_addons(do_reload=True, do_reverse=True)
index cb86953e00e22905f373dd7468776884168d10a3..3ae1828c59a33c279a39c661df7c81229185233c 100644 (file)
@@ -37,6 +37,7 @@ import os
 # should be directly after the license header, ~20 in most cases
 PEP8_SEEK_COMMENT = 40
 SKIP_PREFIX = "./tools", "./config", "./scons", "./extern"
+SKIP_ADDONS = True
 FORCE_PEP8_ALL = False
 
 
@@ -76,6 +77,10 @@ def main():
         if [None for prefix in SKIP_PREFIX if f.startswith(prefix)]:
             continue
 
+        if SKIP_ADDONS:
+            if (os.sep + "addons") in f:
+                continue
+
         pep8_type = FORCE_PEP8_ALL or is_pep8(f)
 
         if pep8_type:
@@ -98,12 +103,20 @@ def main():
                 print("%s:%d:0: global import bad practice" % (f, i + 1))
 
     print("\n\n\n# running pep8...")
+
+    # these are very picky and often hard to follow
+    # while keeping common script formatting.
+    ignore = "E122", "E123", "E124", "E125", "E126", "E127", "E128"
+
     for f, pep8_type in files:
+
         if pep8_type == 1:
             # E501:80 line length
-            os.system("pep8 --repeat --ignore=E501 '%s'" % (f))
+            ignore_tmp = ignore + ("E501", )
         else:
-            os.system("pep8 --repeat '%s'" % (f))
+            ignore_tmp = ignore
+
+        os.system("pep8 --repeat --ignore=%s '%s'" % (",".join(ignore_tmp), f))
 
     # pyflakes
     print("\n\n\n# running pyflakes...")