extends Node # ------------------------------------------------------------------------------------------------- # Assigns all meshes the actor consists of to the specified layer(s) # @param layerMask Bit mask of the layers the actor's meshes should be visible on # @remarks # This can be useful for segmented scenes, where 'rooms' exist on separate layers # to reduce the number of simultaneously active lights. func SetLayerMask(var layerMask): #print("Layer mask of %s changed to %d" % [ self.name, layerMask ]) var meshes = findMeshes() for mesh in meshes: mesh.set_layer_mask(layerMask) # ------------------------------------------------------------------------------------------------- # Finds all cameras that the camera controller node is carrying # @returns A list of all cameras carried by the camera controller func findMeshes(): var meshes = [] recursivelyCollectMeshes(self, meshes) return meshes # ------------------------------------------------------------------------------------------------- # Recursively searches a node for meshes and appends them to a list # @param node Node that will be searched for meshes # @param meshList List to which all found meshes will be appended func recursivelyCollectMeshes(var node, var meshList): for childNode in node.get_children(): if childNode is MeshInstance: meshList.append(childNode) else: recursivelyCollectMeshes(childNode, meshList)