@@ -9,6 +9,11 @@ namespace MimyLab.FukuroUdon
99 using UdonSharp ;
1010 using UnityEngine ;
1111 using UnityEngine . Animations ;
12+ using VRC . Dynamics ;
13+ using VRC . SDK3 . Dynamics . Constraint . Components ;
14+ using VRC . SDK3 . Dynamics . Contact . Components ;
15+ using VRC . SDK3 . Dynamics . PhysBone . Components ;
16+ using VRC . Udon ;
1217
1318 [ HelpURL ( "https://github.com/mimyquality/FukuroUdon/wiki/Active-Relay#activerelay-to-component" ) ]
1419 [ Icon ( ComponentIconPath . FukuroUdon ) ]
@@ -43,23 +48,40 @@ private bool ValidateComponentType(Component component)
4348 {
4449 if ( ! component ) { return false ; }
4550
46- if ( component is Collider )
47- {
48- if ( component . GetType ( ) == typeof ( TerrainCollider ) ) { return false ; }
49- return true ;
50- }
51- if ( component is Renderer )
52- {
53- if ( component . GetType ( ) == typeof ( UnityEngine . Tilemaps . TilemapRenderer ) ) { return false ; }
54- return true ;
55- }
56- if ( component is Behaviour )
57- {
58- return true ;
59- }
60- // Extra
51+ if ( component is Collider ) { return true ; }
52+ if ( component is Renderer ) { return true ; }
53+ // 個別に羅列の必要ある
54+ //if (component is Behaviour) { return true; }
6155 if ( component is OcclusionPortal ) { return true ; }
6256 if ( component is CanvasGroup ) { return true ; }
57+ if ( component is ParentConstraint ) { return true ; }
58+ if ( component is PositionConstraint ) { return true ; }
59+ if ( component is RotationConstraint ) { return true ; }
60+ if ( component is ScaleConstraint ) { return true ; }
61+ if ( component is AimConstraint ) { return true ; }
62+ if ( component is LookAtConstraint ) { return true ; }
63+ if ( component is AudioSource ) { return true ; }
64+ if ( component is AudioLowPassFilter ) { return true ; }
65+ if ( component is AudioHighPassFilter ) { return true ; }
66+ if ( component is AudioEchoFilter ) { return true ; }
67+ if ( component is AudioDistortionFilter ) { return true ; }
68+ if ( component is AudioChorusFilter ) { return true ; }
69+ if ( component is AudioReverbFilter ) { return true ; }
70+ if ( component is AudioReverbZone ) { return true ; }
71+ if ( component is Light ) { return true ; }
72+ if ( component is Camera ) { return true ; }
73+ if ( component is Animator ) { return true ; }
74+ if ( component is UdonBehaviour ) { return true ; }
75+ //if (component is UdonSharpBehaviour) { return true; } // なんとかする
76+ if ( component is VRCParentConstraint ) { return true ; }
77+ if ( component is VRCPositionConstraint ) { return true ; }
78+ if ( component is VRCRotationConstraint ) { return true ; }
79+ if ( component is VRCScaleConstraint ) { return true ; }
80+ if ( component is VRCAimConstraint ) { return true ; }
81+ if ( component is VRCLookAtConstraint ) { return true ; }
82+ if ( component is VRCPhysBone ) { return true ; }
83+ if ( component is VRCContactSender ) { return true ; }
84+ if ( component is VRCContactReceiver ) { return true ; }
6385
6486 return false ;
6587 }
@@ -90,37 +112,49 @@ private void ToggleComponents(bool value)
90112 if ( ! component ) continue ;
91113
92114 var type = component . GetType ( ) ;
93- if ( type == typeof ( GameObject ) ) { return ; }
94- // Collider
95- else if ( type == typeof ( BoxCollider ) ) { var downCasted = ( BoxCollider ) component ; downCasted . enabled = value ; }
96- else if ( type == typeof ( SphereCollider ) ) { var downCasted = ( SphereCollider ) component ; downCasted . enabled = value ; }
97- else if ( type == typeof ( CapsuleCollider ) ) { var downCasted = ( CapsuleCollider ) component ; downCasted . enabled = value ; }
98- else if ( type == typeof ( MeshCollider ) ) { var downCasted = ( MeshCollider ) component ; downCasted . enabled = value ; }
99- else if ( type == typeof ( WheelCollider ) ) { var downCasted = ( WheelCollider ) component ; downCasted . enabled = value ; }
100- //else if (type == typeof(TerrainCollider)) { var downCasted = (TerrainCollider)component; downCasted.enabled = enabled; }
101- // Renderer
102- else if ( type == typeof ( MeshRenderer ) ) { var downCasted = ( MeshRenderer ) component ; downCasted . enabled = value ; }
103- else if ( type == typeof ( SkinnedMeshRenderer ) ) { var downCasted = ( SkinnedMeshRenderer ) component ; downCasted . enabled = value ; }
104- else if ( type == typeof ( LineRenderer ) ) { var downCasted = ( LineRenderer ) component ; downCasted . enabled = value ; }
105- else if ( type == typeof ( TrailRenderer ) ) { var downCasted = ( TrailRenderer ) component ; downCasted . enabled = value ; }
106- else if ( type == typeof ( BillboardRenderer ) ) { var downCasted = ( BillboardRenderer ) component ; downCasted . enabled = value ; }
107- else if ( type == typeof ( SpriteRenderer ) ) { var downCasted = ( SpriteRenderer ) component ; downCasted . enabled = value ; }
108- //else if (type == typeof(UnityEngine.Tilemaps.TilemapRenderer)) { var downCasted = (UnityEngine.Tilemaps.TilemapRenderer)component; downCasted.enabled = enabled; }
115+ if ( type == typeof ( GameObject ) ) { continue ; }
116+ // Extra
117+ // 用途的に、アクティブならClose・非アクティブならOpenのが都合が良さそうなので反転
118+ else if ( type == typeof ( OcclusionPortal ) ) { var downCasted = ( OcclusionPortal ) component ; downCasted . open = ! value ; }
119+ else if ( type == typeof ( CanvasGroup ) ) { var downCasted = ( CanvasGroup ) component ; downCasted . interactable = value ; }
120+ // Common
121+ else if ( type . IsSubclassOf ( typeof ( Collider ) ) ) { var downCasted = ( Collider ) component ; downCasted . enabled = value ; }
122+ else if ( type . IsSubclassOf ( typeof ( Renderer ) ) ) { var downCasted = ( Renderer ) component ; downCasted . enabled = value ; }
109123 // Constraint
110- else if ( type == typeof ( AimConstraint ) ) { var downCasted = ( AimConstraint ) component ; downCasted . enabled = value ; }
111- else if ( type == typeof ( LookAtConstraint ) ) { var downCasted = ( LookAtConstraint ) component ; downCasted . enabled = value ; }
112124 else if ( type == typeof ( ParentConstraint ) ) { var downCasted = ( ParentConstraint ) component ; downCasted . enabled = value ; }
113125 else if ( type == typeof ( PositionConstraint ) ) { var downCasted = ( PositionConstraint ) component ; downCasted . enabled = value ; }
114126 else if ( type == typeof ( RotationConstraint ) ) { var downCasted = ( RotationConstraint ) component ; downCasted . enabled = value ; }
115127 else if ( type == typeof ( ScaleConstraint ) ) { var downCasted = ( ScaleConstraint ) component ; downCasted . enabled = value ; }
128+ else if ( type == typeof ( AimConstraint ) ) { var downCasted = ( AimConstraint ) component ; downCasted . enabled = ! value ; }
129+ else if ( type == typeof ( LookAtConstraint ) ) { var downCasted = ( LookAtConstraint ) component ; downCasted . enabled = value ; }
130+ // Audio
131+ else if ( type == typeof ( AudioSource ) ) { var downCasted = ( AudioSource ) component ; downCasted . enabled = value ; }
132+ else if ( type == typeof ( AudioLowPassFilter ) ) { var downCasted = ( AudioLowPassFilter ) component ; downCasted . enabled = value ; }
133+ else if ( type == typeof ( AudioHighPassFilter ) ) { var downCasted = ( AudioHighPassFilter ) component ; downCasted . enabled = value ; }
134+ else if ( type == typeof ( AudioEchoFilter ) ) { var downCasted = ( AudioEchoFilter ) component ; downCasted . enabled = value ; }
135+ else if ( type == typeof ( AudioDistortionFilter ) ) { var downCasted = ( AudioDistortionFilter ) component ; downCasted . enabled = value ; }
136+ else if ( type == typeof ( AudioChorusFilter ) ) { var downCasted = ( AudioChorusFilter ) component ; downCasted . enabled = value ; }
137+ else if ( type == typeof ( AudioReverbFilter ) ) { var downCasted = ( AudioReverbFilter ) component ; downCasted . enabled = value ; }
138+ else if ( type == typeof ( AudioReverbZone ) ) { var downCasted = ( AudioReverbZone ) component ; downCasted . enabled = value ; }
116139 // Behaviour
117140 else if ( type == typeof ( Light ) ) { var downCasted = ( Light ) component ; downCasted . enabled = value ; }
118141 else if ( type == typeof ( Camera ) ) { var downCasted = ( Camera ) component ; downCasted . enabled = value ; }
119142 else if ( type == typeof ( Animator ) ) { var downCasted = ( Animator ) component ; downCasted . enabled = value ; }
120- // Extra
121- // 用途的に、アクティブならClose・非アクティブならOpenのが都合が良さそうなので反転
122- else if ( type == typeof ( OcclusionPortal ) ) { var downCasted = ( OcclusionPortal ) component ; downCasted . open = ! value ; }
123- else if ( type == typeof ( CanvasGroup ) ) { var downCasted = ( CanvasGroup ) component ; downCasted . interactable = value ; }
143+ // VRChat
144+ else if ( type == typeof ( UdonBehaviour ) ) { var downCasted = ( UdonBehaviour ) component ; downCasted . enabled = value ; }
145+ else if ( type == typeof ( VRCParentConstraint ) ) { var downCasted = ( VRCParentConstraint ) component ; downCasted . enabled = value ; }
146+ else if ( type == typeof ( VRCPositionConstraint ) ) { var downCasted = ( VRCPositionConstraint ) component ; downCasted . enabled = value ; }
147+ else if ( type == typeof ( VRCRotationConstraint ) ) { var downCasted = ( VRCRotationConstraint ) component ; downCasted . enabled = value ; }
148+ else if ( type == typeof ( VRCScaleConstraint ) ) { var downCasted = ( VRCScaleConstraint ) component ; downCasted . enabled = value ; }
149+ else if ( type == typeof ( VRCAimConstraint ) ) { var downCasted = ( VRCAimConstraint ) component ; downCasted . enabled = value ; }
150+ else if ( type == typeof ( VRCLookAtConstraint ) ) { var downCasted = ( VRCLookAtConstraint ) component ; downCasted . enabled = value ; }
151+ else if ( type == typeof ( VRCPhysBone ) ) { var downCasted = ( VRCPhysBone ) component ; downCasted . enabled = value ; }
152+ else if ( type == typeof ( VRCContactSender ) ) { var downCasted = ( VRCContactSender ) component ; downCasted . enabled = value ; }
153+ else if ( type == typeof ( VRCContactReceiver ) ) { var downCasted = ( VRCContactReceiver ) component ; downCasted . enabled = value ; }
154+ // enabled が not exposed
155+ // else if (type.IsSubclassOf(typeof(Behaviour))) { var downCasted = (Behaviour)component; downCasted.enabled = value; }
156+ // else if (type == typeof(AudioListener)) { var downCasted = (AudioListener)component; downCasted.enabled = value; }
157+ // else if (type == typeof(Cloth)) { var downCasted = (Cloth)component; downCasted.enabled = value; }
124158 }
125159 }
126160 }
0 commit comments