[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3112] contrib/py/scripts/addons/btrace /bTrace.py: Added ability to trace object origin on mesh follow operator.

Scott Wood scott at thewooddesign.com
Wed Mar 14 23:23:27 CET 2012


Revision: 3112
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3112
Author:   crazycourier
Date:     2012-03-14 22:23:24 +0000 (Wed, 14 Mar 2012)
Log Message:
-----------
Added ability to trace object origin on mesh follow operator.
Add option to change material color.

Small UI changes, next update will probably contain a bigger UI overhaul and cleanup.

Modified Paths:
--------------
    contrib/py/scripts/addons/btrace/bTrace.py

Modified: contrib/py/scripts/addons/btrace/bTrace.py
===================================================================
--- contrib/py/scripts/addons/btrace/bTrace.py	2012-03-14 18:14:01 UTC (rev 3111)
+++ contrib/py/scripts/addons/btrace/bTrace.py	2012-03-14 22:23:24 UTC (rev 3112)
@@ -33,16 +33,17 @@
 ### [   ]  Add more options to curve radius/modulation plus cyclic/connect curve option
 
 import bpy, selection_utils
-from bpy.props import FloatProperty, EnumProperty, IntProperty, BoolProperty
+from bpy.props import FloatProperty, EnumProperty, IntProperty, BoolProperty, FloatVectorProperty
 
+
 # Class to define properties
 class TracerProperties(bpy.types.PropertyGroup):
     enabled = IntProperty(default=0)
     # Object Curve Settings
     curve_spline = EnumProperty(name="Spline", items=(("POLY", "Poly", "Use Poly spline type"),  ("NURBS", "Nurbs", "Use Nurbs spline type"), ("BEZIER", "Bezier", "Use Bezier spline type")), description="Choose which type of spline to use when curve is created", default="BEZIER")
     curve_handle = EnumProperty(name="Handle", items=(("ALIGNED", "Aligned", "Use Aligned Handle Type"), ("AUTOMATIC", "Automatic", "Use Auto Handle Type"), ("FREE_ALIGN", "Free Align", "Use Free Handle Type"), ("VECTOR", "Vector", "Use Vector Handle Type")), description="Choose which type of handle to use when curve is created",  default="VECTOR")
-    curve_resolution = IntProperty(name="Bevel Resolution" , min=1, max=32, default=4, description="Adjust the Bevel resolution")
-    curve_depth = FloatProperty(name="Bevel Depth", min=0.0, max=100.0, default=0.02, description="Adjust the Bevel depth")
+    curve_resolution = IntProperty(name="Bevel Resolution", min=1, max=32, default=4, description="Adjust the Bevel resolution")
+    curve_depth = FloatProperty(name="Bevel Depth", min=0.0, max=100.0, default=0.1, description="Adjust the Bevel depth")
     curve_u = IntProperty(name="Resolution U", min=0, max=64, default=12, description="Adjust the Surface resolution")
     curve_join = BoolProperty(name="Join Curves", default=False, description="Join all the curves after they have been created")
     curve_smooth = BoolProperty(name="Smooth", default=True, description="Render curve smooth")
@@ -51,11 +52,11 @@
     # Distort Mesh options
     distort_modscale = IntProperty(name="Modulation Scale", min=0, max=50, default=2, description="Add a scale to modulate the curve at random points, set to 0 to disable")
     distort_noise = FloatProperty(name="Mesh Noise", min=0.0, max=50.0, default=0.00, description="Adjust noise added to mesh before adding curve")
-    # Particle Options    
+    # Particle Options
     particle_step = IntProperty(name="Step Size", min=1, max=50, default=5, description="Sample one every this number of frames")
     particle_auto = BoolProperty(name='Auto Frame Range', default=True, description='Calculate Frame Range from particles life')
-    particle_f_start = IntProperty( name='Start Frame', min=1, max=5000, default=1, description='Start frame')
-    particle_f_end = IntProperty( name='End Frame', min=1, max=5000, default=250, description='End frame')
+    particle_f_start = IntProperty(name='Start Frame', min=1, max=5000, default=1, description='Start frame')
+    particle_f_end = IntProperty(name='End Frame', min=1, max=5000, default=250, description='End frame')
     # F-Curve Modifier Properties
     fcnoise_rot = BoolProperty(name="Rotation", default=False, description="Affect Rotation")
     fcnoise_loc = BoolProperty(name="Location", default=True, description="Affect Location")
@@ -93,32 +94,31 @@
     anim_length = IntProperty(name='Duration', min=1, soft_max=1000, max=2500, default=100, description='Animation Length')
     anim_f_fade = IntProperty(name='Fade After', min=0, soft_max=250, max=2500, default=10, description='Fade after this frames / Zero means no fade')
     anim_delay = IntProperty(name='Grow', min=0, max=50, default=5, description='Frames it takes a point to grow')
-    anim_tails = BoolProperty(name='Tails', default=True, description='Set radius to zero for open splines endpoints')
-    anim_keepr = BoolProperty(name='Radius', default=True, description='Try to keep radius data from original curve')
+    anim_tails = BoolProperty(name='Tails on endpoints', default=True, description='Set radius to zero for open splines endpoints')
+    anim_keepr = BoolProperty(name='Keep Radius', default=True, description='Try to keep radius data from original curve')
     animate = BoolProperty(name="Animate Result", default=False, description='Animate the final curve objects')
     # Convert to Curve options
     convert_conti = BoolProperty(name='Continuous', default=True, description='Create a continuous curve using verts from mesh')
     convert_everyedge = BoolProperty(name='Every Edge', default=False, description='Create a curve from all verts in a mesh')
-    convert_edgetype = EnumProperty(name="Edge Type for Curves", 
-        items=(("CONTI", "Continuous", "Create a continuous curve using verts from mesh"),  ("EDGEALL", "All Edges", "Create a curve from every edge in a mesh")), 
+    convert_edgetype = EnumProperty(name="Edge Type for Curves",
+        items=(("CONTI", "Continuous", "Create a continuous curve using verts from mesh"),  ("EDGEALL", "All Edges", "Create a curve from every edge in a mesh")),
         description="Choose which type of spline to use when curve is created", default="CONTI")
     convert_joinbefore = BoolProperty(name="Join objects before convert", default=False, description='Join all selected mesh to one object before converting to mesh')
     # Mesh Follow Options
-    fol_mesh_select = EnumProperty(name="Mesh type to spawn curves", 
-    items=(("VERTS", "Vertices", "Create the curve using verts from mesh"),  ("FACES", "Faces", "Create the curve using faces from mesh")), 
-    description="Choose which type of spline to use when curve is created", default="VERTS")
     fol_edge_select = BoolProperty(name='Edge', default=False, description='Grow from edges')
     fol_vert_select = BoolProperty(name='Vertex', default=False, description='Grow from verts')
     fol_face_select = BoolProperty(name='Face', default=True, description='Grow from faces')
     fol_mesh_type = EnumProperty(name='Mesh type', default='VERTS', description='Mesh feature to draw cruves from', items=(
-        ("VERTS", "Verts", ""), ("EDGES", "Edges", ""), ("FACES", "Faces", "")
-        ))
+        ("VERTS", "Verts", "Draw from Verts"), ("EDGES", "Edges", "Draw from Edges"), ("FACES", "Faces", "Draw from Faces"), ("OBJECT", "Object", "Draw from Object origin")))
     fol_start_frame = IntProperty(name="Start Frame", min=1, max=2500, default=1, description="Start frame for range to trace")
     fol_end_frame = IntProperty(name="End Frame", min=1, max=2500, default=250, description="End frame for range to trace")
     fol_perc_verts = FloatProperty(name="Reduce selection by", min=0.001, max=1.000, default=0.5, description="percentage of total verts to trace")
-    fol_sel_option = EnumProperty(name="Selection type", items=(("RANDOM", "Random", "Follow Random items"),  ("CUSTOM", "Custom", "Follow selected items"), ("ALL", "All", "Follow all items")), 
-    description="Choose which objects to follow", default="RANDOM")
+    fol_sel_option = EnumProperty(name="Selection type", description="Choose which objects to follow", default="RANDOM", items=(
+        ("RANDOM", "Random", "Follow Random items"),  ("CUSTOM", "Custom Select", "Follow selected items"), ("ALL", "All", "Follow all items")))
+    trace_mat_color = FloatVectorProperty(name="Material Color", description="Choose material color", min=0, max=1, default=(0.0,0.3,0.6), subtype="COLOR")
+    trace_mat_random = BoolProperty(name="Random Color", default=False, description='Make the material colors random')
 
+
 ############################
 ## Draw Brush panel in Toolbar
 ############################
@@ -141,14 +141,20 @@
         row.label(text="Universal Curve Settings")
         box = self.layout.box()
         row = box.row()
-        CurveSettingText="Show: Curve Settings"
+        CurveSettingText = "Show: Curve Settings"
         if curve_settings:
-            CurveSettingText="Hide: Curve Settings"
+            CurveSettingText = "Hide: Curve Settings"
         else:
-            CurveSettingText="Show: Curve Settings"
+            CurveSettingText = "Show: Curve Settings"
         row.prop(bTrace, 'curve_settings', icon='CURVE_BEZCURVE', text=CurveSettingText)
         if curve_settings:
             box.label(text="Curve Settings", icon="CURVE_BEZCURVE")
+            row = box.row()
+            row.label("Curve Material Color")
+            row = box.row()
+            row.prop(bTrace, "trace_mat_random")
+            if not bTrace.trace_mat_random:
+                row.prop(bTrace, "trace_mat_color", text="")
             if len(bpy.context.selected_objects) > 0:
                 if obj.type == 'CURVE':
                     col = box.column(align=True)
@@ -159,7 +165,7 @@
                     col.prop(obj.data, 'resolution_u')
                 else:
                     ############################
-                    ## Object Curve Settings 
+                    ## Object Curve Settings
                     ############################
                     curve_spline, curve_handle, curve_depth, curve_resolution, curve_u = bTrace.curve_spline, bTrace.curve_handle, bTrace.curve_depth, bTrace.curve_resolution, bTrace.curve_u
                     box.label(text="New Curve Settings")
@@ -169,7 +175,7 @@
                     col.prop(bTrace, "curve_depth")
                     col.prop(bTrace, "curve_resolution")
                     col.prop(bTrace, "curve_u")
-            
+
         ######################
         ## Start  Object Tools ###
         ######################
@@ -185,18 +191,18 @@
         ### Object Trace
         ############################
         box = self.layout.box()
-        row  = box.row ()
-        ObjectText="Show: Objects Trace"
+        row = box.row()
+        ObjectText = "Show: Objects Trace"
         if tool_objectTrace:
-            ObjectText="Hide: Objects Trace"
+            ObjectText = "Hide: Objects Trace"
         else:
-            ObjectText="Show: Objects Trace"
+            ObjectText = "Show: Objects Trace"

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list