[Supertux-Commit] r5851 - in trunk/supertux-editor/supertux-editor: . LevelObjects

mmlosh at millhouse.dreamhost.com mmlosh at millhouse.dreamhost.com
Fri Mar 13 13:44:09 PDT 2009


Author: mmlosh
Date: 2009-03-13 13:44:09 -0700 (Fri, 13 Mar 2009)
New Revision: 5851

Modified:
   trunk/supertux-editor/supertux-editor/LevelObjects/Objects.cs
   trunk/supertux-editor/supertux-editor/LevelObjects/SimpleObject.cs
   trunk/supertux-editor/supertux-editor/PropertiesView.cs
   trunk/supertux-editor/supertux-editor/SectorRenderer.cs
Log:
Unrelated to multiselection: "RedrawOnChange" attribute for properties. Used to mark properties that affects appearance of object.


Modified: trunk/supertux-editor/supertux-editor/LevelObjects/Objects.cs
===================================================================
--- trunk/supertux-editor/supertux-editor/LevelObjects/Objects.cs	2009-03-13 19:51:22 UTC (rev 5850)
+++ trunk/supertux-editor/supertux-editor/LevelObjects/Objects.cs	2009-03-13 20:44:09 UTC (rev 5851)
@@ -56,6 +56,7 @@
                 Target = SupertuxObjectAttribute.Usage.LevelOnly)]
 public sealed class MrBomb : SimpleDirObject
 {
+	[PropertyProperties(Tooltip = "File describing \"skin\" for object.", RedrawOnChange = true)]
 	[ChooseResourceSetting]
 	[LispChild("sprite", Optional = true, Default = "")]
 	public string SpriteFile {
@@ -358,7 +359,7 @@
 	private DispenserTypes dispenserType = DispenserTypes.dropper;
 	private List<string> badguy = new List<string>();
 
-	[PropertyProperties(Tooltip = "Type of dispenser to shoot from.")]
+	[PropertyProperties(Tooltip = "Type of dispenser.", RedrawOnChange = true)]
 	[LispChild("type", Optional = true, Default = DispenserTypes.dropper)]
 	public DispenserTypes DispenserType {
 		get {
@@ -655,6 +656,7 @@
                 Target = SupertuxObjectAttribute.Usage.LevelOnly)]
 public sealed class Firefly : SimpleObject
 {
+	[PropertyProperties(Tooltip = "File describing \"skin\" for object.", RedrawOnChange = true)]
 	[ChooseResourceSetting]
 	[LispChild("sprite", Optional = true, Default = "")]
 	public string SpriteFile {
@@ -817,6 +819,7 @@
                 Target = SupertuxObjectAttribute.Usage.LevelOnly)]
 public sealed class Switch : SimpleObject
 {
+	[PropertyProperties(Tooltip = "File describing \"skin\" for object.", RedrawOnChange = true)]
 	[ChooseResourceSetting]
 	[LispChild("sprite")]
 	public string SpriteFile {
@@ -970,6 +973,7 @@
                 Target = SupertuxObjectAttribute.Usage.LevelOnly)]
 public sealed class UnstableTile : SimpleObject
 {
+	[PropertyProperties(Tooltip = "File describing \"skin\" for object.", RedrawOnChange = true)]
 	[ChooseResourceSetting]
 	[LispChild("sprite")]
 	public string SpriteFile {
@@ -1022,6 +1026,7 @@
                 Target = SupertuxObjectAttribute.Usage.LevelOnly)]
 public sealed class Powerup : SimpleObject
 {
+	[PropertyProperties(Tooltip = "File describing \"skin\" for object.", RedrawOnChange = true)]
 	[ChooseResourceSetting]
 	[LispChild("sprite")]
 	public string SpriteFile {
@@ -1054,6 +1059,7 @@
 	[PropertyProperties(Tooltip = ToolTipStrings.ScriptingName)]
 	[LispChild("name")]
 	public string Name = String.Empty;
+	[PropertyProperties(Tooltip = "File describing \"skin\" for object.", RedrawOnChange = true)]
 	[ChooseResourceSetting]
 	[LispChild("sprite")]
 	public string SpriteFile {

Modified: trunk/supertux-editor/supertux-editor/LevelObjects/SimpleObject.cs
===================================================================
--- trunk/supertux-editor/supertux-editor/LevelObjects/SimpleObject.cs	2009-03-13 19:51:22 UTC (rev 5850)
+++ trunk/supertux-editor/supertux-editor/LevelObjects/SimpleObject.cs	2009-03-13 20:44:09 UTC (rev 5851)
@@ -10,10 +10,10 @@
 
 /// <summary>Base class for objects in levels</summary>
 public abstract class SimpleObject : IGameObject, IObject, Node, ICloneable {
-	[PropertyProperties(Tooltip = "X position of object")]
+	[PropertyProperties(Tooltip = "X position of object", RedrawOnChange = true)]
 	[LispChild("x")]
 	public float X;
-	[PropertyProperties(Tooltip = "Y position of object")]
+	[PropertyProperties(Tooltip = "Y position of object", RedrawOnChange = true)]
 	[LispChild("y")]
 	public float Y;
 
@@ -146,7 +146,7 @@
 	/// <summary>
 	/// Direction the badguy will be facing initially.
 	/// </summary>
-	[PropertyProperties(Tooltip = "Direction the badguy will be facing initially.")]
+	[PropertyProperties(Tooltip = "Direction the badguy will be facing initially.", RedrawOnChange = true)]
 	[LispChild("direction", Optional = true, Default = Directions.auto)]
 	public Directions Direction {
 		get {
@@ -172,6 +172,7 @@
 	[PropertyProperties(Tooltip = "If enabled the platform will be moving initially.")]
 	[LispChild("running", Optional = true, Default = true)]
 	public bool Running = true;
+	[PropertyProperties(Tooltip = "File describing \"skin\" for object.", RedrawOnChange = true)]
 	[ChooseResourceSetting]
 	[LispChild("sprite")]
 	public string SpriteFile {
@@ -237,10 +238,10 @@
 /// <summary>Base class for area objects in levels</summary>
 public abstract class SimpleObjectArea : SimpleObject
 {
-	[PropertyProperties(Tooltip = "How wide the object is.")]
+	[PropertyProperties(Tooltip = "How wide the object is.", RedrawOnChange = true)]
 	[LispChild("width")]
 	public float Width = 32;
-	[PropertyProperties(Tooltip = "How high the object is.")]
+	[PropertyProperties(Tooltip = "How high the object is.", RedrawOnChange = true)]
 	[LispChild("height")]
 	public float Height = 32;
 

Modified: trunk/supertux-editor/supertux-editor/PropertiesView.cs
===================================================================
--- trunk/supertux-editor/supertux-editor/PropertiesView.cs	2009-03-13 19:51:22 UTC (rev 5850)
+++ trunk/supertux-editor/supertux-editor/PropertiesView.cs	2009-03-13 20:44:09 UTC (rev 5851)
@@ -18,10 +18,15 @@
 	public string Tooltip = String.Empty;
 
 	/// <summary>
-	/// If true this object is hidden from the <see cref="PropertiesView"/>.
+	/// If true this property is hidden from the <see cref="PropertiesView"/>.
 	/// </summary>
 	public bool Hidden = false;
 
+	/// <summary>
+	/// If true and this property changes, it causes redraw in <see cref="SectorRenderer"/>.
+	/// </summary>
+	public bool RedrawOnChange = false;
+
 	public PropertyPropertiesAttribute() {
 	}
 }

Modified: trunk/supertux-editor/supertux-editor/SectorRenderer.cs
===================================================================
--- trunk/supertux-editor/supertux-editor/SectorRenderer.cs	2009-03-13 19:51:22 UTC (rev 5850)
+++ trunk/supertux-editor/supertux-editor/SectorRenderer.cs	2009-03-13 20:44:09 UTC (rev 5851)
@@ -186,9 +186,11 @@
 
 			QueueDraw();
 		}
-		if (field.Name == "X" || field.Name == "Y") {	//Something has been moved.
+
+		PropertyPropertiesAttribute propertyProperties = (PropertyPropertiesAttribute)
+				field.GetCustomAttribute(typeof(PropertyPropertiesAttribute));
+		if (propertyProperties != null && propertyProperties.RedrawOnChange)	//Every property that affects appearance is marked using this attribute
 			QueueDraw();
-		}
 	}
 
 	public void OnSizeChanged(Sector sector)



More information about the Supertux-Commit mailing list