havok_classes/generated/
hkbPoweredRagdollControlData_.rs

1use super::class_requires::*;
2use super::*;
3/// # C++ Info
4/// - name: `hkbPoweredRagdollControlData`
5/// - version: `3`
6/// - signature: `0xf5ba21b`
7/// - size: ` 32`(x86)/` 32`(x86_64)
8/// -  vtable: `false`
9#[allow(non_upper_case_globals, non_snake_case)]
10#[cfg_attr(feature = "json_schema", derive(schemars::JsonSchema))]
11#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
12#[derive(educe::Educe)]
13#[educe(Debug, Clone, Default, PartialEq)]
14pub struct hkbPoweredRagdollControlData {
15    /// # Unique index for this class
16    /// - Represents a pointer on XML (`<hkobject name="#0001"></hkobject>`)
17    /// - [`Option::None`] => This class is `class in field`.(`<hkobject></hkobject>`)
18    ///
19    /// # Note
20    /// Not present in the binary & Not exist actual C++ field.
21    #[cfg_attr(
22        feature = "serde",
23        serde(skip_serializing_if = "Option::is_none", default)
24    )]
25    pub __ptr: Option<Pointer>,
26    /// # C++ Info
27    /// - name: `maxForce`(ctype: `hkReal`)
28    /// - offset: `  0`(x86)/`  0`(x86_64)
29    /// - type_size: `  4`(x86)/`  4`(x86_64)
30    /// - flags: `ALIGN_16`
31    #[cfg_attr(feature = "json_schema", schemars(rename = "maxForce"))]
32    #[cfg_attr(feature = "serde", serde(rename = "maxForce"))]
33    pub m_maxForce: f32,
34    /// # C++ Info
35    /// - name: `tau`(ctype: `hkReal`)
36    /// - offset: `  4`(x86)/`  4`(x86_64)
37    /// - type_size: `  4`(x86)/`  4`(x86_64)
38    #[cfg_attr(feature = "json_schema", schemars(rename = "tau"))]
39    #[cfg_attr(feature = "serde", serde(rename = "tau"))]
40    pub m_tau: f32,
41    /// # C++ Info
42    /// - name: `damping`(ctype: `hkReal`)
43    /// - offset: `  8`(x86)/`  8`(x86_64)
44    /// - type_size: `  4`(x86)/`  4`(x86_64)
45    #[cfg_attr(feature = "json_schema", schemars(rename = "damping"))]
46    #[cfg_attr(feature = "serde", serde(rename = "damping"))]
47    pub m_damping: f32,
48    /// # C++ Info
49    /// - name: `proportionalRecoveryVelocity`(ctype: `hkReal`)
50    /// - offset: ` 12`(x86)/` 12`(x86_64)
51    /// - type_size: `  4`(x86)/`  4`(x86_64)
52    #[cfg_attr(
53        feature = "json_schema",
54        schemars(rename = "proportionalRecoveryVelocity")
55    )]
56    #[cfg_attr(feature = "serde", serde(rename = "proportionalRecoveryVelocity"))]
57    pub m_proportionalRecoveryVelocity: f32,
58    /// # C++ Info
59    /// - name: `constantRecoveryVelocity`(ctype: `hkReal`)
60    /// - offset: ` 16`(x86)/` 16`(x86_64)
61    /// - type_size: `  4`(x86)/`  4`(x86_64)
62    #[cfg_attr(feature = "json_schema", schemars(rename = "constantRecoveryVelocity"))]
63    #[cfg_attr(feature = "serde", serde(rename = "constantRecoveryVelocity"))]
64    pub m_constantRecoveryVelocity: f32,
65}
66const _: () = {
67    use havok_serde as _serde;
68    impl _serde::HavokClass for hkbPoweredRagdollControlData {
69        #[inline]
70        fn name(&self) -> &'static str {
71            "hkbPoweredRagdollControlData"
72        }
73        #[inline]
74        fn signature(&self) -> _serde::__private::Signature {
75            _serde::__private::Signature::new(0xf5ba21b)
76        }
77        #[allow(clippy::let_and_return, clippy::vec_init_then_push)]
78        fn deps_indexes(&self) -> Vec<usize> {
79            let mut v = Vec::new();
80            v
81        }
82    }
83    impl _serde::Serialize for hkbPoweredRagdollControlData {
84        fn serialize<S>(&self, __serializer: S) -> Result<S::Ok, S::Error>
85        where
86            S: _serde::ser::Serializer,
87        {
88            let class_meta = self
89                .__ptr
90                .map(|name| (name, _serde::__private::Signature::new(0xf5ba21b)));
91            let mut serializer = __serializer
92                .serialize_struct(
93                    "hkbPoweredRagdollControlData",
94                    class_meta,
95                    (32u64, 32u64),
96                )?;
97            serializer.serialize_field("maxForce", &self.m_maxForce)?;
98            serializer.serialize_field("tau", &self.m_tau)?;
99            serializer.serialize_field("damping", &self.m_damping)?;
100            serializer
101                .serialize_field(
102                    "proportionalRecoveryVelocity",
103                    &self.m_proportionalRecoveryVelocity,
104                )?;
105            serializer
106                .serialize_field(
107                    "constantRecoveryVelocity",
108                    &self.m_constantRecoveryVelocity,
109                )?;
110            serializer.pad_field([0u8; 12usize].as_slice(), [0u8; 12usize].as_slice())?;
111            serializer.end()
112        }
113    }
114};
115#[doc(hidden)]
116#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
117const _: () = {
118    use havok_serde as _serde;
119    #[automatically_derived]
120    impl<'de> _serde::Deserialize<'de> for hkbPoweredRagdollControlData {
121        fn deserialize<__D>(deserializer: __D) -> core::result::Result<Self, __D::Error>
122        where
123            __D: _serde::Deserializer<'de>,
124        {
125            #[allow(non_camel_case_types)]
126            enum __Field {
127                m_maxForce,
128                m_tau,
129                m_damping,
130                m_proportionalRecoveryVelocity,
131                m_constantRecoveryVelocity,
132                __ignore,
133            }
134            struct __FieldVisitor;
135            impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
136                type Value = __Field;
137                fn expecting(
138                    &self,
139                    __formatter: &mut core::fmt::Formatter,
140                ) -> core::fmt::Result {
141                    core::fmt::Formatter::write_str(__formatter, "field identifier")
142                }
143                /// Intended for use in XML.
144                #[allow(clippy::match_single_binding)]
145                #[allow(clippy::reversed_empty_ranges)]
146                #[allow(clippy::single_match)]
147                fn visit_key<__E>(
148                    self,
149                    __value: &str,
150                ) -> core::result::Result<Self::Value, __E>
151                where
152                    __E: _serde::de::Error,
153                {
154                    match __value {
155                        "maxForce" => Ok(__Field::m_maxForce),
156                        "tau" => Ok(__Field::m_tau),
157                        "damping" => Ok(__Field::m_damping),
158                        "proportionalRecoveryVelocity" => {
159                            Ok(__Field::m_proportionalRecoveryVelocity)
160                        }
161                        "constantRecoveryVelocity" => {
162                            Ok(__Field::m_constantRecoveryVelocity)
163                        }
164                        _ => Ok(__Field::__ignore),
165                    }
166                }
167            }
168            impl<'de> _serde::Deserialize<'de> for __Field {
169                #[inline]
170                fn deserialize<__D>(
171                    __deserializer: __D,
172                ) -> core::result::Result<Self, __D::Error>
173                where
174                    __D: _serde::Deserializer<'de>,
175                {
176                    _serde::Deserializer::deserialize_key(__deserializer, __FieldVisitor)
177                }
178            }
179            struct __hkbPoweredRagdollControlDataVisitor<'de> {
180                marker: _serde::__private::PhantomData<hkbPoweredRagdollControlData>,
181                lifetime: _serde::__private::PhantomData<&'de ()>,
182            }
183            #[allow(clippy::match_single_binding)]
184            #[allow(clippy::reversed_empty_ranges)]
185            #[allow(clippy::single_match)]
186            impl<'de> _serde::de::Visitor<'de>
187            for __hkbPoweredRagdollControlDataVisitor<'de> {
188                type Value = hkbPoweredRagdollControlData;
189                fn expecting(
190                    &self,
191                    __formatter: &mut core::fmt::Formatter,
192                ) -> core::fmt::Result {
193                    core::fmt::Formatter::write_str(
194                        __formatter,
195                        "struct hkbPoweredRagdollControlData",
196                    )
197                }
198                fn visit_struct_for_bytes<__A>(
199                    self,
200                    mut __map: __A,
201                ) -> _serde::__private::Result<Self::Value, __A::Error>
202                where
203                    __A: _serde::de::MapAccess<'de>,
204                {
205                    let __ptr = __A::class_ptr(&mut __map);
206                    let mut m_maxForce: _serde::__private::Option<f32> = _serde::__private::None;
207                    let mut m_tau: _serde::__private::Option<f32> = _serde::__private::None;
208                    let mut m_damping: _serde::__private::Option<f32> = _serde::__private::None;
209                    let mut m_proportionalRecoveryVelocity: _serde::__private::Option<
210                        f32,
211                    > = _serde::__private::None;
212                    let mut m_constantRecoveryVelocity: _serde::__private::Option<f32> = _serde::__private::None;
213                    for i in 0..5usize {
214                        match i {
215                            0usize => {
216                                if _serde::__private::Option::is_some(&m_maxForce) {
217                                    return _serde::__private::Err(
218                                        <__A::Error as _serde::de::Error>::duplicate_field(
219                                            "maxForce",
220                                        ),
221                                    );
222                                }
223                                m_maxForce = _serde::__private::Some(
224                                    match __A::next_value::<f32>(&mut __map) {
225                                        _serde::__private::Ok(__val) => __val,
226                                        _serde::__private::Err(__err) => {
227                                            return _serde::__private::Err(__err);
228                                        }
229                                    },
230                                );
231                            }
232                            1usize => {
233                                if _serde::__private::Option::is_some(&m_tau) {
234                                    return _serde::__private::Err(
235                                        <__A::Error as _serde::de::Error>::duplicate_field("tau"),
236                                    );
237                                }
238                                m_tau = _serde::__private::Some(
239                                    match __A::next_value::<f32>(&mut __map) {
240                                        _serde::__private::Ok(__val) => __val,
241                                        _serde::__private::Err(__err) => {
242                                            return _serde::__private::Err(__err);
243                                        }
244                                    },
245                                );
246                            }
247                            2usize => {
248                                if _serde::__private::Option::is_some(&m_damping) {
249                                    return _serde::__private::Err(
250                                        <__A::Error as _serde::de::Error>::duplicate_field(
251                                            "damping",
252                                        ),
253                                    );
254                                }
255                                m_damping = _serde::__private::Some(
256                                    match __A::next_value::<f32>(&mut __map) {
257                                        _serde::__private::Ok(__val) => __val,
258                                        _serde::__private::Err(__err) => {
259                                            return _serde::__private::Err(__err);
260                                        }
261                                    },
262                                );
263                            }
264                            3usize => {
265                                if _serde::__private::Option::is_some(
266                                    &m_proportionalRecoveryVelocity,
267                                ) {
268                                    return _serde::__private::Err(
269                                        <__A::Error as _serde::de::Error>::duplicate_field(
270                                            "proportionalRecoveryVelocity",
271                                        ),
272                                    );
273                                }
274                                m_proportionalRecoveryVelocity = _serde::__private::Some(
275                                    match __A::next_value::<f32>(&mut __map) {
276                                        _serde::__private::Ok(__val) => __val,
277                                        _serde::__private::Err(__err) => {
278                                            return _serde::__private::Err(__err);
279                                        }
280                                    },
281                                );
282                            }
283                            4usize => {
284                                if _serde::__private::Option::is_some(
285                                    &m_constantRecoveryVelocity,
286                                ) {
287                                    return _serde::__private::Err(
288                                        <__A::Error as _serde::de::Error>::duplicate_field(
289                                            "constantRecoveryVelocity",
290                                        ),
291                                    );
292                                }
293                                m_constantRecoveryVelocity = _serde::__private::Some(
294                                    match __A::next_value::<f32>(&mut __map) {
295                                        _serde::__private::Ok(__val) => __val,
296                                        _serde::__private::Err(__err) => {
297                                            return _serde::__private::Err(__err);
298                                        }
299                                    },
300                                );
301                            }
302                            _ => {}
303                        }
304                    }
305                    __A::pad(&mut __map, 12usize, 12usize)?;
306                    let m_maxForce = match m_maxForce {
307                        _serde::__private::Some(__field) => __field,
308                        _serde::__private::None => {
309                            return _serde::__private::Err(
310                                <__A::Error as _serde::de::Error>::missing_field("maxForce"),
311                            );
312                        }
313                    };
314                    let m_tau = match m_tau {
315                        _serde::__private::Some(__field) => __field,
316                        _serde::__private::None => {
317                            return _serde::__private::Err(
318                                <__A::Error as _serde::de::Error>::missing_field("tau"),
319                            );
320                        }
321                    };
322                    let m_damping = match m_damping {
323                        _serde::__private::Some(__field) => __field,
324                        _serde::__private::None => {
325                            return _serde::__private::Err(
326                                <__A::Error as _serde::de::Error>::missing_field("damping"),
327                            );
328                        }
329                    };
330                    let m_proportionalRecoveryVelocity = match m_proportionalRecoveryVelocity {
331                        _serde::__private::Some(__field) => __field,
332                        _serde::__private::None => {
333                            return _serde::__private::Err(
334                                <__A::Error as _serde::de::Error>::missing_field(
335                                    "proportionalRecoveryVelocity",
336                                ),
337                            );
338                        }
339                    };
340                    let m_constantRecoveryVelocity = match m_constantRecoveryVelocity {
341                        _serde::__private::Some(__field) => __field,
342                        _serde::__private::None => {
343                            return _serde::__private::Err(
344                                <__A::Error as _serde::de::Error>::missing_field(
345                                    "constantRecoveryVelocity",
346                                ),
347                            );
348                        }
349                    };
350                    _serde::__private::Ok(hkbPoweredRagdollControlData {
351                        __ptr,
352                        m_maxForce,
353                        m_tau,
354                        m_damping,
355                        m_proportionalRecoveryVelocity,
356                        m_constantRecoveryVelocity,
357                    })
358                }
359                #[allow(clippy::manual_unwrap_or_default)]
360                fn visit_struct<__A>(
361                    self,
362                    mut __map: __A,
363                ) -> _serde::__private::Result<Self::Value, __A::Error>
364                where
365                    __A: _serde::de::MapAccess<'de>,
366                {
367                    let mut m_maxForce: _serde::__private::Option<f32> = _serde::__private::None;
368                    let mut m_tau: _serde::__private::Option<f32> = _serde::__private::None;
369                    let mut m_damping: _serde::__private::Option<f32> = _serde::__private::None;
370                    let mut m_proportionalRecoveryVelocity: _serde::__private::Option<
371                        f32,
372                    > = _serde::__private::None;
373                    let mut m_constantRecoveryVelocity: _serde::__private::Option<f32> = _serde::__private::None;
374                    while let _serde::__private::Some(__key) = {
375                        __A::next_key::<__Field>(&mut __map)?
376                    } {
377                        match __key {
378                            __Field::m_maxForce => {
379                                #[cfg(
380                                    any(feature = "strict", feature = "ignore_duplicates")
381                                )]
382                                if _serde::__private::Option::is_some(&m_maxForce) {
383                                    #[cfg(feature = "ignore_duplicates")]
384                                    {
385                                        __A::skip_value(&mut __map)?;
386                                        continue;
387                                    }
388                                    #[cfg(feature = "strict")]
389                                    return _serde::__private::Err(
390                                        <__A::Error as _serde::de::Error>::duplicate_field(
391                                            "maxForce",
392                                        ),
393                                    );
394                                }
395                                m_maxForce = _serde::__private::Some(
396                                    match __A::next_value::<f32>(&mut __map) {
397                                        _serde::__private::Ok(__val) => __val,
398                                        _serde::__private::Err(__err) => {
399                                            return _serde::__private::Err(__err);
400                                        }
401                                    },
402                                );
403                            }
404                            __Field::m_tau => {
405                                #[cfg(
406                                    any(feature = "strict", feature = "ignore_duplicates")
407                                )]
408                                if _serde::__private::Option::is_some(&m_tau) {
409                                    #[cfg(feature = "ignore_duplicates")]
410                                    {
411                                        __A::skip_value(&mut __map)?;
412                                        continue;
413                                    }
414                                    #[cfg(feature = "strict")]
415                                    return _serde::__private::Err(
416                                        <__A::Error as _serde::de::Error>::duplicate_field("tau"),
417                                    );
418                                }
419                                m_tau = _serde::__private::Some(
420                                    match __A::next_value::<f32>(&mut __map) {
421                                        _serde::__private::Ok(__val) => __val,
422                                        _serde::__private::Err(__err) => {
423                                            return _serde::__private::Err(__err);
424                                        }
425                                    },
426                                );
427                            }
428                            __Field::m_damping => {
429                                #[cfg(
430                                    any(feature = "strict", feature = "ignore_duplicates")
431                                )]
432                                if _serde::__private::Option::is_some(&m_damping) {
433                                    #[cfg(feature = "ignore_duplicates")]
434                                    {
435                                        __A::skip_value(&mut __map)?;
436                                        continue;
437                                    }
438                                    #[cfg(feature = "strict")]
439                                    return _serde::__private::Err(
440                                        <__A::Error as _serde::de::Error>::duplicate_field(
441                                            "damping",
442                                        ),
443                                    );
444                                }
445                                m_damping = _serde::__private::Some(
446                                    match __A::next_value::<f32>(&mut __map) {
447                                        _serde::__private::Ok(__val) => __val,
448                                        _serde::__private::Err(__err) => {
449                                            return _serde::__private::Err(__err);
450                                        }
451                                    },
452                                );
453                            }
454                            __Field::m_proportionalRecoveryVelocity => {
455                                #[cfg(
456                                    any(feature = "strict", feature = "ignore_duplicates")
457                                )]
458                                if _serde::__private::Option::is_some(
459                                    &m_proportionalRecoveryVelocity,
460                                ) {
461                                    #[cfg(feature = "ignore_duplicates")]
462                                    {
463                                        __A::skip_value(&mut __map)?;
464                                        continue;
465                                    }
466                                    #[cfg(feature = "strict")]
467                                    return _serde::__private::Err(
468                                        <__A::Error as _serde::de::Error>::duplicate_field(
469                                            "proportionalRecoveryVelocity",
470                                        ),
471                                    );
472                                }
473                                m_proportionalRecoveryVelocity = _serde::__private::Some(
474                                    match __A::next_value::<f32>(&mut __map) {
475                                        _serde::__private::Ok(__val) => __val,
476                                        _serde::__private::Err(__err) => {
477                                            return _serde::__private::Err(__err);
478                                        }
479                                    },
480                                );
481                            }
482                            __Field::m_constantRecoveryVelocity => {
483                                #[cfg(
484                                    any(feature = "strict", feature = "ignore_duplicates")
485                                )]
486                                if _serde::__private::Option::is_some(
487                                    &m_constantRecoveryVelocity,
488                                ) {
489                                    #[cfg(feature = "ignore_duplicates")]
490                                    {
491                                        __A::skip_value(&mut __map)?;
492                                        continue;
493                                    }
494                                    #[cfg(feature = "strict")]
495                                    return _serde::__private::Err(
496                                        <__A::Error as _serde::de::Error>::duplicate_field(
497                                            "constantRecoveryVelocity",
498                                        ),
499                                    );
500                                }
501                                m_constantRecoveryVelocity = _serde::__private::Some(
502                                    match __A::next_value::<f32>(&mut __map) {
503                                        _serde::__private::Ok(__val) => __val,
504                                        _serde::__private::Err(__err) => {
505                                            return _serde::__private::Err(__err);
506                                        }
507                                    },
508                                );
509                            }
510                            _ => __A::skip_value(&mut __map)?,
511                        }
512                    }
513                    let m_maxForce = match m_maxForce {
514                        _serde::__private::Some(__field) => __field,
515                        _serde::__private::None => {
516                            #[cfg(feature = "strict")]
517                            return _serde::__private::Err(
518                                <__A::Error as _serde::de::Error>::missing_field("maxForce"),
519                            );
520                            #[cfg(not(feature = "strict"))] Default::default()
521                        }
522                    };
523                    let m_tau = match m_tau {
524                        _serde::__private::Some(__field) => __field,
525                        _serde::__private::None => {
526                            #[cfg(feature = "strict")]
527                            return _serde::__private::Err(
528                                <__A::Error as _serde::de::Error>::missing_field("tau"),
529                            );
530                            #[cfg(not(feature = "strict"))] Default::default()
531                        }
532                    };
533                    let m_damping = match m_damping {
534                        _serde::__private::Some(__field) => __field,
535                        _serde::__private::None => {
536                            #[cfg(feature = "strict")]
537                            return _serde::__private::Err(
538                                <__A::Error as _serde::de::Error>::missing_field("damping"),
539                            );
540                            #[cfg(not(feature = "strict"))] Default::default()
541                        }
542                    };
543                    let m_proportionalRecoveryVelocity = match m_proportionalRecoveryVelocity {
544                        _serde::__private::Some(__field) => __field,
545                        _serde::__private::None => {
546                            #[cfg(feature = "strict")]
547                            return _serde::__private::Err(
548                                <__A::Error as _serde::de::Error>::missing_field(
549                                    "proportionalRecoveryVelocity",
550                                ),
551                            );
552                            #[cfg(not(feature = "strict"))] Default::default()
553                        }
554                    };
555                    let m_constantRecoveryVelocity = match m_constantRecoveryVelocity {
556                        _serde::__private::Some(__field) => __field,
557                        _serde::__private::None => {
558                            #[cfg(feature = "strict")]
559                            return _serde::__private::Err(
560                                <__A::Error as _serde::de::Error>::missing_field(
561                                    "constantRecoveryVelocity",
562                                ),
563                            );
564                            #[cfg(not(feature = "strict"))] Default::default()
565                        }
566                    };
567                    let __ptr = __A::class_ptr(&mut __map);
568                    _serde::__private::Ok(hkbPoweredRagdollControlData {
569                        __ptr,
570                        m_maxForce,
571                        m_tau,
572                        m_damping,
573                        m_proportionalRecoveryVelocity,
574                        m_constantRecoveryVelocity,
575                    })
576                }
577            }
578            const FIELDS: &[&str] = &[
579                "maxForce",
580                "tau",
581                "damping",
582                "proportionalRecoveryVelocity",
583                "constantRecoveryVelocity",
584            ];
585            _serde::Deserializer::deserialize_struct(
586                deserializer,
587                "hkbPoweredRagdollControlData",
588                FIELDS,
589                __hkbPoweredRagdollControlDataVisitor {
590                    marker: _serde::__private::PhantomData::<
591                        hkbPoweredRagdollControlData,
592                    >,
593                    lifetime: _serde::__private::PhantomData,
594                },
595            )
596        }
597    }
598};