docs: README.md
This commit is contained in:
@@ -6,14 +6,14 @@ import bpy
|
||||
|
||||
|
||||
bl_info = {
|
||||
"name": "BiovelNodes",
|
||||
"name": "Biovel Nodes",
|
||||
"author": "Ma Nan",
|
||||
"description": "",
|
||||
"blender": (4, 0, 0),
|
||||
"blender": (4, 1, 0),
|
||||
"version": (0, 1, 0),
|
||||
"location": "File -> Import",
|
||||
"warning": "",
|
||||
"category": "Import-Export"
|
||||
"category": "Node"
|
||||
}
|
||||
|
||||
auto_load.init()
|
||||
|
||||
@@ -373,7 +373,7 @@ class EXTERNALPACKAGE_OT_Install_Package(bpy.types.Operator):
|
||||
)
|
||||
|
||||
result = installer.install_package(f"{self.package}=={self.version}")
|
||||
if result.returncode == 0 and installer.is_installed(self.package):
|
||||
if result.returncode == 0 or installer.is_installed(self.package):
|
||||
self.report(
|
||||
{'INFO'},
|
||||
f"Successfully installed {self.package} v{self.version}"
|
||||
@@ -381,9 +381,7 @@ class EXTERNALPACKAGE_OT_Install_Package(bpy.types.Operator):
|
||||
else:
|
||||
self.report(
|
||||
{'ERROR'},
|
||||
f"""
|
||||
Error installing package. Please check the log files
|
||||
in {preferences.log_dir}.
|
||||
"""
|
||||
f"""Error installing package. Please check the log files
|
||||
in {preferences.log_dir}."""
|
||||
)
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -23,7 +23,7 @@ def get_data_files(filepath: str):
|
||||
return extract_last_number(file.stem)
|
||||
|
||||
files.sort(key=last_number)
|
||||
files = [f.as_posix() for f in files]
|
||||
files = [str(f) for f in files]
|
||||
return files
|
||||
|
||||
|
||||
@@ -136,15 +136,14 @@ class ImportDICOMDialog(bpy.types.Operator):
|
||||
self.report({"WARNING"}, "Not Supported extension.")
|
||||
return {'CANCELLED'}
|
||||
|
||||
file_path = Path(self.filepath).resolve()
|
||||
name = file_path.parent.name
|
||||
|
||||
files = get_data_files(self.filepath)
|
||||
name = Path(self.filepath).parent.name
|
||||
|
||||
import SimpleITK as sitk
|
||||
image = sitk.ReadImage(files)
|
||||
|
||||
bioxel_size = float(self.bioxel_size)
|
||||
|
||||
orig_spacing = tuple(self.orig_spacing)
|
||||
image_spacing = image.GetSpacing()
|
||||
image_shape = image.GetSize()
|
||||
@@ -243,13 +242,13 @@ class ImportDICOMDialog(bpy.types.Operator):
|
||||
vdb_dirpath.mkdir(parents=True, exist_ok=True)
|
||||
vdb_path = Path(vdb_dirpath, f"{uuid4()}.vdb")
|
||||
|
||||
print(f"Storing the VDB file ({vdb_path.as_posix()})...")
|
||||
vdb.write(vdb_path.as_posix(), grids=[grid])
|
||||
print(f"Storing the VDB file ({str(vdb_path)})...")
|
||||
vdb.write(str(vdb_path), grids=[grid])
|
||||
|
||||
# Read VDB
|
||||
print(f"Importing the VDB file to Blender scene...")
|
||||
bpy.ops.object.volume_import(
|
||||
filepath=vdb_path.as_posix(), align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
|
||||
filepath=str(vdb_path), align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
|
||||
|
||||
bioxels_obj = bpy.context.active_object
|
||||
|
||||
@@ -482,5 +481,7 @@ class ExportVDB(bpy.types.Operator):
|
||||
# print('output_path', output_path)
|
||||
# print('source_path', source_path)
|
||||
shutil.copy(source_path, output_path)
|
||||
|
||||
self.report({"INFO"}, "Successfully Exported")
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -9,8 +9,8 @@ def add_driver_to_node_factory(source_prop, target_prop):
|
||||
import bpy
|
||||
from bioxelnodes.utils import add_direct_driver, get_bioxels_obj
|
||||
bioxels_obj = get_bioxels_obj(bpy.context.active_object)
|
||||
container_obj = bioxels_obj.parent
|
||||
if bioxels_obj:
|
||||
container_obj = bioxels_obj.parent
|
||||
add_direct_driver(
|
||||
target=node,
|
||||
target_prop='{target_prop}',
|
||||
@@ -28,9 +28,10 @@ def set_prop_to_node_factory(source_prop, target_prop):
|
||||
import bpy
|
||||
from bioxelnodes.utils import get_bioxels_obj
|
||||
bioxels_obj = get_bioxels_obj(bpy.context.active_object)
|
||||
container_obj = bioxels_obj.parent
|
||||
if bioxels_obj:
|
||||
node.inputs.get('{target_prop}').default_value = container_obj.get('{source_prop}')
|
||||
container_obj = bioxels_obj.parent
|
||||
node.inputs.get('{target_prop}').default_value = container_obj.get(
|
||||
'{source_prop}')
|
||||
else:
|
||||
print('Cannot find any bioxels.')
|
||||
"""
|
||||
@@ -44,7 +45,7 @@ MENU_ITEMS = [
|
||||
'items': [
|
||||
{
|
||||
'label': 'Segment',
|
||||
'icon': 'OUTLINER_OB_META',
|
||||
'icon': 'BONE_DATA',
|
||||
'node_type': 'BioxelNodes_Segment',
|
||||
'node_description': '',
|
||||
'node_callback': "\n".join([
|
||||
@@ -54,7 +55,7 @@ MENU_ITEMS = [
|
||||
},
|
||||
{
|
||||
'label': 'Anatomy',
|
||||
'icon': 'OUTLINER_OB_META',
|
||||
'icon': 'CONSTRAINT_BONE',
|
||||
'node_type': 'BioxelNodes_Anatomy',
|
||||
'node_description': '',
|
||||
'node_callback': "\n".join([
|
||||
@@ -141,6 +142,6 @@ MENU_ITEMS = [
|
||||
custom_nodes = CustomNodes(
|
||||
menu_items=MENU_ITEMS,
|
||||
nodes_file=Path(__file__).parent/"assets/Nodes.blend",
|
||||
root_label='BioxelNodes',
|
||||
root_label='Bioxel Nodes',
|
||||
root_icon="FILE_VOLUME",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user