[Durian-svn] [3785] move files into the operator directory
campbell
institute at blender.org
Mon May 24 15:18:13 CEST 2010
Revision: 3785
https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=3785
Author: campbell
Date: 2010-05-24 15:18:13 +0200 (Mon, 24 May 2010)
Log Message:
-----------
move files into the operator directory
Modified Paths:
--------------
pro/scripts/utilities/batch_ogl.py
Added Paths:
-----------
pro/scripts/op/add_mesh_random_block.py
pro/scripts/op/lamp_autobuffer.py
pro/scripts/op/marker_camera_namer.py
pro/scripts/op/marker_render.py
pro/scripts/op/mesh_skin.py
pro/scripts/op/object_library_load.py
Removed Paths:
-------------
pro/scripts/ui/add_mesh_random_block.py
pro/scripts/ui/lamp_autobuffer.py
pro/scripts/ui/marker_camera_namer.py
pro/scripts/ui/marker_render.py
pro/scripts/ui/mesh_skin.py
pro/scripts/ui/object_library_load.py
Copied: pro/scripts/op/add_mesh_random_block.py (from rev 3758, pro/scripts/ui/add_mesh_random_block.py)
===================================================================
--- pro/scripts/op/add_mesh_random_block.py (rev 0)
+++ pro/scripts/op/add_mesh_random_block.py 2010-05-24 13:18:13 UTC (rev 3785)
@@ -0,0 +1,250 @@
+import bpy
+import random
+import mathutils
+
+def random_low_high(mean, upper, lower):
+ upper += lower
+ return random.random()*upper-lower+mean
+
+def add_random_block(hei_mean, hei_up, hei_lo, wid_mean, wid_up, wid_lo, len_mean, len_up, len_lo, vert_nois, vert_cou, hori_cou, wid_cou, hori_gap, vert_gap, wid_gap):
+ Vector = mathutils.Vector
+ verts = []
+ faces = []
+ hei_sum=0
+ len_sum=0
+ wid_sum=0
+ block_count=0
+ for vertical_counter in range(vert_cou):
+ hei=random_low_high(hei_mean/2, hei_up/2, hei_lo/2)
+ hei_sum -= hei/2
+ for horizontal_count in range(hori_cou):
+ len=random_low_high(len_mean/2, len_up/2, len_lo/2)
+ if horizontal_count==0:
+ a=random_low_high(0, len_mean/8, len_mean/8)
+ len_sum -= len/2+a
+ else: len_sum -= len/2
+ for width_counter in range(wid_cou):
+ wid=random_low_high(wid_mean/2, wid_up/2, wid_lo/2)
+ wid_sum -= wid/2
+ #1
+ vec = Vector(len_sum-len/2, wid_sum-wid/2+random_low_high(0, vert_nois, vert_nois), hei_sum-hei/2)
+ verts.extend([vec.x,vec.y,vec.z])
+ #2
+ vec = Vector(len_sum+len/2, wid_sum-wid/2+random_low_high(0, vert_nois, vert_nois), hei_sum-hei/2)
+ verts.extend([vec.x,vec.y,vec.z])
+ #3
+ vec = Vector(len_sum+len/2, wid_sum+wid/2+random_low_high(0, vert_nois, vert_nois), hei_sum-hei/2)
+ verts.extend([vec.x,vec.y,vec.z])
+ #4
+ vec = Vector(len_sum-len/2, wid_sum+wid/2+random_low_high(0, vert_nois, vert_nois), hei_sum-hei/2)
+ verts.extend([vec.x,vec.y,vec.z])
+ #5
+ vec = Vector(len_sum-len/2, wid_sum+wid/2+random_low_high(0, vert_nois, vert_nois), hei_sum+hei/2)
+ verts.extend([vec.x,vec.y,vec.z])
+ #6
+ vec = Vector(len_sum+len/2, wid_sum+wid/2+random_low_high(0, vert_nois, vert_nois), hei_sum+hei/2)
+ verts.extend([vec.x,vec.y,vec.z])
+ #7
+ vec = Vector(len_sum+len/2, wid_sum-wid/2+random_low_high(0, vert_nois, vert_nois), hei_sum+hei/2)
+ verts.extend([vec.x,vec.y,vec.z])
+ #8
+ vec = Vector(len_sum-len/2, wid_sum-wid/2+random_low_high(0, vert_nois, vert_nois), hei_sum+hei/2)
+ verts.extend([vec.x,vec.y,vec.z])
+ faces.extend([0+block_count,1+block_count,2+block_count,3+block_count])
+ faces.extend([3+block_count,4+block_count,5+block_count,2+block_count])
+ faces.extend([4+block_count,5+block_count,6+block_count,7+block_count])
+ faces.extend([0+block_count,1+block_count,6+block_count,7+block_count])
+ faces.extend([0+block_count,3+block_count,4+block_count,7+block_count])
+ faces.extend([1+block_count,2+block_count,5+block_count,6+block_count])
+ block_count=block_count+8
+ wid_sum -= wid/2+wid_gap
+ wid_sum=0
+ len_sum -= len/2+hori_gap
+ len_sum = 0
+ hei_sum -= hei/2+vert_gap
+ return verts, faces
+
+from bpy.props import *
+
+class AddRandomBlock(bpy.types.Operator):
+ '''Add a block of random dimensions.'''
+ bl_idname = "mesh.primitive_random_block_add"
+ bl_label = "Random Block"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ presets = EnumProperty(items = [("wall","Walls","good for walls"), ("plank", "Planks", "good for planks"), ("shingle", "shingle", "good for shingles"), ("custom", "custom", "good for custom stuff")],
+ name="presets",
+ description="preset dropdown",
+ default = "wall")
+ height_mean = FloatProperty(name="height mean",
+ description="Number of segments for the main ring of the torus",
+ default=0.5, min=0.01, max=100.00)
+ height_upper = FloatProperty(name="height upper limit",
+ description="Number of segments for the minor ring of the torus",
+ default=0.0, min=0.0, max=100.0)
+ height_lower = FloatProperty(name="height lower limit",
+ description="Number of segments for the main ring of the torus",
+ default=0.1, min=0.0, max=100.00)
+ width_mean = FloatProperty(name="width mean",
+ description="Number of segments for the main ring of the torus",
+ default=0.3, min=0.01, max=100.00)
+ width_upper = FloatProperty(name="width upper limit",
+ description="Number of segments for the main ring of the torus",
+ default=0.04, min=0.0, max=100.00)
+ width_lower = FloatProperty(name="width lower limit",
+ description="Number of segments for the main ring of the torus",
+ default=0.0, min=0.0, max=100.00)
+ length_mean = FloatProperty(name="length mean",
+ description="Number of segments for the main ring of the torus",
+ default=1.0, min=0.01, max=100.00)
+ length_upper = FloatProperty(name="length upper limit",
+ description="Number of segments for the main ring of the torus",
+ default=0.3, min=0.0, max=100.00)
+ length_lower = FloatProperty(name="length lower limit",
+ description="Number of segments for the main ring of the torus",
+ default=0.4, min=0.0, max=100.00)
+ vertice_noise = FloatProperty(name="vertice noise",
+ description="Number of segments for the main ring of the torus",
+ default=0.005, min=0.0, max=100.00, precision=3, step=0.001)
+ vertical_count = IntProperty(name="vertical count",
+ description="Number of segments for the main ring of the torus",
+ default=2, min=1, max=256)
+ horizontal_count = IntProperty(name="horizontal count",
+ description="Number of segments for the main ring of the torus",
+ default=2, min=1, max=256)
+ width_count = IntProperty(name="width count",
+ description="Number of segments for the main ring of the torus",
+ default=1, min=1, max=256)
+ vertical_gap = FloatProperty(name="vertical gap",
+ description="Number of segments for the main ring of the torus",
+ default=0.001, min=0.000, max=100.00, precision=3, step=0.001)
+ horizontal_gap = FloatProperty(name="horizontal gap",
+ description="Number of segments for the main ring of the torus",
+ default=0.001, min=0.000, max=100.00, precision=3, step=0.001)
+ width_gap = FloatProperty(name="horizontal gap",
+ description="Number of segments for the main ring of the torus",
+ default=0.001, min=0.000, max=100.00, precision=3, step=0.001)
+
+ def execute(self, context):
+ #mesh = bpy.data.add_mesh("Random Block")
+ if self.properties.presets=="wall":
+ self.properties.height_mean=0.5
+ self.properties.height_upper=0.0
+ self.properties.height_lower=0.1
+ self.properties.width_mean=0.3
+ self.properties.width_upper=0.04
+ self.properties.width_lower=0.0
+ self.properties.length_mean=1.0
+ self.properties.length_upper=0.3
+ self.properties.length_lower=0.4
+ self.properties.vertice_noise=0.005
+ self.properties.vertical_count=2
+ self.properties.horizontal_count=2
+ self.properties.horizontal_count=1
+ self.properties.horizontal_gap=0.001
+ self.properties.vertical_gap=0.001
+ self.properties.vertical_gap=0.001
+ if self.properties.presets=="plank":
+ self.properties.height_mean=0.150000
+ self.properties.height_upper=0.060000
+ self.properties.height_lower=0.030000
+ self.properties.width_mean=0.070000
+ self.properties.width_upper=0
+ self.properties.width_lower=0.030000
+ self.properties.length_mean=1.360000
+ self.properties.length_upper=0.150000
+ self.properties.length_lower=0.400000
+ self.properties.vertice_noise=0.005
+ self.properties.vertical_count=10
+ self.properties.horizontal_count=1
+ self.properties.width_count=1
+ self.properties.horizontal_gap=0.1
+ self.properties.vertical_gap=0.1
+ self.properties.width_gap=0.1
+ if self.properties.presets=="shingle":
+ self.properties.height_mean=0.120000
+ self.properties.height_upper=0.000000
+ self.properties.height_lower=0.030000
+ self.properties.width_mean=0.02
+ self.properties.width_upper=0
+ self.properties.width_lower=0.0
+ self.properties.length_mean=0.16
+ self.properties.length_upper=0.000000
+ self.properties.length_lower=0.09
+ self.properties.vertice_noise=0.001390
+ self.properties.vertical_count=11
+ self.properties.horizontal_count=11
+ self.properties.width_count=1
+ self.properties.vertical_gap=0.00
+ self.properties.horizontal_gap=0.002
+ self.properties.width_gap=0.0
+ self.properties.presets="custom"
+ verts_loc, faces = add_random_block(self.properties.height_mean,
+ self.properties.height_upper,
+ self.properties.height_lower,
+ self.properties.width_mean,
+ self.properties.width_upper,
+ self.properties.width_lower,
+ self.properties.length_mean,
+ self.properties.length_upper,
+ self.properties.length_lower,
@@ Diff output truncated at 10240 characters. @@
More information about the Durian-svn
mailing list