Пример #1
0
        void BuildZoneList()
        {
            this.listView_Zones.BeginUpdate();

            ListViewItem item = listView_Zones.Items.Add("Main part");

            item.Checked = LightMainPart;
            item.SubItems.Add("Geometry that is not assigned to any zone");

            foreach (Zone zone in EditorManager.Scene.Zones)
            {
                if (!zone.Loaded) // cannot light these zones
                {
                    continue;
                }
                item     = listView_Zones.Items.Add(zone.ZoneName);
                item.Tag = zone;
                int idx = LayerTreeViewNodeBase.GetZoneIcon(zone);
                item.ImageIndex = idx;
                item.Checked    = zone.RunLighting;
                item.SubItems.Add(zone.Description);
            }

            this.listView_Zones.EndUpdate();
        }
Пример #2
0
    void UpdateListBox()
    {
      System.Diagnostics.Debug.Assert(bListBuildInProgress == false);
      bListBuildInProgress = true;
      listView_Layers.BeginUpdate();
      listView_Layers.Items.Clear();
      
      IScene scene = EditorManager.Scene;

      // layers that can be exported
      foreach (Layer layer in scene.Layers)
      {
        if (layer.ParentZone != null)
          continue;

        string itemName = layer.LayerName;
        Color textColor = Color.Black;
        if (!layer.VisibleInAssetProfile.IsActiveProfileSet)
        {
          itemName += " (disabled by asset profile)";
          textColor = Color.Gray;
        }
        ListViewItem item = listView_Layers.Items.Add(itemName);
        item.ForeColor = textColor;
        item.ImageIndex = LayerTreeViewNodeBase.GetLayerIcon(layer);
        item.Tag = layer;
        item.Checked = _settings.ExportedLayers.Contains(layer); // layer.Export;
        item.Group = listView_Layers.Groups["Layers"];

        item.SubItems.Add(layer.Description);
        item.ToolTipText = layer.AbsoluteLayerFilename;
      }

      // zones that can be exported
      foreach (Zone zone in scene.Zones)
      {
        // [#24564] Not modifiable zones can still be exported, otherwise this would not be consistent with unparented layers
        if (_settings.LoadedZonesOnly && !zone.Loaded /* || !zone.Modifiable*/)
          continue;
        ListViewItem item = listView_Layers.Items.Add(zone.ZoneName);
        item.ImageIndex = LayerTreeViewNodeBase.GetZoneIcon(zone);
        item.Tag = zone;
        item.Checked = _settings.ExportedZones.Contains(zone); // zone.Export;
        item.Group = listView_Layers.Groups["Zones"];

        item.SubItems.Add(zone.Description);
        item.ToolTipText = zone.AbsoluteZoneFilename;
      }

      // scene components
      // fill flags box
      Type enumType = typeof(SceneExportFlags_e);
      string[] flags = Enum.GetNames(enumType);
      Array values = Enum.GetValues(enumType);
      for (int i = 0; i < flags.Length; i++)
      {        
        ListViewItem item = listView_Layers.Items.Add(flags[i]);
        item.Tag = values.GetValue(i);
        item.Group = listView_Layers.Groups["SceneComponents"];

        FieldInfo fi = enumType.GetField(flags[i]);
        DescriptionAttribute[] descAttr = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), true);
        if (descAttr.Length == 1)
          item.ToolTipText = descAttr[0].Description;
          //item.SubItems.Add(descAttr[0].Description);
      }
      UIExportFlags = (SceneExportFlags_e)_exportFlags;

      // custom plugins state
      Dictionary<string, bool> relevantPlugins = new Dictionary<string, bool>();
      ExportHelper.GetPluginsForUserSelection(relevantPlugins);
      foreach (KeyValuePair<string, bool> plugin in relevantPlugins)
      {
        string name = plugin.Key;
        ListViewItem item = listView_Layers.Items.Add(name);
        bool bState = plugin.Value;
        // sync with the settings:
        _settings.PluginsUserSelection.TryGetValue(name, out bState);

        item.Tag = name;
        item.Group = listView_Layers.Groups["Plugins"];
        item.ToolTipText = "If enabled, this plugin will be loaded by the vSceneViewer";
        item.Checked = bState;
      }

      listView_Layers.EndUpdate();
      bListBuildInProgress = false;
    }
Пример #3
0
        /// <summary>
        /// Updates the list with the recently selected objects (shape, layer, zone).
        /// </summary>
        private void UpdateRecentSelection()
        {
            // Clean up (remove event handlers
            foreach (ToolStripMenuItem item in ToolStripButtonRecentSelection.DropDownItems)
            {
                item.Click -= new EventHandler(recentItem_Click);
            }
            this.ToolStripButtonRecentSelection.DropDownItems.Clear();

            foreach (object obj in _recentSelectionList)
            {
                ToolStripMenuItem item = new ToolStripMenuItem();

                // Layers
                Layer layer = obj as Layer;
                if (layer != null && EditorManager.Scene.Layers.Contains(layer))
                {
                    item.Text   = "Layer: " + layer.LayerName;
                    item.Tag    = obj;
                    item.Click += new EventHandler(recentItem_Click);
                    this.ToolStripButtonRecentSelection.DropDownItems.Add(item);
                    int index = LayerTreeViewNodeBase.GetLayerIcon(layer);
                    if (index >= 0)
                    {
                        item.Image = LayerTreeViewNodeBase.ImageList.ImageList.Images[index];
                    }
                    continue;
                }

                // Zones
                Zone zone = obj as Zone;
                if (zone != null && EditorManager.Scene.Zones.Contains(zone))
                {
                    item.Text   = "Zone: " + zone.ZoneName;
                    item.Tag    = obj;
                    item.Click += new EventHandler(recentItem_Click);
                    this.ToolStripButtonRecentSelection.DropDownItems.Add(item);
                    int index = LayerTreeViewNodeBase.GetZoneIcon(zone);
                    if (index >= 0)
                    {
                        item.Image = LayerTreeViewNodeBase.ImageList.ImageList.Images[index];
                    }
                    continue;
                }

                // Shapes
                ShapeBase shape = obj as ShapeBase;
                if (shape != null && shape.IsAddedToScene)
                {
                    item.Text   = "Shape: " + shape.ShapeName + " (" + shape.GetType().Name + ")";
                    item.Tag    = obj;
                    item.Click += new EventHandler(recentItem_Click);
                    this.ToolStripButtonRecentSelection.DropDownItems.Add(item);
                    if (shape.IconIndex >= 0)
                    {
                        item.Image = EditorManager.GUI.ShapeTreeImages.ImageList.Images[shape.IconIndex];
                    }
                    continue;
                }
            }
        }