5 posts / 0 new
Last post
ForumImport
Offline
Last seen: 9 years 9 months ago
Joined: 09/22/2009 - 18:47
k3d.property.create() for User Property List?

What is the correct python syntax for creating a drop-down list in a node, such as the Camera's choices for Aspect Ratio?

ForumImport
Offline
Last seen: 9 years 9 months ago
Joined: 09/22/2009 - 18:47
k3d.property.create() for User Property List?

The closest you can get is to create a property of type "k3d::string_t", but there is no way to specify the enumerated values from Python.
Cheers,
Tim

ForumImport
Offline
Last seen: 9 years 9 months ago
Joined: 09/22/2009 - 18:47
k3d.property.create() for User Property List?

Thanks for replying. Drop down lists in the GUI would be very helpful for creating parametric objects, as a user could choose an option/preset, triggering lots of cool possibilities (as seen with the Camera).
What would be required to add this functionality?

ForumImport
Offline
Last seen: 9 years 9 months ago
Joined: 09/22/2009 - 18:47
k3d.property.create() for User Property List?

This one is a fairly fundamental limitation in the way properties work. Currently, there are two types of properties, "user defined" and "plugin defined". Plugin-defined properties can implement arbitrarily-complex behavior in C++, and are easy to serialize, because the only thing that needs to be serialized is their value. User-defined properties (the kind that can be instantiated through Python) can't implement arbitrary behavior (like an enumeration, which shows-up as a combo box in the UI), because there's currently no way to serialize all the possible permutations. So they're limited to a fixed set of types (scalars, colors, strings, etc) and the simplest possible behavior.
Cheers,
Tim

ForumImport
Offline
Last seen: 9 years 9 months ago
Joined: 09/22/2009 - 18:47
k3d.property.create() for User Property List?

Thanks for the explanation. I had assumed the UI combo box would just be a simple set of key/values, such as a Python dictionary.
In order to simulate this functionality, do you think it would be possible to create the widget from a k3d script with something like PyGTK? Would PyGTK called from a script be able to modify K-3D's UI elements?

Log in or register to post comments