2025-08-20 17:04:08 -06:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
# General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2025-08-20 16:59:22 -06:00
|
|
|
|
2025-08-20 17:07:03 -06:00
|
|
|
bl_info = {
|
|
|
|
|
"name": "Dynamic Link Manager",
|
|
|
|
|
"author": "Nathan Lindsay",
|
|
|
|
|
"version": (0, 0, 1),
|
|
|
|
|
"blender": (4, 5, 0),
|
|
|
|
|
"location": "View3D > Sidebar > Dynamic Link Manager",
|
|
|
|
|
"description": "Replace linked assets and characters with ease",
|
|
|
|
|
"warning": "",
|
|
|
|
|
"doc_url": "",
|
|
|
|
|
"category": "Import-Export",
|
|
|
|
|
}
|
2025-08-20 16:59:22 -06:00
|
|
|
|
2025-08-20 17:07:03 -06:00
|
|
|
import bpy
|
|
|
|
|
from bpy.props import StringProperty, BoolProperty, EnumProperty
|
|
|
|
|
from bpy.types import Panel, Operator, PropertyGroup
|
2025-08-20 16:59:22 -06:00
|
|
|
|
2025-08-20 17:07:03 -06:00
|
|
|
# Import local modules
|
|
|
|
|
from . import operators
|
|
|
|
|
from . import ui
|
|
|
|
|
|
2025-08-22 13:25:41 -06:00
|
|
|
def ensure_default_search_path():
|
|
|
|
|
"""Ensure there's always at least one search path"""
|
|
|
|
|
prefs = bpy.context.preferences.addons.get(__name__)
|
|
|
|
|
if prefs and len(prefs.preferences.search_paths) == 0:
|
|
|
|
|
new_path = prefs.preferences.search_paths.add()
|
|
|
|
|
new_path.path = "//" # Default to relative path
|
|
|
|
|
|
2025-08-20 17:07:03 -06:00
|
|
|
def register():
|
|
|
|
|
operators.register()
|
|
|
|
|
ui.register()
|
2025-08-22 13:25:41 -06:00
|
|
|
# Ensure default search path exists
|
|
|
|
|
bpy.app.handlers.load_post.append(ensure_default_search_path)
|
2025-08-20 17:07:03 -06:00
|
|
|
|
|
|
|
|
def unregister():
|
|
|
|
|
ui.unregister()
|
|
|
|
|
operators.unregister()
|
2025-08-22 13:25:41 -06:00
|
|
|
# Remove the handler
|
|
|
|
|
if ensure_default_search_path in bpy.app.handlers.load_post:
|
|
|
|
|
bpy.app.handlers.load_post.remove(ensure_default_search_path)
|
2025-08-20 17:07:03 -06:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
register()
|