my attempt at an 'unlimited clay' script

Lately I have been working on a script to subdivide a mesh only where it is needed, this could in turn be used as a suppliment to the sculpt tools in blender to allow for a largely quad dominant mesh that would update itself as you sculpted it.
NOTE** to use the script you must have the mesh in vertex select mode, and not be in edit mode.

as you can see in the links below, the majority of the faces are indeed quads, as opposed to triangles

and here is the script:

can ou make a short video to show how this is used < 3 Minutes
just to gie us an idea how to work with it !

Thanks and happy 2.5

and is it available in 2.5?

the script currently does not support 2.5, I still need to work out some issues with its integration with the blender tools (ie: so that the script will automatically update after each stroke in sculpt mode, and that it will only reference vertices effected by the brush) with the help of the blender community before I start working on getting it into an addon form :slight_smile:
as for the video, its uploading to youtube right now, I will post a link when it finishes

ok, and here, is a brief video of myself using the script in 2.49

don’t know how you can subdivide locally but it’s a good feature

hope you an make in 2.5 soon

can be very usefull!

did you see the Farharthey version for unlimited clay ?

keep up the good work

i tested it in 2.49 and works fine
very nice to subdivide localy

can this work with other type of brush - now it’s one type = inflate
but can it work with smooth pinch ect. ?

happy 2.5

well there are a couple of things I wanted to add in but they are limited by what I can do with the scripts. For example, I would like to make it so that the script updates each time you complete a stroke, and only references the verts that were moved by the brush. Do you have any idea how I can do that?

would be easier to do in 2.5

each time you change a var it should update the display !

i;ll ahve a look in sccript and see if hard to convert to 2.5

but might het help from IRC channel too

happy 2.5

here is the beginning of the ported script in 2.5 working in version 31197
and it is not an addons!

1- This add a new panel at bottom of the tool panel

Still need to add one or 2 properties for res

complete the subdivide and smooth function for the script

ti finalize this this panel

2 - Get some help to get the Selected vertices from the brush instead
might be much faster !

3 - Ideally would be nice to have all this in the operators’ pane instead of the too panel
easier to find and work with

so here is the script with some debugging lines you can read on the console

import bpy
import mathutils
from math import *
from bpy.props import *
def maintain_resolution(res,smooth,mesh=0):
    print ()
    print ('Active object =  =',objact )
    myMesh =
    print ('data  =',myMesh )
    print (' myMesh.vert sel  =',myMesh.total_vert_sel)
    print ()
    print ()
    print (' #### Edges    ####  ')
    print ()
    for ed in myMesh.edges:
#        if ed.selected or not bpy.context.scene.display_sel_only:
        v1, v2 = ed.verts
        print (' ed verts index =',ed.verts[0],'index =',ed.verts[1],'    v1=',v1,'v2=',v2)
        v3 = myMesh.verts[v1].co
        v4 = myMesh.verts[v2].co
        print ('v3=',v3,'v4=',v4)
    print ()
    print (' ####   Faces    ####  ')
    print ()
    for i in myMesh.faces:
        print('F=',fa,'Face verts =',i.verts[:],' Face.area = ', i.area,' qty Verts/ Face =',len(i.verts))
        for j in range(0,len(i.verts)):                            # List vertices  indices / Face
#            print('vert[',j,']=',i.verts[j],' Co =',myMesh.verts[j].co)
#            print ('j=',j,'Co =',myMesh.verts[j].co)
#            print ('vv1=',vv1[0],'Y=',vv1[1],'Z=',vv1[2])
#            dist = sqrt(pow(vv1[0],2))
#            print ('dist=',dist)
            for k1 in range(0,len(i.verts)):
                print(' vv2 = vert[',k1,']=',i.verts[k1],' Co =',myMesh.verts[k1].co)
                dist1 = sqrt(pow(vv1[0]-vv2[0],2)+pow(vv1[1]-vv2[1],2)+pow(vv1[2]-vv2[2],2))
                print ('Dist =',dist1)
#    bpy.ops.mesh.quads_convert_to_tris()                 #    Operators
                    dist = math.sqrt(math.pow([0][0],2)+math.pow([1][1],2)+math.pow([2][2],2))
                    if dist &gt; res:
                        v.sel = a.sel = 1
bpy.types.Scene.StringProperty(name="file path",            # Define Text  Input   field
    description="simple file path",
    maxlen= 1024,
    default= "")
class VIEW3D_PT_CustomMenuPanel(bpy.types.Panel):          # Define the New Panel
    bl_space_type = "VIEW_3D"
    bl_region_type = "TOOLS"
    bl_label = "Subdivide Local"
    def draw(self, context):
        layout = self.layout
        layout.label(text="custom text")                    # Add a new Text field on one line
        layout.label(text="Clay Local")                        # Add a new Text field on one line
        layout.operator("object.CustomButton")                # Add a new Label field on one line
        layout.label(text="Resolution")                        # Add a new Text field on one line
        layout.operator("object.CustomButton1")                # Add a new Label field on one line
class OBJECT_OT_CustomButton(bpy.types.Operator):        # Define First new button in  New Panel
    bl_idname = "OBJECT_OT_CustomButton"
    bl_label = "Subdivide Clay Local"
    __doc__ = "Subdivide  Clay Local"
    def invoke(self, context, event):
        print("Execute Clay Local")
class OBJECT_OT_CustomButton1(bpy.types.Operator):        # Define First new button in  New Panel
    bl_idname = "OBJECT_OT_CustomButton1"
    bl_label = "Clay Resolution"
    __doc__ = "Clay Resol"
    def invoke(self, context, event):
        print("Execute Clay Local")
def register():
def unregister():
if __name__ == "__main__":

might be able to get some helps at IRC python

Thanks and let us know how it goes
would definitively be nice to see this work in 2.5

You should contact Raul to share information about this method, maybe together can solve the individual problems that both of you has.

I already PM him but waiting for an answer

would be nice to hear form him!

don’t know what happenign with his Clay built!

i think it was put on hold till we get more tools in 2.5

happy 2.5

Thanks ricky for all your help, I definitely will keep you updated, well, I think the first thing I want to do is get the script to only check verts effected by the brush, then I will work on getting it to work automatically with each stroke :slight_smile: yet again thank you ricky :smiley: well I guess im off to the IRC to look for more answers

i’ll try to add the 2 variables in new panel
as soon as i find how to do it i’ll get back

but good idea for IRC
you migth get some help to get the list of vertices used by the brush

let us know how it goes

it will be an interesting script to locally subdivide and be able to use the brush in sculpt mode

happy 2.5