Page MenuHome

Empty plain axes should not be too empty (object.data should not be None in python)
Closed, ArchivedPublic

Description

Blender Version
Broken: version: 2.83.19, branch: master, commit date: 2022-02-01 20:05, hash: rB86c526d2c733
Worked: (newest version of Blender that worked as expected)

Addon Information
Name: BoltFactory (0, 4, 0)
Author: Aaron Keith

Short description of error

AttributeError Traceback (most recent call last)
C:\Program Files\Blender Foundation\Blender 2.83\2.83\scripts\addons\add_mesh_BoltFactory\Boltfactory.py in execute(self, context)

340         if bpy.context.mode == "OBJECT":
341             if context.selected_objects != [] and context.active_object and \

--> 342 ('Bolt' in context.active_object.data.keys()) and (self.change == True):

343                 obj = context.active_object
344                 oldmesh = obj.data

AttributeError: 'NoneType' object has no attribute 'keys'

Exact steps for others to reproduce the error

import bpy
bpy.ops.wm.read_homefile(app_template="")

bpy.ops.object.empty_add(type='PLAIN_AXES', align='CURSOR')
bpy.ops.preferences.addon_enable(module="add_mesh_BoltFactory")

#make sure python get interrupted, other wise it will get another error, which is more common but more reasonable.
bpy.ops.mesh.bolt_add()

*tried workaround**

When the active object is Empty, no matter it is plain axes or cone, try adding a bolt will cause the error.

so that add a new mesh before add bolt, and then unlink, and then remove, and then del it can avoid the problem.

Event Timeline

This is already fixed in rBA69751991311a165e97a48ea67ed60e2c6022ee63. But not available in 2.83, so you will have to update the add-on or Blender.