Skip to content

Contexts, Objects and Classes#

As you've seen in the previous section, there are two fundamental types of items in Clarisse: objects and contexts.

What are Contexts?#

Contexts are containers of items that contain both objects and contexts. In other words, contexts are to objects what folders are to files.

Indeed, in the same way files are organized in folders, in Clarisse, items are freely organized in contexts and sub-contexts.

The top most root context is always referred as the project and is used to represent assets or an entire scene ready for final rendering. There are many kinds of contexts in Clarisse.

Each one is bound to a specific context engine which manages the behavior of the context and the items it contains. Context engines also define attributes on the context itself so that the user can drive the engine.

Contexts and Visibility#

Contexts also play a big role in the visibility of the scenes in Clarisse. When a 3D View is displaying a context, it always displays the content of the selected context including the content of its sub-contexts.

This means that if the 3D View displays the root context (called project://), it will display the entire content of the project.

This will likely result to display many unwanted items since contexts are used to organize projects in a logical way where, one context is usually used to represent a scene, while others are used to organize assets, looks, rigs and more...

Let's imagine we have a context hierarchy like this:

graph TB
A(project://)-->B(scene)
A-->C(assets)

showing project// which shows everything including the content of project//scene and project//assets

Showing project//scene

project//assets which displays the asset library used to set dress the scene

When we display project:// in the 3D View, we also see the entire content of both project://scene and project://asset

What are Objects?#

An Object in Clarisse is an instance of a specific Class representing a concept in the software. There are many different classes and Widgets, Scene Items, Geometries, Lights, Images, Filters, Textures, Renderers... are just a few of the built-in classes coming by default.

For example, adding a new distant light in the scene will create a new object in the project that is an instance of class Light Physical Distant.

In the same way, displaying an Image View in a Viewport, will automatically create a new instance of the Image View class.

What are Classes?#

Without getting too technical, Classes are a fundamental part of Clarisse's core architecture. They define and extend Clarisse with all the features that are available in the application.

They are always identified by a unique name and can represent anything from a 3D geometry to an image filter, to user interface elements users interact with.

They also define the engine that processes or generates data based on the set of attributes they declare.

The concept of attributes#

Attributes are parameters that are declared by classes. They always have a name, a value and can be modified, animated, textured or driven by other attributes through expressions.

They basically define the final representation/state of an Object since they drive the engine defined by the Class of the object.

For example, the Scene Item class declares attributes that are interpreted by its engine in such way that:

  • Moving an item in the 3D space is performed by changing the value of Translate attribute of the scene item.
  • Animating the rotation of a scene item is done by animating the Rotate attribute.
  • Parenting a scene item to another one is achieved by setting the Parent attribute to the name of the scene item that will become its parent.

Tip

The attributes of an object are inspected and manipulated using the Attribute Editor. This makes the Attribute Editor one of the most central elements of the workflow of Clarisse.

Class Inheritance#

Classes can inherit from other classes. For example, a Layered Image (an image composed of layers) inherits from a generic/abstract Image class. This Image class describes what is an image in Clarisse.

graph TB
A(Project Item)-->B(Layer)-->C(Layer 3d)
A-->D(Image)-->E(Layered Image)
A-->F(Scene Item)-->G(Scene Object)-->H(Geometry)-->I(Polymesh)-->J(Polyfile)
I-->K(Polygrid)

Simplified example of a class hierarchy

The Image class defines two attributes: Resolution and Resolution Multiplier. It also defines the output image data and an engine that manages this image data. For users, Attributes are what really matters.

When they modify the Resolution attribute, it modifies the image data resolution in the image object. In fact, each time an attribute is modified, the class engine gets notified to eventually process its data.

For the Layered Image class, inheriting from Image class means it inherits from all its attributes and features. However, Layered Image also adds new attributes and its base Image class doesn't have an engine related to the objects of the Layer class it handles.

In the very same way, the class PolyFile (polygonal mesh referencing a file) inherits from Polymesh which defines everything related to Polygons and Subdivision Surfaces.

In the end, the system of classes in Clarisse is very powerful since they allow Clarisse to easily be extended with new features that feel native and tightly integrated to the workflow.

Role when making connections#

The concept of inheritance plays a big role when connecting objects to the attribute of another one. These special type of attributes called Reference potentially accept connections to objects that are instances of a certain set of classes.

For example, the Parent attribute of Scene Items only accepts connections to objects that inherit from the Scene Item class.

This is why you can parent a Camera, a Light, a Geometry or anything that inherits (directly or indirectly) from the Scene Item class but you can't set an instance of an Image for example as Parent.

Inspecting the Class Hierarchy#

Clarisse provides a useful widget created for debugging purposes called the Class Explorer. The Class Explorer allows you to browse all the objects of the current project sorted by their classes.

To open the Class Explorer, using the main application menu bar select Window > Class Explorer.

Below is a screenshot of the Class Explorer expanding the Widget class:

The Class Explorer expanding the Widget Class

In screenshot above, we can clearly see that both classes Attribute Editor and Class Explorer are under the Widget class.

This means that they are both inheriting from the Widget class.

If we look carefully, we can see that we selected two objects in the project: one Attribute Editor and one Class Explorer which are respectively named widgets://attribute_editor and widgets://class_explorer.

For more information about item's paths please refer here.