internal unsafe void SetSCN0(SCN0Node node)
 {
     if (node == null)
     {
         _lightSet = null;
         _fog = null;
     }
     else
     {
         SCN0GroupNode g = node.GetFolder<SCN0LightSetNode>();
         _lightSet = LightSetIndex < g.Children.Count && LightSetIndex >= 0 ? g.Children[LightSetIndex] as SCN0LightSetNode : null;
         g = node.GetFolder<SCN0FogNode>();
         _fog = FogIndex < g.Children.Count && FogIndex >= 0 ? g.Children[FogIndex] as SCN0FogNode : null;
     }
 }
        private void nodeList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (nodeList.SelectedItem == null)
            {
                btnRename.Enabled = false;
                return;
            }
            else if (btnRename.Enabled == false)
                btnRename.Enabled = true;

            _mainWindow.KeyframePanel.TargetSequence = nodeList.SelectedItem as ResourceNode;

            switch (tabIndex)
            {
                case 0:
                    _lightSet = nodeList.SelectedItem as SCN0LightSetNode;

                    lstAmb.Items.Clear();
                    lstAmb.Items.Add("<null>");
                    foreach (SCN0AmbientLightNode s in SelectedAnimation.GetFolder<SCN0AmbientLightNode>().Children)
                        lstAmb.Items.Add(s);

                    SCN0GroupNode lights = SelectedAnimation.GetFolder<SCN0LightNode>();

                    lstLight0.Items.Clear();
                    lstLight0.Items.Add("<null>");
                    foreach (SCN0LightNode s in lights.Children)
                        lstLight0.Items.Add(s);

                    lstLight1.Items.Clear();
                    lstLight1.Items.Add("<null>");
                    foreach (SCN0LightNode s in lights.Children)
                        lstLight1.Items.Add(s);

                    lstLight2.Items.Clear();
                    lstLight2.Items.Add("<null>");
                    foreach (SCN0LightNode s in lights.Children)
                        lstLight2.Items.Add(s);

                    lstLight3.Items.Clear();
                    lstLight3.Items.Add("<null>");
                    foreach (SCN0LightNode s in lights.Children)
                        lstLight3.Items.Add(s);

                    lstLight4.Items.Clear();
                    lstLight4.Items.Add("<null>");
                    foreach (SCN0LightNode s in lights.Children)
                        lstLight4.Items.Add(s);

                    lstLight5.Items.Clear();
                    lstLight5.Items.Add("<null>");
                    foreach (SCN0LightNode s in lights.Children)
                        lstLight5.Items.Add(s);

                    lstLight6.Items.Clear();
                    lstLight6.Items.Add("<null>");
                    foreach (SCN0LightNode s in lights.Children)
                        lstLight6.Items.Add(s);

                    lstLight7.Items.Clear();
                    lstLight7.Items.Add("<null>");
                    foreach (SCN0LightNode s in lights.Children)
                        lstLight7.Items.Add(s);

                    UpdateSelectedLightSets();

                    break;
                case 1:
                    _ambLight = nodeList.SelectedItem as SCN0AmbientLightNode;
                    chkAmbClr.Checked = _ambLight.ColorEnabled;
                    chkAmbAlpha.Checked = _ambLight.AlphaEnabled;

                    break;
                case 2:
                    _light = nodeList.SelectedItem as SCN0LightNode;
                    chkLightClr.Checked = _light.ColorEnabled;
                    chkLightAlpha.Checked = _light.AlphaEnabled;
                    chkLightSpec.Checked = _light.SpecularEnabled;
                    lstLightType.SelectedIndex = (int)_light.LightType;
                    lstDistFunc.SelectedIndex = (int)_light.DistanceFunction;
                    lstSpotFunc.SelectedIndex = (int)_light.SpotFunction;

                    break;
                case 3:
                    _fog = nodeList.SelectedItem as SCN0FogNode;
                    comboBox3.SelectedIndex = Array.IndexOf(fogEnum, _fog.Type);

                    break;
                case 4:
                    _camera = nodeList.SelectedItem as SCN0CameraNode;
                    lstCamType.SelectedIndex = (int)_camera.Type;
                    lstCamProj.SelectedIndex = (int)_camera.ProjectionType;

                    break;
            }
            _mainWindow.KeyframePanel.TargetSequence = nodeList.SelectedItem as ResourceNode;
        }