diff --git a/README.md b/README.md index c815341..2ab0217 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,24 @@ **Import your robot in Blender and create a nice render of it!** -https://github.com/ami-iit/blend-my-bot/assets/29798643/c224cd56-1d90-42dd-aec5-960a13690ce7 + ## 🐍 Requirements - [`python3`]() -- [`Blender 3.6`]() +- [`Blender 4`]() - [`iDynTree`]() - [`numpy`]() -- [`bpy 3.6`]() +- [`bpy 4`]() -Note: This library has been tested with the `appimage` version of Blender 3.6. You should use a Python version that matches the one supported by the Blender version. +> [!NOTE] +> You should use a Python version that matches the one supported by the Blender version. +> For example, Blender 4 supports Python 3.10 -Note 2: This library does not define the rig of the robot. For this, you can use a library such as [`blender-robotics-utils`](https://github.com/robotology/blender-robotics-utils). +> [!NOTE] +> This library does not define the rig of the robot. For this, you can use a library such as [`blender-robotics-utils`](https://github.com/robotology/blender-robotics-utils). ## πŸ’Ύ Installation @@ -114,6 +117,8 @@ Having the meshes in an `obj` format, instead, will give a nicer and more colorf ## 🦿 Troubleshooting +#### FileNotFoundError when running the script + If you install a new package in the conda environment but it is not working as you expect when you run the script, try to activate it in a terminal **before** and then open `Visual Studio Code` from the terminal: ```bash @@ -129,6 +134,10 @@ FileNotFoundError: resolve-robotics-uri-py: No file corresponding to uri "packag This is due to the fact that environmental variables are not sourced. Activating the conda environment before opening `vscode` solves this issue! +#### Crush when running the script + +If Blender crashes when running the script from `Visual Studio Code`, try to run the script from the `Scripting` tab of Blender. + ## πŸ¦Έβ€β™‚οΈ Contributing `blend-my-bot` is an open-source project. Contributions are very welcome! diff --git a/setup.cfg b/setup.cfg index bc87486..de772e9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,7 +20,7 @@ python_requires = >=3.10 install_requires = idyntree numpy - bpy==3.6 + bpy [options.packages.find] where = src diff --git a/src/blend_my_bot/model_importer.py b/src/blend_my_bot/model_importer.py index f3c051b..2cae267 100644 --- a/src/blend_my_bot/model_importer.py +++ b/src/blend_my_bot/model_importer.py @@ -1,10 +1,11 @@ from dataclasses import dataclass from typing import List + import bpy import idyntree.bindings as idyntree import numpy as np -from blend_my_bot import Link, BlenderModel +from blend_my_bot import BlenderModel, Link @dataclass @@ -99,7 +100,7 @@ def import_links( mesh = bpy.data.objects[mesh_name] elif mesh_path.endswith(".obj"): print(f"Importing {mesh_path}") - bpy.ops.import_scene.obj(filepath=mesh_path) + bpy.ops.wm.obj_import(filepath=mesh_path) mesh = bpy.context.selected_objects[0] elif mesh_path.endswith(".stl"): print(f"Importing {mesh_path}")