Align Objects fails with IndexError: bpy_prop_collection[-1]: out of range. #54075

Closed
opened 2018-02-14 22:35:58 +01:00 by George Angelopoulos · 9 comments

System Information
OS: Arch Linux
GPU: 01:00.0 VGA compatible controller: NVIDIA Corporation GM206 [GeForce GTX 950] (rev a1)

Blender Version
Broken:

Short description of error

Align Objects fails with:

Traceback (most recent call last):
  File "/usr/share/blender/2.79/scripts/startup/bl_operators/object_align.py", line 409, in execute
    self.bb_quality,
  File "/usr/share/blender/2.79/scripts/startup/bl_operators/object_align.py", line 152, in align_objects
    GBB = GlobalBB_HQ(obj)
  File "/usr/share/blender/2.79/scripts/startup/bl_operators/object_align.py", line 77, in GlobalBB_HQ
    val = matrix_world * verts[-1].co
IndexError: bpy_prop_collection[-1]: out of range.

Exact steps for others to reproduce the error

  1. Download my .blend.
  2. The cubes are already selected. Do Spacebar -> Align Objects
  3. Python IndexError

Additional notes
I encountered this bug by chance. I don't know what the simplest reproducer would be. Two notable features of my .blend reproducer are:

  • I'm using multiple instances of the same linked object, a cube.
  • There are two materials on different surfaces of the cube.
  • EDIT apparently I also have some overlapping objects/edges/surfaces.
    This may or may not be relevant. I haven't found a less complex reproducer.

align-bug.blend

**System Information** OS: Arch Linux GPU: 01:00.0 VGA compatible controller: NVIDIA Corporation GM206 [GeForce GTX 950] (rev a1) **Blender Version** Broken: - Stable release: 2.79 8ef39d5c882 - builder build: 2.79 f6107af4cf4 Worked: - No idea **Short description of error** Align Objects fails with: ``` Traceback (most recent call last): File "/usr/share/blender/2.79/scripts/startup/bl_operators/object_align.py", line 409, in execute self.bb_quality, File "/usr/share/blender/2.79/scripts/startup/bl_operators/object_align.py", line 152, in align_objects GBB = GlobalBB_HQ(obj) File "/usr/share/blender/2.79/scripts/startup/bl_operators/object_align.py", line 77, in GlobalBB_HQ val = matrix_world * verts[-1].co IndexError: bpy_prop_collection[-1]: out of range. ``` **Exact steps for others to reproduce the error** 1. Download my .blend. 2. The cubes are already selected. Do Spacebar -> Align Objects 3. Python IndexError **Additional notes** I encountered this bug by chance. I don't know what the simplest reproducer would be. Two notable features of my .blend reproducer are: * I'm using multiple instances of the same linked object, a cube. * There are two materials on different surfaces of the cube. * *EDIT* apparently I also have some overlapping objects/edges/surfaces. This may or may not be relevant. I haven't found a less complex reproducer. [align-bug.blend](https://archive.blender.org/developer/F2277497/align-bug.blend)

Added subscriber: @george-4

Added subscriber: @george-4

Added subscriber: @cyaoeu

Added subscriber: @cyaoeu

You've got a bunch of objects using mesh data Cube which doesn't have any vertices, the operator uses the vertices to find out where it should align (or something like that) so it fails when there are no vertices. If you isolate the objects that actually are the cubes (using mesh data Cube.001) it works fine. Did you mean to have empty mesh objects instead of using for example Empties?

You've got a bunch of objects using mesh data Cube which doesn't have any vertices, the operator uses the vertices to find out where it should align (or something like that) so it fails when there are no vertices. If you isolate the objects that actually are the cubes (using mesh data Cube.001) it works fine. Did you mean to have empty mesh objects instead of using for example Empties?

Hi Henrik, thanks for the very fast response.

Did you mean to

I'm generally not quite sure what I meant to do cause I'm a noob. Please bear with me!

In this case I meant to select only the cubes with mesh data Cube.001.
I guess it makes sense that you can't align an empty object with no vertices.
Looking at the Outliner I still can't spot what is selected aside from the cubes. :S

Hi Henrik, thanks for the very fast response. > Did you mean to I'm generally not quite sure what I meant to do cause I'm a noob. Please bear with me! In this case I meant to select only the cubes with mesh data Cube.001. I guess it makes sense that you can't align an empty object with no vertices. Looking at the Outliner I still can't spot what is selected aside from the cubes. :S

In #54075#484623, @george-4 wrote:
Hi Henrik, thanks for the very fast response.

Did you mean to

I'm generally not quite sure what I meant to do cause I'm a noob. Please bear with me!

In this case I meant to select only the cubes with mesh data Cube.001.
I guess it makes sense that you can't align an empty object with no vertices.
Looking at the Outliner I still can't spot what is selected aside from the cubes. :S

You can deselect all objects and then run this (copy into the text editor and click Run Script):

import bpy

for obj in bpy.data.objects:
    if obj.data.name == "Cube":
        obj.select = True

All of the objects with the Cube mesh data (that has no vertices) will be selected, you can move them to another layer or delete them if you don't actually need them. Right now they don't really do anything from what I can see anyway. After doing that and only selecting the cubes that are left you should be able to align them.

> In #54075#484623, @george-4 wrote: > Hi Henrik, thanks for the very fast response. > >> Did you mean to > > I'm generally not quite sure what I meant to do cause I'm a noob. Please bear with me! > > In this case I meant to select only the cubes with mesh data Cube.001. > I guess it makes sense that you can't align an empty object with no vertices. > Looking at the Outliner I still can't spot what is selected aside from the cubes. :S You can deselect all objects and then run this (copy into the text editor and click Run Script): ``` import bpy for obj in bpy.data.objects: if obj.data.name == "Cube": obj.select = True ``` All of the objects with the Cube mesh data (that has no vertices) will be selected, you can move them to another layer or delete them if you don't actually need them. Right now they don't really do anything from what I can see anyway. After doing that and only selecting the cubes that are left you should be able to align them.

Ok. I see what's happening now. I also learned how to use the text editor today. ?

As I said, I'm very new to blender and I just saw "python exception" and my python instincts said I should open a bug report. If this sort of exception is considered trivial or low priority please feel free to close this task. I'll be more careful what I select in the future.

Ok. I see what's happening now. I also learned how to use the text editor today. ? As I said, I'm very new to blender and I just saw "python exception" and my python instincts said I should open a bug report. If this sort of exception is considered trivial or low priority please feel free to close this task. I'll be more careful what I select in the future.

In #54075#484625, @george-4 wrote:
Ok. I see what's happening now. I also learned how to use the text editor today. ?

As I said, I'm very new to blender and I just saw "python exception" and my python instincts said I should open a bug report. If this sort of exception is considered trivial or low priority please feel free to close this task. I'll be more careful what I select in the future.

You can report it here if it's a script/addon bundled with Blender meaning it's in the Blender software folder\2.79\scripts folder, if it's a user addon (AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons) you will have to tell the person that actually made that addon. In your case I think it's a bug with this particular script though.

You could also try googling the exception error and see what it means if you're interested in python scripting, maybe you can fix it yourself. In this particular case it's not that easy though.

> In #54075#484625, @george-4 wrote: > Ok. I see what's happening now. I also learned how to use the text editor today. ? > > As I said, I'm very new to blender and I just saw "python exception" and my python instincts said I should open a bug report. If this sort of exception is considered trivial or low priority please feel free to close this task. I'll be more careful what I select in the future. You can report it here if it's a script/addon bundled with Blender meaning it's in the Blender software folder\2.79\scripts folder, if it's a user addon (AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons) you will have to tell the person that actually made that addon. In your case I think it's a bug with this particular script though. You could also try googling the exception error and see what it means if you're interested in python scripting, maybe you can fix it yourself. In this particular case it's not that easy though.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

This issue was referenced by 58ba89b5be

This issue was referenced by 58ba89b5bec5a2b7b74ef93fe18f0a3811cb48db
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#54075
No description provided.