Empty plain axes should not be too empty (object.data should not be None in python) #96970

Closed
opened 2022-04-02 03:00:24 +02:00 by Xiao Tom · 4 comments

Blender Version
Broken: version: 2.83.19, branch: master, commit date: 2022-02-01 20:05, hash: blender/blender@86c526d2c7
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()

image.png

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.

**Blender Version** Broken: version: 2.83.19, branch: master, commit date: 2022-02-01 20:05, hash: `blender/blender@86c526d2c7` 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() ![image.png](https://archive.blender.org/developer/F12963010/image.png) *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.
Author

Added subscriber: @tom_xiao

Added subscriber: @tom_xiao
Member

Added subscriber: @OmarEmaraDev

Added subscriber: @OmarEmaraDev
Member

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Member

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

This is already fixed in 6975199131. But not available in 2.83, so you will have to update the add-on or Blender.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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-addons#96970
No description provided.