Skip to content
Snippets Groups Projects
add_curve_aceous_galore.py 38.2 KiB
Newer Older
  • Learn to ignore specific revisions
  •         # options per GalloreType
            box = layout.box()
    
                box.prop(self, 'ProfileCurveType')
                box.prop(self, 'ProfileCurvevar1')
                box.prop(self, 'ProfileCurvevar2')
    
            elif self.GalloreType == 'Miscellaneous':
    
    Florian Meyer's avatar
    Florian Meyer committed
                box.prop(self, 'MiscCurvevar1', text='Width')
                box.prop(self, 'MiscCurvevar2', text='Height')
                if self.MiscCurveType == 5:
                    box.prop(self, 'MiscCurvevar3', text='Rounded')
    
            elif self.GalloreType == 'Flower':
    
                box.prop(self, 'petals')
                box.prop(self, 'petalWidth')
                box.prop(self, 'innerRadius')
                box.prop(self, 'outerRadius')
    
            elif self.GalloreType == 'Star':
    
                box.prop(self, 'starPoints')
                box.prop(self, 'starTwist')
                box.prop(self, 'innerRadius')
                box.prop(self, 'outerRadius')
    
            elif self.GalloreType == 'Arc':
    
                box.prop(self, 'arcSides')
                box.prop(self, 'arcType') # has only one Type?
                box.prop(self, 'startAngle')
                box.prop(self, 'endAngle')
                box.prop(self, 'innerRadius') # doesn't seem to do anything
                box.prop(self, 'outerRadius')
    
            elif self.GalloreType == 'Cogwheel':
    
                box.prop(self, 'teeth')
                box.prop(self, 'bevel')
                box.prop(self, 'innerRadius')
                box.prop(self, 'middleRadius')
                box.prop(self, 'outerRadius')
    
            elif self.GalloreType == 'Nsided':
    
                box.prop(self, 'Nsides')
                box.prop(self, 'outerRadius', text='Radius')
    
    Florian Meyer's avatar
    Florian Meyer committed
    
    
            elif self.GalloreType == 'Splat':
    
                box.prop(self, 'splatSides')
                box.prop(self, 'outerRadius')
                box.prop(self, 'splatScale')
                box.prop(self, 'seed')
                box.prop(self, 'basis')
    
    Florian Meyer's avatar
    Florian Meyer committed
    
    
            elif self.GalloreType == 'Helix':
    
                box.prop(self, 'helixPoints')
                box.prop(self, 'helixHeight')
                box.prop(self, 'helixWidth')
                box.prop(self, 'helixStart')
                box.prop(self, 'helixEnd')
                box.prop(self, 'helix_a')
                box.prop(self, 'helix_b')
    
            elif self.GalloreType == 'Cycloid':
    
                box.prop(self, 'cycloPoints')
                #box.prop(self, 'cycloType') # needs the other types first
                box.prop(self, 'cycloStart')
                box.prop(self, 'cycloEnd')
                box.prop(self, 'cyclo_a')
                box.prop(self, 'cyclo_b')
                box.prop(self, 'cyclo_d')
    
    
            col = layout.column()
    
            col.label(text="Output Curve Type:")
            col.row().prop(self, 'outputType', expand=True)
            col.label(text="Curve Options:")
    
    
            # output options
            box = layout.box()
    
                box.row().prop(self, 'shape', expand=True)
                #box.prop(self, 'use_cyclic_u')
                #box.prop(self, 'endp_u')
                box.prop(self, 'order_u')
    
            elif self.outputType == 'POLY':
    
                box.row().prop(self, 'shape', expand=True)
                #box.prop(self, 'use_cyclic_u')
    
            elif self.outputType == 'BEZIER':
    
                box.row().prop(self, 'shape', expand=True)
                box.row().prop(self, 'handleType', expand=True)
                #box.prop(self, 'use_cyclic_u')
    
        @classmethod
        def poll(cls, context):
    
            return context.scene != None
    
        ##### EXECUTE #####
        def execute(self, context):
            # turn off undo
    
    Campbell Barton's avatar
    Campbell Barton committed
            undo = bpy.context.user_preferences.edit.use_global_undo
            bpy.context.user_preferences.edit.use_global_undo = False
    
            # deal with 2D - 3D curve differences
    
            if self.GalloreType in ['Helix', 'Cycloid']:
                self.shape = '3D'
    
                #self.shape = '2D'     # someone decide if we want this
    
            if self.GalloreType in ['Helix']:
                self.use_cyclic_u = False
    
            
            # restore pre operator undo state
    
    Campbell Barton's avatar
    Campbell Barton committed
            bpy.context.user_preferences.edit.use_global_undo = undo
    
    
            return {'FINISHED'}
    
        ##### INVOKE #####
        def invoke(self, context, event):
            # store creation_matrix
            self.align_matrix = align_matrix(context)
            self.execute(context)
    
            return {'FINISHED'}
    
    ################################################################################
    ##### REGISTER #####
    
    
    def Curveaceous_galore_button(self, context):
        self.layout.operator(Curveaceous_galore.bl_idname, text="curvatures gallore", icon="PLUGIN")
    
        bpy.types.INFO_MT_curve_add.append(Curveaceous_galore_button)
    
    def unregister():
    
        bpy.types.INFO_MT_curve_add.remove(Curveaceous_galore_button)
    
    if __name__ == "__main__":
    
    Guillermo S. Romero's avatar
    Guillermo S. Romero committed
        register()