Implement bulk delete tool for grass instances (#161)

* Added new Project panel for bulk grass delete

* Removed vs2015BlueTheme instance added unintentionally
This commit is contained in:
PNWParksFan 2022-07-29 06:16:13 -07:00 committed by GitHub
parent cca75a00c5
commit bacbef88f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 777 additions and 269 deletions

View File

@ -0,0 +1,219 @@
namespace CodeWalker.Project.Panels
{
partial class DeleteGrassPanel
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.brushModeGroupBox = new System.Windows.Forms.GroupBox();
this.brushDeleteAnyRadio = new System.Windows.Forms.RadioButton();
this.brushDeleteYmapRadio = new System.Windows.Forms.RadioButton();
this.brushDisabledRadio = new System.Windows.Forms.RadioButton();
this.brushSettingsGroupBox = new System.Windows.Forms.GroupBox();
this.RadiusNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.radiusLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.brushDeleteBatchRadio = new System.Windows.Forms.RadioButton();
this.currentYmapTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.brushDeleteProjectRadio = new System.Windows.Forms.RadioButton();
this.brushModeGroupBox.SuspendLayout();
this.brushSettingsGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.RadiusNumericUpDown)).BeginInit();
this.SuspendLayout();
//
// brushModeGroupBox
//
this.brushModeGroupBox.Controls.Add(this.brushDeleteProjectRadio);
this.brushModeGroupBox.Controls.Add(this.brushDeleteBatchRadio);
this.brushModeGroupBox.Controls.Add(this.brushDeleteAnyRadio);
this.brushModeGroupBox.Controls.Add(this.brushDeleteYmapRadio);
this.brushModeGroupBox.Controls.Add(this.brushDisabledRadio);
this.brushModeGroupBox.Location = new System.Drawing.Point(12, 12);
this.brushModeGroupBox.Name = "brushModeGroupBox";
this.brushModeGroupBox.Size = new System.Drawing.Size(187, 138);
this.brushModeGroupBox.TabIndex = 70;
this.brushModeGroupBox.TabStop = false;
this.brushModeGroupBox.Text = "Delete Grass Brush Mode";
//
// brushDeleteAnyRadio
//
this.brushDeleteAnyRadio.AutoSize = true;
this.brushDeleteAnyRadio.Location = new System.Drawing.Point(16, 109);
this.brushDeleteAnyRadio.Name = "brushDeleteAnyRadio";
this.brushDeleteAnyRadio.Size = new System.Drawing.Size(122, 17);
this.brushDeleteAnyRadio.TabIndex = 4;
this.brushDeleteAnyRadio.Text = "Delete In A&ny YMAP";
this.brushDeleteAnyRadio.UseVisualStyleBackColor = true;
//
// brushDeleteYmapRadio
//
this.brushDeleteYmapRadio.AutoSize = true;
this.brushDeleteYmapRadio.Location = new System.Drawing.Point(16, 65);
this.brushDeleteYmapRadio.Name = "brushDeleteYmapRadio";
this.brushDeleteYmapRadio.Size = new System.Drawing.Size(124, 17);
this.brushDeleteYmapRadio.TabIndex = 3;
this.brushDeleteYmapRadio.Text = "Delete In This &YMAP";
this.brushDeleteYmapRadio.UseVisualStyleBackColor = true;
//
// brushDisabledRadio
//
this.brushDisabledRadio.AutoSize = true;
this.brushDisabledRadio.Checked = true;
this.brushDisabledRadio.Location = new System.Drawing.Point(16, 21);
this.brushDisabledRadio.Name = "brushDisabledRadio";
this.brushDisabledRadio.Size = new System.Drawing.Size(66, 17);
this.brushDisabledRadio.TabIndex = 0;
this.brushDisabledRadio.TabStop = true;
this.brushDisabledRadio.Text = "&Disabled";
this.brushDisabledRadio.UseVisualStyleBackColor = true;
//
// brushSettingsGroupBox
//
this.brushSettingsGroupBox.Controls.Add(this.RadiusNumericUpDown);
this.brushSettingsGroupBox.Controls.Add(this.radiusLabel);
this.brushSettingsGroupBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.brushSettingsGroupBox.Location = new System.Drawing.Point(221, 13);
this.brushSettingsGroupBox.Name = "brushSettingsGroupBox";
this.brushSettingsGroupBox.Size = new System.Drawing.Size(140, 59);
this.brushSettingsGroupBox.TabIndex = 71;
this.brushSettingsGroupBox.TabStop = false;
this.brushSettingsGroupBox.Text = "Delete Brush Settings";
//
// RadiusNumericUpDown
//
this.RadiusNumericUpDown.DecimalPlaces = 1;
this.RadiusNumericUpDown.Increment = new decimal(new int[] {
5,
0,
0,
65536});
this.RadiusNumericUpDown.Location = new System.Drawing.Point(52, 28);
this.RadiusNumericUpDown.Name = "RadiusNumericUpDown";
this.RadiusNumericUpDown.Size = new System.Drawing.Size(65, 20);
this.RadiusNumericUpDown.TabIndex = 11;
this.RadiusNumericUpDown.Value = new decimal(new int[] {
5,
0,
0,
0});
//
// radiusLabel
//
this.radiusLabel.AutoSize = true;
this.radiusLabel.Location = new System.Drawing.Point(6, 30);
this.radiusLabel.Name = "radiusLabel";
this.radiusLabel.Size = new System.Drawing.Size(40, 13);
this.radiusLabel.TabIndex = 10;
this.radiusLabel.Text = "Radius";
//
// label1
//
this.label1.Location = new System.Drawing.Point(12, 163);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(397, 48);
this.label1.TabIndex = 72;
this.label1.Text = "Hold CTRL to use delete brush. In \"Any YMAP\" mode new YMAPs will be automatically" +
" added to the project.";
//
// brushDeleteBatchRadio
//
this.brushDeleteBatchRadio.AutoSize = true;
this.brushDeleteBatchRadio.Location = new System.Drawing.Point(16, 43);
this.brushDeleteBatchRadio.Name = "brushDeleteBatchRadio";
this.brushDeleteBatchRadio.Size = new System.Drawing.Size(122, 17);
this.brushDeleteBatchRadio.TabIndex = 5;
this.brushDeleteBatchRadio.Text = "Delete In This &Batch";
this.brushDeleteBatchRadio.UseVisualStyleBackColor = true;
//
// currentYmapTextBox
//
this.currentYmapTextBox.Enabled = false;
this.currentYmapTextBox.Location = new System.Drawing.Point(221, 118);
this.currentYmapTextBox.Name = "currentYmapTextBox";
this.currentYmapTextBox.ReadOnly = true;
this.currentYmapTextBox.Size = new System.Drawing.Size(188, 20);
this.currentYmapTextBox.TabIndex = 73;
this.currentYmapTextBox.Visible = false;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(218, 102);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(74, 13);
this.label2.TabIndex = 74;
this.label2.Text = "Current YMAP";
this.label2.Visible = false;
//
// brushDeleteProjectRadio
//
this.brushDeleteProjectRadio.AutoSize = true;
this.brushDeleteProjectRadio.Location = new System.Drawing.Point(16, 87);
this.brushDeleteProjectRadio.Name = "brushDeleteProjectRadio";
this.brushDeleteProjectRadio.Size = new System.Drawing.Size(158, 17);
this.brushDeleteProjectRadio.TabIndex = 6;
this.brushDeleteProjectRadio.Text = "Delete In Any &Project YMAP";
this.brushDeleteProjectRadio.UseVisualStyleBackColor = true;
//
// DeleteGrassPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(430, 228);
this.Controls.Add(this.label2);
this.Controls.Add(this.currentYmapTextBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.brushSettingsGroupBox);
this.Controls.Add(this.brushModeGroupBox);
this.Name = "DeleteGrassPanel";
this.Text = "Delete Grass Instances";
this.brushModeGroupBox.ResumeLayout(false);
this.brushModeGroupBox.PerformLayout();
this.brushSettingsGroupBox.ResumeLayout(false);
this.brushSettingsGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.RadiusNumericUpDown)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox brushModeGroupBox;
private System.Windows.Forms.RadioButton brushDeleteAnyRadio;
private System.Windows.Forms.RadioButton brushDeleteYmapRadio;
private System.Windows.Forms.RadioButton brushDisabledRadio;
private System.Windows.Forms.GroupBox brushSettingsGroupBox;
private System.Windows.Forms.NumericUpDown RadiusNumericUpDown;
private System.Windows.Forms.Label radiusLabel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.RadioButton brushDeleteBatchRadio;
private System.Windows.Forms.TextBox currentYmapTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.RadioButton brushDeleteProjectRadio;
}
}

View File

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
namespace CodeWalker.Project.Panels
{
public partial class DeleteGrassPanel : ProjectPanel
{
internal enum DeleteGrassMode
{
None,
Batch,
Ymap,
Project,
Any
}
public ProjectForm ProjectForm { get; set; }
public ProjectFile CurrentProjectFile { get; set; }
public DeleteGrassPanel(ProjectForm projectForm)
{
ProjectForm = projectForm;
InitializeComponent();
if (ProjectForm?.WorldForm == null)
{
//could happen in some other startup mode - world form is required for this..
brushModeGroupBox.Enabled = false;
}
this.DockStateChanged += onDockStateChanged;
// currentYmapTextBox.DataBindings.Add("Text", ProjectForm, "CurrentYmapName", false, DataSourceUpdateMode.OnPropertyChanged);
}
private void onDockStateChanged(object sender, EventArgs e)
{
if(DockState == DockState.Hidden)
{
brushDisabledRadio.Checked = true;
brushDisabledRadio.Focus();
}
}
public void SetProject(ProjectFile project)
{
CurrentProjectFile = project;
}
internal DeleteGrassMode Mode
{
get
{
if (brushDeleteBatchRadio.Checked) return DeleteGrassMode.Batch;
else if (brushDeleteYmapRadio.Checked) return DeleteGrassMode.Ymap;
else if (brushDeleteProjectRadio.Checked) return DeleteGrassMode.Project;
else if (brushDeleteAnyRadio.Checked) return DeleteGrassMode.Any;
else return DeleteGrassMode.None;
}
}
internal float BrushRadius => (float)RadiusNumericUpDown.Value;
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -77,6 +77,8 @@
this.OptmizationThresholdNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.BrushModeCheckBox = new System.Windows.Forms.CheckBox();
this.label8 = new System.Windows.Forms.Label();
this.brushModeGroupBox = new System.Windows.Forms.GroupBox();
this.label16 = new System.Windows.Forms.Label();
this.tabControl1.SuspendLayout();
this.GrassBatchTab.SuspendLayout();
this.groupBox1.SuspendLayout();
@ -92,6 +94,7 @@
((System.ComponentModel.ISupportInitialize)(this.DensityNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadiusNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.OptmizationThresholdNumericUpDown)).BeginInit();
this.brushModeGroupBox.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
@ -101,7 +104,7 @@
this.tabControl1.Location = new System.Drawing.Point(12, 65);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(486, 181);
this.tabControl1.Size = new System.Drawing.Size(525, 214);
this.tabControl1.TabIndex = 37;
//
// GrassBatchTab
@ -110,7 +113,7 @@
this.GrassBatchTab.Location = new System.Drawing.Point(4, 22);
this.GrassBatchTab.Name = "GrassBatchTab";
this.GrassBatchTab.Padding = new System.Windows.Forms.Padding(3);
this.GrassBatchTab.Size = new System.Drawing.Size(478, 155);
this.GrassBatchTab.Size = new System.Drawing.Size(517, 183);
this.GrassBatchTab.TabIndex = 0;
this.GrassBatchTab.Text = "Grass Batch";
this.GrassBatchTab.UseVisualStyleBackColor = true;
@ -130,7 +133,7 @@
this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox1.Location = new System.Drawing.Point(12, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(460, 143);
this.groupBox1.Size = new System.Drawing.Size(460, 135);
this.groupBox1.TabIndex = 42;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Batch";
@ -250,12 +253,13 @@
//
// BrushTab
//
this.BrushTab.Controls.Add(this.brushModeGroupBox);
this.BrushTab.Controls.Add(this.groupBox2);
this.BrushTab.Controls.Add(this.brushSettingsGroupBox);
this.BrushTab.Location = new System.Drawing.Point(4, 22);
this.BrushTab.Name = "BrushTab";
this.BrushTab.Padding = new System.Windows.Forms.Padding(3);
this.BrushTab.Size = new System.Drawing.Size(478, 155);
this.BrushTab.Size = new System.Drawing.Size(517, 188);
this.BrushTab.TabIndex = 1;
this.BrushTab.Text = " Brush";
this.BrushTab.UseVisualStyleBackColor = true;
@ -272,9 +276,9 @@
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.RandomizeScaleCheckBox);
this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox2.Location = new System.Drawing.Point(191, 3);
this.groupBox2.Location = new System.Drawing.Point(265, 6);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(281, 146);
this.groupBox2.Size = new System.Drawing.Size(246, 176);
this.groupBox2.TabIndex = 39;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Instance Settings";
@ -384,23 +388,23 @@
this.brushSettingsGroupBox.Controls.Add(this.label5);
this.brushSettingsGroupBox.Controls.Add(this.radiusLabel);
this.brushSettingsGroupBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.brushSettingsGroupBox.Location = new System.Drawing.Point(8, 3);
this.brushSettingsGroupBox.Location = new System.Drawing.Point(11, 6);
this.brushSettingsGroupBox.Name = "brushSettingsGroupBox";
this.brushSettingsGroupBox.Size = new System.Drawing.Size(177, 146);
this.brushSettingsGroupBox.Size = new System.Drawing.Size(246, 71);
this.brushSettingsGroupBox.TabIndex = 38;
this.brushSettingsGroupBox.TabStop = false;
this.brushSettingsGroupBox.Text = "Brush Settings";
//
// DensityNumericUpDown
//
this.DensityNumericUpDown.Location = new System.Drawing.Point(76, 57);
this.DensityNumericUpDown.Location = new System.Drawing.Point(187, 28);
this.DensityNumericUpDown.Maximum = new decimal(new int[] {
128,
0,
0,
0});
this.DensityNumericUpDown.Name = "DensityNumericUpDown";
this.DensityNumericUpDown.Size = new System.Drawing.Size(84, 20);
this.DensityNumericUpDown.Size = new System.Drawing.Size(53, 20);
this.DensityNumericUpDown.TabIndex = 20;
this.DensityNumericUpDown.Value = new decimal(new int[] {
28,
@ -410,15 +414,15 @@
//
// RadiusNumericUpDown
//
this.RadiusNumericUpDown.DecimalPlaces = 2;
this.RadiusNumericUpDown.DecimalPlaces = 1;
this.RadiusNumericUpDown.Increment = new decimal(new int[] {
1,
0,
0,
131072});
this.RadiusNumericUpDown.Location = new System.Drawing.Point(76, 31);
65536});
this.RadiusNumericUpDown.Location = new System.Drawing.Point(52, 28);
this.RadiusNumericUpDown.Name = "RadiusNumericUpDown";
this.RadiusNumericUpDown.Size = new System.Drawing.Size(84, 20);
this.RadiusNumericUpDown.Size = new System.Drawing.Size(65, 20);
this.RadiusNumericUpDown.TabIndex = 11;
this.RadiusNumericUpDown.Value = new decimal(new int[] {
5,
@ -430,7 +434,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(21, 59);
this.label5.Location = new System.Drawing.Point(141, 30);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(42, 13);
this.label5.TabIndex = 19;
@ -439,7 +443,7 @@
// radiusLabel
//
this.radiusLabel.AutoSize = true;
this.radiusLabel.Location = new System.Drawing.Point(21, 33);
this.radiusLabel.Location = new System.Drawing.Point(6, 30);
this.radiusLabel.Name = "radiusLabel";
this.radiusLabel.Size = new System.Drawing.Size(40, 13);
this.radiusLabel.TabIndex = 10;
@ -447,7 +451,7 @@
//
// OptimizeBatchButton
//
this.OptimizeBatchButton.Location = new System.Drawing.Point(16, 280);
this.OptimizeBatchButton.Location = new System.Drawing.Point(16, 296);
this.OptimizeBatchButton.Name = "OptimizeBatchButton";
this.OptimizeBatchButton.Size = new System.Drawing.Size(108, 24);
this.OptimizeBatchButton.TabIndex = 70;
@ -461,16 +465,16 @@
//
this.ExtentsMinTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ExtentsMinTextBox.Location = new System.Drawing.Point(84, 319);
this.ExtentsMinTextBox.Location = new System.Drawing.Point(84, 335);
this.ExtentsMinTextBox.Name = "ExtentsMinTextBox";
this.ExtentsMinTextBox.ReadOnly = true;
this.ExtentsMinTextBox.Size = new System.Drawing.Size(380, 20);
this.ExtentsMinTextBox.Size = new System.Drawing.Size(449, 20);
this.ExtentsMinTextBox.TabIndex = 55;
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(13, 349);
this.label14.Location = new System.Drawing.Point(13, 365);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(68, 13);
this.label14.TabIndex = 54;
@ -480,16 +484,16 @@
//
this.ExtentsMaxTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ExtentsMaxTextBox.Location = new System.Drawing.Point(84, 345);
this.ExtentsMaxTextBox.Location = new System.Drawing.Point(84, 361);
this.ExtentsMaxTextBox.Name = "ExtentsMaxTextBox";
this.ExtentsMaxTextBox.ReadOnly = true;
this.ExtentsMaxTextBox.Size = new System.Drawing.Size(380, 20);
this.ExtentsMaxTextBox.Size = new System.Drawing.Size(449, 20);
this.ExtentsMaxTextBox.TabIndex = 53;
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(13, 322);
this.label13.Location = new System.Drawing.Point(13, 338);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(65, 13);
this.label13.TabIndex = 52;
@ -498,7 +502,7 @@
// GrassDeleteButton
//
this.GrassDeleteButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.GrassDeleteButton.Location = new System.Drawing.Point(257, 397);
this.GrassDeleteButton.Location = new System.Drawing.Point(276, 397);
this.GrassDeleteButton.Name = "GrassDeleteButton";
this.GrassDeleteButton.Size = new System.Drawing.Size(95, 23);
this.GrassDeleteButton.TabIndex = 51;
@ -509,7 +513,7 @@
// GrassAddToProjectButton
//
this.GrassAddToProjectButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.GrassAddToProjectButton.Location = new System.Drawing.Point(159, 397);
this.GrassAddToProjectButton.Location = new System.Drawing.Point(178, 397);
this.GrassAddToProjectButton.Name = "GrassAddToProjectButton";
this.GrassAddToProjectButton.Size = new System.Drawing.Size(95, 23);
this.GrassAddToProjectButton.TabIndex = 50;
@ -550,7 +554,7 @@
this.PositionTextBox.Location = new System.Drawing.Point(66, 39);
this.PositionTextBox.Name = "PositionTextBox";
this.PositionTextBox.ReadOnly = true;
this.PositionTextBox.Size = new System.Drawing.Size(275, 20);
this.PositionTextBox.Size = new System.Drawing.Size(314, 20);
this.PositionTextBox.TabIndex = 58;
//
// label1
@ -565,7 +569,7 @@
// GrassGoToButton
//
this.GrassGoToButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.GrassGoToButton.Location = new System.Drawing.Point(347, 36);
this.GrassGoToButton.Location = new System.Drawing.Point(386, 36);
this.GrassGoToButton.Name = "GrassGoToButton";
this.GrassGoToButton.Size = new System.Drawing.Size(56, 23);
this.GrassGoToButton.TabIndex = 56;
@ -576,7 +580,7 @@
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(130, 286);
this.label17.Location = new System.Drawing.Point(130, 302);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(54, 13);
this.label17.TabIndex = 71;
@ -584,7 +588,7 @@
//
// OptmizationThresholdNumericUpDown
//
this.OptmizationThresholdNumericUpDown.Location = new System.Drawing.Point(190, 284);
this.OptmizationThresholdNumericUpDown.Location = new System.Drawing.Point(190, 300);
this.OptmizationThresholdNumericUpDown.Maximum = new decimal(new int[] {
999999,
0,
@ -602,7 +606,7 @@
// BrushModeCheckBox
//
this.BrushModeCheckBox.AutoSize = true;
this.BrushModeCheckBox.Location = new System.Drawing.Point(16, 252);
this.BrushModeCheckBox.Location = new System.Drawing.Point(12, 25);
this.BrushModeCheckBox.Name = "BrushModeCheckBox";
this.BrushModeCheckBox.Size = new System.Drawing.Size(83, 17);
this.BrushModeCheckBox.TabIndex = 68;
@ -619,17 +623,36 @@
this.label8.TabIndex = 72;
this.label8.Text = ".ydr";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// brushModeGroupBox
//
this.brushModeGroupBox.Controls.Add(this.label16);
this.brushModeGroupBox.Controls.Add(this.BrushModeCheckBox);
this.brushModeGroupBox.Location = new System.Drawing.Point(8, 83);
this.brushModeGroupBox.Name = "brushModeGroupBox";
this.brushModeGroupBox.Size = new System.Drawing.Size(249, 99);
this.brushModeGroupBox.TabIndex = 69;
this.brushModeGroupBox.TabStop = false;
this.brushModeGroupBox.Text = "Brush Mode";
//
// label16
//
this.label16.Location = new System.Drawing.Point(9, 49);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(231, 40);
this.label16.TabIndex = 69;
this.label16.Text = "Hold CTRL to paint instances in this batch. Hold CTRL+SHIFT to delete in this bat" +
"ch. Open Tools menu for bulk delete option.";
//
// EditYmapGrassPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(510, 443);
this.ClientSize = new System.Drawing.Size(549, 443);
this.Controls.Add(this.label8);
this.Controls.Add(this.label17);
this.Controls.Add(this.OptmizationThresholdNumericUpDown);
this.Controls.Add(this.OptimizeBatchButton);
this.Controls.Add(this.BrushModeCheckBox);
this.Controls.Add(this.HashLabel);
this.Controls.Add(this.ExtentsMinTextBox);
this.Controls.Add(this.ArchetypeNameTextBox);
@ -664,6 +687,8 @@
((System.ComponentModel.ISupportInitialize)(this.DensityNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadiusNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.OptmizationThresholdNumericUpDown)).EndInit();
this.brushModeGroupBox.ResumeLayout(false);
this.brushModeGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -718,5 +743,7 @@
private System.Windows.Forms.Button OptimizeBatchButton;
private System.Windows.Forms.CheckBox BrushModeCheckBox;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.GroupBox brushModeGroupBox;
private System.Windows.Forms.Label label16;
}
}

View File

@ -9,10 +9,8 @@ using SharpDX;
// - COMPLETED -- Optimization feature.
// - COMPLETED -- Remove grass instances using CTRL + SHIFT + LMB
// - Better gizmo for grass brush (like a circle with a little line in the middle sticking upwards)
// - Maybe some kind of auto coloring system? I've noticed that mostly all grass in GTA inherits it's color from the surface it's on.
// - Grass area fill (generate grass on ydr based on colision materials?)
// - Need to have a way to erase instances from other batches in the current batches ymap.
// if we optimize our instances, we'd have to go through each batch to erase, this is very monotonous.
// BUG
@ -265,27 +263,6 @@ namespace CodeWalker.Project.Panels
BatchChanged();
}
public void EraseInstancesAtMouse(SpaceRayIntersectResult mouseRay)
{
var wf = ProjectForm.WorldForm;
if (wf == null) return;
var changed = false;
lock (wf.RenderSyncRoot)
{
if (CurrentBatch.EraseInstancesAtMouse(
CurrentBatch,
mouseRay,
(float) RadiusNumericUpDown.Value
))
{
wf.UpdateGrassBatchGraphics(CurrentBatch);
changed = true;
}
}
if (changed) BatchChanged();
}
#endregion
#region Privates
@ -296,7 +273,7 @@ namespace CodeWalker.Project.Panels
return res;
}
private void BatchChanged()
internal void BatchChanged()
{
UpdateControls();
CurrentBatch.UpdateInstanceCount();

View File

@ -69,6 +69,14 @@
this.ViewThemeBlueMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ViewThemeLightMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ViewThemeDarkMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsManifestGeneratorMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsLODLightsGeneratorMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsNavMeshGeneratorMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.ToolsImportMenyooXmlMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator31 = new System.Windows.Forms.ToolStripSeparator();
this.deleteGrassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.YmapMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YmapNameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
@ -113,6 +121,22 @@
this.toolStripSeparator26 = new System.Windows.Forms.ToolStripSeparator();
this.YbnAddToProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YbnRemoveFromProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YdrMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YdrNameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.YdrRemoveFromProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YddMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YddNameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.YddRemoveFromProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YftMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YftNameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator30 = new System.Windows.Forms.ToolStripSeparator();
this.YftRemoveFromProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YtdMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YtdNameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator29 = new System.Windows.Forms.ToolStripSeparator();
this.YtdRemoveFromProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YndMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YndNameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator();
@ -158,12 +182,6 @@
this.toolStripSeparator24 = new System.Windows.Forms.ToolStripSeparator();
this.AudioAddToProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.AudioRemoveFromProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsManifestGeneratorMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsLODLightsGeneratorMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsNavMeshGeneratorMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.ToolsImportMenyooXmlMenu = new System.Windows.Forms.ToolStripMenuItem();
this.OptionsMenu = new System.Windows.Forms.ToolStripMenuItem();
this.OptionsRenderGtavMapMenu = new System.Windows.Forms.ToolStripMenuItem();
this.OptionsRenderProjectItemsMenu = new System.Windows.Forms.ToolStripMenuItem();
@ -195,22 +213,6 @@
this.ToolbarSaveAllButton = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
this.YdrMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YddMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YftMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YtdMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YdrNameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.YddNameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.YftNameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YtdNameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator29 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator30 = new System.Windows.Forms.ToolStripSeparator();
this.YdrRemoveFromProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YddRemoveFromProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YftRemoveFromProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.YtdRemoveFromProjectMenu = new System.Windows.Forms.ToolStripMenuItem();
this.MainMenu.SuspendLayout();
this.MainToolbar.SuspendLayout();
this.SuspendLayout();
@ -221,6 +223,7 @@
this.FileMenu,
this.EditMenu,
this.ViewMenu,
this.ToolsMenu,
this.YmapMenu,
this.YtypMenu,
this.YbnMenu,
@ -233,7 +236,6 @@
this.TrainsMenu,
this.ScenarioMenu,
this.AudioMenu,
this.ToolsMenu,
this.OptionsMenu});
this.MainMenu.Location = new System.Drawing.Point(0, 0);
this.MainMenu.Name = "MainMenu";
@ -547,6 +549,65 @@
this.ViewThemeDarkMenu.Text = "Dark";
this.ViewThemeDarkMenu.Click += new System.EventHandler(this.ViewThemeDarkMenu_Click);
//
// ToolsMenu
//
this.ToolsMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolsManifestGeneratorMenu,
this.ToolsLODLightsGeneratorMenu,
this.ToolsNavMeshGeneratorMenu,
this.toolStripSeparator2,
this.ToolsImportMenyooXmlMenu,
this.toolStripSeparator31,
this.deleteGrassToolStripMenuItem});
this.ToolsMenu.Name = "ToolsMenu";
this.ToolsMenu.Size = new System.Drawing.Size(46, 20);
this.ToolsMenu.Text = "Tools";
//
// ToolsManifestGeneratorMenu
//
this.ToolsManifestGeneratorMenu.Name = "ToolsManifestGeneratorMenu";
this.ToolsManifestGeneratorMenu.Size = new System.Drawing.Size(196, 22);
this.ToolsManifestGeneratorMenu.Text = "Manifest Generator...";
this.ToolsManifestGeneratorMenu.Click += new System.EventHandler(this.ToolsManifestGeneratorMenu_Click);
//
// ToolsLODLightsGeneratorMenu
//
this.ToolsLODLightsGeneratorMenu.Name = "ToolsLODLightsGeneratorMenu";
this.ToolsLODLightsGeneratorMenu.Size = new System.Drawing.Size(196, 22);
this.ToolsLODLightsGeneratorMenu.Text = "LOD Lights Generator...";
this.ToolsLODLightsGeneratorMenu.Click += new System.EventHandler(this.ToolsLODLightsGeneratorMenu_Click);
//
// ToolsNavMeshGeneratorMenu
//
this.ToolsNavMeshGeneratorMenu.Name = "ToolsNavMeshGeneratorMenu";
this.ToolsNavMeshGeneratorMenu.Size = new System.Drawing.Size(196, 22);
this.ToolsNavMeshGeneratorMenu.Text = "Nav Mesh Generator...";
this.ToolsNavMeshGeneratorMenu.Click += new System.EventHandler(this.ToolsNavMeshGeneratorMenu_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(193, 6);
//
// ToolsImportMenyooXmlMenu
//
this.ToolsImportMenyooXmlMenu.Name = "ToolsImportMenyooXmlMenu";
this.ToolsImportMenyooXmlMenu.Size = new System.Drawing.Size(196, 22);
this.ToolsImportMenyooXmlMenu.Text = "Import Menyoo XML...";
this.ToolsImportMenyooXmlMenu.Click += new System.EventHandler(this.ToolsImportMenyooXmlMenu_Click);
//
// toolStripSeparator31
//
this.toolStripSeparator31.Name = "toolStripSeparator31";
this.toolStripSeparator31.Size = new System.Drawing.Size(193, 6);
//
// deleteGrassToolStripMenuItem
//
this.deleteGrassToolStripMenuItem.Name = "deleteGrassToolStripMenuItem";
this.deleteGrassToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.deleteGrassToolStripMenuItem.Text = "Delete Grass...";
this.deleteGrassToolStripMenuItem.Click += new System.EventHandler(this.ToolsDeleteGrassMenu_Click);
//
// YmapMenu
//
this.YmapMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -901,6 +962,130 @@
this.YbnRemoveFromProjectMenu.Text = "Remove from Project";
this.YbnRemoveFromProjectMenu.Click += new System.EventHandler(this.YbnRemoveFromProjectMenu_Click);
//
// YdrMenu
//
this.YdrMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.YdrNameMenu,
this.toolStripSeparator6,
this.YdrRemoveFromProjectMenu});
this.YdrMenu.Name = "YdrMenu";
this.YdrMenu.Size = new System.Drawing.Size(36, 20);
this.YdrMenu.Text = "Ydr";
this.YdrMenu.Visible = false;
//
// YdrNameMenu
//
this.YdrNameMenu.Enabled = false;
this.YdrNameMenu.Name = "YdrNameMenu";
this.YdrNameMenu.Size = new System.Drawing.Size(186, 22);
this.YdrNameMenu.Text = "(No .ydr file selected)";
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(183, 6);
//
// YdrRemoveFromProjectMenu
//
this.YdrRemoveFromProjectMenu.Enabled = false;
this.YdrRemoveFromProjectMenu.Name = "YdrRemoveFromProjectMenu";
this.YdrRemoveFromProjectMenu.Size = new System.Drawing.Size(186, 22);
this.YdrRemoveFromProjectMenu.Text = "Remove from Project";
this.YdrRemoveFromProjectMenu.Click += new System.EventHandler(this.YdrRemoveFromProjectMenu_Click);
//
// YddMenu
//
this.YddMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.YddNameMenu,
this.toolStripSeparator9,
this.YddRemoveFromProjectMenu});
this.YddMenu.Name = "YddMenu";
this.YddMenu.Size = new System.Drawing.Size(39, 20);
this.YddMenu.Text = "Ydd";
this.YddMenu.Visible = false;
//
// YddNameMenu
//
this.YddNameMenu.Enabled = false;
this.YddNameMenu.Name = "YddNameMenu";
this.YddNameMenu.Size = new System.Drawing.Size(189, 22);
this.YddNameMenu.Text = "(No .ydd file selected)";
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(186, 6);
//
// YddRemoveFromProjectMenu
//
this.YddRemoveFromProjectMenu.Enabled = false;
this.YddRemoveFromProjectMenu.Name = "YddRemoveFromProjectMenu";
this.YddRemoveFromProjectMenu.Size = new System.Drawing.Size(189, 22);
this.YddRemoveFromProjectMenu.Text = "Remove from Project";
this.YddRemoveFromProjectMenu.Click += new System.EventHandler(this.YddRemoveFromProjectMenu_Click);
//
// YftMenu
//
this.YftMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.YftNameMenu,
this.toolStripSeparator30,
this.YftRemoveFromProjectMenu});
this.YftMenu.Name = "YftMenu";
this.YftMenu.Size = new System.Drawing.Size(34, 20);
this.YftMenu.Text = "Yft";
this.YftMenu.Visible = false;
//
// YftNameMenu
//
this.YftNameMenu.Enabled = false;
this.YftNameMenu.Name = "YftNameMenu";
this.YftNameMenu.Size = new System.Drawing.Size(186, 22);
this.YftNameMenu.Text = "(No .yft file selected)";
//
// toolStripSeparator30
//
this.toolStripSeparator30.Name = "toolStripSeparator30";
this.toolStripSeparator30.Size = new System.Drawing.Size(183, 6);
//
// YftRemoveFromProjectMenu
//
this.YftRemoveFromProjectMenu.Enabled = false;
this.YftRemoveFromProjectMenu.Name = "YftRemoveFromProjectMenu";
this.YftRemoveFromProjectMenu.Size = new System.Drawing.Size(186, 22);
this.YftRemoveFromProjectMenu.Text = "Remove from Project";
this.YftRemoveFromProjectMenu.Click += new System.EventHandler(this.YftRemoveFromProjectMenu_Click);
//
// YtdMenu
//
this.YtdMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.YtdNameMenu,
this.toolStripSeparator29,
this.YtdRemoveFromProjectMenu});
this.YtdMenu.Name = "YtdMenu";
this.YtdMenu.Size = new System.Drawing.Size(37, 20);
this.YtdMenu.Text = "Ytd";
this.YtdMenu.Visible = false;
//
// YtdNameMenu
//
this.YtdNameMenu.Enabled = false;
this.YtdNameMenu.Name = "YtdNameMenu";
this.YtdNameMenu.Size = new System.Drawing.Size(186, 22);
this.YtdNameMenu.Text = "(No .ytd file selected)";
//
// toolStripSeparator29
//
this.toolStripSeparator29.Name = "toolStripSeparator29";
this.toolStripSeparator29.Size = new System.Drawing.Size(183, 6);
//
// YtdRemoveFromProjectMenu
//
this.YtdRemoveFromProjectMenu.Enabled = false;
this.YtdRemoveFromProjectMenu.Name = "YtdRemoveFromProjectMenu";
this.YtdRemoveFromProjectMenu.Size = new System.Drawing.Size(186, 22);
this.YtdRemoveFromProjectMenu.Text = "Remove from Project";
this.YtdRemoveFromProjectMenu.Click += new System.EventHandler(this.YtdRemoveFromProjectMenu_Click);
//
// YndMenu
//
this.YndMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -1266,51 +1451,6 @@
this.AudioRemoveFromProjectMenu.Text = "Remove from Project";
this.AudioRemoveFromProjectMenu.Click += new System.EventHandler(this.AudioRemoveFromProjectMenu_Click);
//
// ToolsMenu
//
this.ToolsMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolsManifestGeneratorMenu,
this.ToolsLODLightsGeneratorMenu,
this.ToolsNavMeshGeneratorMenu,
this.toolStripSeparator2,
this.ToolsImportMenyooXmlMenu});
this.ToolsMenu.Name = "ToolsMenu";
this.ToolsMenu.Size = new System.Drawing.Size(46, 20);
this.ToolsMenu.Text = "Tools";
//
// ToolsManifestGeneratorMenu
//
this.ToolsManifestGeneratorMenu.Name = "ToolsManifestGeneratorMenu";
this.ToolsManifestGeneratorMenu.Size = new System.Drawing.Size(196, 22);
this.ToolsManifestGeneratorMenu.Text = "Manifest Generator...";
this.ToolsManifestGeneratorMenu.Click += new System.EventHandler(this.ToolsManifestGeneratorMenu_Click);
//
// ToolsLODLightsGeneratorMenu
//
this.ToolsLODLightsGeneratorMenu.Name = "ToolsLODLightsGeneratorMenu";
this.ToolsLODLightsGeneratorMenu.Size = new System.Drawing.Size(196, 22);
this.ToolsLODLightsGeneratorMenu.Text = "LOD Lights Generator...";
this.ToolsLODLightsGeneratorMenu.Click += new System.EventHandler(this.ToolsLODLightsGeneratorMenu_Click);
//
// ToolsNavMeshGeneratorMenu
//
this.ToolsNavMeshGeneratorMenu.Name = "ToolsNavMeshGeneratorMenu";
this.ToolsNavMeshGeneratorMenu.Size = new System.Drawing.Size(196, 22);
this.ToolsNavMeshGeneratorMenu.Text = "Nav Mesh Generator...";
this.ToolsNavMeshGeneratorMenu.Click += new System.EventHandler(this.ToolsNavMeshGeneratorMenu_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(193, 6);
//
// ToolsImportMenyooXmlMenu
//
this.ToolsImportMenyooXmlMenu.Name = "ToolsImportMenyooXmlMenu";
this.ToolsImportMenyooXmlMenu.Size = new System.Drawing.Size(196, 22);
this.ToolsImportMenyooXmlMenu.Text = "Import Menyoo XML...";
this.ToolsImportMenyooXmlMenu.Click += new System.EventHandler(this.ToolsImportMenyooXmlMenu_Click);
//
// OptionsMenu
//
this.OptionsMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -1558,130 +1698,6 @@
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(6, 25);
//
// YdrMenu
//
this.YdrMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.YdrNameMenu,
this.toolStripSeparator6,
this.YdrRemoveFromProjectMenu});
this.YdrMenu.Name = "YdrMenu";
this.YdrMenu.Size = new System.Drawing.Size(36, 20);
this.YdrMenu.Text = "Ydr";
this.YdrMenu.Visible = false;
//
// YddMenu
//
this.YddMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.YddNameMenu,
this.toolStripSeparator9,
this.YddRemoveFromProjectMenu});
this.YddMenu.Name = "YddMenu";
this.YddMenu.Size = new System.Drawing.Size(39, 20);
this.YddMenu.Text = "Ydd";
this.YddMenu.Visible = false;
//
// YftMenu
//
this.YftMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.YftNameMenu,
this.toolStripSeparator30,
this.YftRemoveFromProjectMenu});
this.YftMenu.Name = "YftMenu";
this.YftMenu.Size = new System.Drawing.Size(34, 20);
this.YftMenu.Text = "Yft";
this.YftMenu.Visible = false;
//
// YtdMenu
//
this.YtdMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.YtdNameMenu,
this.toolStripSeparator29,
this.YtdRemoveFromProjectMenu});
this.YtdMenu.Name = "YtdMenu";
this.YtdMenu.Size = new System.Drawing.Size(37, 20);
this.YtdMenu.Text = "Ytd";
this.YtdMenu.Visible = false;
//
// YdrNameMenu
//
this.YdrNameMenu.Enabled = false;
this.YdrNameMenu.Name = "YdrNameMenu";
this.YdrNameMenu.Size = new System.Drawing.Size(186, 22);
this.YdrNameMenu.Text = "(No .ydr file selected)";
//
// toolStripSeparator6
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(183, 6);
//
// YddNameMenu
//
this.YddNameMenu.Enabled = false;
this.YddNameMenu.Name = "YddNameMenu";
this.YddNameMenu.Size = new System.Drawing.Size(189, 22);
this.YddNameMenu.Text = "(No .ydd file selected)";
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(186, 6);
//
// YftNameMenu
//
this.YftNameMenu.Enabled = false;
this.YftNameMenu.Name = "YftNameMenu";
this.YftNameMenu.Size = new System.Drawing.Size(186, 22);
this.YftNameMenu.Text = "(No .yft file selected)";
//
// YtdNameMenu
//
this.YtdNameMenu.Enabled = false;
this.YtdNameMenu.Name = "YtdNameMenu";
this.YtdNameMenu.Size = new System.Drawing.Size(186, 22);
this.YtdNameMenu.Text = "(No .ytd file selected)";
//
// toolStripSeparator29
//
this.toolStripSeparator29.Name = "toolStripSeparator29";
this.toolStripSeparator29.Size = new System.Drawing.Size(183, 6);
//
// toolStripSeparator30
//
this.toolStripSeparator30.Name = "toolStripSeparator30";
this.toolStripSeparator30.Size = new System.Drawing.Size(183, 6);
//
// YdrRemoveFromProjectMenu
//
this.YdrRemoveFromProjectMenu.Enabled = false;
this.YdrRemoveFromProjectMenu.Name = "YdrRemoveFromProjectMenu";
this.YdrRemoveFromProjectMenu.Size = new System.Drawing.Size(186, 22);
this.YdrRemoveFromProjectMenu.Text = "Remove from Project";
this.YdrRemoveFromProjectMenu.Click += new System.EventHandler(this.YdrRemoveFromProjectMenu_Click);
//
// YddRemoveFromProjectMenu
//
this.YddRemoveFromProjectMenu.Enabled = false;
this.YddRemoveFromProjectMenu.Name = "YddRemoveFromProjectMenu";
this.YddRemoveFromProjectMenu.Size = new System.Drawing.Size(189, 22);
this.YddRemoveFromProjectMenu.Text = "Remove from Project";
this.YddRemoveFromProjectMenu.Click += new System.EventHandler(this.YddRemoveFromProjectMenu_Click);
//
// YftRemoveFromProjectMenu
//
this.YftRemoveFromProjectMenu.Enabled = false;
this.YftRemoveFromProjectMenu.Name = "YftRemoveFromProjectMenu";
this.YftRemoveFromProjectMenu.Size = new System.Drawing.Size(186, 22);
this.YftRemoveFromProjectMenu.Text = "Remove from Project";
this.YftRemoveFromProjectMenu.Click += new System.EventHandler(this.YftRemoveFromProjectMenu_Click);
//
// YtdRemoveFromProjectMenu
//
this.YtdRemoveFromProjectMenu.Enabled = false;
this.YtdRemoveFromProjectMenu.Name = "YtdRemoveFromProjectMenu";
this.YtdRemoveFromProjectMenu.Size = new System.Drawing.Size(186, 22);
this.YtdRemoveFromProjectMenu.Text = "Remove from Project";
this.YtdRemoveFromProjectMenu.Click += new System.EventHandler(this.YtdRemoveFromProjectMenu_Click);
//
// ProjectForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1889,5 +1905,7 @@
private System.Windows.Forms.ToolStripMenuItem YtdNameMenu;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator29;
private System.Windows.Forms.ToolStripMenuItem YtdRemoveFromProjectMenu;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator31;
private System.Windows.Forms.ToolStripMenuItem deleteGrassToolStripMenuItem;
}
}

View File

@ -25,7 +25,7 @@ namespace CodeWalker.Project
public ThemeBase Theme { get; private set; }
public ProjectExplorerPanel ProjectExplorer { get; set; }
public ProjectPanel PreviewPanel { get; set; }
public DeleteGrassPanel DeleteGrassPanel { get; set; }
public GameFileCache GameFileCache { get; private set; }
public RpfManager RpfMan { get; private set; }
@ -357,6 +357,13 @@ namespace CodeWalker.Project
(panel) => { panel.SetProject(CurrentProjectFile); }, //updateFunc
(panel) => { return true; }); //findFunc
}
public void ShowDeleteGrassPanel(bool promote)
{
ShowPanel(promote,
() => { DeleteGrassPanel = new DeleteGrassPanel(this); return DeleteGrassPanel; }, //createFunc
(panel) => { panel.SetProject(CurrentProjectFile); panel.IsFloat = true; }, //updateFunc
(panel) => { return true; }); //findFunc
}
public void ShowGenerateLODLightsPanel(bool promote)
{
ShowPanel(promote,
@ -1099,20 +1106,19 @@ namespace CodeWalker.Project
public bool CanPaintInstances()
{
// Possibly future proofing for procedural prop instances
if (CurrentGrassBatch != null)
if ((CurrentGrassBatch != null && CurrentGrassBatch.BrushEnabled) || (DeleteGrassPanel != null && DeleteGrassPanel.Mode != DeleteGrassPanel.DeleteGrassMode.None))
{
if (CurrentGrassBatch.BrushEnabled)
return true;
}
return false;
}
public float GetInstanceBrushRadius()
{
if (CurrentGrassBatch != null)
return CurrentGrassBatch.BrushRadius;
var mode = (DeleteGrassPanel?.Mode ?? DeleteGrassPanel.DeleteGrassMode.None);
if (mode == DeleteGrassPanel.DeleteGrassMode.None || mode == DeleteGrassPanel.DeleteGrassMode.Batch)
return CurrentGrassBatch?.BrushRadius ?? 0f;
else if (DeleteGrassPanel != null && mode != DeleteGrassPanel.DeleteGrassMode.None)
return DeleteGrassPanel.BrushRadius;
return 0f;
}
@ -2311,6 +2317,15 @@ namespace CodeWalker.Project
return batch;
}
public void AddGrassBatchToProject(YmapGrassInstanceBatch batch)
{
var ymap = batch.Ymap;
if (!YmapExistsInProject(ymap))
{
ymap.HasChanged = true;
AddYmapToProject(ymap);
}
}
public void AddGrassBatchToProject()
{
if (CurrentGrassBatch == null) return;
@ -2373,26 +2388,36 @@ namespace CodeWalker.Project
return true;
}
public void PaintGrass(SpaceRayIntersectResult mouseRay, bool erase)
public void PaintGrass(SpaceRayIntersectResult mouseRay, InputManager input)
{
try
{
if (InvokeRequired)
{
Invoke(new Action(() => { PaintGrass(mouseRay, erase); }));
Invoke(new Action(() => { PaintGrass(mouseRay, input); }));
return;
}
if (!mouseRay.Hit || !mouseRay.TestComplete) return;
if (CurrentGrassBatch == null || (!CurrentGrassBatch.BrushEnabled)) return; // brush isn't enabled right now
EditYmapGrassPanel panel = FindPanel<EditYmapGrassPanel>(x => x.CurrentBatch == CurrentGrassBatch);
if (panel == null) return; // no panels with this batch
EditYmapGrassPanel batchPanel = FindPanel<EditYmapGrassPanel>(x => x.CurrentBatch == CurrentGrassBatch);
if (batchPanel == null && DeleteGrassPanel == null) return; // no relevant panels
// TODO: Maybe move these functions into the batch instead of the grass panel?
// although, the panel does have the brush settings.
if (!erase)
panel.CreateInstancesAtMouse(mouseRay);
else panel.EraseInstancesAtMouse(mouseRay);
var mode = DeleteGrassPanel?.Mode;
if (CurrentGrassBatch != null && batchPanel != null && (mode == DeleteGrassPanel.DeleteGrassMode.Batch || (CurrentGrassBatch.BrushEnabled && input.ShiftPressed)))
BulkEraseGrassInstancesAtMouse(mouseRay, (y) => y == CurrentYmapFile, (b) => b == CurrentGrassBatch);
else if (CurrentYmapFile != null && mode == DeleteGrassPanel.DeleteGrassMode.Ymap)
BulkEraseGrassInstancesAtMouse(mouseRay, (y) => y == CurrentYmapFile);
else if (mode == DeleteGrassPanel.DeleteGrassMode.Project)
BulkEraseGrassInstancesAtMouse(mouseRay, YmapExistsInProject);
else if (mode == DeleteGrassPanel.DeleteGrassMode.Any)
BulkEraseGrassInstancesAtMouse(mouseRay);
else if (batchPanel != null && CurrentGrassBatch != null && CurrentGrassBatch.BrushEnabled)
batchPanel.CreateInstancesAtMouse(mouseRay);
}
catch { }
}
@ -2400,6 +2425,7 @@ namespace CodeWalker.Project
{
if (CurrentProjectFile?.YmapFiles == null) return false;
if (CurrentProjectFile.YmapFiles.Count <= 0) return false;
if (CurrentProjectFile.YmapFiles.Contains(batch.Ymap)) return true;
foreach (var ymapFile in CurrentProjectFile.YmapFiles)
{
if (ymapFile.GrassInstanceBatches == null) continue;
@ -2412,6 +2438,53 @@ namespace CodeWalker.Project
return false;
}
public void BulkEraseGrassInstancesAtMouse(SpaceRayIntersectResult mouseRay) => BulkEraseGrassInstancesAtMouse(mouseRay, (y) => true);
public void BulkEraseGrassInstancesAtMouse(SpaceRayIntersectResult mouseRay, Predicate<YmapFile> ymapFilter) => BulkEraseGrassInstancesAtMouse(mouseRay, ymapFilter, (b) => true);
public void BulkEraseGrassInstancesAtMouse(SpaceRayIntersectResult mouseRay, Predicate<YmapFile> ymapFilter, Predicate<YmapGrassInstanceBatch> batchFilter)
{
if (!mouseRay.Hit) return;
float radius = DeleteGrassPanel?.BrushRadius ?? 5f;
var mouseSphere = new BoundingSphere(mouseRay.Position, radius);
if (WorldForm == null) return;
lock (WorldForm.RenderSyncRoot)
{
foreach (var ymap in WorldForm.Renderer.VisibleYmaps)
{
if (ymap.GrassInstanceBatches == null) continue;
if (!ymapFilter(ymap)) continue;
for (int i = 0; i < ymap.GrassInstanceBatches.Length; i++)
{
var gb = ymap.GrassInstanceBatches[i];
if (!batchFilter(gb)) continue;
BoundingBox bbox = new BoundingBox();
MapBox mb = new MapBox();
mb.BBMin = gb.AABBMin;
mb.BBMax = gb.AABBMax;
mb.Orientation = Quaternion.Identity;
mb.Scale = Vector3.One;
bbox.Minimum = mb.BBMin;
bbox.Maximum = mb.BBMax;
// do not continue if mouse position + radius is not in this instance's bounding box
if (!bbox.Intersects(mouseSphere)) continue;
if (gb.EraseInstancesAtMouse(gb, mouseRay, radius))
{
WorldForm.UpdateGrassBatchGraphics(gb);
AddGrassBatchToProject(gb);
var gbp = FindPanel<EditYmapGrassPanel>(panel => panel.CurrentBatch == CurrentGrassBatch);
gbp?.BatchChanged();
}
}
}
}
}
public YmapCarGen NewCarGen(YmapCarGen copy = null, bool copyPosition = false, bool selectNew = true)
{
if (CurrentYmapFile == null) return null;
@ -9538,7 +9611,10 @@ namespace CodeWalker.Project
{
ImportMenyooXml();
}
private void ToolsDeleteGrassMenu_Click(object sender, EventArgs e)
{
ShowDeleteGrassPanel(true);
}
private void OptionsRenderGtavMapMenu_Click(object sender, EventArgs e)
{
OptionsRenderGtavMapMenu.Checked = !OptionsRenderGtavMapMenu.Checked;
@ -9656,6 +9732,5 @@ namespace CodeWalker.Project
{
SaveAll();
}
}
}

View File

@ -2701,7 +2701,7 @@ namespace CodeWalker
}
private void UpdateMouseHits(YmapFile ymap)
{
//find mouse hits for things like time cycle mods and car generators in ymaps.
//find mouse hits for things like MLOs, time cycle mods, grass batches, and car generators in ymaps.
BoundingBox bbox = new BoundingBox();
Ray mray = new Ray();
@ -6019,7 +6019,7 @@ namespace CodeWalker
{
if (ProjectForm != null && MouseLButtonDown)
{
ProjectForm.PaintGrass(MouseRayCollision, Input.ShiftPressed);
ProjectForm.PaintGrass(MouseRayCollision, Input);
}
ControlBrushTimer = 0;
}