Beispiel #1
0
        public CamView(int runtimeId, string initStateTypeName = null)
        {
            this.InitializeComponent();
            this.loadTempState            = initStateTypeName;
            this.oldColorDialogColor      = Color.FromArgb(64, 64, 64);
            this.selectedColorDialogColor = this.oldColorDialogColor;
            this.Text      = Properties.CamViewRes.MenuItemName_CamView + " #" + runtimeId;
            this.runtimeId = runtimeId;
            this.toolbarCamera.Renderer = new Duality.Editor.Controls.ToolStrip.DualitorToolStripProfessionalRenderer();

            var camViewStateTypeQuery =
                from t in DualityEditorApp.GetAvailDualityEditorTypes(typeof(CamViewState))
                where !t.IsAbstract
                select t;

            foreach (Type t in camViewStateTypeQuery)
            {
                CamViewState state = t.CreateInstanceOf() as CamViewState;
                state.View = this;
                this.availStates.Add(t, state);
            }

            var camViewLayerTypeQuery =
                from t in DualityEditorApp.GetAvailDualityEditorTypes(typeof(CamViewLayer))
                where !t.IsAbstract
                select t;

            foreach (Type t in camViewLayerTypeQuery)
            {
                CamViewLayer layer = t.CreateInstanceOf() as CamViewLayer;
                layer.View = this;
                this.availLayers.Add(t, layer);
            }
        }
Beispiel #2
0
        public void ActivateLayer(CamViewLayer layer)
        {
            if (this.activeLayers == null)
            {
                this.activeLayers = new List <CamViewLayer>();
            }
            if (this.activeLayers.Contains(layer))
            {
                return;
            }
            if (this.activeLayers.Any(l => l.GetType() == layer.GetType()))
            {
                return;
            }
            if (this.lockedLayers.Contains(layer.GetType()))
            {
                return;
            }

            this.activeLayers.Add(layer);
            layer.View = this;
            // No glControl yet? We're not initialized properly and this is the initial state. Enter the state later.
            if (this.glControl != null)
            {
                layer.OnActivateLayer();
                this.glControl.Invalidate();
            }
        }
Beispiel #3
0
        public void DeactivateLayer(CamViewLayer layer)
        {
            if (this.activeLayers == null)
            {
                this.activeLayers = new List <CamViewLayer>();
            }
            if (!this.activeLayers.Contains(layer))
            {
                return;
            }
            if (this.lockedLayers.Contains(layer.GetType()))
            {
                return;
            }

            layer.OnDeactivateLayer();
            layer.View = null;
            this.activeLayers.Remove(layer);
            this.glControl.Invalidate();
        }
Beispiel #4
0
 public LayerEntry(Type stateType, CamViewLayer layer)
 {
     this.layerType = stateType;
     this.layer = layer;
 }
Beispiel #5
0
 public void UnlockLayer(CamViewLayer layer)
 {
     this.UnlockLayer(layer.GetType());
 }
Beispiel #6
0
 public LayerEntry(Type stateType, CamViewLayer layer)
 {
     this.layerType = stateType;
     this.layer     = layer;
 }