1 # SPDX-License-Identifier: GPL-2.0-or-later
7 ICONS
= 'BIX CCEN V2X VTX XALL E2F'.split(' ')
11 class TinyCADProperties(bpy
.types
.PropertyGroup
):
13 num_verts
: bpy
.props
.IntProperty(
14 min=3, max=60, default
=12)
16 rescale
: bpy
.props
.FloatProperty(
22 class VIEW3D_MT_edit_mesh_tinycad(bpy
.types
.Menu
):
26 def poll(cls
, context
):
27 return bool(context
.object)
29 def draw(self
, context
):
31 pcoll
= icon_collection
["main"]
34 return pcoll
[name
].icon_id
36 op
= self
.layout
.operator
37 op('tinycad.autovtx', text
='VTX | AUTO', icon_value
=cicon('VTX'))
38 op('tinycad.vertintersect', text
='V2X | Vertex at intersection', icon_value
=cicon('V2X'))
39 op('tinycad.intersectall', text
='XALL | Intersect selected edges', icon_value
=cicon('XALL'))
40 op('tinycad.linetobisect', text
='BIX | Bisector of 2 planar edges', icon_value
=cicon('BIX'))
41 op('tinycad.circlecenter', text
='CCEN | Resurrect circle center', icon_value
=cicon('CCEN'))
42 op('tinycad.edge_to_face', text
='E2F | Extend Edge to Face', icon_value
=cicon('E2F'))
46 import bpy
.utils
.previews
47 pcoll
= bpy
.utils
.previews
.new()
48 icons_dir
= os
.path
.join(os
.path
.dirname(__file__
), "icons")
49 for icon_name
in ICONS
:
50 pcoll
.load(icon_name
, os
.path
.join(icons_dir
, icon_name
+ '.png'), 'IMAGE')
52 icon_collection
["main"] = pcoll
55 def unregister_icons():
56 for pcoll
in icon_collection
.values():
57 bpy
.utils
.previews
.remove(pcoll
)
58 icon_collection
.clear()