From 43d37633c860709336eee7765215754a3889a4fc Mon Sep 17 00:00:00 2001 From: wampa842 Date: Tue, 29 Oct 2019 16:24:21 +0100 Subject: [PATCH] added Selection Storage --- CHANGELOG.MD | 13 + README.MD | 17 +- WPlugins.Common/About.cs | 2 +- .../Properties/Resources.Designer.cs | 133 +++++++ .../Properties/Resources.resx | 142 +++++++ .../Resources/icon_clone.png | Bin 0 -> 1079 bytes .../Resources/icon_complement.png | Bin 0 -> 2570 bytes .../Resources/icon_delete.png | Bin 0 -> 836 bytes .../Resources/icon_difference.png | Bin 0 -> 2257 bytes .../Resources/icon_down.png | Bin 0 -> 490 bytes .../Resources/icon_intersect.png | Bin 0 -> 2088 bytes .../Resources/icon_set.svg | 280 +++++++++++++ .../Resources/icon_union.png | Bin 0 -> 2577 bytes .../Resources/icon_up.png | Bin 0 -> 475 bytes WPlugins.SelectionStorage/Selection.cs | 120 +++++- .../SelectionStorageForm.Designer.cs | 353 +++++++++++++++-- .../SelectionStorageForm.cs | 268 +++++++++++-- .../SelectionStorageForm.resx | 45 +++ .../TrimForm.Designer.cs | 368 ++++++++++++++++++ WPlugins.SelectionStorage/TrimForm.cs | 74 ++++ WPlugins.SelectionStorage/TrimForm.resx | 120 ++++++ .../WPlugins.SelectionStorage.csproj | 45 ++- 22 files changed, 1891 insertions(+), 89 deletions(-) create mode 100644 CHANGELOG.MD create mode 100644 WPlugins.SelectionStorage/Properties/Resources.Designer.cs create mode 100644 WPlugins.SelectionStorage/Properties/Resources.resx create mode 100644 WPlugins.SelectionStorage/Resources/icon_clone.png create mode 100644 WPlugins.SelectionStorage/Resources/icon_complement.png create mode 100644 WPlugins.SelectionStorage/Resources/icon_delete.png create mode 100644 WPlugins.SelectionStorage/Resources/icon_difference.png create mode 100644 WPlugins.SelectionStorage/Resources/icon_down.png create mode 100644 WPlugins.SelectionStorage/Resources/icon_intersect.png create mode 100644 WPlugins.SelectionStorage/Resources/icon_set.svg create mode 100644 WPlugins.SelectionStorage/Resources/icon_union.png create mode 100644 WPlugins.SelectionStorage/Resources/icon_up.png create mode 100644 WPlugins.SelectionStorage/TrimForm.Designer.cs create mode 100644 WPlugins.SelectionStorage/TrimForm.cs create mode 100644 WPlugins.SelectionStorage/TrimForm.resx diff --git a/CHANGELOG.MD b/CHANGELOG.MD new file mode 100644 index 0000000..065e463 --- /dev/null +++ b/CHANGELOG.MD @@ -0,0 +1,13 @@ +# 0.5.0 +- Added Selection Storage (WPlugins.SelectionStorage) +- Added automatic udpdate checking +- Completely reimplemented settings serialization (saving and loading files) +# 0.4.1 +- Fixed an issue where applying a morph would revert the model to the state it was when the plugin was launched. +# 0.4.0 +- Added Morph Scale (WPlugins.MorphScale) +# 0.3.0 +- Added OBJ Export (WPlugins.ObjExport) +# 0.2.0 +- First release +- Added OBJ Import (WPlugins.ObjImport) \ No newline at end of file diff --git a/README.MD b/README.MD index 6583f68..2823237 100644 --- a/README.MD +++ b/README.MD @@ -17,8 +17,7 @@ Developed by Wampa842 5. [Troubleshooting and compatibility](#troubleshooting-and-compatibility) 6. [Contribute](#contribute) 7. [License & Copying](#license-copying) -8. [Changelog](#changelog) -10. [Contact](#contact) +8. [Contact](#contact) ------ ## Features @@ -45,6 +44,8 @@ Developed by Wampa842 #### Selection Storage - Store any number of selections, identified by a name. - Selections can be named and managed in a user interface. +- Restore selections completely or selectively by object type (vertex, triangle, bone, rigid body, joint). +- Perform set operations (union, intersect, difference, complement) between selections. #### About & Update - Displays copyright and license informations @@ -159,18 +160,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with WPlugins. If not, see . ------- -## Changelog -#### 0.4.1 -- Fixed an issue where applying a morph would revert the model to the state it was when the plugin was launched. -#### 0.4.0 -- Added Morph Scale (WPlugins.MorphScale) -#### 0.3.0 -- Added OBJ Export (WPlugins.ObjExport) -#### 0.2.0 -- First release -- Added OBJ Import (WPlugins.ObjImport) - ------ ## Contact diff --git a/WPlugins.Common/About.cs b/WPlugins.Common/About.cs index 45ace4d..aaf6c16 100644 --- a/WPlugins.Common/About.cs +++ b/WPlugins.Common/About.cs @@ -36,7 +36,7 @@ public static class Info static Info() { - Version = new SemanticVersion(0, 4, 2); + Version = new SemanticVersion(0, 5, 0); PluginDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); } } diff --git a/WPlugins.SelectionStorage/Properties/Resources.Designer.cs b/WPlugins.SelectionStorage/Properties/Resources.Designer.cs new file mode 100644 index 0000000..12492a9 --- /dev/null +++ b/WPlugins.SelectionStorage/Properties/Resources.Designer.cs @@ -0,0 +1,133 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WPlugins.SelectionStorage.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WPlugins.SelectionStorage.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_complement { + get { + object obj = ResourceManager.GetObject("icon_complement", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_delete { + get { + object obj = ResourceManager.GetObject("icon_delete", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_difference { + get { + object obj = ResourceManager.GetObject("icon_difference", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_down { + get { + object obj = ResourceManager.GetObject("icon_down", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_intersect { + get { + object obj = ResourceManager.GetObject("icon_intersect", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_union { + get { + object obj = ResourceManager.GetObject("icon_union", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icon_up { + get { + object obj = ResourceManager.GetObject("icon_up", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/WPlugins.SelectionStorage/Properties/Resources.resx b/WPlugins.SelectionStorage/Properties/Resources.resx new file mode 100644 index 0000000..7ef263c --- /dev/null +++ b/WPlugins.SelectionStorage/Properties/Resources.resx @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\icon_union.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icon_difference.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icon_complement.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icon_delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icon_intersect.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icon_down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\icon_up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/WPlugins.SelectionStorage/Resources/icon_clone.png b/WPlugins.SelectionStorage/Resources/icon_clone.png new file mode 100644 index 0000000000000000000000000000000000000000..f42b39fca36cf43d9e10e3c67c9a45c69cc3ea97 GIT binary patch literal 1079 zcmV-71jze|P)QYLgDoF6~oiS(5oPB1_ z-uq}D)<4V@b}|7Au^cbr!@B;d z_!Il^F&-=W!b(vACDVlscn=>`pD!AWn}j(y1_L$i6Y)3xXzw!1qfeY_SzLuLu}s{i zgPK#s>0Vc|+_SJ5FX8Z#WjAFKX5d8eakDTvW9(x5fXmyomQJidZ=2++h@HL0P)0@mWOj!0? z@fv=@(>S4o_1ue}v9zY`2)tW@>=AU~4sp^?;^YFdrr~ycD>kCp<~5^&9k>#&*R(g< zfYsIa=3+WFVLgt^E2IIvcmTU`c8>Yy3H7VsGvN|xtO8Hq?mUZ}EA;v<#bbspY-=Fr z9I*+@T9o&^IDJADRyG-XsW`xv=))(tq1A~QOvRpzzPb1g3&ts{5Br6yTZgxVUCKJ7 z1>zRB#4~uL)k#h0#_#CJ=szD{8)?zAxEX7Os~vg02k;u|kRG+fx5NdM3Q{GKDvqAehVNs98=h~A^?!l2I$vP?T#FueNUE37l zuDYxL-;~dP6DK`rv>ta0>)x4D?hqB+BaCXU0BE_<#fDq(qv1ULE7?Y8JPi5&)rNKV zLOI-39kWEp{k8(p-%;XYYjgFFjI`i~ij1x=?@L6K`IO-x<_%n3Kpq^A+Z4Y=*5JA7 z?>TtKXq|sti|(ZfOYx~tk0nCAnpyQ3)p4t|$!Jc*`?#|m!s|F)Bw9lm;!3gM`|yi6 zfLgYTWNN+8^{l!>VfsZlyhe5eSClKn$1lq0?-TJyE!~XSxWGlk!tUwvi@!?_oKiNL8M(%h|LlQxQK%|8X+TPkITvYo;r xcZyow{*vV<5{X12kw_#Gi9{liNF)*k`4?_aqm);^hhG2y002ovPDHLkV1l(w37G%@ literal 0 HcmV?d00001 diff --git a/WPlugins.SelectionStorage/Resources/icon_complement.png b/WPlugins.SelectionStorage/Resources/icon_complement.png new file mode 100644 index 0000000000000000000000000000000000000000..a32b3f4c3586e5787a8cc01311811ced735d68e6 GIT binary patch literal 2570 zcmV+l3ib7gP) zl|H#~i8ZZrcpBN6a$vRZ`!PTrM(16?#!r8YiijStAUl0Okb}Q9{5p)@HlQZq)^!4l z@jE=+SN4VP`t>k+`97KCgj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`W&H7s$H5 z8Q}-a!ijvVP>Z;JZ6SjSuEVLS`g$srtZO>kQ2p}ZU7?AUQ#}(ary3FY<)AJ>GPcK&BXA*!hZkXl zwg5Yk^7r?F`!Shx+2sUhdOZFO9+&Uqv4P0s3FEHrzjD%SXIZGyT^6eJdffp>e>_Y$ z+L7q$x)6W+(#euYwAaBVuBd|Z>W4xzW^BV@>NbWSjg5T#?ZHVb*vr;xS& z7}k~y@ZPe*KIB`0Dl}!i-e7qm5$!~0g&Wa7y&VcpgdO@IIxAd;WO6-PYeslOdnsxW fMHEp)5k>GH7e}K3pFnI-00000NkvXXu0mjfhi4IS literal 0 HcmV?d00001 diff --git a/WPlugins.SelectionStorage/Resources/icon_down.png b/WPlugins.SelectionStorage/Resources/icon_down.png new file mode 100644 index 0000000000000000000000000000000000000000..b0480a7640912c6722d01cf24f1c0e81ebb00b5d GIT binary patch literal 490 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq!<_&(>+}r zLn`LHz3J$6*g@pj$NJ_Fm+l9Lwp!~yXx#OUCGSq>BVLh`mxV0)3iljbS-LMCbLDKg zXmpZivboWH{!NmT_Dt6|)}7nb0RbL~YPRQZvn`ufEOx*>#`@jVyV)m@Qd1u*Rsb3w+G7KsDj6gFEvcm34u;fx;iy-t@+9 z`Joz6!(ge~$YtRXvzT!nNWB5GobdG(h2KoO;+c-JPq-{p!QLlyJ>yQ}9Ht*^?~d#J zy1wj%=KlIAZxHkB$MoH;=qSDYNOZNiIscyblB;K$ z9O0?pSabclc)^YDPcF<9`1P!uIg8iUuHDSkq-92CzEH#a=mm^@jlO?QE2i8k*KL^G z@%nc}TilD;oc|v&>tEX?&{gqcnzU0O|NSgyjZY7wYyXFd3xdJKKYtiRDyBH8Z&;H6 Pj28w^S3j3^P64e|wWAyPMZ0MyLf9>wqyD6f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14NJKYFLVwq{z{NmCkZcZ}QK+NgJJx;>su9k~?$2d*b0Tje$!mcwqA!n+Vh ztVS+NeB#5P!i+{Nr?6@zkU);1j6$w}MBher~Xvlc=F><|UTxdXU zU3CNB!=EE6qv47_MZ#4Bix=FLx#sef!;x@hG7_%r#Qsj86&iA7?`>q!c1!{zmm?9K z4}sq!Q)Q`3-5TJBz;h59l*F^@otrChsIuk&_aK{|9l!$D)*C1^CRmTGwOf#;`yO&+ z9akxd{HocQ;8{qpa|aU3%l6S$Bqlf;37&S7iwS;)1WKz_Is>^pxfAK@>r}bE7|W<| z7`ZDjot&`|qypKf@PEl&y){Ea;(ZO|qQaGkBePC@A8GDR(dB@EfPjDi2fhHCP%1AV SUNWfw0000 + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + A + A' + + diff --git a/WPlugins.SelectionStorage/Resources/icon_union.png b/WPlugins.SelectionStorage/Resources/icon_union.png new file mode 100644 index 0000000000000000000000000000000000000000..eb5c7ac89cc90501d4afada99b1098f65adb198f GIT binary patch literal 2577 zcmV+s3hwoZP)#A6wN`XmJ36I`Q^#VfXdSgxK=1`cKrL3pq992O5i|kM=KKgWLc8Eyh3WxSYx+>23iH=YN-zK8yND*t~#yaAX6v?$|_^XE>&SU|U5 z(c@cSJMc6xKutls0k{LmP{#jK0L;ifg@MnNQ46#JCBQw%xo1=?1!-{@=?`2990S^c z@xaBvSG{ojT;o&V+8)R9fVY6jz+aFP>kkmm3YZ5NfLDQ+m1DOh<7FS?B(O-CPl!d* z3V@F8i(Li0j=bD%0gSzLurDAef4#8?S^<~>3#$rP4Cs2+Yg!h2vsN;U%P2|-xS4}zKi<(~1? zP9~oLU&i1R0+%C~quXO}8UPRA0t$eE$OV-e1}X!f4LG8~j~D&oB^rPe$Wfc5!Ye>t zCGCJsg|~t3yBSY5elUu^UW2Q(0y63T3EUHhZ9sm+Nx(t0`vqNjLM<6yNB0G_02iuo zM<*zXF!e>gKojYZB=Un=LDNMHr5RfHamgWKi678Q;G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`eldzD>b! zB>WFGp4O`;PcSH4|M+t=eW#laCGE_-*?*&^b{$naS8H;&*RG}d^EE6e|9jH*8e5LC z>XqTs?L4$SX~5XRfwH5136hE-Ji&XI9*d+mTJIl6p(^ z3RbPVpNH<+NKTg8X92Ns^u%r+dHQle40QY<66t(Xiyuz_h(tPTLSgaH*6Nq1r@Qiu z1^J_OYWx1P!R^dtT=7hnulWt%oZQEVp_4HgEdU5&8!Oi>q;lu$JaqR5KR8Y9Wp_`k4Q z-AnZPwEmY*oNt^^GRIVqKL%r(SyRv}v`}}bij7;J^?z0WkqMx9#7~3Mr`=__aOf25 zwhT=jp>TjB$7`vseJi-NdSzIW!p8-%{rAZKTaXZX+Y>A@nXL0o2FrC~&^sVEYp`!% z{wTf6k!^H2vdw0rP3QA_@Cc28=H_Gmqu=gM^9n5ni`lV95Irj+k4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq!<_&BRpLk zLn`LHo$2Ux*g>StzIn&Rpn``{cPbd)C-*;ey5o7#xMRmhize|2_Z*gTgstx7)^71E z6*_*hr}97hO`B7H-q(JaxP?)%MZk#zM0BLBS(>My%38oWNBx~LXZ+#mr%z8|DX$0? z+9!Rlh2{Q-z0)p~{D||)u&!CJ@~7-ay?WwRW?#k_ruN44`Ao-k?e;VFFd5hCG<0Vr zPHhl=b@)9)^t{9Jjn&J|%9!gDcGxJZ72COPekFTSAK23{CoF;Cj@!8k=5MQk8bl7nJ?XjCuejFX6`R(XhQ%i& zxwlW4+#vp7&Fg^A+6i$Em#^QM{o}vS9LDpBZ@~coCXPI37S(SG>D+968yFD`p00i_ I>zopr0GEQm%>V!Z literal 0 HcmV?d00001 diff --git a/WPlugins.SelectionStorage/Selection.cs b/WPlugins.SelectionStorage/Selection.cs index 7ad6f50..c89b6c7 100644 --- a/WPlugins.SelectionStorage/Selection.cs +++ b/WPlugins.SelectionStorage/Selection.cs @@ -8,15 +8,39 @@ namespace WPlugins.SelectionStorage { - public class Selection + /// + /// Holds the indices of selected items in a PMX View instance. + /// + public class Selection : ICloneable { + /// + /// The displayed name of the selection + /// public string Name { get; set; } + /// + /// Indices of selected vertices + /// public int[] Vertex { get; set; } + /// + /// Indices of selected triangles + /// public int[] Triangle { get; set; } + /// + /// Indices of selected bones + /// public int[] Bone { get; set; } + /// + /// Indices of selected rigid bodies + /// public int[] Rigidbody { get; set; } + /// + /// Indices of selected joints + /// public int[] Joint { get; set; } + /// + /// Initializes a new instance of a Selection class. + /// public Selection() { Name = ""; @@ -27,6 +51,22 @@ public Selection() Joint = new int[0]; } + /// + /// Initializes a new instance of a Selection class with the given indices. + /// + public Selection(string name, int[] vertex, int[] triangle, int[] bone, int[] rigidbody, int[] joint) + { + Name = name; + Vertex = vertex; + Triangle = triangle; + Bone = bone; + Rigidbody = rigidbody; + Joint = joint; + } + + /// + /// Initializes a new instance of a Selection class from the given reference. + /// public Selection(PEPlugin.View.IPXPmxViewConnector connector) { Name = ""; @@ -37,9 +77,87 @@ public Selection(PEPlugin.View.IPXPmxViewConnector connector) Joint = connector.GetSelectedJointIndices(); } + /// + /// Initializes a new instance of a Selection class with the given name and reference. + /// public Selection(PEPlugin.View.IPXPmxViewConnector connector, string name) : this(connector) { Name = name; } + + /// + /// Creates a new Selection instance where items are the elements of any of the operands. + /// + /// The union of operands. + public static Selection Union(params Selection[] operands) + { + // Given the sets A, B, C, D + // returns ((A u B) u C) u D + if (operands.Length <= 0) return new Selection(); + Selection result = (Selection)operands[0].Clone(); + for (int i = 1; i < operands.Length; ++i) + { + result.Vertex = result.Vertex.Union(operands[i].Vertex).ToArray(); + result.Triangle = result.Triangle.Union(operands[i].Triangle).ToArray(); + result.Bone = result.Bone.Union(operands[i].Bone).ToArray(); + result.Rigidbody = result.Rigidbody.Union(operands[i].Rigidbody).ToArray(); + result.Joint = result.Joint.Union(operands[i].Joint).ToArray(); + } + return result; + } + + /// + /// Creates a new Selection instance where items must be elements of all operands. + /// + /// The intersect of all operands. + public static Selection Intersect(params Selection[] operands) + { + // Given the sets A, B, C, D + // returns ((A n B) n C) n D + if (operands.Length <= 0) return new Selection(); + Selection result = (Selection)operands[0].Clone(); + for (int i = 1; i < operands.Length; ++i) + { + result.Vertex = result.Vertex.Intersect(operands[i].Vertex).ToArray(); + result.Triangle = result.Triangle.Intersect(operands[i].Triangle).ToArray(); + result.Bone = result.Bone.Intersect(operands[i].Bone).ToArray(); + result.Rigidbody = result.Rigidbody.Intersect(operands[i].Rigidbody).ToArray(); + result.Joint = result.Joint.Intersect(operands[i].Joint).ToArray(); + } + return result; + } + + /// + /// Creates a new Selection instance where items are elements of the first operand, but not elements of subsequent operands. + /// + /// The relative complement of the first operand with the union of all subsequent operands. + public static Selection Except(params Selection[] operands) + { + // Given the sets A, B, C, D + // returns A \ (B u C u D) + if (operands.Length <= 0) return new Selection(); + Selection result = (Selection)operands[0].Clone(); + for (int i = 1; i < operands.Length; ++i) + { + result.Vertex = result.Vertex.Except(operands[i].Vertex).ToArray(); + result.Triangle = result.Triangle.Except(operands[i].Triangle).ToArray(); + result.Bone = result.Bone.Except(operands[i].Bone).ToArray(); + result.Rigidbody = result.Rigidbody.Except(operands[i].Rigidbody).ToArray(); + result.Joint = result.Joint.Except(operands[i].Joint).ToArray(); + } + return result; + } + + public object Clone() + { + Selection clone = new Selection(); + clone.Name = this.Name; + clone.Vertex = (int[])this.Vertex.Clone(); + clone.Triangle = (int[])this.Triangle.Clone(); + clone.Bone = (int[])this.Bone.Clone(); + clone.Rigidbody = (int[])this.Rigidbody.Clone(); + clone.Joint = (int[])this.Joint.Clone(); + return clone; + } } } diff --git a/WPlugins.SelectionStorage/SelectionStorageForm.Designer.cs b/WPlugins.SelectionStorage/SelectionStorageForm.Designer.cs index 57a59b6..2f44174 100644 --- a/WPlugins.SelectionStorage/SelectionStorageForm.Designer.cs +++ b/WPlugins.SelectionStorage/SelectionStorageForm.Designer.cs @@ -32,6 +32,9 @@ private void InitializeComponent() System.Windows.Forms.Label label1; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SelectionStorageForm)); this.mainMenuStrip = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.exportToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importFromFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.keepOnTopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.storedList = new System.Windows.Forms.ListView(); @@ -49,9 +52,23 @@ private void InitializeComponent() this.restoreSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.renameButton = new System.Windows.Forms.Button(); + this.operationToolTip = new System.Windows.Forms.ToolTip(this.components); + this.trimButton = new System.Windows.Forms.Button(); + this.cloneButton = new System.Windows.Forms.Button(); + this.moveDownButton = new System.Windows.Forms.Button(); + this.moveUpButton = new System.Windows.Forms.Button(); + this.complementButton = new System.Windows.Forms.Button(); + this.differenceButton = new System.Windows.Forms.Button(); + this.intersectButton = new System.Windows.Forms.Button(); + this.unionButton = new System.Windows.Forms.Button(); this.deleteButton = new System.Windows.Forms.Button(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.exportToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.selectiveAllCheck = new System.Windows.Forms.CheckBox(); + this.selectiveJointCheck = new System.Windows.Forms.CheckBox(); + this.selectiveRigidbodyCheck = new System.Windows.Forms.CheckBox(); + this.selectiveTriangleCheck = new System.Windows.Forms.CheckBox(); + this.selectiveBoneCheck = new System.Windows.Forms.CheckBox(); + this.selectiveVertexCheck = new System.Windows.Forms.CheckBox(); + this.objectTypeToolTip = new System.Windows.Forms.ToolTip(this.components); label1 = new System.Windows.Forms.Label(); this.mainMenuStrip.SuspendLayout(); this.storedListContextMenu.SuspendLayout(); @@ -61,7 +78,7 @@ private void InitializeComponent() // label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); label1.AutoSize = true; - label1.Location = new System.Drawing.Point(12, 350); + label1.Location = new System.Drawing.Point(12, 377); label1.Name = "label1"; label1.Size = new System.Drawing.Size(38, 13); label1.TabIndex = 4; @@ -74,10 +91,34 @@ private void InitializeComponent() this.viewToolStripMenuItem}); this.mainMenuStrip.Location = new System.Drawing.Point(0, 0); this.mainMenuStrip.Name = "mainMenuStrip"; - this.mainMenuStrip.Size = new System.Drawing.Size(484, 24); + this.mainMenuStrip.Size = new System.Drawing.Size(464, 24); this.mainMenuStrip.TabIndex = 0; this.mainMenuStrip.Text = "mainMenuStrip"; // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.exportToFileToolStripMenuItem, + this.importFromFileToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // exportToFileToolStripMenuItem + // + this.exportToFileToolStripMenuItem.Enabled = false; + this.exportToFileToolStripMenuItem.Name = "exportToFileToolStripMenuItem"; + this.exportToFileToolStripMenuItem.Size = new System.Drawing.Size(158, 22); + this.exportToFileToolStripMenuItem.Text = "Export to file"; + this.exportToFileToolStripMenuItem.Click += new System.EventHandler(this.exportToFileToolStripMenuItem_Click); + // + // importFromFileToolStripMenuItem + // + this.importFromFileToolStripMenuItem.Enabled = false; + this.importFromFileToolStripMenuItem.Name = "importFromFileToolStripMenuItem"; + this.importFromFileToolStripMenuItem.Size = new System.Drawing.Size(158, 22); + this.importFromFileToolStripMenuItem.Text = "Import from file"; + // // viewToolStripMenuItem // this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -90,7 +131,7 @@ private void InitializeComponent() // this.keepOnTopToolStripMenuItem.CheckOnClick = true; this.keepOnTopToolStripMenuItem.Name = "keepOnTopToolStripMenuItem"; - this.keepOnTopToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.keepOnTopToolStripMenuItem.Size = new System.Drawing.Size(138, 22); this.keepOnTopToolStripMenuItem.Text = "Keep on top"; this.keepOnTopToolStripMenuItem.CheckedChanged += new System.EventHandler(this.keepOnTopToolStripMenuItem_CheckedChanged); // @@ -109,12 +150,12 @@ private void InitializeComponent() this.numberJointsColumn}); this.storedList.FullRowSelect = true; this.storedList.Location = new System.Drawing.Point(12, 27); - this.storedList.MultiSelect = false; this.storedList.Name = "storedList"; - this.storedList.Size = new System.Drawing.Size(460, 300); + this.storedList.Size = new System.Drawing.Size(389, 340); this.storedList.TabIndex = 1; this.storedList.UseCompatibleStateImageBehavior = false; this.storedList.View = System.Windows.Forms.View.Details; + this.storedList.SelectedIndexChanged += new System.EventHandler(this.storedList_SelectedIndexChanged); this.storedList.DoubleClick += new System.EventHandler(this.restoreButton_Click); // // indexColumn @@ -125,22 +166,22 @@ private void InitializeComponent() // nameColumn // this.nameColumn.Text = "Name"; - this.nameColumn.Width = 130; + this.nameColumn.Width = 129; // // numberVertexColumn // this.numberVertexColumn.Text = "Vertices"; - this.numberVertexColumn.Width = 50; + this.numberVertexColumn.Width = 55; // // numberTriangleColumn // this.numberTriangleColumn.Text = "Faces"; - this.numberTriangleColumn.Width = 50; + this.numberTriangleColumn.Width = 55; // // numberBonesColumn // this.numberBonesColumn.Text = "Bones"; - this.numberBonesColumn.Width = 50; + this.numberBonesColumn.Width = 55; // // numberBodiesColumn // @@ -150,16 +191,16 @@ private void InitializeComponent() // numberJointsColumn // this.numberJointsColumn.Text = "Joints"; - this.numberJointsColumn.Width = 50; + this.numberJointsColumn.Width = 55; // // storeCurrentButton // this.storeCurrentButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.storeCurrentButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.storeCurrentButton.Location = new System.Drawing.Point(12, 373); + this.storeCurrentButton.Location = new System.Drawing.Point(12, 429); this.storeCurrentButton.Name = "storeCurrentButton"; - this.storeCurrentButton.Size = new System.Drawing.Size(460, 35); + this.storeCurrentButton.Size = new System.Drawing.Size(440, 35); this.storeCurrentButton.TabIndex = 2; this.storeCurrentButton.Text = "Store current selection"; this.storeCurrentButton.UseVisualStyleBackColor = true; @@ -169,9 +210,9 @@ private void InitializeComponent() // this.nameText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.nameText.Location = new System.Drawing.Point(56, 347); + this.nameText.Location = new System.Drawing.Point(56, 374); this.nameText.Name = "nameText"; - this.nameText.Size = new System.Drawing.Size(191, 20); + this.nameText.Size = new System.Drawing.Size(283, 20); this.nameText.TabIndex = 3; // // restoreButton @@ -179,9 +220,9 @@ private void InitializeComponent() this.restoreButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.restoreButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.restoreButton.Location = new System.Drawing.Point(12, 414); + this.restoreButton.Location = new System.Drawing.Point(12, 470); this.restoreButton.Name = "restoreButton"; - this.restoreButton.Size = new System.Drawing.Size(460, 35); + this.restoreButton.Size = new System.Drawing.Size(440, 35); this.restoreButton.TabIndex = 5; this.restoreButton.Text = "Restore selection"; this.restoreButton.UseVisualStyleBackColor = true; @@ -212,7 +253,7 @@ private void InitializeComponent() // renameButton // this.renameButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.renameButton.Location = new System.Drawing.Point(253, 345); + this.renameButton.Location = new System.Drawing.Point(345, 372); this.renameButton.Name = "renameButton"; this.renameButton.Size = new System.Drawing.Size(107, 23); this.renameButton.TabIndex = 7; @@ -220,50 +261,265 @@ private void InitializeComponent() this.renameButton.UseVisualStyleBackColor = true; this.renameButton.Click += new System.EventHandler(this.renameButton_Click); // + // operationToolTip + // + this.operationToolTip.AutoPopDelay = 10000; + this.operationToolTip.InitialDelay = 500; + this.operationToolTip.ReshowDelay = 100; + this.operationToolTip.ToolTipTitle = "Set operations"; + // + // trimButton + // + this.trimButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.trimButton.Location = new System.Drawing.Point(352, 402); + this.trimButton.Name = "trimButton"; + this.trimButton.Size = new System.Drawing.Size(100, 23); + this.trimButton.TabIndex = 15; + this.trimButton.Text = "Trim selected"; + this.operationToolTip.SetToolTip(this.trimButton, "Trimming\r\nTrims the selected items to only contain objects of the selected type. " + + "Types that are not selected will be removed."); + this.trimButton.UseVisualStyleBackColor = true; + this.trimButton.Click += new System.EventHandler(this.trimButton_Click); + // + // cloneButton + // + this.cloneButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.cloneButton.Location = new System.Drawing.Point(407, 290); + this.cloneButton.Name = "cloneButton"; + this.cloneButton.Size = new System.Drawing.Size(45, 26); + this.cloneButton.TabIndex = 16; + this.cloneButton.Text = "Clone"; + this.operationToolTip.SetToolTip(this.cloneButton, "Clone selected"); + this.cloneButton.UseVisualStyleBackColor = true; + this.cloneButton.Click += new System.EventHandler(this.cloneButton_Click); + // + // moveDownButton + // + this.moveDownButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.moveDownButton.BackgroundImage = global::WPlugins.SelectionStorage.Properties.Resources.icon_down; + this.moveDownButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.moveDownButton.Location = new System.Drawing.Point(407, 258); + this.moveDownButton.Name = "moveDownButton"; + this.moveDownButton.Size = new System.Drawing.Size(45, 26); + this.moveDownButton.TabIndex = 14; + this.operationToolTip.SetToolTip(this.moveDownButton, "Move down"); + this.moveDownButton.UseVisualStyleBackColor = true; + this.moveDownButton.Click += new System.EventHandler(this.moveDownButton_Click); + // + // moveUpButton + // + this.moveUpButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.moveUpButton.BackgroundImage = global::WPlugins.SelectionStorage.Properties.Resources.icon_up; + this.moveUpButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.moveUpButton.Location = new System.Drawing.Point(407, 231); + this.moveUpButton.Name = "moveUpButton"; + this.moveUpButton.Size = new System.Drawing.Size(45, 26); + this.moveUpButton.TabIndex = 13; + this.operationToolTip.SetToolTip(this.moveUpButton, "Move up"); + this.moveUpButton.UseVisualStyleBackColor = true; + this.moveUpButton.Click += new System.EventHandler(this.moveUpButton_Click); + // + // complementButton + // + this.complementButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.complementButton.BackgroundImage = global::WPlugins.SelectionStorage.Properties.Resources.icon_complement; + this.complementButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.complementButton.Enabled = false; + this.complementButton.Location = new System.Drawing.Point(407, 180); + this.complementButton.Name = "complementButton"; + this.complementButton.Size = new System.Drawing.Size(45, 45); + this.complementButton.TabIndex = 12; + this.operationToolTip.SetToolTip(this.complementButton, "Complement\r\nCreates a selection of items that are not part of any selected operan" + + "ds.\r\n"); + this.complementButton.UseVisualStyleBackColor = true; + this.complementButton.Click += new System.EventHandler(this.complementButton_Click); + // + // differenceButton + // + this.differenceButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.differenceButton.BackgroundImage = global::WPlugins.SelectionStorage.Properties.Resources.icon_difference; + this.differenceButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.differenceButton.Location = new System.Drawing.Point(407, 129); + this.differenceButton.Name = "differenceButton"; + this.differenceButton.Size = new System.Drawing.Size(45, 45); + this.differenceButton.TabIndex = 11; + this.operationToolTip.SetToolTip(this.differenceButton, "Difference\r\nCreates a new selection of items that are elements of the first opera" + + "nd, but not elements of any subsequent operands.\r\n"); + this.differenceButton.UseVisualStyleBackColor = true; + this.differenceButton.Click += new System.EventHandler(this.differenceButton_Click); + // + // intersectButton + // + this.intersectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.intersectButton.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("intersectButton.BackgroundImage"))); + this.intersectButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.intersectButton.Location = new System.Drawing.Point(407, 78); + this.intersectButton.Name = "intersectButton"; + this.intersectButton.Size = new System.Drawing.Size(45, 45); + this.intersectButton.TabIndex = 10; + this.operationToolTip.SetToolTip(this.intersectButton, "Intersect\r\nCreates a new selection of items that are elements of all of the opera" + + "nds.\r\n"); + this.intersectButton.UseVisualStyleBackColor = true; + this.intersectButton.Click += new System.EventHandler(this.intersectButton_Click); + // + // unionButton + // + this.unionButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.unionButton.BackgroundImage = global::WPlugins.SelectionStorage.Properties.Resources.icon_union; + this.unionButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.unionButton.Location = new System.Drawing.Point(407, 27); + this.unionButton.Name = "unionButton"; + this.unionButton.Size = new System.Drawing.Size(45, 45); + this.unionButton.TabIndex = 9; + this.operationToolTip.SetToolTip(this.unionButton, "Union\r\nCreates a new selection of items that are elements of any of the operands." + + ""); + this.unionButton.UseVisualStyleBackColor = true; + this.unionButton.Click += new System.EventHandler(this.unionButton_Click); + // // deleteButton // - this.deleteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.deleteButton.Location = new System.Drawing.Point(365, 345); + this.deleteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.deleteButton.BackgroundImage = global::WPlugins.SelectionStorage.Properties.Resources.icon_delete; + this.deleteButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.deleteButton.Location = new System.Drawing.Point(407, 322); this.deleteButton.Name = "deleteButton"; - this.deleteButton.Size = new System.Drawing.Size(107, 23); + this.deleteButton.Size = new System.Drawing.Size(45, 45); this.deleteButton.TabIndex = 8; - this.deleteButton.Text = "Delete selected"; + this.operationToolTip.SetToolTip(this.deleteButton, "Delete selected items"); this.deleteButton.UseVisualStyleBackColor = true; this.deleteButton.Click += new System.EventHandler(this.deleteButton_Click); // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.exportToFileToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); - this.fileToolStripMenuItem.Text = "File"; - // - // exportToFileToolStripMenuItem - // - this.exportToFileToolStripMenuItem.Name = "exportToFileToolStripMenuItem"; - this.exportToFileToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.exportToFileToolStripMenuItem.Text = "Export to file"; - this.exportToFileToolStripMenuItem.Click += new System.EventHandler(this.exportToFileToolStripMenuItem_Click); + // selectiveAllCheck + // + this.selectiveAllCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.selectiveAllCheck.AutoSize = true; + this.selectiveAllCheck.Checked = true; + this.selectiveAllCheck.CheckState = System.Windows.Forms.CheckState.Checked; + this.selectiveAllCheck.Location = new System.Drawing.Point(12, 406); + this.selectiveAllCheck.Name = "selectiveAllCheck"; + this.selectiveAllCheck.Size = new System.Drawing.Size(162, 17); + this.selectiveAllCheck.TabIndex = 6; + this.selectiveAllCheck.Text = "Select types to store/restore:"; + this.selectiveAllCheck.UseVisualStyleBackColor = true; + this.selectiveAllCheck.Click += new System.EventHandler(this.selectiveAllCheck_Click); + // + // selectiveJointCheck + // + this.selectiveJointCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.selectiveJointCheck.Appearance = System.Windows.Forms.Appearance.Button; + this.selectiveJointCheck.AutoSize = true; + this.selectiveJointCheck.Checked = true; + this.selectiveJointCheck.CheckState = System.Windows.Forms.CheckState.Checked; + this.selectiveJointCheck.Location = new System.Drawing.Point(312, 402); + this.selectiveJointCheck.Name = "selectiveJointCheck"; + this.selectiveJointCheck.Size = new System.Drawing.Size(22, 23); + this.selectiveJointCheck.TabIndex = 5; + this.selectiveJointCheck.Text = "J"; + this.objectTypeToolTip.SetToolTip(this.selectiveJointCheck, "Joints"); + this.selectiveJointCheck.UseVisualStyleBackColor = true; + this.selectiveJointCheck.CheckedChanged += new System.EventHandler(this.selectiveCheck_Click); + // + // selectiveRigidbodyCheck + // + this.selectiveRigidbodyCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.selectiveRigidbodyCheck.Appearance = System.Windows.Forms.Appearance.Button; + this.selectiveRigidbodyCheck.AutoSize = true; + this.selectiveRigidbodyCheck.Checked = true; + this.selectiveRigidbodyCheck.CheckState = System.Windows.Forms.CheckState.Checked; + this.selectiveRigidbodyCheck.Location = new System.Drawing.Point(275, 402); + this.selectiveRigidbodyCheck.Name = "selectiveRigidbodyCheck"; + this.selectiveRigidbodyCheck.Size = new System.Drawing.Size(31, 23); + this.selectiveRigidbodyCheck.TabIndex = 4; + this.selectiveRigidbodyCheck.Text = "Rb"; + this.objectTypeToolTip.SetToolTip(this.selectiveRigidbodyCheck, "Rigid bodies"); + this.selectiveRigidbodyCheck.UseVisualStyleBackColor = true; + this.selectiveRigidbodyCheck.CheckedChanged += new System.EventHandler(this.selectiveCheck_Click); + // + // selectiveTriangleCheck + // + this.selectiveTriangleCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.selectiveTriangleCheck.Appearance = System.Windows.Forms.Appearance.Button; + this.selectiveTriangleCheck.AutoSize = true; + this.selectiveTriangleCheck.Checked = true; + this.selectiveTriangleCheck.CheckState = System.Windows.Forms.CheckState.Checked; + this.selectiveTriangleCheck.Location = new System.Drawing.Point(216, 402); + this.selectiveTriangleCheck.Name = "selectiveTriangleCheck"; + this.selectiveTriangleCheck.Size = new System.Drawing.Size(23, 23); + this.selectiveTriangleCheck.TabIndex = 3; + this.selectiveTriangleCheck.Text = "F"; + this.objectTypeToolTip.SetToolTip(this.selectiveTriangleCheck, "Faces"); + this.selectiveTriangleCheck.UseVisualStyleBackColor = true; + this.selectiveTriangleCheck.Click += new System.EventHandler(this.selectiveCheck_Click); + // + // selectiveBoneCheck + // + this.selectiveBoneCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.selectiveBoneCheck.Appearance = System.Windows.Forms.Appearance.Button; + this.selectiveBoneCheck.AutoSize = true; + this.selectiveBoneCheck.Checked = true; + this.selectiveBoneCheck.CheckState = System.Windows.Forms.CheckState.Checked; + this.selectiveBoneCheck.Location = new System.Drawing.Point(245, 402); + this.selectiveBoneCheck.Name = "selectiveBoneCheck"; + this.selectiveBoneCheck.Size = new System.Drawing.Size(24, 23); + this.selectiveBoneCheck.TabIndex = 2; + this.selectiveBoneCheck.Text = "B"; + this.objectTypeToolTip.SetToolTip(this.selectiveBoneCheck, "Bones"); + this.selectiveBoneCheck.UseVisualStyleBackColor = true; + this.selectiveBoneCheck.CheckedChanged += new System.EventHandler(this.selectiveCheck_Click); + // + // selectiveVertexCheck + // + this.selectiveVertexCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.selectiveVertexCheck.Appearance = System.Windows.Forms.Appearance.Button; + this.selectiveVertexCheck.AutoSize = true; + this.selectiveVertexCheck.Checked = true; + this.selectiveVertexCheck.CheckState = System.Windows.Forms.CheckState.Checked; + this.selectiveVertexCheck.Location = new System.Drawing.Point(186, 402); + this.selectiveVertexCheck.Name = "selectiveVertexCheck"; + this.selectiveVertexCheck.Size = new System.Drawing.Size(24, 23); + this.selectiveVertexCheck.TabIndex = 2; + this.selectiveVertexCheck.Text = "V"; + this.objectTypeToolTip.SetToolTip(this.selectiveVertexCheck, "Vertices"); + this.selectiveVertexCheck.UseVisualStyleBackColor = true; + this.selectiveVertexCheck.CheckedChanged += new System.EventHandler(this.selectiveCheck_Click); + // + // objectTypeToolTip + // + this.objectTypeToolTip.AutoPopDelay = 5000; + this.objectTypeToolTip.InitialDelay = 300; + this.objectTypeToolTip.ReshowDelay = 100; // // SelectionStorageForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(484, 461); + this.ClientSize = new System.Drawing.Size(464, 517); + this.Controls.Add(this.cloneButton); + this.Controls.Add(this.trimButton); + this.Controls.Add(this.selectiveAllCheck); + this.Controls.Add(this.selectiveJointCheck); + this.Controls.Add(this.selectiveRigidbodyCheck); + this.Controls.Add(this.moveDownButton); + this.Controls.Add(this.selectiveTriangleCheck); + this.Controls.Add(this.moveUpButton); + this.Controls.Add(this.selectiveBoneCheck); + this.Controls.Add(this.complementButton); + this.Controls.Add(this.selectiveVertexCheck); + this.Controls.Add(this.differenceButton); + this.Controls.Add(this.intersectButton); + this.Controls.Add(this.unionButton); + this.Controls.Add(this.storedList); this.Controls.Add(this.deleteButton); this.Controls.Add(this.renameButton); this.Controls.Add(this.restoreButton); this.Controls.Add(label1); this.Controls.Add(this.nameText); this.Controls.Add(this.storeCurrentButton); - this.Controls.Add(this.storedList); this.Controls.Add(this.mainMenuStrip); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.mainMenuStrip; this.MaximizeBox = false; this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(500, 500); this.Name = "SelectionStorageForm"; this.Text = "Selection Storage"; this.mainMenuStrip.ResumeLayout(false); @@ -297,5 +553,22 @@ private void InitializeComponent() private System.Windows.Forms.Button deleteButton; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exportToFileToolStripMenuItem; + private System.Windows.Forms.Button unionButton; + private System.Windows.Forms.Button intersectButton; + private System.Windows.Forms.Button differenceButton; + private System.Windows.Forms.Button complementButton; + private System.Windows.Forms.ToolTip operationToolTip; + private System.Windows.Forms.Button moveUpButton; + private System.Windows.Forms.Button moveDownButton; + private System.Windows.Forms.CheckBox selectiveVertexCheck; + private System.Windows.Forms.CheckBox selectiveBoneCheck; + private System.Windows.Forms.CheckBox selectiveTriangleCheck; + private System.Windows.Forms.CheckBox selectiveJointCheck; + private System.Windows.Forms.CheckBox selectiveRigidbodyCheck; + private System.Windows.Forms.CheckBox selectiveAllCheck; + private System.Windows.Forms.ToolStripMenuItem importFromFileToolStripMenuItem; + private System.Windows.Forms.Button trimButton; + private System.Windows.Forms.Button cloneButton; + private System.Windows.Forms.ToolTip objectTypeToolTip; } } \ No newline at end of file diff --git a/WPlugins.SelectionStorage/SelectionStorageForm.cs b/WPlugins.SelectionStorage/SelectionStorageForm.cs index de616be..44cbfbb 100644 --- a/WPlugins.SelectionStorage/SelectionStorageForm.cs +++ b/WPlugins.SelectionStorage/SelectionStorageForm.cs @@ -5,7 +5,9 @@ using System.Drawing; using System.Linq; using System.Text; -using System.Threading.Tasks; +using System.IO; +using System.Xml; +using System.Xml.Serialization; using System.Windows.Forms; using PEPlugin; @@ -14,47 +16,91 @@ namespace WPlugins.SelectionStorage public partial class SelectionStorageForm : Form { private IPERunArgs _args; - private List _storage; + private TrimForm _trimForm; public SelectionStorageForm(IPERunArgs args) { InitializeComponent(); _args = args; - _storage = new List(); } - public void PopulateList() + public void AddSelection(Selection sel) { - storedList.Items.Clear(); - for(int i = 0; i < _storage.Count; ++i) - { - Selection sel = _storage[i]; - ListViewItem item = new ListViewItem(new string[] { i.ToString(), sel.Name, sel.Vertex.Length.ToString(), sel.Triangle.Length.ToString(), sel.Bone.Length.ToString(), sel.Rigidbody.Length.ToString(), sel.Joint.Length.ToString() }); - item.Tag = sel; - storedList.Items.Add(item); - } + ListViewItem item = new ListViewItem(new string[] { storedList.Items.Count.ToString(), sel.Name, sel.Vertex.Length.ToString(), sel.Triangle.Length.ToString(), sel.Bone.Length.ToString(), sel.Rigidbody.Length.ToString(), sel.Joint.Length.ToString() }); + item.Tag = sel; + storedList.Items.Add(item); + } + + public Selection GetCurrentSelection() + { + PEPlugin.View.IPXPmxViewConnector view = _args.Host.Connector.View.PmxView; + int[] v = selectiveVertexCheck.Checked ? view.GetSelectedVertexIndices() : new int[0]; + int[] f = selectiveTriangleCheck.Checked ? view.GetSelectedFaceIndices() : new int[0]; + int[] b = selectiveBoneCheck.Checked ? view.GetSelectedBoneIndices() : new int[0]; + int[] r = selectiveRigidbodyCheck.Checked ? view.GetSelectedBodyIndices() : new int[0]; + int[] j = selectiveJointCheck.Checked ? view.GetSelectedJointIndices() : new int[0]; + string name = string.IsNullOrEmpty(nameText.Text) ? "Selection " + storedList.Items.Count.ToString() : nameText.Text; + + return new Selection(name, v, f, b, r, j); } public void AddCurrentSelection() { - Selection sel = new Selection(_args.Host.Connector.View.PmxView, nameText.Text); - _storage.Add(sel); - ListViewItem item = new ListViewItem(new string[] { (_storage.Count - 1).ToString(), sel.Name, sel.Vertex.Length.ToString(), sel.Triangle.Length.ToString(), sel.Bone.Length.ToString(), sel.Rigidbody.Length.ToString(), sel.Joint.Length.ToString() }); - item.Tag = sel; - storedList.Items.Add(item); + AddSelection(GetCurrentSelection()); } public void RestoreSelection(Selection sel) { PEPlugin.View.IPXPmxViewConnector view = _args.Host.Connector.View.PmxView; - view.SetSelectedVertexIndices(sel.Vertex); - view.SetSelectedFaceIndices(sel.Triangle); - view.SetSelectedBoneIndices(sel.Bone); - view.SetSelectedBodyIndices(sel.Rigidbody); - view.SetSelectedJointIndices(sel.Joint); + if (selectiveVertexCheck.Checked) + { + view.SetSelectedVertexIndices(sel.Vertex); + } + if (selectiveTriangleCheck.Checked) + { + view.SetSelectedFaceIndices(sel.Triangle); + } + if (selectiveBoneCheck.Checked) + { + view.SetSelectedBoneIndices(sel.Bone); + } + if (selectiveRigidbodyCheck.Checked) + { + view.SetSelectedBodyIndices(sel.Rigidbody); + } + if (selectiveJointCheck.Checked) + { + view.SetSelectedJointIndices(sel.Joint); + } view.UpdateView(); } + private Selection[] GetSelectedFromList() + { + Selection[] output = new Selection[storedList.SelectedItems.Count]; + for(int i = 0; i < output.Length; ++i) + { + output[i] = (Selection)storedList.SelectedItems[i].Tag; + } + return output; + } + + private void UpdateIndices() + { + foreach(ListViewItem item in storedList.Items) + { + item.Text = item.Index.ToString(); + } + } + + #region Event handlers + private void storedList_SelectedIndexChanged(object sender, EventArgs e) + { + unionButton.Enabled = intersectButton.Enabled = differenceButton.Enabled = storedList.SelectedItems.Count > 1; + deleteButton.Enabled = renameButton.Enabled = storedList.SelectedItems.Count > 0; + nameText.Text = storedList.SelectedItems.Count > 0 ? ((Selection)storedList.SelectedItems[0].Tag).Name : ""; + } + private void storeCurrentButton_Click(object sender, EventArgs e) { AddCurrentSelection(); @@ -75,25 +121,183 @@ private void restoreButton_Click(object sender, EventArgs e) private void renameButton_Click(object sender, EventArgs e) { - if (storedList.SelectedItems.Count <= 0) - return; - Selection sel = (Selection)storedList.SelectedItems[0].Tag; - sel.Name = nameText.Text; - PopulateList(); + foreach(ListViewItem item in storedList.SelectedItems) + { + item.SubItems[0].Text = ((Selection)item.Tag).Name = nameText.Text; + } } private void deleteButton_Click(object sender, EventArgs e) { - if (storedList.SelectedItems.Count <= 0) - return; - Selection sel = (Selection)storedList.SelectedItems[0].Tag; - _storage.Remove(sel); - PopulateList(); + foreach(ListViewItem item in storedList.SelectedItems) + { + storedList.Items.Remove(item); + } } private void exportToFileToolStripMenuItem_Click(object sender, EventArgs e) { } + + private void unionButton_Click(object sender, EventArgs e) + { + Selection[] operands = GetSelectedFromList(); + if (operands.Length < 2) return; + Selection union = Selection.Union(operands); + union.Name = operands.Length > 2 ? string.Format("Union of {0} selections", operands.Length) : string.Format("Union of {0} and {1}", operands[0].Name, operands[1].Name); + AddSelection(union); + } + + private void intersectButton_Click(object sender, EventArgs e) + { + Selection[] operands = GetSelectedFromList(); + if (operands.Length < 2) return; + Selection intersect = Selection.Intersect(operands); + intersect.Name = operands.Length > 2 ? string.Format("Intersect of {0} selections", operands.Length) : string.Format("Intersect of {0} and {1}", operands[0].Name, operands[1].Name); + AddSelection(intersect); + } + + private void differenceButton_Click(object sender, EventArgs e) + { + Selection[] operands = GetSelectedFromList(); + if (operands.Length < 2) return; + Selection difference = Selection.Except(operands); + difference.Name = operands.Length > 2 ? string.Format("Difference of {0} and {1} others", operands[0].Name, operands.Length - 1) : string.Format("Difference of {0} and {1}", operands[0].Name, operands[1].Name); + AddSelection(difference); + } + + private void moveUpButton_Click(object sender, EventArgs e) + { + foreach(ListViewItem item in storedList.SelectedItems) + { + if(item.Index > 0) + { + int index = item.Index - 1; + storedList.Items.RemoveAt(item.Index); + storedList.Items.Insert(index, item); + } + } + } + + private void moveDownButton_Click(object sender, EventArgs e) + { + for(int i = storedList.SelectedItems.Count - 1; i >= 0; --i) + { + ListViewItem item = storedList.SelectedItems[i]; + if (item.Index < storedList.Items.Count - 1) + { + int index = item.Index + 1; + storedList.Items.RemoveAt(item.Index); + storedList.Items.Insert(index, item); + } + } + } + + private void complementButton_Click(object sender, EventArgs e) + { + // Given the sets A, B, C, U where U = selection of every item + // produces the set O = U \ (A u B u C) + + PEPlugin.View.IPXPmxViewConnector view = _args.Host.Connector.View.PmxView; + + // Get U + Selection universe = new Selection(); + + } + + private void selectiveCheck_Click(object sender, EventArgs e) + { + if (selectiveVertexCheck.Checked && selectiveTriangleCheck.Checked && selectiveBoneCheck.Checked && selectiveRigidbodyCheck.Checked && selectiveJointCheck.Checked) + { + selectiveAllCheck.CheckState = CheckState.Checked; + } + else if (selectiveVertexCheck.Checked || selectiveTriangleCheck.Checked || selectiveBoneCheck.Checked || selectiveRigidbodyCheck.Checked || selectiveJointCheck.Checked) + { + selectiveAllCheck.CheckState = CheckState.Indeterminate; + } + else + { + selectiveAllCheck.CheckState = CheckState.Unchecked; + } + } + + private void selectiveAllCheck_Click(object sender, EventArgs e) + { + selectiveVertexCheck.Checked = selectiveTriangleCheck.Checked = selectiveBoneCheck.Checked = selectiveRigidbodyCheck.Checked = selectiveJointCheck.Checked = ((CheckBox)sender).CheckState == CheckState.Checked; + } + + #endregion + + private void cloneButton_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in storedList.SelectedItems) + { + Selection clone = (Selection)((Selection)item.Tag).Clone(); + clone.Name += " copy"; + AddSelection(clone); + } + } + + private void trimButton_Click(object sender, EventArgs e) + { + if (_trimForm == null) + _trimForm = new TrimForm(); + TrimOptions options = TrimOptions.None; + if (!selectiveVertexCheck.Checked) options |= TrimOptions.Vertex; + if (!selectiveTriangleCheck.Checked) options |= TrimOptions.Triangle; + if (!selectiveBoneCheck.Checked) options |= TrimOptions.Bone; + if (!selectiveRigidbodyCheck.Checked) options |= TrimOptions.Rigidbody; + if (!selectiveJointCheck.Checked) options |= TrimOptions.Joint; + + TrimOptions result = _trimForm.Display(options); + if (result.HasFlag(TrimOptions.Cancel)) + return; + + foreach(ListViewItem item in storedList.SelectedItems) + { + Selection sel; + if (result.HasFlag(TrimOptions.Clone)) + { + sel = (Selection)((Selection)item.Tag).Clone(); + sel.Name += " trim"; + } + else + { + sel = (Selection)item.Tag; + } + + if (result.HasFlag(TrimOptions.Vertex)) + { + sel.Vertex = new int[0]; + item.SubItems[2].Text = "0"; + } + if (result.HasFlag(TrimOptions.Triangle)) + { + sel.Triangle = new int[0]; + item.SubItems[3].Text = "0"; + } + if (result.HasFlag(TrimOptions.Bone)) + { + sel.Bone = new int[0]; + item.SubItems[4].Text = "0"; + } + if (result.HasFlag(TrimOptions.Rigidbody)) + { + sel.Rigidbody = new int[0]; + item.SubItems[5].Text = "0"; + } + if (result.HasFlag(TrimOptions.Joint)) + { + sel.Joint = new int[0]; + item.SubItems[6].Text = "0"; + } + + if(result.HasFlag(TrimOptions.Clone)) + { + AddSelection(sel); + } + } + } } } diff --git a/WPlugins.SelectionStorage/SelectionStorageForm.resx b/WPlugins.SelectionStorage/SelectionStorageForm.resx index 9a2a116..98a6494 100644 --- a/WPlugins.SelectionStorage/SelectionStorageForm.resx +++ b/WPlugins.SelectionStorage/SelectionStorageForm.resx @@ -126,7 +126,52 @@ 132, 17 + + 310, 17 + + + + iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + xAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAbeSURBVHhe7Zt3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RNcZoeiSls+WOMDZWhoHfYmvOfMlT + w4xSrQ1/s4H/5MAWWub5+GxRKfwlWdxkt/dDkutsT2H6inaEOT06OLyjTHAi+xDfl+w2IQ7TbKQhLXmQ + F3mSN71Dfot/2Xh9sWwU0Ovir8JuEbajzJJsXJwhKSwrxbzffr0yHud2kuE3aUhLHuRFnuTN05ZT7zQi + IiIiIgKaNPkfVSLIN7+GJloAAAAASUVORK5CYII= + + + + 455, 17 + + + 455, 17 + AAABAAEAgIAAAAEAIAAoCAEAFgAAACgAAACAAAAAAAEAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA diff --git a/WPlugins.SelectionStorage/TrimForm.Designer.cs b/WPlugins.SelectionStorage/TrimForm.Designer.cs new file mode 100644 index 0000000..4a7bbfc --- /dev/null +++ b/WPlugins.SelectionStorage/TrimForm.Designer.cs @@ -0,0 +1,368 @@ +namespace WPlugins.SelectionStorage +{ + partial class TrimForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panel1 = new System.Windows.Forms.Panel(); + this.keepVertices = new System.Windows.Forms.RadioButton(); + this.label1 = new System.Windows.Forms.Label(); + this.removeVertices = new System.Windows.Forms.RadioButton(); + this.panel3 = new System.Windows.Forms.Panel(); + this.removeTriangles = new System.Windows.Forms.RadioButton(); + this.label3 = new System.Windows.Forms.Label(); + this.keepTriangles = new System.Windows.Forms.RadioButton(); + this.panel4 = new System.Windows.Forms.Panel(); + this.removeBones = new System.Windows.Forms.RadioButton(); + this.label4 = new System.Windows.Forms.Label(); + this.keepBones = new System.Windows.Forms.RadioButton(); + this.panel5 = new System.Windows.Forms.Panel(); + this.removeRigidbodies = new System.Windows.Forms.RadioButton(); + this.label5 = new System.Windows.Forms.Label(); + this.keepRigidbodies = new System.Windows.Forms.RadioButton(); + this.panel6 = new System.Windows.Forms.Panel(); + this.removeJoints = new System.Windows.Forms.RadioButton(); + this.label6 = new System.Windows.Forms.Label(); + this.keepJoints = new System.Windows.Forms.RadioButton(); + this.label2 = new System.Windows.Forms.Label(); + this.cancelButton = new System.Windows.Forms.Button(); + this.trimCloneButton = new System.Windows.Forms.Button(); + this.trimButton = new System.Windows.Forms.Button(); + this.panel1.SuspendLayout(); + this.panel3.SuspendLayout(); + this.panel4.SuspendLayout(); + this.panel5.SuspendLayout(); + this.panel6.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Controls.Add(this.removeVertices); + this.panel1.Controls.Add(this.label1); + this.panel1.Controls.Add(this.keepVertices); + this.panel1.Location = new System.Drawing.Point(12, 34); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(90, 77); + this.panel1.TabIndex = 0; + // + // keepVertices + // + this.keepVertices.Appearance = System.Windows.Forms.Appearance.Button; + this.keepVertices.Checked = true; + this.keepVertices.Location = new System.Drawing.Point(6, 22); + this.keepVertices.Name = "keepVertices"; + this.keepVertices.Size = new System.Drawing.Size(78, 22); + this.keepVertices.TabIndex = 0; + this.keepVertices.TabStop = true; + this.keepVertices.Text = "Keep"; + this.keepVertices.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(5, 6); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(45, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Vertices"; + // + // removeVertices + // + this.removeVertices.Appearance = System.Windows.Forms.Appearance.Button; + this.removeVertices.Location = new System.Drawing.Point(6, 45); + this.removeVertices.Name = "removeVertices"; + this.removeVertices.Size = new System.Drawing.Size(78, 22); + this.removeVertices.TabIndex = 2; + this.removeVertices.Text = "Remove"; + this.removeVertices.UseVisualStyleBackColor = true; + // + // panel3 + // + this.panel3.Controls.Add(this.removeTriangles); + this.panel3.Controls.Add(this.label3); + this.panel3.Controls.Add(this.keepTriangles); + this.panel3.Location = new System.Drawing.Point(102, 34); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(90, 77); + this.panel3.TabIndex = 3; + // + // removeTriangles + // + this.removeTriangles.Appearance = System.Windows.Forms.Appearance.Button; + this.removeTriangles.Location = new System.Drawing.Point(6, 45); + this.removeTriangles.Name = "removeTriangles"; + this.removeTriangles.Size = new System.Drawing.Size(78, 22); + this.removeTriangles.TabIndex = 2; + this.removeTriangles.Text = "Remove"; + this.removeTriangles.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(5, 6); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(36, 13); + this.label3.TabIndex = 1; + this.label3.Text = "Faces"; + // + // keepTriangles + // + this.keepTriangles.Appearance = System.Windows.Forms.Appearance.Button; + this.keepTriangles.Checked = true; + this.keepTriangles.Location = new System.Drawing.Point(6, 22); + this.keepTriangles.Name = "keepTriangles"; + this.keepTriangles.Size = new System.Drawing.Size(78, 22); + this.keepTriangles.TabIndex = 0; + this.keepTriangles.TabStop = true; + this.keepTriangles.Text = "Keep"; + this.keepTriangles.UseVisualStyleBackColor = true; + // + // panel4 + // + this.panel4.Controls.Add(this.removeBones); + this.panel4.Controls.Add(this.label4); + this.panel4.Controls.Add(this.keepBones); + this.panel4.Location = new System.Drawing.Point(192, 34); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(90, 77); + this.panel4.TabIndex = 3; + // + // removeBones + // + this.removeBones.Appearance = System.Windows.Forms.Appearance.Button; + this.removeBones.Location = new System.Drawing.Point(6, 45); + this.removeBones.Name = "removeBones"; + this.removeBones.Size = new System.Drawing.Size(78, 22); + this.removeBones.TabIndex = 2; + this.removeBones.Text = "Remove"; + this.removeBones.UseVisualStyleBackColor = true; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(5, 6); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(37, 13); + this.label4.TabIndex = 1; + this.label4.Text = "Bones"; + // + // keepBones + // + this.keepBones.Appearance = System.Windows.Forms.Appearance.Button; + this.keepBones.Checked = true; + this.keepBones.Location = new System.Drawing.Point(6, 22); + this.keepBones.Name = "keepBones"; + this.keepBones.Size = new System.Drawing.Size(78, 22); + this.keepBones.TabIndex = 0; + this.keepBones.TabStop = true; + this.keepBones.Text = "Keep"; + this.keepBones.UseVisualStyleBackColor = true; + // + // panel5 + // + this.panel5.Controls.Add(this.removeRigidbodies); + this.panel5.Controls.Add(this.label5); + this.panel5.Controls.Add(this.keepRigidbodies); + this.panel5.Location = new System.Drawing.Point(282, 34); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(90, 77); + this.panel5.TabIndex = 3; + // + // removeRigidbodies + // + this.removeRigidbodies.Appearance = System.Windows.Forms.Appearance.Button; + this.removeRigidbodies.Location = new System.Drawing.Point(6, 45); + this.removeRigidbodies.Name = "removeRigidbodies"; + this.removeRigidbodies.Size = new System.Drawing.Size(78, 22); + this.removeRigidbodies.TabIndex = 2; + this.removeRigidbodies.Text = "Remove"; + this.removeRigidbodies.UseVisualStyleBackColor = true; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(5, 6); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(65, 13); + this.label5.TabIndex = 1; + this.label5.Text = "Rigid bodies"; + // + // keepRigidbodies + // + this.keepRigidbodies.Appearance = System.Windows.Forms.Appearance.Button; + this.keepRigidbodies.Checked = true; + this.keepRigidbodies.Location = new System.Drawing.Point(6, 22); + this.keepRigidbodies.Name = "keepRigidbodies"; + this.keepRigidbodies.Size = new System.Drawing.Size(78, 22); + this.keepRigidbodies.TabIndex = 0; + this.keepRigidbodies.TabStop = true; + this.keepRigidbodies.Text = "Keep"; + this.keepRigidbodies.UseVisualStyleBackColor = true; + // + // panel6 + // + this.panel6.Controls.Add(this.removeJoints); + this.panel6.Controls.Add(this.label6); + this.panel6.Controls.Add(this.keepJoints); + this.panel6.Location = new System.Drawing.Point(372, 34); + this.panel6.Name = "panel6"; + this.panel6.Size = new System.Drawing.Size(90, 77); + this.panel6.TabIndex = 3; + // + // removeJoints + // + this.removeJoints.Appearance = System.Windows.Forms.Appearance.Button; + this.removeJoints.Location = new System.Drawing.Point(6, 45); + this.removeJoints.Name = "removeJoints"; + this.removeJoints.Size = new System.Drawing.Size(78, 22); + this.removeJoints.TabIndex = 2; + this.removeJoints.Text = "Remove"; + this.removeJoints.UseVisualStyleBackColor = true; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(5, 6); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(34, 13); + this.label6.TabIndex = 1; + this.label6.Text = "Joints"; + // + // keepJoints + // + this.keepJoints.Appearance = System.Windows.Forms.Appearance.Button; + this.keepJoints.Checked = true; + this.keepJoints.Location = new System.Drawing.Point(6, 22); + this.keepJoints.Name = "keepJoints"; + this.keepJoints.Size = new System.Drawing.Size(78, 22); + this.keepJoints.TabIndex = 0; + this.keepJoints.TabStop = true; + this.keepJoints.Text = "Keep"; + this.keepJoints.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(9, 9); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(434, 13); + this.label2.TabIndex = 4; + this.label2.Text = "By trimming the selection, you can remove unwanted object types. This cannot be u" + + "ndone."; + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.Location = new System.Drawing.Point(388, 118); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 23); + this.cancelButton.TabIndex = 5; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); + // + // trimCloneButton + // + this.trimCloneButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.trimCloneButton.Location = new System.Drawing.Point(307, 118); + this.trimCloneButton.Name = "trimCloneButton"; + this.trimCloneButton.Size = new System.Drawing.Size(75, 23); + this.trimCloneButton.TabIndex = 6; + this.trimCloneButton.Text = "Trim clone"; + this.trimCloneButton.UseVisualStyleBackColor = true; + this.trimCloneButton.Click += new System.EventHandler(this.trimCloneButton_Click); + // + // trimButton + // + this.trimButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.trimButton.Location = new System.Drawing.Point(226, 118); + this.trimButton.Name = "trimButton"; + this.trimButton.Size = new System.Drawing.Size(75, 23); + this.trimButton.TabIndex = 7; + this.trimButton.Text = "Trim original"; + this.trimButton.UseVisualStyleBackColor = true; + this.trimButton.Click += new System.EventHandler(this.trimButton_Click); + // + // TrimForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(475, 153); + this.Controls.Add(this.trimButton); + this.Controls.Add(this.trimCloneButton); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.label2); + this.Controls.Add(this.panel3); + this.Controls.Add(this.panel4); + this.Controls.Add(this.panel5); + this.Controls.Add(this.panel6); + this.Controls.Add(this.panel1); + this.Name = "TrimForm"; + this.Text = "TrimForm"; + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.panel4.ResumeLayout(false); + this.panel4.PerformLayout(); + this.panel5.ResumeLayout(false); + this.panel5.PerformLayout(); + this.panel6.ResumeLayout(false); + this.panel6.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.RadioButton removeVertices; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.RadioButton keepVertices; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.RadioButton removeTriangles; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.RadioButton keepTriangles; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.RadioButton removeBones; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.RadioButton keepBones; + private System.Windows.Forms.Panel panel5; + private System.Windows.Forms.RadioButton removeRigidbodies; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.RadioButton keepRigidbodies; + private System.Windows.Forms.Panel panel6; + private System.Windows.Forms.RadioButton removeJoints; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.RadioButton keepJoints; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.Button trimCloneButton; + private System.Windows.Forms.Button trimButton; + } +} \ No newline at end of file diff --git a/WPlugins.SelectionStorage/TrimForm.cs b/WPlugins.SelectionStorage/TrimForm.cs new file mode 100644 index 0000000..8d0e718 --- /dev/null +++ b/WPlugins.SelectionStorage/TrimForm.cs @@ -0,0 +1,74 @@ +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; + +namespace WPlugins.SelectionStorage +{ + /// + /// Having a bit in the 1st to 5th place set means that the type should be removed. + /// + [Flags] + public enum TrimOptions { None = 0, Vertex = 1, Triangle = 2, Bone = 4, Rigidbody = 8, Joint = 16, Clone = 32, Cancel = 64 } + + public partial class TrimForm : Form + { + private TrimOptions _options = TrimOptions.None; + + public TrimForm() + { + InitializeComponent(); + } + + // Pass the options, then call ShowDialog + public TrimOptions Display(TrimOptions options) + { + _options = options; + keepVertices.Checked = !(removeVertices.Checked = _options.HasFlag(TrimOptions.Vertex)); + keepTriangles.Checked = !(removeTriangles.Checked = _options.HasFlag(TrimOptions.Triangle)); + keepBones.Checked = !(removeBones.Checked = _options.HasFlag(TrimOptions.Bone)); + keepRigidbodies.Checked = !(removeRigidbodies.Checked = _options.HasFlag(TrimOptions.Rigidbody)); + keepJoints.Checked = !(removeJoints.Checked = _options.HasFlag(TrimOptions.Joint)); + + ShowDialog(); + // This thread should be blocked at this point. + // Control returns here when the form is closed. + return _options; + } + + private void cancelButton_Click(object sender, EventArgs e) + { + _options = TrimOptions.Cancel; + Close(); + } + + private void trimButton_Click(object sender, EventArgs e) + { + _options = TrimOptions.None; + + if (removeVertices.Checked) _options |= TrimOptions.Vertex; + if (removeTriangles.Checked) _options |= TrimOptions.Triangle; + if (removeBones.Checked) _options |= TrimOptions.Bone; + if (removeRigidbodies.Checked) _options |= TrimOptions.Rigidbody; + if (removeJoints.Checked) _options |= TrimOptions.Joint; + Close(); + } + + private void trimCloneButton_Click(object sender, EventArgs e) + { + _options = TrimOptions.Clone; + + if (removeVertices.Checked) _options |= TrimOptions.Vertex; + if (removeTriangles.Checked) _options |= TrimOptions.Triangle; + if (removeBones.Checked) _options |= TrimOptions.Bone; + if (removeRigidbodies.Checked) _options |= TrimOptions.Rigidbody; + if (removeJoints.Checked) _options |= TrimOptions.Joint; + Close(); + } + } +} diff --git a/WPlugins.SelectionStorage/TrimForm.resx b/WPlugins.SelectionStorage/TrimForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/WPlugins.SelectionStorage/TrimForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WPlugins.SelectionStorage/WPlugins.SelectionStorage.csproj b/WPlugins.SelectionStorage/WPlugins.SelectionStorage.csproj index fd812e9..ec61216 100644 --- a/WPlugins.SelectionStorage/WPlugins.SelectionStorage.csproj +++ b/WPlugins.SelectionStorage/WPlugins.SelectionStorage.csproj @@ -48,6 +48,11 @@ + + True + True + Resources.resx + Form @@ -55,6 +60,12 @@ SelectionStorageForm.cs + + Form + + + TrimForm.cs + @@ -63,12 +74,44 @@ + + ResXFileCodeGenerator + Resources.Designer.cs + SelectionStorageForm.cs + + TrimForm.cs + + + + + + + + + + + + + + + + + + + + + + + + + - xcopy "$(TargetPath)" "H:\MMD\PMX Editor\PmxEditor\_plugin\User\WPlugins" /Y /Q + xcopy "$(TargetPath)" "H:\MMD\PMX Editor\PmxEditor\_plugin\User\WPlugins" /Y /Q +xcopy "$(TargetDir)$(TargetName).pdb" "H:\MMD\PMX Editor\PmxEditor\_plugin\User\WPlugins" /Y /Q \ No newline at end of file