Skip to content

Commit

Permalink
Add auto increment function
Browse files Browse the repository at this point in the history
頂点グループの重複を防ぐために、作成したボーンの数に合わせて、ボーンの開始番号を自動で増やす機能を追加した。
  • Loading branch information
Samia committed May 10, 2021
1 parent 7aff769 commit e8e12ec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/petit_armature_tools/pat_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ class PAT_ToolSettings(bpy.types.PropertyGroup):
default=True,
options={'HIDDEN'}
)
use_auto_increment = bpy.props.BoolProperty(
name="Auto Increment",
description="Enable auto increment of start number",
default=True,
options={'HIDDEN'}
)
use_offset = bpy.props.BoolProperty(
name="Offset",
description="Enable Bone location offset",
Expand Down Expand Up @@ -454,6 +460,10 @@ def invoke(self, context, event):

self.new_bone_names = self._get_new_bone_names()

# 開始番号にボーンの数を足す
if self.pat_tool_settings.use_auto_increment:
self.pat_tool_settings.start_number += len(self.new_bones)

# ボーンネームが空の場合は終了
for bone_name in self.new_bone_names:
if bone_name == '':
Expand Down Expand Up @@ -542,7 +552,7 @@ def _get_select_edge_loops_location(self, context):
if e in selected_edges:
return

select_loop_edges = [s_e for s_e in bm.edges if s_e.select == True]
select_loop_edges = [s_e for s_e in bm.edges if s_e.select]
selected_edges += select_loop_edges

if i > 0:
Expand Down Expand Up @@ -602,6 +612,10 @@ def invoke(self, context, event):

self.new_bone_names = self._get_new_bone_names()

# 開始番号にボーンの数を足す
if self.pat_tool_settings.use_auto_increment:
self.pat_tool_settings.start_number += len(self.new_bones)

# ボーンネームが空の場合は終了
for bone_name in self.new_bone_names:
if bone_name == '':
Expand Down Expand Up @@ -683,6 +697,7 @@ def draw(self, context):
box.prop(pat_tool_settings, "zero_padding")
box.prop(pat_tool_settings, "use_auto_bone_roll")
box.prop(pat_tool_settings, "use_auto_bone_weight")
box.prop(pat_tool_settings, "use_auto_increment")
box.prop(pat_tool_settings, "is_parent")
# box.prop(pat_tool_settings, "is_reverse")
box_col = box.column(align=True)
Expand Down Expand Up @@ -729,6 +744,7 @@ def draw(self, context):
box.prop(pat_tool_settings, "start_number")
box.prop(pat_tool_settings, "zero_padding")
box.prop(pat_tool_settings, "use_auto_bone_weight")
box.prop(pat_tool_settings, "use_auto_increment")
box.prop(pat_tool_settings, "is_parent")
# box.prop(pat_tool_settings, "is_reverse")
box_col = box.column(align=True)
Expand Down
2 changes: 2 additions & 0 deletions src/petit_armature_tools/translation_dictionary.csv
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"自動でボーンロールを設定する機能を有効にします","Enable Auto bone roll"
"自動ウェイト","Auto Bone Weight"
"自動でウェイトを設定する機能を有効にします","Enable Auto bone weights"
"自動インクリメント","Auto Increment"
"開始番号の自動インクリメントを有効にします","Enable auto increment of start number"
"オフセット","Offset"
"オフセット値","Offset value"
"ボーンを作成するとき、位置のオフセットを有効にします","Enable Bone location offset"
Expand Down

0 comments on commit e8e12ec

Please sign in to comment.