[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2121] trunk/py/scripts/addons/ add_curve_sapling: SVN maintenance.
gsr b3d
gsr.b3d at infernal-iceberg.com
Tue Jul 12 02:33:02 CEST 2011
Revision: 2121
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2121
Author: gsrb3d
Date: 2011-07-12 00:33:00 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
SVN maintenance.
Modified Paths:
--------------
trunk/py/scripts/addons/add_curve_sapling/__init__.py
trunk/py/scripts/addons/add_curve_sapling/presets/black_tupelo.py
trunk/py/scripts/addons/add_curve_sapling/presets/ca_black_oak.py
trunk/py/scripts/addons/add_curve_sapling/presets/quaking_aspen.py
trunk/py/scripts/addons/add_curve_sapling/presets/weeping_willow.py
trunk/py/scripts/addons/add_curve_sapling/utils.py
Property Changed:
----------------
trunk/py/scripts/addons/add_curve_sapling/__init__.py
trunk/py/scripts/addons/add_curve_sapling/presets/black_tupelo.py
trunk/py/scripts/addons/add_curve_sapling/presets/ca_black_oak.py
trunk/py/scripts/addons/add_curve_sapling/presets/quaking_aspen.py
trunk/py/scripts/addons/add_curve_sapling/presets/weeping_willow.py
trunk/py/scripts/addons/add_curve_sapling/utils.py
Modified: trunk/py/scripts/addons/add_curve_sapling/__init__.py
===================================================================
--- trunk/py/scripts/addons/add_curve_sapling/__init__.py 2011-07-11 10:30:32 UTC (rev 2120)
+++ trunk/py/scripts/addons/add_curve_sapling/__init__.py 2011-07-12 00:33:00 UTC (rev 2121)
@@ -1,589 +1,589 @@
-#====================== BEGIN GPL LICENSE BLOCK ======================
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-#======================= END GPL LICENSE BLOCK ========================
-
-bl_info = {
- "name": "Sapling",
- "author": "Andrew Hale (TrumanBlending)",
- "version": (0, 2, 3),
- "blender": (2, 5, 8),
- "api": 38289,
- "location": "View3D > Add > Curve",
- "description": ("Adds a parametric tree. The method is presented by "
- "Jason Weber & Joseph Penn in their paper 'Creation and Rendering of "
- "Realistic Trees'."),
- "warning": "", # used for warning icon and text in addons panel
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
- "Scripts/Curve/Sapling_Tree",
- "tracker_url": "http://projects.blender.org/tracker/index.php?"\
- "func=detail&aid=27226&group_id=153&atid=468",
- "category": "Add Curve"}
-
-if "bpy" in locals():
- import imp
- imp.reload(utils)
-else:
- from add_curve_sapling import utils
-
-import bpy
-import time
-import os
-
-#from utils import *
-from mathutils import *
-from math import pi, sin, degrees, radians, atan2, copysign
-from random import random, uniform, seed, choice, getstate, setstate
-from bpy.props import *
-
-from add_curve_sapling.utils import *
-
-#global splitError
-useSet = False
-
-shapeList = [('0', 'Conical (0)', 'Shape = 0'),
- ('1', 'Spherical (1)', 'Shape = 1'),
- ('2', 'Hemispherical (2)', 'Shape = 2'),
- ('3', 'Cylindrical (3)', 'Shape = 3'),
- ('4', 'Tapered Cylindrical (4)', 'Shape = 4'),
- ('5', 'Flame (5)', 'Shape = 5'),
- ('6', 'Inverse Conical (6)', 'Shape = 6'),
- ('7', 'Tend Flame (7)', 'Shape = 7')]
-
-handleList = [('0', 'Auto', 'Auto'),
- ('1', 'Vector', 'Vector')]
-
-settings = [('0', 'Geometry', 'Geometry'),
- ('1', 'Branch Splitting', 'Branch Splitting'),
- ('2', 'Branch Growth', 'Branch Growth'),
- ('3', 'Pruning', 'Pruning'),
- ('4', 'Leaves', 'Leaves'),
- ('5', 'Armature', 'Armature')]
-
-
-def getPresetpath():
- '''Support user defined scripts directory
- Find the first ocurrence of add_curve_sapling/presets in possible script paths
- and return it as preset path'''
- presetpath = ""
- for p in bpy.utils.script_paths():
- presetpath = os.path.join(p, 'addons', 'add_curve_sapling', 'presets')
- if os.path.exists(presetpath):
- break
- return presetpath
-
-
-class ExportData(bpy.types.Operator):
- '''This operator handles writing presets to file'''
- bl_idname = 'sapling.exportdata'
- bl_label = 'Export Preset'
-
- data = StringProperty()
-
- def execute(self, context):
- # Unpack some data from the input
- data, filename = eval(self.data)
- try:
- # Check whether the file exists by trying to open it.
- f = open(os.path.join(getPresetpath(), filename + '.py'), 'r')
- f.close()
- # If it exists then report an error
- self.report({'ERROR_INVALID_INPUT'}, 'Preset Already Exists')
- return {'CANCELLED'}
- except IOError:
- if data:
- # If it doesn't exist, create the file with the required data
- f = open(os.path.join(getPresetpath(), filename + '.py'), 'w')
- f.write(data)
- f.close()
- return {'FINISHED'}
- else:
- return {'CANCELLED'}
-
-
-class ImportData(bpy.types.Operator):
- '''This operator handles importing existing presets'''
- bl_idname = 'sapling.importdata'
- bl_label = 'Import Preset'
-
- filename = StringProperty()
-
- def execute(self, context):
- # Make sure the operator knows about the global variables
- global settings, useSet
- # Read the preset data into the global settings
- f = open(os.path.join(getPresetpath(), self.filename), 'r')
- settings = f.readline()
- f.close()
- #print(settings)
- settings = eval(settings)
- # Set the flag to use the settings
- useSet = True
- return {'FINISHED'}
-
-
-class PresetMenu(bpy.types.Menu):
- '''Create the preset menu by finding all preset files
- in the preset directory
- '''
- bl_idname = "sapling.presetmenu"
- bl_label = "Presets"
-
- def draw(self, context):
- # Get all the sapling presets
- presets = [a for a in os.listdir(getPresetpath()) if a[-3:] == '.py']
- layout = self.layout
- # Append all to the menu
- for p in presets:
- layout.operator("sapling.importdata", text=p[:-3]).filename = p
-
-
-class AddTree(bpy.types.Operator):
- bl_idname = "curve.tree_add"
- bl_label = "Sapling"
- bl_options = {'REGISTER', 'UNDO'}
-
- chooseSet = EnumProperty(name='Settings',
- description='Choose the settings to modify',
- items=settings,
- default='0')
- bevel = BoolProperty(name='Bevel',
- description='Whether the curve is bevelled',
- default=False)
- prune = BoolProperty(name='Prune',
- description='Whether the tree is pruned',
- default=False)
- showLeaves = BoolProperty(name='Show Leaves',
- description='Whether the leaves are shown',
- default=False)
- useArm = BoolProperty(name='Use Armature',
- description='Whether the armature is generated',
- default=False)
- seed = IntProperty(name='Random Seed',
- description='The seed of the random number generator',
- default=0)
- handleType = IntProperty(name='Handle Type',
- description='The type of curve handles',
- min=0,
- max=1,
- default=0)
- levels = IntProperty(name='Levels',
- description='Number of recursive branches (Levels)',
- min=1,
- max=6,
- default=3)
- length = FloatVectorProperty(name='Length',
- description='The relative lengths of each branch level (nLength)',
- min=0.0,
- default=[1, 0.3, 0.6, 0.45],
- size=4)
- lengthV = FloatVectorProperty(name='Length Variation',
- description='The relative length variations of each level (nLengthV)',
- min=0.0,
- default=[0, 0, 0, 0],
- size=4)
- branches = IntVectorProperty(name='Branches',
- description='The number of branches grown at each level (nBranches)',
- min=0,
- default=[50, 30, 10, 10],
- size=4)
- curveRes = IntVectorProperty(name='Curve Resolution',
- description='The number of segments on each branch (nCurveRes)',
- min=1,
- default=[3, 5, 3, 1],
- size=4)
- curve = FloatVectorProperty(name='Curvature',
- description='The angle of the end of the branch (nCurve)',
- default=[0, -40, -40, 0],
- size=4)
- curveV = FloatVectorProperty(name='Curvature Variation',
- description='Variation of the curvature (nCurveV)',
- default=[20, 50, 75, 0],
- size=4)
- curveBack = FloatVectorProperty(name='Back Curvature',
- description='Curvature for the second half of a branch (nCurveBack)',
- default=[0, 0, 0, 0],
- size=4)
- baseSplits = IntProperty(name='Base Splits',
- description='Number of trunk splits at its base (nBaseSplits)',
- min=0,
- default=0)
- segSplits = FloatVectorProperty(name='Segment Splits',
- description='Number of splits per segment (nSegSplits)',
- min=0,
- default=[0, 0, 0, 0],
- size=4)
- splitAngle = FloatVectorProperty(name='Split Angle',
- description='Angle of branch splitting (nSplitAngle)',
- default=[0, 0, 0, 0],
- size=4)
- splitAngleV = FloatVectorProperty(name='Split Angle Variation',
- description='Variation in the split angle (nSplitAngleV)',
- default=[0, 0, 0, 0],
- size=4)
- scale = FloatProperty(name='Scale',
- description='The tree scale (Scale)',
- min=0.0,
- default=13.0)
- scaleV = FloatProperty(name='Scale Variation',
- description='The variation in the tree scale (ScaleV)',
- default=3.0)
- attractUp = FloatProperty(name='Vertical Attraction',
- description='Branch upward attraction',
- default=0.0)
- shape = EnumProperty(name='Shape',
- description='The overall shape of the tree (Shape)',
- items=shapeList,
- default='7')
- baseSize = FloatProperty(name='Base Size',
- description='Fraction of tree height with no branches (BaseSize)',
- min=0.0,
- max=1.0,
- default=0.4)
- ratio = FloatProperty(name='Ratio',
- description='Base radius size (Ratio)',
- min=0.0,
- default=0.015)
- taper = FloatVectorProperty(name='Taper',
- description='The fraction of tapering on each branch (nTaper)',
- min=0.0,
- max=1.0,
- default=[1, 1, 1, 1],
- size=4)
- ratioPower = FloatProperty(name='Branch Radius Ratio',
- description=('Power which defines the radius of a branch compared to '
- 'the radius of the branch it grew from (RatioPower)'),
- min=0.0,
- default=1.2)
- downAngle = FloatVectorProperty(name='Down Angle',
- description=('The angle between a new branch and the one it grew '
- 'from (nDownAngle)'),
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list