Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
508e6858d7 | ||
| 1c49fbb813 | |||
| 35e405acd8 | |||
|
|
68748f509a |
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "bioxelnodes"
|
||||
version = "1.0.8"
|
||||
version = "1.0.9"
|
||||
description = ""
|
||||
authors = [{ name = "Ma Nan", email = "icrdr2010@outlook.com" }]
|
||||
requires-python = ">=3.11.0,<3.12.dev0"
|
||||
|
||||
Binary file not shown.
@@ -95,7 +95,7 @@ def add_layers(layers: list[Layer],
|
||||
if len(output_node.inputs[0].links) == 0:
|
||||
node_group.links.new(fetch_node.outputs[0],
|
||||
output_node.inputs[0])
|
||||
move_node_to_node(fetch_node, output_node, (-600, 0))
|
||||
move_node_to_node(fetch_node, output_node, (-900, 0))
|
||||
else:
|
||||
move_node_to_node(fetch_node, output_node, (0, -100 * (i+1)))
|
||||
|
||||
@@ -164,4 +164,23 @@ def container_to_obj(container: Container,
|
||||
container_obj=container_obj,
|
||||
cache_dir=cache_dir)
|
||||
|
||||
try:
|
||||
layer_node = get_nodes_by_type(
|
||||
node_group, "BioxelNodes_FetchLayer")[0]
|
||||
center_node = add_node_to_graph("ReCenter",
|
||||
node_group,
|
||||
use_link=get_use_link())
|
||||
|
||||
output_node = get_output_node(node_group)
|
||||
|
||||
node_group.links.new(layer_node.outputs[0],
|
||||
center_node.inputs[0])
|
||||
node_group.links.new(center_node.outputs[0],
|
||||
output_node.inputs[0])
|
||||
|
||||
move_node_to_node(center_node, layer_node, (300, 0))
|
||||
bpy.ops.bioxelnodes.add_slicer('EXEC_DEFAULT')
|
||||
except:
|
||||
pass
|
||||
|
||||
return container_obj
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
schema_version = "1.0.0"
|
||||
|
||||
id = "bioxelnodes"
|
||||
version = "1.0.8"
|
||||
version = "1.0.9"
|
||||
name = "Bioxel Nodes"
|
||||
tagline = "For scientific volumetric data visualization in Blender"
|
||||
maintainer = "Ma Nan <icrdr2010@outlook.com>"
|
||||
|
||||
@@ -419,7 +419,7 @@ node_menu = NodeMenu(
|
||||
|
||||
def add():
|
||||
node_menu.register()
|
||||
bpy.types.VIEW3D_HT_header.append(VIEW3D_TOPBAR)
|
||||
# bpy.types.VIEW3D_HT_header.append(VIEW3D_TOPBAR)
|
||||
bpy.types.TOPBAR_MT_editor_menus.append(TOPBAR)
|
||||
bpy.types.NODE_PT_node_tree_properties.prepend(NODE_PROP)
|
||||
bpy.types.NODE_MT_editor_menus.append(NODE_HEAD)
|
||||
@@ -427,7 +427,7 @@ def add():
|
||||
|
||||
|
||||
def remove():
|
||||
bpy.types.VIEW3D_HT_header.remove(VIEW3D_TOPBAR)
|
||||
# bpy.types.VIEW3D_HT_header.remove(VIEW3D_TOPBAR)
|
||||
bpy.types.TOPBAR_MT_editor_menus.remove(TOPBAR)
|
||||
bpy.types.NODE_PT_node_tree_properties.remove(NODE_PROP)
|
||||
bpy.types.NODE_MT_editor_menus.remove(NODE_HEAD)
|
||||
|
||||
@@ -510,6 +510,10 @@ class AddLocator(bpy.types.Operator):
|
||||
|
||||
modifier = container_obj.modifiers[0]
|
||||
node_group = modifier.node_group
|
||||
try:
|
||||
selected_node = context.selected_nodes[0]
|
||||
except:
|
||||
selected_node = None
|
||||
|
||||
parent_node = add_node_to_graph("TransformParent",
|
||||
node_group,
|
||||
@@ -518,20 +522,37 @@ class AddLocator(bpy.types.Operator):
|
||||
|
||||
parent_node.inputs[1].default_value = locator_obj
|
||||
|
||||
output_node = get_output_node(node_group)
|
||||
|
||||
if len(output_node.inputs[0].links) == 0:
|
||||
node_group.links.new(parent_node.outputs[0],
|
||||
output_node.inputs[0])
|
||||
move_node_to_node(parent_node, output_node, (-300, 0))
|
||||
if selected_node is None or len(selected_node.outputs) == 0:
|
||||
output_node = get_output_node(node_group)
|
||||
if len(output_node.inputs[0].links) == 0:
|
||||
node_group.links.new(parent_node.outputs[0],
|
||||
output_node.inputs[0])
|
||||
move_node_to_node(parent_node, output_node, (-300, 0))
|
||||
else:
|
||||
pre_output_node = output_node.inputs[0].links[0].from_node
|
||||
node_group.links.new(pre_output_node.outputs[0],
|
||||
parent_node.inputs[0])
|
||||
node_group.links.new(parent_node.outputs[0],
|
||||
output_node.inputs[0])
|
||||
move_node_between_nodes(parent_node,
|
||||
[pre_output_node, output_node])
|
||||
else:
|
||||
pre_output_node = output_node.inputs[0].links[0].from_node
|
||||
node_group.links.new(pre_output_node.outputs[0],
|
||||
parent_node.inputs[0])
|
||||
node_group.links.new(parent_node.outputs[0],
|
||||
output_node.inputs[0])
|
||||
move_node_between_nodes(parent_node,
|
||||
[pre_output_node, output_node])
|
||||
try:
|
||||
to_node = selected_node.outputs[0].links[0].to_node
|
||||
except:
|
||||
to_node = None
|
||||
|
||||
if to_node is None:
|
||||
node_group.links.new(selected_node.outputs[0],
|
||||
parent_node.inputs[0])
|
||||
move_node_to_node(parent_node, selected_node, (300, 0))
|
||||
else:
|
||||
node_group.links.new(selected_node.outputs[0],
|
||||
parent_node.inputs[0])
|
||||
node_group.links.new(parent_node.outputs[0],
|
||||
to_node.inputs[0])
|
||||
move_node_between_nodes(parent_node,
|
||||
[selected_node, to_node])
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import threading
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
from ..exceptions import CancelledByUser
|
||||
from ..props import BIOXELNODES_Series
|
||||
from ..bioxelutils.common import (get_all_layer_objs, get_container_obj,
|
||||
@@ -16,8 +17,7 @@ from ..bioxel.layer import Layer
|
||||
from ..bioxel.parse import (DICOM_EXTS, SUPPORT_EXTS,
|
||||
get_ext, parse_volumetric_data)
|
||||
|
||||
from ..utils import (get_cache_dir,
|
||||
progress_update, progress_bar,
|
||||
from ..utils import (get_cache_dir, progress_update, progress_bar,
|
||||
select_object)
|
||||
|
||||
# 3rd-party
|
||||
@@ -666,7 +666,7 @@ class ImportVolumetricDataDialog(bpy.types.Operator):
|
||||
|
||||
# Gamma Correct
|
||||
# data = data ** 2.2
|
||||
|
||||
|
||||
name = self.layer_name or "Color"
|
||||
if data.shape[4] == 1:
|
||||
data = np.repeat(data, repeats=3, axis=4)
|
||||
@@ -854,10 +854,25 @@ class ImportVolumetricDataDialog(bpy.types.Operator):
|
||||
|
||||
# Change render setting for better result
|
||||
if is_first_import:
|
||||
bpy.ops.bioxelnodes.render_setting_preset('EXEC_DEFAULT',
|
||||
preset="balance")
|
||||
bpy.context.scene.render.engine = 'CYCLES'
|
||||
bpy.ops.bioxelnodes.slice_viewer('EXEC_DEFAULT')
|
||||
try:
|
||||
bpy.ops.bioxelnodes.render_setting_preset('EXEC_DEFAULT',
|
||||
preset="balance")
|
||||
bpy.ops.bioxelnodes.add_eevee_env('EXEC_DEFAULT')
|
||||
bpy.context.scene.eevee.use_taa_reprojection = False
|
||||
bpy.context.scene.render.engine = 'BLENDER_EEVEE_NEXT'
|
||||
|
||||
view_3d = None
|
||||
if context.area.type == 'VIEW_3D':
|
||||
view_3d = context.area
|
||||
else:
|
||||
for area in context.screen.areas:
|
||||
if area.type == 'VIEW_3D':
|
||||
view_3d = area
|
||||
break
|
||||
if view_3d:
|
||||
view_3d.spaces[0].shading.type = 'RENDERED'
|
||||
except:
|
||||
self.report({"WARNING"}, "Fail to change render setting.")
|
||||
|
||||
self.report({"INFO"}, "Successfully Imported")
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -147,6 +147,7 @@ class RenderSettingPreset(bpy.types.Operator):
|
||||
if self.preset == "performance":
|
||||
# EEVEE
|
||||
# bpy.context.scene.eevee.use_taa_reprojection = False
|
||||
bpy.context.scene.eevee.use_shadow_jitter_viewport = True
|
||||
bpy.context.scene.eevee.volumetric_tile_size = '2'
|
||||
bpy.context.scene.eevee.volumetric_shadow_samples = 32
|
||||
bpy.context.scene.eevee.volumetric_samples = 64
|
||||
@@ -154,7 +155,6 @@ class RenderSettingPreset(bpy.types.Operator):
|
||||
bpy.context.scene.eevee.use_volumetric_shadows = True
|
||||
|
||||
# Cycles
|
||||
bpy.context.scene.cycles.shading_system = True
|
||||
bpy.context.scene.cycles.volume_bounces = 0
|
||||
bpy.context.scene.cycles.transparent_max_bounces = 4
|
||||
bpy.context.scene.cycles.volume_preview_step_rate = 4
|
||||
@@ -163,6 +163,7 @@ class RenderSettingPreset(bpy.types.Operator):
|
||||
elif self.preset == "balance":
|
||||
# EEVEE
|
||||
# bpy.context.scene.eevee.use_taa_reprojection = False
|
||||
bpy.context.scene.eevee.use_shadow_jitter_viewport = True
|
||||
bpy.context.scene.eevee.volumetric_tile_size = '2'
|
||||
bpy.context.scene.eevee.volumetric_shadow_samples = 64
|
||||
bpy.context.scene.eevee.volumetric_samples = 128
|
||||
@@ -170,7 +171,6 @@ class RenderSettingPreset(bpy.types.Operator):
|
||||
bpy.context.scene.eevee.use_volumetric_shadows = True
|
||||
|
||||
# Cycles
|
||||
bpy.context.scene.cycles.shading_system = True
|
||||
bpy.context.scene.cycles.volume_bounces = 4
|
||||
bpy.context.scene.cycles.transparent_max_bounces = 8
|
||||
bpy.context.scene.cycles.volume_preview_step_rate = 1
|
||||
@@ -179,6 +179,7 @@ class RenderSettingPreset(bpy.types.Operator):
|
||||
elif self.preset == "quality":
|
||||
# EEVEE
|
||||
# bpy.context.scene.eevee.use_taa_reprojection = False
|
||||
bpy.context.scene.eevee.use_shadow_jitter_viewport = True
|
||||
bpy.context.scene.eevee.volumetric_tile_size = '2'
|
||||
bpy.context.scene.eevee.volumetric_shadow_samples = 128
|
||||
bpy.context.scene.eevee.volumetric_samples = 256
|
||||
@@ -186,7 +187,6 @@ class RenderSettingPreset(bpy.types.Operator):
|
||||
bpy.context.scene.eevee.use_volumetric_shadows = True
|
||||
|
||||
# Cycles
|
||||
bpy.context.scene.cycles.shading_system = True
|
||||
bpy.context.scene.cycles.volume_bounces = 8
|
||||
bpy.context.scene.cycles.transparent_max_bounces = 16
|
||||
bpy.context.scene.cycles.volume_preview_step_rate = 0.5
|
||||
@@ -296,28 +296,6 @@ class AddEeveeEnv(bpy.types.Operator):
|
||||
directory=f"{str(LATEST_NODE_LIB_PATH)}/Object",
|
||||
filename="EeveeEnv"
|
||||
)
|
||||
# bpy.ops.object.light_add(
|
||||
# type='POINT', align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
|
||||
# light_obj = bpy.context.active_object
|
||||
# light_obj.name = "EeveeEnv"
|
||||
# light_obj.data.shadow_soft_size = 100
|
||||
# light_obj.data.energy = 1e+06
|
||||
# light_obj.data.color = (0.1, 0.1, 0.1)
|
||||
# light_obj.data.use_shadow = False
|
||||
# light_obj.data.diffuse_factor = 0
|
||||
# light_obj.data.specular_factor = 0
|
||||
# light_obj.data.transmission_factor = 0
|
||||
|
||||
# light_obj.hide_select = True
|
||||
# light_obj.lock_location[0] = True
|
||||
# light_obj.lock_location[1] = True
|
||||
# light_obj.lock_location[2] = True
|
||||
# light_obj.lock_rotation[0] = True
|
||||
# light_obj.lock_rotation[1] = True
|
||||
# light_obj.lock_rotation[2] = True
|
||||
# light_obj.lock_scale[0] = True
|
||||
# light_obj.lock_scale[1] = True
|
||||
# light_obj.lock_scale[2] = True
|
||||
|
||||
bpy.context.scene.eevee.use_shadows = True
|
||||
bpy.context.scene.eevee.use_volumetric_shadows = True
|
||||
|
||||
Reference in New Issue
Block a user