-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwem_bindings_1.cpp
More file actions
933 lines (846 loc) · 84.3 KB
/
Copy pathwem_bindings_1.cpp
File metadata and controls
933 lines (846 loc) · 84.3 KB
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2026 Fernando Sahmkow
//
// AUTOGENERATED by tools/codegen — do not edit by hand.
// Regenerate via: python -m tools.codegen.codegen wem --backend pybind11
//
// Source headers and `@bind` annotations live under include/whiteout/.
//
// Include order matters here:
// 1. pybind11/pybind11.h sets up the base library
// 2. project headers define whiteout::u32 et al used inside MAKE_OPAQUE
// 3. PYBIND11_MAKE_OPAQUE opts out of stl.h's auto-conversion for our vectors
// 4. pybind11/stl.h, stl_bind.h honor the opaque declarations
#include <pybind11/pybind11.h>
#include <array>
#include <cstdint>
#include <optional>
#include <sstream>
#include <string>
#include <vector>
#include <whiteout/vector_types.h>
#include <whiteout/models/wem/profile.h>
#include <whiteout/models/wem/diagnostics.h>
#include <whiteout/models/wem/bounds.h>
#include <whiteout/models/wem/asset_key.h>
#include <whiteout/models/wem/native_bag.h>
#include <whiteout/models/wem/materials/texture.h>
#include <whiteout/models/wem/materials/common.h>
#include <whiteout/models/wem/materials/features.h>
#include <whiteout/models/wem/materials/looks.h>
#include <whiteout/models/wem/materials/material.h>
#include <whiteout/models/wem/geometry/attributes.h>
#include <whiteout/models/wem/geometry/skin.h>
#include <whiteout/models/wem/geometry/mesh.h>
#include <whiteout/models/wem/nodes/emitters.h>
#include <whiteout/models/wem/nodes/fields.h>
#include <whiteout/models/wem/nodes/node.h>
#include <whiteout/models/wem/nodes/tree.h>
#include <whiteout/models/wem/anim/channel.h>
#include <whiteout/models/wem/anim/clip.h>
#include <whiteout/models/wem/physics/physics.h>
#include <whiteout/models/wem/model.h>
#include <whiteout/models/wem/document.h>
#include <whiteout/models/wem/parser.h>
#include <whiteout/models/wem/writer.h>
#include <whiteout/models/wem/validate.h>
#include <whiteout/interfaces.h>
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::f32>);
PYBIND11_MAKE_OPAQUE(std::vector<std::string>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::u8>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::u32>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::Vector2f>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::Vector3f>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::AnimChannel>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::AnimSet>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::AnimTag>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::AssetKey>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Clip>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::ClipEvent>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::ClipTrackSet>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Cloth>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::ClothBinding>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::ClothCollider>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::CombinerStage>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::CompositeLayer>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Diagnostic>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Diagnostics::CodeCount>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Look>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Material>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::MaterialFeature>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Mesh>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::MeshSection>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Model>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::NativeKind>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Node>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::PhysicsBody>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::PhysicsJoint>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::PhysicsRig>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::PhysicsShape>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::PoseSchema>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::ProfileId>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::ProfileMaterialSet>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Sc2Property<whiteout::Vector3f>>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Sc2RibbonSplinePoint>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::SlotBinding>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::SubTrack>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::SubTrackContainer>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::TextureRef>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::TrackSet>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::Transform>);
PYBIND11_MAKE_OPAQUE(std::vector<whiteout::models::wem::UnknownChunk>);
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>
#include <pybind11/operators.h>
#include <pybind11/numpy.h>
namespace py = pybind11;
namespace {
// Buffer-protocol vector wrapper for std::vector<Elem> where Elem is laid
// out as `Components` contiguous Scalars (Vector3f, Quaternion, ColorBGRA…).
//
// pybind11's bind_vector<> wires up py::buffer_protocol() automatically,
// but stl_bind.h's auto-buffer-info path static-asserts on element types
// lacking a format_descriptor — Vector3f/Quaternion don't have one.
// We provide the same Python surface (append, extend, clear, __getitem__,
// __setitem__, __iter__, __len__, __bool__) plus a 2D buffer view.
template <typename Elem, typename Scalar, py::ssize_t Components>
auto bindBufferVector(py::module_& m, const char* name) {
using Vec = std::vector<Elem>;
py::class_<Vec> cls(m, name, py::buffer_protocol());
cls.def(py::init<>());
cls.def("__len__", [](const Vec& v) { return v.size(); });
cls.def("__bool__", [](const Vec& v) { return !v.empty(); });
cls.def("__getitem__", [](const Vec& v, std::size_t i) -> Elem {
if (i >= v.size()) throw py::index_error();
return v[i];
});
cls.def("__setitem__", [](Vec& v, std::size_t i, const Elem& val) {
if (i >= v.size()) throw py::index_error();
v[i] = val;
});
cls.def("__iter__", [](Vec& v) {
return py::make_iterator(v.begin(), v.end());
}, py::keep_alive<0, 1>());
cls.def("append", [](Vec& v, const Elem& val) { v.push_back(val); });
cls.def("extend", [](Vec& v, const Vec& o) {
v.insert(v.end(), o.begin(), o.end());
});
cls.def("clear", &Vec::clear);
cls.def_buffer([](Vec& v) -> py::buffer_info {
if constexpr (Components == 1) {
return py::buffer_info(
v.data(),
static_cast<py::ssize_t>(sizeof(Scalar)),
py::format_descriptor<Scalar>::format(),
1,
{ static_cast<py::ssize_t>(v.size()) },
{ static_cast<py::ssize_t>(sizeof(Scalar)) });
} else {
return py::buffer_info(
v.data(),
static_cast<py::ssize_t>(sizeof(Scalar)),
py::format_descriptor<Scalar>::format(),
2,
{ static_cast<py::ssize_t>(v.size()), Components },
{ static_cast<py::ssize_t>(sizeof(Elem)),
static_cast<py::ssize_t>(sizeof(Scalar)) });
}
});
return cls;
}
} // namespace
// Part 1 of bind_wem(), which calls the parts in order.
void bind_wem_1(py::module_& m) {
py::class_<whiteout::models::wem::MeshSection>(m, "MeshSection", R"doc(Metadata only; one per draw section. The faces that belong to it are the ones whose `section` attribute names it.)doc")
.def(py::init<>())
.def_readwrite("name", &whiteout::models::wem::MeshSection::name)
.def_readwrite("material_slot", &whiteout::models::wem::MeshSection::materialSlot, R"doc(-> `Model::materialSlots[]`, or `kInvalidIndex` for NO MATERIAL: a section made by an editor before one has been chosen for it. The sentinel is the emitter links' (§10.9), so one rule covers both, and every profile draws such a section as plain white (`toMdx` writes it a blank SD material; a profile that cannot say "none" must write one).)doc")
.def_readwrite("profiles", &whiteout::models::wem::MeshSection::profiles, R"doc(Which profiles draw this section (§6).)doc")
.def_readwrite("rigid_node", &whiteout::models::wem::MeshSection::rigidNode, R"doc(Set: every vertex binds here at weight 1 (§5.6).)doc")
.def_readwrite("selection_group", &whiteout::models::wem::MeshSection::selectionGroup, R"doc(MDX geoset group / M2 skinSectionId.)doc")
.def_readwrite("flags", &whiteout::models::wem::MeshSection::flags)
.def_readwrite("bounds", &whiteout::models::wem::MeshSection::bounds, R"doc(Derived, recomputed.)doc")
.def_readwrite("native", &whiteout::models::wem::MeshSection::native)
;
py::class_<whiteout::models::wem::Mesh>(m, "Mesh")
.def(py::init<>())
.def_readwrite("name", &whiteout::models::wem::Mesh::name)
.def_readwrite("lod_level", &whiteout::models::wem::Mesh::lodLevel, R"doc(0, or `kAllLods`: a document holds no other level (`DropLevelsOfDetail`, EDIT_MODE_MODELLING_DESIGN.md §8.1).)doc")
.def_readwrite("skin", &whiteout::models::wem::Mesh::skin)
.def_readwrite("sections", &whiteout::models::wem::Mesh::sections)
.def_readwrite("bounds", &whiteout::models::wem::Mesh::bounds)
.def("face_set", &whiteout::models::wem::Mesh::faceSet, R"doc(The indexed face set — the mesh's own form.
Regenerated from the connectivity first when an edit has made it stale, so this is always current even mid-edit.)doc")
.def("set_face_set", &whiteout::models::wem::Mesh::setFaceSet, py::arg("faces"), R"doc(Replaces the geometry. Drops any connectivity and the stored triangulation, and resizes the Vertex and Face attribute domains to match; Halfedge and Edge domains are sized by `ensureConnectivity`, since only the build knows how many there are.)doc")
.def("has_connectivity", &whiteout::models::wem::Mesh::hasConnectivity)
.def("ensure_connectivity", &whiteout::models::wem::Mesh::ensureConnectivity, R"doc(Builds the half-edge arrays if they are not already there.
Deterministic and idempotent. Fails only on a non-manifold face set, which `MeshBuilder` cannot produce — a mesh that came through the builder always builds.)doc")
.def("invalidate_connectivity", &whiteout::models::wem::Mesh::invalidateConnectivity, R"doc(Drops the half-edge arrays, syncing the face set first if an edit made it stale. When an edit renumbered the connectivity, it is canonicalized first (`geom::Canonicalize`): lazily deleted elements are compacted and the Halfedge and Edge layers carried to the numbering a rebuild gives, so ids held across this call are renumbered. The geometry is unchanged.)doc")
.def("topology", py::overload_cast<>(&whiteout::models::wem::Mesh::topology, py::const_))
.def("vertex_count", &whiteout::models::wem::Mesh::vertexCount)
.def("face_count", &whiteout::models::wem::Mesh::faceCount)
.def("face_sections", py::overload_cast<>(&whiteout::models::wem::Mesh::faceSections, py::const_))
.def("faces_of_section", &whiteout::models::wem::Mesh::facesOfSection, py::arg("section"), R"doc(Faces belonging to @p section, in face order. A bucket pass at the point of use, which is what replaces the old sorted-range invariant.)doc")
.def("recompute_bounds", &whiteout::models::wem::Mesh::recomputeBounds, R"doc(Recomputes `bounds` and every section's `bounds` from `position`.)doc")
;
py::class_<whiteout::models::wem::Wc3ParticleEmitter1Payload>(m, "Wc3ParticleEmitter1Payload", R"doc(`PREM`: every particle is a copy of `spawnModel`, flung from the node.)doc")
.def(py::init<>())
.def_readwrite("emission_rate", &whiteout::models::wem::Wc3ParticleEmitter1Payload::emissionRate, R"doc(Particles a second.)doc")
.def_readwrite("gravity", &whiteout::models::wem::Wc3ParticleEmitter1Payload::gravity)
.def_readwrite("longitude", &whiteout::models::wem::Wc3ParticleEmitter1Payload::longitude, R"doc(Radians.)doc")
.def_readwrite("latitude", &whiteout::models::wem::Wc3ParticleEmitter1Payload::latitude, R"doc(Radians.)doc")
.def_readwrite("lifespan", &whiteout::models::wem::Wc3ParticleEmitter1Payload::lifespan, R"doc(Seconds.)doc")
.def_readwrite("speed", &whiteout::models::wem::Wc3ParticleEmitter1Payload::speed, R"doc(`initialVelocity`.)doc")
.def_readwrite("spawn_model", &whiteout::models::wem::Wc3ParticleEmitter1Payload::spawnModel, R"doc(The model each particle is, by path.)doc")
.def_readwrite("uses_mdl", &whiteout::models::wem::Wc3ParticleEmitter1Payload::usesMdl, R"doc(Node flag 0x8000.)doc")
.def_readwrite("uses_tga", &whiteout::models::wem::Wc3ParticleEmitter1Payload::usesTga, R"doc(Node flag 0x10000.)doc")
;
py::class_<whiteout::models::wem::Wc3ParticleSegment>(m, "Wc3ParticleSegment", R"doc(A particle's look at one of its three lifetime points: birth, `time`, death.)doc")
.def(py::init<>())
.def_readwrite("color", &whiteout::models::wem::Wc3ParticleSegment::color, R"doc(RGB, red first — the static-colour order.)doc")
.def_readwrite("alpha", &whiteout::models::wem::Wc3ParticleSegment::alpha)
.def_readwrite("scaling", &whiteout::models::wem::Wc3ParticleSegment::scaling, R"doc(The quad's size, in model units.)doc")
;
py::class_<whiteout::models::wem::Wc3ParticleInterval>(m, "Wc3ParticleInterval", R"doc(A flipbook run: cells `start..end`, `repeat` times over the span.)doc")
.def(py::init<>())
.def_readwrite("start", &whiteout::models::wem::Wc3ParticleInterval::start)
.def_readwrite("end", &whiteout::models::wem::Wc3ParticleInterval::end)
.def_readwrite("repeat", &whiteout::models::wem::Wc3ParticleInterval::repeat)
;
py::class_<whiteout::models::wem::Wc3ParticleEmitter2Payload>(m, "Wc3ParticleEmitter2Payload", R"doc(`PRE2`: camera-facing flipbook quads — the Warcraft III particle.)doc")
.def(py::init<>())
.def_readwrite("speed", &whiteout::models::wem::Wc3ParticleEmitter2Payload::speed)
.def_readwrite("variation", &whiteout::models::wem::Wc3ParticleEmitter2Payload::variation, R"doc(Of the speed, as a fraction.)doc")
.def_readwrite("latitude", &whiteout::models::wem::Wc3ParticleEmitter2Payload::latitude, R"doc(Degrees, unlike `PREM`'s.)doc")
.def_readwrite("gravity", &whiteout::models::wem::Wc3ParticleEmitter2Payload::gravity)
.def_readwrite("lifespan", &whiteout::models::wem::Wc3ParticleEmitter2Payload::lifespan, R"doc(Seconds.)doc")
.def_readwrite("emission_rate", &whiteout::models::wem::Wc3ParticleEmitter2Payload::emissionRate)
.def_readwrite("width", &whiteout::models::wem::Wc3ParticleEmitter2Payload::width, R"doc(The emission area, in model units.)doc")
.def_readwrite("length", &whiteout::models::wem::Wc3ParticleEmitter2Payload::length)
.def_readwrite("filter", &whiteout::models::wem::Wc3ParticleEmitter2Payload::filter)
.def_readwrite("rows", &whiteout::models::wem::Wc3ParticleEmitter2Payload::rows, R"doc(Flipbook grid.)doc")
.def_readwrite("columns", &whiteout::models::wem::Wc3ParticleEmitter2Payload::columns)
.def_readwrite("head_or_tail", &whiteout::models::wem::Wc3ParticleEmitter2Payload::headOrTail)
.def_readwrite("tail_length", &whiteout::models::wem::Wc3ParticleEmitter2Payload::tailLength)
.def_readwrite("time", &whiteout::models::wem::Wc3ParticleEmitter2Payload::time, R"doc(Where `middle` sits in the lifespan, 0..1.)doc")
.def_readwrite("start", &whiteout::models::wem::Wc3ParticleEmitter2Payload::start)
.def_readwrite("middle", &whiteout::models::wem::Wc3ParticleEmitter2Payload::middle)
.def_readwrite("end", &whiteout::models::wem::Wc3ParticleEmitter2Payload::end)
.def_readwrite("head_life", &whiteout::models::wem::Wc3ParticleEmitter2Payload::headLife)
.def_readwrite("head_decay", &whiteout::models::wem::Wc3ParticleEmitter2Payload::headDecay)
.def_readwrite("tail_life", &whiteout::models::wem::Wc3ParticleEmitter2Payload::tailLife)
.def_readwrite("tail_decay", &whiteout::models::wem::Wc3ParticleEmitter2Payload::tailDecay)
.def_readwrite("texture", &whiteout::models::wem::Wc3ParticleEmitter2Payload::texture, R"doc(-> `Document::textures`.)doc")
.def_readwrite("replaceable_id", &whiteout::models::wem::Wc3ParticleEmitter2Payload::replaceableId)
.def_readwrite("squirt", &whiteout::models::wem::Wc3ParticleEmitter2Payload::squirt, R"doc(Emission is a burst per rate key, not a rate.)doc")
.def_readwrite("priority_plane", &whiteout::models::wem::Wc3ParticleEmitter2Payload::priorityPlane)
.def_readwrite("unshaded", &whiteout::models::wem::Wc3ParticleEmitter2Payload::unshaded, R"doc(0x8000.)doc")
.def_readwrite("sort_prims_far_z", &whiteout::models::wem::Wc3ParticleEmitter2Payload::sortPrimsFarZ, R"doc(0x10000.)doc")
.def_readwrite("line_emitter", &whiteout::models::wem::Wc3ParticleEmitter2Payload::lineEmitter, R"doc(0x20000.)doc")
.def_readwrite("unfogged", &whiteout::models::wem::Wc3ParticleEmitter2Payload::unfogged, R"doc(0x40000.)doc")
.def_readwrite("xy_quad", &whiteout::models::wem::Wc3ParticleEmitter2Payload::xyQuad, R"doc(0x100000.)doc")
;
py::class_<whiteout::models::wem::Wc3RibbonEmitterPayload>(m, "Wc3RibbonEmitterPayload", R"doc(`RIBB`: a strip swept between `heightAbove` and `heightBelow` of the node.
Its colour, alpha and flipbook cell key on the shared `Color`, `Alpha` and `TextureIndex` channels and rest here.)doc")
.def(py::init<>())
.def_readwrite("height_above", &whiteout::models::wem::Wc3RibbonEmitterPayload::heightAbove)
.def_readwrite("height_below", &whiteout::models::wem::Wc3RibbonEmitterPayload::heightBelow)
.def_readwrite("alpha", &whiteout::models::wem::Wc3RibbonEmitterPayload::alpha)
.def_readwrite("color", &whiteout::models::wem::Wc3RibbonEmitterPayload::color, R"doc(RGB, red first.)doc")
.def_readwrite("lifespan", &whiteout::models::wem::Wc3RibbonEmitterPayload::lifespan, R"doc(Seconds a segment lives.)doc")
.def_readwrite("texture_slot", &whiteout::models::wem::Wc3RibbonEmitterPayload::textureSlot, R"doc(The flipbook cell.)doc")
.def_readwrite("emission_rate", &whiteout::models::wem::Wc3RibbonEmitterPayload::emissionRate, R"doc(Segments a second.)doc")
.def_readwrite("rows", &whiteout::models::wem::Wc3RibbonEmitterPayload::rows)
.def_readwrite("columns", &whiteout::models::wem::Wc3RibbonEmitterPayload::columns)
.def_readwrite("material_slot", &whiteout::models::wem::Wc3RibbonEmitterPayload::materialSlot, R"doc(-> `Model::materialSlots`.)doc")
.def_readwrite("gravity", &whiteout::models::wem::Wc3RibbonEmitterPayload::gravity)
;
py::class_<whiteout::models::wem::Wc3CornEmitterPayload>(m, "Wc3CornEmitterPayload", R"doc(`CORN`: a PopcornFX effect run at the node (Reforged).
The effect itself is a `.pkb` WEM does not hold, named by `effect`; what the model owns is the five numbers the game hands the effect every frame. They are MULTIPLIERS on the effect's own values (the game's reader names each track so: "lifespan multiplier keys", ...), which is why they rest at 1.
Its colour, alpha and visibility key on the shared `Color`, `Alpha` and `Visibility` channels and rest here; lifespan, emission rate and speed are `Wc3CornProperty` channels. A keyed colour is blue first in the file, like every other Warcraft III colour key (`ReadBinParticleEmitterPopcorn` keeps the keys as read and reverses only the static colour); the channel is RGB.)doc")
.def(py::init<>())
.def_readwrite("lifespan", &whiteout::models::wem::Wc3CornEmitterPayload::lifespan, R"doc(Multiplies the effect's particle lifespan.)doc")
.def_readwrite("emission_rate", &whiteout::models::wem::Wc3CornEmitterPayload::emissionRate, R"doc(Multiplies its emission rate.)doc")
.def_readwrite("speed", &whiteout::models::wem::Wc3CornEmitterPayload::speed, R"doc(Multiplies its particle speed.)doc")
.def_readwrite("color", &whiteout::models::wem::Wc3CornEmitterPayload::color, R"doc(Multiplies its colour. RGB, red first.)doc")
.def_readwrite("alpha", &whiteout::models::wem::Wc3CornEmitterPayload::alpha, R"doc(Multiplies its alpha.)doc")
.def_readwrite("replaceable_id", &whiteout::models::wem::Wc3CornEmitterPayload::replaceableId, R"doc(The team colour/glow the effect's textures take.)doc")
.def_readwrite("effect", &whiteout::models::wem::Wc3CornEmitterPayload::effect, R"doc(The PopcornFX effect, by path — a `.pkb`.)doc")
.def_readwrite("anim_visibility_guide", &whiteout::models::wem::Wc3CornEmitterPayload::animVisibilityGuide, R"doc(The effect's animation-visibility guide, by name. Opaque here: the engine resolves it against the effect.)doc")
.def_readwrite("unshaded", &whiteout::models::wem::Wc3CornEmitterPayload::unshaded, R"doc(0x8000.)doc")
.def_readwrite("sort_prims_far_z", &whiteout::models::wem::Wc3CornEmitterPayload::sortPrimsFarZ, R"doc(0x10000.)doc")
.def_readwrite("unfogged", &whiteout::models::wem::Wc3CornEmitterPayload::unfogged, R"doc(0x20000.)doc")
.def_readwrite("popcorn_scaling", &whiteout::models::wem::Wc3CornEmitterPayload::popcornScaling, R"doc(0x40000: the node's scale reaches the effect.)doc")
;
py::class_<whiteout::models::wem::M2ParticleEmitterPayload>(m, "M2ParticleEmitterPayload", R"doc(`M2Particle`: WoW's emitter — Warcraft III's `PRE2` grown up.
The record's own frame and flags. The emitter sits on its node the way the game places it: turned a quarter about Z (`baseFlip`), so the record's X is the node's Y. `flags` is the record's word as the file holds it (its bits are `m2::ParticleFlag`); what they mean to another system is the crossing's to decide, not a field's.
The lifetime curves are the record's fake-animation blocks: times over the particle's life in 0..1, colours 0..1 red first, alpha 0..1, sizes in model units, cells as sprite-sheet indices.)doc")
.def(py::init<>())
.def_readwrite("particle_id", &whiteout::models::wem::M2ParticleEmitterPayload::particleId)
.def_readwrite("flags", &whiteout::models::wem::M2ParticleEmitterPayload::flags)
.def_readwrite("texture", &whiteout::models::wem::M2ParticleEmitterPayload::texture, R"doc(-> `Document::textures`. A multi-texture record (`flags` bit 0x10000000) binds all three; any other only the first.)doc")
.def_readwrite("texture2", &whiteout::models::wem::M2ParticleEmitterPayload::texture2)
.def_readwrite("texture3", &whiteout::models::wem::M2ParticleEmitterPayload::texture3)
.def_readwrite("blend", &whiteout::models::wem::M2ParticleEmitterPayload::blend, R"doc(The M2 material blend numbering: 2 alpha, 4 add, ...)doc")
.def_readwrite("emitter_type", &whiteout::models::wem::M2ParticleEmitterPayload::emitterType, R"doc(1 plane, 2 sphere, 3 spline, 4 bone.)doc")
.def_readwrite("color_index", &whiteout::models::wem::M2ParticleEmitterPayload::colorIndex, R"doc(11..13 recolour from the creature display's particle colours, which a host resolves into `colors`.)doc")
.def_readwrite("rows", &whiteout::models::wem::M2ParticleEmitterPayload::rows)
.def_readwrite("columns", &whiteout::models::wem::M2ParticleEmitterPayload::columns)
.def_readwrite("priority_plane", &whiteout::models::wem::M2ParticleEmitterPayload::priorityPlane)
.def_readwrite("speed", &whiteout::models::wem::M2ParticleEmitterPayload::speed)
.def_readwrite("speed_variation", &whiteout::models::wem::M2ParticleEmitterPayload::speedVariation)
.def_readwrite("vertical_range", &whiteout::models::wem::M2ParticleEmitterPayload::verticalRange)
.def_readwrite("horizontal_range", &whiteout::models::wem::M2ParticleEmitterPayload::horizontalRange)
.def_readwrite("gravity", &whiteout::models::wem::M2ParticleEmitterPayload::gravity)
.def_readwrite("lifespan", &whiteout::models::wem::M2ParticleEmitterPayload::lifespan)
.def_readwrite("lifespan_variation", &whiteout::models::wem::M2ParticleEmitterPayload::lifespanVariation)
.def_readwrite("emission_rate", &whiteout::models::wem::M2ParticleEmitterPayload::emissionRate)
.def_readwrite("emission_rate_variation", &whiteout::models::wem::M2ParticleEmitterPayload::emissionRateVariation)
.def_readwrite("width", &whiteout::models::wem::M2ParticleEmitterPayload::width)
.def_readwrite("length", &whiteout::models::wem::M2ParticleEmitterPayload::length)
.def_readwrite("z_source", &whiteout::models::wem::M2ParticleEmitterPayload::zSource)
.def_readwrite("color_times", &whiteout::models::wem::M2ParticleEmitterPayload::colorTimes)
.def_readwrite("colors", &whiteout::models::wem::M2ParticleEmitterPayload::colors)
.def_readwrite("alpha_times", &whiteout::models::wem::M2ParticleEmitterPayload::alphaTimes)
.def_readwrite("alphas", &whiteout::models::wem::M2ParticleEmitterPayload::alphas)
.def_readwrite("scale_times", &whiteout::models::wem::M2ParticleEmitterPayload::scaleTimes)
.def_readwrite("scales", &whiteout::models::wem::M2ParticleEmitterPayload::scales)
.def_readwrite("scale_variation", &whiteout::models::wem::M2ParticleEmitterPayload::scaleVariation)
.def_readwrite("head_cell_times", &whiteout::models::wem::M2ParticleEmitterPayload::headCellTimes)
.def_readwrite("head_cells", &whiteout::models::wem::M2ParticleEmitterPayload::headCells)
.def_readwrite("tail_cell_times", &whiteout::models::wem::M2ParticleEmitterPayload::tailCellTimes)
.def_readwrite("tail_cells", &whiteout::models::wem::M2ParticleEmitterPayload::tailCells)
.def_readwrite("tail_length", &whiteout::models::wem::M2ParticleEmitterPayload::tailLength)
.def_readwrite("twinkle_speed", &whiteout::models::wem::M2ParticleEmitterPayload::twinkleSpeed)
.def_readwrite("twinkle_percent", &whiteout::models::wem::M2ParticleEmitterPayload::twinklePercent)
.def_readwrite("twinkle_scale", &whiteout::models::wem::M2ParticleEmitterPayload::twinkleScale)
.def_readwrite("drag", &whiteout::models::wem::M2ParticleEmitterPayload::drag)
.def_readwrite("base_spin", &whiteout::models::wem::M2ParticleEmitterPayload::baseSpin)
.def_readwrite("base_spin_variation", &whiteout::models::wem::M2ParticleEmitterPayload::baseSpinVariation)
.def_readwrite("spin", &whiteout::models::wem::M2ParticleEmitterPayload::spin)
.def_readwrite("spin_variation", &whiteout::models::wem::M2ParticleEmitterPayload::spinVariation)
.def_readwrite("wind", &whiteout::models::wem::M2ParticleEmitterPayload::wind)
.def_readwrite("wind_time", &whiteout::models::wem::M2ParticleEmitterPayload::windTime)
.def_readwrite("spline_points", &whiteout::models::wem::M2ParticleEmitterPayload::splinePoints)
.def_readwrite("texture2_scale", &whiteout::models::wem::M2ParticleEmitterPayload::texture2Scale, R"doc(A multi-texture record's second and third layers. Each spans `Scale` tiles across the quad from an origin drawn at birth, anywhere in the tile, and scrolls `ScrollMid + r * ScrollRange` UV a second, with one draw r in [-1, 1] per layer and particle.)doc")
.def_readwrite("texture3_scale", &whiteout::models::wem::M2ParticleEmitterPayload::texture3Scale)
.def_readwrite("texture2_scroll_mid", &whiteout::models::wem::M2ParticleEmitterPayload::texture2ScrollMid)
.def_readwrite("texture3_scroll_mid", &whiteout::models::wem::M2ParticleEmitterPayload::texture3ScrollMid)
.def_readwrite("texture2_scroll_range", &whiteout::models::wem::M2ParticleEmitterPayload::texture2ScrollRange)
.def_readwrite("texture3_scroll_range", &whiteout::models::wem::M2ParticleEmitterPayload::texture3ScrollRange)
.def_readwrite("inherit_velocity_scale", &whiteout::models::wem::M2ParticleEmitterPayload::inheritVelocityScale, R"doc(How much of its emitter's velocity an `InheritVelocity` particle takes.)doc")
.def_readwrite("follow_speed1", &whiteout::models::wem::M2ParticleEmitterPayload::followSpeed1, R"doc(`FollowPosition`'s line: a particle follows its emitter's travel by `followScale1` at emitter speed `followSpeed1`, by `followScale2` at `followSpeed2`, linearly between and clamped to [0, 1].)doc")
.def_readwrite("follow_scale1", &whiteout::models::wem::M2ParticleEmitterPayload::followScale1)
.def_readwrite("follow_speed2", &whiteout::models::wem::M2ParticleEmitterPayload::followSpeed2)
.def_readwrite("follow_scale2", &whiteout::models::wem::M2ParticleEmitterPayload::followScale2)
.def_readwrite("tumble_min", &whiteout::models::wem::M2ParticleEmitterPayload::tumbleMin, R"doc(A model particle's angular velocity, drawn per axis in [min, max] (radians a second).)doc")
.def_readwrite("tumble_max", &whiteout::models::wem::M2ParticleEmitterPayload::tumbleMax)
.def_readwrite("color_mult", &whiteout::models::wem::M2ParticleEmitterPayload::colorMult, R"doc(The `EXPT` extension's multipliers on the colour and alpha curves; 1 without one.)doc")
.def_readwrite("alpha_mult", &whiteout::models::wem::M2ParticleEmitterPayload::alphaMult)
.def_readwrite("alpha_cutoff_times", &whiteout::models::wem::M2ParticleEmitterPayload::alphaCutoffTimes, R"doc(The `EXP2` extension's alpha cutoff over the particle's life; empty without one.)doc")
.def_readwrite("alpha_cutoffs", &whiteout::models::wem::M2ParticleEmitterPayload::alphaCutoffs)
;
py::class_<whiteout::models::wem::Sc2Variation>(m, "Sc2Variation", R"doc(One of the per-particle variation channels: a curve type, and the amplitude and frequency it runs at.)doc")
.def(py::init<>())
.def_readwrite("type", &whiteout::models::wem::Sc2Variation::type, R"doc(0 = none.)doc")
.def_readwrite("amplitude", &whiteout::models::wem::Sc2Variation::amplitude)
.def_readwrite("frequency", &whiteout::models::wem::Sc2Variation::frequency)
;
py::class_<whiteout::models::wem::Sc2ParticleEmitterPayload>(m, "Sc2ParticleEmitterPayload", R"doc(`PAR_` — the StarCraft II particle system — or one `PARC` copy of it.
Field names are the M3 record's. The bit words keep the file's own bits: `flags` is `m3::ParticleFlag`, `additionalFlags` `m3::ParticleAdditionalFlag`, `rotationFlags` `m3::ParticleRotationFlag`.
**A copy is a node too.** A `PARC` is another emission point of one system — its own bone, emission rate and squirt, the source's everything else — so it imports as a `Sc2ParticleEmitter` node under that bone whose `copyOf` names the source, and reads nothing of its payload but `emissionRate` and `squirtAmount`. The engine numbers copies as slots 1..n in node order.)doc")
.def(py::init<>())
.def_readwrite("copy_of", &whiteout::models::wem::Sc2ParticleEmitterPayload::copyOf, R"doc(Set on a `PARC`: the emitter it copies.)doc")
.def_readwrite("material_slot", &whiteout::models::wem::Sc2ParticleEmitterPayload::materialSlot, R"doc(-> `Model::materialSlots`.)doc")
.def_readwrite("additional_flags", &whiteout::models::wem::Sc2ParticleEmitterPayload::additionalFlags)
.def_readwrite("initial_speed", &whiteout::models::wem::Sc2ParticleEmitterPayload::initialSpeed)
.def_readwrite("initial_speed_random", &whiteout::models::wem::Sc2ParticleEmitterPayload::initialSpeedRandom)
.def_readwrite("initial_yaw", &whiteout::models::wem::Sc2ParticleEmitterPayload::initialYaw)
.def_readwrite("initial_pitch", &whiteout::models::wem::Sc2ParticleEmitterPayload::initialPitch)
.def_readwrite("initial_horizontal", &whiteout::models::wem::Sc2ParticleEmitterPayload::initialHorizontal)
.def_readwrite("initial_vertical", &whiteout::models::wem::Sc2ParticleEmitterPayload::initialVertical)
.def_readwrite("lifetime", &whiteout::models::wem::Sc2ParticleEmitterPayload::lifetime)
.def_readwrite("lifetime_random", &whiteout::models::wem::Sc2ParticleEmitterPayload::lifetimeRandom)
.def_readwrite("kill_radius", &whiteout::models::wem::Sc2ParticleEmitterPayload::killRadius)
.def_readwrite("gravity_x", &whiteout::models::wem::Sc2ParticleEmitterPayload::gravityX, R"doc(Stored as the file does; 0 everywhere shipped.)doc")
.def_readwrite("gravity_y", &whiteout::models::wem::Sc2ParticleEmitterPayload::gravityY)
.def_readwrite("gravity", &whiteout::models::wem::Sc2ParticleEmitterPayload::gravity)
.def_readwrite("size_mid_time", &whiteout::models::wem::Sc2ParticleEmitterPayload::sizeMidTime)
.def_readwrite("color_mid_time", &whiteout::models::wem::Sc2ParticleEmitterPayload::colorMidTime)
.def_readwrite("alpha_mid_time", &whiteout::models::wem::Sc2ParticleEmitterPayload::alphaMidTime)
.def_readwrite("rotation_mid_time", &whiteout::models::wem::Sc2ParticleEmitterPayload::rotationMidTime)
.def_readwrite("size_mid_hold_time", &whiteout::models::wem::Sc2ParticleEmitterPayload::sizeMidHoldTime)
.def_readwrite("color_mid_hold_time", &whiteout::models::wem::Sc2ParticleEmitterPayload::colorMidHoldTime)
.def_readwrite("alpha_mid_hold_time", &whiteout::models::wem::Sc2ParticleEmitterPayload::alphaMidHoldTime)
.def_readwrite("rotation_mid_hold_time", &whiteout::models::wem::Sc2ParticleEmitterPayload::rotationMidHoldTime)
.def_readwrite("size_animation", &whiteout::models::wem::Sc2ParticleEmitterPayload::sizeAnimation, R"doc(Birth, middle, death.)doc")
.def_readwrite("rotation_animation", &whiteout::models::wem::Sc2ParticleEmitterPayload::rotationAnimation, R"doc(Birth, middle, death.)doc")
.def_readwrite("color_start", &whiteout::models::wem::Sc2ParticleEmitterPayload::colorStart)
.def_readwrite("color_mid", &whiteout::models::wem::Sc2ParticleEmitterPayload::colorMid)
.def_readwrite("color_end", &whiteout::models::wem::Sc2ParticleEmitterPayload::colorEnd)
.def_readwrite("drag", &whiteout::models::wem::Sc2ParticleEmitterPayload::drag)
.def_readwrite("mass", &whiteout::models::wem::Sc2ParticleEmitterPayload::mass)
.def_readwrite("mass_random", &whiteout::models::wem::Sc2ParticleEmitterPayload::massRandom)
.def_readwrite("mass_size_multiplier", &whiteout::models::wem::Sc2ParticleEmitterPayload::massSizeMultiplier)
.def_readwrite("local_forces", &whiteout::models::wem::Sc2ParticleEmitterPayload::localForces, R"doc(Force channel masks.)doc")
.def_readwrite("world_forces", &whiteout::models::wem::Sc2ParticleEmitterPayload::worldForces)
.def_readwrite("local_forces_fallback", &whiteout::models::wem::Sc2ParticleEmitterPayload::localForcesFallback)
.def_readwrite("world_forces_fallback", &whiteout::models::wem::Sc2ParticleEmitterPayload::worldForcesFallback)
.def_readwrite("world_forces_mass_multiplier", &whiteout::models::wem::Sc2ParticleEmitterPayload::worldForcesMassMultiplier)
.def_readwrite("noise_amplitude", &whiteout::models::wem::Sc2ParticleEmitterPayload::noiseAmplitude)
.def_readwrite("noise_frequency", &whiteout::models::wem::Sc2ParticleEmitterPayload::noiseFrequency)
.def_readwrite("noise_coherence", &whiteout::models::wem::Sc2ParticleEmitterPayload::noiseCoherence)
.def_readwrite("noise_edge", &whiteout::models::wem::Sc2ParticleEmitterPayload::noiseEdge)
.def_readwrite("index_plus_length", &whiteout::models::wem::Sc2ParticleEmitterPayload::indexPlusLength)
.def_readwrite("max_particles", &whiteout::models::wem::Sc2ParticleEmitterPayload::maxParticles)
.def_readwrite("emission_rate", &whiteout::models::wem::Sc2ParticleEmitterPayload::emissionRate)
.def_readwrite("emitter_shape", &whiteout::models::wem::Sc2ParticleEmitterPayload::emitterShape)
.def_readwrite("shape_outer", &whiteout::models::wem::Sc2ParticleEmitterPayload::shapeOuter)
.def_readwrite("shape_inner", &whiteout::models::wem::Sc2ParticleEmitterPayload::shapeInner)
.def_readwrite("outer_radius", &whiteout::models::wem::Sc2ParticleEmitterPayload::outerRadius)
.def_readwrite("inner_radius", &whiteout::models::wem::Sc2ParticleEmitterPayload::innerRadius)
.def_readwrite("shape_sections", &whiteout::models::wem::Sc2ParticleEmitterPayload::shapeSections, R"doc(The mesh sections a `Mesh` shape emits from: sections of `Model::meshes[0]`, which is the one division StarCraft II draws, so a section index is the region index the file stores.)doc")
.def_readwrite("velocity_type", &whiteout::models::wem::Sc2ParticleEmitterPayload::velocityType)
.def_readwrite("size_random_enable", &whiteout::models::wem::Sc2ParticleEmitterPayload::sizeRandomEnable)
.def_readwrite("size_random_animation", &whiteout::models::wem::Sc2ParticleEmitterPayload::sizeRandomAnimation)
.def_readwrite("rotation_random_enable", &whiteout::models::wem::Sc2ParticleEmitterPayload::rotationRandomEnable)
.def_readwrite("rotation_random_animation", &whiteout::models::wem::Sc2ParticleEmitterPayload::rotationRandomAnimation)
.def_readwrite("color_random_enable", &whiteout::models::wem::Sc2ParticleEmitterPayload::colorRandomEnable)
.def_readwrite("color_start_random", &whiteout::models::wem::Sc2ParticleEmitterPayload::colorStartRandom)
.def_readwrite("color_mid_random", &whiteout::models::wem::Sc2ParticleEmitterPayload::colorMidRandom)
.def_readwrite("color_end_random", &whiteout::models::wem::Sc2ParticleEmitterPayload::colorEndRandom)
.def_readwrite("alpha_random_enable", &whiteout::models::wem::Sc2ParticleEmitterPayload::alphaRandomEnable)
.def_readwrite("squirt_amount", &whiteout::models::wem::Sc2ParticleEmitterPayload::squirtAmount, R"doc(A burst count, keyed as a step.)doc")
.def_readwrite("flipbook_start_init_index", &whiteout::models::wem::Sc2ParticleEmitterPayload::flipbookStartInitIndex)
.def_readwrite("flipbook_start_stop_index", &whiteout::models::wem::Sc2ParticleEmitterPayload::flipbookStartStopIndex)
.def_readwrite("flipbook_end_init_index", &whiteout::models::wem::Sc2ParticleEmitterPayload::flipbookEndInitIndex)
.def_readwrite("flipbook_end_stop_index", &whiteout::models::wem::Sc2ParticleEmitterPayload::flipbookEndStopIndex)
.def_readwrite("flipbook_mid_time", &whiteout::models::wem::Sc2ParticleEmitterPayload::flipbookMidTime)
.def_readwrite("flipbook_columns", &whiteout::models::wem::Sc2ParticleEmitterPayload::flipbookColumns)
.def_readwrite("flipbook_rows", &whiteout::models::wem::Sc2ParticleEmitterPayload::flipbookRows)
.def_readwrite("flipbook_column_fraction", &whiteout::models::wem::Sc2ParticleEmitterPayload::flipbookColumnFraction)
.def_readwrite("flipbook_row_fraction", &whiteout::models::wem::Sc2ParticleEmitterPayload::flipbookRowFraction)
.def_readwrite("bounce", &whiteout::models::wem::Sc2ParticleEmitterPayload::bounce)
.def_readwrite("friction", &whiteout::models::wem::Sc2ParticleEmitterPayload::friction)
.def_readwrite("collision_spawn", &whiteout::models::wem::Sc2ParticleEmitterPayload::collisionSpawn, R"doc(The emitter a collision spawns from.)doc")
.def_readwrite("collision_spawn_min", &whiteout::models::wem::Sc2ParticleEmitterPayload::collisionSpawnMin)
.def_readwrite("collision_spawn_max", &whiteout::models::wem::Sc2ParticleEmitterPayload::collisionSpawnMax)
.def_readwrite("collision_spawn_chance", &whiteout::models::wem::Sc2ParticleEmitterPayload::collisionSpawnChance)
.def_readwrite("collision_spawn_energy", &whiteout::models::wem::Sc2ParticleEmitterPayload::collisionSpawnEnergy)
.def_readwrite("collision_die_bounce", &whiteout::models::wem::Sc2ParticleEmitterPayload::collisionDieBounce)
.def_readwrite("instance_type", &whiteout::models::wem::Sc2ParticleEmitterPayload::instanceType)
.def_readwrite("tail_length", &whiteout::models::wem::Sc2ParticleEmitterPayload::tailLength)
.def_readwrite("instance_angle", &whiteout::models::wem::Sc2ParticleEmitterPayload::instanceAngle)
.def_readwrite("instance_distance", &whiteout::models::wem::Sc2ParticleEmitterPayload::instanceDistance)
.def_readwrite("pitch", &whiteout::models::wem::Sc2ParticleEmitterPayload::pitch)
.def_readwrite("yaw", &whiteout::models::wem::Sc2ParticleEmitterPayload::yaw)
.def_readwrite("speed", &whiteout::models::wem::Sc2ParticleEmitterPayload::speed)
.def_readwrite("size", &whiteout::models::wem::Sc2ParticleEmitterPayload::size)
.def_readwrite("alpha", &whiteout::models::wem::Sc2ParticleEmitterPayload::alpha)
.def_readwrite("color", &whiteout::models::wem::Sc2ParticleEmitterPayload::color)
.def_readwrite("rotation", &whiteout::models::wem::Sc2ParticleEmitterPayload::rotation)
.def_readwrite("horizontal", &whiteout::models::wem::Sc2ParticleEmitterPayload::horizontal)
.def_readwrite("vertical", &whiteout::models::wem::Sc2ParticleEmitterPayload::vertical)
.def_readwrite("particle_velocity", &whiteout::models::wem::Sc2ParticleEmitterPayload::particleVelocity)
.def_readwrite("phase_shift", &whiteout::models::wem::Sc2ParticleEmitterPayload::phaseShift)
.def_readwrite("flags", &whiteout::models::wem::Sc2ParticleEmitterPayload::flags)
.def_readwrite("rotation_flags", &whiteout::models::wem::Sc2ParticleEmitterPayload::rotationFlags)
.def_readwrite("color_smoothing", &whiteout::models::wem::Sc2ParticleEmitterPayload::colorSmoothing)
.def_readwrite("size_smoothing", &whiteout::models::wem::Sc2ParticleEmitterPayload::sizeSmoothing)
.def_readwrite("rotation_smoothing", &whiteout::models::wem::Sc2ParticleEmitterPayload::rotationSmoothing)
.def_readwrite("alpha_threshold", &whiteout::models::wem::Sc2ParticleEmitterPayload::alphaThreshold)
.def_readwrite("uv_offset", &whiteout::models::wem::Sc2ParticleEmitterPayload::uvOffset)
.def_readwrite("uv_angle", &whiteout::models::wem::Sc2ParticleEmitterPayload::uvAngle)
.def_readwrite("uv_tiling", &whiteout::models::wem::Sc2ParticleEmitterPayload::uvTiling)
.def_readwrite("spline_points", &whiteout::models::wem::Sc2ParticleEmitterPayload::splinePoints, R"doc(A `Spline` shape's path.)doc")
.def_readwrite("wind_multiplier", &whiteout::models::wem::Sc2ParticleEmitterPayload::windMultiplier)
.def_readwrite("lod_reduce", &whiteout::models::wem::Sc2ParticleEmitterPayload::lodReduce)
.def_readwrite("lod_cut", &whiteout::models::wem::Sc2ParticleEmitterPayload::lodCut)
.def_readwrite("lower_bound", &whiteout::models::wem::Sc2ParticleEmitterPayload::lowerBound)
.def_readwrite("upper_bound", &whiteout::models::wem::Sc2ParticleEmitterPayload::upperBound)
.def_readwrite("trail_link", &whiteout::models::wem::Sc2ParticleEmitterPayload::trailLink, R"doc(The emitter this one leaves trails with.)doc")
.def_readwrite("trail_chance", &whiteout::models::wem::Sc2ParticleEmitterPayload::trailChance)
.def_readwrite("trail_emission_rate", &whiteout::models::wem::Sc2ParticleEmitterPayload::trailEmissionRate)
.def_readwrite("splat_projection_index", &whiteout::models::wem::Sc2ParticleEmitterPayload::splatProjectionIndex, R"doc(A `PROJ` index. WEM holds no projectors, so the number is carried as the file had it; -1 is none, which is every shipped emitter measured.)doc")
.def_readwrite("splat_chance", &whiteout::models::wem::Sc2ParticleEmitterPayload::splatChance)
.def_readwrite("models", &whiteout::models::wem::Sc2ParticleEmitterPayload::models, R"doc(Model particles, by path (`SCHR`).)doc")
.def_readwrite("spawn_ribbon_on_bounce_chance", &whiteout::models::wem::Sc2ParticleEmitterPayload::spawnRibbonOnBounceChance)
.def_readwrite("ribbon_link", &whiteout::models::wem::Sc2ParticleEmitterPayload::ribbonLink, R"doc(The ribbon a bounce spawns.)doc")
.def_readwrite("noise_smoothness", &whiteout::models::wem::Sc2ParticleEmitterPayload::noiseSmoothness, R"doc(Pre-v12 only; the upgrade has nowhere to put it.)doc")
;
py::class_<whiteout::models::wem::Sc2RibbonSplinePoint>(m, "Sc2RibbonSplinePoint", R"doc(`SRIB`: one control point of a `RIB_`'s spline, riding a bone of its own.)doc")
.def(py::init<>())
.def_readwrite("node", &whiteout::models::wem::Sc2RibbonSplinePoint::node, R"doc(The bone it rides.)doc")
.def_readwrite("emission_offset", &whiteout::models::wem::Sc2RibbonSplinePoint::emissionOffset)
.def_readwrite("emission_vector", &whiteout::models::wem::Sc2RibbonSplinePoint::emissionVector)
.def_readwrite("velocity", &whiteout::models::wem::Sc2RibbonSplinePoint::velocity)
.def_readwrite("reserved", &whiteout::models::wem::Sc2RibbonSplinePoint::reserved)
.def_readwrite("velocity_base_factor", &whiteout::models::wem::Sc2RibbonSplinePoint::velocityBaseFactor)
.def_readwrite("velocity_end_factor", &whiteout::models::wem::Sc2RibbonSplinePoint::velocityEndFactor)
.def_readwrite("yaw_variation", &whiteout::models::wem::Sc2RibbonSplinePoint::yawVariation)
.def_readwrite("pitch_variation", &whiteout::models::wem::Sc2RibbonSplinePoint::pitchVariation)
.def_readwrite("velocity_variation", &whiteout::models::wem::Sc2RibbonSplinePoint::velocityVariation)
.def_readwrite("yaw", &whiteout::models::wem::Sc2RibbonSplinePoint::yaw)
.def_readwrite("pitch", &whiteout::models::wem::Sc2RibbonSplinePoint::pitch)
.def_readwrite("emission_vector_norm_factor", &whiteout::models::wem::Sc2RibbonSplinePoint::emissionVectorNormFactor, R"doc(Shipped as ~0.01 / |emissionVector|.)doc")
.def_readwrite("velocity_norm_factor", &whiteout::models::wem::Sc2RibbonSplinePoint::velocityNormFactor, R"doc(Shipped as ~0.01 / velocity.)doc")
;
py::class_<whiteout::models::wem::Sc2RibbonEmitterPayload>(m, "Sc2RibbonEmitterPayload", R"doc(`RIB_` — the StarCraft II ribbon.
Its bone is the node's parent. The record's second `u16` beside the bone is the high half of one `u32` bone index to the editor, zero on every shipped ribbon, and is written as zero rather than carried. `flags` is `m3::RibbonFlag`, `additionalFlags` `m3::RibbonAdditionalFlag`.)doc")
.def(py::init<>())
.def_readwrite("material_slot", &whiteout::models::wem::Sc2RibbonEmitterPayload::materialSlot, R"doc(-> `Model::materialSlots`.)doc")
.def_readwrite("additional_flags", &whiteout::models::wem::Sc2RibbonEmitterPayload::additionalFlags)
.def_readwrite("initial_speed", &whiteout::models::wem::Sc2RibbonEmitterPayload::initialSpeed)
.def_readwrite("initial_speed_random", &whiteout::models::wem::Sc2RibbonEmitterPayload::initialSpeedRandom)
.def_readwrite("initial_yaw", &whiteout::models::wem::Sc2RibbonEmitterPayload::initialYaw)
.def_readwrite("initial_pitch", &whiteout::models::wem::Sc2RibbonEmitterPayload::initialPitch)
.def_readwrite("initial_horizontal", &whiteout::models::wem::Sc2RibbonEmitterPayload::initialHorizontal)
.def_readwrite("initial_vertical", &whiteout::models::wem::Sc2RibbonEmitterPayload::initialVertical)
.def_readwrite("lifetime", &whiteout::models::wem::Sc2RibbonEmitterPayload::lifetime)
.def_readwrite("lifetime_random", &whiteout::models::wem::Sc2RibbonEmitterPayload::lifetimeRandom)
.def_readwrite("kill_radius", &whiteout::models::wem::Sc2RibbonEmitterPayload::killRadius, R"doc(A `u32` in the ribbon record, unlike the particle's.)doc")
.def_readwrite("gravity_x", &whiteout::models::wem::Sc2RibbonEmitterPayload::gravityX)
.def_readwrite("gravity_y", &whiteout::models::wem::Sc2RibbonEmitterPayload::gravityY)
.def_readwrite("gravity", &whiteout::models::wem::Sc2RibbonEmitterPayload::gravity)
.def_readwrite("size_mid_time", &whiteout::models::wem::Sc2RibbonEmitterPayload::sizeMidTime)
.def_readwrite("color_mid_time", &whiteout::models::wem::Sc2RibbonEmitterPayload::colorMidTime)
.def_readwrite("alpha_mid_time", &whiteout::models::wem::Sc2RibbonEmitterPayload::alphaMidTime)
.def_readwrite("rotation_mid_time", &whiteout::models::wem::Sc2RibbonEmitterPayload::rotationMidTime)
.def_readwrite("size_mid_hold_time", &whiteout::models::wem::Sc2RibbonEmitterPayload::sizeMidHoldTime)
.def_readwrite("color_mid_hold_time", &whiteout::models::wem::Sc2RibbonEmitterPayload::colorMidHoldTime)
.def_readwrite("alpha_mid_hold_time", &whiteout::models::wem::Sc2RibbonEmitterPayload::alphaMidHoldTime)
.def_readwrite("rotation_mid_hold_time", &whiteout::models::wem::Sc2RibbonEmitterPayload::rotationMidHoldTime)
.def_readwrite("size_animation", &whiteout::models::wem::Sc2RibbonEmitterPayload::sizeAnimation)
.def_readwrite("rotation_animation", &whiteout::models::wem::Sc2RibbonEmitterPayload::rotationAnimation)
.def_readwrite("color_start", &whiteout::models::wem::Sc2RibbonEmitterPayload::colorStart)
.def_readwrite("color_mid", &whiteout::models::wem::Sc2RibbonEmitterPayload::colorMid)
.def_readwrite("color_end", &whiteout::models::wem::Sc2RibbonEmitterPayload::colorEnd)
.def_readwrite("drag", &whiteout::models::wem::Sc2RibbonEmitterPayload::drag)
.def_readwrite("mass", &whiteout::models::wem::Sc2RibbonEmitterPayload::mass)
.def_readwrite("mass_random", &whiteout::models::wem::Sc2RibbonEmitterPayload::massRandom)
.def_readwrite("mass_size_multiplier", &whiteout::models::wem::Sc2RibbonEmitterPayload::massSizeMultiplier)
.def_readwrite("local_forces", &whiteout::models::wem::Sc2RibbonEmitterPayload::localForces)
.def_readwrite("world_forces", &whiteout::models::wem::Sc2RibbonEmitterPayload::worldForces)
.def_readwrite("local_forces_fallback", &whiteout::models::wem::Sc2RibbonEmitterPayload::localForcesFallback)
.def_readwrite("world_forces_fallback", &whiteout::models::wem::Sc2RibbonEmitterPayload::worldForcesFallback)
.def_readwrite("world_forces_mass_multiplier", &whiteout::models::wem::Sc2RibbonEmitterPayload::worldForcesMassMultiplier)
.def_readwrite("noise_amplitude", &whiteout::models::wem::Sc2RibbonEmitterPayload::noiseAmplitude)
.def_readwrite("noise_frequency", &whiteout::models::wem::Sc2RibbonEmitterPayload::noiseFrequency)
.def_readwrite("noise_coherence", &whiteout::models::wem::Sc2RibbonEmitterPayload::noiseCoherence)
.def_readwrite("noise_edge", &whiteout::models::wem::Sc2RibbonEmitterPayload::noiseEdge)
.def_readwrite("index_plus_length", &whiteout::models::wem::Sc2RibbonEmitterPayload::indexPlusLength)
.def_readwrite("emitter_shape", &whiteout::models::wem::Sc2RibbonEmitterPayload::emitterShape)
.def_readwrite("ribbon_type", &whiteout::models::wem::Sc2RibbonEmitterPayload::ribbonType)
.def_readwrite("divisions", &whiteout::models::wem::Sc2RibbonEmitterPayload::divisions)
.def_readwrite("edges", &whiteout::models::wem::Sc2RibbonEmitterPayload::edges)
.def_readwrite("inner_radius", &whiteout::models::wem::Sc2RibbonEmitterPayload::innerRadius)
.def_readwrite("max_length", &whiteout::models::wem::Sc2RibbonEmitterPayload::maxLength)
.def_readwrite("spline_points", &whiteout::models::wem::Sc2RibbonEmitterPayload::splinePoints, R"doc(`SRIB`.)doc")
.def_readwrite("active", &whiteout::models::wem::Sc2RibbonEmitterPayload::active, R"doc(A flag, keyed as one. Rests at null 0 on every shipped ribbon.)doc")
.def_readwrite("flags", &whiteout::models::wem::Sc2RibbonEmitterPayload::flags)
.def_readwrite("size_smoothing", &whiteout::models::wem::Sc2RibbonEmitterPayload::sizeSmoothing)
.def_readwrite("color_smoothing", &whiteout::models::wem::Sc2RibbonEmitterPayload::colorSmoothing)
.def_readwrite("friction", &whiteout::models::wem::Sc2RibbonEmitterPayload::friction)
.def_readwrite("bounce", &whiteout::models::wem::Sc2RibbonEmitterPayload::bounce)
.def_readwrite("lod_reduce", &whiteout::models::wem::Sc2RibbonEmitterPayload::lodReduce)
.def_readwrite("lod_cut", &whiteout::models::wem::Sc2RibbonEmitterPayload::lodCut)
.def_readwrite("yaw", &whiteout::models::wem::Sc2RibbonEmitterPayload::yaw)
.def_readwrite("pitch", &whiteout::models::wem::Sc2RibbonEmitterPayload::pitch)
.def_readwrite("speed", &whiteout::models::wem::Sc2RibbonEmitterPayload::speed)
.def_readwrite("size", &whiteout::models::wem::Sc2RibbonEmitterPayload::size)
.def_readwrite("alpha", &whiteout::models::wem::Sc2RibbonEmitterPayload::alpha)
.def_readwrite("particle_velocity", &whiteout::models::wem::Sc2RibbonEmitterPayload::particleVelocity)
.def_readwrite("overlay", &whiteout::models::wem::Sc2RibbonEmitterPayload::overlay)
.def_readwrite("deprecated_unknown", &whiteout::models::wem::Sc2RibbonEmitterPayload::deprecatedUnknown, R"doc(Pre-v7 only (`unknown3fbae7d6`).)doc")
;
py::class_<whiteout::models::wem::ForceFieldPayload>(m, "ForceFieldPayload", R"doc(StarCraft II `FOR_`: pushes what is inside a volume. Particles and ribbons feel it when `affectsParticles` is set, rigid bodies when `affectsBodies` is and `channels` shares a bit with their `PhysicsBody::forceChannels`. Cloth has no force-field path.)doc")
.def(py::init<>())
.def_readwrite("kind", &whiteout::models::wem::ForceFieldPayload::kind)
.def_readwrite("volume", &whiteout::models::wem::ForceFieldPayload::volume)
.def_readwrite("falloff", &whiteout::models::wem::ForceFieldPayload::falloff)
.def_readwrite("height_gradient", &whiteout::models::wem::ForceFieldPayload::heightGradient)
.def_readwrite("unbounded", &whiteout::models::wem::ForceFieldPayload::unbounded)
.def_readwrite("affects_particles", &whiteout::models::wem::ForceFieldPayload::affectsParticles)
.def_readwrite("affects_bodies", &whiteout::models::wem::ForceFieldPayload::affectsBodies)
.def_readwrite("channels", &whiteout::models::wem::ForceFieldPayload::channels)
.def_readwrite("scope", &whiteout::models::wem::ForceFieldPayload::scope, R"doc(`FOR_` +8, read as the field's scope (0 = the model's own); no reader is traced yet, so it crosses verbatim.)doc")
.def_readwrite("strength", &whiteout::models::wem::ForceFieldPayload::strength)
.def_readwrite("width", &whiteout::models::wem::ForceFieldPayload::width)
.def_readwrite("height", &whiteout::models::wem::ForceFieldPayload::height)
.def_readwrite("length", &whiteout::models::wem::ForceFieldPayload::length)
;
py::class_<whiteout::models::wem::VertexWarpPayload>(m, "VertexWarpPayload", R"doc(StarCraft II `WRP_`: a vertex-shader deformation particles and ribbons opt into. An effect, not physics.)doc")
.def(py::init<>())
.def_readwrite("type", &whiteout::models::wem::VertexWarpPayload::type)
.def_readwrite("reserved", &whiteout::models::wem::VertexWarpPayload::reserved, R"doc(`WRP_` +8; no reader is traced yet, so it crosses verbatim.)doc")
.def_readwrite("radius", &whiteout::models::wem::VertexWarpPayload::radius)
.def_readwrite("height", &whiteout::models::wem::VertexWarpPayload::height)
.def_readwrite("strength", &whiteout::models::wem::VertexWarpPayload::strength)
.def_readwrite("angular", &whiteout::models::wem::VertexWarpPayload::angular)
.def_readwrite("axial", &whiteout::models::wem::VertexWarpPayload::axial)
.def_readwrite("radial", &whiteout::models::wem::VertexWarpPayload::radial)
;
py::class_<whiteout::models::wem::Transform>(m, "Transform", R"doc(TRS everywhere in WEM. Nothing stores a matrix that a TRS can express.)doc")
.def(py::init<>())
.def_readwrite("translation", &whiteout::models::wem::Transform::translation)
.def_readwrite("rotation", &whiteout::models::wem::Transform::rotation)
.def_readwrite("scale", &whiteout::models::wem::Transform::scale)
;
py::class_<whiteout::models::wem::Sphere>(m, "Sphere")
.def(py::init<>())
.def_readwrite("center", &whiteout::models::wem::Sphere::center)
.def_readwrite("radius", &whiteout::models::wem::Sphere::radius)
;
py::class_<whiteout::models::wem::HelperPayload>(m, "HelperPayload", R"doc(Empty for a Helper; the alternatives below are one per kind. Both empty payloads still reflect: an empty body writes nothing, and having one keeps every alternative visitable without the payload switch special-casing two.)doc")
.def(py::init<>())
;
py::class_<whiteout::models::wem::BonePayload>(m, "BonePayload")
.def(py::init<>())
.def_readwrite("bounds", &whiteout::models::wem::BonePayload::bounds, R"doc(D3 ships both a box and a sphere, per bone.)doc")
.def_readwrite("sphere", &whiteout::models::wem::BonePayload::sphere)
.def_readwrite("gate_mesh", &whiteout::models::wem::BonePayload::gateMesh, R"doc(MDX's bone -> geoset link: the mesh whose geoset animation gates this bone (its subtree is hidden while the mesh's alpha is 0) and, when that mesh is `SectionFlags::ProjectedShadow`, places it as a drop shadow. `kInvalidIndex`: none. `NODE` v5; an older chunk's link is migrated on read (`Node::migrateBoneGate`).)doc")
;
py::class_<whiteout::models::wem::AttachmentPayload>(m, "AttachmentPayload", R"doc(An attach point, and what is riding it.
The placement is the node — that is the whole of an MDX or `.m2` attachment, and of a D3 hardpoint, which is skeleton-relative data shipped with the skeleton. The equip-slot key (M2's attachment `id`, the hardpoint's own name) lives in `native`.
What rides it is the other half, and it is here rather than in a parallel list for §10.2's reason: removing or reparenting the node has to move everything that is *about* it, and a side table of `{node, child}` pairs would be one more referencer §10.6 has to invalidate.
Both halves are optional and independent. `asset` is what the source named — an effect WEM does not contain (§18), or a model it does. `model` is filled when that name resolved to something the document now holds, which is how a D3 child actor arrives: it converts to a `Model` of its own and the attach point points at it.)doc")
.def(py::init<>())
.def_readwrite("asset", &whiteout::models::wem::AttachmentPayload::asset, R"doc(What the source named, resolved or not.)doc")
.def_readwrite("model", &whiteout::models::wem::AttachmentPayload::model, R"doc(-> `Document::models[]` once it resolved.)doc")
;
py::class_<whiteout::models::wem::LightPayload>(m, "LightPayload")
.def(py::init<>())
.def_readwrite("kind", &whiteout::models::wem::LightPayload::kind)
.def_readwrite("color", &whiteout::models::wem::LightPayload::color)
.def_readwrite("intensity", &whiteout::models::wem::LightPayload::intensity)
.def_readwrite("attenuation_start", &whiteout::models::wem::LightPayload::attenuationStart)
.def_readwrite("attenuation_end", &whiteout::models::wem::LightPayload::attenuationEnd)
.def_readwrite("hot_spot", &whiteout::models::wem::LightPayload::hotSpot, R"doc(Spot cone inner angle.)doc")
.def_readwrite("falloff", &whiteout::models::wem::LightPayload::falloff, R"doc(Spot cone outer angle.)doc")
.def_readwrite("shadow_casting", &whiteout::models::wem::LightPayload::shadowCasting, R"doc(MDX v1300: the light casts shadows, over `shadowCastingStart` .. `shadowCastingEnd` from it — its shadow cube's near and far.)doc")
.def_readwrite("shadow_casting_start", &whiteout::models::wem::LightPayload::shadowCastingStart)
.def_readwrite("shadow_casting_end", &whiteout::models::wem::LightPayload::shadowCastingEnd)
.def_readwrite("quadratic_falloff", &whiteout::models::wem::LightPayload::quadraticFalloff, R"doc(MDX v1600: the distance falloff, a factor of `exp(-damping d²) / (1 + linearFalloff d + quadraticFalloff d²)` — unrelated to the spot cone's `falloff`.)doc")
.def_readwrite("linear_falloff", &whiteout::models::wem::LightPayload::linearFalloff)
.def_readwrite("damping", &whiteout::models::wem::LightPayload::damping)
;
py::class_<whiteout::models::wem::CameraPayload>(m, "CameraPayload")
.def(py::init<>())
.def_readwrite("fov", &whiteout::models::wem::CameraPayload::fov)
.def_readwrite("near_clip", &whiteout::models::wem::CameraPayload::nearClip)
.def_readwrite("far_clip", &whiteout::models::wem::CameraPayload::farClip)
.def_readwrite("target", &whiteout::models::wem::CameraPayload::target, R"doc(Where the camera looks, in model space. MDX and M2 store one; M3 and glTF aim a camera by its node's orientation instead, and leave this at the origin — which is also what a v3 `NODE` reads as. `Channel::Target` keys offset it, as `Translation` keys offset the node.)doc")
.def_readwrite("focus_distance", &whiteout::models::wem::CameraPayload::focusDistance, R"doc(Warcraft III 3.0's depth of field; 0 is unset. The game blurs only where all three have a value (`AnimateCamera`), and MDX stores no rests for them, only the IDUF/ELAF/PTSF keys.)doc")
.def_readwrite("focal_length", &whiteout::models::wem::CameraPayload::focalLength, R"doc(Millimetres.)doc")
.def_readwrite("f_stop", &whiteout::models::wem::CameraPayload::fStop)
;
py::class_<whiteout::models::wem::ParticlePayload>(m, "ParticlePayload")
.def(py::init<>())
.def_readwrite("system", &whiteout::models::wem::ParticlePayload::system, R"doc(WHAT runs here, never how (§18).)doc")
;
py::class_<whiteout::models::wem::RibbonPayload>(m, "RibbonPayload")
.def(py::init<>())
.def_readwrite("system", &whiteout::models::wem::RibbonPayload::system)
;
py::class_<whiteout::models::wem::EventPayload>(m, "EventPayload")
.def(py::init<>())
.def_readwrite("id", &whiteout::models::wem::EventPayload::id)
;
py::class_<whiteout::models::wem::CollisionShapeDesc>(m, "CollisionShapeDesc")
.def(py::init<>())
.def_readwrite("kind", &whiteout::models::wem::CollisionShapeDesc::kind)
.def_readwrite("box", &whiteout::models::wem::CollisionShapeDesc::box)
.def_readwrite("sphere", &whiteout::models::wem::CollisionShapeDesc::sphere)
.def_readwrite("height", &whiteout::models::wem::CollisionShapeDesc::height, R"doc(Capsule / cylinder length along the shape's local axis.)doc")
;
py::class_<whiteout::models::wem::CollisionPayload>(m, "CollisionPayload")
.def(py::init<>())
.def_readwrite("shape", &whiteout::models::wem::CollisionPayload::shape)
;
py::class_<whiteout::models::wem::Node>(m, "Node")
.def(py::init<>())
.def_readwrite("name", &whiteout::models::wem::Node::name)
.def_readwrite("parent", &whiteout::models::wem::Node::parent, R"doc(Index into `NodeTree::nodes`; invalid = a root.)doc")
.def_readwrite("kind", &whiteout::models::wem::Node::kind)
.def_readwrite("flags", &whiteout::models::wem::Node::flags)
.def_readwrite("pivot", &whiteout::models::wem::Node::pivot, R"doc(MDX `PIVT`; zero for the other three formats — a D3 `PRSTransform` is complete with no separate pivot.)doc")
.def_readwrite("local", &whiteout::models::wem::Node::local, R"doc(Bind-time local TRS.)doc")
.def_readwrite("uniform_scale_only", &whiteout::models::wem::Node::uniformScaleOnly, R"doc(D3 stores ONE scale float per bone; export asserts on this rather than silently writing the x component of a non-uniform scale.)doc")
.def_readwrite("poses", &whiteout::models::wem::Node::poses, R"doc(Values for `NodeTree::poseSchema` — sized to it for Bone nodes, empty for kinds that carry none (§10.5).)doc")
.def_readwrite("native", &whiteout::models::wem::Node::native)
.def_readwrite("removed", &whiteout::models::wem::Node::removed, R"doc(Transient removal marker (§10.6).
`RemoveNode` marks; `CompactNodes` collects. It lives on the node rather than in a parallel status array for the same reason the poses do: removing or copying a node has to move everything that is about it. Never serialized — a written document is always compacted first.)doc")
;
py::class_<whiteout::models::wem::PoseSchema>(m, "PoseSchema")
.def(py::init<>())
.def_readwrite("name", &whiteout::models::wem::PoseSchema::name, R"doc("bind", "bindA", "bindAInverse", …)doc")
.def_readwrite("space", &whiteout::models::wem::PoseSchema::space)
.def_readwrite("inverse", &whiteout::models::wem::PoseSchema::inverse)
.def_readwrite("storage", &whiteout::models::wem::PoseSchema::storage)
;
py::class_<whiteout::models::wem::NodeTree>(m, "NodeTree")
.def(py::init<>())
.def_readwrite("nodes", &whiteout::models::wem::NodeTree::nodes, R"doc(Parents precede children.)doc")
.def_readwrite("pose_schema", &whiteout::models::wem::NodeTree::poseSchema)
.def_readwrite("authoritative_pose", &whiteout::models::wem::NodeTree::authoritativePose, R"doc(Which schema entry a profile treats as *the* bind pose.)doc")
.def_readwrite("rig", &whiteout::models::wem::NodeTree::rig, R"doc(What convention the values above are in — the fact that decides whether a `.mdx` exporter may write `pivot` and an `.m3` one may write `IREF` straight through.
Set by every importer, read by `RetargetSkeleton` and by the four exporters. It is a property of what the tree *holds*, and `ProfileDesc::rig` is the property of what a format *wants*; a retarget is the operation between them.)doc")
.def("size", &whiteout::models::wem::NodeTree::size)
.def("empty", &whiteout::models::wem::NodeTree::empty)
.def("add", &whiteout::models::wem::NodeTree::add, py::arg("node"), R"doc(Appends a node and returns its index. The caller is responsible for the parents-precede-children invariant; `Validate` checks it.)doc")
.def("clear", &whiteout::models::wem::NodeTree::clear)
.def("parents_precede_children", &whiteout::models::wem::NodeTree::parentsPrecedeChildren, R"doc(True when every node's parent index precedes it (or is invalid).)doc")
.def("sort_parents_first", &whiteout::models::wem::NodeTree::sortParentsFirst, R"doc(Reorders `nodes` so parents precede children and returns the remap (`remap[old] == new`). A cycle leaves the tree untouched and returns an empty remap.)doc")
.def("ensure_hierarchy", &whiteout::models::wem::NodeTree::ensureHierarchy, R"doc(Builds the child lists and the depth-first pre-order from `parent`.
Children come out in index order, so the build is deterministic and golden tests can compare traversal orders. Dropped by any structural mutation.
The pre-order is stored as one flat array with a per-node (offset, size), the Euler-tour layout: that makes `subtree()` a contiguous slice rather than a walk, so it can be a real range and two callers can hold two subtree ranges at once.)doc")
.def("invalidate_hierarchy", &whiteout::models::wem::NodeTree::invalidateHierarchy)
.def("has_hierarchy", &whiteout::models::wem::NodeTree::hasHierarchy)
.def("depth", &whiteout::models::wem::NodeTree::depth, py::arg("node"))
.def("world_bind", &whiteout::models::wem::NodeTree::worldBind, py::arg("node"), R"doc(Composes locals up the chain, honouring the inherit flags.
The same composition D3's `Skeleton_ComposeWorldPose` performs. A node flagged `ModelSpace` stops the walk: its local *is* its world.)doc")
.def("pose_of", &whiteout::models::wem::NodeTree::poseOf, py::arg("node"), py::arg("pose"), R"doc(The pose value for @p node under schema entry @p pose, or its `local` (composed to the schema's space) when the node carries no pose array.
A `PoseStorage::Matrix` entry answers with the *decomposition* of the stored matrix, which is what `poses` holds — use @ref poseMatrixOf when the exact value is what matters.)doc")
.def("pose_matrix_of", &whiteout::models::wem::NodeTree::poseMatrixOf, py::arg("node"), py::arg("pose"), R"doc(The same value as a matrix, and the authoritative one: a `PoseStorage::Matrix` entry with a stored matrix answers with it unchanged, and everything else composes @ref poseOf.)doc")
.def("conform_poses", &whiteout::models::wem::NodeTree::conformPoses, R"doc(Resizes every node's `poses` to `poseSchema.size()`, filling new entries from `worldBind`/`local` as the schema's space asks. Every kind, because a pose entry need not be a bind: MDX's `BPOS` is one and it is indexed by `objectId`, which numbers attachments, events and collision shapes too.)doc")
.def("inverse_bind_matrix", &whiteout::models::wem::NodeTree::inverseBindMatrix, py::arg("node"), R"doc(The matrix a skinning palette multiplies @p node's animated frame by — `skin = inverseBindMatrix(b) * world(b)`.
The one question every exporter and every evaluator actually has, and the only place `rig` needs to be read to answer it: an `ExplicitBind` tree answers with the shipped `IREF`/`tTransform4`, and a `PivotRelative` one with the inverse of the composed rest chain — identity in the animation's own terms, but the pivot chain is what `local` holds there, so the inverse of `worldBind` is what makes the two agree at the bind pose.)doc")
.def("inferred_rig", &whiteout::models::wem::NodeTree::inferredRig, R"doc(The convention `poseSchema` implies, for a tree that never recorded one: an inverse or matrix pose entry exists only to carry an explicit bind.)doc")
;
py::class_<whiteout::models::wem::MaterialChannelRef>(m, "MaterialChannelRef", R"doc(Which material a channel drives, along the profile and look axes.
A material *index* alone is ambiguous the moment a model carries several sets (§6.3) and several looks (§8), so the reference is spelled the way `Resolve` is: profile, slot, look. It is deliberately not the resolved index — a look removal renumbers those, and a slot name does not.)doc")
.def(py::init<>())
.def_readwrite("profile", &whiteout::models::wem::MaterialChannelRef::profile)
.def_readwrite("slot", &whiteout::models::wem::MaterialChannelRef::slot, R"doc(-> `Model::materialSlots`.)doc")
.def_readwrite("look", &whiteout::models::wem::MaterialChannelRef::look, R"doc(-> the set's `LookTable`.)doc")
;
py::class_<whiteout::models::wem::TrackTarget>(m, "TrackTarget")
.def(py::init<>())
.def_readwrite("node", &whiteout::models::wem::TrackTarget::node, R"doc(`Kind::Node`: -> `Model::nodes`.)doc")
.def_readwrite("mesh", &whiteout::models::wem::TrackTarget::mesh, R"doc(`Kind::Section`: -> `Model::meshes`.)doc")
.def_readwrite("material", &whiteout::models::wem::TrackTarget::material)
.def_readwrite("sub", &whiteout::models::wem::TrackTarget::sub, R"doc(What `kind` says it is. For a node it separates same-named properties of one node — an `.m2` light keys an ambient colour beside its diffuse one — and is 0 for everything with only one.)doc")
.def_readwrite("channel", &whiteout::models::wem::TrackTarget::channel)
;
py::class_<whiteout::models::wem::AnimChannel>(m, "AnimChannel", R"doc(One animatable property, declared once. M3's AnimRef, hoisted out of the owner structs into a per-model table.)doc")
.def(py::init<>())
.def_readwrite("id", &whiteout::models::wem::AnimChannel::id, R"doc(The join key, stable for the model's life and **never reused**. M3's animId arrives here unchanged, which is what makes an `.m3a` merge a concatenation rather than a re-resolution; the other three importers allocate ids and the value is theirs to choose.)doc")
.def_readwrite("target", &whiteout::models::wem::AnimChannel::target)
.def_readwrite("init_value", &whiteout::models::wem::AnimChannel::initValue, R"doc(One element of `valueType`, or empty. What an **opaque** container contributes for this channel when it holds no sub-track for it — the asymmetry M3's split-body playback is built on (§10.8.1). Empty means the source declared no rest value, not "zero".)doc")
;
py::class_<whiteout::models::wem::AnimChannelTable>(m, "AnimChannelTable", R"doc(The animatable properties of one model (§10.8).
Empty is a normal state — a model with no animation carries no channels.)doc")
.def(py::init<>())
.def_readwrite("channels", &whiteout::models::wem::AnimChannelTable::channels)
;
py::class_<whiteout::models::wem::TrackSet>(m, "TrackSet", R"doc(A named group of channels a clip can play on its own layer — the StarCraft II Art Tools' "track set", the source of split-body animation.
Only the grouping lives here. Which clips play a set, and at what priority, is each clip's `Clip::trackSets`; the containers themselves are made at export (`LayeredContainers`), so a clip's edited tracks stay in one place.)doc")
.def(py::init<>())
.def_readwrite("name", &whiteout::models::wem::TrackSet::name)
.def_readwrite("channels", &whiteout::models::wem::TrackSet::channels, R"doc(`AnimChannel::id`s. A stale id is ignored, not an error.)doc")
;
py::class_<whiteout::models::wem::SubTrack>(m, "SubTrack", R"doc(One channel's keyframe stream. M3's SD entry.
`times` are **seconds**, converted at import from whatever ticks the source counts in, and are **not clamped or padded to `Clip::duration`**: M3 wraps the playhead modulo the *track's* own length, so a sub-track outlasting or undershooting its clip is data, not an error (§10.8.2).)doc")
.def(py::init<>())
.def_readwrite("channel", &whiteout::models::wem::SubTrack::channel, R"doc(An `AnimChannel::id`, never an index into the table.)doc")
.def_readwrite("interp", &whiteout::models::wem::SubTrack::interp)
.def_readwrite("times", &whiteout::models::wem::SubTrack::times)
.def_readwrite("values", &whiteout::models::wem::SubTrack::values, R"doc(`times.size() * ValuesPerKey(interp) * AttrTypeSize(channel's valueType)` bytes. The type is on the channel because every sub-track that drives one must agree about it, and storing it here would let two disagree.)doc")
.def_readwrite("tcb", &whiteout::models::wem::SubTrack::tcb, R"doc(TCB parameters, three per key (tension, continuity, bias), or empty. Only meaningful on a `Hermite` sub-track: the tangents in `values` are the ones these produce, so a consumer that ignores this field plays the same curve. An editor keeps them to derive the tangents again when a key changes; a format without TCB drops them and keeps the curve.)doc")
;
py::class_<whiteout::models::wem::SubTrackContainer>(m, "SubTrackContainer", R"doc(One layer of a clip. M3's STC_.
`concurrent` is the asymmetry: a **transparent** container (true) holding no sub-track for a channel is skipped and lower layers show through; an **opaque** one contributes the channel's `initValue` at full weight, forcing un-keyed channels back to rest. Every non-M3 importer writes one opaque container at priority 0, which is the degenerate case of the same rule.)doc")
.def(py::init<>())
.def_readwrite("name", &whiteout::models::wem::SubTrackContainer::name)
.def_readwrite("priority", &whiteout::models::wem::SubTrackContainer::priority, R"doc(STC `animPriority`.)doc")
.def_readwrite("concurrent", &whiteout::models::wem::SubTrackContainer::concurrent, R"doc(STC `runsConcurrent`.)doc")
.def_readwrite("sub_tracks", &whiteout::models::wem::SubTrackContainer::subTracks)
.def_readwrite("native", &whiteout::models::wem::SubTrackContainer::native)
;
py::class_<whiteout::models::wem::ClipEvent>(m, "ClipEvent", R"doc(A discrete key firing at a node — the node is the *where*, the key is the *when*.
MDX's `EventObject` plus its KEVT timestamps, M3's SDEV keys, D3's `flEventFrame`. What the event *means* is the host's: WEM carries the name and one integer because that is all three formats agree on.
The node's **kind is not fixed**: MDX and `.m2` name a dedicated `Event` node, `.m3` names the bone the SDEV key sits on, and D3 names the attachment its hardpoint resolves to. All three are the place the event happens.)doc")
.def(py::init<>())
.def_readwrite("time", &whiteout::models::wem::ClipEvent::time, R"doc(Seconds from the clip's start.)doc")
.def_readwrite("node", &whiteout::models::wem::ClipEvent::node, R"doc(The node it fires at, of any kind; a §10.6 referencer.)doc")
.def_readwrite("name", &whiteout::models::wem::ClipEvent::name)
.def_readwrite("value", &whiteout::models::wem::ClipEvent::value)
;
py::class_<whiteout::models::wem::ClipTrackSet>(m, "ClipTrackSet", R"doc(One of the model's `TrackSet`s this clip plays on a layer of its own.
Every clip also plays the "default" set — whatever no listed set claims — in its own containers, at their priority.)doc")
.def(py::init<>())
.def_readwrite("set", &whiteout::models::wem::ClipTrackSet::set, R"doc(-> the clip's `Model::trackSets`.)doc")
.def_readwrite("priority", &whiteout::models::wem::ClipTrackSet::priority, R"doc(The layer's STC `animPriority`.)doc")
;
py::class_<whiteout::models::wem::Clip>(m, "Clip", R"doc(One playable animation. M3's SEQS plus its STG_.
`model` exists because a document holds several models (§9.1) and a channel id is only meaningful within one model's table — a clip that did not say whose nodes its sub-tracks name would be ambiguous the moment a D3 actor brought a second model along on a hardpoint.)doc")
.def(py::init<>())
.def_readwrite("name", &whiteout::models::wem::Clip::name)
.def_readwrite("model", &whiteout::models::wem::Clip::model, R"doc(-> `Document::models[]`. Whose channel table this drives.)doc")
.def_readwrite("duration", &whiteout::models::wem::Clip::duration, R"doc(Seconds.)doc")
.def_readwrite("looping", &whiteout::models::wem::Clip::looping)
.def_readwrite("flags", &whiteout::models::wem::Clip::flags)
.def_readwrite("containers", &whiteout::models::wem::Clip::containers, R"doc(>= 1; one is the common case.)doc")
.def_readwrite("events", &whiteout::models::wem::Clip::events)
.def_readwrite("native", &whiteout::models::wem::Clip::native)
.def_readwrite("bounds", &whiteout::models::wem::Clip::bounds, R"doc(What the model occupies while this clip plays, when the source said so. All zeros when it did not — which `valid()` calls well-formed, so test the extent for volume, not validity.
The one place WEM stores a bound it does not recompute. All four formats ship one per sequence — MDX's `Sequence::extent`, M2's `bounds`, M3's SEQS extents — and it is not derivable from the geometry: it is the union over the *posed* mesh across the clip, so recovering it means evaluating the whole skeleton at a sampling the source never recorded. A host reads it to frame a camera, and a conservative substitute (the model's own bounds) frames every clip as though it were the widest.)doc")
.def_readwrite("track_sets", &whiteout::models::wem::Clip::trackSets, R"doc(The track sets this clip plays split out of container 0; see `LayeredContainers`.)doc")
.def_readwrite("read_rule", &whiteout::models::wem::Clip::readRule, R"doc(How its tracks are read. A clip written before v4 derives it once, as it is read (`DerivedReadRule`).)doc")
;
py::class_<whiteout::models::wem::AnimTag>(m, "AnimTag", R"doc(One (tag -> clip) row. A struct rather than a `std::pair` because a pair has no `reflect()` and naming the halves is worth more than the two lines.)doc")
.def(py::init<>())
.def_readwrite("tag_id", &whiteout::models::wem::AnimTag::tagId, R"doc(The source's own tag id; D3 hashes a name into it.)doc")
.def_readwrite("clip", &whiteout::models::wem::AnimTag::clip, R"doc(-> `Document::clips[]`.)doc")
;
py::class_<whiteout::models::wem::AnimSet>(m, "AnimSet", R"doc(A named (tag -> clip) map, with a fallback.
D3's `.ans` is the shape this exists for: 30 tag maps in one asset, one core and 29 keyed by what the character is holding, and the runtime falls back to core when the weapon's map has no row for a tag. That is **one `AnimSet` per map**, with `baseAnimSet` pointing at the core one — the fallback field spelling the fallback, rather than a 30-wide struct nothing else could use. The same field carries `.ans`'s own `snoBaseAnimSet` link on the core set, because it means the same thing one level up.)doc")
.def(py::init<>())
.def_readwrite("name", &whiteout::models::wem::AnimSet::name)
.def_readwrite("by_tag", &whiteout::models::wem::AnimSet::byTag)
.def_readwrite("base_anim_set", &whiteout::models::wem::AnimSet::baseAnimSet, R"doc(-> `Document::animSets[]`.)doc")
;
py::class_<whiteout::models::wem::PhysicsMaterial>(m, "PhysicsMaterial")
.def(py::init<>())
.def_readwrite("density", &whiteout::models::wem::PhysicsMaterial::density, R"doc(The StarCraft II upgrade's default.)doc")
.def_readwrite("friction", &whiteout::models::wem::PhysicsMaterial::friction)
.def_readwrite("restitution", &whiteout::models::wem::PhysicsMaterial::restitution)
;
py::class_<whiteout::models::wem::PhysicsShape>(m, "PhysicsShape")
.def(py::init<>())
.def_readwrite("kind", &whiteout::models::wem::PhysicsShape::kind)
.def_readwrite("half_extents", &whiteout::models::wem::PhysicsShape::halfExtents, R"doc(Box.)doc")
.def_readwrite("radius", &whiteout::models::wem::PhysicsShape::radius, R"doc(Sphere, capsule, cylinder.)doc")
.def_readwrite("length", &whiteout::models::wem::PhysicsShape::length, R"doc(Along own +Z: a capsule's between its cap centres, a cylinder's whole.)doc")
.def_readwrite("points", &whiteout::models::wem::PhysicsShape::points, R"doc(Convex hull: the vertex set, own frame.)doc")
.def_readwrite("vertices", &whiteout::models::wem::PhysicsShape::vertices, R"doc(Triangle mesh, own frame.)doc")
.def_readwrite("triangles", &whiteout::models::wem::PhysicsShape::triangles, R"doc(Triangle mesh, three per face.)doc")
.def_readwrite("material", &whiteout::models::wem::PhysicsShape::material)
;
py::class_<whiteout::models::wem::Sc2BodyExtension>(m, "Sc2BodyExtension", R"doc(What only StarCraft II means by a body.)doc")
.def(py::init<>())
.def_readwrite("physics_material", &whiteout::models::wem::Sc2BodyExtension::physicsMaterial, R"doc(`physicsType`: a material id game data may override.)doc")
.def_readwrite("collidable", &whiteout::models::wem::Sc2BodyExtension::collidable, R"doc(Flag 0x1. } The collision filter.)doc")
.def_readwrite("walkable", &whiteout::models::wem::Sc2BodyExtension::walkable, R"doc(Flag 0x2. })doc")
.def_readwrite("stackable", &whiteout::models::wem::Sc2BodyExtension::stackable, R"doc(Flag 0x4. })doc")
.def_readwrite("simulate_collision", &whiteout::models::wem::Sc2BodyExtension::simulateCollision, R"doc(Flag 0x8. })doc")
.def_readwrite("keeps_bone_driven", &whiteout::models::wem::Sc2BodyExtension::keepsBoneDriven, R"doc(Flag 0x80: setup and deactivation leave the bone's physics bit.)doc")
.def_readwrite("untraced_flags", &whiteout::models::wem::Sc2BodyExtension::untracedFlags, R"doc(Flags 0x10, 0x20 and 0x200: consistently authored, no reader found in the client yet (WEM_PHYSICS_DESIGN.md §14), so kept as they came.)doc")
;
py::class_<whiteout::models::wem::PhysicsBody>(m, "PhysicsBody")
.def(py::init<>())
.def_readwrite("id", &whiteout::models::wem::PhysicsBody::id)
.def_readwrite("node", &whiteout::models::wem::PhysicsBody::node)
.def_readwrite("motion", &whiteout::models::wem::PhysicsBody::motion)
.def_readwrite("simulates", &whiteout::models::wem::PhysicsBody::simulates, R"doc(The rest value of `Channel::PhysicsDynamic`: whether it simulates where no key says otherwise.)doc")
.def_readwrite("shapes", &whiteout::models::wem::PhysicsBody::shapes)
.def_readwrite("linear_damping", &whiteout::models::wem::PhysicsBody::linearDamping)
.def_readwrite("angular_damping", &whiteout::models::wem::PhysicsBody::angularDamping)
.def_readwrite("inertia_scale", &whiteout::models::wem::PhysicsBody::inertiaScale)
.def_readwrite("gravity_scale", &whiteout::models::wem::PhysicsBody::gravityScale, R"doc(StarCraft II hard-wires 1; World of Warcraft authors it.)doc")
.def_readwrite("inherit_dynamic", &whiteout::models::wem::PhysicsBody::inheritDynamic, R"doc(Takes the nearest bodied ancestor's current state instead of its own (StarCraft II flag 0x40).)doc")
.def_readwrite("exempt_from_ragdoll", &whiteout::models::wem::PhysicsBody::exemptFromRagdoll, R"doc(Stays kinematic when the model ragdolls (StarCraft II flag 0x100).)doc")
.def_readwrite("force_channels", &whiteout::models::wem::PhysicsBody::forceChannels, R"doc(Which force fields act on it: matched against `ForceFieldPayload::channels`. StarCraft II's `localForces | worldForces << 16`.)doc")
.def_readwrite("sc2", &whiteout::models::wem::PhysicsBody::sc2)
;
}