objc2_model_io/generated/
MDLObject.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// Base class for object in a ModelIO asset hierarchy
12    ///
13    /// Includes transformation and bounds info, links to parent and
14    /// children in the hierachy
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlobject?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct MDLObject;
20);
21
22#[cfg(feature = "MDLTypes")]
23unsafe impl MDLNamed for MDLObject {}
24
25unsafe impl NSObjectProtocol for MDLObject {}
26
27impl MDLObject {
28    extern_methods!(
29        #[cfg(feature = "MDLTypes")]
30        /// Allows applications to introspect the components on the objects.
31        #[unsafe(method(components))]
32        #[unsafe(method_family = none)]
33        pub unsafe fn components(&self) -> Retained<NSArray<ProtocolObject<dyn MDLComponent>>>;
34
35        #[cfg(feature = "MDLTypes")]
36        /// Extensible component support that allows user of ModelIO to customize
37        /// MDLObjects to fit their format and workflow.
38        #[unsafe(method(setComponent:forProtocol:))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn setComponent_forProtocol(
41            &self,
42            component: &ProtocolObject<dyn MDLComponent>,
43            protocol: &AnyProtocol,
44        );
45
46        #[cfg(feature = "MDLTypes")]
47        /// Extensible component support that allows user of ModelIO to customize
48        /// MDLObjects to fit their format and workflow.
49        #[unsafe(method(componentConformingToProtocol:))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn componentConformingToProtocol(
52            &self,
53            protocol: &AnyProtocol,
54        ) -> Option<Retained<ProtocolObject<dyn MDLComponent>>>;
55
56        #[cfg(feature = "MDLTypes")]
57        /// Allows shorthand [key] syntax for componentConformingToProtocol:.
58        ///
59        /// Parameter `key`: The protocol that the component conforms to.
60        ///
61        /// See: componentConformingToProtocol:
62        #[unsafe(method(objectForKeyedSubscript:))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn objectForKeyedSubscript(
65            &self,
66            key: &AnyProtocol,
67        ) -> Option<Retained<ProtocolObject<dyn MDLComponent>>>;
68
69        #[cfg(feature = "MDLTypes")]
70        /// Allows shorthand [key] syntax for setComponent:forProtocol:.
71        ///
72        /// Parameter `key`: The protocol that the component conforms to.
73        ///
74        /// See: setComponent:forProtocol:
75        #[unsafe(method(setObject:forKeyedSubscript:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn setObject_forKeyedSubscript(
78            &self,
79            obj: Option<&ProtocolObject<dyn MDLComponent>>,
80            key: &AnyProtocol,
81        );
82
83        /// Parent object. Nil if no parent.
84        ///
85        /// Set to nil when you remove this from an object container inside the
86        /// parent object.
87        #[unsafe(method(parent))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn parent(&self) -> Option<Retained<MDLObject>>;
90
91        /// This is a [weak property][objc2::topics::weak_property].
92        /// Setter for [`parent`][Self::parent].
93        #[unsafe(method(setParent:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn setParent(&self, parent: Option<&MDLObject>);
96
97        /// Instance object
98        ///
99        /// nil, unless this object refers to original data to be instanced. The
100        /// original data object can be any MDLObject that does not have a parent.
101        /// If an MDLAsset has been created from a data file, any original objects
102        /// parsed from that file will be found in the originals property.
103        /// A typical use of a original and instance might be to have one original
104        /// chair MDLObject, and instance six chairs around a table. The
105        /// transform of each chair would be found on the parent MDLObject, but
106        /// the various items making up the chair would be found in the original
107        /// object.
108        #[unsafe(method(instance))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn instance(&self) -> Option<Retained<MDLObject>>;
111
112        /// Setter for [`instance`][Self::instance].
113        #[unsafe(method(setInstance:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn setInstance(&self, instance: Option<&MDLObject>);
116
117        /// a string representing a path to the object
118        ///
119        /// a path is of the form /path/to/object where the path is formed by
120        /// concatenating the names of the objects up the parent chain.
121        /// Requesting a path will force any unnamed objects to became uniquely
122        /// named. Any characters outside of [A-Z][a-z][0-9][:-_.] will be
123        /// forced to underscore.
124        #[unsafe(method(path))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn path(&self) -> Retained<NSString>;
127
128        /// Return the object at the specified path, or nil if none exists there
129        #[unsafe(method(objectAtPath:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn objectAtPath(&self, path: &NSString) -> Retained<MDLObject>;
132
133        #[cfg(feature = "block2")]
134        #[unsafe(method(enumerateChildObjectsOfClass:root:usingBlock:stopPointer:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn enumerateChildObjectsOfClass_root_usingBlock_stopPointer(
137            &self,
138            object_class: &AnyClass,
139            root: &MDLObject,
140            block: &block2::Block<dyn Fn(NonNull<MDLObject>, NonNull<Bool>)>,
141            stop_pointer: NonNull<Bool>,
142        );
143
144        #[cfg(all(feature = "MDLTransform", feature = "MDLTypes"))]
145        /// Short hand property for the MDLTransformComponent.
146        ///
147        /// The default value is nil
148        ///
149        ///
150        /// See: MDLTransformComponent
151        #[unsafe(method(transform))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn transform(
154            &self,
155        ) -> Option<Retained<ProtocolObject<dyn MDLTransformComponent>>>;
156
157        #[cfg(all(feature = "MDLTransform", feature = "MDLTypes"))]
158        /// Setter for [`transform`][Self::transform].
159        #[unsafe(method(setTransform:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setTransform(
162            &self,
163            transform: Option<&ProtocolObject<dyn MDLTransformComponent>>,
164        );
165
166        #[cfg(feature = "MDLTypes")]
167        /// Short hand property for the MDLObjectContainerComponent.
168        ///
169        /// The default value is an empty MDLObjectContainer
170        ///
171        ///
172        /// See: MDLObjectContainerComponent
173        #[unsafe(method(children))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn children(&self) -> Retained<ProtocolObject<dyn MDLObjectContainerComponent>>;
176
177        #[cfg(feature = "MDLTypes")]
178        /// Setter for [`children`][Self::children].
179        #[unsafe(method(setChildren:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setChildren(
182            &self,
183            children: &ProtocolObject<dyn MDLObjectContainerComponent>,
184        );
185
186        /// Visibility of the node
187        ///
188        /// default is NO
189        #[unsafe(method(hidden))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn hidden(&self) -> bool;
192
193        /// Setter for [`hidden`][Self::hidden].
194        #[unsafe(method(setHidden:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn setHidden(&self, hidden: bool);
197
198        /// Short hand for adding a child to the current container component and
199        /// setting the parent to this object.
200        ///
201        /// It will create a default container if none exists. If children are
202        /// explicitly disallowed for an object, then add a container component
203        /// that throws on addition.
204        ///
205        ///
206        /// See: MDLObjectContainer
207        #[unsafe(method(addChild:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn addChild(&self, child: &MDLObject);
210    );
211}
212
213/// Methods declared on superclass `NSObject`.
214impl MDLObject {
215    extern_methods!(
216        #[unsafe(method(init))]
217        #[unsafe(method_family = init)]
218        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
219
220        #[unsafe(method(new))]
221        #[unsafe(method_family = new)]
222        pub unsafe fn new() -> Retained<Self>;
223    );
224}
225
226extern_class!(
227    /// Default container object
228    ///
229    /// Subclass the object container to support custom containers. Such
230    /// custom containers might reference in memory representations, offline
231    /// databases, and so on.
232    ///
233    /// See also [Apple's documentation](https://developer.apple.com/documentation/modelio/mdlobjectcontainer?language=objc)
234    #[unsafe(super(NSObject))]
235    #[derive(Debug, PartialEq, Eq, Hash)]
236    pub struct MDLObjectContainer;
237);
238
239#[cfg(feature = "MDLTypes")]
240unsafe impl MDLComponent for MDLObjectContainer {}
241
242#[cfg(feature = "MDLTypes")]
243unsafe impl MDLObjectContainerComponent for MDLObjectContainer {}
244
245unsafe impl NSFastEnumeration for MDLObjectContainer {}
246
247unsafe impl NSObjectProtocol for MDLObjectContainer {}
248
249impl MDLObjectContainer {
250    extern_methods!();
251}
252
253/// Methods declared on superclass `NSObject`.
254impl MDLObjectContainer {
255    extern_methods!(
256        #[unsafe(method(init))]
257        #[unsafe(method_family = init)]
258        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
259
260        #[unsafe(method(new))]
261        #[unsafe(method_family = new)]
262        pub unsafe fn new() -> Retained<Self>;
263    );
264}