Skip to content
Snippets Groups Projects
__init__.py 36.7 KiB
Newer Older
  • Learn to ignore specific revisions
  •             col.prop(self, 'downAngleV')
    
    Thomas Dinges's avatar
    Thomas Dinges committed
                col.prop(self, 'curveV')
    
                col.prop(self, 'attractUp')
    
                box.prop(self, 'useOldDownAngle')
                box.prop(self, 'useParentAngle')
    
            elif self.chooseSet == '4':
    
    Andrew Hale's avatar
    Andrew Hale committed
                box = layout.box()
    
                box.label(text="Prune:")
    
    Thomas Dinges's avatar
    Thomas Dinges committed
                box.prop(self, 'prune')
                box.prop(self, 'pruneRatio')
    
                row = box.row()
                row.prop(self, 'pruneWidth')
                row.prop(self, 'pruneBase')
    
    Thomas Dinges's avatar
    Thomas Dinges committed
                box.prop(self, 'pruneWidthPeak')
    
    Andrew Hale's avatar
    Andrew Hale committed
                row = box.row()
                row.prop(self, 'prunePowerHigh')
                row.prop(self, 'prunePowerLow')
    
    
            elif self.chooseSet == '5':
    
    Andrew Hale's avatar
    Andrew Hale committed
                box = layout.box()
    
                box.label(text="Leaves:")
    
    Thomas Dinges's avatar
    Thomas Dinges committed
                box.prop(self, 'showLeaves')
                box.prop(self, 'leafShape')
    
                box.prop(self, 'leafDupliObj')
    
    Thomas Dinges's avatar
    Thomas Dinges committed
                box.prop(self, 'leaves')
                box.prop(self, 'leafDist')
    
                box.label(text="")
    
                row = box.row()
                row.prop(self, 'leafDownAngle')
                row.prop(self, 'leafDownAngleV')
    
                row = box.row()
                row.prop(self, 'leafRotate')
                row.prop(self, 'leafRotateV')
    
                box.label(text="")
    
    Thomas Dinges's avatar
    Thomas Dinges committed
                row = box.row()
                row.prop(self, 'leafScale')
                row.prop(self, 'leafScaleX')
    
                row = box.row()
                row.prop(self, 'leafScaleT')
                row.prop(self, 'leafScaleV')
    
                box.prop(self, 'horzLeaves')
                box.prop(self, 'leafangle')
    
    
                # box.label(text=" ")
    
                # box.prop(self, 'bend')
    
            elif self.chooseSet == '6':
                box = layout.box()
    
                box.label(text="Armature:")
    
    Andrew Hale's avatar
    Andrew Hale committed
                row = box.row()
                row.prop(self, 'useArm')
    
                box.prop(self, 'makeMesh')
    
                box.label(text="Armature Simplification:")
    
                box.prop(self, 'armLevels')
                box.prop(self, 'boneStep')
    
            elif self.chooseSet == '7':
                box = layout.box()
    
                box.label(text="Finalize All Other Settings First!")
    
                box.prop(self, 'armAnim')
                box.prop(self, 'leafAnim')
                box.prop(self, 'previewArm')
                box.prop(self, 'frameRate')
                box.prop(self, 'loopFrames')
    
    
                # row = box.row()
                # row.prop(self, 'windSpeed')
                # row.prop(self, 'windGust')
    
                box.label(text='Wind Settings:')
    
                box.prop(self, 'wind')
    
    Andrew Hale's avatar
    Andrew Hale committed
                row = box.row()
    
                row.prop(self, 'gust')
                row.prop(self, 'gustF')
    
                box.label(text='Leaf Wind Settings:')
    
                box.prop(self, 'af1')
                box.prop(self, 'af2')
                box.prop(self, 'af3')
    
    Andrew Hale's avatar
    Andrew Hale committed
    
        def execute(self, context):
            # Ensure the use of the global variables
            global settings, useSet
            start_time = time.time()
    
    Andrew Hale's avatar
    Andrew Hale committed
            # If we need to set the properties from a preset then do it here
            if useSet:
                for a, b in settings.items():
                    setattr(self, a, b)
                if self.limitImport:
    
                    setattr(self, 'levels', min(settings['levels'], 2))
    
    Andrew Hale's avatar
    Andrew Hale committed
                    setattr(self, 'showLeaves', False)
                useSet = False
    
    Andrew Hale's avatar
    Andrew Hale committed
            if not self.do_update:
                return {'PASS_THROUGH'}
    
            utils.addTree(self)
            # cProfile.runctx("addTree(self)", globals(), locals())
            print("Tree creation in %0.1fs" % (time.time() - start_time))
    
    
    Andrew Hale's avatar
    Andrew Hale committed
            return {'FINISHED'}
    
    Andrew Hale's avatar
    Andrew Hale committed
        def invoke(self, context, event):
    
            bpy.ops.sapling.importdata(filename="callistemon.py")
    
    Andrew Hale's avatar
    Andrew Hale committed
            return self.execute(context)
    
    
    Andrew Hale's avatar
    Andrew Hale committed
    def menu_func(self, context):
    
        self.layout.operator(AddTree.bl_idname, text="Sapling Tree Gen", icon='CURVE_DATA')
    
    classes = (
        AddTree,
        PresetMenu,
        ImportData,
        ExportData,
    )
    
    Andrew Hale's avatar
    Andrew Hale committed
    def register():
    
        from bpy.utils import register_class
        for cls in classes:
            register_class(cls)
    
        bpy.types.VIEW3D_MT_curve_add.append(menu_func)
    
    Andrew Hale's avatar
    Andrew Hale committed
    def unregister():
    
        from bpy.utils import unregister_class
        for cls in reversed(classes):
            unregister_class(cls)
    
        bpy.types.VIEW3D_MT_curve_add.remove(menu_func)
    
    Andrew Hale's avatar
    Andrew Hale committed
    if __name__ == "__main__":
    
    Guillermo S. Romero's avatar
    Guillermo S. Romero committed
        register()