Exemplo n.º 1
0
        public override int OnCalculateSize(bool force)
        {
            for (int i = 0; i < 3; i++)
            {
                _dataLengths[i] = 0;
            }

            _match = null;

            if (_name == "<null>")
            {
                return(SCN0AmbientLight.Size);
            }

            _match = FindColorMatch(_constant, FrameCount, 0) as SCN0AmbientLightNode;
            if (_match == null && !_constant)
            {
                _dataLengths[1] += 4 * (FrameCount + 1);
            }

            if (_constant)
            {
                _fixedFlags |= 0x80;
            }
            else
            {
                _fixedFlags &= 0x7F;
            }

            return(SCN0AmbientLight.Size);
        }
        public override int OnCalculateSize(bool force)
        {
            _visLen = 0;
            _match  = null;
            if (_name != "<null>")
            {
                if (_numEntries != 0)
                {
                    fixedFlags &= 0xFF - 128;
                    foreach (SCN0AmbientLightNode n in Parent.Children)
                    {
                        if (n == this)
                        {
                            break;
                        }

                        if (!n._constant)
                        {
                            for (int i = 0; i < FrameCount + 1; i++)
                            {
                                if (n._colors[i] != _colors[i])
                                {
                                    break;
                                }
                                if (i == FrameCount)
                                {
                                    _match = n;
                                }
                            }
                        }

                        if (_match != null)
                        {
                            break;
                        }
                    }
                    if (_match == null)
                    {
                        _lightLen += 4 * (FrameCount + 1);
                    }
                }
                else
                {
                    fixedFlags |= 128;
                    _lightLen   = 0;
                }
            }
            return(SCN0AmbientLight.Size);
        }
Exemplo n.º 3
0
        public void AttachNodes()
        {
            SCN0Node      node    = (SCN0Node)Parent.Parent;
            SCN0GroupNode g       = node.GetFolder <SCN0LightNode>();
            bint *        strings = Data->StringOffsets;

            if (g != null && !_replaced)
            {
                for (int i = 0; i < Data->_numLights && i < 8; i++)
                {
                    _lights[i] = g.FindChild(new String((sbyte *)strings + strings[i]), false) as SCN0LightNode;
                }
            }
            g = node.GetFolder <SCN0AmbientLightNode>();
            if (g != null && Data->_ambNameOffset != 0 && !_replaced)
            {
                _ambient = g.FindChild(Data->AmbientString, false) as SCN0AmbientLightNode;
            }
        }
        public override int OnCalculateSize(bool force)
        {
            _visLen = 0;
            _match = null;
            if (_name != "<null>")
                if (_numEntries != 0)
                {
                    fixedFlags &= 0xFF - 128;
                    foreach (SCN0AmbientLightNode n in Parent.Children)
                    {
                        if (n == this)
                            break;

                        if (!n._constant)
                        {
                            for (int i = 0; i < FrameCount + 1; i++)
                            {
                                if (n._colors[i] != _colors[i])
                                    break;
                                if (i == FrameCount)
                                    _match = n;
                            }
                        }

                        if (_match != null)
                            break;
                    }
                    if (_match == null)
                        _lightLen += 4 * (FrameCount + 1);
                }
                else
                {
                    fixedFlags |= 128;
                    _lightLen = 0;
                }
            return SCN0AmbientLight.Size;
        }
Exemplo n.º 5
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;
        }
 public void AttachNodes()
 {
     SCN0Node node = (SCN0Node)Parent.Parent;
     SCN0GroupNode g = node.GetFolder<SCN0LightNode>();
     bint* strings = Data->StringOffsets;
     if (g != null && !_replaced)
         for (int i = 0; i < Data->_numLights && i < 8; i++)
             _lights[i] = g.FindChild(new String((sbyte*)strings + strings[i]), false) as SCN0LightNode;
     g = node.GetFolder<SCN0AmbientLightNode>();
     if (g != null && Data->_ambNameOffset != 0 && !_replaced)
         _ambient = g.FindChild(Data->AmbientString, false) as SCN0AmbientLightNode;
 }