use crate::*;
use crate::aegp::*;
use ae_sys::{AEGP_CompH, AEGP_LayerH};
define_suite!(
LayerSuite,
AEGP_LayerSuite7,
kAEGPLayerSuite,
kAEGPLayerSuiteVersion7
);
define_suite!(
LayerSuite8,
AEGP_LayerSuite8,
kAEGPLayerSuite,
kAEGPLayerSuiteVersion8
);
define_suite!(
LayerSuite9,
AEGP_LayerSuite9,
kAEGPLayerSuite,
kAEGPLayerSuiteVersion9
);
impl LayerSuite {
pub fn new() -> Result<Self, Error> {
crate::Suite::new()
}
pub fn comp_num_layers(&self, comp_handle: impl AsPtr<AEGP_CompH>) -> Result<usize, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetCompNumLayers -> i32, comp_handle.as_ptr())? as usize)
}
pub fn comp_layer_by_index(&self, comp_handle: impl AsPtr<AEGP_CompH>, layer_index: usize) -> Result<LayerHandle, Error> {
Ok(LayerHandle::from_raw(
call_suite_fn_single!(self, AEGP_GetCompLayerByIndex -> ae_sys::AEGP_LayerH, comp_handle.as_ptr(), layer_index as _)?
))
}
pub fn active_layer(&self) -> Result<Option<LayerHandle>, Error> {
let layer_handle = call_suite_fn_single!(self, AEGP_GetActiveLayer -> ae_sys::AEGP_LayerH)?;
if layer_handle.is_null() {
Ok(None)
} else {
Ok(Some(LayerHandle::from_raw(layer_handle)))
}
}
pub fn layer_index(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<usize, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerIndex -> i32, layer_handle.as_ptr())? as usize)
}
pub fn layer_source_item(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<ItemHandle, Error> {
Ok(ItemHandle::from_raw(
call_suite_fn_single!(self, AEGP_GetLayerSourceItem -> ae_sys::AEGP_ItemH, layer_handle.as_ptr())?
))
}
pub fn layer_source_item_id(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<i32, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerSourceItemID -> i32, layer_handle.as_ptr())?)
}
pub fn layer_parent_comp(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<CompHandle, Error> {
Ok(CompHandle::from_raw(
call_suite_fn_single!(self, AEGP_GetLayerParentComp -> ae_sys::AEGP_CompH, layer_handle.as_ptr())?
))
}
pub fn layer_name(&self, layer_handle: impl AsPtr<AEGP_LayerH>, plugin_id: PluginId) -> Result<(String, String), Error> {
let (layer_name, source_name) = call_suite_fn_double!(self, AEGP_GetLayerName ->ae_sys::AEGP_MemHandle, ae_sys::AEGP_MemHandle, plugin_id, layer_handle.as_ptr())?;
unsafe {
Ok((
U16CString::from_ptr_str(MemHandle::<u16>::from_raw(layer_name)?.lock()?.as_ptr()).to_string_lossy(),
U16CString::from_ptr_str(MemHandle::<u16>::from_raw(source_name)?.lock()?.as_ptr()).to_string_lossy()
))
}
}
pub fn layer_quality(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<LayerQuality, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerQuality -> ae_sys::AEGP_LayerQuality, layer_handle.as_ptr())?.into())
}
pub fn set_layer_quality(&self, layer_handle: impl AsPtr<AEGP_LayerH>, quality: LayerQuality) -> Result<(), Error> {
call_suite_fn!(self, AEGP_SetLayerQuality, layer_handle.as_ptr(), quality.into())
}
pub fn layer_flags(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<LayerFlags, Error> {
Ok(LayerFlags::from_bits_truncate(
call_suite_fn_single!(self, AEGP_GetLayerFlags -> ae_sys::AEGP_LayerFlags, layer_handle.as_ptr())?
))
}
pub fn set_layer_flag(&self, layer_handle: impl AsPtr<AEGP_LayerH>, single_flag: LayerFlags, value: bool) -> Result<(), Error> {
call_suite_fn!(self, AEGP_SetLayerFlag, layer_handle.as_ptr(), single_flag.bits(), value as _)
}
pub fn is_layer_video_really_on(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<bool, Error> {
Ok(call_suite_fn_single!(self, AEGP_IsLayerVideoReallyOn -> ae_sys::A_Boolean, layer_handle.as_ptr())? != 0)
}
pub fn is_layer_audio_really_on(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<bool, Error> {
Ok(call_suite_fn_single!(self, AEGP_IsLayerAudioReallyOn -> ae_sys::A_Boolean, layer_handle.as_ptr())? != 0)
}
pub fn layer_current_time(&self, layer_handle: impl AsPtr<AEGP_LayerH>, time_mode: TimeMode) -> Result<Time, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerCurrentTime -> ae_sys::A_Time, layer_handle.as_ptr(), time_mode.into())?.into())
}
pub fn layer_in_point(&self, layer_handle: impl AsPtr<AEGP_LayerH>, time_mode: TimeMode) -> Result<Time, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerInPoint -> ae_sys::A_Time, layer_handle.as_ptr(), time_mode.into())?.into())
}
pub fn layer_duration(&self, layer_handle: impl AsPtr<AEGP_LayerH>, time_mode: TimeMode) -> Result<Time, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerDuration -> ae_sys::A_Time, layer_handle.as_ptr(), time_mode.into())?.into())
}
pub fn set_layer_in_point_and_duration(&self, layer_handle: impl AsPtr<AEGP_LayerH>, in_point: Time, duration: Time, time_mode: TimeMode) -> Result<(), Error> {
call_suite_fn!(self, AEGP_SetLayerInPointAndDuration, layer_handle.as_ptr(), time_mode.into(), &in_point.into() as *const _, &duration.into() as *const _)
}
pub fn layer_offset(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<Time, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerOffset -> ae_sys::A_Time, layer_handle.as_ptr())?.into())
}
pub fn set_layer_offset(&self, layer_handle: impl AsPtr<AEGP_LayerH>, offset: Time) -> Result<(), Error> {
call_suite_fn!(self, AEGP_SetLayerOffset, layer_handle.as_ptr(), &offset.into() as *const _)
}
pub fn layer_stretch(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<Ratio, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerStretch -> ae_sys::A_Ratio, layer_handle.as_ptr())?.into())
}
pub fn set_layer_stretch(&self, layer_handle: impl AsPtr<AEGP_LayerH>, stretch: Ratio) -> Result<(), Error> {
call_suite_fn!(self, AEGP_SetLayerStretch, layer_handle.as_ptr(), &stretch.into() as *const _)
}
pub fn layer_transfer_mode(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<ae_sys::AEGP_LayerTransferMode, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerTransferMode -> ae_sys::AEGP_LayerTransferMode, layer_handle.as_ptr())?.into())
}
pub fn set_layer_transfer_mode(&self, layer_handle: impl AsPtr<AEGP_LayerH>, transfer_mode: &ae_sys::AEGP_LayerTransferMode) -> Result<(), Error> {
call_suite_fn!(self, AEGP_SetLayerTransferMode, layer_handle.as_ptr(), transfer_mode)
}
pub fn is_add_layer_valid(&self, item_handle: &ItemHandle, comp_handle: impl AsPtr<AEGP_CompH>) -> Result<bool, Error> {
Ok(call_suite_fn_single!(self, AEGP_IsAddLayerValid -> ae_sys::A_Boolean, item_handle.as_ptr(), comp_handle.as_ptr())? != 0)
}
pub fn add_layer(&self, item_handle: &ItemHandle, comp_handle: impl AsPtr<AEGP_CompH>) -> Result<LayerHandle, Error> {
Ok(LayerHandle::from_raw(
call_suite_fn_single!(self, AEGP_AddLayer -> ae_sys::AEGP_LayerH, item_handle.as_ptr(), comp_handle.as_ptr())?
))
}
pub fn reorder_layer(&self, layer_handle: impl AsPtr<AEGP_LayerH>, layer_index: i32) -> Result<(), Error> {
call_suite_fn!(self, AEGP_ReorderLayer, layer_handle.as_ptr(), layer_index)
}
pub fn layer_masked_bounds(&self, layer_handle: impl AsPtr<AEGP_LayerH>, time_mode: TimeMode, time: Time) -> Result<FloatRect, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerMaskedBounds -> ae_sys::A_FloatRect, layer_handle.as_ptr(), time_mode.into(), &time.into() as *const _)?.into())
}
pub fn layer_object_type(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<ObjectType, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerObjectType -> ae_sys::AEGP_ObjectType, layer_handle.as_ptr())?.into())
}
pub fn is_layer_3d(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<bool, Error> {
Ok(call_suite_fn_single!(self, AEGP_IsLayer3D -> ae_sys::A_Boolean, layer_handle.as_ptr())? != 0)
}
pub fn is_layer_2d(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<bool, Error> {
Ok(call_suite_fn_single!(self, AEGP_IsLayer2D -> ae_sys::A_Boolean, layer_handle.as_ptr())? != 0)
}
pub fn is_video_active(&self, layer_handle: impl AsPtr<AEGP_LayerH>, time_mode: TimeMode, time: Time) -> Result<bool, Error> {
Ok(call_suite_fn_single!(self, AEGP_IsVideoActive -> ae_sys::A_Boolean, layer_handle.as_ptr(), time_mode.into(), &time.into() as *const _)? != 0)
}
pub fn is_layer_used_as_track_matte(&self, layer_handle: impl AsPtr<AEGP_LayerH>, fill_must_be_active: bool) -> Result<bool, Error> {
Ok(call_suite_fn_single!(self, AEGP_IsLayerUsedAsTrackMatte -> ae_sys::A_Boolean, layer_handle.as_ptr(), fill_must_be_active as _)? != 0)
}
pub fn does_layer_have_track_matte(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<bool, Error> {
Ok(call_suite_fn_single!(self, AEGP_DoesLayerHaveTrackMatte -> ae_sys::A_Boolean, layer_handle.as_ptr())? != 0)
}
pub fn convert_comp_to_layer_time(&self, layer_handle: impl AsPtr<AEGP_LayerH>, comp_time: Time) -> Result<Time, Error> {
Ok(call_suite_fn_single!(self, AEGP_ConvertCompToLayerTime -> ae_sys::A_Time, layer_handle.as_ptr(), &comp_time.into() as *const _)?.into())
}
pub fn convert_layer_to_comp_time(&self, layer_handle: impl AsPtr<AEGP_LayerH>, layer_time: Time) -> Result<Time, Error> {
Ok(call_suite_fn_single!(self, AEGP_ConvertLayerToCompTime -> ae_sys::A_Time, layer_handle.as_ptr(), &layer_time.into() as *const _)?.into())
}
pub fn layer_dancing_rand_value(&self, layer_handle: impl AsPtr<AEGP_LayerH>, time: Time) -> Result<i32, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerDancingRandValue -> ae_sys::A_long, layer_handle.as_ptr(), &time.into() as *const _)?.into())
}
pub fn layer_id(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<LayerId, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerID -> ae_sys::AEGP_LayerIDVal, layer_handle.as_ptr())? as LayerId)
}
pub fn layer_to_world_xform(&self, layer_handle: impl AsPtr<AEGP_LayerH>, time: Time) -> Result<Matrix4, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerToWorldXform -> ae_sys::A_Matrix4, layer_handle.as_ptr(), &time.into() as *const _)?.into())
}
pub fn layer_to_world_xform_from_view(&self, layer_handle: impl AsPtr<AEGP_LayerH>, comp_time: Time, view_time: Time) -> Result<Matrix4, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerToWorldXformFromView -> ae_sys::A_Matrix4, layer_handle.as_ptr(), &comp_time.into() as *const _, &view_time.into() as *const _)?.into())
}
pub fn set_layer_name(&self, layer_handle: impl AsPtr<AEGP_LayerH>, new_name: &str) -> Result<(), Error> {
let new_name = U16CString::from_str(new_name).map_err(|_| Error::InvalidParms)?;
call_suite_fn!(self, AEGP_SetLayerName, layer_handle.as_ptr(), new_name.as_ptr())
}
pub fn layer_parent(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<Option<LayerHandle>, Error> {
let parent_handle = call_suite_fn_single!(self, AEGP_GetLayerParent -> ae_sys::AEGP_LayerH, layer_handle.as_ptr())?;
if parent_handle.is_null() {
Ok(None)
} else {
Ok(Some(LayerHandle::from_raw(parent_handle)))
}
}
pub fn set_layer_parent(&self, layer_handle: impl AsPtr<AEGP_LayerH>, parent_handle: LayerHandle) -> Result<(), Error> {
call_suite_fn!(self, AEGP_SetLayerParent, layer_handle.as_ptr(), parent_handle.as_ptr())
}
pub fn delete_layer(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<(), Error> {
call_suite_fn!(self, AEGP_DeleteLayer, layer_handle.as_ptr())
}
pub fn duplicate_layer(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<LayerHandle, Error> {
Ok(LayerHandle::from_raw(
call_suite_fn_single!(self, AEGP_DuplicateLayer -> ae_sys::AEGP_LayerH, layer_handle.as_ptr())?
))
}
pub fn layer_from_layer_id(&self, parent: &CompHandle, layer_id: LayerId) -> Result<LayerHandle, Error> {
Ok(LayerHandle::from_raw(
call_suite_fn_single!(self, AEGP_GetLayerFromLayerID -> ae_sys::AEGP_LayerH, parent.as_ptr(), layer_id as _)?
))
}
pub fn layer_label(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<LabelId, Error> {
Ok(call_suite_fn_single!(self, AEGP_GetLayerLabel -> ae_sys::AEGP_LabelID, layer_handle.as_ptr())?.into())
}
pub fn set_layer_label(&self, layer_handle: impl AsPtr<AEGP_LayerH>, label_id: LabelId) -> Result<(), Error> {
call_suite_fn!(self, AEGP_SetLayerLabel, layer_handle.as_ptr(), label_id.into())
}
pub fn layer_sampling_quality(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<LayerSamplingQuality, Error> {
let v8 = LayerSuite8::new()?;
Ok(call_suite_fn_single!(v8, AEGP_GetLayerSamplingQuality -> ae_sys::AEGP_LayerSamplingQuality, layer_handle.as_ptr())?.into())
}
pub fn set_layer_sampling_quality(&self, layer_handle: impl AsPtr<AEGP_LayerH>, quality: LayerSamplingQuality) -> Result<(), Error> {
let v8 = LayerSuite8::new()?;
call_suite_fn!(v8, AEGP_SetLayerSamplingQuality, layer_handle.as_ptr(), quality.into())
}
pub fn track_matte_layer(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<Option<LayerHandle>, Error> {
let v9 = LayerSuite9::new()?;
let track_matte_handle = call_suite_fn_single!(v9, AEGP_GetTrackMatteLayer -> ae_sys::AEGP_LayerH, layer_handle.as_ptr())?;
if track_matte_handle.is_null() {
Ok(None)
} else {
Ok(Some(LayerHandle::from_raw(track_matte_handle)))
}
}
pub fn set_track_matte(&self, layer_handle: impl AsPtr<AEGP_LayerH>, track_matte_layer: Option<LayerHandle>, track_matte_type: TrackMatte) -> Result<(), Error> {
let v9 = LayerSuite9::new()?;
call_suite_fn!(v9, AEGP_SetTrackMatte, layer_handle.as_ptr(), track_matte_layer.map_or(std::ptr::null_mut(), |h| h.as_ptr()), track_matte_type.into())
}
pub fn remove_track_matte(&self, layer_handle: impl AsPtr<AEGP_LayerH>) -> Result<(), Error> {
let v9 = LayerSuite9::new()?;
call_suite_fn!(v9, AEGP_RemoveTrackMatte, layer_handle.as_ptr())
}
}
register_handle!(AEGP_LayerH);
define_handle_wrapper!(LayerHandle, AEGP_LayerH);
define_enum! {
ae_sys::AEGP_ObjectType,
ObjectType {
None = ae_sys::AEGP_ObjectType_NONE,
AudioVideo = ae_sys::AEGP_ObjectType_AV,
Light = ae_sys::AEGP_ObjectType_LIGHT,
Camera = ae_sys::AEGP_ObjectType_CAMERA,
Text = ae_sys::AEGP_ObjectType_TEXT,
Vector = ae_sys::AEGP_ObjectType_VECTOR,
ThreeDModel = ae_sys::AEGP_ObjectType_3D_MODEL,
}
}
define_enum! {
ae_sys::AEGP_LayerQuality,
LayerQuality {
None = ae_sys::AEGP_LayerQual_NONE,
Wireframe = ae_sys::AEGP_LayerQual_WIREFRAME,
Draft = ae_sys::AEGP_LayerQual_DRAFT,
Best = ae_sys::AEGP_LayerQual_BEST,
}
}
define_enum! {
ae_sys::AEGP_LayerSamplingQuality,
LayerSamplingQuality {
Bilinear = ae_sys::AEGP_LayerSamplingQual_BILINEAR,
Bicubic = ae_sys::AEGP_LayerSamplingQual_BICUBIC,
}
}
define_enum! {
ae_sys::AEGP_TrackMatte,
TrackMatte {
NoTrackMatte = ae_sys::AEGP_TrackMatte_NO_TRACK_MATTE,
Alpha = ae_sys::AEGP_TrackMatte_ALPHA,
NotAlpha = ae_sys::AEGP_TrackMatte_NOT_ALPHA,
Luma = ae_sys::AEGP_TrackMatte_LUMA,
NotLuma = ae_sys::AEGP_TrackMatte_NOT_LUMA,
}
}
define_enum! {
ae_sys::AEGP_LTimeMode,
TimeMode {
LayerTime = ae_sys::AEGP_LTimeMode_LayerTime,
CompTime = ae_sys::AEGP_LTimeMode_CompTime,
}
}
bitflags::bitflags! {
pub struct LayerFlags: ae_sys::A_long {
const NONE = ae_sys::AEGP_LayerFlag_NONE as ae_sys::A_long;
const VIDEO_ACTIVE = ae_sys::AEGP_LayerFlag_VIDEO_ACTIVE as ae_sys::A_long;
const AUDIO_ACTIVE = ae_sys::AEGP_LayerFlag_AUDIO_ACTIVE as ae_sys::A_long;
const EFFECTS_ACTIVE = ae_sys::AEGP_LayerFlag_EFFECTS_ACTIVE as ae_sys::A_long;
const MOTION_BLUR = ae_sys::AEGP_LayerFlag_MOTION_BLUR as ae_sys::A_long;
const FRAME_BLENDING = ae_sys::AEGP_LayerFlag_FRAME_BLENDING as ae_sys::A_long;
const LOCKED = ae_sys::AEGP_LayerFlag_LOCKED as ae_sys::A_long;
const SHY = ae_sys::AEGP_LayerFlag_SHY as ae_sys::A_long;
const COLLAPSE = ae_sys::AEGP_LayerFlag_COLLAPSE as ae_sys::A_long;
const AUTO_ORIENT_ROTATION = ae_sys::AEGP_LayerFlag_AUTO_ORIENT_ROTATION as ae_sys::A_long;
const ADJUSTMENT_LAYER = ae_sys::AEGP_LayerFlag_ADJUSTMENT_LAYER as ae_sys::A_long;
const TIME_REMAPPING = ae_sys::AEGP_LayerFlag_TIME_REMAPPING as ae_sys::A_long;
const LAYER_IS_3D = ae_sys::AEGP_LayerFlag_LAYER_IS_3D as ae_sys::A_long;
const LOOK_AT_CAMERA = ae_sys::AEGP_LayerFlag_LOOK_AT_CAMERA as ae_sys::A_long;
const LOOK_AT_POI = ae_sys::AEGP_LayerFlag_LOOK_AT_POI as ae_sys::A_long;
const SOLO = ae_sys::AEGP_LayerFlag_SOLO as ae_sys::A_long;
const MARKERS_LOCKED = ae_sys::AEGP_LayerFlag_MARKERS_LOCKED as ae_sys::A_long;
const NULL_LAYER = ae_sys::AEGP_LayerFlag_NULL_LAYER as ae_sys::A_long;
const HIDE_LOCKED_MASKS = ae_sys::AEGP_LayerFlag_HIDE_LOCKED_MASKS as ae_sys::A_long;
const GUIDE_LAYER = ae_sys::AEGP_LayerFlag_GUIDE_LAYER as ae_sys::A_long;
const ADVANCED_FRAME_BLENDING = ae_sys::AEGP_LayerFlag_ADVANCED_FRAME_BLENDING as ae_sys::A_long;
const SUBLAYERS_RENDER_SEPARATELY = ae_sys::AEGP_LayerFlag_SUBLAYERS_RENDER_SEPARATELY as ae_sys::A_long;
const ENVIRONMENT_LAYER = ae_sys::AEGP_LayerFlag_ENVIRONMENT_LAYER as ae_sys::A_long;
}
}
define_suite_item_wrapper!(
ae_sys::AEGP_LayerH, LayerHandle,
suite: LayerSuite,
effect: aegp::suites::Effect,
light: aegp::suites::Light,
mask: aegp::suites::Mask,
stream: aegp::suites::Stream,
dynstream: aegp::suites::DynamicStream,
Layer {
dispose: ;
index() -> usize => suite.layer_index,
source_item() -> Item => suite.layer_source_item,
source_item_id() -> i32 => suite.layer_source_item_id,
parent_comp() -> Composition => suite.layer_parent_comp,
name(plugin_id: PluginId) -> (String, String) => suite.layer_name,
quality() -> LayerQuality => suite.layer_quality,
set_quality(quality: LayerQuality) -> () => suite.set_layer_quality,
flags() -> LayerFlags => suite.layer_flags,
set_flag(single_flag: LayerFlags, value: bool) -> () => suite.set_layer_flag,
is_video_really_on() -> bool => suite.is_layer_video_really_on,
is_audio_really_on() -> bool => suite.is_layer_audio_really_on,
current_time(time_mode: TimeMode) -> Time => suite.layer_current_time,
in_point(time_mode: TimeMode) -> Time => suite.layer_in_point,
duration(time_mode: TimeMode) -> Time => suite.layer_duration,
set_in_point_and_duration(in_point: Time, duration: Time, time_mode: TimeMode) -> () => suite.set_layer_in_point_and_duration,
offset() -> Time => suite.layer_offset,
set_offset(offset: Time) -> () => suite.set_layer_offset,
stretch() -> Ratio => suite.layer_stretch,
set_stretch(stretch: Ratio) -> () => suite.set_layer_stretch,
transfer_mode() -> ae_sys::AEGP_LayerTransferMode => suite.layer_transfer_mode,
set_transfer_mode(transfer_mode: &ae_sys::AEGP_LayerTransferMode) -> () => suite.set_layer_transfer_mode,
reorder(layer_index: i32) -> () => suite.reorder_layer,
masked_bounds(time_mode: TimeMode, time: Time) -> FloatRect => suite.layer_masked_bounds,
object_type() -> ObjectType => suite.layer_object_type,
is_3d() -> bool => suite.is_layer_3d,
is_2d() -> bool => suite.is_layer_2d,
is_video_active(time_mode: TimeMode, time: Time) -> bool => suite.is_video_active,
is_used_as_track_matte(fill_must_be_active: bool) -> bool => suite.is_layer_used_as_track_matte,
does_layer_have_track_matte() -> bool => suite.does_layer_have_track_matte,
convert_comp_to_layer_time(comp_time: Time) -> Time => suite.convert_comp_to_layer_time,
convert_layer_to_comp_time(layer_time: Time) -> Time => suite.convert_layer_to_comp_time,
dancing_rand_value(time: Time) -> i32 => suite.layer_dancing_rand_value,
id() -> LayerId => suite.layer_id,
to_world_xform(time: Time) -> Matrix4 => suite.layer_to_world_xform,
to_world_xform_from_view(comp_time: Time, view_time: Time) -> Matrix4 => suite.layer_to_world_xform_from_view,
set_name(new_name: &str) -> () => suite.set_layer_name,
parent() -> Option<LayerHandle> => suite.layer_parent,
set_parent(parent_handle: LayerHandle) -> () => suite.set_layer_parent,
delete() -> () => suite.delete_layer,
duplicate() -> Layer => suite.duplicate_layer,
label() -> LabelId => suite.layer_label,
set_label(label_id: LabelId) -> () => suite.set_layer_label,
sampling_quality() -> LayerSamplingQuality => suite.layer_sampling_quality,
set_sampling_quality(quality: LayerSamplingQuality) -> () => suite.set_layer_sampling_quality,
track_matte() -> Option<LayerHandle> => suite.track_matte_layer,
set_track_matte(track_matte_layer: Option<LayerHandle>, track_matte_type: TrackMatte) -> () => suite.set_track_matte,
remove_track_matte() -> () => suite.remove_track_matte,
num_effects() -> i32 => effect.layer_num_effects,
effect_by_index(plugin_id: PluginId, index: i32) -> aegp::Effect => effect.layer_effect_by_index,
apply_effect(plugin_id: PluginId, installed_effect_key: InstalledEffectKey) -> aegp::Effect => effect.apply_effect,
light_type() -> LightType => light.light_type,
set_light_type(light_type: LightType) -> () => light.set_light_type,
num_masks() -> i32 => mask.layer_num_masks,
mask_by_index(mask_index: i32) -> Mask => mask.layer_mask_by_index,
is_stream_legal(stream: LayerStream) -> bool => stream.is_stream_legal,
new_layer_stream(plugin_id: PluginId, stream_name: LayerStream) -> aegp::Stream => stream.new_layer_stream,
layer_stream_value(stream: LayerStream, time_mode: TimeMode, time: Time, pre_expression: bool) -> StreamValue => stream.layer_stream_value,
new_stream_for_layer(plugin_id: PluginId) -> aegp::Stream => dynstream.new_stream_ref_for_layer,
}
);
impl Layer {
pub fn active() -> Result<Option<Layer>, Error> {
LayerSuite::new()?.active_layer().map(|h| h.map(|x| Layer::from_handle(x, false)))
}
pub fn create_new_mask(&self) -> Result<(Mask, i32), Error> {
let Ok(ref suite) = *self.mask else { return Err(Error::MissingSuite); };
suite.create_new_mask(self.handle.as_ptr()).map(|(mask, idx)| (mask.into(), idx))
}
pub fn layer_render_options(&self, plugin_id: PluginId) -> Result<aegp::LayerRenderOptions, Error> {
aegp::LayerRenderOptions::from_layer(self.handle.as_ptr(), plugin_id)
}
}