コード例 #1
0
ファイル: MultiForm.cs プロジェクト: kjmikkel/NWN2_Multibrush
 public void setData(brushData data)
 {
     if (data != null) {
         textureList.Items.Clear();
         setValuesToFormControls(data);
         this.data = data;
     }
 }
コード例 #2
0
ファイル: MultiForm.cs プロジェクト: SeanWH/NWN2_Multibrush
        void getValuesFromFormControls()
        {
            try {
                data = new brushData();

                //Texture brushes
                foreach (textureData tex in textureList.Items)
                {
                    data.textures.AddLast(tex);
                }

                data.rounds = (int)numericRounds.Value;
                // Grass
                data.grassCoverage = grassCoverageTrackbar.Value;
                data.grassDensity  = grassDensityTrackbar.Value;

                data.grassSize          = bladeSize.Value;
                data.grassSizeVariation = bladeSizeVariation.Value;
                data.numSelected        = grassTextures.numSelected;

                data.grassTexture = grassTextures.selectedTextures;

                if (paintGrass.Checked)
                {
                    data.grassOption = grassOption.Paint;
                }
                else
                {
                    data.grassOption = grassOption.NoGrass;
                }

                data.grassTexture = grassTextures.getListOfNames();

                // The brush itself
                data.innerCircle = (int)numInner.Value;
                data.outerCircle = (int)numOuter.Value;

                // Colour
                data.col = colourButton.BackColor;

                if (paintColour.Checked)
                {
                    data.colourOption = colourOption.Colour;
                }
                else
                {
                    data.colourOption = colourOption.NoColour;
                }

                data.colourCoverage = colourCoverage.Value;
                data.colourPresure  = colourPresure.Value;

                data.randomize = randomCheck.Checked;
            } catch (Exception e) {
                Console.WriteLine(e);
            }
        }
コード例 #3
0
ファイル: MultiForm.cs プロジェクト: SeanWH/NWN2_Multibrush
 public void setData(brushData data)
 {
     if (data != null)
     {
         textureList.Items.Clear();
         setValuesToFormControls(data);
         this.data = data;
     }
 }
コード例 #4
0
        /// <summary>
        /// We are already painting with the multibrush, but we want to change the data
        /// </summary>
        /// <param name="data">The new data we want to use</param>
        public void setNewData(brushData data)
        {
            this.data = data;

            try {
                foreach (NWN2AreaViewer viewer in NWN2ToolsetMainForm.App.GetAllAreaViewers())
                {
                    if (newReceiverTable.ContainsKey(viewer))
                    {
                        InputReceiver input = (InputReceiver)newReceiverTable[viewer];
                        if (input != null)
                        {
                            inputReciver = input;
                            inputReciver.changeData(this.data);
                        }
                    }
                }
            } catch (Exception exception) {
                throw new Exception("Problem found while trying to add new Data: " + exception);
            }
        }
コード例 #5
0
ファイル: Painter.cs プロジェクト: SeanWH/NWN2_Multibrush
        /// <summary>
        /// Set the data for the painter
        /// </summary>
        /// <param name="data"></param>
        public void setOuterInner(brushData data)
        {
            this.data     = data;
            this.newOuter = data.outerCircle;
            this.newInner = data.innerCircle;
            this.rounds   = data.rounds;

            opTexture.Checked = true;
            innerRadius.Value = Math.Min(this.newInner, innerRadius.Maximum);
            outerRadius.Value = Math.Min(this.newOuter, outerRadius.Maximum);

            // I set the default texture, and textures
            foreach (object texture in textureListBox.Items)
            {
                if (texture.ToString() == data.textures.First.Value.ToString())
                {
                    textureListBox.SelectedItem = texture;
                    break;
                }
            }

            barPressure.Value = data.textures.First.Value.getPresureUnmodified() * 100;
        }
コード例 #6
0
ファイル: MultiForm.cs プロジェクト: SeanWH/NWN2_Multibrush
        void importBrush(object sender, EventArgs e)
        {
            try {
                FileDialog fileDia = new OpenFileDialog();
                fileDia.Filter     = filter;
                fileDia.DefaultExt = saveFormat;

                if (fileDia.ShowDialog() == DialogResult.OK)
                {
                    string filename = fileDia.FileName;
                    if (fileDia.CheckFileExists)
                    {
                        data = new brushData();
                        textureList.Items.Clear();

                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.Load(filename);

                        data.textures = new LinkedList <textureData>();


                        for (int index = 1; index <= NUM_TEXTURE_TOTAL; index++)
                        {
                            XmlNodeList node = xmlDoc.GetElementsByTagName("texture" + index);
                            if (node[0] != null)
                            {
                                data.textures.AddLast(readTextureElement(node[0]));
                            }
                            else
                            {
                                break;
                            }
                        }

                        //Grass
                        XmlElement grassElem = (XmlElement)xmlDoc.GetElementsByTagName("Grass")[0];

                        string grassOptionStr = grassElem.GetAttribute("grassOption");

                        if (grassOptionStr == grassOption.NoGrass.ToString())
                        {
                            data.grassOption = grassOption.NoGrass;
                        }
                        else if (grassOptionStr == grassOption.Paint.ToString())
                        {
                            data.grassOption = grassOption.Paint;
                        }
                        else
                        {
                            throw new Exception("Wrong grass option");
                        }

                        data.grassSize          = int.Parse(grassElem.GetAttribute("bladeSize"));
                        data.grassSizeVariation = int.Parse(grassElem.GetAttribute("bladeSizeVariation"));
                        data.grassCoverage      = int.Parse(grassElem.GetAttribute("coverage"));
                        data.grassDensity       = int.Parse(grassElem.GetAttribute("density"));
                        data.grassTexture       = new String[3];


                        string val;

                        for (int index = 0; index < 3; index++)
                        {
                            if (grassElem.HasAttribute("grassTexture" + (index + 1)))
                            {
                                val = grassElem.GetAttribute("grassTexture" + (index + 1));
                                data.grassTexture[index] = val;
                            }
                        }

                        //Brush data
                        XmlElement brushElem = (XmlElement)xmlDoc.GetElementsByTagName("Brush_Data")[0];
                        data.innerCircle = int.Parse(brushElem.GetAttribute("inner"));
                        data.outerCircle = int.Parse(brushElem.GetAttribute("outer"));

                        // Colour
                        XmlElement colourElem = (XmlElement)xmlDoc.GetElementsByTagName("Colour")[0];
                        data.col = Color.FromArgb(int.Parse(colourElem.InnerXml));

                        string colourOptionStr = colourElem.GetAttribute("option");
                        if (colourOptionStr == colourOption.Colour.ToString())
                        {
                            data.colourOption = colourOption.Colour;
                        }
                        else if (colourOptionStr == colourOption.NoColour.ToString())
                        {
                            data.colourOption = colourOption.NoColour;
                        }
                        else
                        {
                            throw new Exception("Wrong colour option");
                        }

                        data.colourCoverage = int.Parse(colourElem.GetAttribute("coverage"));
                        data.colourPresure  = int.Parse(colourElem.GetAttribute("presure"));

                        XmlElement randomizeElement = (XmlElement)xmlDoc.GetElementsByTagName("Random")[0];

                        if (randomizeElement != null)
                        {
                            data.randomize = bool.Parse(randomizeElement.GetAttribute("randomize"));
                        }

                        // All the values have been set - now is the time to set the form itself
                        setValuesToFormControls(data);
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("File \"" + filename + "\" does not exist. Please choose another one");
                    }
                }
            } catch (Exception e2) {
                Console.WriteLine(e2);
            }
        }
コード例 #7
0
ファイル: Painter.cs プロジェクト: kjmikkel/NWN2_Multibrush
 /// <summary>
 /// Change the brush data
 /// </summary>
 /// <param name="data"></param>
 public void changeData(brushData data)
 {
     setOuterInner(data);
 }
コード例 #8
0
 // Methods
 public InputReceiver(brushData data)
 {
     painter = new Painter();
     painter.setOuterInner(data);
 }
コード例 #9
0
 // Methods
 public InputReceiver(brushData data)
 {
     painter = new Painter();
     painter.setOuterInner(data);
 }
コード例 #10
0
 // Methods
 public IntervalTimer(brushData data)
 {
     this.data = data;
     base.Interval = 0x7d0;
 }
コード例 #11
0
        /// <summary>
        /// We are already painting with the multibrush, but we want to change the data
        /// </summary>
        /// <param name="data">The new data we want to use</param>
        public void setNewData(brushData data)
        {
            this.data = data;

            try {
                foreach (NWN2AreaViewer viewer in NWN2ToolsetMainForm.App.GetAllAreaViewers())
                {
                    if (newReceiverTable.ContainsKey(viewer)) {
                        InputReceiver input = (InputReceiver)newReceiverTable[viewer];
                        if (input != null) {
                            inputReciver = input;
                            inputReciver.changeData(this.data);
                        }
                    }
                }
            } catch (Exception exception) {
                throw new Exception("Problem found while trying to add new Data: " + exception);
            }
        }
コード例 #12
0
ファイル: MultiForm.cs プロジェクト: kjmikkel/NWN2_Multibrush
        void importBrush(object sender, EventArgs e)
        {
            try {
                FileDialog fileDia = new OpenFileDialog();
                fileDia.Filter = filter;
                fileDia.DefaultExt = saveFormat;

                if (fileDia.ShowDialog() == DialogResult.OK) {
                    string filename = fileDia.FileName;
                    if (fileDia.CheckFileExists) {
                        data = new brushData();
                        textureList.Items.Clear();

                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.Load(filename);

                        data.textures = new LinkedList<textureData>();

                        for(int index = 1; index <= NUM_TEXTURE_TOTAL; index++) {
                            XmlNodeList node = xmlDoc.GetElementsByTagName("texture" + index);
                            if (node[0] != null) {
                                data.textures.AddLast(readTextureElement(node[0]));
                            } else {
                                break;
                            }
                        }

                        //Grass
                        XmlElement grassElem = (XmlElement)xmlDoc.GetElementsByTagName("Grass")[0];

                        string grassOptionStr = grassElem.GetAttribute("grassOption");

                        if (grassOptionStr == grassOption.NoGrass.ToString()) {
                            data.grassOption = grassOption.NoGrass;
                        } else if (grassOptionStr == grassOption.Paint.ToString()) {
                            data.grassOption = grassOption.Paint;
                        } else {
                            throw new Exception("Wrong grass option");
                        }

                        data.grassSize = int.Parse(grassElem.GetAttribute("bladeSize"));
                        data.grassSizeVariation = int.Parse(grassElem.GetAttribute("bladeSizeVariation"));
                        data.grassCoverage = int.Parse(grassElem.GetAttribute("coverage"));
                        data.grassDensity = int.Parse(grassElem.GetAttribute("density"));
                        data.grassTexture = new String[3];

                        string val;

                        for(int index = 0; index < 3; index++) {
                            if (grassElem.HasAttribute("grassTexture" + (index + 1))) {
                                val = grassElem.GetAttribute("grassTexture" + (index + 1));
                                data.grassTexture[index] = val;
                            }
                        }

                        //Brush data
                        XmlElement brushElem = (XmlElement)xmlDoc.GetElementsByTagName("Brush_Data")[0];
                        data.innerCircle = int.Parse(brushElem.GetAttribute("inner"));
                        data.outerCircle = int.Parse(brushElem.GetAttribute("outer"));

                        // Colour
                        XmlElement colourElem = (XmlElement)xmlDoc.GetElementsByTagName("Colour")[0];
                        data.col = Color.FromArgb(int.Parse(colourElem.InnerXml));

                        string colourOptionStr = colourElem.GetAttribute("option");
                        if (colourOptionStr == colourOption.Colour.ToString()) {
                            data.colourOption = colourOption.Colour;
                        } else if (colourOptionStr == colourOption.NoColour.ToString()) {
                            data.colourOption = colourOption.NoColour;
                        }else {
                            throw new Exception("Wrong colour option");
                        }

                        data.colourCoverage = int.Parse(colourElem.GetAttribute("coverage"));
                        data.colourPresure = int.Parse(colourElem.GetAttribute("presure"));

                        XmlElement randomizeElement = (XmlElement)xmlDoc.GetElementsByTagName("Random")[0];

                        if (randomizeElement != null) {
                            data.randomize = bool.Parse(randomizeElement.GetAttribute("randomize"));
                        }

                        // All the values have been set - now is the time to set the form itself
                        setValuesToFormControls(data);
                    } else {
                        System.Windows.Forms.MessageBox.Show("File \"" + filename + "\" does not exist. Please choose another one");
                    }
                }
            } catch (Exception e2) {
                Console.WriteLine(e2);
            }
        }
コード例 #13
0
ファイル: MultiForm.cs プロジェクト: kjmikkel/NWN2_Multibrush
        void getValuesFromFormControls()
        {
            try {
                data = new brushData();

                //Texture brushes
                foreach(textureData tex in textureList.Items) {
                    data.textures.AddLast(tex);
                }

                data.rounds = (int)numericRounds.Value;
                // Grass
                data.grassCoverage = grassCoverageTrackbar.Value;
                data.grassDensity = grassDensityTrackbar.Value;

                data.grassSize = bladeSize.Value;
                data.grassSizeVariation = bladeSizeVariation.Value;
                data.numSelected = grassTextures.numSelected;

                data.grassTexture = grassTextures.selectedTextures;

                if (paintGrass.Checked) {
                    data.grassOption = grassOption.Paint;
                } else {
                    data.grassOption = grassOption.NoGrass;
                }

                data.grassTexture = grassTextures.getListOfNames();

                // The brush itself
                data.innerCircle = (int)numInner.Value;
                data.outerCircle = (int)numOuter.Value;

                // Colour
                data.col = colourButton.BackColor;

                if (paintColour.Checked) {
                    data.colourOption = colourOption.Colour;
                } else {
                    data.colourOption = colourOption.NoColour;
                }

                data.colourCoverage = colourCoverage.Value;
                data.colourPresure = colourPresure.Value;

                data.randomize = randomCheck.Checked;

            } catch (Exception e) {
                Console.WriteLine(e);
            }
        }
コード例 #14
0
ファイル: MultiForm.cs プロジェクト: kjmikkel/NWN2_Multibrush
        public void setValuesToFormControls(brushData localData)
        {
            try {
                // Texture
                foreach(textureData tex in localData.textures) {
                    textureList.Items.Add(tex);
                }
                textureList.SelectedIndex = 0;

                // Grass
                grassCoverageTrackbar.Value = localData.grassCoverage;
                grassDensityTrackbar.Value = localData.grassDensity;
                foreach(string grassTexture in data.grassTexture) {
                    grassTextures.setListByName(grassTexture);
                }

                bladeSize.Value = localData.grassSize;
                bladeSizeVariation.Value = localData.grassSizeVariation;

                if (localData.grassOption == grassOption.NoGrass) {
                    paintGrass.Checked = false;
                } else if (localData.grassOption == grassOption.Paint) {
                    paintGrass.Checked = true;
                } else {
                    throw new Exception("Wrong grass option in init data");
                }

                // Outer and inner brush size
                numInner.Value = (decimal)localData.innerCircle;
                numOuter.Value = (decimal)localData.outerCircle;

                //Colour
                colourButton.BackColor = localData.col;

                colourCoverage.Value = localData.colourCoverage;
                colourPresure.Value = localData.colourPresure;

                if (localData.colourOption == colourOption.Colour) {
                    paintColour.Checked = true;
                } else if (localData.colourOption == colourOption.NoColour) {
                    paintColour.Checked = false;
                } else {
                    throw new Exception("Wrong colour option in init data");
                }

                randomCheck.Checked = data.randomize;

            } catch (Exception e) {
                Console.WriteLine(e);
            }
        }
コード例 #15
0
ファイル: Painter.cs プロジェクト: SeanWH/NWN2_Multibrush
 /// <summary>
 /// Change the brush data
 /// </summary>
 /// <param name="data"></param>
 public void changeData(brushData data)
 {
     setOuterInner(data);
 }
コード例 #16
0
ファイル: MultiForm.cs プロジェクト: SeanWH/NWN2_Multibrush
        public void setValuesToFormControls(brushData localData)
        {
            try {
                // Texture
                foreach (textureData tex in localData.textures)
                {
                    textureList.Items.Add(tex);
                }
                textureList.SelectedIndex = 0;

                // Grass
                grassCoverageTrackbar.Value = localData.grassCoverage;
                grassDensityTrackbar.Value  = localData.grassDensity;
                foreach (string grassTexture in data.grassTexture)
                {
                    grassTextures.setListByName(grassTexture);
                }

                bladeSize.Value          = localData.grassSize;
                bladeSizeVariation.Value = localData.grassSizeVariation;

                if (localData.grassOption == grassOption.NoGrass)
                {
                    paintGrass.Checked = false;
                }
                else if (localData.grassOption == grassOption.Paint)
                {
                    paintGrass.Checked = true;
                }
                else
                {
                    throw new Exception("Wrong grass option in init data");
                }

                // Outer and inner brush size
                numInner.Value = (decimal)localData.innerCircle;
                numOuter.Value = (decimal)localData.outerCircle;

                //Colour
                colourButton.BackColor = localData.col;

                colourCoverage.Value = localData.colourCoverage;
                colourPresure.Value  = localData.colourPresure;

                if (localData.colourOption == colourOption.Colour)
                {
                    paintColour.Checked = true;
                }
                else if (localData.colourOption == colourOption.NoColour)
                {
                    paintColour.Checked = false;
                }
                else
                {
                    throw new Exception("Wrong colour option in init data");
                }

                randomCheck.Checked = data.randomize;
            } catch (Exception e) {
                Console.WriteLine(e);
            }
        }
コード例 #17
0
ファイル: brushData.cs プロジェクト: kjmikkel/NWN2_Multibrush
        public static brushData importBrush(String filename, int NUM_TEXTURE_TOTAL)
        {
            brushData	data = new brushData();

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(filename);

            data.textures = new LinkedList<textureData>();

            for(int index = 1; index <= NUM_TEXTURE_TOTAL; index++) {
                XmlNodeList node = xmlDoc.GetElementsByTagName("texture" + index);
                if (node[0] != null) {
                    data.textures.AddLast(readTextureElement(node[0]));
                } else {
                    break;
                }
            }

            //Grass
            XmlElement grassElem = (XmlElement)xmlDoc.GetElementsByTagName("Grass")[0];

            string grassOptionStr = grassElem.GetAttribute("grassOption");

            if (grassOptionStr == grassOption.NoGrass.ToString()) {
                data.grassOption = grassOption.NoGrass;
            } else if (grassOptionStr == grassOption.Paint.ToString()) {
                data.grassOption = grassOption.Paint;
            } else {
                throw new Exception("Wrong grass option");
            }

            data.grassSize = int.Parse(grassElem.GetAttribute("bladeSize"));
            data.grassSizeVariation = int.Parse(grassElem.GetAttribute("bladeSizeVariation"));
            data.grassCoverage = int.Parse(grassElem.GetAttribute("coverage"));
            data.grassDensity = int.Parse(grassElem.GetAttribute("density"));
            data.grassTexture = new String[3];

            string val;

            for(int index = 0; index < 3; index++) {
                if (grassElem.HasAttribute("grassTexture" + (index + 1))) {
                    val = grassElem.GetAttribute("grassTexture" + (index + 1));
                    data.grassTexture[index] = val;
                }
            }

            //Brush data
            XmlElement brushElem = (XmlElement)xmlDoc.GetElementsByTagName("Brush_Data")[0];
            data.innerCircle = int.Parse(brushElem.GetAttribute("inner"));
            data.outerCircle = int.Parse(brushElem.GetAttribute("outer"));

            // Colour
            XmlElement colourElem = (XmlElement)xmlDoc.GetElementsByTagName("Colour")[0];
            data.col = Color.FromArgb(int.Parse(colourElem.InnerXml));

            string colourOptionStr = colourElem.GetAttribute("option");
            if (colourOptionStr == colourOption.Colour.ToString()) {
                data.colourOption = colourOption.Colour;
            } else if (colourOptionStr == colourOption.NoColour.ToString()) {
                data.colourOption = colourOption.NoColour;
            }else {
                throw new Exception("Wrong colour option");
            }

            data.colourCoverage = int.Parse(colourElem.GetAttribute("coverage"));
            data.colourPresure = int.Parse(colourElem.GetAttribute("presure"));

            XmlElement randomizeElement = (XmlElement)xmlDoc.GetElementsByTagName("Random")[0];

            if (randomizeElement != null) {
                data.randomize = bool.Parse(randomizeElement.GetAttribute("randomize"));
            }
            return data;
        }
コード例 #18
0
ファイル: Multibrush.cs プロジェクト: SeanWH/NWN2_Multibrush
        /// <summary>
        /// A utility method to handle the launch of the multiform.
        /// If the data is different than null, then it becomes the default data for the multiform
        /// </summary>
        /// <param name="data"></param>
        public static void makeMultiForm(brushData data)
        {
            UI.MultiForm form = UI.MultiForm.makeMultiForm();

            if (data != null)
            {
                form.setData(data);
            }

            if (DialogResult.OK == form.ShowDialog() && form.data != null)
            {
                drawPolygon.Enabled = false;
                if (form.data.mode == paintmode.paint)
                {
                    debugOut("brush!");
                    tool = "Brush";
                }
                else if (form.data.mode == paintmode.eyedrop)
                {
                    debugOut("eyedrop");
                    tool = "Eyedrop tool";
                }
                else if (form.data.mode == paintmode.polygon)
                {
                    debugOut("Polygon");
                    tool = "Polygon paint";
                    drawPolygon.Enabled = true;
                }
                else
                {
                    throw new Exception("Error wrong paint mode");
                }
                //	setStartStopTitle(true);

                if (!form.stopSystem)
                {
                    if (m_timer != null)
                    {
                        m_timer.setNewData(form.data);
                        m_timer.resumeTexture();
                    }
                    else
                    {
                        m_timer = new IntervalTimer(form.data);
                        m_timer.startTexture();
                    }
                    setStartStopTitle(true);
                }
                else
                {
                    if (m_timer != null)
                    {
                        m_timer.stopTexture();
                        setStartStopTitle(false);
                    }
                }
            }

            if (form.data == null)
            {
                setStartStopTitle(false);
            }
        }
コード例 #19
0
 public void changeData(brushData data)
 {
     painter.changeData(data);
 }
コード例 #20
0
 // Methods
 public IntervalTimer(brushData data)
 {
     this.data     = data;
     base.Interval = 0x7d0;
 }
コード例 #21
0
 public void changeData(brushData data)
 {
     painter.changeData(data);
 }
コード例 #22
0
        public static brushData importBrush(String filename, int NUM_TEXTURE_TOTAL)
        {
            brushData data = new brushData();


            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(filename);

            data.textures = new LinkedList <textureData>();


            for (int index = 1; index <= NUM_TEXTURE_TOTAL; index++)
            {
                XmlNodeList node = xmlDoc.GetElementsByTagName("texture" + index);
                if (node[0] != null)
                {
                    data.textures.AddLast(readTextureElement(node[0]));
                }
                else
                {
                    break;
                }
            }

            //Grass
            XmlElement grassElem = (XmlElement)xmlDoc.GetElementsByTagName("Grass")[0];

            string grassOptionStr = grassElem.GetAttribute("grassOption");

            if (grassOptionStr == grassOption.NoGrass.ToString())
            {
                data.grassOption = grassOption.NoGrass;
            }
            else if (grassOptionStr == grassOption.Paint.ToString())
            {
                data.grassOption = grassOption.Paint;
            }
            else
            {
                throw new Exception("Wrong grass option");
            }

            data.grassSize          = int.Parse(grassElem.GetAttribute("bladeSize"));
            data.grassSizeVariation = int.Parse(grassElem.GetAttribute("bladeSizeVariation"));
            data.grassCoverage      = int.Parse(grassElem.GetAttribute("coverage"));
            data.grassDensity       = int.Parse(grassElem.GetAttribute("density"));
            data.grassTexture       = new String[3];


            string val;

            for (int index = 0; index < 3; index++)
            {
                if (grassElem.HasAttribute("grassTexture" + (index + 1)))
                {
                    val = grassElem.GetAttribute("grassTexture" + (index + 1));
                    data.grassTexture[index] = val;
                }
            }

            //Brush data
            XmlElement brushElem = (XmlElement)xmlDoc.GetElementsByTagName("Brush_Data")[0];

            data.innerCircle = int.Parse(brushElem.GetAttribute("inner"));
            data.outerCircle = int.Parse(brushElem.GetAttribute("outer"));

            // Colour
            XmlElement colourElem = (XmlElement)xmlDoc.GetElementsByTagName("Colour")[0];

            data.col = Color.FromArgb(int.Parse(colourElem.InnerXml));

            string colourOptionStr = colourElem.GetAttribute("option");

            if (colourOptionStr == colourOption.Colour.ToString())
            {
                data.colourOption = colourOption.Colour;
            }
            else if (colourOptionStr == colourOption.NoColour.ToString())
            {
                data.colourOption = colourOption.NoColour;
            }
            else
            {
                throw new Exception("Wrong colour option");
            }

            data.colourCoverage = int.Parse(colourElem.GetAttribute("coverage"));
            data.colourPresure  = int.Parse(colourElem.GetAttribute("presure"));

            XmlElement randomizeElement = (XmlElement)xmlDoc.GetElementsByTagName("Random")[0];

            if (randomizeElement != null)
            {
                data.randomize = bool.Parse(randomizeElement.GetAttribute("randomize"));
            }
            return(data);
        }
コード例 #23
0
ファイル: Painter.cs プロジェクト: kjmikkel/NWN2_Multibrush
        /// <summary>
        /// Set the data for the painter
        /// </summary>
        /// <param name="data"></param>
        public void setOuterInner(brushData data)
        {
            this.data = data;
            this.newOuter = data.outerCircle;
            this.newInner = data.innerCircle;
            this.rounds = data.rounds;

            opTexture.Checked = true;
            innerRadius.Value = Math.Min(this.newInner, innerRadius.Maximum);
            outerRadius.Value = Math.Min(this.newOuter, outerRadius.Maximum);

            // I set the default texture, and textures
            foreach(object texture in textureListBox.Items) {
                if (texture.ToString() == data.textures.First.Value.ToString()) {
                    textureListBox.SelectedItem = texture;
                    break;
                }
            }

            barPressure.Value = data.textures.First.Value.getPresureUnmodified() * 100;
        }
コード例 #24
0
        /// <summary>
        /// A utility method to handle the launch of the multiform. 
        /// If the data is different than null, then it becomes the default data for the multiform
        /// </summary>
        /// <param name="data"></param>
        public static void makeMultiForm(brushData data)
        {
            UI.MultiForm form = UI.MultiForm.makeMultiForm();

            if (data != null)
                form.setData(data);

            if (DialogResult.OK == form.ShowDialog() && form.data != null) {

                drawPolygon.Enabled = false;
                if (form.data.mode == paintmode.paint) {
                    debugOut("brush!");
                    tool = "Brush";
                } else if (form.data.mode == paintmode.eyedrop) {
                    debugOut("eyedrop");
                    tool = "Eyedrop tool";
                } else if (form.data.mode == paintmode.polygon) {
                    debugOut("Polygon");
                    tool = "Polygon paint";
                    drawPolygon.Enabled = true;
                } else {
                    throw new Exception("Error wrong paint mode");
                }
            //	setStartStopTitle(true);

                if (!form.stopSystem) {
                    if (m_timer != null) {
                        m_timer.setNewData(form.data);
                        m_timer.resumeTexture();
                    } else {
                        m_timer = new IntervalTimer(form.data);
                        m_timer.startTexture();
                    }
                    setStartStopTitle(true);
                }
                else {

                    if (m_timer != null) {
                        m_timer.stopTexture();
                        setStartStopTitle(false);
                    }
                }
            }

            if (form.data == null) {
                setStartStopTitle(false);
            }
        }