@@ -33,6 +33,7 @@ type Props = {|
33
33
id ? : string ,
34
34
objectType : string ,
35
35
objectBehaviorsTypes : Array < string > ,
36
+ isChildObject : boolean ,
36
37
behaviorShortHeader : BehaviorShortHeader ,
37
38
matches : ?Array < SearchMatch > ,
38
39
onChoose : ( ) = > void ,
@@ -45,6 +46,7 @@ export const BehaviorListItem = ({
45
46
id,
46
47
objectType,
47
48
objectBehaviorsTypes,
49
+ isChildObject,
48
50
behaviorShortHeader,
49
51
matches,
50
52
onChoose,
@@ -53,20 +55,28 @@ export const BehaviorListItem = ({
53
55
platform,
54
56
} : Props ) => {
55
57
const alreadyAdded = objectBehaviorsTypes . includes ( behaviorShortHeader . type ) ;
56
- // An empty object type means the base object, i.e: any object.
58
+
59
+ const behaviorMetadata = gd . MetadataProvider . getBehaviorMetadata (
60
+ platform ,
61
+ behaviorShortHeader . type
62
+ ) ;
57
63
const isObjectCompatible =
64
+ // An empty object type means the base object, i.e: any object.
58
65
( ! behaviorShortHeader . objectType ||
59
66
objectType === behaviorShortHeader . objectType ) &&
67
+ ( ! isChildObject || behaviorMetadata . isRelevantForChildObjects ( ) ) &&
60
68
behaviorShortHeader . allRequiredBehaviorTypes . every ( requiredBehaviorType => {
61
69
const behaviorMetadata = gd . MetadataProvider . getBehaviorMetadata (
62
70
platform ,
63
71
requiredBehaviorType
64
72
) ;
65
73
return (
66
- ! behaviorMetadata . isHidden ( ) ||
67
- objectBehaviorsTypes . includes ( requiredBehaviorType )
74
+ ( ! isChildObject || behaviorMetadata . isRelevantForChildObjects ( ) ) &&
75
+ ( ! behaviorMetadata . isHidden ( ) ||
76
+ objectBehaviorsTypes . includes ( requiredBehaviorType ) )
68
77
) ;
69
78
} ) ;
79
+
70
80
const isEngineCompatible = isCompatibleWithGDevelopVersion (
71
81
getIDEVersion ( ) ,
72
82
behaviorShortHeader . gdevelopVersion
0 commit comments