Skip to content

Commit

Permalink
fix circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
Taremin committed Mar 5, 2022
1 parent 9a3a7aa commit d759396
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

# モジュール読み込み
module_names = [
"utils",
"library",
"lacing_base",
"lacing_bow_tie",
Expand Down
6 changes: 3 additions & 3 deletions lib/lacing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import mathutils
import math
import os
from . import library, ops
from . import library, utils


def append(context, path, obj_name):
Expand All @@ -18,7 +18,7 @@ def append(context, path, obj_name):
class ShoeLacing:
label = "ShoeLacing(Base)"

def __init__(self, obj, vertices2d, settings: ops.ShoeLacingProps):
def __init__(self, obj, vertices2d, settings):
self.base_obj = obj
self.vertices2d = vertices2d
self.settings = settings
Expand Down Expand Up @@ -353,7 +353,7 @@ def get_top_points(self, context):
center = self.calc_center_points(y, is_reversed)

asset = library.knots[int(settings.knot_type)]
knots = ops.get_knot_list(context.scene, context)
knots = utils.get_knot_list(context.scene, context)
is_local_object = (asset[1] == "")
if asset[1] is None or (is_local_object and len(knots) == 0):
return (left + center, right, True)
Expand Down
13 changes: 2 additions & 11 deletions lib/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ def check_index(self, value):
return value


def get_knot_list(scene, context):
settings = utils.get_settings(context)
items = [
(knot.object.name, knot.object.name, "")
for i, knot in enumerate(settings.knots) if knot.object is not None
]
return items


class OBJECT_OT_TareminShoeLacesCreateCurve(bpy.types.Operator):
bl_idname = 'taremin.shoelaces_create_curve'
bl_label = 'カーブの生成'
Expand Down Expand Up @@ -136,7 +127,7 @@ def set_index_right(self, value):
options={'HIDDEN'}
)

knot: bpy.props.EnumProperty(items=get_knot_list)
knot: bpy.props.EnumProperty(items=utils.get_knot_list)

# --------------------------------------------------------------------------

Expand Down Expand Up @@ -447,7 +438,7 @@ def draw(self, context):
box = layout.box()
box.prop(self, "knot_type")
knot = library.knots[int(self.knot_type)]
knots = get_knot_list(context.scene, context)
knots = utils.get_knot_list(context.scene, context)
if knot[1] == "" and len(knots) > 0:
box.prop(self, "knot")
box.prop(self, "is_reverse_spline_left")
Expand Down
9 changes: 9 additions & 0 deletions lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ def get_settings(context):

def set_settings(context, value):
context.scene.taremin_shoelace = value


def get_knot_list(scene, context):
settings = get_settings(context)
items = [
(knot.object.name, knot.object.name, "")
for i, knot in enumerate(settings.knots) if knot.object is not None
]
return items

0 comments on commit d759396

Please sign in to comment.