Skip to content

4.1 Compatibility #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
current_folder = os.path.dirname(os.path.abspath(__file__))
if current_folder not in sys.path:
sys.path.append(current_folder)
# add paths of external libraries to sys.path
if os.path.exists(os.path.join(current_folder, "extern")):
external_libs = ["fileseq/src", "meshio/src", "python-future/src", "rich"]
for lib in external_libs:
lib_path = os.path.join(current_folder, "extern", lib)
if lib_path not in sys.path:
sys.path.append(lib_path)


if bpy.context.preferences.filepaths.use_relative_paths == True:
bpy.context.preferences.filepaths.use_relative_paths = False
Expand Down
12 changes: 9 additions & 3 deletions bseq/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def create_or_retrieve_attribute(mesh, k, v):
if len(v.shape) == 2:
dim = v.shape[1]
if dim > 3:
show_message_box('higher than 3 dimensional attribue, ignored')
# show_message_box('higher than 3 dimensional attribue, ignored')
return None
if dim == 1:
return mesh.attributes.new(k, "FLOAT", "POINT")
Expand All @@ -113,7 +113,7 @@ def create_or_retrieve_attribute(mesh, k, v):
if dim == 3:
return mesh.attributes.new(k, "FLOAT_VECTOR", "POINT")
if len(v.shape) > 2:
show_message_box('more than 2 dimensional tensor, ignored')
# show_message_box('more than 2 dimensional tensor, ignored')
return None
else:
return mesh.attributes[k]
Expand Down Expand Up @@ -192,6 +192,8 @@ def update_mesh(meshio_mesh, mesh):
for k, v in meshio_mesh.point_data.items():
k = "bseq_" + k
attribute = create_or_retrieve_attribute(mesh, k, v)
if attribute is None:
continue
name_string = None
if attribute.data_type == "FLOAT":
name_string = "value"
Expand All @@ -202,7 +204,11 @@ def update_mesh(meshio_mesh, mesh):

# set as split normal per vertex
if mesh.BSEQ.split_norm_att_name and mesh.BSEQ.split_norm_att_name == k:
mesh.use_auto_smooth = True
# If blender version is less than 4.1.0, then dont set auto smooth.
# It has been removed and normals will be used automatically if they are set.
# https://developer.blender.org/docs/release_notes/4.1/python_api/#mesh
if bpy.app.version < (4, 1, 0):
mesh.use_auto_smooth = True
mesh.normals_split_custom_set_from_vertices(v)

for k, v in meshio_mesh.field_data.items():
Expand Down