Exemplo n.º 1
0
        public static void SetFileMonitoringEnabled(PrintMeshSO so, bool bEnabled)
        {
            if (so.CanAutoUpdateFromSource() == false || so.AutoUpdateOnSourceFileChange == bEnabled)
            {
                return;
            }

            if (bEnabled)
            {
                so.AutoUpdateOnSourceFileChange = true;
                CC.FileMonitor.AddMesh(so);
            }
            else
            {
                so.AutoUpdateOnSourceFileChange = false;
                CC.FileMonitor.RemoveMesh(so);
            }
        }
Exemplo n.º 2
0
        private void ActiveScene_ChangedEvent(object sender, SceneObject so, SceneChangeType type)
        {
            if (so is PrintMeshSO == false)
            {
                return;
            }
            PrintMeshSO printSO = so as PrintMeshSO;

            if (type == SceneChangeType.Removed)
            {
                RemoveMesh(printSO);
            }
            else if (type == SceneChangeType.Added &&
                     printSO.CanAutoUpdateFromSource() &&
                     printSO.AutoUpdateOnSourceFileChange)
            {
                // this should only happen on undo of delete, right?
                AddMesh(printSO);
            }
        }
Exemplo n.º 3
0
        public static void DuplicateSelectedObjects(bool bInteractive)
        {
            List <SceneObject> duplicate = new List <SceneObject>(CC.ActiveScene.Selected);

            foreach (var existingSO in duplicate)
            {
                if (existingSO is PrintMeshSO == false)
                {
                    throw new NotSupportedException("CCActions.DuplicateSelectedObjects: currently can only delete print meshes?");
                }

                PrintMeshSO dupeSO = (existingSO as PrintMeshSO).DuplicateSubtype <PrintMeshSO>();
                dupeSO.Name = UniqueNames.GetNext(existingSO.Name);
                AddNewPrintMesh(dupeSO);

                // If we have multi-select, then we duplicated relative to a transient group that will
                // go away. So, update position using scene coords
                if (existingSO.Parent is FScene == false)
                {
                    var sceneF = existingSO.GetLocalFrame(CoordSpace.SceneCoords);
                    dupeSO.SetLocalFrame(sceneF, CoordSpace.SceneCoords);
                    Vector3f scaleL = existingSO.GetLocalScale();
                    Vector3f scaleS = SceneTransforms.ObjectToSceneV(existingSO, scaleL);
                    float    scale  = scaleS.Length / scaleL.Length;
                    dupeSO.SetLocalScale(scale * Vector3f.One);
                }

                if (dupeSO.CanAutoUpdateFromSource() && dupeSO.AutoUpdateOnSourceFileChange == true)
                {
                    CC.FileMonitor.AddMesh(dupeSO);
                }
            }
            if (bInteractive)
            {
                CC.ActiveScene.History.PushInteractionCheckpoint();
            }
        }