PointerPropety of ID sub type doesn't work as Operator attribute
Closed, InvalidPublic

Description

Blender Version 2.78-9 29ec0b1 buildbot build

Short description of error
PointerProperty pointing at ID sub class is not working if used as Operator property.
It will return:

AttributeError: 'set' object has no attribute 'test_prop'

Example:

import bpy

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    test_prop = bpy.props.PointerProperty(type = bpy.types.Object)
    
    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        print(self.test_prop)
        return {'FINISHED'}


def register():
    bpy.utils.register_class(SimpleOperator)


def unregister():
    bpy.utils.unregister_class(SimpleOperator)


if __name__ == "__main__":
    register()

    # test call
    op = bpy.ops.object.simple_operator()
    op.test_prop = bpy.context.active_object

Details

Type
Bug
Bastien Montagne (mont29) closed this task as "Invalid".Wed, Jul 19, 11:00 AM
Bastien Montagne (mont29) claimed this task.

PointerProperty is not supposed to work in Operator at all (technically, we have no 'runtime' definition for Ppinter RNA property type).

In any case, that would be horribly crasher guaranteed, since pointers get changed all the time internally. Just pass ID references as pair of strings e.g. (name of ID, name of its lib if applicable).