| 1 |
{%MainUnit castlepropedits.pas} |
| 2 |
{ |
| 3 |
Copyright 2010-2022 Michalis Kamburelis. |
| 4 |
|
| 5 |
This file is part of "Castle Game Engine". |
| 6 |
|
| 7 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 8 |
included in this distribution, for details about the copyright. |
| 9 |
|
| 10 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
|
| 14 |
---------------------------------------------------------------------------- |
| 15 |
} |
| 16 |
|
| 17 |
{ TCastleSceneCore.AutoAnimation, TCastleThirdPersonNavigation.AnimationXxx property editor. } |
| 18 |
|
| 19 |
{ TSceneAutoAnimationPropertyEditor ------------------------------------------ } |
| 20 |
|
| 21 |
type |
| 22 |
{ Property editor to select an animation on TCastleSceneCore. } |
| 23 |
TSceneAutoAnimationPropertyEditor = class(TStringPropertyEditor) |
| 24 |
public |
| 25 |
function GetAttributes: TPropertyAttributes; override; |
| 26 |
procedure GetValues(Proc: TGetStrProc); override; |
| 27 |
end; |
| 28 |
|
| 29 |
function TSceneAutoAnimationPropertyEditor.GetAttributes: TPropertyAttributes; |
| 30 |
begin |
| 31 |
Result := [paMultiSelect, paValueList, paSortList, paRevertable]; |
| 32 |
end; |
| 33 |
|
| 34 |
procedure TSceneAutoAnimationPropertyEditor.GetValues(Proc: TGetStrProc); |
| 35 |
var |
| 36 |
Scene: TCastleSceneCore; |
| 37 |
S: String; |
| 38 |
begin |
| 39 |
Proc(''); |
| 40 |
Scene := GetComponent(0) as TCastleSceneCore; |
| 41 |
for S in Scene.AnimationsList do |
| 42 |
Proc(S); |
| 43 |
end; |
| 44 |
|
| 45 |
{ TThirdPersonAnimationPropertyEditor ------------------------------------------ } |
| 46 |
|
| 47 |
type |
| 48 |
{ Property editor to select an animation on TCastleThirdPersonNavigation. } |
| 49 |
TThirdPersonAnimationPropertyEditor = class(TStringPropertyEditor) |
| 50 |
public |
| 51 |
function GetAttributes: TPropertyAttributes; override; |
| 52 |
procedure GetValues(Proc: TGetStrProc); override; |
| 53 |
end; |
| 54 |
|
| 55 |
function TThirdPersonAnimationPropertyEditor.GetAttributes: TPropertyAttributes; |
| 56 |
begin |
| 57 |
Result := [paMultiSelect, paValueList, paSortList, paRevertable]; |
| 58 |
end; |
| 59 |
|
| 60 |
procedure TThirdPersonAnimationPropertyEditor.GetValues(Proc: TGetStrProc); |
| 61 |
var |
| 62 |
Nav: TCastleThirdPersonNavigation; |
| 63 |
Scene: TCastleSceneCore; |
| 64 |
S: String; |
| 65 |
begin |
| 66 |
Proc(''); |
| 67 |
Nav := GetComponent(0) as TCastleThirdPersonNavigation; |
| 68 |
Scene := Nav.Avatar; |
| 69 |
if Scene <> nil then |
| 70 |
for S in Scene.AnimationsList do |
| 71 |
Proc(S); |
| 72 |
end; |