fmod/studio/event_description/
user_property.rs1use fmod_sys::*;
8use lanyard::Utf8CStr;
9use std::{ffi::c_int, mem::MaybeUninit};
10
11use crate::studio::{EventDescription, UserProperty};
12
13impl EventDescription {
14 pub fn get_user_property(&self, name: &Utf8CStr) -> Result<UserProperty> {
16 let mut property = MaybeUninit::uninit();
17 unsafe {
18 FMOD_Studio_EventDescription_GetUserProperty(
19 self.inner,
20 name.as_ptr(),
21 property.as_mut_ptr(),
22 )
23 .to_result()?;
24
25 let property = UserProperty::from_ffi(property.assume_init());
26 Ok(property)
27 }
28 }
29
30 pub fn get_user_property_by_index(&self, index: c_int) -> Result<UserProperty> {
34 let mut property = MaybeUninit::uninit();
35 unsafe {
36 FMOD_Studio_EventDescription_GetUserPropertyByIndex(
37 self.inner,
38 index,
39 property.as_mut_ptr(),
40 )
41 .to_result()?;
42
43 let property = UserProperty::from_ffi(property.assume_init());
44 Ok(property)
45 }
46 }
47
48 pub fn user_property_count(&self) -> Result<c_int> {
49 let mut count = 0;
50 unsafe {
51 FMOD_Studio_EventDescription_GetUserPropertyCount(self.inner, &mut count)
52 .to_result()?;
53 }
54 Ok(count)
55 }
56}