[Bf-extensions-cvs] [9aa6c805] blender2.8: Port 'Sapling Tree Gen' addon to Blender 2.8
CansecoGPC
noreply at git.blender.org
Tue Dec 18 11:17:47 CET 2018
Commit: 9aa6c8058b32675b2636632d6735f66baf6300b1
Author: CansecoGPC
Date: Tue Dec 18 11:11:40 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBA9aa6c8058b32675b2636632d6735f66baf6300b1
Port 'Sapling Tree Gen' addon to Blender 2.8
Differential Revision: https://developer.blender.org/D4085
===================================================================
M add_curve_sapling/__init__.py
M add_curve_sapling/utils.py
===================================================================
diff --git a/add_curve_sapling/__init__.py b/add_curve_sapling/__init__.py
index a63e55c1..a657264a 100644
--- a/add_curve_sapling/__init__.py
+++ b/add_curve_sapling/__init__.py
@@ -19,9 +19,9 @@
bl_info = {
"name": "Sapling Tree Gen",
- "author": "Andrew Hale (TrumanBlending), Aaron Buchler",
- "version": (0, 3, 3),
- "blender": (2, 77, 0),
+ "author": "Andrew Hale (TrumanBlending), Aaron Buchler, CansecoGPC",
+ "version": (0, 3, 4),
+ "blender": (2, 80, 0),
"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 "
@@ -110,14 +110,7 @@ def getPresetpath():
"""Support user defined scripts directory
Find the first occurrence 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_3', 'presets')
- # if os.path.exists(presetpath):
- # break
- # return presetpath
-
- # why not just do this
+
script_file = os.path.realpath(__file__)
directory = os.path.dirname(script_file)
directory = os.path.join(directory, "presets")
@@ -145,7 +138,7 @@ class ExportData(Operator):
bl_idname = 'sapling.exportdata'
bl_label = 'Export Preset'
- data = StringProperty()
+ data: StringProperty()
def execute(self, context):
# Unpack some data from the input
@@ -196,7 +189,7 @@ class ImportData(Operator):
bl_idname = "sapling.importdata"
bl_label = "Import Preset"
- filename = StringProperty()
+ filename: StringProperty()
def execute(self, context):
# Make sure the operator knows about the global variables
@@ -276,49 +269,49 @@ class AddTree(Operator):
def no_update_tree(self, context):
self.do_update = False
- do_update = BoolProperty(
+ do_update: BoolProperty(
name='Do Update',
default=True, options={'HIDDEN'}
)
- chooseSet = EnumProperty(
+ chooseSet: EnumProperty(
name='Settings',
description='Choose the settings to modify',
items=settings,
default='0', update=no_update_tree
)
- bevel = BoolProperty(
+ bevel: BoolProperty(
name='Bevel',
description='Whether the curve is beveled',
default=False, update=update_tree
)
- prune = BoolProperty(
+ prune: BoolProperty(
name='Prune',
description='Whether the tree is pruned',
default=False, update=update_tree
)
- showLeaves = BoolProperty(
+ showLeaves: BoolProperty(
name='Show Leaves',
description='Whether the leaves are shown',
default=False, update=update_tree
)
- useArm = BoolProperty(
+ useArm: BoolProperty(
name='Use Armature',
description='Whether the armature is generated',
default=False, update=update_tree
)
- seed = IntProperty(
+ seed: IntProperty(
name='Random Seed',
description='The seed of the random number generator',
default=0, update=update_tree
)
- handleType = IntProperty(
+ handleType: IntProperty(
name='Handle Type',
description='The type of curve handles',
min=0,
max=1,
default=0, update=update_tree
)
- levels = IntProperty(
+ levels: IntProperty(
name='Levels',
description='Number of recursive branches (Levels)',
min=1,
@@ -326,14 +319,14 @@ class AddTree(Operator):
soft_max=4,
default=3, update=update_tree
)
- length = FloatVectorProperty(
+ length: FloatVectorProperty(
name='Length',
description='The relative lengths of each branch level (nLength)',
min=0.000001,
default=[1, 0.3, 0.6, 0.45],
size=4, update=update_tree
)
- lengthV = FloatVectorProperty(
+ lengthV: FloatVectorProperty(
name='Length Variation',
description='The relative length variations of each level (nLengthV)',
min=0.0,
@@ -341,52 +334,52 @@ class AddTree(Operator):
default=[0, 0, 0, 0],
size=4, update=update_tree
)
- taperCrown = FloatProperty(
+ taperCrown: FloatProperty(
name='Taper Crown',
description='Shorten trunk splits toward outside of tree',
min=0.0,
soft_max=1.0,
default=0, update=update_tree
)
- branches = IntVectorProperty(
+ branches: IntVectorProperty(
name='Branches',
description='The number of branches grown at each level (nBranches)',
min=0,
default=[50, 30, 10, 10],
size=4, update=update_tree
)
- curveRes = IntVectorProperty(
+ curveRes: IntVectorProperty(
name='Curve Resolution',
description='The number of segments on each branch (nCurveRes)',
min=1,
default=[3, 5, 3, 1],
size=4, update=update_tree
)
- curve = FloatVectorProperty(
+ curve: FloatVectorProperty(
name='Curvature',
description='The angle of the end of the branch (nCurve)',
default=[0, -40, -40, 0],
size=4, update=update_tree
)
- curveV = FloatVectorProperty(
+ curveV: FloatVectorProperty(
name='Curvature Variation',
description='Variation of the curvature (nCurveV)',
default=[20, 50, 75, 0],
size=4, update=update_tree
)
- curveBack = FloatVectorProperty(
+ curveBack: FloatVectorProperty(
name='Back Curvature',
description='Curvature for the second half of a branch (nCurveBack)',
default=[0, 0, 0, 0],
size=4, update=update_tree
)
- baseSplits = IntProperty(
+ baseSplits: IntProperty(
name='Base Splits',
description='Number of trunk splits at its base (nBaseSplits)',
min=0,
default=0, update=update_tree
)
- segSplits = FloatVectorProperty(
+ segSplits: FloatVectorProperty(
name='Segment Splits',
description='Number of splits per segment (nSegSplits)',
min=0,
@@ -394,45 +387,45 @@ class AddTree(Operator):
default=[0, 0, 0, 0],
size=4, update=update_tree
)
- splitByLen = BoolProperty(
+ splitByLen: BoolProperty(
name='Split relative to length',
description='Split proportional to branch length',
default=False, update=update_tree
)
- rMode = EnumProperty(
+ rMode: EnumProperty(
name="", # "Branching Mode"
description='Branching and Rotation Mode',
items=branchmodes,
default="rotate", update=update_tree
)
- splitAngle = FloatVectorProperty(
+ splitAngle: FloatVectorProperty(
name='Split Angle',
description='Angle of branch splitting (nSplitAngle)',
default=[0, 0, 0, 0],
size=4, update=update_tree
)
- splitAngleV = FloatVectorProperty(
+ splitAngleV: FloatVectorProperty(
name='Split Angle Variation',
description='Variation in the split angle (nSplitAngleV)',
default=[0, 0, 0, 0],
size=4, update=update_tree
)
- scale = FloatProperty(
+ scale: FloatProperty(
name='Scale',
description='The tree scale (Scale)',
min=0.0,
default=13.0, update=update_tree)
- scaleV = FloatProperty(name='Scale Variation',
+ scaleV: FloatProperty(name='Scale Variation',
description='The variation in the tree scale (ScaleV)',
default=3.0, update=update_tree
)
- attractUp = FloatVectorProperty(
+ attractUp: FloatVectorProperty(
name='Vertical Attraction',
description='Branch upward attraction',
default=[0, 0, 0, 0],
size=4, update=update_tree
)
- attractOut = FloatVectorProperty(
+ attractOut: FloatVectorProperty(
name='Outward Attraction',
description='Branch outward attraction',
default=[0, 0, 0, 0],
@@ -440,19 +433,19 @@ class AddTree(Operator):
max=1.0,
size=4, update=update_tree
)
- shape = EnumProperty(
+ shape: EnumProperty(
name='Shape',
description='The overall shape of the tree (Shape)',
items=shapeList3,
default='7', update=update_tree
)
- shapeS = EnumProperty(
+ shapeS: EnumProperty(
name='Secondary Branches Shape',
description='The shape of secondary splits',
items=shapeList4,
default='4', update=update_tree
)
- customShape = FloatVectorProperty(
+ customShape: FloatVectorProperty(
name='Custom Shape',
description='custom shape branch length at (Base, Middle, Middle Position, Top)',
size=4,
@@ -460,76 +453,76 @@ class AddTree(Operator):
max=1,
default=[.5, 1.0, .3, .5], update=update_tree
)
- branchDist = FloatProperty(
+ branchDist: FloatProperty(
name='Branch Distribution',
description='Adjust branch spacing to put more branches at the top or bottom of the tree',
min=0.1,
soft_max=10,
default=1.0, update=update_tree
)
- nrings = IntProperty(
+ nrings: IntProperty(
name='Branch Rings',
description='grow branches in rings',
min=0,
default=0, update=update_tree
)
- baseSize = FloatProperty(
+ baseSize: FloatProperty(
name='Trunk Height',
description='Fraction of tree height with no branches (Base Size)',
min=0.0,
max=1.0,
default=0.4, update=update_tree
)
- baseSize_s = FloatProperty(
+ baseSize_s: FloatProperty(
name='Secondary Base Size',
description='Factor to decrease base size for each level',
min=0.0,
max=1.0,
default=0.25, update=update_tree
)
- splitHeight = FloatProperty(
+ splitHeight
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list