Data Structures

Data Structures #

Despite the new operators, this add-on prefers an unobtrusive style that does not change the original way that Blender's objects work. However, a small number of operators must create new properties/attributes in an object to store additional information. This pages list all new data structures created by the add-on.

Add-On Registering #

All add-on operators are registered under bpy.ops.gpencil with the name prefix nijigp_. The add-on chooses gpencil as the category instead of creating a new one, because this allows users to assign shortcut to each operator.

The add-on stores global setting options by defining properties with the name prefix nijigp_ in bpy.types.Scene.

Custom Properties #

Materials #

  • original_material_index: Operators such as Hole Holdout may generate new materials from existing ones. The new material uses this property to mark the material slot number of the original material.

Objects #

Mesh objects generated by this add-on from Grease Pencil strokes have following properties defined:

  • nijigp_mesh: The type of the mesh. Currently, it can be either planar or 3d.

  • nijigp_parent: A pointer to the Grease Pencil object that generates this mesh.

    • The parentship needs to be stored in this way persistently, because Rigging Operators may change the parentship of involved objects.

Mesh Attributes #

Meshes generated by this add-on use attributes for shaders and Geometry Nodes. Besides the regular attributes like Color and UVMap, there are also new ones defined:

  • NormalMap: The normal vector calculated by the Normal Interpolation operator.

  • Depth: A Float representing the height/depth of each vertex, normalized to 0~1 range.

    • This value is deduced from the normal vector, which may not be the same with actual vertex coordinate.
    • Currently, none of the default shaders uses this attribute. However, the user can create their own shaders with it.
  • start_frame, end_frame: Integers marking the frame range of the stroke generating this mesh. The Stop-Motion Animation option will insert a Geometry Nodes group to show/hide the mesh according to these values.

All of these new attributes are vertex attributes.