Ejemplo n.º 1
0
        // Create clicked
        private void createButton_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.Assert(uidBox.Text.Length > 0);

            try
            {
                if (EditorResourceManager.exists(uidBox.Text))
                {
                    MessageBox.Show("That uid already exists.", "Duplicate UID");
                }
                else
                {
                    DialogResult = System.Windows.Forms.DialogResult.OK;
                    Close();
                }
            }
            catch (InvalidResourceException resourceException)
            {
                MessageBox.Show(String.Format("Invalid resource:\n {0}", resourceException.StackTrace), "Resource Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (ResourceNotFoundException resourceException)
            {
                MessageBox.Show(String.Format("Resource not found:\n {0}", resourceException.StackTrace), "Resource Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        // Clone material
        public void cloneMaterial(EditorMaterial source)
        {
            EditorMaterial material = source.clone();
            string         newUID   = material.uid + "_copy";

            while (EditorResourceManager.exists(newUID))
            {
                newUID = newUID + "_copy";
            }
            while (materialExists(newUID))
            {
                newUID = newUID + "_copy";
            }
            material.uid = newUID;
            _materials.Add(material);
        }