[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50014] branches/soc-2012-bratwurst: code cleanup
Campbell Barton
ideasman42 at gmail.com
Sun Aug 19 15:13:47 CEST 2012
Revision: 50014
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50014
Author: campbellbarton
Date: 2012-08-19 13:13:45 +0000 (Sun, 19 Aug 2012)
Log Message:
-----------
code cleanup
Modified Paths:
--------------
branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d.py
branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d_toolbar.py
branches/soc-2012-bratwurst/source/blender/blenkernel/intern/blender.c
branches/soc-2012-bratwurst/source/blender/blenkernel/intern/brush.c
branches/soc-2012-bratwurst/source/blender/blenlib/intern/math_vector.c
branches/soc-2012-bratwurst/source/blender/blenloader/intern/writefile.c
branches/soc-2012-bratwurst/source/blender/editors/interface/interface.c
branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c
branches/soc-2012-bratwurst/source/blender/editors/interface/interface_layout.c
branches/soc-2012-bratwurst/source/blender/editors/interface/interface_regions.c
branches/soc-2012-bratwurst/source/blender/editors/interface/interface_templates.c
branches/soc-2012-bratwurst/source/blender/editors/interface/interface_widgets.c
branches/soc-2012-bratwurst/source/blender/editors/mesh/editmesh_tools.c
branches/soc-2012-bratwurst/source/blender/editors/mesh/mesh_data.c
branches/soc-2012-bratwurst/source/blender/editors/object/object_vgroup.c
branches/soc-2012-bratwurst/source/blender/editors/screen/area.c
branches/soc-2012-bratwurst/source/blender/editors/screen/screen_edit.c
branches/soc-2012-bratwurst/source/blender/editors/screen/screen_ops.c
branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_2D.c
branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_cursor.c
branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_image.c
branches/soc-2012-bratwurst/source/blender/editors/space_view3d/space_view3d.c
branches/soc-2012-bratwurst/source/blender/editors/space_view3d/view3d_edit.c
branches/soc-2012-bratwurst/source/blender/editors/transform/transform.c
branches/soc-2012-bratwurst/source/blender/editors/transform/transform_conversions.c
branches/soc-2012-bratwurst/source/blender/editors/transform/transform_generics.c
branches/soc-2012-bratwurst/source/blender/editors/transform/transform_manipulator.c
branches/soc-2012-bratwurst/source/blender/editors/uvedit/uvedit_parametrizer.c
branches/soc-2012-bratwurst/source/blender/editors/uvedit/uvedit_unwrap_ops.c
branches/soc-2012-bratwurst/source/blender/imbuf/intern/util.c
Modified: branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d.py 2012-08-19 12:07:28 UTC (rev 50013)
+++ branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d.py 2012-08-19 13:13:45 UTC (rev 50014)
@@ -2744,19 +2744,20 @@
view = context.space_data
tools = context.tool_settings
wm = context.window_manager
+ floating_controls = context.user_preferences.view.floating_controls
- if bpy.context.user_preferences.view.floating_controls == 'BOTTOM' or bpy.context.user_preferences.view.floating_controls == 'TOP':
+ if floating_controls in {'BOTTOM', 'TOP'}:
layout = self.layout
row = None
- if bpy.context.user_preferences.view.floating_controls == 'BOTTOM':
+ if floating_controls == 'BOTTOM':
layout.alignment = 'BOTTOM'
row = layout.row() # Create this first so it floats on the bottom
self.make_lastop(context, layout)
- if bpy.context.user_preferences.view.floating_controls == 'TOP':
+ if floating_controls == 'TOP':
row = layout.row()
row = row.row(align=True)
@@ -2774,7 +2775,7 @@
# as operator controls so that they render off (popped, not toggled) and when the user clicks they
# invoke edit mode.
- if bpy.context.object.mode == 'EDIT':
+ if context.object.mode == 'EDIT':
props = row.operator("object.mode_set", text="", icon='OBJECT_DATA')
props.mode='OBJECT'
row.prop(tools, "use_select_vertex", text="", clearfield=True)
@@ -2790,13 +2791,13 @@
props = row.operator("mesh.selection_mode_set", text="", icon='FACESEL')
props.mode='FACE'
- elif bpy.context.user_preferences.view.floating_controls == 'LEFT' or bpy.context.user_preferences.view.floating_controls == 'RIGHT':
+ elif floating_controls in {'LEFT', 'RIGHT'}:
layout = self.layout
self.make_lastop(context, layout)
row = layout.row()
- if bpy.context.user_preferences.view.floating_controls == 'RIGHT':
+ if floating_controls == 'RIGHT':
row.alignment = 'RIGHT'
column = row.column(align=True)
@@ -2809,7 +2810,7 @@
column.separator()
- if bpy.context.object.mode == 'EDIT':
+ if context.object.mode == 'EDIT':
props = row.operator("object.mode_set", text="", icon='OBJECT_DATA')
props.mode='OBJECT'
column.prop(tools, "use_select_vertex", text="", clearfield=True)
@@ -2826,7 +2827,6 @@
props.mode='FACE'
-
def register():
bpy.utils.register_module(__name__)
Modified: branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2012-08-19 12:07:28 UTC (rev 50013)
+++ branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2012-08-19 13:13:45 UTC (rev 50014)
@@ -1069,7 +1069,6 @@
# ********** default tools for texture-paint ****************
-
class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel):
bl_context = "imagepaint"
bl_label = "Project Paint"
Modified: branches/soc-2012-bratwurst/source/blender/blenkernel/intern/blender.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/blenkernel/intern/blender.c 2012-08-19 12:07:28 UTC (rev 50013)
+++ branches/soc-2012-bratwurst/source/blender/blenkernel/intern/blender.c 2012-08-19 13:13:45 UTC (rev 50014)
@@ -253,8 +253,8 @@
sound_init_main(G.main);
if (bfd->user) {
- if (G.fileflags&G_FILE_PREFERENCES)
- {
+
+ if (G.fileflags & G_FILE_PREFERENCES) {
/* only here free userdef themes... */
BKE_userdef_free();
U = *bfd->user;
Modified: branches/soc-2012-bratwurst/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/blenkernel/intern/brush.c 2012-08-19 12:07:28 UTC (rev 50013)
+++ branches/soc-2012-bratwurst/source/blender/blenkernel/intern/brush.c 2012-08-19 13:13:45 UTC (rev 50014)
@@ -490,7 +490,7 @@
* number for every call. Instead we will generate a random number before each stroke */
void BKE_brush_randomize_size(Brush *brush)
{
- brush->random_factor_cache = (1.0 - brush->random_size/2.0) + brush->random_size*BLI_frand();
+ brush->random_factor_cache = (1.0 - brush->random_size / 2.0) + brush->random_size * BLI_frand();
}
@@ -509,7 +509,7 @@
co[1] = xy[1] / radius;
co[2] = 0.0f;
- if(fabs(angle) > 0.0001) {
+ if (fabsf(angle) > 0.0001f) {
length = normalize_v2(co);
co_angle = acos(co[0]);
co_angle = (co[1] > 0)? co_angle : - co_angle;
@@ -554,10 +554,10 @@
co[1] = xy[1] / radius;
co[2] = 0.0f;
- if(fabs(angle) > 0.0001) {
+ if (fabsf(angle) > 0.0001f) {
length = normalize_v2(co);
co_angle = acos(co[0]);
- co_angle = (co[1] > 0)? co_angle : - co_angle;
+ co_angle = (co[1] > 0) ? co_angle : -co_angle;
co_angle -= angle;
co[0] = cos(co_angle)*length;
@@ -588,7 +588,7 @@
unsigned char *dst, crgb[3];
const float alpha = BKE_brush_alpha_get(scene, brush);
float brush_rgb[3];
-
+
imbflag = (flt) ? IB_rectfloat : IB_rect;
xoff = -bufsize / 2.0f + 0.5f;
yoff = -bufsize / 2.0f + 0.5f;
@@ -616,16 +616,16 @@
if (texfall == 0) {
copy_v3_v3(dstf, brush_rgb);
dstf[3] = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
- if(invert) rgb_invert(dstf);
+ if (invert) rgb_invert(dstf);
}
else if (texfall == 1) {
BKE_brush_sample_tex(scene, brush, xy, dstf, 0, angle);
- if(invert) rgb_invert(dstf);
+ if (invert) rgb_invert(dstf);
}
else {
BKE_brush_sample_tex(scene, brush, xy, rgba, 0, angle);
mul_v3_v3v3(dstf, rgba, brush_rgb);
- if(invert) rgb_invert(dstf);
+ if (invert) rgb_invert(dstf);
dstf[3] = rgba[3] *alpha *BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius)
*BKE_brush_sample_masktex(scene, brush, xy, 0, angle);
}
@@ -654,7 +654,7 @@
else if (texfall == 1) {
BKE_brush_sample_tex(scene, brush, xy, rgba, 0, angle);
rgba_float_to_uchar(dst, rgba);
- if(invert) rgb_invert_uchar(dst);
+ if (invert) rgb_invert_uchar(dst);
}
else if (texfall == 2) {
BKE_brush_sample_tex(scene, brush, xy, rgba, 0, angle);
@@ -663,7 +663,7 @@
*BKE_brush_sample_masktex(scene, brush, xy, 0, angle);
rgb_float_to_uchar(dst, rgba);
- if(invert) rgb_invert_uchar(dst);
+ if (invert) rgb_invert_uchar(dst);
dst[3] = FTOCHAR(alpha_f);
}
@@ -676,7 +676,7 @@
dst[1] = crgb[1];
dst[2] = crgb[2];
dst[3] = FTOCHAR(alpha_f);
- if(invert) rgb_invert_uchar(dst);
+ if (invert) rgb_invert_uchar(dst);
}
}
}
@@ -721,7 +721,7 @@
{
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
- return (ups->flag & UNIFIED_PAINT_SIZE) ? brush->random_factor_cache*ups->size : brush->random_factor_cache*brush->size;
+ return (ups->flag & UNIFIED_PAINT_SIZE) ? brush->random_factor_cache * ups->size : brush->random_factor_cache * brush->size;
}
int BKE_brush_use_locked_size(const Scene *scene, Brush *brush)
Modified: branches/soc-2012-bratwurst/source/blender/blenlib/intern/math_vector.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/blenlib/intern/math_vector.c 2012-08-19 12:07:28 UTC (rev 50013)
+++ branches/soc-2012-bratwurst/source/blender/blenlib/intern/math_vector.c 2012-08-19 13:13:45 UTC (rev 50014)
@@ -345,7 +345,7 @@
float mul;
sub_v3_v3v3(vector, v, p);
- mul = dot_v3v3(vector, n)/dot_v3v3(v2, n);
+ mul = dot_v3v3(vector, n) / dot_v3v3(v2, n);
mul_v3_v3fl(vector, v2, mul);
sub_v3_v3(v, vector);
Modified: branches/soc-2012-bratwurst/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/blenloader/intern/writefile.c 2012-08-19 12:07:28 UTC (rev 50013)
+++ branches/soc-2012-bratwurst/source/blender/blenloader/intern/writefile.c 2012-08-19 13:13:45 UTC (rev 50014)
@@ -2885,8 +2885,7 @@
write_thumb(wd, thumb);
write_global(wd, write_flags, mainvar);
- if (!(write_flags & G_FILE_NO_DATA))
- {
+ if (!(write_flags & G_FILE_NO_DATA)) {
/* no UI save in undo */
if (current==NULL) {
write_windowmanagers(wd, &mainvar->wm);
Modified: branches/soc-2012-bratwurst/source/blender/editors/interface/interface.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/interface/interface.c 2012-08-19 12:07:28 UTC (rev 50013)
+++ branches/soc-2012-bratwurst/source/blender/editors/interface/interface.c 2012-08-19 13:13:45 UTC (rev 50014)
@@ -1458,17 +1458,17 @@
if (RNA_property_editable(&but->rnapoin, prop)) {
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
- if (RNA_property_array_length(&but->rnapoin, prop))
+ if (RNA_property_array_length(&but->rnapoin, prop)) {
RNA_property_boolean_set_index(&but->rnapoin, prop, but->rnaindex, value);
- else
- {
- if (but->flag & UI_CLEAR_BITFIELD)
- {
- // I'm not thrilled with this code, but I'm not sure there's a better way to find the state of shift.
+ }
+ else {
+ if (but->flag & UI_CLEAR_BITFIELD) {
+ /* I'm not thrilled with this code, but I'm not sure there's a better way to find the state of shift. */
wmWindow *win = CTX_wm_window((const bContext*)but->block->evil_C);
int shift = win->eventstate->shift;
- if (!shift)
+ if (!shift) {
RNA_property_boolean_clear(&but->rnapoin, prop);
+ }
}
RNA_property_boolean_set(&but->rnapoin, prop, value);
@@ -2014,8 +2014,9 @@
IMB_freeImBuf((struct ImBuf *)but->poin);
}
- if (but->color_override)
+ if (but->color_override) {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list