fix: macos-arm64 cannot install
fix: better layer fill smooth filter
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import bpy
|
||||
|
||||
|
||||
import bmesh
|
||||
|
||||
from ..nodes import custom_nodes
|
||||
from ..bioxel.io import load_container, save_container
|
||||
from ..bioxelutils.layer import get_all_layer_objs
|
||||
from ..bioxelutils.container import (container_to_obj, obj_to_container,
|
||||
get_container_objs_from_selection)
|
||||
from ..bioxelutils.node import get_nodes_by_type, move_node_between_nodes, move_node_to_node
|
||||
from .utils import get_cache_dir, select_object
|
||||
from .utils import change_render_setting, get_cache_dir, get_preferences, select_object
|
||||
|
||||
|
||||
class SaveContainer(bpy.types.Operator):
|
||||
@@ -59,11 +61,16 @@ class LoadContainer(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
load_path = self.filepath
|
||||
container = load_container(self.filepath)
|
||||
is_first_import = len(get_all_layer_objs()) == 0
|
||||
|
||||
container_obj = container_to_obj(container,
|
||||
scene_scale=0.01,
|
||||
cache_dir=get_cache_dir(context))
|
||||
select_object(container_obj)
|
||||
|
||||
if is_first_import:
|
||||
change_render_setting(context)
|
||||
|
||||
self.report({"INFO"}, f"Successfully load {load_path}")
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ from ..bioxelutils.container import (Container,
|
||||
get_container_objs_from_selection)
|
||||
from ..bioxel.parse import (DICOM_EXTS, SUPPORT_EXTS,
|
||||
get_ext, parse_volumetric_data)
|
||||
from .utils import (get_cache_dir, get_preferences,
|
||||
from .utils import (change_render_setting, get_cache_dir, get_preferences,
|
||||
progress_update, progress_bar, select_object)
|
||||
|
||||
# 3rd-party
|
||||
@@ -674,26 +674,8 @@ class ImportVolumetricDataDialog(bpy.types.Operator):
|
||||
select_object(container_obj)
|
||||
|
||||
# Change render setting for better result
|
||||
preferences = get_preferences(context)
|
||||
if preferences.do_change_render_setting and is_first_import:
|
||||
bpy.context.scene.render.engine = 'CYCLES'
|
||||
try:
|
||||
bpy.context.scene.cycles.shading_system = True
|
||||
bpy.context.scene.cycles.volume_bounces = 12
|
||||
bpy.context.scene.cycles.transparent_max_bounces = 16
|
||||
bpy.context.scene.cycles.volume_preview_step_rate = 10
|
||||
bpy.context.scene.cycles.volume_step_rate = 10
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
bpy.context.scene.eevee.use_taa_reprojection = False
|
||||
bpy.context.scene.eevee.volumetric_tile_size = '2'
|
||||
bpy.context.scene.eevee.volumetric_shadow_samples = 128
|
||||
bpy.context.scene.eevee.volumetric_samples = 256
|
||||
bpy.context.scene.eevee.use_volumetric_shadows = True
|
||||
except:
|
||||
pass
|
||||
if is_first_import:
|
||||
change_render_setting(context)
|
||||
|
||||
self.report({"INFO"}, "Successfully Imported")
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -3,6 +3,29 @@ from pathlib import Path
|
||||
from .. import __package__ as base_package
|
||||
|
||||
|
||||
def change_render_setting(context):
|
||||
preferences = get_preferences(context)
|
||||
if preferences.do_change_render_setting:
|
||||
bpy.context.scene.render.engine = 'CYCLES'
|
||||
try:
|
||||
bpy.context.scene.cycles.shading_system = True
|
||||
bpy.context.scene.cycles.volume_bounces = 12
|
||||
bpy.context.scene.cycles.transparent_max_bounces = 16
|
||||
bpy.context.scene.cycles.volume_preview_step_rate = 10
|
||||
bpy.context.scene.cycles.volume_step_rate = 10
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
bpy.context.scene.eevee.use_taa_reprojection = False
|
||||
bpy.context.scene.eevee.volumetric_tile_size = '2'
|
||||
bpy.context.scene.eevee.volumetric_shadow_samples = 128
|
||||
bpy.context.scene.eevee.volumetric_samples = 256
|
||||
bpy.context.scene.eevee.use_volumetric_shadows = True
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def select_object(target_obj):
|
||||
for obj in bpy.data.objects:
|
||||
obj.select_set(False)
|
||||
|
||||
Reference in New Issue
Block a user