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 ()
objact=bpy.context.active_object
print ('Active object = =',objact )
myMesh = objact.data
print ('data =',myMesh )
print (' myMesh.vert sel =',myMesh.total_vert_sel)
print ()
print ()
print (' #### Edges #### ')
print ()
loc=0
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 ()
fa=0
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)
vv1=myMesh.verts[j].co
# print ('vv1=',vv1[0],'Y=',vv1[1],'Z=',vv1[2])
# dist = sqrt(pow(vv1[0],2))
# print ('dist=',dist)
print()
for k1 in range(0,len(i.verts)):
vv2=myMesh.verts[k1].co
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)
print()
# bpy.ops.mesh.quads_convert_to_tris() # Operators
fa+=1
"""
dist = math.sqrt(math.pow(v.co[0]-a.co[0],2)+math.pow(v.co[1]-a.co[1],2)+math.pow(v.co[2]-a.co[2],2))
if dist > res:
v.sel = a.sel = 1
"""
bpy.types.Scene.StringProperty(name="file path", # Define Text Input field
attr="custompath",
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")
maintain_resolution(.1,5)
return{'FINISHED'}
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")
maintain_resolution(.1,5)
return{'FINISHED'}
def register():
bpy.types.register(VIEW3D_PT_CustomMenuPanel)
bpy.types.register(OBJECT_OT_CustomButton)
bpy.types.register(OBJECT_OT_CustomButton1)
def unregister():
bpy.types.unregister(VIEW3D_PT_CustomMenuPanel)
bpy.types.unregister(OBJECT_OT_CustomButton)
bpy.types.unregister(OBJECT_OT_CustomButton1)
if __name__ == "__main__":
register()
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