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