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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
use crate::{
inspector::editors::{
animation::{
AnimationContainerPropertyEditorDefinition, AnimationPropertyEditorDefinition,
MachinePropertyEditorDefinition,
},
handle::NodeHandlePropertyEditorDefinition,
material::MaterialPropertyEditorDefinition,
resource::ResourceFieldPropertyEditorDefinition,
script::ScriptPropertyEditorDefinition,
spritesheet::SpriteSheetFramesContainerEditorDefinition,
surface::SurfaceDataPropertyEditorDefinition,
texture::TexturePropertyEditorDefinition,
},
Message,
};
use fyrox::animation::machine::{PoseNode, State};
use fyrox::{
animation::{
machine::{
node::BasePoseNode, BlendAnimations, BlendAnimationsByIndex, BlendPose,
IndexedBlendInput, Machine, PlayAnimation, PoseWeight,
},
AnimationContainer,
},
core::{
futures::executor::block_on,
parking_lot::Mutex,
pool::{ErasedHandle, Handle},
},
gui::inspector::editors::{
bit::BitFieldPropertyEditorDefinition, collection::VecCollectionPropertyEditorDefinition,
enumeration::EnumPropertyEditorDefinition, inherit::InheritablePropertyEditorDefinition,
inspectable::InspectablePropertyEditorDefinition, PropertyEditorDefinitionContainer,
},
material::{
shader::{Shader, ShaderError, ShaderState},
SharedMaterial,
},
resource::{
curve::{CurveResource, CurveResourceError, CurveResourceState},
model::{MaterialSearchOptions, Model, ModelData, ModelLoadError},
texture::{
CompressionOptions, Texture, TextureMagnificationFilter, TextureMinificationFilter,
TextureWrapMode,
},
},
scene::{
base::{
Base, LevelOfDetail, LodControlledObject, LodGroup, Mobility, Property, PropertyValue,
},
camera::{
ColorGradingLut, Exposure, OrthographicProjection, PerspectiveProjection, Projection,
SkyBox,
},
collider::{
BallShape, BitMask, CapsuleShape, ColliderShape, ConeShape, ConvexPolyhedronShape,
CuboidShape, CylinderShape, GeometrySource, HeightfieldShape, InteractionGroups,
SegmentShape, TriangleShape, TrimeshShape,
},
dim2,
graph::physics::CoefficientCombineRule,
joint::*,
light::{
directional::{CsmOptions, FrustumSplitOptions},
BaseLight,
},
mesh::{
surface::{Surface, SurfaceSharedData},
RenderPath,
},
node::{Node, NodeHandle},
particle_system::{
emitter::{
base::BaseEmitter, cuboid::CuboidEmitter, cylinder::CylinderEmitter,
sphere::SphereEmitter, Emitter,
},
EmitterWrapper,
},
rigidbody::RigidBodyType,
sound::{
self,
effect::{BaseEffect, Effect, EffectInput, ReverbEffect},
Biquad, DistanceModel, SoundBufferResource, SoundBufferResourceLoadError,
SoundBufferState, Status,
},
terrain::Layer,
transform::Transform,
},
};
use std::{rc::Rc, sync::mpsc::Sender};
pub mod animation;
pub mod handle;
pub mod material;
pub mod resource;
pub mod script;
pub mod spritesheet;
pub mod surface;
pub mod texture;
pub fn make_status_enum_editor_definition() -> EnumPropertyEditorDefinition<Status> {
EnumPropertyEditorDefinition {
variant_generator: |i| match i {
0 => Status::Stopped,
1 => Status::Playing,
2 => Status::Paused,
_ => unreachable!(),
},
index_generator: |v| *v as usize,
names_generator: || {
vec![
"Stopped".to_string(),
"Playing".to_string(),
"Paused".to_string(),
]
},
}
}
pub fn make_property_editors_container(
sender: Sender<Message>,
) -> PropertyEditorDefinitionContainer {
let container = PropertyEditorDefinitionContainer::new();
container.insert(TexturePropertyEditorDefinition);
container.insert(InheritablePropertyEditorDefinition::<Option<Texture>>::new());
container.insert(InheritablePropertyEditorDefinition::<Handle<Node>>::new());
container.insert(MaterialPropertyEditorDefinition {
sender: Mutex::new(sender.clone()),
});
container.insert(InheritablePropertyEditorDefinition::<SharedMaterial>::new());
container.register_inheritable_vec_collection::<Handle<Node>>();
container.insert(NodeHandlePropertyEditorDefinition::new(sender));
container.register_inheritable_inspectable::<NodeHandle>();
container.register_inheritable_vec_collection::<NodeHandle>();
container.register_inheritable_vec_collection::<Surface>();
container.register_inheritable_vec_collection::<Layer>();
container.register_inheritable_vec_collection::<EmitterWrapper>();
container.register_inheritable_vec_collection::<LevelOfDetail>();
container.register_inheritable_vec_collection::<ErasedHandle>();
container.register_inheritable_vec_collection::<Property>();
container.register_inheritable_vec_collection::<LodControlledObject>();
container.register_inheritable_vec_collection::<GeometrySource>();
container.register_inheritable_vec_collection::<EffectInput>();
container.insert(make_status_enum_editor_definition());
container.insert(EnumPropertyEditorDefinition::<LodGroup>::new_optional());
container.insert(InheritablePropertyEditorDefinition::<Option<LodGroup>>::new());
container.register_inheritable_enum::<fyrox::animation::spritesheet::Status, _>();
container.register_inheritable_inspectable::<LodGroup>();
container
.register_inheritable_inspectable::<fyrox::animation::spritesheet::SpriteSheetAnimation>();
container
.register_inheritable_vec_collection::<fyrox::animation::spritesheet::SpriteSheetAnimation>(
);
container.register_inheritable_inspectable::<fyrox::animation::spritesheet::signal::Signal>();
container
.register_inheritable_vec_collection::<fyrox::animation::spritesheet::signal::Signal>();
container.insert(ResourceFieldPropertyEditorDefinition::<
Model,
ModelData,
ModelLoadError,
>::new(Rc::new(|resource_manager, path| {
block_on(resource_manager.request_model(path))
})));
container.insert(InheritablePropertyEditorDefinition::<Option<Model>>::new());
container.insert(ResourceFieldPropertyEditorDefinition::<
SoundBufferResource,
SoundBufferState,
SoundBufferResourceLoadError,
>::new(Rc::new(|resource_manager, path| {
block_on(resource_manager.request_sound_buffer(path))
})));
container.insert(InheritablePropertyEditorDefinition::<
Option<SoundBufferResource>,
>::new());
container.insert(ResourceFieldPropertyEditorDefinition::<
CurveResource,
CurveResourceState,
CurveResourceError,
>::new(Rc::new(|resource_manager, path| {
block_on(resource_manager.request_curve(path))
})));
container.insert(InheritablePropertyEditorDefinition::<Option<CurveResource>>::new());
container.insert(ResourceFieldPropertyEditorDefinition::<
Shader,
ShaderState,
ShaderError,
>::new(Rc::new(|resource_manager, path| {
block_on(resource_manager.request_shader(path))
})));
container.insert(InheritablePropertyEditorDefinition::<Option<Shader>>::new());
container.register_inheritable_inspectable::<ColorGradingLut>();
container.register_inheritable_inspectable::<InteractionGroups>();
container.register_inheritable_inspectable::<GeometrySource>();
container.register_inheritable_enum::<JointParams, _>();
container.register_inheritable_enum::<dim2::joint::JointParams, _>();
container.register_inheritable_inspectable::<BallJoint>();
container.register_inheritable_inspectable::<dim2::joint::BallJoint>();
container.register_inheritable_inspectable::<FixedJoint>();
container.register_inheritable_inspectable::<dim2::joint::FixedJoint>();
container.register_inheritable_inspectable::<RevoluteJoint>();
container.register_inheritable_inspectable::<PrismaticJoint>();
container.register_inheritable_inspectable::<dim2::joint::PrismaticJoint>();
container.register_inheritable_inspectable::<Base>();
container.register_inheritable_inspectable::<BaseEffect>();
container.register_inheritable_inspectable::<BaseLight>();
container.register_inheritable_enum::<Effect, _>();
container.register_inheritable_enum::<Emitter, _>();
container.register_inheritable_inspectable::<ReverbEffect>();
container.register_inheritable_inspectable::<Biquad>();
container.register_inheritable_inspectable::<BaseEmitter>();
container.register_inheritable_inspectable::<SphereEmitter>();
container.register_inheritable_inspectable::<CylinderEmitter>();
container.register_inheritable_inspectable::<CuboidEmitter>();
container.register_inheritable_inspectable::<PerspectiveProjection>();
container.register_inheritable_inspectable::<OrthographicProjection>();
container.register_inheritable_inspectable::<Transform>();
container.register_inheritable_inspectable::<CsmOptions>();
container.register_inheritable_option::<ColorGradingLut>();
container.register_inheritable_option::<Biquad>();
container.register_inheritable_option::<SkyBox>();
container.register_inheritable_inspectable::<SkyBox>();
container.register_inheritable_enum::<dim2::collider::ColliderShape, _>();
container.register_inheritable_enum::<CoefficientCombineRule, _>();
container.register_inheritable_enum::<CompressionOptions, _>();
container.register_inheritable_enum::<TextureWrapMode, _>();
container.register_inheritable_enum::<TextureMagnificationFilter, _>();
container.register_inheritable_enum::<TextureMinificationFilter, _>();
container.register_inheritable_enum::<Projection, _>();
container.register_inheritable_enum::<ColliderShape, _>();
container.register_inheritable_enum::<PropertyValue, _>();
container.register_inheritable_enum::<Mobility, _>();
container.register_inheritable_enum::<RigidBodyType, _>();
container.register_inheritable_enum::<Exposure, _>();
container.register_inheritable_enum::<FrustumSplitOptions, _>();
container.register_inheritable_enum::<MaterialSearchOptions, _>();
container.register_inheritable_enum::<DistanceModel, _>();
container.register_inheritable_enum::<sound::Renderer, _>();
container.register_inheritable_enum::<RenderPath, _>();
container.insert(ScriptPropertyEditorDefinition {});
container.insert(BitFieldPropertyEditorDefinition::<BitMask>::new());
container.register_inheritable_inspectable::<BallShape>();
container.register_inheritable_inspectable::<dim2::collider::BallShape>();
container.register_inheritable_inspectable::<CylinderShape>();
container.register_inheritable_inspectable::<ConeShape>();
container.register_inheritable_inspectable::<CuboidShape>();
container.register_inheritable_inspectable::<dim2::collider::CuboidShape>();
container.register_inheritable_inspectable::<CapsuleShape>();
container.register_inheritable_inspectable::<dim2::collider::CapsuleShape>();
container.register_inheritable_inspectable::<SegmentShape>();
container.register_inheritable_inspectable::<dim2::collider::SegmentShape>();
container.register_inheritable_inspectable::<TriangleShape>();
container.register_inheritable_inspectable::<dim2::collider::TriangleShape>();
container.register_inheritable_inspectable::<TrimeshShape>();
container.register_inheritable_inspectable::<dim2::collider::TrimeshShape>();
container.register_inheritable_inspectable::<HeightfieldShape>();
container.register_inheritable_inspectable::<dim2::collider::HeightfieldShape>();
container.register_inheritable_inspectable::<ConvexPolyhedronShape>();
container.insert(SpriteSheetFramesContainerEditorDefinition);
container.insert(SurfaceDataPropertyEditorDefinition);
container.insert(InheritablePropertyEditorDefinition::<SurfaceSharedData>::new());
container.insert(InheritablePropertyEditorDefinition::<Status>::new());
container.insert(InspectablePropertyEditorDefinition::<BasePoseNode>::new());
container.insert(InspectablePropertyEditorDefinition::<IndexedBlendInput>::new());
container.insert(VecCollectionPropertyEditorDefinition::<IndexedBlendInput>::new());
container.insert(InspectablePropertyEditorDefinition::<BlendPose>::new());
container.insert(VecCollectionPropertyEditorDefinition::<BlendPose>::new());
container.insert(EnumPropertyEditorDefinition::<PoseWeight>::new());
container.insert(InspectablePropertyEditorDefinition::<BlendAnimationsByIndex>::new());
container.insert(InspectablePropertyEditorDefinition::<BlendAnimations>::new());
container.insert(InspectablePropertyEditorDefinition::<PlayAnimation>::new());
container.insert(InspectablePropertyEditorDefinition::<Handle<PoseNode>>::new());
container.insert(InspectablePropertyEditorDefinition::<Handle<State>>::new());
container.insert(AnimationPropertyEditorDefinition);
container.insert(AnimationContainerPropertyEditorDefinition);
container.insert(InheritablePropertyEditorDefinition::<AnimationContainer>::new());
container.insert(MachinePropertyEditorDefinition);
container.insert(InheritablePropertyEditorDefinition::<Machine>::new());
container
}