-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Description
Describe the bug
When I use phobos.blender.operators.io.createRobot to create a robot, I encounter the following error. My current workaround is to comment out bpy.ops.view3d.view_selected().
Traceback (most recent call last):
File "C:\Users\hesic\Yearly_Archive\25fall\bpy_render_hand\tmp.py", line 35, in <module>
main(args)
File "C:\Users\hesic\Yearly_Archive\25fall\bpy_render_hand\tmp.py", line 23, in main
createRobot(robot)
File "C:\Users\hesic\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\phobos\blender\io\phobos2blender.py", line 629, in createRobot
bpy.ops.view3d.view_selected()
File "C:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\bpy\ops.py", line 109, in __call__
ret = _op_call(self.idname_py(), kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Operator bpy.ops.view3d.view_selected.poll() expected a view3d region
To Reproduce
"C:\Program Files\Blender Foundation\Blender 4.2\blender.exe" --python tmp.py -- --urdf "urdf path"tmp.py:
import sys
import argparse
import bpy
import phobos
from phobos.blender.operators.io import createRobot
def remove_default_cube():
if "Cube" in bpy.data.objects:
bpy.data.objects["Cube"].select_set(True)
bpy.ops.object.delete()
print("Default cube removed.")
def main(args):
remove_default_cube()
robot = phobos.core.Robot(
inputfile=args.urdf,
)
createRobot(robot)
if "--" in sys.argv:
args_start_index = sys.argv.index("--") + 1
script_args = sys.argv[args_start_index:]
else:
script_args = []
parser = argparse.ArgumentParser()
parser.add_argument("--urdf", type=str, required=True, help="Path to the URDF file")
args = parser.parse_args(script_args)
main(args)Expected behavior
The URDF should load successfully without errors.
Screenshots
As the error occurs at the end of the function, the urdf is correctly loaded.
Desktop (please complete the following information):
- OS: Windows 11
- Blender version 4.2.14
- Phobos 2.0.2 "Perilled Pangolin"
Update: I encountered the same issue on Ubuntu 24.04 and am using the same workaround.
Additional context
I use this urdf:
https://github.com/dexsuite/dex-urdf/blob/main/robots/hands/allegro_hand/allegro_hand_right_glb.urdf
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels