This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| #define what the property in the colection will look like | |
| class scad_params(bpy.types.PropertyGroup): | |
| materialname: bpy.props.StringProperty(name="Material", default="") | |
| slot: bpy.props.IntProperty(name="Slot") | |
| #operator, connected the button that adds the params | |
| class HiOp(bpy.types.Operator): | |
| bl_idname = 'hi.go' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| import bpy.utils.previews | |
| class HelloWorldPanel(bpy.types.Panel): | |
| """Creates a Panel in the Object properties window""" | |
| bl_label = "HI" | |
| bl_category = "HI" | |
| bl_idname = "HI_Panel" | |
| bl_space_type = 'VIEW_3D' | |
| bl_region_type = 'UI' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| class EXAMPLE_panel: | |
| bl_space_type = "VIEW_3D" | |
| bl_region_type = "UI" | |
| bl_category = "Hi" | |
| bl_options = {"DEFAULT_CLOSED"} | |
| #The primary panel, no parents | |
| class EXAMPLE_PT_panel_1(EXAMPLE_panel, bpy.types.Panel): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### blender addon template | |
| import bpy | |
| #used for file open browser | |
| from bpy_extras.io_utils import ImportHelper | |
| ####|| OPERATORS ||#### | |
| class HI_OT_DoStuff(bpy.types.Operator): | |
| bl_idname = 'do.go' | |
| bl_label = 'Do Stuff' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### blender addon template | |
| import bpy | |
| #used for file open browser | |
| from bpy_extras.io_utils import ImportHelper | |
| ####|| OPERATORS ||#### | |
| class HI_OT_DoStuff(bpy.types.Operator): | |
| bl_idname = 'do.go' | |
| bl_label = 'Do Stuff' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| from mathutils import Matrix | |
| import bmesh | |
| ob = bpy.context.view_layer.objects.active | |
| def create_empty(coord): | |
| obj = bpy.data.objects.new('em', None) | |
| bpy.context.collection.objects.link(obj) | |
| obj.location = coord |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy, bmesh, mathutils | |
| # an example script of getting the boundary paths of selected faces on a mesh and outputting them in x,y cooridnates. | |
| # not sure what other people might do with it, but I found this a needed step in 2d-3d workflows | |
| # fn determine if vert is a boundary OF SELECTION vert | |
| def fnDetermineVertBoundary(objVert): | |
| if objVert.select == True: | |
| for objFace in objVert.link_faces: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| #define what the property in the colection will look like | |
| class color_map(bpy.types.PropertyGroup): | |
| color: bpy.props.FloatVectorProperty( | |
| name = "Color Picker", | |
| subtype = "COLOR", | |
| default = (1.0,1.0,1.0,1.0), | |
| size = 4 | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # move origin for all selected objects to edges of axis example usage, where xyz=012 | |
| # left = origin_to(obj,0,"-"), right = origin_to(obj,0,"+") | |
| def origin_to(ob, axis="z", dir="-", matrix=Matrix()): | |
| me = ob.data | |
| mw = ob.matrix_world | |
| local_verts = [matrix @ Vector(v[:]) for v in ob.bound_box] | |
| o = sum(local_verts, Vector()) / 8 | |
| if dir == "-": | |
| o[axis] = min(v[axis] for v in local_verts) | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bl_info = { | |
| "name": "Crayon", | |
| "author": "Anthony Aragues", | |
| "version": (0, 9), | |
| "blender": (3,0,0), | |
| "location": "n > Crayon", | |
| "description": "vertex paint your objects by chosen colors quickly", | |
| "warning": "", | |
| "doc_url": "http://3dialogue.com/addons/crayon", | |
| "category": "Import-Export", |