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