I'm fairly new to using Blender's API, and Python for that matter, and just can't find the answer to my question elsewhere so here it goes:
I have a PropertryGroup and I want to write the names and the values of the contained properties into a file. They are mostly floats and 2 booleans.
My PropertyGroup ist for example looking like this:
class ExampleFloatPropertyGroup(bpy.types.PropertyGroup):
float_a = bpy.props.FloatProperty \
(
name = "Float A",
description = "Contains the value of Float A",
default = 1.0
)
float_b = bpy.props.FloatProperty \
(
name = "Float B",
description = "Contains the value of Float B",
default = 2.0
)
Within my operator I'm using it like this:
example_floats = bpy.props.PointerProperty(type = ExampleFloatPropertyGroup)
And so far everything works fine. I can work with it, pass it on to other classes, they can work with it and so on.
Now I tried to access the information that I need by using .items()
or .keys()
. For example like this example_floats.items()
.But as long as the values in my PropertyGroup are set to default, I'm only getting a completly empty return looking like this []
As soon as I change one of the values from default to something else, the returns are no longer empty but I only get the values that I did change, but still not the ones that are still set to default.
Also I'm only getting the key and the current value. I would also like to Access the property's attribute name
. In this case "Float A" or "Float B".
So as the titles states, how can I iterate the single properties contained in a PropertyGroup, while retrieving the value and the name of the propertie?
I'm sure there is a relatively easy solution, but I was not able to work around that problem after hitting google for quite some time today.
Any help is greatly appreciated!