Increased some of the defaults- very small brush sizes could make verts NAN location.
[blender.git] / release / scripts / bpydata / mesh_bbrush.py
index a3c78facc40c7907d5b1dd0cdec69e45783cf6d5..eac576b2e28a7540b0872b1feea470b817dafed0 100644 (file)
@@ -133,9 +133,8 @@ getPickRay.ortho_d = Vector(0,0,0,0) # ortho only 4d
 
 
 def ui_set_preferences(user_interface=1):
-       
        # Create data and set defaults.
-       ADAPTIVE_GEOMETRY_but = Draw.Create(1)
+       ADAPTIVE_GEOMETRY_but = Draw.Create(0)
        BRUSH_MODE_but = Draw.Create(1)
        BRUSH_PRESSURE_but = Draw.Create(0.05)
        BRUSH_RADIUS_but = Draw.Create(0.25)
@@ -166,8 +165,8 @@ def ui_set_preferences(user_interface=1):
                'Brush Options',\
                ('Adaptive Geometry', ADAPTIVE_GEOMETRY_but, 'Add and remove detail as needed. Uses min/max resolution.'),\
                ('Brush Type: ', BRUSH_MODE_but, 1, 5, 'Push/Pull:1, Grow/Shrink:2, Spin:3, Relax:4, Goo:5'),\
-               ('Pressure: ', BRUSH_PRESSURE_but, 0.0, 1.0, 'Pressure of the brush.'),\
-               ('Size: ', BRUSH_RADIUS_but, 0.0, 2.0, 'Size of the brush.'),\
+               ('Pressure: ', BRUSH_PRESSURE_but, 0.01, 1.0, 'Pressure of the brush.'),\
+               ('Size: ', BRUSH_RADIUS_but, 0.02, 2.0, 'Size of the brush.'),\
                ('Geometry Res: ', RESOLUTION_MIN_but, 0.01, 0.5, 'Size of the brush & Adaptive Subdivision.'),\
                ('Displace Vector: ', DISPLACE_NORMAL_MODE_but, 1, 4, 'Vertex Normal:1, Median Normal:2, Face Normal:3, View Normal:4'),\
                ('Static Normal', STATIC_NORMAL_but, 'Use the initial normal only.'),\
@@ -411,11 +410,22 @@ def event_main():
                        #ed.flag &= ~SEL_FLAG # deselect. 34
                        ed.flag = 32
                '''
-               filter(lambda ed: setattr(ed, 'flag', 32), me.edges)
+               #filter(lambda ed: setattr(ed, 'flag', 32), me.edges)
                
                '''for v in me.verts:
                        v.sel = 0'''
-               filter(lambda v: setattr(v, 'sel', 0), me.verts)
+               #filter(lambda v: setattr(v, 'sel', 0), me.verts)
+               # DESELECT ABSOLUTLY ALL
+               Mesh.Mode(Mesh.SelectModes['FACE'])
+               filter(lambda f: setattr(f, 'sel', 0), me.faces)
+               
+               Mesh.Mode(Mesh.SelectModes['EDGE'])
+               filter(lambda ed: setattr(ed, 'flag', 32), me.edges)
+               
+               Mesh.Mode(Mesh.SelectModes['VERTEX'])
+               filter(lambda v: setattr(v, 'sel', 0), me.verts)                
+               
+               Mesh.Mode(Mesh.SelectModes['EDGE'])
                
        i = 0
        time = Blender.sys.time()
@@ -809,7 +819,8 @@ def event_main():
                                                        
                                        if EDGE_COUNT:
                                                me.subdivide(1)
-                                       
+                                               me = ob.getData(mesh=1)
+                                               filter(lambda ed: setattr(ed, 'flag', 32), me.edges)
                                                        
                                        # Deselect all, we know theres only 2 selected
                                        '''
@@ -887,13 +898,17 @@ def event_main():
        if FIX_TOPOLOGY:
                fix_topolagy(me)
        
-       Mesh.Mode(Mesh.SelectModes['VERTEX'])
-       filter(lambda v: setattr(v, 'sel', 1), me.verts)
-       me.remDoubles(0.001)
-       print 'removing doubles'
-       me = ob.getData(mesh=1) # Get new vert data
-       Blender.event = Draw.LEFTMOUSE
+       # Remove short edges of we have edaptive geometry enabled.
+       if ADAPTIVE_GEOMETRY:
+               Mesh.Mode(Mesh.SelectModes['VERTEX'])
+               filter(lambda v: setattr(v, 'sel', 1), me.verts)
+               me.remDoubles(0.001)
+               print 'removing doubles'
+               me = ob.getData(mesh=1) # Get new vert data
+               Blender.event = Draw.LEFTMOUSE
+
        Mesh.Mode(Mesh.SelectModes['EDGE'])
+       
        if i:
                Window.EditMode(1)
                if not is_editmode: # User was in edit mode, so stay there.