Skip to content

Delegates

rigatoni.Delegate

Bases: NoodleObject

Parent class for all delegates

Defines general methods that should be available for all delegates. In this context, a delegate refers to an object in a NOODLES scene that can be subclassed and extended by the user. For example, a user can create an implementation for a table that specifically suits their needs. The server's job is essentially to manage the state of all delegates, and to call the appropriate methods on them when necessary. Most methods defined by the user will also be to manipulate the state of the delegates.

Attributes:

Name Type Description
server Server

server delegate is attached to

id ID

(ID): Unique identifier for delegate

name Optional[str]

Name of delegate

signals Optional[dict]

Signals that can be called on delegate, method name to callable

rigatoni.Method

Bases: Delegate

A method that clients can request the server to call.

Attributes:

Name Type Description
id MethodID

ID for the method

name str

Name of the method

doc Optional[str]

Documentation for the method

return_doc Optional[str]

Documentation for the return value

arg_doc List[MethodArg]

Documentation for the arguments

rigatoni.Signal

Bases: Delegate

A signal that the server can send to update clients.

Attributes:

Name Type Description
id SignalID

ID for the signal

name str

Name of the signal

doc Optional[str]

Documentation for the signal

arg_doc List[MethodArg]

Documentation for the arguments

rigatoni.Entity

Bases: Delegate

A generic container

Can reference other entities, geometry, plots, and lights. It can be rendered, if it has a render rep. It may have associated methods and signals. The transform is relative to the parent entity. In other contexts it may be called a node.

Attributes:

Name Type Description
id EntityID

ID for the entity

name Optional[str]

Name of the entity

parent Optional[EntityID]

Parent entity

transform Optional[Mat4]

Local transform for the entity, ie. positional information

text_rep Optional[TextRepresentation]

Text representation for the entity

web_rep Optional[WebRepresentation]

Web representation for the entity

render_rep Optional[RenderRepresentation]

Render representation for the entity, points to geometry and instances

lights Optional[List[LightID]]

List of lights attached to the entity

tables Optional[List[TableID]]

List of tables attached to the entity

plots Optional[List[PlotID]]

List of plots attached to the entity

tags Optional[List[str]]

List of tags for the entity

methods_list Optional[List[MethodID]]

List of methods attached to the entity

signals_list Optional[List[SignalID]]

List of signals attached to the entity

influence Optional[BoundingBox]

Bounding box for the entity

rigatoni.Plot

Bases: Delegate

An abstract plot object.

Attributes:

Name Type Description
id PlotID

ID for the plot

name Optional[str]

Name of the plot

table Optional[TableID]

Table to plot

simple_plot Optional[str]

Simple plot to render

url_plot Optional[str]

URL for plot to render

methods_list Optional[List[MethodID]]

List of methods attached to the plot

signals_list Optional[List[SignalID]]

List of signals attached to the plot

rigatoni.Buffer

Bases: Delegate

A buffer of bytes containing data for an image or a mesh.

Bytes can be stored directly in the buffer with inline_bytes, or they can be stored in a URI with uri_bytes. The server should create a separate server to host the bytes, and there is support for this in the ByteServer class. To obtain these bytes, clients would have to make an HTTP request to the URI.

A buffer could store a single attribute, or it could store multiple attributes interleaved together. This is where buffer views specify how to interpret the buffer.

Attributes:

Name Type Description
id BufferID

ID for the buffer

name Optional[str]

Name of the buffer

size int

Size of the buffer in bytes

inline_bytes Optional[bytes]

Bytes of the buffer

uri_bytes Optional[str]

URI for the bytes

rigatoni.BufferView

Bases: Delegate

A view into a buffer, specifying a subset of the buffer and how to interpret it.

Attributes:

Name Type Description
id BufferViewID

ID for the buffer view

name Optional[str]

Name of the buffer view

source_buffer BufferID

Buffer that the view is referring to

type BufferType

Type of the buffer view

offset int

Offset into the buffer in bytes

length int

Length of the buffer view in bytes

rigatoni.Material

Bases: Delegate

A material that can be applied to a mesh.

The material is a collection of textures and factors that are used to render the mesh.

Attributes:

Name Type Description
id MaterialID

ID for the material

name Optional[str]

Name of the material

pbr_info Optional[PBRInfo]

Information for physically based rendering

normal_texture Optional[TextureRef]

Texture for normals

occlusion_texture Optional[TextureRef]

Texture for occlusion

occlusion_texture_factor Optional[float]

Factor for occlusion

emissive_texture Optional[TextureRef]

Texture for emissive

emissive_factor Optional[Vec3]

Factor for emissive

use_alpha Optional[bool]

Whether to use alpha

alpha_cutoff Optional[float]

Alpha cutoff

double_sided Optional[bool]

Whether the material is double-sided

rigatoni.Image

Bases: Delegate

An image, can be used for a texture

Like a buffer, an image can be stored in a URI to reduce the size of messages. To obtain the bytes, you would have to make an HTTP request to the URI.

Attributes:

Name Type Description
id ImageID

ID for the image

name Optional[str]

Name of the image

buffer_source Optional[BufferID]

Buffer that the image is stored in

uri_source Optional[str]

URI for the bytes if they are hosted externally

rigatoni.Texture

Bases: Delegate

A texture, can be used for a material

This is like a wrapping paper that is applied to a mesh. The image specifies the pattern, and the sampler specifies which part of the image should be applied to each part of the mesh.

Attributes:

Name Type Description
id TextureID

ID for the texture

name Optional[str]

Name of the texture

image ImageID

Image to use for the texture

sampler Optional[SamplerID]

Sampler to use for the texture

rigatoni.Sampler

Bases: Delegate

A sampler to use for a texture

A sampler specifies how to take portions of an image and apply them to a mesh.

Attributes:

Name Type Description
id SamplerID

ID for the sampler

name Optional[str]

Name of the sampler

mag_filter Optional[MagFilterTypes]

Magnification filter

min_filter Optional[MinFilterTypes]

Minification filter

wrap_s Optional[SamplerMode]

Wrap mode for S

wrap_t Optional[SamplerMode]

Wrap mode for T

rigatoni.Light

Bases: Delegate

Represents a light in the scene

For these purposes, a light is just a couple of properties like color, intensity, and light type. The entity that stores the light will dictate position and direction with its transform. The client application is then responsible for using this information to render the light. The light is either a point light, a spotlight, or a directional light.

Attributes:

Name Type Description
id LightID

ID for the light

name Optional[str]

Name of the light

color Optional[RGB]

Color of the light

intensity Optional[float]

Intensity of the light

point Optional[PointLight]

Point light information

spot Optional[SpotLight]

Spotlight information

directional Optional[DirectionalLight]

Directional light information

rigatoni.Geometry

Bases: Delegate

Represents geometry in the scene and can be used for meshes

This is more of a collection of patches, but each patch will contain the geometry information to render a mesh. The patch references buffer views and buffers for each attribute, and a material to use for rendering. Instances are stored in a separate buffer that is referenced at the entity level.

Attributes:

Name Type Description
id GeometryID

ID for the geometry

name Optional[str]

Name of the geometry

patches List[GeometryPatch]

Patches that make up the geometry

rigatoni.Table

Bases: Delegate

Data table

Note that this delegate doesn't store any actual data. Delegates are meant to subclass and add functionality to this class. For the client to receive the actual data, they must subscribe to the table. The client will have access to certain injected methods that allow them to insert, update, delete, and clear the table. This class provides some abstract methods that can be overridden to handle these events.

Attributes:

Name Type Description
id TableID

ID for the table

name Optional[str]

Name of the table

meta Optional[str]

Metadata for the table

methods_list Optional[List[MethodID]]

List of methods for the table

signals_list Optional[List[SignalID]]

List of signals for the table

handle_clear

handle_clear()

Method to handle clearing the table

Source code in rigatoni/noodle_objects.py
916
917
918
def handle_clear(self):
    """Method to handle clearing the table"""
    pass

handle_delete

handle_delete(keys)

Method to handle deleting from the table

Source code in rigatoni/noodle_objects.py
912
913
914
def handle_delete(self, keys: List[int]):
    """Method to handle deleting from the table"""
    pass

handle_insert

handle_insert(new_rows)

Method to handle inserting into the table

Source code in rigatoni/noodle_objects.py
904
905
906
def handle_insert(self, new_rows: List[List[int]]):
    """Method to handle inserting into the table"""
    pass

handle_set_selection

handle_set_selection(selection)

Method to handle setting a selection

Source code in rigatoni/noodle_objects.py
920
921
922
def handle_set_selection(self, selection: Selection):
    """Method to handle setting a selection"""
    pass

handle_update

handle_update(keys, rows)

Method to handle updating the table

Source code in rigatoni/noodle_objects.py
908
909
910
def handle_update(self, keys: List[int], rows: List[List[int]]):
    """Method to handle updating the table"""
    pass

table_reset

table_reset(tbl_init)

Invoke table reset signal

Source code in rigatoni/noodle_objects.py
925
926
927
def table_reset(self, tbl_init: TableInitData):
    """Invoke table reset signal"""
    pass

table_rows_removed

table_rows_removed(keys)

Invoke table rows removed signal

Source code in rigatoni/noodle_objects.py
933
934
935
def table_rows_removed(self, keys: List[int]):
    """Invoke table rows removed signal"""
    pass

table_selection_updated

table_selection_updated(selection)

Invoke table selection updated signal

Source code in rigatoni/noodle_objects.py
937
938
939
def table_selection_updated(self, selection: Selection):
    """Invoke table selection updated signal"""
    pass

table_updated

table_updated(keys, rows)

Invoke table updated signal

Source code in rigatoni/noodle_objects.py
929
930
931
def table_updated(self, keys: List[int], rows: List[List[int]]):
    """Invoke table updated signal"""
    pass

rigatoni.StartingComponent

StartingComponent(kind, component_attrs, method=None, document=False)

Bases: object

User input object for setting starting components on server

Attributes:

Name Type Description
type Type[Delegate]

Type of component

component_attrs dict

Attributes for component

method Callable

Optional method to call on component

document bool

Whether method / signal is attached to and can be called on document

Source code in rigatoni/noodle_objects.py
1053
1054
1055
1056
1057
def __init__(self, kind, component_attrs: Dict[str, Any], method: Optional[Callable] = None, document: bool = False):
    self.type = kind
    self.component_attrs = component_attrs
    self.method = method
    self.document = document

rigatoni.MethodException

MethodException(code, message=None, data=None)

Bases: Exception

Custom exception specifically for methods defined on the server

User defined methods injected on the server should raise this exception, and it will be sent to clients in a method reply message. Exception codes are defined in the table below.

Code Message Description
-32700 Parse Error Given invocation object is malformed and failed to be validated
-32600 Invalid Request Given invocation object does not fulfill required semantics
-32601 Method Not Found Given invocation object tries to call a method that does not exist
-32602 Invalid Parameters Given invocation tries to call a method with invalid parameters
-32603 Internal Error The invocation fulfills all requirements, but an internal error prevents the server from executing it

Attributes:

Name Type Description
code int

Code for the exception

message Optional[message]

Message for the exception

data Optional[data]

Data for the exception

Source code in rigatoni/noodle_objects.py
985
986
987
988
def __init__(self, code: int, message: Optional[str] = None, data: Optional[Any] = None):
    self.code = code
    self.message = message
    self.data = data