Page 1 of 1

Atach arbitrary user-supplied attributes to objects?

Posted: Sun Mar 26, 2006 6:29 pm
by reed
For a script, I would like to let the user add arbitrary key=value pairs to any object, and also to a scene. The value should also have a data type ("float", "int", "bool", "string", or user-supplied type identifier string). I would also love to be able to use the script/text editor to edit certain attributes, since they might contain long multiline text (or they might just be a very short value). Then my script can read these attributes.

This is more or less like the game logic properties, except they would simply have an unchanging value and be attached to an object.

I don't think there's any way to do this right now, is there?

The only way to do it that I can think of is to have a naming scheme for text files edited in the script editor to associate them with objects by name. Unfortunately, there is a very short limit on the length of text file names.

Should I request this as a new Blender feature? Would others find such a feature useful?



Posted: Mon Mar 27, 2006 12:36 pm
by nemyax
Custom attributes would be an extremely useful feature, but this part of your suggestion seems confusing:
they would simply have an unchanging value and be attached to an object
In other software, custom attributes are used for indirect control over other attributes. Do you want to use such attributes to simply store custom values? If they were made animatable, this would also be possible, plus you would have a way to animate one or more properties through a custom property you have assigned.
Here's a description of Maya's custom attributes:
http://help.thecentre.centennialcollege ... tml#467999
To a certain extent, you can mimic this in Blender by adding "dummy" shapes to mesh objects and using the shape IPO curves to drive other IPO curves, but that's an ugly dirty hack.
Maybe a better solution would be to add a new IPO type that would contain such custom attributes. Ideally, it should allow you to add, delete, rename and animate attributes as easily as shape keys. With sliders and stuff.
And of course, these attributes should be readily available as drivers.

Posted: Thu Mar 30, 2006 11:24 pm
by reed
Well, I only require a simple attribute of an object that doesn't change. Actually, if a TEXT object could be linked to one or more objects (so objects could share the same attribute) then that would be useful too.

If they could be targets or sources of data flow in an animation then maybe that would be useful too, but not necc. to me :D