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
|
C++RAW
#include "UnityPrefix.h"
#include "Runtime/Mono/MonoBehaviour.h"
#include "Runtime/Graphics/Transform.h"
#include "Runtime/Mono/MonoScript.h"
#include "Runtime/Mono/MonoManager.h"
#include "Runtime/Animation/Animator.h"
#include "Runtime/Animation/RuntimeAnimatorController.h"
#include "Runtime/Animation/Avatar.h"
#include "Runtime/mecanim/human/human.h"
#include "Runtime/mecanim/generic/crc32.h"
#include "Runtime/Animation/AnimationClip.h"
#include "Runtime/Animation/AnimatorOverrideController.h"
#include "Runtime/Scripting/ScriptingExportUtility.h"
#include "Runtime/Scripting/ScriptingUtility.h"
#include "Runtime/Scripting/Scripting.h"
using namespace Unity;
CSRAW
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections;
namespace UnityEngine
{
// Target
ENUM AvatarTarget
// The root, the position of the game object
Root = 0,
// The body, center of mass
Body = 1,
// The left foot
LeftFoot = 2,
// The right foot
RightFoot = 3,
// The left hand
LeftHand = 4,
// The right hand
RightHand = 5,
END
// IK Goal
ENUM AvatarIKGoal
// The left foot
LeftFoot = 0,
// The right foot
RightFoot = 1,
// The left hand
LeftHand = 2,
// The right hand
RightHand = 3
END
// Information about what animation clips is played and its weight
STRUCT AnimationInfo
// Animation clip that is played
CSRAW public AnimationClip clip { get {return m_ClipInstanceID != 0 ? ClipInstanceToScriptingObject(m_ClipInstanceID) : null; } }
// The weight of the animation clip
CSRAW public float weight { get { return m_Weight;}}
CUSTOM private static AnimationClip ClipInstanceToScriptingObject(int instanceID)
{
return Scripting::ScriptingWrapperFor(PPtr<AnimationClip>(instanceID));
}
CSRAW private int m_ClipInstanceID;
CSRAW private float m_Weight;
END
C++RAW
struct MonoAnimationInfo
{
int clipInstanceID;
float weight;
};
void AnimationInfoToMono ( const AnimationInfo& src, MonoAnimationInfo &dest)
{
dest.clipInstanceID = src.clip.IsValid() ? src.clip.GetInstanceID() : 0;
dest.weight = src.weight;
}
static int ScriptingStringToCRC32 (ICallString& stringValue);
// Culling mode for the Animator
ENUM AnimatorCullingMode
// Always animate the entire character. Object is animated even when offscreen.
AlwaysAnimate = 0,
// Animation is disabled when renderers are not visible.
BasedOnRenderers = 1
END
// Information about the current or next state
STRUCT AnimatorStateInfo
// Does /name/ match the name of the active state in the statemachine.
CSRAW public bool IsName (string name) { int hash = Animator.StringToHash (name); return hash == m_Name || hash == m_Path; }
// For backwards compatibility this is actually the path...
// In the future it would be good to come up with a new name for the name & path.
CSRAW public int nameHash { get { return m_Path; } }
// Normalized time of the State
CSRAW public float normalizedTime { get { return m_NormalizedTime; } }
// Current duration of the state
CSRAW public float length { get { return m_Length; } }
// The Tag of the State
CSRAW public int tagHash { get { return m_Tag; } }
// Does /tag/ match the tag of the active state in the statemachine.
CSRAW public bool IsTag (string tag) { return Animator.StringToHash (tag) == m_Tag; }
// Is the state looping
CSRAW public bool loop { get { return m_Loop != 0;} }
CSRAW private int m_Name;
CSRAW private int m_Path;
CSRAW private float m_NormalizedTime;
CSRAW private float m_Length;
CSRAW private int m_Tag;
CSRAW private int m_Loop;
END
// Information about the current transition
STRUCT AnimatorTransitionInfo
// Does /name/ match the name of the active Transition.
CSRAW public bool IsName (string name) { return Animator.StringToHash (name) == m_Name ; }
// Does /userName/ match the name of the active Transition.
CSRAW public bool IsUserName (string name) { return Animator.StringToHash (name) == m_UserName ; }
// The unique name of the Transition
CSRAW public int nameHash { get { return m_Name; } }
// The user-specidied name of the Transition
CSRAW public int userNameHash { get { return m_UserName; } }
// Normalized time of the Transition
CSRAW public float normalizedTime { get { return m_NormalizedTime; } }
CSRAW private int m_Name;
CSRAW private int m_UserName;
CSRAW private float m_NormalizedTime;
END
// To specify position and rotation weight mask for Animator::MatchTarget
STRUCT MatchTargetWeightMask
// MatchTargetWeightMask contructor
CSRAW public MatchTargetWeightMask(Vector3 positionXYZWeight, float rotationWeight)
{
m_PositionXYZWeight = positionXYZWeight;
m_RotationWeight = rotationWeight;
}
// Position XYZ weight
CSRAW public Vector3 positionXYZWeight
{
get { return m_PositionXYZWeight;}
set { m_PositionXYZWeight = value; }
}
// Rotation weight
CSRAW public float rotationWeight
{
get { return m_RotationWeight;}
set { m_RotationWeight =value;}
}
CSRAW private Vector3 m_PositionXYZWeight;
CSRAW private float m_RotationWeight;
END
C++RAW
enum HumanBodyBones { Hips=0, LeftUpperLeg, RightUpperLeg, LeftLowerLeg, RightLowerLeg, LeftFoot, RightFoot, Spine, Chest, Neck, Head, LeftShoulder, RightShoulder, LeftUpperArm, RightUpperArm, LeftLowerArm, RightLowerArm, LeftHand, RightHand, LeftToes, RightToes, LeftEye, RightEye, Jaw, LastBone};
// Interface to control the Mecanim animation system
CLASS Animator : Behaviour
// Returns true if the current rig is optimizable
CUSTOM_PROP bool isOptimizable { return self->IsOptimizable(); }
// Returns true if the current rig is ''humanoid'', false if it is ''generic''
CUSTOM_PROP bool isHuman { return self->IsHuman(); }
// Returns true if the current generic rig has a root motion
CUSTOM_PROP bool hasRootMotion { return self->HasRootMotion(); }
// Returns the scale of the current Avatar for a humanoid rig, (1 by default if the rig is generic)
CUSTOM_PROP float humanScale { return self->GetHumanScale(); }
// Gets the value of a float parameter
CSRAW public float GetFloat(string name) { return GetFloatString(name); }
// Gets the value of a float parameter
CSRAW public float GetFloat(int id) { return GetFloatID(id); }
// Sets the value of a float parameter
CSRAW public void SetFloat(string name, float value) { SetFloatString(name, value);}
// Sets the value of a float parameter
CSRAW public void SetFloat(string name, float value, float dampTime, float deltaTime) { SetFloatStringDamp(name, value, dampTime, deltaTime);}
// Sets the value of a float parameter
CSRAW public void SetFloat(int id, float value) { SetFloatID(id, value);}
// Sets the value of a float parameter
CSRAW public void SetFloat(int id, float value, float dampTime, float deltaTime) { SetFloatIDDamp(id, value, dampTime, deltaTime); }
// Gets the value of a bool parameter
CSRAW public bool GetBool(string name) { return GetBoolString(name);}
// Gets the value of a bool parameter
CSRAW public bool GetBool(int id) { return GetBoolID(id);}
// Sets the value of a bool parameter
CSRAW public void SetBool(string name, bool value) { SetBoolString(name, value);}
// Sets the value of a bool parameter
CSRAW public void SetBool(int id, bool value) { SetBoolID(id, value);}
// Gets the value of an integer parameter
CSRAW public int GetInteger(string name) { return GetIntegerString(name);}
// Gets the value of an integer parameter
CSRAW public int GetInteger(int id) { return GetIntegerID(id);}
// Sets the value of an integer parameter
CSRAW public void SetInteger(string name, int value) { SetIntegerString(name, value);}
// Sets the value of an integer parameter
CSRAW public void SetInteger(int id, int value) { SetIntegerID(id, value); }
// Sets the trigger parameter on
CSRAW public void SetTrigger(string name) { SetTriggerString(name); }
// Sets the trigger parameter at on
CSRAW public void SetTrigger(int id) { SetTriggerID(id); }
// Resets the trigger parameter at off
CSRAW public void ResetTrigger(string name) { ResetTriggerString(name); }
// Resets the trigger parameter at off
CSRAW public void ResetTrigger(int id) { ResetTriggerID(id); }
// Returns true if a parameter is controlled by an additional curve on an animation
CSRAW public bool IsParameterControlledByCurve(string name) { return IsParameterControlledByCurveString(name); }
// Returns true if a parameter is controlled by an additional curve on an animation
CSRAW public bool IsParameterControlledByCurve(int id) { return IsParameterControlledByCurveID(id); }
// Gets the avatar delta position for the last evaluated frame
CUSTOM_PROP Vector3 deltaPosition { return self->GetDeltaPosition(); }
// Gets the avatar delta rotation for the last evaluated frame
CUSTOM_PROP Quaternion deltaRotation { return self->GetDeltaRotation(); }
// The root position, the position of the game object
CUSTOM_PROP Vector3 rootPosition { return self->GetAvatarPosition();} { self->SetAvatarPosition(value);}
// The root rotation, the rotation of the game object
CUSTOM_PROP Quaternion rootRotation { return self->GetAvatarRotation();} { self->SetAvatarRotation(value);}
// Root is controlled by animations
CUSTOM_PROP bool applyRootMotion { return self->GetApplyRootMotion(); } { self->SetApplyRootMotion(value); }
// When turned on, animations will be executed in the physics loop. This is only useful in conjunction with kinematic rigidbodies.
CUSTOM_PROP bool animatePhysics { return self->GetAnimatePhysics(); } { self->SetAnimatePhysics(value); }
// Tell if the corresponding Character has transform hierarchy.
CUSTOM_PROP bool hasTransformHierarchy { return self->GetHasTransformHierarchy(); }
// The current gravity weight based on current animations that are played
CUSTOM_PROP float gravityWeight { return self->GetGravityWeight(); }
// The position of the body center of mass
CUSTOM_PROP Vector3 bodyPosition { return self->GetBodyPosition(); } { self->SetBodyPosition(value); }
// The rotation of the body center of mass
CUSTOM_PROP Quaternion bodyRotation { return self->GetBodyRotation(); } { self->SetBodyRotation(value); }
// Gets the position of an IK goal
CUSTOM Vector3 GetIKPosition( AvatarIKGoal goal) { return self->GetGoalPosition(goal) ;}
// Sets the position of an IK goal
CUSTOM void SetIKPosition( AvatarIKGoal goal, Vector3 goalPosition) { self->SetGoalPosition(goal,goalPosition); }
// Gets the rotation of an IK goal
CUSTOM Quaternion GetIKRotation( AvatarIKGoal goal) { return self->GetGoalRotation(goal); }
// Sets the rotation of an IK goal
CUSTOM void SetIKRotation( AvatarIKGoal goal, Quaternion goalRotation) { self->SetGoalRotation(goal, goalRotation); }
// Gets the translative weight of an IK goal (0 = at the original animation before IK, 1 = at the goal)
CUSTOM float GetIKPositionWeight ( AvatarIKGoal goal) { return self->GetGoalWeightPosition(goal); }
// Sets the translative weight of an IK goal (0 = at the original animation before IK, 1 = at the goal)
CUSTOM void SetIKPositionWeight ( AvatarIKGoal goal, float value) { self->SetGoalWeightPosition(goal,value); }
// Gets the rotational weight of an IK goal (0 = rotation before IK, 1 = rotation at the IK goal)
CUSTOM float GetIKRotationWeight( AvatarIKGoal goal) { return self->GetGoalWeightRotation(goal); }
// Sets the rotational weight of an IK goal (0 = rotation before IK, 1 = rotation at the IK goal)
CUSTOM void SetIKRotationWeight( AvatarIKGoal goal, float value) { self->SetGoalWeightRotation(goal,value); }
// Sets the look at position
CUSTOM void SetLookAtPosition(Vector3 lookAtPosition) { self->SetLookAtPosition(lookAtPosition); }
//Set look at weights
CUSTOM void SetLookAtWeight(float weight, float bodyWeight = 0.00f, float headWeight = 1.00f, float eyesWeight = 0.00f, float clampWeight = 0.50f)
{
self->SetLookAtBodyWeight(weight*bodyWeight);
self->SetLookAtHeadWeight(weight*headWeight);
self->SetLookAtEyesWeight(weight*eyesWeight);
self->SetLookAtClampWeight(clampWeight);
}
// Automatic stabilization of feet during transition and blending
CUSTOM_PROP bool stabilizeFeet { return self->GetStabilizeFeet(); } { self->SetStabilizeFeet(value);}
// The AnimatorController layer count
CUSTOM_PROP int layerCount { return self->GetLayerCount(); }
// Gets name of the layer
CUSTOM string GetLayerName( int layerIndex) { return scripting_string_new(self->GetLayerName(layerIndex)) ; }
// Gets the layer's current weight
CUSTOM float GetLayerWeight( int layerIndex) { return self->GetLayerWeight(layerIndex) ; }
// Sets the layer's current weight
CUSTOM void SetLayerWeight( int layerIndex, float weight) { self->SetLayerWeight(layerIndex, weight); }
// Gets the current State information on a specified AnimatorController layer
CUSTOM AnimatorStateInfo GetCurrentAnimatorStateInfo(int layerIndex)
{
AnimatorStateInfo info;
self->GetAnimatorStateInfo (layerIndex, true, info);
return info;
}
// Gets the next State information on a specified AnimatorController layer
CUSTOM AnimatorStateInfo GetNextAnimatorStateInfo(int layerIndex)
{
AnimatorStateInfo info;
self->GetAnimatorStateInfo(layerIndex, false, info);
return info;
}
// Gets the Transition information on a specified AnimatorController layer
CUSTOM AnimatorTransitionInfo GetAnimatorTransitionInfo(int layerIndex)
{
AnimatorTransitionInfo info;
self->GetAnimatorTransitionInfo(layerIndex, info);
return info;
}
CONDITIONAL !UNITY_FLASH
// Gets the list of AnimationInfo currently played by the current state
CUSTOM AnimationInfo[] GetCurrentAnimationClipState (int layerIndex)
{
dynamic_array<AnimationInfo> clips (kMemTempAlloc);
self->GetAnimationClipState(layerIndex, true, clips);
return DynamicArrayToScriptingStructArray(clips, GetMonoManager().GetCommonClasses().animationInfo, AnimationInfoToMono);
}
CONDITIONAL !UNITY_FLASH
// Gets the list of AnimationInfo currently played by the next state
CUSTOM AnimationInfo[] GetNextAnimationClipState (int layerIndex)
{
dynamic_array<AnimationInfo> clips (kMemTempAlloc);
self->GetAnimationClipState(layerIndex, false, clips);
return DynamicArrayToScriptingStructArray(clips, GetMonoManager().GetCommonClasses().animationInfo, AnimationInfoToMono);
}
// Is the specified AnimatorController layer in a transition
CUSTOM bool IsInTransition(int layerIndex) { return self->IsInTransition(layerIndex); }
// Blends pivot point between body center of mass and feet pivot. At 0%, the blending point is body center of mass. At 100%, the blending point is feet pivot
CUSTOM_PROP float feetPivotActive { return self->GetFeetPivotActive(); } { self->SetFeetPivotActive(value);}
// Gets the pivot weight
CUSTOM_PROP float pivotWeight { return self->GetPivotWeight(); }
// Get the current position of the pivot
CUSTOM_PROP Vector3 pivotPosition { return self->GetPivotPosition(); }
// Automatically adjust the gameobject position and rotation so that the AvatarTarget reaches the matchPosition when the current state is at the specified progress
CUSTOM void MatchTarget(Vector3 matchPosition, Quaternion matchRotation, AvatarTarget targetBodyPart, MatchTargetWeightMask weightMask, float startNormalizedTime, float targetNormalizedTime = 1)
{
self->MatchTarget(matchPosition, matchRotation, (int)targetBodyPart, weightMask, startNormalizedTime, targetNormalizedTime);
}
// Interrupts the automatic target matching
CUSTOM void InterruptMatchTarget(bool completeMatch = true) { self->InterruptMatchTarget(completeMatch);}
// If automatic matching is active
CUSTOM_PROP bool isMatchingTarget{ return self->IsMatchingTarget();}
// The playback speed of the Animator. 1 is normal playback speed
CUSTOM_PROP float speed { return self->GetSpeed() ; } { self->SetSpeed(value);}
// Force the normalized time of a state to a user defined value
OBSOLETE warning ForceStateNormalizedTime is deprecated. Please use Play or CrossFade instead.
CSRAW public void ForceStateNormalizedTime(float normalizedTime) { Play(0, 0, normalizedTime); }
CSRAW public void CrossFade (string stateName, float transitionDuration, int layer = -1, float normalizedTime = float.NegativeInfinity)
{
CrossFade (StringToHash(stateName), transitionDuration, layer, normalizedTime);
}
CUSTOM void CrossFade (int stateNameHash, float transitionDuration, int layer = -1, float normalizedTime = float.NegativeInfinity)
{
self->GotoState(layer, stateNameHash, normalizedTime, transitionDuration);
}
CSRAW public void Play (string stateName, int layer = -1, float normalizedTime = float.NegativeInfinity)
{
Play (StringToHash(stateName), layer, normalizedTime);
}
CUSTOM void Play (int stateNameHash, int layer = -1, float normalizedTime = float.NegativeInfinity)
{
self->GotoState(layer, stateNameHash, normalizedTime, 0.0F);
}
// Sets an AvatarTarget and a targetNormalizedTime for the current state
CUSTOM void SetTarget(AvatarTarget targetIndex, float targetNormalizedTime) {self->SetTarget((int)targetIndex, targetNormalizedTime);}
// Returns the position of the target specified by SetTarget(AvatarTarget targetIndex, float targetNormalizedTime))
CUSTOM_PROP Vector3 targetPosition { return self->GetTargetPosition(); }
// Returns the rotation of the target specified by SetTarget(AvatarTarget targetIndex, float targetNormalizedTime))
CUSTOM_PROP Quaternion targetRotation { return self->GetTargetRotation(); }
OBSOLETE error use mask and layers to control subset of transfroms in a skeleton
CUSTOM bool IsControlled(Transform transform) {return false;}
// Returns ture if a transform a bone controlled by human
CUSTOM internal bool IsBoneTransform(Transform transform) {return self->IsBoneTransform(transform);}
CUSTOM_PROP internal Transform avatarRoot {return Scripting::ScriptingWrapperFor(self->GetAvatarRoot());}
// Returns transform mapped to this human bone id
CUSTOM Transform GetBoneTransform(HumanBodyBones humanBoneId) {return Scripting::ScriptingWrapperFor(self->GetBoneTransform((int)humanBoneId));}
// Controls culling of this Animator component.
AUTO_PROP AnimatorCullingMode cullingMode GetCullingMode SetCullingMode
// Sets the animator in playback mode
CUSTOM void StartPlayback() { self->StartPlayback();}
// Stops animator playback mode
CUSTOM void StopPlayback() { self->StopPlayback();}
// Plays recorded data
CUSTOM_PROP float playbackTime {return self->GetPlaybackTime(); } { self->SetPlaybackTime(value);}
// Sets the animator in record mode
CUSTOM void StartRecording(int frameCount) { self->StartRecording(frameCount);}
// Stops animator record mode
CUSTOM void StopRecording() { self->StopRecording();}
// The time at which the recording data starts
CUSTOM_PROP float recorderStartTime { return self->GetRecorderStartTime();} {}
// The time at which the recoding data stops
CUSTOM_PROP float recorderStopTime { return self->GetRecorderStopTime();} {}
// The runtime representation of AnimatorController that controls the Animator
CUSTOM_PROP RuntimeAnimatorController runtimeAnimatorController {return Scripting::ScriptingWrapperFor(self->GetRuntimeAnimatorController());} { self->SetRuntimeAnimatorController(value);}
C++RAW static int ScriptingStringToCRC32 (ICallString& stringValue)
{
if(stringValue.IsNull()) return 0;
#if ENABLE_MONO
const gunichar2* chars = mono_string_chars(stringValue.str);
const size_t length = stringValue.Length();
if (IsUtf16InAsciiRange (chars, length))
{
return mecanim::processCRC32UTF16Ascii (chars, length);
}
else
#endif
{
return mecanim::processCRC32 (stringValue.AsUTF8().c_str());
}
}
// Generates an parameter id from a string
THREAD_SAFE
CUSTOM static int StringToHash (string name) { return ScriptingStringToCRC32(name); }
// Gets/Sets the current Avatar
CUSTOM_PROP Avatar avatar {return Scripting::ScriptingWrapperFor(self->GetAvatar());} { self->SetAvatar(value);}
C++RAW
#define GET_NAME_IMPL(Func,x) \
x value; \
GetSetValueResult result = self->Func(ScriptingStringToCRC32(name), value); \
if (result != kGetSetSuccess) \
self->ValidateParameterString (result, name); \
return value;
#define SET_NAME_IMPL(Func) \
GetSetValueResult result = self->Func(ScriptingStringToCRC32(name), value); \
if (result != kGetSetSuccess) \
self->ValidateParameterString (result, name);
#define GET_ID_IMPL(Func,x) \
x value; \
GetSetValueResult result = self->Func(id, value); \
if (result != kGetSetSuccess) \
self->ValidateParameterID (result, id); \
return value;
#define SET_ID_IMPL(Func) \
GetSetValueResult result = self->Func(id, value); \
if (result != kGetSetSuccess) \
self->ValidateParameterID (result, id);
// Internal
CUSTOM private void SetFloatString(string name, float value) { SET_NAME_IMPL(SetFloat) }
CUSTOM private void SetFloatID(int id, float value) { SET_ID_IMPL (SetFloat) }
CUSTOM private float GetFloatString(string name) { GET_NAME_IMPL(GetFloat, float) }
CUSTOM private float GetFloatID(int id) { GET_ID_IMPL (GetFloat, float) }
CUSTOM private void SetBoolString(string name, bool value) { SET_NAME_IMPL(SetBool) }
CUSTOM private void SetBoolID(int id, bool value) { SET_ID_IMPL (SetBool) }
CUSTOM private bool GetBoolString(string name) { GET_NAME_IMPL(GetBool, bool) }
CUSTOM private bool GetBoolID(int id) { GET_ID_IMPL (GetBool, bool) }
CUSTOM private void SetIntegerString(string name, int value) { SET_NAME_IMPL(SetInteger) }
CUSTOM private void SetIntegerID(int id, int value) { SET_ID_IMPL (SetInteger)}
CUSTOM private int GetIntegerString(string name) { GET_NAME_IMPL(GetInteger, int) }
CUSTOM private int GetIntegerID(int id) { GET_ID_IMPL (GetInteger, int) }
CUSTOM private void SetTriggerString(string name)
{
GetSetValueResult result = self->SetTrigger(ScriptingStringToCRC32(name));
if (result != kGetSetSuccess)
self->ValidateParameterString (result, name);
}
CUSTOM private void SetTriggerID(int id)
{
GetSetValueResult result = self->SetTrigger(id);
if (result != kGetSetSuccess)
self->ValidateParameterID (result, id);
}
CUSTOM private void ResetTriggerString(string name)
{
GetSetValueResult result = self->ResetTrigger(ScriptingStringToCRC32(name));
if (result != kGetSetSuccess)
self->ValidateParameterString (result, name);
}
CUSTOM private void ResetTriggerID(int id)
{
GetSetValueResult result = self->ResetTrigger(id);
if (result != kGetSetSuccess)
self->ValidateParameterID (result, id);
}
CUSTOM private bool IsParameterControlledByCurveString(string name)
{
GetSetValueResult result = self->ParameterControlledByCurve(ScriptingStringToCRC32(name));
if (result == kParameterIsControlledByCurve)
return true;
else if (result == kGetSetSuccess)
return false;
else
{
self->ValidateParameterString (result, name);
return false;
}
}
CUSTOM private bool IsParameterControlledByCurveID(int id)
{
GetSetValueResult result = self->ParameterControlledByCurve(id);
if (result == kParameterIsControlledByCurve)
return true;
else if (result == kGetSetSuccess)
return false;
else
{
self->ValidateParameterID (result, id);
return false;
}
}
CUSTOM private void SetFloatStringDamp(string name, float value, float dampTime, float deltaTime)
{
GetSetValueResult result = self->SetFloatDamp(ScriptingStringToCRC32(name), value, dampTime, deltaTime);
if (result != kGetSetSuccess)
self->ValidateParameterString (result, name);
}
CUSTOM private void SetFloatIDDamp(int id, float value, float dampTime, float deltaTime)
{
GetSetValueResult result = self->SetFloatDamp(id, value, dampTime, deltaTime);
if (result != kGetSetSuccess)
self->ValidateParameterID (result, id);
}
// True if additional layers affect the center of mass
CUSTOM_PROP bool layersAffectMassCenter {return self->GetLayersAffectMassCenter();} { self->SetLayersAffectMassCenter(value);}
// Get left foot bottom height.
CUSTOM_PROP float leftFeetBottomHeight {return self->GetLeftFeetBottomHeight();}
// Get right foot bottom height.
CUSTOM_PROP float rightFeetBottomHeight {return self->GetRightFeetBottomHeight();}
CONDITIONAL UNITY_EDITOR
CUSTOM_PROP internal bool supportsOnAnimatorMove { return self->SupportsOnAnimatorMove (); }
CONDITIONAL UNITY_EDITOR
CUSTOM internal void WriteDefaultPose() { self->WriteDefaultPose(); }
CUSTOM void Update(float deltaTime) { self->Update(deltaTime);}
CONDITIONAL UNITY_EDITOR
// Evalutes only the StateMachine, does not write into transforms, uses previous deltaTime
// Mostly used for editor previews ( BlendTrees )
CUSTOM internal void EvaluateSM() {self->EvaluateSM();}
CONDITIONAL UNITY_EDITOR
CUSTOM internal string GetCurrentStateName(int layerIndex) { return scripting_string_new(self->GetAnimatorStateName(layerIndex,true));}
CONDITIONAL UNITY_EDITOR
CUSTOM internal string GetNextStateName(int layerIndex) { return scripting_string_new(self->GetAnimatorStateName(layerIndex,false));}
CUSTOM_PROP private bool isInManagerList { return self->IsInManagerList();}
AUTO_PROP bool logWarnings GetLogWarnings SetLogWarnings
AUTO_PROP bool fireEvents GetFireEvents SetFireEvents
OBSOLETE warning GetVector is deprecated.
CSRAW public Vector3 GetVector(string name) { return Vector3.zero; }
OBSOLETE warning GetVector is deprecated.
CSRAW public Vector3 GetVector(int id) { return Vector3.zero; }
OBSOLETE warning SetVector is deprecated.
CSRAW public void SetVector(string name, Vector3 value) { }
OBSOLETE warning SetVector is deprecated.
CSRAW public void SetVector(int id, Vector3 value) { }
OBSOLETE warning GetQuaternion is deprecated.
CSRAW public Quaternion GetQuaternion(string name) { return Quaternion.identity;}
OBSOLETE warning GetQuaternion is deprecated.
CSRAW public Quaternion GetQuaternion(int id) { return Quaternion.identity; }
OBSOLETE warning SetQuaternion is deprecated.
CSRAW public void SetQuaternion(string name, Quaternion value) { }
OBSOLETE warning SetQuaternion is deprecated.
CSRAW public void SetQuaternion(int id, Quaternion value) { }
END
CSRAW }
|