Skip to content

Commit 9552d35

Browse files
committed
Remove multiple ui templates
1 parent 1c5bd0c commit 9552d35

File tree

9 files changed

+14
-142
lines changed

9 files changed

+14
-142
lines changed

__init__.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@
3737
importlib.reload(utils)
3838
importlib.reload(metarig_menu)
3939
importlib.reload(rig_lists)
40-
importlib.reload(template_list)
4140
importlib.reload(feature_sets)
4241
else:
43-
from . import (utils, rig_lists, template_list,
44-
generate, ui, metarig_menu, feature_sets)
42+
from . import (utils, rig_lists, generate, ui, metarig_menu, feature_sets)
4543

4644
import bpy
4745
import sys
@@ -139,10 +137,6 @@ def update_external_rigs(self):
139137
print('Reloading external metarigs...')
140138
metarig_menu.get_external_metarigs(feature_sets_path)
141139

142-
# Reload templates
143-
print('Reloading external templates...')
144-
template_list.get_external_templates(feature_sets_path)
145-
146140
legacy_mode = BoolProperty(
147141
name='Rigify Legacy Mode',
148142
description='Select if you want to use Rigify in legacy mode',
@@ -260,10 +254,6 @@ class RigifySelectionColors(bpy.types.PropertyGroup):
260254
)
261255

262256

263-
class RigifyTemplate(bpy.types.PropertyGroup):
264-
name = bpy.props.StringProperty()
265-
266-
267257
class RigifyParameters(bpy.types.PropertyGroup):
268258
name = bpy.props.StringProperty()
269259

@@ -349,7 +339,6 @@ def register():
349339
metarig_menu.register()
350340

351341
bpy.utils.register_class(RigifyName)
352-
bpy.utils.register_class(RigifyTemplate)
353342
bpy.utils.register_class(RigifyParameters)
354343

355344
bpy.utils.register_class(RigifyColorSet)
@@ -444,8 +433,6 @@ def update_mode(self, context):
444433
# update legacy on restart or reload
445434
bpy.context.user_preferences.addons['rigify'].preferences.legacy_mode = True
446435
IDStore = bpy.types.Armature
447-
IDStore.rigify_templates = bpy.props.CollectionProperty(type=RigifyTemplate)
448-
IDStore.rigify_active_template = bpy.props.IntProperty(name="Rigify Active Template", description="The selected ui template", default=0)
449436

450437
bpy.context.user_preferences.addons['rigify'].preferences.update_external_rigs()
451438

@@ -487,11 +474,8 @@ def unregister():
487474
del IDStore.rigify_transfer_end_frame
488475

489476
IDStore = bpy.types.Armature
490-
del IDStore.rigify_templates
491-
del IDStore.rigify_active_template
492477

493478
bpy.utils.unregister_class(RigifyName)
494-
bpy.utils.unregister_class(RigifyTemplate)
495479
bpy.utils.unregister_class(RigifyParameters)
496480

497481
bpy.utils.unregister_class(RigifyColorSet)

generate.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from .utils import copy_attributes
3434
from .utils import gamma_correct
3535
from . import rig_lists
36-
from . import template_list
36+
from . import rig_ui_template
3737

3838
RIG_MODULE = "rigs"
3939
ORG_LAYER = [n == 31 for n in range(0, 32)] # Armature layer that original bones should be moved to.
@@ -341,17 +341,11 @@ def generate_rig(context, metarig):
341341

342342
# Generate all the rigs.
343343
armature_store = context.armature
344-
if len(template_list.templates) > 1:
345-
template_name = armature_store.rigify_templates[armature_store.rigify_active_template].name
346-
else:
347-
template_name = 'rig_ui_template'
348-
349-
template = template_list.templates[template_name]
350344

351345
ui_scripts = []
352-
ui_imports = template.UI_IMPORTS.copy()
353-
ui_utilities = template.UI_UTILITIES.copy()
354-
ui_register = template.UI_REGISTER.copy()
346+
ui_imports = rig_ui_template.UI_IMPORTS.copy()
347+
ui_utilities = rig_ui_template.UI_UTILITIES.copy()
348+
ui_register = rig_ui_template.UI_REGISTER.copy()
355349
noparent_bones = []
356350
for rig in rigs:
357351
# Go into editmode in the rig armature
@@ -504,13 +498,13 @@ def generate_rig(context, metarig):
504498

505499
for s in OrderedDict.fromkeys(ui_imports):
506500
script.write(s + "\n")
507-
script.write(template.UI_BASE_UTILITIES % rig_id)
501+
script.write(rig_ui_template.UI_BASE_UTILITIES % rig_id)
508502
for s in OrderedDict.fromkeys(ui_utilities):
509503
script.write(s + "\n")
510-
script.write(template.UI_SLIDERS)
504+
script.write(rig_ui_template.UI_SLIDERS)
511505
for s in ui_scripts:
512506
script.write("\n " + s.replace("\n", "\n ") + "\n")
513-
script.write(template.layers_ui(vis_layers, layer_layout))
507+
script.write(rig_ui_template.layers_ui(vis_layers, layer_layout))
514508
script.write("\ndef register():\n")
515509
ui_register = OrderedDict.fromkeys(ui_register)
516510
for s in ui_register:

metarig_menu.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import bpy
2626

2727
from . import utils
28-
from . import template_list
2928

3029

3130
class ArmatureSubMenu(bpy.types.Menu):
@@ -90,8 +89,6 @@ def execute(self, context):
9089
bones = context.active_object.data.edit_bones
9190
bones.remove(bones[0])
9291

93-
template_list.fill_ui_template_list(obj)
94-
9592
# Create metarig
9693
m.create(obj)
9794

File renamed without changes.

rigs/limbs/arm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ...utils import make_mechanism_name
1010
from ...utils import create_limb_widget, connected_children_names
1111
from ...utils import align_bone_x_axis, align_bone_z_axis
12-
from ...ui_templates.rig_ui_template import UTILITIES_RIG_ARM, REGISTER_RIG_ARM
12+
from ...rig_ui_template import UTILITIES_RIG_ARM, REGISTER_RIG_ARM
1313
from ...utils import ControlLayersOption
1414
from rna_prop_ui import rna_idprop_ui_prop_get
1515
from ..widgets import create_ikarrow_widget
@@ -1549,4 +1549,4 @@ def create_sample(obj):
15491549

15501550

15511551
if __name__ == "__main__":
1552-
create_sample(bpy.context.active_object)
1552+
create_sample(bpy.context.active_object)

rigs/limbs/leg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from ...utils import MetarigError, make_mechanism_name
1111
from ...utils import create_limb_widget, connected_children_names
1212
from ...utils import align_bone_y_axis, align_bone_x_axis, align_bone_z_axis
13-
from ...ui_templates.rig_ui_template import UTILITIES_RIG_LEG, REGISTER_RIG_LEG
13+
from ...rig_ui_template import UTILITIES_RIG_LEG, REGISTER_RIG_LEG
1414
from ...utils import ControlLayersOption
1515
from rna_prop_ui import rna_idprop_ui_prop_get
1616
from ..widgets import create_ikarrow_widget
@@ -1577,4 +1577,4 @@ def create_sample(obj):
15771577

15781578

15791579
if __name__ == "__main__":
1580-
create_sample(bpy.context.active_object)
1580+
create_sample(bpy.context.active_object)

rigs/limbs/paw.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from ...utils import MetarigError, make_mechanism_name
99
from ...utils import create_limb_widget, connected_children_names
1010
from ...utils import align_bone_x_axis, align_bone_z_axis
11-
from ...ui_templates.rig_ui_template import UTILITIES_RIG_LEG, REGISTER_RIG_LEG
11+
from ...rig_ui_template import UTILITIES_RIG_LEG, REGISTER_RIG_LEG
1212
from ...utils import ControlLayersOption
1313
from rna_prop_ui import rna_idprop_ui_prop_get
1414
from ..widgets import create_ikarrow_widget, create_gear_widget
@@ -1575,4 +1575,4 @@ def create_sample(obj):
15751575

15761576

15771577
if __name__ == "__main__":
1578-
create_sample(bpy.context.active_object)
1578+
create_sample(bpy.context.active_object)

template_list.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

ui.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
from .utils import overwrite_prop_animation
3131
from .rigs.utils import get_limb_generated_names
3232
from . import rig_lists
33-
from . import template_list
3433
from . import generate
3534
from . import rot_mode
3635
from . import feature_sets
@@ -47,16 +46,6 @@ def build_type_list(context, rigify_types):
4746
a.name = r
4847

4948

50-
class DATA_UL_rigify_template_list(bpy.types.UIList):
51-
"""UIList subclass, to disable renaming in UI"""
52-
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
53-
ob = data
54-
template = item
55-
if template:
56-
layout.label(text=template.name, translate=False, icon_value=icon)
57-
else:
58-
layout.label(text="", translate=False, icon_value=icon)
59-
6049
class DATA_PT_rigify_buttons(bpy.types.Panel):
6150
bl_label = "Rigify Buttons"
6251
bl_space_type = 'PROPERTIES'
@@ -119,16 +108,9 @@ def draw(self, context):
119108

120109
col = layout.column(align=True)
121110
col.active = (not 'rig_id' in C.object.data)
122-
if len(template_list.templates) > 1:
123-
if len(context.object.data.rigify_templates) == 0:
124-
col.operator("pose.rigify_template_init")
125-
else:
126-
col.label("UI template for rig:")
127-
col.template_list("DATA_UL_rigify_template_list", "rigify_templates", armature_id_store, "rigify_templates", armature_id_store, "rigify_active_template")
128111

129112
col.separator()
130113
row = col.row()
131-
row.active = len(context.object.data.rigify_templates) != 0 or len(template_list.templates) == 1
132114
row.operator("pose.rigify_generate", text="Generate Rig", icon='POSE_HLT')
133115

134116
row.enabled = enable_generate_and_advanced
@@ -200,7 +182,6 @@ def draw(self, context):
200182
row = layout.row()
201183
row.prop(context.object.data, "active_feature_set")
202184
row = layout.row()
203-
row.template_list("UI_UL_list", "rigify_types", id_store, "rigify_types", id_store, 'rigify_active_type')
204185

205186
props = layout.operator("armature.metarig_sample_add", text="Add sample")
206187
props.metarig_type = id_store.rigify_types[id_store.rigify_active_type].name
@@ -748,18 +729,6 @@ def execute(self, context):
748729
return {'FINISHED'}
749730

750731

751-
class TemplateInit(bpy.types.Operator):
752-
"""Initialize armature rigify ui templates"""
753-
754-
bl_idname = "pose.rigify_template_init"
755-
bl_label = "Add Rigify UI Templates"
756-
bl_options = {'UNDO'}
757-
758-
def execute(self, context):
759-
template_list.fill_ui_template_list(context.object)
760-
return {'FINISHED'}
761-
762-
763732
class Generate(bpy.types.Operator):
764733
"""Generates a rig from the active metarig armature"""
765734

@@ -1337,7 +1306,6 @@ def execute(self, context):
13371306

13381307
def register():
13391308

1340-
bpy.utils.register_class(DATA_UL_rigify_template_list)
13411309
bpy.utils.register_class(DATA_OT_rigify_add_bone_groups)
13421310
bpy.utils.register_class(DATA_OT_rigify_use_standard_colors)
13431311
bpy.utils.register_class(DATA_OT_rigify_apply_selection_colors)
@@ -1354,7 +1322,6 @@ def register():
13541322
bpy.utils.register_class(VIEW3D_PT_rigify_animation_tools)
13551323
bpy.utils.register_class(VIEW3D_PT_tools_rigify_dev)
13561324
bpy.utils.register_class(LayerInit)
1357-
bpy.utils.register_class(TemplateInit)
13581325
bpy.utils.register_class(Generate)
13591326
bpy.utils.register_class(UpgradeMetarigTypes)
13601327
bpy.utils.register_class(SwitchToLegacy)
@@ -1375,7 +1342,6 @@ def register():
13751342

13761343
def unregister():
13771344

1378-
bpy.utils.unregister_class(DATA_UL_rigify_template_list)
13791345
bpy.utils.unregister_class(DATA_OT_rigify_add_bone_groups)
13801346
bpy.utils.unregister_class(DATA_OT_rigify_use_standard_colors)
13811347
bpy.utils.unregister_class(DATA_OT_rigify_apply_selection_colors)
@@ -1392,7 +1358,6 @@ def unregister():
13921358
bpy.utils.unregister_class(VIEW3D_PT_rigify_animation_tools)
13931359
bpy.utils.unregister_class(VIEW3D_PT_tools_rigify_dev)
13941360
bpy.utils.unregister_class(LayerInit)
1395-
bpy.utils.unregister_class(TemplateInit)
13961361
bpy.utils.unregister_class(Generate)
13971362
bpy.utils.unregister_class(UpgradeMetarigTypes)
13981363
bpy.utils.unregister_class(SwitchToLegacy)

0 commit comments

Comments
 (0)