[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29341] branches/soc-2010-jwilkins: * Stencil buffer pixel format request for Mac OSX (Cocoa)

Jason Wilkins Jason.A.Wilkins at gmail.com
Tue Jun 8 15:54:36 CEST 2010


Revision: 29341
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29341
Author:   jwilkins
Date:     2010-06-08 15:54:36 +0200 (Tue, 08 Jun 2010)

Log Message:
-----------
* Stencil buffer pixel format request for Mac OSX (Cocoa)
* Only the current projected or unprojected size slider appears in the UI at one time
* "Lock Brush" or "Use Surface Size" is now "Blender Units"
* Added UI for controlling the scale, offset, and rotation of the texture
* Added overlay graphic for "Tiled" texture map mode.  Can be turned off and on.  Transparency can be adjusted.
- Known bug: overlay may not draw properly if texture is modified from an image to a prodedural texture.
- Known bug: overlay regenerates and uploads a texture every time it is drawn.
* Added "Restore Mesh" feature to strokes that allows you to drag a shape around on the surface to place it carefully
* Unchecking "Original Normal" now hides the "Normal Direction" list box
* Added 'Edge-to-edge' checkbox that appears when 'Anchored' is selected.  It allows 'anchor' daubs to be applied by selecting accross the diameter where the user wishes to place it.
* The airbrush rate, smoothstroke, and spacing modifiers are hidden now when their respective strokes are not selected
* Added controls to select the color of each individual brush in both add and subtract mode.  
* Only the add color is used for brushes that only have one mode.
* Layer does not use direction so removed the add/subtract button for it.
- Possible bug?  The layer tool does not behave correctly in subtract mod if it is allowed
* Renamed 'offset' in the texture controls to 'depth offset'
* Added defaults of red for + and blue for - in new_brush and readfile
- Possible bug?  It feels like the UI loses focus where it shouldn't.  Everything gets greyed out.
* Commented out notification functions for changes in Brush values.  Since both sliders aren't visible anymore.
* Moving the mouse cursor keeps track of the direction of movement so that 'rake' has a more sensible starting angle.
* The thickness and transparency of the 'on surface' brush changes depending on strength and tablet pressure
* The anchor brush shows a small dot as a cursor which expands to surround the area that is being stamped
- Bug: it is not advisable to combine 'use blender units' with an overlay because it is too unstable with changes in brush size
- Bug: it does not appear to me that loading textures as GL_LUMINANCE_ALPHA makes dark areas more transparent
- Bug: even though I have tried to adjust the anchor brush so that it only outlines areas outside its influence it seems too small still
* Careful coding in several places to make sure that textures are consistently offset, scaled, and rotated in the overlay and in tiled and fixed modes
* The f-key now scales the brush in blender units or pixels depending on which one is selected
* The 'on surface' brush requires that the depth buffer be saved so I modified the "triple" update path to save depth values as well.
- The defaults for OpenGL pixel transfers are used to insure speed, this is a much better solution than the alternative of rerendering the viewport completely.
- The implementation uses Read/DrawPixels which is considered 'slow', a better implementation would use ARB_depth_texture and ARB_fragment_program
* There is a potential for bugs around where I changed opengl state because although I tried to ensure I set all state I need, I do not know what Blender considers to be its defaults.
* Fixed non-standard C in sculpt.c
* Made outline of brush on surface thinner
* fixed the horrible hack I was using to make the on-surface brush routine work.  cpu usage when the brush is over the model is now reasonable

Modified Paths:
--------------
    branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.mm
    branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
    branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
    branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c
    branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
    branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h
    branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
    branches/soc-2010-jwilkins/source/blender/windowmanager/intern/wm_draw.c

Modified: branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.mm	2010-06-08 13:03:49 UTC (rev 29340)
+++ branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.mm	2010-06-08 13:54:36 UTC (rev 29341)
@@ -349,15 +349,22 @@
 	pixelFormatAttrsWindow[i++] = NSOpenGLPFAAccelerated;
 	//pixelFormatAttrsWindow[i++] = NSOpenGLPFAAllowOfflineRenderers,;   // Removed to allow 10.4 builds, and 2 GPUs rendering is not used anyway
 	
+	pixelFormatAttrsWindow[i++] = NSOpenGLPFAStencilSize;
+	pixelFormatAttrsWindow[i++] = (NSOpenGLPixelFormatAttribute) 8;
+	
 	pixelFormatAttrsWindow[i++] = NSOpenGLPFADepthSize;
 	pixelFormatAttrsWindow[i++] = (NSOpenGLPixelFormatAttribute) 32;
 	
+	
 	if (stereoVisual) pixelFormatAttrsWindow[i++] = NSOpenGLPFAStereo;
 	
 	if (numOfAASamples>0) {
 		// Multisample anti-aliasing
 		pixelFormatAttrsWindow[i++] = NSOpenGLPFAMultisample;
 		
+		pixelFormatAttrsWindow[i++] = NSOpenGLPFAStencilSize;
+		pixelFormatAttrsWindow[i++] = (NSOpenGLPixelFormatAttribute) 8;
+
 		pixelFormatAttrsWindow[i++] = NSOpenGLPFASampleBuffers;
 		pixelFormatAttrsWindow[i++] = (NSOpenGLPixelFormatAttribute) 1;
 		

Modified: branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-06-08 13:03:49 UTC (rev 29340)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-06-08 13:54:36 UTC (rev 29341)
@@ -547,19 +547,14 @@
             col.separator()
 
             row = col.row(align=True)
-            row.prop(brush, "lock_brush_size", text="Use Surface Size")
+            row.prop(brush, "lock_brush_size", text="Use Blender Units")
 
             row = col.row(align=True)
-            row.prop(brush, "unprojected_radius", text="Surface Size", slider=True)
-            row.active = brush.lock_brush_size
+            if brush.lock_brush_size:
+                row.prop(brush, "unprojected_radius", text="Units", slider=True)
+            else:
+                row.prop(brush, "size", slider=True, text="Pixels")
 
-            if brush.sculpt_tool != 'GRAB' and brush.lock_brush_size:
-                row.prop(brush, "use_size_pressure", toggle=True, text="")
-
-            row = col.row(align=True)
-            row.prop(brush, "size", slider=True, text="Pixel Size")
-            row.active = not brush.lock_brush_size
-
             if brush.sculpt_tool != 'GRAB' and not brush.lock_brush_size:
                 row.prop(brush, "use_size_pressure", toggle=True, text="")
 
@@ -579,7 +574,7 @@
                     row.prop(brush, "plane_offset", slider=True)
                     row.prop(brush, "use_offset_pressure", text="")
 
-                if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
+                if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'CLAY'):
                     col.row().prop(brush, "direction", expand=True)
 
                 if brush.sculpt_tool in ('DRAW', 'INFLATE', 'LAYER', 'CLAY'):
@@ -693,11 +688,29 @@
             row = col.row(align=True)
             row.prop(tex_slot, "map_mode", expand=True)
             row = col.row(align=True)
-            row.prop(brush, "texture_offset", slider=True)
+            row.prop(brush, "texture_offset", slider=True, text="Depth Offset")
 
-        row = col.row(align=True)
-        row.prop(tex_slot, "angle", slider=True)
+            if tex_slot.map_mode in ('FIXED', 'TILED'):
+                sub = col.column(align=True)
+                sub.label(text="Scale:")
+                sub.prop(brush, "texture_scale_x", slider=True, text="Width")
+                sub.prop(brush, "texture_scale_y", slider=True, text="Height")
+                sub.prop(brush, "texture_scale_percentage", slider=True, text="")
+                sub.label(text="Center:")
+                sub.prop(brush, "texture_center_x", slider=True, text="Center X")
+                sub.prop(brush, "texture_center_y", slider=True, text="Center Y")
 
+                row = col.row(align=True)
+                row.prop(tex_slot, "angle", slider=True)
+
+                if tex_slot.map_mode in ('TILED'):
+                    row = col.row(align=True)
+                    row.prop(brush, "use_texture_overlay", text="Show Overlay")
+                    
+                    if brush.use_texture_overlay:
+                        row = col.row(align=True)
+                        row.prop(brush, "texture_overlay_alpha", slider=True, text="Overlay Alpha")
+
 class VIEW3D_PT_tools_brush_tool(PaintPanel):
     bl_label = "Tool"
     bl_default_closed = True
@@ -750,35 +763,35 @@
 
         if context.sculpt_object:
             if brush.sculpt_tool != 'LAYER':
+                layout.prop(brush, "restore_mesh")
                 layout.prop(brush, "use_anchor")
+                if brush.use_anchor:
+                    layout.prop(brush, "edge_to_edge")
             layout.prop(brush, "use_rake")
             if brush.sculpt_tool in ('DRAW', 'LAYER', 'FLATTEN', 'CLAY', 'FILL', 'SCRAPE', 'CONTRAST'):
                 layout.prop(brush, "use_original_normal")
-                col = layout.column()
-                col.label(text="Direction:")
-                col.prop(brush, "sculpt_direction", text="")
+                if brush.use_original_normal:
+                    col = layout.column()
+                    col.label(text="Direction:")
+                    col.prop(brush, "sculpt_direction", text="")
         layout.prop(brush, "use_airbrush")
-        col = layout.column()
-        col.active = brush.use_airbrush
-        col.prop(brush, "rate", slider=True)
+        if brush.use_airbrush:
+            col = layout.column()
+            col.prop(brush, "rate", slider=True)
 
         if not texture_paint:
             layout.prop(brush, "use_smooth_stroke")
-            col = layout.column()
-            col.active = brush.use_smooth_stroke
-            col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
-            col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
+            if brush.use_smooth_stroke:
+                col = layout.column()
+                col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
+                col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
 
         layout.prop(brush, "use_space")
-        row = layout.row(align=True)
-        row.active = brush.use_space
-        row.prop(brush, "spacing", text="Spacing", slider=True)
-        row = layout.row(align=True)
-        row.active = brush.use_space
-        row.prop(brush, "use_space_atten", text="Adaptive Strength")
-        #row = layout.row(align=True)
-        #row.active = brush.use_space
-        #row.prop(brush, "use_adaptive_space", text="Adaptive Spacing")
+        if brush.use_space:
+            col = layout.col(align=True)
+            col.prop(brush, "use_space_atten", text="Adaptive Strength")
+            col.prop(brush, "spacing", text="Spacing", slider=True)
+            #col.prop(brush, "use_adaptive_space", text="Adaptive Spacing")
 
         if texture_paint:
             row.prop(brush, "use_spacing_pressure", toggle=True, text="")
@@ -816,12 +829,25 @@
         layout = self.layout
 
         sculpt = context.tool_settings.sculpt
+        settings = self.paint_settings(context)
+        brush = settings.brush
 
         col = layout.column()
         col.prop(sculpt, "show_brush")
-        col.prop(sculpt, "show_brush_on_surface")
+        if sculpt.show_brush:
+            col.prop(sculpt, "show_brush_on_surface")
         col.prop(sculpt, "fast_navigate")
 
+        if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH'):
+            sub = col.column()
+            sub.label(text="Color:")
+            sub.prop(brush, "add_col", text="Add")
+            sub.prop(brush, "sub_col", text="Substract")
+        else:
+            sub = col.column()
+            sub.prop(brush, "add_col", text="Color")
+
+
         split = self.layout.split()
 
         col = split.column()

Modified: branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c	2010-06-08 13:03:49 UTC (rev 29340)
+++ branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c	2010-06-08 13:54:36 UTC (rev 29341)
@@ -88,7 +88,22 @@
 	brush->flag |= BRUSH_SPACE;
 	brush->detail = 0.25f;
 	brush->smoothness = 0.25f;
+	brush->plane_offset = 0;
+	brush->texture_center_x = 0;
+	brush->texture_center_y = 0;
+	brush->texture_scale_x = 1;
+	brush->texture_scale_y = 1;
+	brush->texture_offset = 0;
+	brush->overlay_texture = 0;
 
+	brush->add_col[0] = 1.00;
+	brush->add_col[1] = 0.39;
+	brush->add_col[2] = 0.39;
+
+	brush->sub_col[0] = 0.39;
+	brush->sub_col[1] = 0.39;
+	brush->sub_col[2] = 1.00;
+
 	brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
 	
 	default_mtex(&brush->mtex);
@@ -1021,7 +1036,12 @@
 	const float conv = 0.017453293;
 
 	if(mode == WM_RADIALCONTROL_SIZE)
-		br->size = new_value * size_weight;
+		if (br->flag & BRUSH_LOCK_SIZE) {
+			float initial_value = RNA_float_get(op->ptr, "initial_value");
+			br->unprojected_radius *= new_value/initial_value * size_weight;
+		}
+		else
+			br->size = new_value * size_weight;
 	else if(mode == WM_RADIALCONTROL_STRENGTH)
 		br->alpha = new_value;
 	else if(mode == WM_RADIALCONTROL_ANGLE) {

Modified: branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c	2010-06-08 13:03:49 UTC (rev 29340)
+++ branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c	2010-06-08 13:54:36 UTC (rev 29341)
@@ -10925,10 +10925,31 @@
 	{
 		Brush *brush;
 		for (brush= main->brush.first; brush; brush= brush->id.next) {
-			if(brush->detail == 0.0f)
-				brush->detail = 0.25f;
-			if (brush->smoothness == 0.0f)
-				brush->smoothness = 0.25f;
+			if (brush->detail == 0.0f)                brush->detail = 0.25f;
+			if (brush->smoothness == 0.0f)            brush->smoothness = 0.25f;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list