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: ScalingHow 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
impl FixtureDefinition
Sourcepub fn insert_pixels(&mut self, pixels: Vec<Pixel>) -> Range<usize> ⓘ
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.
pub fn remove_pixels(&mut self, indices: &BTreeSet<usize>)
Sourcepub fn reorder(&mut self, order: &[usize]) -> Result<(), DefinitionError>
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].
Sourcepub fn reverse_pixels(&mut self, indices: &BTreeSet<usize>)
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.
Sourcepub fn move_to_front(&mut self, indices: &BTreeSet<usize>)
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.
Sourcepub fn duplicate_pixels(
&mut self,
indices: &BTreeSet<usize>,
offset_m: [f32; 3],
) -> Range<usize> ⓘ
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.
pub fn set_model_of( &mut self, indices: &BTreeSet<usize>, model: usize, ) -> Result<(), DefinitionError>
Sourcepub fn remove_model(&mut self, model: usize) -> Result<(), DefinitionError>
pub fn remove_model(&mut self, model: usize) -> Result<(), DefinitionError>
Removes a model no pixel draws with.
Sourcepub fn pixel_bounds_m(&self) -> Option<([f32; 2], [f32; 2])>
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.
Sourcepub fn fit_size(&mut self)
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.
Sourcepub fn fit_size_to_photo(&mut self)
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.
Sourcepub fn centre_pixels(&mut self)
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.
Sourcepub fn add_mode(&mut self, name: impl Into<String>) -> usize
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.
Sourcepub fn remove_mode(&mut self, index: usize) -> Result<(), DefinitionError>
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”.
Sourcepub fn group_selection(
&mut self,
mode: usize,
pixels: &BTreeSet<usize>,
) -> Result<(), DefinitionError>
pub fn group_selection( &mut self, mode: usize, pixels: &BTreeSet<usize>, ) -> Result<(), DefinitionError>
Puts the selected pixels into one group of mode.
Sourcepub fn ungroup_selection(
&mut self,
mode: usize,
pixels: &BTreeSet<usize>,
) -> Result<(), DefinitionError>
pub fn ungroup_selection( &mut self, mode: usize, pixels: &BTreeSet<usize>, ) -> Result<(), DefinitionError>
Gives every selected pixel a group of its own in mode.
Sourcepub fn each_own_group(&mut self, mode: usize) -> Result<(), DefinitionError>
pub fn each_own_group(&mut self, mode: usize) -> Result<(), DefinitionError>
Gives every pixel a group of its own in mode, keeping its name.
Sourcepub fn next_pixel_number(&self) -> usize
pub fn next_pixel_number(&self) -> usize
The number the next generated pixel is named with.
Source§impl FixtureDefinition
impl FixtureDefinition
Sourcepub fn channel_count(&self) -> u16
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).
Sourcepub fn channel_offset(&self, pixel: usize) -> u16
pub fn channel_offset(&self, pixel: usize) -> u16
DMX offset of pixel from the fixture’s address. Saturates like
Self::channel_count.
Sourcepub fn default_mode(&self) -> usize
pub fn default_mode(&self) -> usize
Index of the definition’s default mode. Always the first one.
pub fn mode(&self, index: usize) -> Option<&Mode>
pub fn mode_names(&self) -> Vec<&str>
pub fn model(&self, index: usize) -> Option<&Model>
Sourcepub fn non_rgb_pixel(&self) -> Option<&Pixel>
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
impl FixtureDefinition
Sourcepub fn pixel_scene_positions(&self, position: &LayoutPosition) -> Vec<Pos2>
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
impl AssetTrait for FixtureDefinition
Source§impl Clone for FixtureDefinition
impl Clone for FixtureDefinition
Source§impl Debug for FixtureDefinition
impl Debug for FixtureDefinition
Source§impl Default for FixtureDefinition
impl Default for FixtureDefinition
Source§impl<'de> Deserialize<'de> for FixtureDefinitionwhere
FixtureDefinition: Default,
impl<'de> Deserialize<'de> for FixtureDefinitionwhere
FixtureDefinition: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for FixtureDefinition
impl PartialEq for FixtureDefinition
Source§impl Serialize for FixtureDefinition
impl Serialize for FixtureDefinition
impl StructuralPartialEq for FixtureDefinition
Auto Trait Implementations§
impl Freeze for FixtureDefinition
impl RefUnwindSafe for FixtureDefinition
impl Send for FixtureDefinition
impl Sync for FixtureDefinition
impl Unpin for FixtureDefinition
impl UnsafeUnpin for FixtureDefinition
impl UnwindSafe for FixtureDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DebugAny for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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