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