Skip to content
Snippets Groups Projects
add_curve_aceous_galore.py 38.1 KiB
Newer Older
  • Learn to ignore specific revisions
  •             box.prop(self.properties, 'arcType') # has only one Type?
                box.prop(self.properties, 'startAngle')
                box.prop(self.properties, 'endAngle')
                box.prop(self.properties, 'innerRadius') # doesn't seem to do anything
                box.prop(self.properties, 'outerRadius')
            if self.GalloreType == 'Cogwheel':
                box.prop(self.properties, 'teeth')
                box.prop(self.properties, 'bevel')
                box.prop(self.properties, 'innerRadius')
                box.prop(self.properties, 'middleRadius')
                box.prop(self.properties, 'outerRadius')
            if self.GalloreType == 'Nsided':
                box.prop(self.properties, 'Nsides')
                box.prop(self.properties, 'outerRadius', text='Radius')
    
    Florian Meyer's avatar
    Florian Meyer committed
    
    
            if self.GalloreType == 'Splat':
                box.prop(self.properties, 'splatSides')
                box.prop(self.properties, 'outerRadius')
                box.prop(self.properties, 'splatScale')
                box.prop(self.properties, 'seed')
                box.prop(self.properties, 'basis')
    
    Florian Meyer's avatar
    Florian Meyer committed
    
    
            if self.GalloreType == 'Helix':
                box.prop(self.properties, 'helixPoints')
                box.prop(self.properties, 'helixHeight')
                box.prop(self.properties, 'helixWidth')
                box.prop(self.properties, 'helixStart')
                box.prop(self.properties, 'helixEnd')
                box.prop(self.properties, 'helix_a')
                box.prop(self.properties, 'helix_b')
            if self.GalloreType == 'Cycloid':
                box.prop(self.properties, 'cycloPoints')
                #box.prop(self.properties, 'cycloType') # needs the other types first
                box.prop(self.properties, 'cycloStart')
                box.prop(self.properties, 'cycloEnd')
                box.prop(self.properties, 'cyclo_a')
                box.prop(self.properties, 'cyclo_b')
                box.prop(self.properties, 'cyclo_d')
    
    
            col = layout.column()
            col.label(text="Output Curve Type")
            row = layout.row()
    
            row.prop(self.properties, 'outputType', expand=True)
    
            col = layout.column()
            col.label(text="Curve Options")
    
            # output options
            box = layout.box()
    
            if self.outputType == 'NURBS':
                box.row().prop(self.properties, 'shape', expand=True)
                #box.prop(self.properties, 'use_cyclic_u')
                #box.prop(self.properties, 'endp_u')
                box.prop(self.properties, 'order_u')
    
            if self.outputType == 'POLY':
                box.row().prop(self.properties, 'shape', expand=True)
                #box.prop(self.properties, 'use_cyclic_u')
    
            if self.outputType == 'BEZIER':
                box.row().prop(self.properties, 'shape', expand=True)
                box.row().prop(self.properties, 'handleType', expand=True)
                #box.prop(self.properties, '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")
    
    
    
    def register():
        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()