public void AssignAnimatorController(GameObject rootGameObject, AnimationClip animationClip)
            {
                CREditorUtils.GetRenderersFromRoot(rootGameObject, out arrNormalMeshRenderer_, out arrSkinnedMeshRenderer_);

                animator_ = rootGameObject.GetComponent <Animator>();
                animator_.runtimeAnimatorController = animatorSampler_;

                runtimeAnimationController_ = animator_.runtimeAnimatorController;
                ovrrAnimationController_    = new AnimatorOverrideController();

                ovrrAnimationController_.runtimeAnimatorController = runtimeAnimationController_;

#if CR_UNITY_5_X
                AnimationClip[] clips = ovrrAnimationController_.animationClips;
                foreach (AnimationClip animClip in clips)
                {
                    ovrrAnimationController_[animClip] = animationClip;
                }
                animator_.runtimeAnimatorController = ovrrAnimationController_;
#endif

#if CR_UNITY_4_X
                AnimationClipPair[] clips = ovrrAnimationController_.clips;
                foreach (AnimationClipPair animClipPair in clips)
                {
                    animClipPair.overrideClip = animationClip;
                }
                animator_.runtimeAnimatorController = ovrrAnimationController_;
#endif
            }
        private void SaveNewChopInfo(Dictionary <GameObject, int> dictChoppedGOInteriorSubmeshIdx)
        {
            List <GameObject> listChoppedGameObject = new List <GameObject>();

            GameObject[] arrChoppedGO = CREditorUtils.GetAllChildObjectsWithGeometry(Data.GameObjectChoppedRoot, true);
            listChoppedGameObject.AddRange(arrChoppedGO);


            int nTotalPieces = listChoppedGameObject.Count;

            Data.ArrChoppedGameObject = listChoppedGameObject.ToArray();

            Data.ArrInteriorSubmeshIdx           = new int[nTotalPieces];
            Data.ArrGameObject_Bounds_Chopped    = new Bounds[nTotalPieces];
            Data.ArrGameObject_Chopped_Positions = new Vector3[nTotalPieces];

            for (int i = 0; i < nTotalPieces; i++)
            {
                GameObject go = listChoppedGameObject[i];

                int interiorSubMeshIdx = dictChoppedGOInteriorSubmeshIdx[go];

                Data.ArrInteriorSubmeshIdx[i]           = interiorSubMeshIdx;
                Data.ArrGameObject_Bounds_Chopped[i]    = go.GetWorldBounds();
                Data.ArrGameObject_Chopped_Positions[i] = go.transform.localPosition;
            }

            EditorUtility.SetDirty(Data);
        }
        //SaveAssets
        private void SaveAssets()
        {
            if (!HasUnsavedTessellatorReferences())
            {
                EditorUtility.DisplayDialog("CaronteFX - Info", "There is not any mesh to save in assets.", "ok");
                return;
            }

            CREditorUtils.SaveAnyUnsavedMeshInHierarchy(Data.NodeGO, false);
        } //Save tessellator result
Пример #4
0
        public void SaveWeldResult()
        {
            if (!HasUnsavedWeldReferences())
            {
                EditorUtility.DisplayDialog("CaronteFX - Info", "There is not any mesh to save in assets.", "ok");
                return;
            }

            CREditorUtils.SaveAnyUnsavedMeshInHierarchy(Data.WeldGameObject, false);
        } //Save weld result
        private void SaveChopResult()
        {
            if (!HasUnsavedChopReferences())
            {
                EditorUtility.DisplayDialog("CaronteFX - Info", "There is not any mesh to save in assets.", "ok");
                return;
            }

            CREditorUtils.SaveAnyUnsavedMeshInHierarchy(Data.GameObjectChoppedRoot, false);
        }
Пример #6
0
        private static void CreateGlobalBoundsObject(List <GameObject> listGO, out GameObject boundsObject, out Matrix4x4 boundsMatrixWorldToLocal)
        {
            Bounds objectsBounds = CREditorUtils.GetGlobalBoundsWorld(listGO);

            boundsObject = new GameObject();
            Transform boundsTransform = boundsObject.transform;

            boundsTransform.position = objectsBounds.center;
            boundsMatrixWorldToLocal = boundsTransform.worldToLocalMatrix;
        }
        //-----------------------------------------------------------------------------------
        private bool FieldIsValidDragTarget()
        {
            UnityEngine.Object[] objects = DragAndDrop.objectReferences;

            if ((objects != null && CREditorUtils.CheckIfAnySceneGameObjects(objects)))
            {
                return(true);
            }

            return(false);
        }
        public void DrawAnimationFiles()
        {
            if (ac_.animationFileType == CRAnimation.AnimationFileType.CRAnimationAsset)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUI.BeginChangeCheck();
                var value = EditorGUILayout.ObjectField("Active animation", ac_.activeAnimation, typeof(CRAnimationAsset), false);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(ac_, "Change active animation");
                    ac_.activeAnimation = (CRAnimationAsset)value;
                    EditorUtility.SetDirty(ac_);
                }
                EditorGUILayout.EndHorizontal();

                CREditorUtils.DrawInspectorList("Animation tracks", ac_.listAnimations, ac_, "Set Active", ChangeToAnimationTrack);

                EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
                if (GUILayout.Button("Convert animations to TextAssets"))
                {
                    bool ok = EditorUtility.DisplayDialog("CaronteFX - Convert animations to TextAssets", "Proceed to conversion?", "Yes", "No");
                    if (ok)
                    {
                        ConvertCRAnimationAssetsToTextAssets();
                    }
                }
                EditorGUI.EndDisabledGroup();
            }
            else if (ac_.animationFileType == CRAnimation.AnimationFileType.TextAsset)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUI.BeginChangeCheck();
                var value = EditorGUILayout.ObjectField("Active animation", ac_.activeAnimationText, typeof(TextAsset), false);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(ac_, "Change active animation");
                    ac_.activeAnimationText = (TextAsset)value;
                    EditorUtility.SetDirty(ac_);
                }
                EditorGUILayout.EndHorizontal();

                CREditorUtils.DrawInspectorList("Animation tracks", ac_.listAnimationsText, ac_, "Set Active", ChangeToAnimationTrack);

                if (GUILayout.Button("Convert animations to CRAnimationAssets"))
                {
                    bool ok = EditorUtility.DisplayDialog("CaronteFX - Convert animations to CRAnimationAssets", "Proceed to conversion?", "Yes", "No");
                    if (ok)
                    {
                        ConvertTextAssetsToCRAnimationAssets();
                    }
                }
            }
        }
        } // RenderGUI

        private bool HasHelperMeshReferences()
        {
            if (Data.HelperGO == null)
            {
                return(false);
            }

            if (!CREditorUtils.IsAnyUnsavedMeshInHierarchy(Data.HelperGO))
            {
                return(false);
            }

            return(true);
        }
        } // RenderGUI

        private bool HasUnsavedTessellatorReferences()
        {
            if (Data.NodeGO == null)
            {
                return(false);
            }

            if (!CREditorUtils.IsAnyUnsavedMeshInHierarchy(Data.NodeGO))
            {
                return(false);
            }

            return(true);
        }
Пример #11
0
 //----------------------------------------------------------------------------------
 private void SampleAnimationController(GameObject go)
 {
     if (Data.UN_AnimationClip != null)
     {
         Animator animator = CREditorUtils.GetFirstAnimatorInHierarchy(go);
         if (animator != null)
         {
             if (Data.OverrideAnimationController)
             {
                 OverrideAnimatorController(animator);
             }
             animator.Update(0.0f);
         }
     }
 }
Пример #12
0
        } // RenderGUI

        public bool HasUnsavedWeldReferences()
        {
            if (Data.WeldGameObject == null)
            {
                return(false);
            }

            if (CREditorUtils.IsAnyUnsavedMeshInHierarchy(Data.WeldGameObject))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private bool HasUnsavedChopReferences()
        {
            if (Data.GameObjectChoppedRoot == null)
            {
                return(false);
            }

            if (CREditorUtils.IsAnyUnsavedMeshInHierarchy(Data.GameObjectChoppedRoot))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #14
0
        public void Weld()
        {
            GameObject[] arrGOtoWeld = FieldController.GetUnityGameObjects();

            int arrGOtoWeld_size = arrGOtoWeld.Length;

            if (arrGOtoWeld_size == 0)
            {
                EditorUtility.DisplayDialog("CaronteFX", "Input objects are mandatory", "Ok");
                return;
            }

            GameObject[] arrWeldedObject;
            Mesh[]       arrWeldedMesh;
            int          interiorMaterialIdx;

            EditorUtility.DisplayProgressBar(Data.Name, "Welding...", 1.0f);
            CRGeometryUtils.WeldObjects(arrGOtoWeld, Data.Name, null, out arrWeldedObject, out arrWeldedMesh, out interiorMaterialIdx);
            EditorUtility.ClearProgressBar();

            if (cnManager.IsFreeVersion() && arrWeldedObject == null)
            {
                EditorUtility.DisplayDialog("CaronteFX - Free version", "CaronteFX Free version can only weld the meshes included in the example scenes and the unity primitives (cube, plane, sphere, etc.).", "Ok");
            }

            if (arrWeldedObject != null)
            {
                List <GameObject> listWeldedObjects = new List <GameObject>();
                listWeldedObjects.AddRange(arrWeldedObject);

                Bounds bounds = CREditorUtils.GetGlobalBoundsWorld(listWeldedObjects);

                GameObject go = new GameObject(Data.Name + "_output");
                go.transform.position = bounds.center;

                foreach (GameObject weldedGO in listWeldedObjects)
                {
                    weldedGO.transform.parent = go.transform;
                }

                Data.WeldGameObject = go;

                UnityEditor.Selection.activeGameObject = go;
            }
        }
Пример #15
0
        /// <summary>
        /// Builds a list with all the scene fx and their status(included/not included)
        /// </summary>
        void BuildEffectList()
        {
            List <Tuple2 <Caronte_Fx, int> > listCaronteFx;

            CREditorUtils.GetCaronteFxsRelations(Controller.FxData, out listCaronteFx);

            for (int i = 0; i < listCaronteFx.Count; i++)
            {
                Caronte_Fx fx           = listCaronteFx[i].First;
                int        depth        = listCaronteFx[i].Second;
                bool       alreadyAdded = Controller.IsEffectIncluded(fx);

                listCaronteFx_.Add(Tuple3.New(fx, depth, alreadyAdded));
            }
            arrEffectsToInclude = new bool[listCaronteFx_.Count];
            for (int i = 0; i < arrEffectsToInclude.Length; i++)
            {
                arrEffectsToInclude[i] = listCaronteFx_[i].Third;
            }
        }
Пример #16
0
        public static bool IsAnyUnsavedMeshInHierarchy(GameObject go)
        {
            bool isAnyUnsavedMesh = false;

            GameObject[] arrGameObjects = CREditorUtils.GetAllChildObjectsWithGeometry(go, true);
            int          nGameObjects   = arrGameObjects.Length;

            for (int i = 0; i < nGameObjects; i++)
            {
                UnityEngine.GameObject gameObject = arrGameObjects[i];
                UnityEngine.Mesh       mesh       = gameObject.GetMesh();

                if (mesh != null && !AssetDatabase.Contains(mesh.GetInstanceID()))
                {
                    isAnyUnsavedMesh = true;
                }
            }

            return(isAnyUnsavedMesh);
        }
Пример #17
0
        //-----------------------------------------------------------------------------------
        public GameObject[] GetAnimatorGameObjects()
        {
            List <GameObject> listGameObject = new List <GameObject>();

            List <GameObject> listBodyObjects = GetGameObjects();

            foreach (var go in listBodyObjects)
            {
                Animator animator = CREditorUtils.GetFirstAnimatorInHierarchy(go);
                if (animator != null)
                {
                    GameObject animatorGO = animator.gameObject;
                    if (!listGameObject.Contains(animatorGO))
                    {
                        listGameObject.Add(animatorGO);
                    }
                }
            }

            return(listGameObject.ToArray());
        }
        public void Tessellate()
        {
            GameObject[] arrGOtoTessellate = FieldController.GetUnityGameObjects();

            DeleteOldObjects();

            GameObject[] arrGOTessellated;
            Mesh[]       arrMeshTessellated;

            EditorUtility.DisplayProgressBar(Data.Name, "Tessellating...", 1.0f);
            CRGeometryUtils.TessellateObjects(arrGOtoTessellate, Data.MaxEdgeDistance, Data.LimitByMeshDimensions, out arrGOTessellated, out arrMeshTessellated);
            EditorUtility.ClearProgressBar();

            if (cnManager.IsFreeVersion() && arrGOTessellated == null)
            {
                EditorUtility.DisplayDialog("CaronteFX - Free version", "CaronteFX Free version can only tessellate the meshes included in the example scenes and the unity primitives (cube, plane, sphere, etc.).", "Ok");
            }

            if (arrGOTessellated != null)
            {
                List <GameObject> listGameObject = new List <GameObject>();
                listGameObject.AddRange(arrGOTessellated);

                Bounds     bounds = CREditorUtils.GetGlobalBoundsWorld(listGameObject);
                GameObject nodeGO = new GameObject(Data.Name);

                nodeGO.transform.position = bounds.center;

                foreach (GameObject go in arrGOTessellated)
                {
                    go.transform.parent = nodeGO.transform;
                }

                Data.NodeGO             = nodeGO;
                Data.ArrTessellatedGO   = arrGOTessellated;
                Data.ArrTessellatedMesh = arrMeshTessellated;

                Selection.activeGameObject = nodeGO;
            }
        }
        //-----------------------------------------------------------------------------------
        private void RegisterUnityGameObjectInCaronte()
        {
            GameObject[] sceneObjects = CREditorUtils.GetAllGameObjectsInScene();
            int          length       = sceneObjects.Length;

            for (int i = 0; i < length; ++i)
            {
                GameObject go = sceneObjects[i];
                CREditorUtils.GetChildObjectsIds(go, listObjectsIds_);
                uint idCaronte;
                bool exists = goToIdCaronte_.TryGetByFirst(go, out idCaronte);
                if (!exists)
                {
                    idCaronte = GOManager.RegisterGameObject(go.name, go.GetInstanceID(), listObjectsIds_.ToArray());
                    goToIdCaronte_.Add(go, idCaronte);
                }
                else
                {
                    GOManager.ReregisterGameObject(idCaronte, go.name, go.GetInstanceID(), listObjectsIds_.ToArray());
                }
            }
        }
Пример #20
0
    private void GenerateBodyBoxMeshes()
    {
      CREditorUtils.GetListBoundsFromListGO( listBodyGOEnabledVisible_, listTmpBounds_ );
      CRGUIUtils.GenerateBoxMeshes( listTmpBounds_, fxData_.listMeshBodyBoxesEnabledVisible_ );

      CREditorUtils.GetListBoundsFromListGO( listBodyGODisabledVisible_, listTmpBounds_ );
      CRGUIUtils.GenerateBoxMeshes( listTmpBounds_, fxData_.listMeshBodyBoxesDisabledVisible_ );

      if ( fxData_.DrawSleepingState )
      {
        CREditorUtils.GetListBoundsFromListGO( listBodyGOSleeping_, listTmpBounds_ );
        CRGUIUtils.GenerateBoxMeshes( listTmpBounds_, fxData_.listMeshBodyBoxesSleeping_ );
      }

      if ( fxData_.ShowInvisibles )
      {
        CREditorUtils.GetListBoundsFromListGO( listBodyGOEnabledHide_, listTmpBounds_ );
        CRGUIUtils.GenerateBoxMeshes( listTmpBounds_, fxData_.listMeshBodyBoxesEnabledHide_ );

        CREditorUtils.GetListBoundsFromListGO( listBodyGODisabledHide_, listTmpBounds_ );
        CRGUIUtils.GenerateBoxMeshes( listTmpBounds_, fxData_.listMeshBodyBoxesDisabledHide_ );
      }
    }
        void DoSubstitution()
        {
            Undo.RecordObject(rootObject_, "Substitute material in hierarchy");

            List <GameObject> listGameObject = new List <GameObject>();

            listGameObject.Add(rootObject_);
            GameObject[] arrGameObject = CREditorUtils.GetAllChildObjectsWithGeometry(rootObject_, true);
            listGameObject.AddRange(arrGameObject);

            foreach (GameObject go in listGameObject)
            {
                Renderer rn = go.GetComponent <Renderer>();
                if (rn != null)
                {
                    Material[] arrMaterial   = rn.sharedMaterials;
                    bool       modifiedArray = false;
                    for (int i = 0; i < arrMaterial.Length; i++)
                    {
                        Material mat = arrMaterial[i];
                        if (mat == originalMaterial_)
                        {
                            modifiedArray  = true;
                            arrMaterial[i] = newMaterial_;
                        }
                    }

                    if (modifiedArray)
                    {
                        Undo.RecordObject(rn, "Change materials");
                        rn.sharedMaterials = arrMaterial;
                    }
                }
            }
            Undo.SetCurrentGroupName("Substitute material in hierarchy");
            Undo.CollapseUndoOperations(Undo.GetCurrentGroup());
        }
Пример #22
0
        public static void SaveAnyUnsavedMeshInHierarchy(GameObject go, bool saveAsCopy)
        {
            string path = EditorUtility.SaveFilePanelInProject("Save unsaved meshes into Assets...", go.name + ".prefab", "prefab", "Please, enter a name where the unsaved meshes will be saved to");

            if (path.Length != 0)
            {
                string       meshesPrefabPath = AssetDatabase.GenerateUniqueAssetPath(path);
                Object       meshesPrefab     = PrefabUtility.CreateEmptyPrefab(meshesPrefabPath);
                GameObject[] arrGameObjects   = CREditorUtils.GetAllChildObjectsWithGeometry(go, true);
                int          nGameObjects     = arrGameObjects.Length;
                for (int i = 0; i < nGameObjects; i++)
                {
                    UnityEngine.GameObject gameObject = arrGameObjects[i];
                    UnityEngine.Mesh       mesh       = gameObject.GetMesh();
                    if (mesh != null && !AssetDatabase.Contains(mesh.GetInstanceID()))
                    {
                        if (saveAsCopy)
                        {
                            Mesh newMesh = UnityEngine.Object.Instantiate(mesh);
                            newMesh.name = mesh.name;
                            CREditorUtils.SetMesh(gameObject, newMesh);
                            AssetDatabase.AddObjectToAsset(newMesh, meshesPrefab);
                        }
                        else
                        {
                            AssetDatabase.AddObjectToAsset(mesh, meshesPrefab);
                        }

                        EditorUtility.DisplayProgressBar("Saving scene meshes to prefab...", "Saving mesh " + i + 1 + " of " + nGameObjects, (float)i + 1 / (float)nGameObjects);
                    }
                }

                EditorUtility.ClearProgressBar();
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
        }
        public void Chop()
        {
            GameObject[] goToChop   = FieldController.GetUnityGameObjects();
            int          numObjects = goToChop.Length;

            string errorMessage = string.Empty;

            if (numObjects == 0)
            {
                errorMessage = "Objects field must contain at least one object with geometry";
            }

            if (Data.CropGeometry != null && !Data.CropGeometry.HasMesh())
            {
                errorMessage = "Crop geometry GameObject must contain a mesh";
            }

            if (Data.ChopMode == CNFracture.CHOP_MODE.VORONOI_BY_GEOMETRY)
            {
                if (Data.ChopGeometry == null)
                {
                    errorMessage = "Specifying a steering geometry is mandatory";
                }
                else if (!Data.ChopGeometry.HasMesh())
                {
                    errorMessage = "Steering geometry GameObject must contain a mesh";
                }
            }

            if (Data.ChopMode == CNFracture.CHOP_MODE.VORONOI_RADIAL)
            {
                if (Data.ReferenceSystem == null)
                {
                    errorMessage = "Specifying the reference system is mandatory";
                }
            }

            if (errorMessage != string.Empty)
            {
                EditorUtility.DisplayDialog("CaronteFX", errorMessage, "Ok");
                return;
            }

            Undo.RecordObject(Data, "Chop - " + Data.Name);

            List <GameObject>  listParentGO           = new List <GameObject>();
            List <Mesh>        listParentMesh_un      = new List <Mesh>();
            List <MeshComplex> listParentMesh_car     = new List <MeshComplex>();
            List <Matrix4x4>   listMatrixModelToWorld = new List <Matrix4x4>();

            for (int i = 0; i < numObjects; i++)
            {
                GameObject go      = goToChop[i];
                Mesh       un_mesh = go.GetMesh();

                if (un_mesh != null)
                {
                    MeshComplex mc = new MeshComplex();
                    mc.Set(un_mesh);

                    listParentMesh_car.Add(mc);
                    listParentMesh_un.Add(un_mesh);
                    listParentGO.Add(go);
                    listMatrixModelToWorld.Add(go.transform.localToWorldMatrix);
                }
            }

            Bounds globalBounds = CREditorUtils.GetGlobalBoundsWorld(listParentGO);

            ChopRequest cr = new ChopRequest();

            cr.doKeepUVCoords_          = true;
            cr.doKeepVertexNormals_     = true;
            cr.doParentIndexTriangInfo_ = true;
            cr.arrMeshToChop_           = listParentMesh_car.ToArray();
            cr.arrMatrixModelToWorld_   = listMatrixModelToWorld.ToArray();

            cr.doGlobalPattern_ = Data.DoGlobalPattern;
            cr.seed_            = (uint)Data.Seed;

            bool chopModeUniform  = false;
            bool chopModeGeometry = false;
            bool chopModeRadial   = false;

            cr.pProgressFunction_ = null;

            switch (Data.ChopMode)
            {
            case CNFracture.CHOP_MODE.VORONOI_UNIFORM:
                cr.chopMode_    = CaronteSharp.CP_CHOP_MODE.CP_CHOP_MODE_VORONOI_UNIFORM;
                chopModeUniform = ChopModeUniform(cr);
                break;

            case CNFracture.CHOP_MODE.VORONOI_BY_GEOMETRY:
                cr.chopMode_     = CaronteSharp.CP_CHOP_MODE.CP_CHOP_MODE_VORONOI_BY_GEOMETRY;
                chopModeGeometry = ChopModeGeometry(cr);
                break;

            case CNFracture.CHOP_MODE.VORONOI_RADIAL:
                cr.chopMode_   = CaronteSharp.CP_CHOP_MODE.CP_CHOP_MODE_VORONOI_RADIAL;
                chopModeRadial = ChopModeRadial(cr);
                break;
            }

            if (!chopModeUniform && !chopModeGeometry && !chopModeRadial)
            {
                return;
            }

            WeldRequest wr = GetWeldRequest();

            CaronteSharp.MeshComplex[]    arrMeshPieceCaronte;
            CaronteSharp.MeshParentInfo[] arrMeshParentInfo;
            Vector3[]  arrMeshPosition;
            ArrayIndex arrInsideOutsideIdx;

            EditorUtility.DisplayProgressBar(Data.Name, "Chopping...", 1.0f);
            CaronteSharp.Tools.FractureMeshesV2(cr, wr, out arrMeshPieceCaronte, out arrMeshParentInfo, out arrMeshPosition, out arrInsideOutsideIdx);


            bool thereIsOutput = arrMeshPieceCaronte.Length > 0;

            if (cnManager.IsFreeVersion() && !thereIsOutput)
            {
                EditorUtility.DisplayDialog("CaronteFX - Free version", "CaronteFX Free version can only fracture the meshes included in the example scenes and the unity primitives (cube, plane, sphere, etc.)", "Ok");
            }

            if (thereIsOutput)
            {
                List <GameObject> listChoppedParentGO;
                CreateListChoppedParentGO(listParentGO, out listChoppedParentGO);

                EditorUtility.DisplayProgressBar(Data.Name, "Post processing...", 1.0f);
                UnityEngine.Mesh[]  arrMeshPieceUnity;
                Tuple2 <int, int>[] arrSubmeshRange;
                int[] arrMeshComplexIdx;

                CreateMeshPiecesUnity(listChoppedParentGO, arrMeshPieceCaronte, arrMeshParentInfo, arrMeshPosition,
                                      out arrMeshPieceUnity, out arrSubmeshRange, out arrMeshComplexIdx);

                Transform oldParent = DestroyOldObjects();

                Undo.RecordObject(Data, "Chop - " + Data.Name);
                CreateNewObjects(globalBounds.center, listParentGO, listChoppedParentGO, arrMeshParentInfo,
                                 arrMeshPieceUnity, arrSubmeshRange, arrMeshComplexIdx, arrMeshPosition, arrInsideOutsideIdx.arrIdx_);


                if (oldParent != null)
                {
                    Data.GameObjectChoppedRoot.transform.parent = oldParent;
                }

                SeparatePieces();

                CalculateStatistics();

                EditorUtility.ClearProgressBar();

                Undo.SetCurrentGroupName("Chop - " + Data.Name);
                Undo.CollapseUndoOperations(Undo.GetCurrentGroup());
                EditorUtility.SetDirty(Data);
            }
        }
 public CRAnimatorInfo(GameObject rootGameObject)
 {
     CREditorUtils.GetRenderersFromRoot(rootGameObject, out arrNormalMeshRenderer_, out arrSkinnedMeshRenderer_);
     AssignBodyIds();
 }