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