dfki-ric / phobos

An add-on for Blender allowing to create URDF, SDF and SMURF robot models in a WYSIWYG environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[pre_v2.0.0] Create Collision Objects by mesh

brothermechanic opened this issue · comments

Describe the bug
Create Collision Objects by mesh don't works (any other options like cube - works)

To Reproduce
Steps to reproduce the behavior:

  1. Run bpy.ops.phobos.create_collision_objects() ("Create Collision Objects")
  2. Select type - Mesh
  3. See error
Error: Python: Traceback (most recent call last):
  File "/home/bm/.config/blender/3.5/scripts/addons/phobos/blender/operators/editing.py", line 1343, in execute
    bpy.ops.object.transform_apply(location=False, rotation=False, scale=True, properties=False)
  File "/usr/share/blender/3.5/scripts/modules/bpy/ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Error: Cannot apply to a multi user: Object "grip_rotator_collision", Mesh "Part__Feature007.003", aborting

Expected behavior
In Phobos v1 it works

Desktop:

  • OS: Gentoo
  • Version: ~amd64

Thanks @brothermechanic for your bug reports, this is really a great help, which I appreciate a lot!
Please let me ḱnow whether fc80018 solves your issue.
The commented lines seem to be a residue from an older version. As collision are allowed to use the same mesh as their visual to reduce the size of the exported model. Therefore applying the scale only to the collision doesn't make sense.

@hwiedPro Hi,
Error message has changed

Python: Traceback (most recent call last):
  File "/home/bm/.config/blender/3.5/scripts/addons/phobos/blender/operators/editing.py", line 1282, in execute
    phobos_vis = blender2phobos.deriveVisual(vis)
  File "/home/bm/.config/blender/3.5/scripts/addons/phobos/blender/io/blender2phobos.py", line 189, in deriveVisual
    material = deriveMaterial(obj.active_material, logging=logging)
  File "/home/bm/.config/blender/3.5/scripts/addons/phobos/blender/io/blender2phobos.py", line 50, in deriveMaterial
    if "No material defined." in errors:
TypeError: argument of type 'NoneType' is not iterable

56d64f4 should take care of this

@hwiedPro new error message

Error: Python: Traceback (most recent call last):
  File "/home/bm/.config/blender/3.5/scripts/addons/phobos/blender/operators/editing.py", line 1318, in execute
    origin=representation.Pose.from_matrix(phobos_vis.origin.to_matrix().dot(transform))
TypeError: Pose.from_matrix() missing 1 required positional argument: 'relative_to'

i think collision wants be relative from armature object, but can't find it

Perfect that you have found that. To facilitate more profound SDF support I recently made the relative_to property mandatory for all Poses. I thought I had found all usages but some seem to have slipped through. I'll push the fix asap

Ok, please try again ;)

Python: Traceback (most recent call last):
  File "/home/bm/.config/blender/3.5/scripts/addons/phobos/blender/operators/editing.py", line 1282, in execute
    phobos_vis = blender2phobos.deriveVisual(vis)
  File "/home/bm/.config/blender/3.5/scripts/addons/phobos/blender/io/blender2phobos.py", line 189, in deriveVisual
    material = deriveMaterial(obj.active_material, logging=logging)
  File "/home/bm/.config/blender/3.5/scripts/addons/phobos/blender/io/blender2phobos.py", line 85, in deriveMaterial
    return representation.Material(
  File "/home/bm/.config/blender/3.5/scripts/addons/phobos/io/representation.py", line 322, in __init__
    self.specular = misc.color_parser(rgba=specular)
  File "/home/bm/.config/blender/3.5/scripts/addons/phobos/utils/misc.py", line 328, in color_parser
    raise Exception(f'Invalid color argument count for argument "{out}"')
Exception: Invalid color argument count for argument "<Color (r=1.0000, g=1.0000, b=1.0000)>"

Thanks, this was a not yet handled blender color type in the color parser. Should be fixed now.

I consider this as solved, please reopen if not.