Files
Bioxel/src/bioxelnodes/menus.py
Nan ae7868d410 5.0 (#60)
* feat: Add Bioxel asset catalog and layer management functionality

- Introduced a new asset catalog definition file for Blender to manage Bioxel assets.
- Implemented layer caching and snapshot functionality in `layer.py`, allowing for VDB file generation and low-resolution snapshots.
- Created node management functions in `node.py` for handling Bioxel nodes within Blender's Geometry Node Editor.
- Added an operator to extract mesh data from selected nodes in `structure.py`.
- Developed UI panels in `panels.py` for layer management, including import options and layer library display.

* Add unit tests for bioxel module and documentation

- Created README.md for test instructions and categories.
- Implemented comprehensive unit tests for the Data, Layer, and utility functions in the bioxel module.
- Added tests for reading NRRD and DICOM formats, data properties, and edge cases.
- Included tests for real data files to ensure functionality with actual datasets.

* feat: Update .gitattributes and .gitignore for improved asset management and ignore patterns

chore: Add app.json and omoolab.css for Obsidian integration

refactor: Clean up AGENTS.md and remove outdated test files

* feat: Update .gitignore to include scipy_ndimage directory

* feat: Update release workflow and manifest for improved dependency management and layer handling

* feat: Update .gitignore and add binary files for scipy_ndimage across multiple platforms

* feat: Add OPSX commands for archiving, exploring, and proposing changes

* feat: Refactor asset library management and update manifest for improved organization

* feat: Downgrade h5py version to 3.14.0 in requirements and manifest

* feat: Update Help operator and panel labels to use English terminology

* Translate documentation to Chinese, add support format details, and enhance styling with new fonts. Update mkdocs configuration for multilingual support and improve package dependencies.

* feat: Remove default version setting from extra configuration in mkdocs.yml

* fix: Update documentation links to point to the correct URLs for Chinese and English versions

* Add documentation for basic usage, supported formats, and performance tips

- Created English and Chinese documentation for basic usage of the add-on, including data download, import, extraction, and rendering steps.
- Added support format documentation listing compatible file types for the add-on.
- Included links to open databases for volumetric data.
- Provided performance improvement tips for voxel reconstruction and rendering, including settings for low-resolution previews and balanced rendering configurations.
2026-05-26 16:01:29 +08:00

106 lines
2.7 KiB
Python

import bpy
from .operators.structure import ExtractMesh
from .operators.io import ImportAsLabel, ImportAsScalar, ImportAsColor
from .operators.misc import (
CleanTemp,
Help,
RenderSettingPreset,
TogglePhantom,
)
class ImportLayerMenu(bpy.types.Menu):
bl_idname = "BIOXEL_MT_IMPORTLAYER"
bl_label = "Import Volumetric Data (Init)"
bl_icon = "FILE_NEW"
def draw(self, context):
layout = self.layout
layout.operator(ImportAsScalar.bl_idname, text="as Scalar")
layout.operator(ImportAsLabel.bl_idname, text="as Label")
layout.operator(ImportAsColor.bl_idname, text="as Color")
class RenderSettingMenu(bpy.types.Menu):
bl_idname = "BIOXEL_MT_RENDER"
bl_label = "Render Setting Presets"
def draw(self, context):
layout = self.layout
for k, v in RenderSettingPreset.PRESETS.items():
op = layout.operator(RenderSettingPreset.bl_idname, text=v)
op.preset = k
class DangerZoneMenu(bpy.types.Menu):
bl_idname = "BIOXEL_MT_DANGER"
bl_label = "Danger Zone"
def draw(self, context):
layout = self.layout
layout.operator(CleanTemp.bl_idname)
class BioxelNodesTopbarMenu(bpy.types.Menu):
bl_idname = "BIOXEL_MT_TOPBAR"
bl_label = "Bioxel Nodes"
def draw(self, context):
layout = self.layout
layout.separator()
layout.menu(DangerZoneMenu.bl_idname)
layout.separator()
layout.operator(Help.bl_idname, icon=Help.bl_icon)
class NodeContextMenu(bpy.types.Menu):
bl_idname = "BIOXEL_MT_NODE_CONTEXT"
bl_label = "Bioxel Nodes"
bl_icon = "FILE_VOLUME"
def draw(self, context):
layout = self.layout
layout.operator(ExtractMesh.bl_idname)
class ObjectContextMenu(bpy.types.Menu):
bl_idname = "BIOXEL_MT_OBJECT_CONTEXT"
bl_label = "Bioxel Nodes"
bl_icon = "FILE_VOLUME"
def draw(self, context):
layout = self.layout
layout.operator(TogglePhantom.bl_idname)
def NODE_CONTEXT(self, context):
container_obj = context.object
is_geo_nodes = context.area.ui_type == "GeometryNodeTree"
if not is_geo_nodes or not container_obj:
return
layout = self.layout
layout.separator()
layout.menu(NodeContextMenu.bl_idname)
# 定义添加到右键菜单的函数,放在首位
def OBJECT_CONTEXT(self, context):
layout = self.layout
layout.separator()
layout.menu(ObjectContextMenu.bl_idname)
def add():
bpy.types.VIEW3D_MT_object_context_menu.append(OBJECT_CONTEXT)
# bpy.types.NODE_MT_context_menu.append(NODE_CONTEXT)
def remove():
bpy.types.VIEW3D_MT_object_context_menu.remove(OBJECT_CONTEXT)
# bpy.types.NODE_MT_context_menu.remove(NODE_CONTEXT)