pub struct GroupTransform { /* private fields */ }Expand description
An ordered list of transforms evaluated as one transform.
Group transforms are useful for composing generated or user-authored
transform chains before asking a Config for a processor.
Adding or replacing a child rejects direct and indirect cycles before
mutation. Acyclic groups may share children; non-group children require no
graph traversal. Group traversal occurs only while editing, not per pixel.
Implementations§
Source§impl GroupTransform
impl GroupTransform
Sourcepub fn num_transforms(&self) -> i32
pub fn num_transforms(&self) -> i32
Return the number of child transforms in the group.
Sourcepub fn append_transform(&self, child: &impl TransformHandle) -> Result<()>
pub fn append_transform(&self, child: &impl TransformHandle) -> Result<()>
Append child to the end of the group.
Sourcepub fn prepend_transform(&self, child: &impl TransformHandle) -> Result<()>
pub fn prepend_transform(&self, child: &impl TransformHandle) -> Result<()>
Insert child at the beginning of the group.
Sourcepub fn transform(&self, index: i32) -> Option<Transform>
pub fn transform(&self, index: i32) -> Option<Transform>
Return the child transform at index, if present.
The returned handle shares the native child rather than copying it. Mutating it affects every group retaining that child. Replacing the group’s slot does not retarget an already returned handle.
Sourcepub fn try_transform(&self, index: i32) -> Result<Option<Transform>>
pub fn try_transform(&self, index: i32) -> Result<Option<Transform>>
Return the shared native child while preserving OCIO query failures.
This has the same sharing and mutation semantics as Self::transform;
it does not copy the child transform.
Sourcepub fn set_transform(
&self,
index: i32,
child: &impl TransformHandle,
) -> Result<()>
pub fn set_transform( &self, index: i32, child: &impl TransformHandle, ) -> Result<()>
Replace a child in place, preserving the group’s identity and metadata.
The group retains the same native transform as child. Existing handles
to the previous child remain valid. An invalid index returns an error.
pub fn get_transform(&self, index: i32) -> Option<Transform>
compat alias; prefer transform()
pub fn get_transform_v1(&self, index: i32) -> Option<Transform>
compat alias; prefer transform()
Sourcepub fn direction(&self) -> TransformDirection
pub fn direction(&self) -> TransformDirection
Return the transform direction used when this group is evaluated.
Sourcepub fn set_direction(&self, direction: TransformDirection)
pub fn set_direction(&self, direction: TransformDirection)
Set the transform direction used when this group is evaluated.
Sourcepub fn try_set_direction(&self, direction: TransformDirection) -> Result<()>
pub fn try_set_direction(&self, direction: TransformDirection) -> Result<()>
Set the transform direction and surface any OCIO validation error.
Sourcepub fn create_editable_copy(&self) -> Result<Self>
pub fn create_editable_copy(&self) -> Result<Self>
Copy the group container and metadata using OCIO’s native operation.
Child transforms remain shared with the original. Use
Self::create_deep_copy to independently copy the graph.
Sourcepub fn create_deep_copy(&self) -> Result<Self>
pub fn create_deep_copy(&self) -> Result<Self>
Deep-copy the built-in transform graph while preserving sharing within the copy. Group nodes are reconstructed as native OCIO groups; other nodes use their native editable-copy method. Custom native subclasses may have additional state or copy semantics not represented by this API. Cycles and null children from external native interop are rejected.
Sourcepub fn remove_transform(&self, index: usize) -> Result<()>
pub fn remove_transform(&self, index: usize) -> Result<()>
Remove the child transform at index by rebuilding this wrapper’s group.
OCIO exposes no in-place removal API. Existing shared references, including groups that already contain this group and previously obtained metadata, continue to refer to the original native object.
Sourcepub fn clear_transforms(&self) -> Result<()>
pub fn clear_transforms(&self) -> Result<()>
Remove every child by rebuilding this wrapper’s group. Existing shared
native references continue to point to the original group; see
Self::remove_transform.
Sourcepub unsafe fn write(
&self,
config: *mut c_void,
format_name: *const i8,
os: *mut c_void,
)
👎Deprecated since 0.2.0: raw OCIO ostream entry point; prefer write_to_string(&Config, format_name) for Rust callers
pub unsafe fn write( &self, config: *mut c_void, format_name: *const i8, os: *mut c_void, )
raw OCIO ostream entry point; prefer write_to_string(&Config, format_name) for Rust callers
§Safety
config, format_name, and os must be valid pointers accepted by the OCIO ABI.
Sourcepub fn write_to_string(
&self,
config: &Config,
format_name: impl AsRef<str>,
) -> Result<Option<String>>
pub fn write_to_string( &self, config: &Config, format_name: impl AsRef<str>, ) -> Result<Option<String>>
Serialize this group transform using OCIO’s writer for format_name.
Returns None in stub builds where no real OCIO serializer is linked.
Sourcepub fn write_to_string_with_const_config(
&self,
config: &ConstConfig,
format_name: impl AsRef<str>,
) -> Result<Option<String>>
pub fn write_to_string_with_const_config( &self, config: &ConstConfig, format_name: impl AsRef<str>, ) -> Result<Option<String>>
Serialize using a retained read-only native config without copying it.
Sourcepub fn format_metadata(&self) -> Option<FormatMetadata>
pub fn format_metadata(&self) -> Option<FormatMetadata>
Return format metadata attached to the group, when available.
pub fn format_metadata_v1(&self) -> Option<FormatMetadata>
compat alias; prefer format_metadata()
pub fn format_metadata_v2(&self) -> Option<FormatMetadata>
compat alias; prefer format_metadata()
Sourcepub fn num_write_formats() -> i32
pub fn num_write_formats() -> i32
Return the number of serialization formats supported by write_to_string.
Sourcepub fn format_name_by_index(index: i32) -> Option<String>
pub fn format_name_by_index(index: i32) -> Option<String>
Return the writer format name at index, or None for an invalid index.
Sourcepub fn format_extension_by_index(index: i32) -> Option<String>
pub fn format_extension_by_index(index: i32) -> Option<String>
Return the writer format extension at index, without a leading dot.
Returns None for an invalid index.
Trait Implementations§
Source§impl Drop for GroupTransform
impl Drop for GroupTransform
Source§impl TransformHandle for GroupTransform
impl TransformHandle for GroupTransform
fn as_ptr(&self) -> *mut c_void
Source§fn diagnostic_text(&self) -> Result<String>
fn diagnostic_text(&self) -> Result<String>
Source§fn try_type_tag(&self) -> Result<i32>
fn try_type_tag(&self) -> Result<i32>
crate::TransformType.Source§fn try_set_direction(&mut self, direction: TransformDirection) -> Result<()>
fn try_set_direction(&mut self, direction: TransformDirection) -> Result<()>
Source§fn try_validate(&self) -> Result<()>
fn try_validate(&self) -> Result<()>
Source§fn try_create_editable_copy(&self) -> Result<Transform>
fn try_create_editable_copy(&self) -> Result<Transform>
GroupTransform::create_deep_copy.