[Bf-blender-cvs] [ea610e6] master: Style cleanup: C & pep8
Campbell Barton
noreply at git.blender.org
Tue Apr 15 05:12:28 CEST 2014
Commit: ea610e655cd8b8f9fb97f0a9a4fc5fd46418bd9e
Author: Campbell Barton
Date: Tue Apr 15 13:11:48 2014 +1000
https://developer.blender.org/rBea610e655cd8b8f9fb97f0a9a4fc5fd46418bd9e
Style cleanup: C & pep8
===================================================================
M doc/python_api/rst_from_bmesh_opdefines.py
M intern/cycles/blender/addon/ui.py
M release/scripts/modules/bpy/ops.py
M release/scripts/templates_py/custom_nodes.py
M release/scripts/templates_py/operator_modal_view3d_raycast.py
M release/scripts/templates_py/ui_panel.py
M source/blender/editors/sculpt_paint/paint_stroke.c
M source/blender/editors/space_view3d/drawobject.c
M source/blender/makesrna/intern/rna_mesh.c
M source/tests/bl_run_operators.py
M source/tests/pep8.py
===================================================================
diff --git a/doc/python_api/rst_from_bmesh_opdefines.py b/doc/python_api/rst_from_bmesh_opdefines.py
index 977d317..32afe33 100644
--- a/doc/python_api/rst_from_bmesh_opdefines.py
+++ b/doc/python_api/rst_from_bmesh_opdefines.py
@@ -113,7 +113,7 @@ def main():
fsrc.close()
del fsrc
- # namespace hack
+ # namespace hack
vars = (
"BMO_OP_SLOT_ELEMENT_BUF",
"BMO_OP_SLOT_BOOL",
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index e7c5e58..a064b4f 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -47,12 +47,12 @@ class CyclesButtonsPanel():
def poll(cls, context):
rd = context.scene.render
return rd.engine in cls.COMPAT_ENGINES
-
-
+
+
def use_cpu(context):
cscene = context.scene.cycles
device_type = context.user_preferences.system.compute_device_type
-
+
return (device_type == 'NONE' or cscene.device == 'CPU')
@@ -1126,7 +1126,7 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
def poll(cls, context):
# node = context.texture_node
return False
- #return node and CyclesButtonsPanel.poll(context)
+ # return node and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py
index e457c08..2be2abc 100644
--- a/release/scripts/modules/bpy/ops.py
+++ b/release/scripts/modules/bpy/ops.py
@@ -204,8 +204,10 @@ class BPyOpsSubModOp(object):
import bpy
idname = self.idname()
as_string = op_as_string(idname)
- # XXX You never quite know what you get from bpy.types, with operators... Operator and OperatorProperties
- # are shadowing each other, and not in the same way for native ops and py ones! See T39158.
+ # XXX You never quite know what you get from bpy.types,
+ # with operators... Operator and OperatorProperties
+ # are shadowing each other, and not in the same way for
+ # native ops and py ones! See T39158.
# op_class = getattr(bpy.types, idname)
op_class = op_get_rna(idname)
descr = op_class.bl_rna.description
diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py
index bf89c0d..992ef73 100644
--- a/release/scripts/templates_py/custom_nodes.py
+++ b/release/scripts/templates_py/custom_nodes.py
@@ -49,13 +49,15 @@ class MyCustomSocket(NodeSocket):
def draw_color(self, context, node):
return (1.0, 0.4, 0.216, 0.5)
+
# Mix-in class for all custom nodes in this tree type.
# Defines a poll function to enable instantiation.
-class MyCustomTreeNode :
+class MyCustomTreeNode:
@classmethod
def poll(cls, ntree):
return ntree.bl_idname == 'CustomTreeType'
+
# Derived from the Node base type.
class MyCustomNode(Node, MyCustomTreeNode):
# === Basics ===
@@ -123,6 +125,7 @@ class MyCustomNode(Node, MyCustomTreeNode):
import nodeitems_utils
from nodeitems_utils import NodeCategory, NodeItem
+
# our own base class with an appropriate poll function,
# so the categories only show up in our own tree type
class MyNodeCategory(NodeCategory):
@@ -143,12 +146,12 @@ node_categories = [
# NB: settings values are stored as string expressions,
# for this reason they should be converted to strings using repr()
NodeItem("CustomNodeType", label="Node A", settings={
- "myStringProperty" : repr("Lorem ipsum dolor sit amet"),
- "myFloatProperty" : repr(1.0),
+ "myStringProperty": repr("Lorem ipsum dolor sit amet"),
+ "myFloatProperty": repr(1.0),
}),
NodeItem("CustomNodeType", label="Node B", settings={
- "myStringProperty" : repr("consectetur adipisicing elit"),
- "myFloatProperty" : repr(2.0),
+ "myStringProperty": repr("consectetur adipisicing elit"),
+ "myFloatProperty": repr(2.0),
}),
]),
]
diff --git a/release/scripts/templates_py/operator_modal_view3d_raycast.py b/release/scripts/templates_py/operator_modal_view3d_raycast.py
index eac7692..4d03550 100644
--- a/release/scripts/templates_py/operator_modal_view3d_raycast.py
+++ b/release/scripts/templates_py/operator_modal_view3d_raycast.py
@@ -16,7 +16,6 @@ def main(context, event, ray_max=10000.0):
ray_origin = view3d_utils.region_2d_to_origin_3d(region, rv3d, coord)
ray_target = ray_origin + (view_vector * ray_max)
-
def visible_objects_and_duplis():
"""Loop over (object, matrix) pairs (mesh only)"""
diff --git a/release/scripts/templates_py/ui_panel.py b/release/scripts/templates_py/ui_panel.py
index cacdb83..855d057 100644
--- a/release/scripts/templates_py/ui_panel.py
+++ b/release/scripts/templates_py/ui_panel.py
@@ -42,22 +42,22 @@ class LayoutDemoPanel(bpy.types.Panel):
col.label(text="Column Two:")
col.prop(scene, "frame_start")
col.prop(scene, "frame_end")
-
+
# Big render button
layout.label(text="Big Button:")
row = layout.row()
row.scale_y = 3.0
row.operator("render.render")
-
+
# Different sizes in a row
layout.label(text="Different button sizes:")
row = layout.row(align=True)
row.operator("render.render")
-
+
sub = row.row()
sub.scale_x = 2.0
sub.operator("render.render")
-
+
row.operator("render.render")
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index d3b6d8c..7b91214 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -169,7 +169,7 @@ static void paint_brush_update(bContext *C, Brush *brush, PaintMode mode,
* brush coord/pressure/etc.
* It's more an events design issue, which doesn't split coordinate/pressure/angle
* changing events. We should avoid this after events system re-design */
- if(!stroke->brush_init) {
+ if (!stroke->brush_init) {
copy_v2_v2(stroke->initial_mouse, mouse);
copy_v2_v2(ups->last_rake, mouse);
copy_v2_v2(ups->tex_mouse, mouse);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 24e00dd..df34f1f 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2414,8 +2414,8 @@ static void draw_dm_loop_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv
if (lnors) {
drawDMNormal_userData data;
- MLoop *mloops = dm->getLoopArray(dm);
- MVert *mverts = dm->getVertArray(dm);
+ const MLoop *mloops = dm->getLoopArray(dm);
+ const MVert *mverts = dm->getVertArray(dm);
int i, totloops = dm->getNumLoops(dm);
data.bm = em->bm;
@@ -2426,7 +2426,7 @@ static void draw_dm_loop_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv
glBegin(GL_LINES);
for (i = 0; i < totloops; i++, mloops++, lnors++) {
float no[3];
- float *co = mverts[mloops->v].co;
+ const float *co = mverts[mloops->v].co;
if (!data.uniform_scale) {
mul_v3_m3v3(no, data.tmat, (float *)lnors);
@@ -2434,7 +2434,7 @@ static void draw_dm_loop_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv
mul_m3_v3(data.imat, no);
}
else {
- copy_v3_v3(no,(float *)lnors);
+ copy_v3_v3(no, (float *)lnors);
}
mul_v3_fl(no, data.normalsize);
add_v3_v3(no, co);
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 99c35bd..42f316e 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -424,7 +424,7 @@ static void rna_MeshTessFace_split_normals_get(PointerRNA *ptr, float *values)
while (i--) zero_v3(&values[i * 3]);
}
else {
- while (i--) normal_short_to_float_v3(&values[i * 3], (const short*)(*vec)[i]);
+ while (i--) normal_short_to_float_v3(&values[i * 3], (const short *)(*vec)[i]);
}
}
diff --git a/source/tests/bl_run_operators.py b/source/tests/bl_run_operators.py
index 13bf615..e14b0ce 100644
--- a/source/tests/bl_run_operators.py
+++ b/source/tests/bl_run_operators.py
@@ -105,7 +105,7 @@ def blend_list(mainpath):
def is_blend(filename):
ext = splitext(filename)[1]
- return (ext in {".blend",})
+ return (ext in {".blend", })
return list(sorted(file_list(mainpath, is_blend)))
diff --git a/source/tests/pep8.py b/source/tests/pep8.py
index 3ae1828..235bca4 100644
--- a/source/tests/pep8.py
+++ b/source/tests/pep8.py
@@ -54,7 +54,7 @@ def is_pep8(path):
print("\nfile contains BOM, remove first 3 bytes: %r\n" % path)
# templates don't have a header but should be pep8
- for d in ("presets", "templates", "examples"):
+ for d in ("presets", "templates_py", "examples"):
if ("%s%s%s" % (os.sep, d, os.sep)) in path:
return 1
More information about the Bf-blender-cvs
mailing list