From ebfafc77ebf8c4059a281bd9b12b879253c85549 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 17 Jan 2012 17:14:23 +0000 Subject: fix for error in merge 43462 --- source/blender/editors/sculpt_paint/sculpt_uv.c | 2 -- source/blender/editors/uvedit/uvedit_smart_stitch.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 229ef10159e..4023797b11a 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -634,14 +634,12 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent /* Allocate initial selection for grab tool */ if(ts->uv_sculpt_tool == UV_SCULPT_TOOL_GRAB){ float radius, radius_root; - unsigned int tool; UvSculptData *sculptdata = (UvSculptData *)op->customdata; SpaceImage *sima; int width, height; float aspectRatio; float alpha, zoomx, zoomy; Brush *brush = paint_brush(sculptdata->uvsculpt); - tool = CTX_data_scene(C)->toolsettings->uv_sculpt_tool; alpha = brush_alpha(scene, brush); diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 6a9dda3e1f8..38c8f5bc69c 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1097,7 +1097,7 @@ static int stitch_init(bContext *C, wmOperator *op) state->selection_size = 0; /* Load old selection if redoing operator with different settings */ - if(RNA_property_is_set(op->ptr, "selection")){ + if(RNA_struct_property_is_set(op->ptr, "selection")){ int faceIndex, elementIndex; UvElement *element; -- cgit v1.2.3 From c64ab6c2bf2bb931249db9fe4712760760fbdcd6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 17 Jan 2012 17:26:58 +0000 Subject: Whitespace tabs vs. spaces consistency changes --- source/blender/blenkernel/BKE_text.h | 12 ++++++------ source/blender/blenkernel/intern/text.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index ffea8e0c8e2..f0c054560c4 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -46,8 +46,8 @@ void free_text (struct Text *text); void txt_set_undostate (int u); int txt_get_undostate (void); struct Text* add_empty_text (const char *name); -int txt_extended_ascii_as_utf8(char **str); -int reopen_text (struct Text *text); +int txt_extended_ascii_as_utf8(char **str); +int reopen_text (struct Text *text); struct Text* add_text (const char *file, const char *relpath); struct Text* copy_text (struct Text *ta); void unlink_text (struct Main *bmain, struct Text *text); @@ -60,8 +60,8 @@ void txt_order_cursors (struct Text *text); int txt_find_string (struct Text *text, const char *findstr, int wrap, int match_case); int txt_has_sel (struct Text *text); int txt_get_span (struct TextLine *from, struct TextLine *to); -int txt_utf8_offset_to_index(char *str, int offset); -int txt_utf8_index_to_offset(char *str, int index); +int txt_utf8_offset_to_index(char *str, int offset); +int txt_utf8_index_to_offset(char *str, int index); void txt_move_up (struct Text *text, short sel); void txt_move_down (struct Text *text, short sel); void txt_move_left (struct Text *text, short sel); @@ -162,8 +162,8 @@ int text_check_whitespace(char ch); * by 4 character length ID + the text * block itself + the 4 character length * ID (repeat) and opcode (repeat)) */ -#define UNDO_DBLOCK 027 /* Delete block */ -#define UNDO_IBLOCK 030 /* Insert block */ +#define UNDO_DBLOCK 027 /* Delete block */ +#define UNDO_IBLOCK 030 /* Insert block */ /* Misc */ #define UNDO_SWAP 031 /* Swap cursors */ diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index bc86a53c35e..40d439169a3 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -226,7 +226,7 @@ int txt_extended_ascii_as_utf8(char **str) while ((*str)[i]) { if((bad_char= BLI_utf8_invalid_byte(*str+i, length)) == -1) - break; + break; added++; i+= bad_char + 1; -- cgit v1.2.3 From 21b5dea29b513be759789048b178f18ab6e53a6e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 17 Jan 2012 17:27:18 +0000 Subject: PEP8 complaint changes --- release/scripts/startup/bl_ui/space_clip.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 0cf3a921167..b5e23f146b1 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -162,22 +162,25 @@ class CLIP_PT_tools_tracking(Panel): def draw(self, context): layout = self.layout - # clip = context.space_data.clip # UNUSED row = layout.row(align=True) - row.operator("clip.track_markers", text="", icon='FRAME_PREV').backwards = True + props = row.operator("clip.track_markers", text="", icon='FRAME_PREV') + props.backwards = True props = row.operator("clip.track_markers", text="", icon='PLAY_REVERSE') props.backwards = True props.sequence = True - row.operator("clip.track_markers", text="", icon='PLAY').sequence = True + props = row.operator("clip.track_markers", text="", icon='PLAY') + props.sequence = True row.operator("clip.track_markers", text="", icon='FRAME_NEXT') col = layout.column(align=True) - col.operator("clip.clear_track_path", text="Clear After").action = 'REMAINED' + props = col.operator("clip.clear_track_path", text="Clear After") + props.action = 'REMAINED' - col.operator("clip.clear_track_path", text="Clear Before").action = 'UPTO' + props = col.operator("clip.clear_track_path", text="Clear Before") + props.action = 'UPTO' col.operator("clip.clear_track_path", text="Clear").action = 'ALL' layout.operator("clip.join_tracks", text="Join") @@ -371,7 +374,7 @@ class CLIP_PT_objects(Panel): def draw(self, context): layout = self.layout - + sc = context.space_data tracking = sc.clip.tracking @@ -478,7 +481,8 @@ class CLIP_PT_tracking_camera(Panel): label = bpy.types.CLIP_MT_camera_presets.bl_label row.menu('CLIP_MT_camera_presets', text=label) row.operator("clip.camera_preset_add", text="", icon='ZOOMIN') - row.operator("clip.camera_preset_add", text="", icon='ZOOMOUT').remove_active = True + props = row.operator("clip.camera_preset_add", text="", icon='ZOOMOUT') + props.remove_active = True row = layout.row(align=True) sub = row.split(percentage=0.65) @@ -942,7 +946,8 @@ class CLIP_MT_select(Menu): layout.separator() - layout.operator("clip.select_all", text="Select/Deselect all").action = 'TOGGLE' + props = layout.operator("clip.select_all", text="Select/Deselect all") + props.action = 'TOGGLE' layout.operator("clip.select_all", text="Inverse").action = 'INVERT' layout.menu("CLIP_MT_select_grouped") @@ -967,8 +972,12 @@ class CLIP_MT_tracking_specials(Menu): def draw(self, context): layout = self.layout - layout.operator("clip.disable_markers", text="Enable Markers").action = 'ENABLE' - layout.operator("clip.disable_markers", text="Disable markers").action = 'DISABLE' + props = layout.operator("clip.disable_markers", + text="Enable Markers") + props.action = 'ENABLE' + + props = layout.operator("clip.disable_markers", text="Disable markers") + props.action = 'DISABLE' layout.separator() layout.operator("clip.set_origin") -- cgit v1.2.3 From 391a214303ed7d7307b8c26496d00607a1b34814 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 17 Jan 2012 17:57:20 +0000 Subject: pep8 edits, also remove unused vars --- release/scripts/modules/rna_xml.py | 5 ++- release/scripts/startup/bl_operators/clip.py | 5 ++- release/scripts/startup/bl_operators/wm.py | 4 +- release/scripts/startup/bl_ui/properties_game.py | 2 +- release/scripts/startup/bl_ui/properties_render.py | 6 +-- release/scripts/startup/bl_ui/space_image.py | 20 +++++---- release/scripts/startup/bl_ui/space_time.py | 16 ++++---- release/scripts/startup/bl_ui/space_view3d.py | 38 ++++++++--------- .../scripts/startup/bl_ui/space_view3d_toolbar.py | 47 +++++++++++----------- 9 files changed, 72 insertions(+), 71 deletions(-) diff --git a/release/scripts/modules/rna_xml.py b/release/scripts/modules/rna_xml.py index 634c74178fa..c39d904bf08 100644 --- a/release/scripts/modules/rna_xml.py +++ b/release/scripts/modules/rna_xml.py @@ -141,7 +141,7 @@ def rna2xml(fw=print_ln, return number_to_str(s, subsubvalue_type) else: return " ".join([str_recursive(si) for si in s]) - + array_value = " ".join(str_recursive(v) for v in subvalue_rna) node_attrs.append("%s=\"%s\"" % (prop, array_value)) @@ -308,13 +308,13 @@ def xml2rna(root_xml, rna2xml_node(root_xml, root_rna) - # ----------------------------------------------------------------------------- # Utility function used by presets. # The idea is you can run a preset like a script with a few args. # # This roughly matches the operator 'bpy.ops.script.python_file_run' + def _get_context_val(context, path): path_full = "context." + path try: @@ -328,6 +328,7 @@ def _get_context_val(context, path): return value + def xml_file_run(context, filepath, rna_map): import xml.dom.minidom diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 28628a48a0b..ac82ffbf48f 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -76,6 +76,7 @@ def CLIP_camera_for_clip(context, clip): return camera + def CLIP_track_view_selected(sc, track): if track.select_anchor: return True @@ -118,7 +119,7 @@ class CLIP_OT_track_to_empty(Operator): constraint.track = track.name constraint.use_3d_position = False constraint.object = tracking_object.name - constraint.camera = CLIP_camera_for_clip(context, clip); + constraint.camera = CLIP_camera_for_clip(context, clip) def execute(self, context): sc = context.space_data @@ -127,7 +128,7 @@ class CLIP_OT_track_to_empty(Operator): for track in tracking_object.tracks: if CLIP_track_view_selected(sc, track): - self._link_track(context, clip, tracking_object ,track) + self._link_track(context, clip, tracking_object, track) return {'FINISHED'} diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 970245fbf87..e9cb8af1cbd 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -166,9 +166,10 @@ class BRUSH_OT_active_index_set(Operator): if attr is None: return {'CANCELLED'} + toolsettings = context.tool_settings for i, brush in enumerate((cur for cur in bpy.data.brushes if getattr(cur, attr))): if i == self.index: - getattr(context.tool_settings, self.mode).brush = brush + getattr(toolsettings, self.mode).brush = brush return {'FINISHED'} return {'CANCELLED'} @@ -1768,4 +1769,3 @@ class WM_OT_addon_expand(Operator): info = addon_utils.module_bl_info(mod) info["show_expanded"] = not info["show_expanded"] return {'FINISHED'} - diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index f0f964f9a31..9f2b3367feb 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -287,7 +287,7 @@ class RENDER_PT_game_player(RenderButtonsPanel, Panel): col = row.column() col.prop(gs, "use_desktop") col.active = gs.show_fullscreen - + col = layout.column() col.label(text="Quality:") col.prop(gs, "samples") diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index 895c3611d86..fea7b9673ec 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -418,9 +418,9 @@ class RENDER_PT_stamp(RenderButtonsPanel, Panel): rd = context.scene.render layout.active = rd.use_stamp - + layout.prop(rd, "stamp_font_size", text="Font Size") - + row = layout.row() row.column().prop(rd, "stamp_foreground", slider=True) row.column().prop(rd, "stamp_background", slider=True) @@ -433,7 +433,7 @@ class RENDER_PT_stamp(RenderButtonsPanel, Panel): col.prop(rd, "use_stamp_render_time", text="RenderTime") col.prop(rd, "use_stamp_frame", text="Frame") col.prop(rd, "use_stamp_scene", text="Scene") - + col = split.column() col.prop(rd, "use_stamp_camera", text="Camera") col.prop(rd, "use_stamp_lens", text="Lens") diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index a7999bac971..7f35ae21dfb 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -706,8 +706,8 @@ class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, Panel): def draw(self, context): layout = self.layout - settings = context.tool_settings.image_paint - brush = settings.brush + toolsettings = context.tool_settings.image_paint + brush = toolsettings.brush layout.prop(brush, "image_tool", text="") @@ -823,18 +823,16 @@ class IMAGE_UV_sculpt(bpy.types.Panel): split = layout.split() col = split.column() - col.prop(context.tool_settings, "uv_sculpt_lock_borders"); - col.prop(context.tool_settings, "uv_sculpt_all_islands"); - + col.prop(toolsettings, "uv_sculpt_lock_borders") + col.prop(toolsettings, "uv_sculpt_all_islands") + split = layout.split() col = split.column() - col.prop(context.tool_settings, "uv_sculpt_tool"); - - if context.tool_settings.uv_sculpt_tool == 'RELAX': - col.prop(context.tool_settings, "uv_relax_method"); - - + col.prop(toolsettings, "uv_sculpt_tool") + + if toolsettings.uv_sculpt_tool == 'RELAX': + col.prop(toolsettings, "uv_relax_method") if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py index bb0e8cfdae5..7720fddb084 100644 --- a/release/scripts/startup/bl_ui/space_time.py +++ b/release/scripts/startup/bl_ui/space_time.py @@ -28,7 +28,7 @@ class TIME_HT_header(Header): layout = self.layout scene = context.scene - tools = context.tool_settings + toolsettings = context.tool_settings screen = context.screen row = layout.row(align=True) @@ -80,11 +80,11 @@ class TIME_HT_header(Header): layout.separator() row = layout.row(align=True) - row.prop(tools, "use_keyframe_insert_auto", text="", toggle=True) - row.prop(tools, "use_keyframe_insert_keyingset", text="", toggle=True) - if screen.is_animation_playing and tools.use_keyframe_insert_auto: + row.prop(toolsettings, "use_keyframe_insert_auto", text="", toggle=True) + row.prop(toolsettings, "use_keyframe_insert_keyingset", text="", toggle=True) + if screen.is_animation_playing and toolsettings.use_keyframe_insert_auto: subsub = row.row() - subsub.prop(tools, "use_record_with_nla", toggle=True) + subsub.prop(toolsettings, "use_record_with_nla", toggle=True) row = layout.row(align=True) row.prop_search(scene.keying_sets_all, "active", scene, "keying_sets_all", text="") @@ -193,10 +193,10 @@ class TIME_MT_autokey(Menu): def draw(self, context): layout = self.layout - tools = context.tool_settings + toolsettings = context.tool_settings - layout.prop_enum(tools, "auto_keying_mode", 'ADD_REPLACE_KEYS') - layout.prop_enum(tools, "auto_keying_mode", 'REPLACE_KEYS') + layout.prop_enum(toolsettings, "auto_keying_mode", 'ADD_REPLACE_KEYS') + layout.prop_enum(toolsettings, "auto_keying_mode", 'REPLACE_KEYS') def marker_menu_generic(layout): diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 715a90bd7ec..1dba79b34d7 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -761,7 +761,7 @@ class VIEW3D_MT_object_clear(Menu): layout.operator("object.location_clear", text="Location") layout.operator("object.rotation_clear", text="Rotation") layout.operator("object.scale_clear", text="Scale") - layout ("object.origin_clear", text="Origin") + layout.operator("object.origin_clear", text="Origin") class VIEW3D_MT_object_specials(Menu): @@ -1110,9 +1110,9 @@ class VIEW3D_MT_sculpt(Menu): def draw(self, context): layout = self.layout - tool_settings = context.tool_settings - sculpt = tool_settings.sculpt - brush = tool_settings.sculpt.brush + toolsettings = context.tool_settings + sculpt = toolsettings.sculpt + brush = toolsettings.sculpt.brush layout.operator("ed.undo") layout.operator("ed.redo") @@ -1148,8 +1148,8 @@ class VIEW3D_MT_sculpt(Menu): layout.prop(sculpt, "show_brush") # TODO, make available from paint menu! - layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size") - layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength") + layout.prop(toolsettings, "sculpt_paint_use_unified_size", text="Unify Size") + layout.prop(toolsettings, "sculpt_paint_use_unified_strength", text="Unify Strength") # ********** Particle menu ********** @@ -1453,7 +1453,7 @@ class VIEW3D_MT_edit_mesh(Menu): def draw(self, context): layout = self.layout - settings = context.tool_settings + toolsettings = context.tool_settings layout.operator("ed.undo") layout.operator("ed.redo") @@ -1485,9 +1485,9 @@ class VIEW3D_MT_edit_mesh(Menu): layout.separator() - layout.prop(settings, "use_mesh_automerge") - layout.prop_menu_enum(settings, "proportional_edit") - layout.prop_menu_enum(settings, "proportional_edit_falloff") + layout.prop(toolsettings, "use_mesh_automerge") + layout.prop_menu_enum(toolsettings, "proportional_edit") + layout.prop_menu_enum(toolsettings, "proportional_edit_falloff") layout.separator() @@ -1718,7 +1718,7 @@ class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu): def draw_curve(self, context): layout = self.layout - settings = context.tool_settings + toolsettings = context.tool_settings layout.menu("VIEW3D_MT_transform") layout.menu("VIEW3D_MT_mirror") @@ -1740,8 +1740,8 @@ def draw_curve(self, context): layout.separator() - layout.prop_menu_enum(settings, "proportional_edit") - layout.prop_menu_enum(settings, "proportional_edit_falloff") + layout.prop_menu_enum(toolsettings, "proportional_edit") + layout.prop_menu_enum(toolsettings, "proportional_edit_falloff") layout.separator() @@ -1870,7 +1870,7 @@ class VIEW3D_MT_edit_meta(Menu): def draw(self, context): layout = self.layout - settings = context.tool_settings + toolsettings = context.tool_settings layout.operator("ed.undo") layout.operator("ed.redo") @@ -1889,8 +1889,8 @@ class VIEW3D_MT_edit_meta(Menu): layout.separator() - layout.prop_menu_enum(settings, "proportional_edit") - layout.prop_menu_enum(settings, "proportional_edit_falloff") + layout.prop_menu_enum(toolsettings, "proportional_edit") + layout.prop_menu_enum(toolsettings, "proportional_edit_falloff") layout.separator() @@ -1914,7 +1914,7 @@ class VIEW3D_MT_edit_lattice(Menu): def draw(self, context): layout = self.layout - settings = context.tool_settings + toolsettings = context.tool_settings layout.menu("VIEW3D_MT_transform") layout.menu("VIEW3D_MT_mirror") @@ -1926,8 +1926,8 @@ class VIEW3D_MT_edit_lattice(Menu): layout.separator() - layout.prop_menu_enum(settings, "proportional_edit") - layout.prop_menu_enum(settings, "proportional_edit_falloff") + layout.prop_menu_enum(toolsettings, "proportional_edit") + layout.prop_menu_enum(toolsettings, "proportional_edit_falloff") class VIEW3D_MT_edit_armature(Menu): diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 248452a0e8c..95af67b9d3a 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -453,18 +453,18 @@ class PaintPanel(): @staticmethod def paint_settings(context): - ts = context.tool_settings + toolsettings = context.tool_settings if context.sculpt_object: - return ts.sculpt + return toolsettings.sculpt elif context.vertex_paint_object: - return ts.vertex_paint + return toolsettings.vertex_paint elif context.weight_paint_object: - return ts.weight_paint + return toolsettings.weight_paint elif context.image_paint_object: - return ts.image_paint + return toolsettings.image_paint elif context.particle_edit_object: - return ts.particle_edit + return toolsettings.particle_edit return None @@ -487,6 +487,7 @@ class PaintPanel(): ptr = ups if ups.use_unified_strength else brush parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider) + class VIEW3D_PT_tools_brush(PaintPanel, Panel): bl_label = "Brush" @@ -497,6 +498,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): def draw(self, context): layout = self.layout + toolsettings = context.tool_settings settings = self.paint_settings(context) brush = settings.brush @@ -541,7 +543,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): row = col.row(align=True) - ups = context.tool_settings.unified_paint_settings + ups = toolsettings.unified_paint_settings if ((ups.use_unified_size and ups.use_locked_size) or ((not ups.use_unified_size) and brush.use_locked_size)): self.prop_unified_size(row, context, brush, "use_locked_size", icon='LOCKED') @@ -675,9 +677,9 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): # Weight Paint Mode # elif context.weight_paint_object and brush: - layout.prop(context.tool_settings, "vertex_group_weight", text="Weight", slider=True) - layout.prop(context.tool_settings, "use_auto_normalize", text="Auto Normalize") - layout.prop(context.tool_settings, "use_multipaint", text="Multi-Paint") + layout.prop(toolsettings, "vertex_group_weight", text="Weight", slider=True) + layout.prop(toolsettings, "use_auto_normalize", text="Auto Normalize") + layout.prop(toolsettings, "use_multipaint", text="Multi-Paint") col = layout.column() @@ -956,8 +958,8 @@ class VIEW3D_PT_sculpt_options(PaintPanel, Panel): def draw(self, context): layout = self.layout - tool_settings = context.tool_settings - sculpt = tool_settings.sculpt + toolsettings = context.tool_settings + sculpt = toolsettings.sculpt layout.label(text="Lock:") row = layout.row(align=True) @@ -1003,11 +1005,11 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, Panel): @classmethod def poll(cls, context): - ts = context.tool_settings - return ((context.sculpt_object and ts.sculpt) or - (context.vertex_paint_object and ts.vertex_paint) or - (context.weight_paint_object and ts.weight_paint) or - (context.image_paint_object and ts.image_paint)) + toolsettings = context.tool_settings + return ((context.sculpt_object and toolsettings.sculpt) or + (context.vertex_paint_object and toolsettings.vertex_paint) or + (context.weight_paint_object and toolsettings.weight_paint) or + (context.image_paint_object and toolsettings.image_paint)) def draw(self, context): layout = self.layout @@ -1102,8 +1104,8 @@ class VIEW3D_PT_tools_vertexpaint(PaintPanel, Panel): def draw(self, context): layout = self.layout - tool_settings = context.tool_settings - vpaint = tool_settings.vertex_paint + toolsettings = context.tool_settings + vpaint = toolsettings.vertex_paint col = layout.column() #col.prop(vpaint, "mode", text="") @@ -1141,8 +1143,9 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel): ob = context.active_object mesh = ob.data - ipaint = context.tool_settings.image_paint - settings = context.tool_settings.image_paint + toolsettings = context.tool_settings + ipaint = toolsettings.image_paint + settings = toolsettings.image_paint use_projection = ipaint.use_projection col = layout.column() @@ -1199,8 +1202,6 @@ class VIEW3D_PT_imagepaint_options(PaintPanel): def draw(self, context): layout = self.layout - tool_settings = context.tool_settings - col = layout.column() self.unified_paint_settings(col, context) -- cgit v1.2.3 From 2019f636b059fde75f459e646c8b0253a5c8189d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 17 Jan 2012 18:01:16 +0000 Subject: misc small changes and bmesh support for testing script --- intern/cycles/blender/addon/enums.py | 4 +- intern/cycles/blender/addon/ui.py | 6 +- source/blender/editors/sculpt_paint/paint_image.c | 13 ++- source/blender/makesrna/intern/rna_userdef.c | 2 +- source/tests/bl_mesh_modifiers.py | 112 ++++++++++++++++++---- 5 files changed, 107 insertions(+), 30 deletions(-) diff --git a/intern/cycles/blender/addon/enums.py b/intern/cycles/blender/addon/enums.py index da4c73a5d3b..e1b138def3c 100644 --- a/intern/cycles/blender/addon/enums.py +++ b/intern/cycles/blender/addon/enums.py @@ -21,8 +21,8 @@ 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"), diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index d3c06084ad3..70f38fa7e8c 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -149,6 +149,7 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel): sub.prop(cscene, "debug_use_spatial_splits") sub.prop(cscene, "use_cache") + class CyclesRender_PT_layers(CyclesButtonsPanel, Panel): bl_label = "Layers" bl_options = {'DEFAULT_CLOSED'} @@ -708,7 +709,7 @@ def draw_device(self, context): scene = context.scene layout = self.layout - if scene.render.engine == "CYCLES": + if scene.render.engine == 'CYCLES': cscene = scene.cycles layout.prop(cscene, "feature_set") @@ -719,6 +720,7 @@ def draw_device(self, context): elif device_type == 'OPENCL' and cscene.feature_set == 'EXPERIMENTAL': layout.prop(cscene, "device") + def draw_pause(self, context): layout = self.layout scene = context.scene @@ -726,7 +728,7 @@ def draw_pause(self, context): if scene.render.engine == "CYCLES": view = context.space_data - if view.viewport_shade == "RENDERED": + if view.viewport_shade == 'RENDERED': cscene = scene.cycles layout.prop(cscene, "preview_pause", icon="PAUSE", text="") diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index fea827ed00b..a5b79d0c974 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4650,7 +4650,8 @@ static int uv_sculpt_brush_poll(bContext *C) int ret; Object *obedit = CTX_data_edit_object(C); SpaceImage *sima= CTX_wm_space_image(C); - ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings; + Scene *scene = CTX_data_scene(C); + ToolSettings *toolsettings = scene->toolsettings; if(!uv_sculpt_brush(C) || !obedit || obedit->type != OB_MESH) return 0; @@ -5162,7 +5163,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) float pixel_size; float alpha= 0.5f; - ts = CTX_data_scene(C)->toolsettings; + ts = scene->toolsettings; if(use_zoom && !ts->use_uv_sculpt){ pixel_size = MAX2(size * zoomx, size * zoomy); @@ -5202,14 +5203,16 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) static void toggle_paint_cursor(bContext *C, int enable) { - ToolSettings *settings= CTX_data_scene(C)->toolsettings; + wmWindowManager *wm= CTX_wm_manager(C); + Scene *scene = CTX_data_scene(C); + ToolSettings *settings= scene->toolsettings; if(settings->imapaint.paintcursor && !enable) { - WM_paint_cursor_end(CTX_wm_manager(C), settings->imapaint.paintcursor); + WM_paint_cursor_end(wm, settings->imapaint.paintcursor); settings->imapaint.paintcursor = NULL; } else if(enable) - settings->imapaint.paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), image_paint_poll, brush_drawcursor, NULL); + settings->imapaint.paintcursor= WM_paint_cursor_activate(wm, image_paint_poll, brush_drawcursor, NULL); } /* enable the paint cursor if it isn't already. diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 9de6f73dbe7..24486c227b7 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2945,7 +2945,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop= RNA_def_property(srna, "use_16bit_textures", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_16bit_textures", 1); - RNA_def_property_ui_text(prop, "16 Bit Float Textures", "Use 16 bit per component texture for float images."); + RNA_def_property_ui_text(prop, "16 Bit Float Textures", "Use 16 bit per component texture for float images"); RNA_def_property_update(prop, 0, "rna_userdef_gl_use_16bit_textures"); prop= RNA_def_property(srna, "use_vertex_buffer_objects", PROP_BOOLEAN, PROP_NONE); diff --git a/source/tests/bl_mesh_modifiers.py b/source/tests/bl_mesh_modifiers.py index 6a4e46a1832..789a4037659 100644 --- a/source/tests/bl_mesh_modifiers.py +++ b/source/tests/bl_mesh_modifiers.py @@ -31,11 +31,12 @@ import math USE_QUICK_RENDER = False - +IS_BMESH = hasattr(__import__("bpy").types, "LoopColors") # ----------------------------------------------------------------------------- # utility funcs + def render_gl(context, filepath, shade): def ctx_viewport_shade(context, shade): @@ -61,15 +62,16 @@ def render_gl(context, filepath, shade): ctx_viewport_shade(context, shade) + #~ # stop to inspect! + #~ if filepath == "test_cube_shell_solidify_subsurf_wp_wire": + #~ assert(0) + #~ else: + #~ return + bpy.ops.render.opengl(write_still=True, view_context=True) - # stop to inspect! - #~ if filepath == "test_cube_like_subsurf_single_wp_wire": - #~ assert(0) - - def render_gl_all_modes(context, obj, filepath=""): assert(obj != None) @@ -201,8 +203,12 @@ def defaults_object(obj): mesh.show_normal_vertex = True # lame! - for face in mesh.faces: - face.use_smooth = True + if IS_BMESH: + for poly in mesh.polygons: + poly.use_smooth = True + else: + for face in mesh.faces: + face.use_smooth = True def defaults_modifier(mod): @@ -213,6 +219,18 @@ def defaults_modifier(mod): # ----------------------------------------------------------------------------- # models (utils) + +if IS_BMESH: + def mesh_bmesh_poly_elems(poly, elems): + vert_start = poly.loop_start + vert_total = poly.loop_total + return elems[vert_start:vert_start + vert_total] + + def mesh_bmesh_poly_vertices(poly): + return [loop.vertex_index + for loop in mesh_bmesh_poly_elems(poly, poly.id_data.loops)] + + def mesh_bounds(mesh): xmin = ymin = zmin = +100000000.0 xmax = ymax = zmax = -100000000.0 @@ -231,23 +249,67 @@ def mesh_bounds(mesh): def mesh_uv_add(obj): + + uvs = ((0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0)) + uv_lay = obj.data.uv_textures.new() - for uv in uv_lay.data: - uv.uv1 = 0.0, 0.0 - uv.uv2 = 0.0, 1.0 - uv.uv3 = 1.0, 1.0 - uv.uv4 = 1.0, 0.0 + + if IS_BMESH: + # XXX, odd that we need to do this. until uvs and texface + # are separated we will need to keep it + uv_loops = obj.data.uv_loop_layers[-1] + uv_list = uv_loops.data[:] + for poly in obj.data.polygons: + poly_uvs = mesh_bmesh_poly_elems(poly, uv_list) + for i, c in enumerate(poly_uvs): + c.uv = uvs[i % 4] + else: + for uv in uv_lay.data: + uv.uv1 = uvs[0] + uv.uv2 = uvs[1] + uv.uv3 = uvs[2] + uv.uv4 = uvs[3] return uv_lay def mesh_vcol_add(obj, mode=0): + + colors = ((0.0, 0.0, 0.0), # black + (1.0, 0.0, 0.0), # red + (0.0, 1.0, 0.0), # green + (0.0, 0.0, 1.0), # blue + (1.0, 1.0, 0.0), # yellow + (0.0, 1.0, 1.0), # cyan + (1.0, 0.0, 1.0), # magenta + (1.0, 1.0, 1.0), # white + ) + + def colors_get(i): + return colors[i % len(colors)] + vcol_lay = obj.data.vertex_colors.new() - for col in vcol_lay.data: - col.color1 = 1.0, 0.0, 0.0 - col.color2 = 0.0, 1.0, 0.0 - col.color3 = 0.0, 0.0, 1.0 - col.color4 = 0.0, 0.0, 0.0 + + mesh = obj.data + + if IS_BMESH: + col_list = vcol_lay.data[:] + for poly in mesh.polygons: + face_verts = mesh_bmesh_poly_vertices(poly) + poly_cols = mesh_bmesh_poly_elems(poly, col_list) + for i, c in enumerate(poly_cols): + c.color = colors[i % 4] + else: + for i, col in enumerate(vcol_lay.data): + face_verts = mesh.faces[i].vertices + col.color1 = colors_get(face_verts[0]) + col.color2 = colors_get(face_verts[1]) + col.color3 = colors_get(face_verts[2]) + if len(face_verts) == 4: + col.color4 = colors_get(face_verts[3]) return vcol_lay @@ -364,13 +426,19 @@ def modifier_hook_add(scene, obj, use_vgroup=True): # no nice way to add hooks from py api yet # assume object mode, hook first face! mesh = obj.data - + if use_vgroup: for v in mesh.vertices: v.select = True else: for v in mesh.vertices: v.select = False + + if IS_BMESH: + face_verts = mesh_bmesh_poly_vertices(mesh.polygons[0]) + else: + face_verts = mesh.faces[0].vertices[:] + for i in mesh.faces[0].vertices: mesh.vertices[i].select = True @@ -406,7 +474,11 @@ def modifier_build_add(scene, obj): defaults_modifier(mod) # ensure we display some faces - totface = len(obj.data.faces) + if IS_BMESH: + totface = len(obj.data.polygons) + else: + totface = len(obj.data.faces) + mod.frame_start = totface // 2 mod.frame_duration = totface -- cgit v1.2.3 From a71d94ad7a84829abd7beb1d12bea3726f1b8955 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 17 Jan 2012 18:29:46 +0000 Subject: Fix carve compile error with gcc 4.6, patch by Stephen McQuay. --- extern/carve/include/carve/polyline_iter.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/extern/carve/include/carve/polyline_iter.hpp b/extern/carve/include/carve/polyline_iter.hpp index 5092f9abecd..8501e620fea 100644 --- a/extern/carve/include/carve/polyline_iter.hpp +++ b/extern/carve/include/carve/polyline_iter.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #include -- cgit v1.2.3 From 408f7963c5cfd65792d826390b01896282de8e97 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 17 Jan 2012 18:32:14 +0000 Subject: error in own recent commit --- release/scripts/startup/bl_ui/space_image.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 7f35ae21dfb..625c3b1ab2f 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -778,8 +778,9 @@ class IMAGE_UV_sculpt_curve(bpy.types.Panel): def draw(self, context): layout = self.layout - toolsettings = context.tool_settings.uv_sculpt - brush = toolsettings.brush + toolsettings = context.tool_settings + uvsculpt = toolsettings.uv_sculpt + brush = uvsculpt.brush layout.template_curve_mapping(brush, "curve") @@ -806,8 +807,9 @@ class IMAGE_UV_sculpt(bpy.types.Panel): def draw(self, context): layout = self.layout - toolsettings = context.tool_settings.uv_sculpt - brush = toolsettings.brush + toolsettings = context.tool_settings + uvsculpt = toolsettings.uv_sculpt + brush = uvsculpt.brush if brush: col = layout.column() -- cgit v1.2.3