3

I have a series of frames, which contain user-entered meta data. After a render I have to retrieve the user entered values.

The path shown is:

bpy.types.OBJECT_OT_paperdoll_operator.title_frame_1

Yet I get an error:

>>> print(bpy.types.OBJECT_OT_paperdoll_operator.title_frame_1)
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
AttributeError: type object 'PaperDoll' has no attribute 'title_frame_1'

In this case, it should return the string "This is Frame 1 meta"

So obviously I am missing something.

enter image description here

CodeManX
  • 29,298
  • 3
  • 89
  • 128
user5266
  • 161
  • 3

1 Answers1

5

What you access via bpy.types is just the type / class, what you are after are the properties of an instance of that class.

It would be best to store the user data in global properties, but if you really want to access the active operator's properties (that's what is shown in the redo panel), use bpy.context.active_operator:

>>> C.active_operator
<bpy_struct, Operator("TRANSFORM_OT_translate")>

>>> C.active_operator.properties['value']
<bpy id property array [3]>

>>> C.active_operator.properties['value'][:]
(0.17133378982543945, -1.7650548219680786, -1.7467097043991089)

>>> C.active_operator.value
Vector((0.17133378982543945, -1.7650548219680786, -1.7467097043991089))

Note that Macro properties need to be accessed in the following way:

>>> C.active_operator.properties.keys()
['OBJECT_OT_duplicate', 'TRANSFORM_OT_translate']

>>> C.active_operator.OBJECT_OT_duplicate.linked
False
CodeManX
  • 29,298
  • 3
  • 89
  • 128
  • A bit THANK YOU SIR. Yes, that was it. On a separate note, can you point me to the information on how to store things in user data like you say? – user5266 Nov 23 '14 at 03:10
  • See http://blender.stackexchange.com/questions/2075/assign-datablock-to-custom-property and http://www.blender.org/api/blender_python_api_2_72_release/ – CodeManX Nov 23 '14 at 12:31