Custom Properties allow you to attach your own data to things in Blender. In this episode of Scripting for Artists Sybren shows how to create an importer that loads all OBJ files in a directory, and then allows reloading OBJ files with the click of a button.
- Different kind of properties: 00:24
- Starting a new add-on with empty panel: 01:14
- Adding a property to the scene: 03:36
- Setting property subtypes: 06:35
- Drawing the property in a panel: 08:03
- Creating mass-importing operator: 08:51
- Adding a property to all objects: 10:09
- Importing OBJ files: 11:54
- Re-importing OBJ files: 15:22
- Deleting objects from the scene: 17:15
- Moving code into a function: 19:!2
Join to comment publicly.
26th April 2020 - 15:36
Super cool ! Thank you for the list copy trick when iterating while altering the content !
Question about custom properties. Can they store a specific blender object type (or a pointer to a specific blender object !?).
Exemple for my use case on an active grease pencil object:
I want to store direct access to this stroke, because data_path has good chance to become invalid (layer name can change, as for both frame and stroke index).
If I assign this in a variable it works well for the curent session, but once I save and reload/revert the file I lost the references... Is there a way to store this type using properties ?
Sybren A. Stüvel
28th April 2020 - 10:12
*@Samuel Bernou* You could have a look at
bpy.props.PointerProperty, that might do what you need.
2nd May 2020 - 14:45
*@Sybren A. Stüvel* Ok, I tried with a pointer prop, but I obviously don't understand how it work (or maybe it's not possible with GP strokes)
But yeah PointerProperty would have been the way to go. Thank you for pointing this ;)