Page MenuHome

CollectionProperty declarations throwing errors randomly
Closed, ArchivedPublic

Description

System Information
Operating system: Win 10
Graphics card: NVIDIA GTX 1060

Blender Version
Broken: 2.80, 2019-01-22

Short description of error
CollectionProperty randomly throwing registration error.

Exact steps for others to reproduce the error
Declarations are as follows:

 class RenderLayersToInclude(bpy.types.PropertyGroup):
	layerName: bpy.props.StringProperty()
	isIncluded: bpy.props.BoolProperty()

 class ConfigCreatorOperator(bpy.types.Operator):
        ....
    	layersToInclude : bpy.props.CollectionProperty(type=RenderLayersToInclude)
        ....

        def invoke(self, context):
              .....
              self.layersToInclude.clear()
              .....

Full error is as follows

TypeError: CollectionProperty(...): expected an RNA type, failed with: RuntimeError: , missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered)

GPUFrameBuffer: framebuffer status GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
Traceback (most recent call last):

File "E:\dmw\dmwTools\blenderScripts\modules\dmw\rqmanager\blender\configCreator.py", line 44, in invoke
  self.layersToInclude.clear()
File "E:\dmw\software\blender\2.80-beta\2.80\scripts\modules\bpy_types.py", line 657, in __getattribute__
  return super().__getattribute__(attr)

AttributeError: 'ConfigCreatorOperator' object has no attribute 'layersToInclude'

Details

Type
Bug

Event Timeline

Jacques Lucke (JacquesLucke) triaged this task as Needs Information from User priority.Feb 4 2019, 12:06 PM

Did you register RenderLayersToInclude before you registered ConfigCreatorOperator?

Yes... I registered RenderLayersToInclude before ConfigCreatorOperator

Error is not consistant... It'll error out very randomly / unpredictable. There are no preferences or any initialization lines before registering.

Here is registration code (snapshot)

Can you share a small complete example that we can use to reproduce the issue?


Find bug behavior in above video attachment. It errors out very randomly. No specific pattern.

Find source code below (video is recorded with following source code only)

Jacques Lucke (JacquesLucke) claimed this task.

I found two problems in the code.

  1. The dtrClasses object is a set instead of tuple or list. In Python sets have no ordering guarantees (yet?). That is probably the reason why the problem only appears sometimes.
  2. You call register_class in the unregister function.
  1. You're correct. I changed it to tuple and no there's no error after that. Thanks for correction. I didn't know ordering issue with sets. New learning today :)
  1. It's my bad. While trimming code base to provide example for you, I made that mistake.

We can close this ticket.