[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2586] branches/geodesic_domes/gui_pkhg .py: error messages for not implemented case by ApplySform
Peter K.H. Gragert
pkhgragert at gmail.com
Sat Nov 5 10:25:31 CET 2011
Revision: 2586
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2586
Author: pkhg
Date: 2011-11-05 09:25:30 +0000 (Sat, 05 Nov 2011)
Log Message:
-----------
error messages for not implemented case by ApplySform
Modified Paths:
--------------
branches/geodesic_domes/gui_pkhg.py
Modified: branches/geodesic_domes/gui_pkhg.py
===================================================================
--- branches/geodesic_domes/gui_pkhg.py 2011-11-04 10:34:18 UTC (rev 2585)
+++ branches/geodesic_domes/gui_pkhg.py 2011-11-05 09:25:30 UTC (rev 2586)
@@ -11,8 +11,9 @@
#globals
created_vefm_mesh_values = None
+last_generated_object = None
##for Hub
-bpy.types.Scene.make_a_hub = BoolProperty(name = "Make a hub?", description = "make a strut out of an selected mesh", default = False)
+bpy.types.Scene.make_a_hub = BoolProperty(name = "HUB?", description = "make a HUB out of an selected mesh", default = False)
bpy.types.Scene.hub_width = FloatProperty(name = "width", min = 0.001,max = 2, description="TODO", default = 1)
bpy.types.Scene.hub_height = FloatProperty(name = "height", min = 0.001,max = 2, description="TODO", default = 1)
bpy.types.Scene.hub_length = FloatProperty(name = "length", min = 0.001,max = 2, description="TODO", default = 1)
@@ -22,7 +23,7 @@
## for Strut
-bpy.types.Scene.make_a_strut = BoolProperty(name = "Make a strut?", description = "make a strut out of an selected mesh", default = False)
+bpy.types.Scene.make_a_strut = BoolProperty(name = "STUT?", description = "make a STRUT out of an selected mesh", default = False)
bpy.types.Scene.max_number_parts = IntProperty(name = "Max nr parts",min=0,max = 1000, description = "Maximum number of v,e,f", default = 100)
bpy.types.Scene.struttype = BoolProperty(name="Type", description = "False: nothing done", default = True)
bpy.types.Scene.width = FloatProperty(name = "width", min = 0.001,max = 2, description="TODO", default = 0.5)
@@ -264,7 +265,7 @@
row = layout.row()
row.operator(ApplySform.bl_idname,"Apply superform")
elif tmp == 'Your mesh':
- col.label("\n**INFO*** YOUR MESH not yet implemented")
+ col.label("***INFO*** YOUR MESH not yet implemented")
else:
col.label(text="Select one")
col.label(text="object to generate")
@@ -751,8 +752,8 @@
bl_label = "superf (u en v type) parameters"
bl_options = {'REGISTER','UNDO'}
uact = BoolProperty(name = 'sup u-active',default = True)
- um = FloatProperty(name = 'u m', min = 0, soft_min = 1, soft_max=5,max = 10, default = 3, description="frequency cos(m*...)")
- un1 = FloatProperty(name = 'u n1', min = 0, soft_min=0.1, soft_max=5,max = 20, default = 1, description = "u active" )
+ um = FloatProperty(name = 'u m', min = 0, soft_min = 1, soft_max=5,max = 10, default = 1, description="frequency cos(m*...)")
+ un1 = FloatProperty(name = 'u n1', min = 0, soft_min=0.1, soft_max=5,max = 20, default = 0.5, description = "u active" )
un2 = FloatProperty(name = 'u n2', min = 0, soft_min=0.1, soft_max=5,max = 10, default = 1, description = "if u active")
un3 = FloatProperty(name = 'u n3', min = 0, soft_min=0.1, soft_max=5,max = 10, default = 1, description = "if u active")
ua = FloatProperty(name = 'u a', min = 0, soft_min=0.1, soft_max=5,max = 10, default = 1, description = "if u active")
@@ -805,12 +806,17 @@
row.prop(self,'vturn')
row.prop(self,'vtwist')
col = layout.column()
+
+ #ApplySform
def execute(self,context):
global last_generated_object, last_sform_parameters, created_vefm_mesh_values
superformparam = [self.um,self.un1,self.un2,self.un3,self.ua,self.ub,self.vm,self.vn1,self.vn2,self.vn3,self.va,self.vb,self.uact,self.vact,self.uturn*pi,self.vturn*(pi),self.utwist,self.vtwist]
object = None
- what_is_it = str(type(last_generated_object)).split('.')[-1].split("'")[0]
- print("\n>>>>>>>>>>>>> dbg what_is_it =",what_is_it,"\n","created_vefm_mesh_values=", created_vefm_mesh_values)
+ if last_generated_object:
+ what_is_it = str(type(last_generated_object)).split('.')[-1].split("'")[0]
+ else:
+ what_is_it = "no geodesic object generate"
+#PKHG_DBG print("\n>>>>>>>>>>>>> dbg what_is_it =",what_is_it,"\n","created_vefm_mesh_values=", created_vefm_mesh_values)
if created_vefm_mesh_values:
tmp = created_vefm_mesh_values
if tmp[0] == 'Torus':
@@ -823,44 +829,14 @@
object = forms_259.parabola(tmp[1],tmp[2],tmp[3],tmp[4],tmp[5],tmp[6],tmp[7],tmp[8],tmp[9],tmp[10],tmp[11],tmp[12],superformparam)
elif tmp[0] == "Grid":
object = forms_259.grid(tmp[1],tmp[2],tmp[3],tmp[4],1.0,1.0,0,0,0,0,1.0,1.0,superformparam)
- elif type(tmp[0]) == type([]):
- #object = None
- #print("\n***INFO*** Geodesics not yet")
- #'''
- what_type = tmp[0][1]
- print("\n make this",what_type)
- parameters = [el for el in tmp[1][0:-1]]
- print("\ndbg parameters =", parameters)
- parameters.append(superformparam)
- print("\ndbg parameters =", parameters)
- if what_type == 'tetrahedron':
- object = geodesic_classes_259.tetrahedron(parameters)
- object.config()
- object.connectivity()
- print("theindices")
- tmp = [el.index for el in object.verts]
- print("\n***DBG*** vextex indices faces",tmp)
- f = [[v.index for v in face.vertices] for face in object.faces]
- for li in f : print(li)
- vefm_259.vefm_add_object(object)
- #check_contains(object,"tetr config ahedron",True)
- created_object = bpy.context.active_object
- created_object.location = (0,0,0)
- bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN', center='MEDIAN')
-
- else:
- object = None
- #object.config()
- #object.connectivity()
-# check_contains(object,"tetrahedron",True)
- # vefm_259.vefm_add_object(object)
-
- #last_generated_object = object
- #'''
+# elif type(tmp[0]) == type([]):
+ elif tmp[0] == 'Geodesic':
+ self.report(set(['ERROR']), "not yet implemented")
else:
- print("\n***TODO*** rest of objects")
+ print("\n***TODO*** rest of objects????")
+ self.report(set(['ERROR']), "not implemented")
object = None
- if object and not(type(tmp[0]) == type([])) :
+ if object: # and not(type(tmp[0]) == type([])) :
last_generated_object = object
vefm_259.vefm_add_object(object)
created_object = bpy.context.active_object
@@ -868,7 +844,9 @@
bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN', center='MEDIAN')
else:
- print("\n***ERROR*** first create an torus, sphere, cylinder, parabola, or grid")
+ print("\n***ERROR*** first create an Torus, Sphere, Cylinder, Parabola, or Grid")
+ self.report(set(['ERROR']), "first create an Torus, Sphere, Cylinder, Parabola, or Grid")
+
return {'FINISHED'}
###PKHG help for debugging
@@ -966,8 +944,6 @@
else:
res = False
return res
-
-
def execute(self,context):
objlist = [obj.name for obj in bpy.data.objects]
@@ -991,3 +967,22 @@
message = "make a mesh with name: hub_to_use"
self.report(set(['ERROR']),message)
return {'FINISHED'}
+
+class AddYourMesh(bpy.types.Operator):
+ bl_idname = "mesh.make_your_mesh"
+ bl_label = "Your mesh"
+ bl_options = {'REGISTER','UNDO'}
+
+ @classmethod
+ def poll(cls,context):
+ res = context.active_object and context.active_object.type == 'MESH'
+ return res
+
+ def execute(self,context):
+ global last_generated_object
+ name = context.active_object.name
+ your_obj = vefm_259.importmesh(name,True)
+ vefm_259.vefm_add_object(your_obj)
+ last_generated_object = bpy.context.active_object
+ bpy.context.active_object.location = (0,0,0)
+ return {'FINISHED'}
More information about the Bf-extensions-cvs
mailing list