work
save startup blend for animation tab & whatnot
This commit is contained in:
@@ -26,10 +26,6 @@ class BUTTON_OT_change_key(bpy.types.Operator):
|
||||
|
||||
property_prefix: bpy.props.StringProperty()
|
||||
|
||||
def __init__(self):
|
||||
self.prefs = None
|
||||
self.my_event = ''
|
||||
|
||||
def invoke(self, context, event):
|
||||
prefs = context.preferences.addons[base_package].preferences
|
||||
self.prefs = prefs
|
||||
@@ -57,7 +53,7 @@ class BUTTON_OT_change_key(bpy.types.Operator):
|
||||
|
||||
|
||||
def add_keymap():
|
||||
km = bpy.context.window_manager.keyconfigs.addon.keymaps.new(name="Window")
|
||||
km = bpy.context.window_manager.keyconfigs.active.keymaps.new(name="Window")
|
||||
prefs = bpy.context.preferences.addons[base_package].preferences
|
||||
|
||||
kmi = km.keymap_items.new(idname='wm.call_panel', type=prefs.renaming_panel_type, value='PRESS',
|
||||
@@ -80,7 +76,7 @@ def add_key_to_keymap(idname, kmi, km, active=True):
|
||||
def remove_key(context, idname, properties_name):
|
||||
"""Removes addon hotkeys from the keymap"""
|
||||
wm = bpy.context.window_manager
|
||||
km = wm.keyconfigs.addon.keymaps['Window']
|
||||
km = wm.keyconfigs.active.keymaps['Window']
|
||||
|
||||
for kmi in km.keymap_items:
|
||||
if kmi.idname == idname and kmi.properties.name == properties_name:
|
||||
@@ -91,7 +87,7 @@ def remove_keymap():
|
||||
"""Removes keys from the keymap. Currently, this is only called when unregistering the addon. """
|
||||
# only works for menus and pie menus
|
||||
wm = bpy.context.window_manager
|
||||
km = wm.keyconfigs.addon.keymaps['Window']
|
||||
km = wm.keyconfigs.active.keymaps['Window']
|
||||
|
||||
for kmi in km.keymap_items:
|
||||
if hasattr(kmi.properties, 'name') and kmi.properties.name in ['VIEW3D_PT_tools_renaming_panel',
|
||||
|
||||
@@ -7,7 +7,6 @@ from bpy.props import (
|
||||
|
||||
from .renaming_keymap import remove_key
|
||||
from .. import __package__ as base_package
|
||||
from ..ui.renaming_panels import VIEW3D_PT_tools_renaming_panel, VIEW3D_PT_tools_type_suffix
|
||||
|
||||
|
||||
def label_multiline(context, text, parent):
|
||||
@@ -29,7 +28,7 @@ def add_key(km, idname, properties_name, button_assignment_type, button_assignme
|
||||
def update_key(context, operation, operator_name, property_prefix):
|
||||
# This functions gets called when the hotkey assignment is updated in the preferences
|
||||
wm = context.window_manager
|
||||
km = wm.keyconfigs.addon.keymaps["Window"]
|
||||
km = wm.keyconfigs.active.keymaps["Window"]
|
||||
|
||||
prefs = context.preferences.addons[base_package].preferences
|
||||
|
||||
@@ -51,6 +50,7 @@ def update_suf_pre_key(self, context):
|
||||
|
||||
def update_panel_category(self, context):
|
||||
"""Update panel tab for collider tools"""
|
||||
from ..ui.renaming_panels import VIEW3D_PT_tools_renaming_panel, VIEW3D_PT_tools_type_suffix
|
||||
|
||||
panels = [
|
||||
VIEW3D_PT_tools_renaming_panel,
|
||||
@@ -70,6 +70,7 @@ def update_panel_category(self, context):
|
||||
|
||||
|
||||
def toggle_suffix_prefix_panel(self, context):
|
||||
from ..ui.renaming_panels import VIEW3D_PT_tools_type_suffix
|
||||
if self.renaming_show_suffix_prefix_panel:
|
||||
bpy.utils.register_class(VIEW3D_PT_tools_type_suffix)
|
||||
else:
|
||||
@@ -107,6 +108,12 @@ class VIEW3D_OT_renaming_preferences(bpy.types.AddonPreferences):
|
||||
default=True,
|
||||
)
|
||||
|
||||
debug_timing: bpy.props.BoolProperty(
|
||||
name="Debug Timing",
|
||||
description="Print operator execution time to the console after each rename operation",
|
||||
default=False,
|
||||
)
|
||||
|
||||
renamingPanel_useObjectOrder: bpy.props.BoolProperty(
|
||||
name="Use Selection Order",
|
||||
description="Use the order of selection when renaming objects",
|
||||
@@ -162,6 +169,25 @@ class VIEW3D_OT_renaming_preferences(bpy.types.AddonPreferences):
|
||||
default='',
|
||||
)
|
||||
|
||||
date_format: StringProperty(
|
||||
name="Date Format",
|
||||
description=(
|
||||
"strftime format string for the @d variable. "
|
||||
"Codes: %d=day(03), %m=month(04), %y=year(26), %Y=year(2026), %b=month abbr(Apr). "
|
||||
"Examples: %d%m%Y → 03042026 (DDMMYYYY), %m%d%y → 040326 (MMDDYY), %d%b%Y → 03Apr2026"
|
||||
),
|
||||
default="%y%m%d",
|
||||
)
|
||||
time_format: StringProperty(
|
||||
name="Time Format",
|
||||
description=(
|
||||
"strftime format string for the @i variable. "
|
||||
"Codes: %H=hour 24h(14), %M=minute(30), %S=second(05), %I=hour 12h(02), %p=AM/PM. "
|
||||
"Example: %H%M → 1430. Avoid colons — invalid in filenames on Windows"
|
||||
),
|
||||
default="%H%M",
|
||||
)
|
||||
|
||||
renaming_show_suffix_prefix_panel: bpy.props.BoolProperty(
|
||||
name="Prefix/Suffix by Type Panel",
|
||||
description="Enable or disable the Prefix/Suffix by Type Panel",
|
||||
@@ -185,7 +211,7 @@ class VIEW3D_OT_renaming_preferences(bpy.types.AddonPreferences):
|
||||
"renamingPanel_showPopup",
|
||||
"renaming_show_suffix_prefix_panel",
|
||||
"renamingPanel_useObjectOrder",
|
||||
|
||||
"debug_timing",
|
||||
]
|
||||
props_naming = [
|
||||
"renaming_separator",
|
||||
@@ -205,6 +231,11 @@ class VIEW3D_OT_renaming_preferences(bpy.types.AddonPreferences):
|
||||
"renaming_user3"
|
||||
]
|
||||
|
||||
props_date_time = [
|
||||
"date_format",
|
||||
"time_format",
|
||||
]
|
||||
|
||||
renaming_panel_type: bpy.props.StringProperty(
|
||||
name="Renaming Popup",
|
||||
default="F2",
|
||||
@@ -325,6 +356,13 @@ class VIEW3D_OT_renaming_preferences(bpy.types.AddonPreferences):
|
||||
row = box.row()
|
||||
row.prop(self, propName)
|
||||
|
||||
box = layout.box()
|
||||
row = box.row()
|
||||
row.label(text='Date & Time Variables')
|
||||
for propName in self.props_date_time:
|
||||
row = box.row()
|
||||
row.prop(self, propName)
|
||||
|
||||
box = layout.box()
|
||||
row = box.row()
|
||||
row.label(text='User Variables')
|
||||
|
||||
Reference in New Issue
Block a user