private void editBtn_Click(object sender, EventArgs e)
        {
            if (SelectedIndex != -1)
            {
                var texMap = ActiveMaterial.TextureMaps[SelectedIndex];

                Texture_Selector selector = new Texture_Selector();
                selector.LoadTextures(textureList, texMap.Name, ActiveMaterial.ParentLayout);
                if (selector.ShowDialog() == DialogResult.OK)
                {
                    string newTexture = selector.GetSelectedTexture();
                    texMap.ID   = (short)ActiveMaterial.ParentLayout.AddTexture(newTexture);
                    texMap.Name = newTexture;
                    ReloadTexture();
                    ParentEditor.PropertyChanged?.Invoke(sender, e);

                    //Apply to all selected panes
                    foreach (BasePane pane in ParentEditor.SelectedPanes)
                    {
                        var mat = pane.TryGetActiveMaterial();
                        if (mat != null && mat != ActiveMaterial)
                        {
                            if (mat.TextureMaps?.Length > SelectedIndex)
                            {
                                mat.TextureMaps[SelectedIndex] = texMap;
                            }
                            else
                            {
                                mat.AddTexture(newTexture);
                            }
                        }
                    }
                }
            }
        }
        private void addbtn_Click(object sender, EventArgs e)
        {
            if (ActiveMaterial.TextureMaps.Length == 3)
            {
                return;
            }

            Texture_Selector selector = new Texture_Selector();

            selector.LoadTextures(textureList, "", ActiveMaterial.ParentLayout);
            if (selector.ShowDialog() == DialogResult.OK)
            {
                string newTexture = selector.GetSelectedTexture();
                ActiveMaterial.AddTexture(newTexture);

                //Apply to all selected panes
                foreach (BasePane pane in ParentEditor.SelectedPanes)
                {
                    var mat = pane.TryGetActiveMaterial();
                    if (mat != null && mat != ActiveMaterial && mat.TextureMaps?.Length != 3)
                    {
                        mat.AddTexture(newTexture);
                    }
                }

                ReloadTexture();
                ParentEditor.PropertyChanged?.Invoke(sender, e);
            }

            if (selector.UpdateTextures)
            {
                ParentEditor.UpdateTextureList();
            }
        }
Ejemplo n.º 3
0
        private void editBtn_Click(object sender, EventArgs e)
        {
            if (SelectedIndex != -1)
            {
                var texMap = ActiveMaterial.TextureMaps[SelectedIndex];

                Texture_Selector selector = new Texture_Selector();
                selector.LoadTextures(textureList, texMap.Name, ActiveMaterial.ParentLayout);
                if (selector.ShowDialog() == DialogResult.OK)
                {
                    string newTexture = selector.GetSelectedTexture();
                    texMap.ID   = (short)ActiveMaterial.ParentLayout.AddTexture(newTexture);
                    texMap.Name = newTexture;
                    ReloadTexture();
                    ParentEditor.PropertyChanged?.Invoke(sender, e);
                }
            }
        }
Ejemplo n.º 4
0
        private void addbtn_Click(object sender, EventArgs e)
        {
            if (ActiveMaterial.TextureMaps.Length == 3)
            {
                return;
            }

            Texture_Selector selector = new Texture_Selector();

            selector.LoadTextures(textureList, "", ActiveMaterial.ParentLayout);
            if (selector.ShowDialog() == DialogResult.OK)
            {
                string newTexture = selector.GetSelectedTexture();
                ActiveMaterial.AddTexture(newTexture);

                ReloadTexture();
                ParentEditor.PropertyChanged?.Invoke(sender, e);
            }

            if (selector.UpdateTextures)
            {
                ParentEditor.UpdateTextureList();
            }
        }