예제 #1
0
    /// <summary>
    /// Recursively populates a transform data array from this shadow, with
    /// a potential whitelist or blacklist
    /// </summary>
    /// <param name="data">The array to populate</param>
    /// <param name="t">The current subtree root</param>
    /// <param name="coordinator">The coordinator</param>
    /// <param name="nameFilter">The filter for names</param>
    /// <param name="bypass">Used for whitelists to take children of
    /// whitelisted transforms</param>
    public static void WriteShadowData(
        ShadowTransform[] data,
        Transform t,
        ShadowCoordinator coordinator,
        FilterList <string> nameFilter,
        bool bypass = false)
    {
        bool allowed   = (bypass == true || nameFilter.Allowed(t.name) == true);
        bool whitelist = (nameFilter.IsWhitelist() == true);

        bypass = (allowed == true && whitelist == true);

        // If we're permitting this bone through the filter
        if (allowed == true)
        {
            data[coordinator.GetBoneKey(t.name)].ReadFrom(t);
        }

        // See if we need to keep searching
        if (whitelist == true || allowed == true)
        {
            foreach (Transform child in t)
            {
                WriteShadowData(data, child, coordinator, nameFilter, bypass);
            }
        }
    }
예제 #2
0
    /// <summary>
    /// Recursively applies an encoded skeleton, or part of it, to the shadow
    /// </summary>
    /// <param name="data">The encoded skeleton data</param>
    /// <param name="t">The current transform to apply to</param>
    /// <param name="nameFilter">The filter for names</param>
    /// <param name="bypass">Used for whitelists to take children of
    /// whitelisted transforms</param>
    public static void ReadShadowData(
        ShadowTransform[] data,
        Transform t,
        ShadowCoordinator coordinator,
        FilterList <string> nameFilter,
        bool bypass = false)
    {
        bool allowed   = (bypass == true || nameFilter.Allowed(t.name) == true);
        bool whitelist = (nameFilter.IsWhitelist() == true);

        bypass = (allowed == true && whitelist == true);

        // If this is a valid bone, and is allowed, read it to the skeleton
        int key = coordinator.GetBoneKey(t.name);

        if (allowed == true && ShadowTransform.IsValid(data[key]) == true)
        {
            data[key].WriteTo(t);
        }

        // See if we need to keep searching
        if (whitelist == true || allowed == true)
        {
            foreach (Transform child in t)
            {
                ReadShadowData(data, child, coordinator, nameFilter, bypass);
            }
        }
    }
예제 #3
0
    /// <summary>
    /// Recursively populates a transform data array from this shadow, with
    /// a potential whitelist or blacklist
    /// </summary>
    /// <param name="data">The array to populate</param>
    /// <param name="t">The current subtree root</param>
    /// <param name="coordinator">The coordinator</param>
    /// <param name="nameFilter">The filter for names</param>
    /// <param name="bypass">Used for whitelists to take children of 
    /// whitelisted transforms</param>
    public static void WriteShadowData(
        ShadowTransform[] data,
        Transform t,
        ShadowCoordinator coordinator,
        FilterList<string> nameFilter,
        bool bypass = false)
    {
        bool allowed = (bypass == true || nameFilter.Allowed(t.name) == true);
        bool whitelist = (nameFilter.IsWhitelist() == true);
        bypass = (allowed == true && whitelist == true);

        // If we're permitting this bone through the filter
        if (allowed == true)
            data[coordinator.GetBoneKey(t.name)].ReadFrom(t);

        // See if we need to keep searching
        if (whitelist == true || allowed == true)
            foreach (Transform child in t)
                WriteShadowData(data, child, coordinator, nameFilter, bypass);
    }
예제 #4
0
    /// <summary>
    /// Recursively applies an encoded skeleton, or part of it, to the shadow
    /// </summary>
    /// <param name="data">The encoded skeleton data</param>
    /// <param name="t">The current transform to apply to</param>
    /// <param name="nameFilter">The filter for names</param>
    /// <param name="bypass">Used for whitelists to take children of 
    /// whitelisted transforms</param>
    public static void ReadShadowData(
        ShadowTransform[] data,
        Transform t,
        ShadowCoordinator coordinator,
        FilterList<string> nameFilter,
        bool bypass = false)
    {
        bool allowed = (bypass == true || nameFilter.Allowed(t.name) == true);
        bool whitelist = (nameFilter.IsWhitelist() == true);
        bypass = (allowed == true && whitelist == true);

        // If this is a valid bone, and is allowed, read it to the skeleton
        int key = coordinator.GetBoneKey(t.name);
        if (allowed == true && ShadowTransform.IsValid(data[key]) == true)
            data[key].WriteTo(t);

        // See if we need to keep searching
        if (whitelist == true || allowed == true)
            foreach (Transform child in t)
                ReadShadowData(data, child, coordinator, nameFilter, bypass);
    }