(name: str)
| 1140 | @when(parsers.parse('the object "{name}" exists')) |
| 1141 | @then(parsers.parse('the object "{name}" exists')) |
| 1142 | def the_object_name_exists(name: str) -> bpy.types.Object: |
| 1143 | # Some objects from linked collections may share the same name. This disambiguates them. |
| 1144 | if name.startswith("Col:"): |
| 1145 | _, collection_name, name = name.split(":") |
| 1146 | obj = bpy.data.collections.get(collection_name).objects.get(name) |
| 1147 | else: |
| 1148 | obj = bpy.data.objects.get(name) |
| 1149 | if not obj: |
| 1150 | debug = "\n".join([o.name for o in bpy.data.objects]) |
| 1151 | assert False, f'The object "{name}" does not exist:\n{debug}' |
| 1152 | return obj |
| 1153 | |
| 1154 | |
| 1155 | @then(parsers.parse('the object "{name}" does not exist')) |
no test coverage detected