Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        public override int OnCalculateSize(bool force)
        {
            match1    = null;
            match2    = null;
            _lightLen = 0;
            _keyLen   = 0;
            _visLen   = 0;
            if (_name != "<null>")
            {
                if (!SetConstant)
                {
                    _visLen += _entryCount.Align(32) / 8;
                }
                if (!_constants[0])
                {
                    foreach (SCN0LightNode n in Parent.Children)
                    {
                        if (n == this)
                        {
                            break;
                        }

                        if (!n._constants[0])
                        {
                            for (int i = 0; i < FrameCount + 1; i++)
                            {
                                if (n.GetColors(0)[i] != GetColors(0)[i])
                                {
                                    break;
                                }
                                if (i == FrameCount)
                                {
                                    match1 = n;
                                }
                            }
                        }

                        if (match1 != null)
                        {
                            break;
                        }
                    }
                    if (match1 == null)
                    {
                        _lightLen += 4 * (FrameCount + 1);
                    }
                }
                if (!_constants[1])
                {
                    foreach (SCN0LightNode n in Parent.Children)
                    {
                        if (n == this)
                        {
                            break;
                        }

                        if (!n._constants[1])
                        {
                            for (int i = 0; i < FrameCount + 1; i++)
                            {
                                if (n.GetColors(1)[i] != GetColors(1)[i])
                                {
                                    break;
                                }
                                if (i == FrameCount)
                                {
                                    match2 = n;
                                }
                            }
                        }

                        if (match2 != null)
                        {
                            break;
                        }
                    }
                    if (match2 == null)
                    {
                        _lightLen += 4 * (FrameCount + 1);
                    }
                }
                for (int i = 0; i < 10; i++)
                {
                    if (GetKeys(i)._keyCount > 1)
                    {
                        _keyLen += 8 + GetKeys(i)._keyCount * 12;
                    }
                }

                if (UsageFlags.HasFlag(UsageFlags.SpecularEnabled))
                {
                    ((SCN0Node)Parent.Parent)._specLights++;
                }
            }

            return(SCN0Light.Size);
        }
        public override int OnCalculateSize(bool force)
        {
            match1 = null;
            match2 = null;
            _lightLen = 0;
            _keyLen = 0;
            _visLen = 0;
            if (_name != "<null>")
            {
                if (!SetConstant)
                    _visLen += _entryCount.Align(32) / 8;
                if (!_constants[0])
                {
                    foreach (SCN0LightNode n in Parent.Children)
                    {
                        if (n == this)
                            break;

                        if (!n._constants[0])
                        {
                            for (int i = 0; i < FrameCount + 1; i++)
                            {
                                if (n.GetColors(0)[i] != GetColors(0)[i])
                                    break;
                                if (i == FrameCount)
                                    match1 = n;
                            }
                        }

                        if (match1 != null)
                            break;
                    }
                    if (match1 == null)
                        _lightLen += 4 * (FrameCount + 1);
                }
                if (!_constants[1])
                {
                    foreach (SCN0LightNode n in Parent.Children)
                    {
                        if (n == this)
                            break;

                        if (!n._constants[1])
                        {
                            for (int i = 0; i < FrameCount + 1; i++)
                            {
                                if (n.GetColors(1)[i] != GetColors(1)[i])
                                    break;
                                if (i == FrameCount)
                                    match2 = n;
                            }
                        }

                        if (match2 != null)
                            break;
                    }
                    if (match2 == null)
                        _lightLen += 4 * (FrameCount + 1);
                }
                for (int i = 0; i < 10; i++)
                    if (GetKeys(i)._keyCount > 1)
                        _keyLen += 8 + GetKeys(i)._keyCount * 12;

                if (UsageFlags.HasFlag(UsageFlags.SpecularEnabled))
                    ((SCN0Node)Parent.Parent)._specLights++;
            }

            return SCN0Light.Size;
        }