Question about Generic Properties

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
damir
Posts: 0
Joined: Tue Feb 21, 2006 7:50 pm

Question about Generic Properties

Post by damir »

Does anyone know would generic properties be implemented for all types? As I can see they are imlemented in current CVS only for MaterialType and TextureType...

damir
Posts: 0
Joined: Tue Feb 21, 2006 7:50 pm

Post by damir »

I have played a bit with properties on materials but IMO coders are making things more complicated then it should be :roll:
I don't understand why properties isn't a plain dict instead of struct. Please, don't catch on my mistakes in naming things, I will show you what I mean in eg.

This is current workflow:

Code: Select all

ob = Blender.Object.GetSelected()[0] # Get object
ob.properties['some_name'] = 'this_is_a_string' # Create ID Property
print ob.properties['some_name'].data # Print 'some_name' property
this_is_a_string
There's nothing wrong with this workflow except that is not flexible, when you create 'some_name' property with a string in it, you cant assign any other type to 'some_name' except a string.

I think that this way could be much more flexible, that is if properties would be a plain dict:

Code: Select all

ob = Blender.Object.GetSelected()[0] # Get object
ob.properties['some_name'] = 'this_is_a_string' # Create Property
print ob.properties # Print all properties
{'some_name':'this_is_a_string'}
print ob.properties['some_name'] # Print only 'some_name' property
this_is_a_string
And joining of two objects that are having the same 'some_name' property could create a new property, for instance called 'some_name-joined_object_name'.

Post Reply