Skip to main content

FixtureDefinition

Struct FixtureDefinition 

Source
pub struct FixtureDefinition {
    pub size_m: [f32; 3],
    pub models: Vec<Model>,
    pub outline: Option<usize>,
    pub pixels: Vec<Pixel>,
    pub modes: Vec<Mode>,
    pub scaling: Scaling,
    pub photo: Option<Photo>,
}
Expand description

Everything relevant about a physical lamp which may be installed. Physical dimensions are authoritative; a layout only places and scales the fixture.

Fields§

§size_m: [f32; 3]

Overall physical extent, in metres.

§models: Vec<Model>§outline: Option<usize>

Model drawn as the fixture’s outline in the patch editor.

§pixels: Vec<Pixel>§modes: Vec<Mode>§scaling: Scaling

How a layout may distort the fixture.

§photo: Option<Photo>

A picture of the lamp drawn under its pixels, in the editors and when picking a fixture to patch; definitions without one show only their own drawing.

Implementations§

Source§

impl FixtureDefinition

Source

pub fn insert_pixels(&mut self, pixels: Vec<Pixel>) -> Range<usize> ⓘ

Appends pixels; each gets a group of its own in every mode. Returns where they landed.

Source

pub fn remove_pixels(&mut self, indices: &BTreeSet<usize>)

Source

pub fn reorder(&mut self, order: &[usize]) -> Result<(), DefinitionError>

Rearranges the pixels, and with them the DMX order: new pixel i is old pixel order[i].

Source

pub fn reverse_pixels(&mut self, indices: &BTreeSet<usize>)

Reverses the DMX order of the selected pixels among the slots they occupy; every other pixel keeps its place.

Source

pub fn move_to_front(&mut self, indices: &BTreeSet<usize>)

Makes the selected pixels the first ones in DMX order, keeping their relative order, the rest following as before.

Source

pub fn duplicate_pixels( &mut self, indices: &BTreeSet<usize>, offset_m: [f32; 3], ) -> Range<usize> ⓘ

Appends a copy of every selected pixel, moved by offset_m. Returns where the copies landed.

Source

pub fn set_model_of( &mut self, indices: &BTreeSet<usize>, model: usize, ) -> Result<(), DefinitionError>

Source

pub fn remove_model(&mut self, model: usize) -> Result<(), DefinitionError>

Removes a model no pixel draws with.

Source

pub fn pixel_bounds_m(&self) -> Option<([f32; 2], [f32; 2])>

The smallest rectangle around every pixel’s drawing, in metres, as (min, max). A pixel whose model is missing counts as a point.

Source

pub fn fit_size(&mut self)

Sizes the fixture to cover its pixels and its outline. The footprint is centred on the fixture’s origin, as a layout draws it, so pixels off centre widen it on both sides; the depth is kept.

Source

pub fn fit_size_to_photo(&mut self)

Like FixtureDefinition::fit_size, and covering the photo too, so the fixture’s frame (what a layout selects and outlines) holds the whole picture of the lamp.

Source

pub fn centre_pixels(&mut self)

Moves every pixel so their drawings are centred on the fixture’s origin, which is where a layout places and rotates the fixture. The photo moves along, so it stays under its LEDs.

Source

pub fn add_mode(&mut self, name: impl Into<String>) -> usize

Adds a mode in which every pixel has its own group, for the user to group from there. Returns its index.

Source

pub fn remove_mode(&mut self, index: usize) -> Result<(), DefinitionError>

Removes a mode. Layouts refer to a definition’s modes by index, so a fixture that used a later mode moves to its neighbour or falls back to “individual”.

Source

pub fn group_selection( &mut self, mode: usize, pixels: &BTreeSet<usize>, ) -> Result<(), DefinitionError>

Puts the selected pixels into one group of mode.

Source

pub fn ungroup_selection( &mut self, mode: usize, pixels: &BTreeSet<usize>, ) -> Result<(), DefinitionError>

Gives every selected pixel a group of its own in mode.

Source

pub fn each_own_group(&mut self, mode: usize) -> Result<(), DefinitionError>

Gives every pixel a group of its own in mode, keeping its name.

Source

pub fn next_pixel_number(&self) -> usize

The number the next generated pixel is named with.

Source§

impl FixtureDefinition

Source

pub fn channel_count(&self) -> u16

The DMX channels the fixture occupies. Saturates at u16::MAX: a malformed definition with more channels is far wider than a universe either way, and gets no address (see Patch::addresses).

Source

pub fn channel_offset(&self, pixel: usize) -> u16

DMX offset of pixel from the fixture’s address. Saturates like Self::channel_count.

Source

pub fn default_mode(&self) -> usize

Index of the definition’s default mode. Always the first one.

Source

pub fn mode(&self, index: usize) -> Option<&Mode>

Source

pub fn mode_names(&self) -> Vec<&str>

Source

pub fn model(&self, index: usize) -> Option<&Model>

Source

pub fn non_rgb_pixel(&self) -> Option<&Pixel>

The first pixel that is not a permutation of red, green and blue, if any. gled drives three-channel RGB pixels in any order, nothing else.

Source§

impl FixtureDefinition

Source

pub fn pixel_scene_positions(&self, position: &LayoutPosition) -> Vec<Pos2>

Scene position of every pixel at position, in pixel order.

Trait Implementations§

Source§

impl AssetTrait for FixtureDefinition

Source§

const DIR_NAME: &'static str = "fixture_definitions"

Source§

const NAME: &'static str = "Fixture Definition"

Source§

const SHOW_NAME_IF_SELECTED: bool = true

Source§

impl Clone for FixtureDefinition

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FixtureDefinition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FixtureDefinition

Source§

fn default() -> Self

An empty definition, as a newly created asset starts out. Definitions are assets on disk; nothing about a physical lamp is compiled in. A fresh installation has none: draw one in the definition editor, or old SVG lamps are converted on start.

Source§

impl<'de> Deserialize<'de> for FixtureDefinition

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for FixtureDefinition

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for FixtureDefinition

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FixtureDefinition

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneAny for T
where T: Any + Clone + Send + Sync,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DebugAny for T
where T: Any + Debug,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnsafeAny for T
where T: Any,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more