Aller au contenu

Message HrzProtocol.Path

Defined in hrz/protocol/scene_model/path.proto.

A path is composed of a root and a list of numbers that point to a specific part of the scene model.

The root points to a specific tree in the scene model. See PathRoot.

To explain the parts array, we will consider the following scene model tree:

my_layer
├── name (#1)
└── palette (#2)
    ├── color_space (#1)
    └── color_stops[] (#2)
        ├── [0]
        │   ├── r (#1)
        │   ├── g (#2)
        │   └── b (#3)
        └── [1]
            ├── r (#1)
            ├── g (#2)
            └── b (#3)

In this example, there is a root message with two fields (name and palette). The palette itself has one field, color_stops, which is an array of colors. Each color has three fields: r, g, and b.

The numbers denoted by a # character are the IDs of the fields, described by the Protobuf schema (omitted here).

A path is the concatenation of field numbers, starting from the root, that points to a specific field. Examples:

  • The path to name would be [1].
  • The path to palette would be [2].
  • The path to palette.color_space would be [2, 1].

Pointing to an entire array (called the root of the array) is done by using the field number of the array. This is used for methods that count or add elements.

  • The path to palette.color_stops would be [2, 2].

Pointing to a specific element of an array is done by using the field number of the array, and the index of the element in the array. The index is zero-based. The path then continues as normal.

  • The path to palette.color_stops[0] would be [2, 2, 0].
  • The path to palette.color_stops[0].r would be [2, 2, 0, 1].
  • The path to palette.color_stops[1].b would be [2, 2, 1, 3].

For paths that include a oneof, the path to any of the variants in the same as if the variant field was a normal field. However, for retrieving the discriminant of the oneof, the path must point to any of the variant fields.


root: HrzProtocol.PathRoot

parts: uint32``[]