From c7b80e1c706a7c30f0ddd879a70b2f855a444f5a Mon Sep 17 00:00:00 2001 From: giulero Date: Fri, 19 Jul 2024 17:39:51 +0200 Subject: [PATCH 1/6] Import obj importer to api 4 one --- src/blend_my_bot/model_importer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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}") From 1ffa9868ee925282339977d102933cdbcad4a1df Mon Sep 17 00:00:00 2001 From: giulero Date: Fri, 19 Jul 2024 17:44:01 +0200 Subject: [PATCH 2/6] Remove required bpy version 3.6 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 7aa2b4e059822a65aacb5ba90675ba1c967b7c0f Mon Sep 17 00:00:00 2001 From: giulero Date: Fri, 19 Jul 2024 17:44:37 +0200 Subject: [PATCH 3/6] Update Blender version to 4 in README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c815341..a4bd90d 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,14 @@ https://github.com/ami-iit/blend-my-bot/assets/29798643/c224cd56-1d90-42dd-aec5- ## 🐍 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). From bc08ada7745a99e64df1322394e46b6b689e782d Mon Sep 17 00:00:00 2001 From: giulero Date: Fri, 19 Jul 2024 17:47:17 +0200 Subject: [PATCH 4/6] Add troubleshooting solution when blender crushes in vscode --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a4bd90d..6a51361 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **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 + @@ -116,6 +116,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 @@ -125,6 +127,10 @@ code . For example, when using [`resolve_robotics_uri_py`](https://github.com/ami-iit/resolve-robotics-uri-py) an error like the following one appears: +#### 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. + ``` FileNotFoundError: resolve-robotics-uri-py: No file corresponding to uri "package://iCub/robots/iCubGazeboV2_7/model.urdf" found ``` From 5c405357a4b502163d29cf04742251bbf40bccf6 Mon Sep 17 00:00:00 2001 From: giulero Date: Fri, 19 Jul 2024 17:49:26 +0200 Subject: [PATCH 5/6] Update --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a51361..00ca14a 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ > 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 From e8378386ab1f6029475283c4aea01e819332cc36 Mon Sep 17 00:00:00 2001 From: giulero Date: Fri, 19 Jul 2024 17:50:45 +0200 Subject: [PATCH 6/6] Fix section --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 00ca14a..2ab0217 100644 --- a/README.md +++ b/README.md @@ -128,16 +128,16 @@ code . For example, when using [`resolve_robotics_uri_py`](https://github.com/ami-iit/resolve-robotics-uri-py) an error like the following one appears: -#### 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. - ``` FileNotFoundError: resolve-robotics-uri-py: No file corresponding to uri "package://iCub/robots/iCubGazeboV2_7/model.urdf" found ``` 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!