Revision: 29142
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29142
Author:   farsthary
Date:     2010-06-01 21:54:05 +0200 (Tue, 01 Jun 2010)

Log Message:
-----------
Added smoothness property to unlimited clay, it controls the subdivission 
smoothness for further user control over sculpting 

Modified Paths:
--------------
    branches/branch-farsthary/release/scripts/ui/space_view3d_toolbar.py
    branches/branch-farsthary/source/blender/blenkernel/intern/brush.c
    branches/branch-farsthary/source/blender/blenloader/intern/readfile.c
    branches/branch-farsthary/source/blender/editors/sculpt_paint/sculpt.c
    branches/branch-farsthary/source/blender/makesdna/DNA_brush_types.h
    branches/branch-farsthary/source/blender/makesrna/intern/rna_brush.c

Modified: branches/branch-farsthary/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/branch-farsthary/release/scripts/ui/space_view3d_toolbar.py        
2010-06-01 19:48:55 UTC (rev 29141)
+++ branches/branch-farsthary/release/scripts/ui/space_view3d_toolbar.py        
2010-06-01 19:54:05 UTC (rev 29142)
@@ -584,6 +584,7 @@
             col.prop(brush,"use_dynamic_subdiv")
             if brush.use_dynamic_subdiv ==True:
                 col.prop(brush,"detail",slider=True)
+                col.prop(brush,"smoothness",slider=True)
 
         # Texture Paint Mode #
 

Modified: branches/branch-farsthary/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/branch-farsthary/source/blender/blenkernel/intern/brush.c  
2010-06-01 19:48:55 UTC (rev 29141)
+++ branches/branch-farsthary/source/blender/blenkernel/intern/brush.c  
2010-06-01 19:54:05 UTC (rev 29142)
@@ -84,6 +84,7 @@
        brush->sculpt_tool = SCULPT_TOOL_DRAW;
        brush->flag |= BRUSH_SPACE;
        brush->detail = 0.25f;
+       brush->smoothness = 0.5f;
 
        brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
        

Modified: branches/branch-farsthary/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/branch-farsthary/source/blender/blenloader/intern/readfile.c       
2010-06-01 19:48:55 UTC (rev 29141)
+++ branches/branch-farsthary/source/blender/blenloader/intern/readfile.c       
2010-06-01 19:54:05 UTC (rev 29142)
@@ -10772,9 +10772,14 @@
                
        }
        Brush *brush;
-       for (brush= main->brush.first; brush; brush= brush->id.next)
+       for (brush= main->brush.first; brush; brush= brush->id.next){
                if(brush->detail == 0.0f)
-                       brush->detail = 0.25f;
+                       brush->detail = 0.3f;
+               if (brush->smoothness == 0.0f)
+                       brush->smoothness = 0.5f;
+       
+       }
+               
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! 
*/
        /* WATCH IT 2!: Userdef struct init has to be in 
editors/interface/resources.c! */
 

Modified: branches/branch-farsthary/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/branch-farsthary/source/blender/editors/sculpt_paint/sculpt.c      
2010-06-01 19:48:55 UTC (rev 29141)
+++ branches/branch-farsthary/source/blender/editors/sculpt_paint/sculpt.c      
2010-06-01 19:54:05 UTC (rev 29142)
@@ -116,6 +116,7 @@
        float clip_tolerance[3];
        float initial_mouse[2];
        float detail;
+       float smoothness;
 
        /* Variants */
        float radius;
@@ -577,24 +578,24 @@
                        Object *obedit= ob;
                        Mesh *me= obedit->data;                 
                        EditEdge *eed;
+                       float detail = ss->cache->detail * ss->cache->radius;
+                       float smoothness = ss->cache->smoothness;
                         
                        for(eed = me->edit_mesh->edges.first; eed; eed = 
eed->next){
                                if (eed->f & SELECT)
                                {
                                        sub_v3_v3v3(diff, eed->v1->co, 
eed->v2->co);
-                                       edgeLength = len_v3(diff);
-                                       
-                                       float detail = ss->cache->detail * 
ss->cache->radius;  
+                                       edgeLength = len_v3(diff);              
                          
                                                                                
                                        
                                        if (edgeLength < detail)
                                                EM_select_edge(eed, 0); 
                                        else    
-                                               EM_select_edge(eed, 1);         
                                
+                                               EM_select_edge(eed, 1);         
        
                                
                                }                                               
                        
                                        
                        }                                                       
                
-                       esubdivideflag(obedit, me->edit_mesh, 
SELECT,0.4,0,B_SMOOTH,1, SUBDIV_CORNER_PATH, SUBDIV_SELECT_INNER);              
          
+                       esubdivideflag(obedit, me->edit_mesh, 
SELECT,smoothness,0,B_SMOOTH,1, SUBDIV_CORNER_PATH, SUBDIV_SELECT_INNER);       
          
                        
                        /* Clear selection */
                        for(eed = me->edit_mesh->edges.first; eed; eed = 
eed->next)
@@ -1768,7 +1769,10 @@
 
        cache->vc = vc;
        cache->brush = brush;
-       if (brush->flag & BRUSH_SUBDIV) cache->detail = brush->detail;
+       if (brush->flag & BRUSH_SUBDIV){
+               cache->detail = brush->detail;
+               cache->smoothness = brush->smoothness;
+       } 
 
        cache->mats = MEM_callocN(sizeof(bglMats), "sculpt bglMats");
        view3d_get_transformation(vc->ar, vc->rv3d, vc->obact, cache->mats);

Modified: branches/branch-farsthary/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/branch-farsthary/source/blender/makesdna/DNA_brush_types.h 
2010-06-01 19:48:55 UTC (rev 29141)
+++ branches/branch-farsthary/source/blender/makesdna/DNA_brush_types.h 
2010-06-01 19:54:05 UTC (rev 29142)
@@ -56,7 +56,8 @@
        
        short flag, blend;                      /* general purpose flag, blend 
mode */
        int size;                                       /* brush diameter */
-       float detail,pad;                       /* dynamic subdivission detail 
*/
+       float detail;                           /* dynamic subdivission detail 
*/
+       float smoothness;                       /* dynamic subdivission 
smoothness*/
        float jitter;                           /* jitter the position of the 
brush */
        float spacing;                          /* spacing of paint operations 
*/
        int smooth_stroke_radius;               /* turning radius (in pixels) 
for smooth stroke */

Modified: branches/branch-farsthary/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/branch-farsthary/source/blender/makesrna/intern/rna_brush.c        
2010-06-01 19:48:55 UTC (rev 29141)
+++ branches/branch-farsthary/source/blender/makesrna/intern/rna_brush.c        
2010-06-01 19:54:05 UTC (rev 29142)
@@ -172,6 +172,11 @@
        RNA_def_property_ui_text(prop, "Detail", "Dynamic subdivission detail");
        RNA_def_property_update(prop, 0, "rna_Brush_update");
        
+       prop= RNA_def_property(srna, "smoothness", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Smoothness", "Dynamic subdivission 
smoothness");
+       RNA_def_property_update(prop, 0, "rna_Brush_update");
+       
        prop= RNA_def_property(srna, "jitter", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "jitter");
        RNA_def_property_range(prop, 0.0f, 1.0f);


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to