Added a line for the color editing of all parts
Added a color editor to Public Property editor
This commit is contained in:
parent
60045410ce
commit
229931039b
5 changed files with 144 additions and 23 deletions
|
|
@ -101,6 +101,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
private static Type[] allowedTypes =
|
||||
{
|
||||
typeof(double), typeof(int), typeof(char), typeof(string), typeof(bool),
|
||||
typeof(Color),
|
||||
typeof(Vector2), typeof(Vector3),
|
||||
typeof(DirectionVector), typeof(DirectionAxis),
|
||||
typeof(ChildrenSelector),
|
||||
|
|
@ -187,7 +188,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
return row;
|
||||
}
|
||||
|
||||
private static FlowLayoutWidget CreateSettingsRow(string labelText, string toolTipText = null)
|
||||
public static FlowLayoutWidget CreateSettingsRow(string labelText, string toolTipText = null)
|
||||
{
|
||||
var rowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight)
|
||||
{
|
||||
|
|
@ -299,6 +300,19 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
rowContainer = CreateSettingsRow(property, field);
|
||||
}
|
||||
else if (propertyValue is Color color)
|
||||
{
|
||||
var field = new ColorField(theme, object3D.Color);
|
||||
field.Initialize(0);
|
||||
field.ValueChanged += (s, e) =>
|
||||
{
|
||||
property.SetValue(field.Color);
|
||||
object3D?.Invalidate(new InvalidateArgs(context.item, InvalidateType.Properties, undoBuffer));
|
||||
propertyGridModifier?.UpdateControls(new PublicPropertyChange(context, property.PropertyInfo.Name));
|
||||
};
|
||||
|
||||
rowContainer = CreateSettingsRow(property, field);
|
||||
}
|
||||
else if (propertyValue is Vector2 vector2)
|
||||
{
|
||||
var field = new Vector2Field();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue