Blender Studio
  • Films
  • Projects
  • Training
  • Characters
  • Tools
  • Blog
  • Join
  • BLENDER.ORG

    • Download

      Get the latest Blender, older versions, or experimental builds.

    • What's New

      Stay up-to-date with the new features in the latest Blender releases.

    LEARNING & RESOURCES

    • Blender Studio

      Access production assets and knowledge from the open movies.

    • Manual

      Documentation on the usage and features in Blender.

    DEVELOPMENT

    • Developers Blog

      Latest development updates, by Blender developers.

    • Documentation

      Guidelines, release notes and development docs.

    • Benchmark

      A platform to collect and share results of the Blender Benchmark.

    • Blender Conference

      The yearly event that brings the community together.

    DONATE

    • Development Fund

      Support core development with a monthly contribution.

    • One-time Donations

      Perform a single donation with more payment options available.

Training Highlights
Stylized Rendering with Brushstrokes
Geometry Nodes from Scratch
Procedural Shading Fundamentals
Stylized Character Workflow

Training types
Course Documentation Production Lesson Workshop

Training categories
Animation Geometry Nodes Lighting Rendering Rigging Shading
Film Highlights
Wing It!
2023
Charge
2022
Sprite Fright
2021
Spring
2019
Project Highlights
Project DogWalk
Interactive
Gold
Showcase
BCON24 Identity
Showcase
Fighting with Grease Pencil
Article
Course
Scripting for Artists
Blender Versions
Videos
  1. 01

    Introduction & copy-pasting

    Free
  2. 02

    Names & Objects

  3. 03

    Stuff on Lists

  4. 04

    Data Types

  5. 05

    Collections: Mass-Rename of Objects

  6. 06

    Blender Collections

    Free
  7. 07

    For vs. While

    Free
  8. 08

    Your Own Operator

    Free
  9. 09

    From Script to Add-on

    Free
  10. 10

    User Interfaces

    Free
  11. 11

    Custom Properties

    Free
  12. 12

    Asset Linking

    Free
  13. 13

    Roast my Add-on

    Free
  14. 14

    The Roast of Nature Clicker

    Free
  15. 15

    Modal Operators

    Free
  16. 16

    Readability & Understandability

Tech
  1. 01

    Updating F-Curves

  2. 02

    Render 10,000 OBJ files

  3. 03

    Mass-Rename Bones & Vertex Groups

  4. 04

    Rendering from 'all' angles

Sybren Stüvel
Sybren Stüvel Author
  • Free
Download English Subtitles
Download .mp4   117.2 MB
License CC-BY
Report Problem
Videos

Custom Properties

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 leave a comment.

3 comments
Samuel Bernou
Samuel Bernou
April 26th, 2020

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:

>>> bpy.context.object.data.layers['Lines'].frames[0].strokes[1]
bpy.data.grease_pencils['Suzanne']...GPencilStroke

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 Stüvel
Sybren Stüvel
April 28th, 2020

*@Samuel Bernou* You could have a look at bpy.props.PointerProperty, that might do what you need.

Samuel Bernou
Samuel Bernou
May 2nd, 2020

*@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)

>>> strokeid_3 = C.object.data.layers.active.active_frame.strokes[3].rna_type
>>> bpy.types.Scene.three = bpy.props.PointerProperty(type = strokeid_3, name = "three")
TypeError: PointerProperty(...) expected an RNA type, failed with type 'GPencilStroke'
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
ValueError: bpy_struct "Scene" registration error: three could not register

But yeah PointerProperty would have been the way to go. Thank you for pointing this ;)

Films Projects Training Blog Blender Studio for Teams
Pipeline and Tools
  • CloudRig
  • Blender Kitsu
  • Brushstroke Tools Add-on
  • Blender Studio Extensions
Characters
  • Mikassa
  • Whale
  • Ballan Wrasse
  • Snow
Studio
  • Terms & Conditions
  • Privacy Policy
  • Contact
  • Remixing Music
Blender Studio

The creators who share.

Artistic freedom starts with Blender The Free and Open Source 3D Creation Suite