Debian Codegraph @

src/lcl/castlepropedits_meshcolliderscene.inc

raw
1 {%MainUnit castlepropedits.pas}
2 {
3 Copyright 2022-2022 Michalis Kamburelis, Andrzej Kilijanski
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 { TCastle property editor. }
18
19 { TMeshColliderMeshPropertyEditor ------------------------------------------ }
20
21 type
22 TMeshColliderMeshPropertyEditor = class(TPersistentPropertyEditor)
23 strict private
24 FProc: TGetStrProc;
25 procedure FilterValues(const S: String);
26 public
27 procedure GetValues(Proc: TGetStrProc); override;
28 end;
29
30 procedure TMeshColliderMeshPropertyEditor.FilterValues(const S: String);
31 var
32 Persistent: TPersistent;
33 Transform: TCastleTransform;
34 begin
35 if Assigned(PropertyHook) and Assigned(FProc) then
36 begin
37 Persistent := PropertyHook.GetComponent(S);
38 Transform := Persistent as TCastleTransform;
39 if Assigned(Transform) and Transform.HasColliderMesh then
40 FProc(S);
41 end;
42 end;
43
44 procedure TMeshColliderMeshPropertyEditor.GetValues(Proc: TGetStrProc);
45 begin
46 FProc := Proc; // used by FilterValues
47 Proc(oisNone); // add none value
48 if Assigned(PropertyHook) then
49 PropertyHook.GetComponentNames(GetTypeData(GetPropType), @FilterValues);
50 end;