pub struct Instance<'a> {
pub type_name: String,
pub data: InstanceDataFormat<'a>,
pub fields: LinkedHashMap<String, FieldTemplate>,
/* private fields */
}
Expand description
Represents a block of data inside the blend file. An Instance
can be a camera, a mesh, a material, or anything
else Blender uses internally, like material nodes, user settings or render options. An Instance
is conceptually a
struct
: a collection of named fields which can themselves be structs or primitives.
Fields§
§type_name: String
§data: InstanceDataFormat<'a>
The raw binary data this Instance
owns.
fields: LinkedHashMap<String, FieldTemplate>
The fields of this Instance
.
Implementations§
Source§impl<'a> Instance<'a>
impl<'a> Instance<'a>
pub fn dna(&self) -> &Dna
pub fn raw(&self) -> &RawBlend
Sourcepub fn code(&self) -> [u8; 4]
pub fn code(&self) -> [u8; 4]
If this Instance
was created from a primary/root Block
it will have a code. Possible codes include “OB” for
objects, “ME” for meshes, “CA” for cameras, etc.
§Panics
Panics if the instance’s underlying data doesn’t have a code
Sourcepub fn memory_address(&self) -> NonZeroU64
pub fn memory_address(&self) -> NonZeroU64
If this Instance
was created from a primary/root or subsidiary Block
it will have a memory address. Blender
dumps its memory into the blend file when saving and the old memory addresses are used the recreate the
connections between blocks when loading the file again.
§Panics
Panics if the instance underlying data doesn’t have an old memory address.
Sourcepub fn is_valid<T: AsRef<str>>(&self, name: T) -> bool
pub fn is_valid<T: AsRef<str>>(&self, name: T) -> bool
Tests whether a field is valid and can be accessed using the get
methods without panicking. Which get
method you have to use depends on the field type.