Skip to content

Commit 8b862b3

Browse files
committed
feat: add primitive cutter
fix: eevee shadow fix: save node toggle not work fix: color over 1.0 fail to render
1 parent 99ce5c2 commit 8b862b3

File tree

6 files changed

+60
-46
lines changed

6 files changed

+60
-46
lines changed

bioxelnodes/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"author": "Ma Nan",
1010
"description": "",
1111
"blender": (4, 1, 0),
12-
"version": (0, 2, 5),
12+
"version": (0, 2, 6),
1313
"location": "File -> Import",
1414
"warning": "",
1515
"category": "Node"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:98a47b3c20b3c84bbde76395b182da5a875931dee615192400af495f47927faf
3-
size 6159997
2+
oid sha256:09e23fa95ee7262a284e2539ec5873e32100116ebaa17374c0bb97923c24aeb5
3+
size 6508765

bioxelnodes/nodes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@
173173
'node_description': ''
174174
},
175175
"separator",
176+
{
177+
'label': 'Primitive Cutter',
178+
'icon': 'MOD_LINEART',
179+
'node_type': 'BioxelNodes_PrimitiveCutter',
180+
'node_description': ''
181+
},
182+
"separator",
176183
{
177184
'label': 'Plane Cutter',
178185
'icon': 'MESH_PLANE',

bioxelnodes/save.py

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -31,60 +31,67 @@ class SaveAllToShare(bpy.types.Operator):
3131
bl_label = "Save All Staged Data"
3232
bl_description = "Save all staged data for sharing"
3333

34+
save_layer: bpy.props.BoolProperty(
35+
name="Save Layer VDB Cache",
36+
default=True,
37+
) # type: ignore
38+
3439
layer_dir: bpy.props.StringProperty(
3540
name="Layer Directory",
3641
subtype='DIR_PATH',
3742
default="//"
3843
) # type: ignore
3944

40-
save_node: bpy.props.BoolProperty(
45+
save_lib: bpy.props.BoolProperty(
4146
name="Save Node Library File",
4247
default=True,
4348
) # type: ignore
4449

45-
node_file_dir: bpy.props.StringProperty(
50+
lib_dir: bpy.props.StringProperty(
4651
name="Library Directory",
4752
subtype='DIR_PATH',
4853
default="//"
4954
) # type: ignore
5055

5156
def execute(self, context):
52-
files = []
53-
for classname in dir(bpy.types):
54-
if CLASS_PREFIX in classname:
55-
cls = getattr(bpy.types, classname)
56-
files.append(cls.nodes_file)
57-
files = list(set(files))
58-
59-
for file in files:
60-
file_name = Path(file).name
61-
# "//"
62-
node_file_dir = bpy.path.abspath(self.node_file_dir)
63-
64-
output_path: Path = Path(node_file_dir, file_name).resolve()
65-
source_path: Path = Path(file).resolve()
66-
67-
if output_path != source_path:
68-
shutil.copy(source_path, output_path)
69-
70-
for lib in bpy.data.libraries:
71-
lib_path = Path(bpy.path.abspath(lib.filepath)).resolve()
72-
if lib_path == source_path:
73-
blend_path = Path(bpy.path.abspath("//")).resolve()
74-
lib.filepath = bpy.path.relpath(
75-
str(output_path), start=str(blend_path))
76-
77-
self.report({"INFO"}, f"Successfully saved to {output_path}")
78-
79-
layers = get_all_layers()
80-
for layer in layers:
81-
try:
82-
save_layer(layer, self.layer_dir)
83-
except:
84-
self.report(
85-
{"WARNING"}, f"Fail to save {layer.name}, skiped")
86-
87-
self.report({"INFO"}, f"Successfully saved bioxel layers.")
57+
if self.save_lib:
58+
files = []
59+
for classname in dir(bpy.types):
60+
if CLASS_PREFIX in classname:
61+
cls = getattr(bpy.types, classname)
62+
files.append(cls.nodes_file)
63+
files = list(set(files))
64+
65+
for file in files:
66+
file_name = Path(file).name
67+
# "//"
68+
lib_dir = bpy.path.abspath(self.lib_dir)
69+
70+
output_path: Path = Path(lib_dir, file_name).resolve()
71+
source_path: Path = Path(file).resolve()
72+
73+
if output_path != source_path:
74+
shutil.copy(source_path, output_path)
75+
76+
for lib in bpy.data.libraries:
77+
lib_path = Path(bpy.path.abspath(lib.filepath)).resolve()
78+
if lib_path == source_path:
79+
blend_path = Path(bpy.path.abspath("//")).resolve()
80+
lib.filepath = bpy.path.relpath(
81+
str(output_path), start=str(blend_path))
82+
83+
self.report({"INFO"}, f"Successfully saved to {output_path}")
84+
85+
if self.save_layer:
86+
layers = get_all_layers()
87+
for layer in layers:
88+
try:
89+
save_layer(layer, self.layer_dir)
90+
except:
91+
self.report(
92+
{"WARNING"}, f"Fail to save {layer.name}, skiped")
93+
94+
self.report({"INFO"}, f"Successfully saved bioxel layers.")
8895

8996
return {'FINISHED'}
9097

@@ -100,11 +107,11 @@ def poll(cls, context):
100107
def draw(self, context):
101108
layout = self.layout
102109
panel = layout.box()
110+
panel.prop(self, "save_layer")
103111
panel.prop(self, "layer_dir")
104112
panel = layout.box()
105-
panel.prop(self, "save_node")
106-
panel.prop(self, "node_file_dir")
107-
layout.label(text="Save your blender file first.")
113+
panel.prop(self, "save_lib")
114+
panel.prop(self, "lib_dir")
108115

109116

110117
def save_layer(layer, output_dir):

extension/blender_manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ schema_version = "1.0.0"
33
# Example of manifest file for a Blender extension
44
# Change the values according to your extension
55
id = "bioxelnodes"
6-
version = "0.2.5"
6+
version = "0.2.6"
77
name = "Bioxel Nodes"
88
tagline = "For scientific volumetric data visualization in Blender"
99
maintainer = "Ma Nan <icrdr2010@outlook.com>"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "bioxelnodes"
3-
version = "0.2.5"
3+
version = "0.2.6"
44
description = ""
55
authors = ["Ma Nan <icrdr2010@outlook.com>"]
66
license = "MIT"

0 commit comments

Comments
 (0)