How heisenshark/blender-krita-link-plugin works
Project Type and Purpose
• This project is a plugin that bridges functionality between Blender and Krita – primarily to allow seamless texture editing by linking Blender’s textures with Krita files.
• The README explains that it is split into two main parts: the Blender add-on and the Krita plugin (with an optional C++ component for advanced UV selection). Its purpose is to synchronize image data and UV maps between the two applications.
Analyzing the File Structure
• Notice two main top-level “components”: the Blender side (directories named “BlenderKritaLink”) and the Krita side (directories and files under “KritaBlenderLink” and “KritaBlenderLink.desktop”).
• There are separate Python modules for connection handling, image management, UI definitions, and specific actions. For example:
• The Python modules (e.g., connection.py, image_manager.py, uv_extractor.py, watch.py) in the BlenderKritaLink directory represent the backend logic for the Blender part.
• In the KritaBlenderLink directory, there are UI components (e.g., .ui files, ImageItem.py, ImageList.py) and additional settings and action scripts.
• A separate directory “cppPart” includes a subdirectory “uv-select” with C++ source files and associated build files that extend functionality – particularly for selecting UV faces.
README Insight
• The README clarifies the deployment separation: one part goes to Blender’s addons directory and the other to Krita’s plugin directory.
a. Main Components:
• BLENDER PLUGIN:
• Components: Core Python modules (e.g., connection.py, image_manager.py, uv_extractor.py, watch.py) that handle communication and image/UV data management.
• KRITA PLUGIN:
• Components: Python UI components (e.g., ImageList, ImageItem), settings, actions, and connection logic.
• OPTIONAL C++ UVSelection Module:
• Components: The “uv-select” module (UvSelect.cpp, UvSelect.h) that integrates with Krita for UV face selection.
• CONNECTIVITY LAYER:
• Component: The connection module (present in both BlenderKritaLink and KritaBlenderLink directories) forming the link between Blender and Krita.
b. Relationships and Interactions:
• That when a user triggers an action in Krita (e.g., “Send Data” or “Select” for UV maps), it communicates with Blender via the connection module.
• If the optional C++ module is installed, highlight that the Krita plugin calls into this module to enhance UV selection capabilities.
c. Architectural Patterns and Design Principles:
• The system exhibits a plugin-based architecture with clear separation of concerns:
• The Blender and Krita sides operate as independent plugins integrated into their respective hosts.
• Use of a dedicated connection module in both environments hints at a loosely coupled design.
• The design favors modularity: UI, connection logic, and business logic (image management and UV extraction) are segmented into their own modules.
• Use of platform APIs (Blender’s Add-ons, Krita’s Python Plugin Manager) and native extensions in C++.
d. Relevant Technologies, Frameworks, or Libraries:
• Python as the main language for both parts of the plugin.
• Qt (implied by the .ui files used for Krita interfaces).
• C++ for the Optional UV selection module.
• Build system for C++ (CMake via the CMakeLists.txt in cppPart/uv-select).