public void ProcessDefaultCentering()
    {
        if (!FindRageGroup())
        {
            return;
        }
        Vector3 origCenter = Group.Center;

        if (!InPlace)
        {
            transform.position = Vector3.zero;
            Group.UpdatePathList();                             // Recalculates the group Center
        }
        var centerOffset = transform.position - Group.Center;

        PointsPositionOffset(Group, centerOffset);
        if (InPlace)
        {
            transform.position = origCenter;
            // Restore Children Positions
            foreach (var item in Group.List)
            {
                var thisPos  = item.Spline.Rs.transform.position;
                var cachePos = item.PositionCache;
                item.Spline.Rs.transform.position = new Vector3(thisPos.x, thisPos.y, cachePos.z);
            }
        }
    }
Ejemplo n.º 2
0
 private void CheckRageGroupAndList()
 {
     if (Group != null && Group.List != null && Group.List.Count != 0)
     {
         return;
     }
     Group = GetComponent <RageGroup>();
     Group.UpdatePathList();
 }
    /// <summary> Applies a given offset to the position of all points of a RageGroup</summary>
    private static void PointsPositionOffset(RageGroup group, Vector3 offset)
    {
        foreach (var groupItem in group.List)
        {
            PointsPositionOffset(groupItem, offset);
        }

        group.UpdatePathList();
    }
Ejemplo n.º 4
0
    /// <summary> Finds (or add if needed) the source and Target groups, fits UVs to both the copies from source to Target UVs
    /// </summary>
    public void Process( )
    {
        if (SourceObject == null || TargetObject == null)
        {
            Debug.Log("Macro error: Both Source and Target gO fields must be filled in. Aborting.");
            return;
        }
        RageGroup sourceGroup = SourceObject.GetComponent <RageGroup>();
        RageGroup targetGroup = TargetObject.GetComponent <RageGroup>();

        if (sourceGroup == null)
        {
            sourceGroup = AddGroups ? SourceObject.AddComponent <RageGroup>() : null;
        }
        if (targetGroup == null)
        {
            targetGroup = AddGroups ? TargetObject.AddComponent <RageGroup>() : null;
        }
        if (sourceGroup == null || targetGroup == null)
        {
            Debug.Log("Macro error: One or both groups missing, aborting.");
            return;
        }
        sourceGroup.UvFit(); targetGroup.UvFit();
        if (NameCleanup)
        {
            sourceGroup.CleanupExtensions(); targetGroup.CleanupExtensions();
        }
        if (PivotoolsBranch)
        {
            ApplyPivotoolsBranch(sourceGroup); ApplyPivotoolsBranch(targetGroup);
        }
        sourceGroup.UpdatePathList(); targetGroup.UpdatePathList();
        OffsetUVs(sourceGroup, targetGroup);
        if (TempGroups)
        {
            SmartDestroy(sourceGroup);
            SmartDestroy(targetGroup);
        }
    }