@ Added Boris' Copy/Paste Sector Properties plugin to solution

@ Added new project for Mass Undo/Redo plugin
This commit is contained in:
codeimp 2009-07-12 21:37:33 +00:00
parent dbc89a36aa
commit 153ea1d767
11 changed files with 584 additions and 2 deletions

View file

@ -7,6 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderModes", "Source\Plug
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Statistics", "Source\Plugins\Statistics\Statistics.csproj", "{FBC0A503-9152-4BE2-9B5C-128FFD0B0D3F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CopyPasteSectorProperties", "Source\Plugins\CopyPasteSectorProps\CopyPasteSectorProperties.csproj", "{A5F93B70-18D9-4F3C-9B72-BC8B5B13998E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MassUndoRedo", "Source\Plugins\MassUndoRedo\MassUndoRedo.csproj", "{2D55F377-4582-4F86-B751-5E6876EB0003}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@ -22,9 +26,13 @@ Global
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x86.ActiveCfg = Release|x86
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|x86.Build.0 = Release|x86
{FBC0A503-9152-4BE2-9B5C-128FFD0B0D3F}.Debug|x86.ActiveCfg = Debug|x86
{FBC0A503-9152-4BE2-9B5C-128FFD0B0D3F}.Debug|x86.Build.0 = Debug|x86
{FBC0A503-9152-4BE2-9B5C-128FFD0B0D3F}.Release|x86.ActiveCfg = Release|x86
{FBC0A503-9152-4BE2-9B5C-128FFD0B0D3F}.Release|x86.Build.0 = Release|x86
{A5F93B70-18D9-4F3C-9B72-BC8B5B13998E}.Debug|x86.ActiveCfg = Debug|x86
{A5F93B70-18D9-4F3C-9B72-BC8B5B13998E}.Release|x86.ActiveCfg = Release|x86
{2D55F377-4582-4F86-B751-5E6876EB0003}.Debug|x86.ActiveCfg = Debug|x86
{2D55F377-4582-4F86-B751-5E6876EB0003}.Debug|x86.Build.0 = Debug|x86
{2D55F377-4582-4F86-B751-5E6876EB0003}.Release|x86.ActiveCfg = Release|x86
{2D55F377-4582-4F86-B751-5E6876EB0003}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -0,0 +1,42 @@

//
// This file defines which actions there are, what description they have and
// some behaviour options. The Doom Builder core will bind to these actions
// with delegates (function pointers) where you use the BeginAction and
// EndAction attributes. This file must be named Actions.cfg and must be
// included in the plugin project as "Embedded Resource".
//
//
// Options:
//
// allowkeys: Allows the user to bind standard keys to this action.
// allowmouse: Allows the user to bind mouse buttons to this action.
// allowscroll: Allows the user to bind the scrollwheel to this action.
// disregardshift: This action will trigger regardless if Shift or Control is used.
// repeat: BeginAction will be called for automatic key repetition.
// default: Default key is only used when the action is loaded for the first
// time and the default key is not used by any other action.
//
// allowkeys and allowmouse are true by default, the others are false by default.
//
copysectorprops
{
title = "Copy sector properties";
category = "sectors";
description = "Copies sector properties.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
}
pastesectorprops
{
title = "Paste sector properties";
category = "sectors";
description = "Pastes sector properties.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
}

View file

@ -0,0 +1,224 @@

#region ================== Copyright (c) 2009 Boris Iwanski
/*
* Copyright (c) 2009 Boris Iwanski
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Geometry;
using System.Drawing;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Plugins;
using CodeImp.DoomBuilder.Actions;
using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Data;
#endregion
namespace CodeImp.DoomBuilder.CopyPasteSectorProps
{
//
// MANDATORY: The plug!
// This is an important class to the Doom Builder core. Every plugin must
// have exactly 1 class that inherits from Plug. When the plugin is loaded,
// this class is instantiated and used to receive events from the core.
// Make sure the class is public, because only public classes can be seen
// by the core.
//
public class BuilderPlug : Plug
{
// Static instance. We can't use a real static class, because BuilderPlug must
// be instantiated by the core, so we keep a static reference. (this technique
// should be familiar to object-oriented programmers)
private static BuilderPlug me;
// Static property to access the BuilderPlug
public static BuilderPlug Me { get { return me; } }
// These variables will store the properties we want to copy
private int floorHeight;
private int ceilHeight;
private string floorTexture;
private string ceilTexture;
private int brightness;
private int effect;
private int tag;
private UniFields fields;
// This is set to true to know that we copied sector properties.
// If this is false, the variables above are uninitialized.
bool didCopyProps = false;
// This event is called when the plugin is initialized
public override void OnInitialize()
{
base.OnInitialize();
// This binds the methods in this class that have the BeginAction
// and EndAction attributes with their actions. Without this, the
// attributes are useless. Note that in classes derived from EditMode
// this is not needed, because they are bound automatically when the
// editing mode is engaged.
General.Actions.BindMethods(this);
// Keep a static reference
me = this;
}
// This is called when the plugin is terminated
public override void Dispose()
{
base.Dispose();
// This must be called to remove bound methods for actions.
General.Actions.UnbindMethods(this);
}
#region ================== Actions
// This is the method that will be called when the "copysectorprops" action is used by the user.
// The actions are defined in the Actions.cfg file (the name must be exactly that) and the
// BeginAction attribute indicates that this method must be called when the key for this
// action is pressed. You can use the EndAction attribute for methods that must be called when
// the key for an action is released. See above for the BindMethods method call which must be
// called in order for these methods to work.
[BeginAction("copysectorprops")]
public void CopySectorProps()
{
// Only make this action possible if a map is actually opened and the we are in sectors mode
if (General.Editing.Mode == null || General.Editing.Mode.Attributes.SwitchAction != "sectorsmode")
{
return;
}
// Make sure a sector is highlighted
if (!(General.Editing.Mode.HighlightedObject is Sector))
{
// Show a warning in the status bar
General.Interface.DisplayStatus(StatusType.Warning, "Please highlight a sector to copy the properties from");
return;
}
// Copy the properties from the sector
Sector s = (Sector)General.Editing.Mode.HighlightedObject;
floorHeight = s.FloorHeight;
ceilHeight = s.CeilHeight;
floorTexture = s.FloorTexture;
ceilTexture = s.CeilTexture;
brightness = s.Brightness;
effect = s.Effect;
tag = s.Tag;
// Remember that we copied the properties
didCopyProps = true;
// Let the user know that copying worked
General.Interface.DisplayStatus(StatusType.Action, "Copied sector properties.");
}
// This is the method that will be called when the "pastesectorprops" action is used by the user.
[BeginAction("pastesectorprops")]
public void PasteSectorProps()
{
// Collection used to store the sectors we want to paste to
List<Sector> sectors = new List<Sector>();
// Just for fun we want to let the user know to how many sectors he/she/it pasted
int pasteCount = 0;
// Only make this action possible if a map is actually opened and we are in sectors mode
if (General.Editing.Mode == null || General.Editing.Mode.Attributes.SwitchAction != "sectorsmode")
{
return;
}
// Make sure there's at least one selected or highlighted sector we can paste the properties to
if (General.Map.Map.GetSelectedSectors(true).Count == 0 && !(General.Editing.Mode.HighlightedObject is Sector))
{
// Show a warning in the status bar
General.Interface.DisplayStatus(StatusType.Warning, "Please select or highlight at least 1 sector to paste the properties to.");
return;
}
// Check if there's actually a copied sector to get the properties from
if (didCopyProps == false)
{
// Show a warning in the status bar
General.Interface.DisplayStatus(StatusType.Warning, "Can't paste properties. You need to copy the properties first.");
return;
}
// If there are selected sectors only paste to them
if (General.Map.Map.GetSelectedSectors(true).Count != 0)
{
ICollection<Sector> selectedsectors = General.Map.Map.GetSelectedSectors(true);
foreach (Sector s in selectedsectors)
{
sectors.Add(s);
pasteCount++;
}
}
// No selected sectors. paste to the highlighted one
else
{
sectors.Add((Sector)General.Editing.Mode.HighlightedObject);
pasteCount++;
}
// Make the action undo-able
General.Map.UndoRedo.CreateUndo("Paste sector properties");
// Set the properties of all selected sectors
foreach(Sector s in sectors)
{
// Heights
s.FloorHeight = floorHeight;
s.CeilHeight = ceilHeight;
// Textures
s.SetFloorTexture(floorTexture);
s.SetCeilTexture(ceilTexture);
// Other stuff
s.Brightness = brightness;
s.Effect = effect;
s.Tag = tag;
}
// Redraw to make the changes visible
General.Map.Map.Update();
General.Interface.RedrawDisplay();
// Let the user know to how many sectors the properties were copied
General.Interface.DisplayStatus(StatusType.Action, "Pasted sector properties to " + pasteCount.ToString() + " sector(s).");
}
#endregion
}
}

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A5F93B70-18D9-4F3C-9B72-BC8B5B13998E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodeImp.DoomBuilder.CopyPasteSectorProps</RootNamespace>
<AssemblyName>CopyPasteSectorProps</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Builder, Version=2.0.0.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Build\Builder.exe</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="BuilderPlug.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Actions.cfg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,30 @@
=== DOOM BUILDER 2 PLUGIN (CopyPasteSectorProps) ==============================
File: CopyPasteSectorProps.dll
Author: Boris Iwanski
Version: 1.0.0.0
Minimum DB2 Version: 2.0.1.1157
=== What does it do ===========================================================
This plugin copies the properties (floor/ceiling heights, floor/ceiling
textures, brightness, tag and special effect from a sector and pastes
them to one or more sectors. Unlike the join/merge sector function this
plugin does not change the sector references of the sidedefs.
=== Usage =====================================================================
Menu entry: no
Toolbar buttons: no
Hotkeys: yes. There are two new actions in the "Sectors" section of the
controls. They are called "Copy sector properties" and "Paste sector
properties".
IMPORTANT: you'll have to assign hotkeys to those actions to use the
functionality of this plugin!
To copy the properties of a sector just highlight the desired sector (hover the
mouse over it) and press the hotkey you assigned to "Copy sector properties".
Now you have two ways to paste those properties to other sectors. Either you
highlight a sector and press your "Paste sector properties" hotkey or select
(by clicking) multiple sectors and then press you "Paste sector properties"
hotkey to paste the properties to all of them.

View file

@ -0,0 +1,32 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CopyPasteSectorProperties Plugin")]
[assembly: AssemblyDescription("Doom Builder CopySectorProperties Plugin")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("boris")]
[assembly: AssemblyProduct("Doom Builder Plugin")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cb6d7713-9c4f-4777-92f3-36cb4c452ff6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]

View file

@ -0,0 +1,82 @@

#region ================== Copyright (c) 2009 Pascal vd Heiden
/*
* Copyright (c) 2009 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Plugins;
using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Data;
#endregion
namespace CodeImp.DoomBuilder.Statistics
{
public class BuilderPlug : Plug
{
#region ================== Variables
private static BuilderPlug me;
#endregion
#region ================== Properties
public static BuilderPlug Me { get { return me; } }
public override string Name { get { return "Mass Undo/Redo Plugin"; } }
#endregion
#region ================== Initialize / Dispose
// This event is called when the plugin is initialized
public override void OnInitialize()
{
base.OnInitialize();
// Keep a static reference
me = this;
}
// This is called when the plugin is terminated
public override void Dispose()
{
// Time to clean everything up
base.Dispose();
}
#endregion
#region ================== Events
#endregion
}
}

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{2D55F377-4582-4F86-B751-5E6876EB0003}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodeImp.DoomBuilder.MassUndoRedo</RootNamespace>
<AssemblyName>MassUndoRedo</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="BuilderPlug.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Builder.csproj">
<Project>{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}</Project>
<Name>Builder</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MassUndoRedo")]
[assembly: AssemblyDescription("Doom Builder Mass Undo/Redo")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CodeImp")]
[assembly: AssemblyProduct("Doom Builder 2")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f424d9b8-b289-4027-b694-df98abe6eb06")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -21,6 +21,7 @@
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\..\..\Build\Plugins\</OutputPath>
@ -29,6 +30,7 @@
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />