2
$\begingroup$

I have a PropertyGroup with let's say a property called prop.

I set prop like this:

propGroup['prop'] = something

and then access it like this:

propGroup.prop

If prop is a StringProperty is gives me the original value, but with an IntProperty or FloatProperty it gives me always 0.

And I tested reading the property with propGroup['prop'], it works so it's not type or affectation problem (I think).

I'm using Blender 2.78.5.

[EDIT]

After some research I understand now that the subscription accessing (propGroup['prop']) is for custom ID properties.

So now my question is: is there a way to access a non custom property (defined with propGroup.prop = IntProperty()) automatically with the name string name of the property?

I have a str which contains 'prop' and I want to access propGroup.prop.

[EDIT 2]

Obviously it's not clear in my mind!

I read again this page: https://wiki.blender.org/index.php/Doc%3A2.6/Manual/Extensions/Python/Properties and I don't understand well the difference between dynamic and non-dynamic custom properties.

So in my case I have a property group where I defined non dynamic custom properties (like this propGroup.prop = IntProperty()) and I want to access it with a string variable.

It works with StringProperty but not with IntProperty or FloatProperty. So I'm confused. Do you know if this behaviour is normal with the blender API?

$\endgroup$
2
  • $\begingroup$ What exactly is the question here? An old but good blender wiki about props. and from the manual $\endgroup$
    – batFINGER
    Aug 4, 2017 at 18:21
  • $\begingroup$ Yes thank you I read several times the wiki, but as you see, things remain mysterious for me... $\endgroup$
    – Datross
    Aug 7, 2017 at 2:05

1 Answer 1

0
$\begingroup$

Ok I solved my problem. I used setattr and it works. Sorry for the non-clearness of all this :-).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .