Rebuilding happing correctly again

This commit is contained in:
LarsBrubaker 2021-06-20 14:31:08 -07:00
parent 6ebc9188c9
commit 4327013216
5 changed files with 25 additions and 16 deletions

View file

@ -196,10 +196,10 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
{
await Rebuild();
}
//else if (SheetObject3D.NeedsRebuild(this, invalidateArgs))
//{
// await Rebuild();
//}
else if (SheetObject3D.NeedsRebuild(this, invalidateArgs))
{
await Rebuild();
}
else
{
base.OnInvalidate(invalidateArgs);

View file

@ -120,7 +120,7 @@ namespace MatterHackers.MatterControl.DesignTools
{
foreach (var cell in row.Cells)
{
if (cell.Name == cellId)
if (cellId.Equals(cell.Name, StringComparison.OrdinalIgnoreCase))
{
return cell;
}
@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl.DesignTools
{
for (int i = 0; i < row.Cells.Count; i++)
{
if (row.Cells[i].Name == cellId)
if (cellId.Equals(row.Cells[i].Name, StringComparison.OrdinalIgnoreCase))
{
row.Cells[i] = value;
}
@ -270,7 +270,7 @@ namespace MatterHackers.MatterControl.DesignTools
}
constants.Add(CellId(xyc.x, xyc.y).ToLower(), value);
if (!string.IsNullOrEmpty(xyc.cell.Name?.ToLower()))
if (!string.IsNullOrEmpty(xyc.cell.Name))
{
constants.Add(xyc.cell.Name.ToLower(), value);
}

View file

@ -320,17 +320,20 @@ namespace MatterHackers.MatterControl.DesignTools
// Check if the sheet is the first sheet parent of this item (if not it will not change it's data).
if (Find(itemToCheck) == sheet)
{
// Find all the OrReference properties on this item and check if any start with an '='.
foreach (var property in PublicPropertyEditor.GetEditablePropreties(itemToCheck))
foreach (var item in itemToCheck.DescendantsAndSelf())
{
var propertyValue = property.Value;
if (propertyValue is IDirectOrExpression directOrExpression)
// Find all the OrReference properties on this item and check if any start with an '='.
foreach (var property in PublicPropertyEditor.GetEditablePropreties(item))
{
if (directOrExpression.Expression.StartsWith("="))
var propertyValue = property.Value;
if (propertyValue is IDirectOrExpression directOrExpression)
{
// WIP: check if the value has actually changed, this will update every object on any cell change
return true;
if (directOrExpression.Expression.StartsWith("="))
{
// WIP: check if the value has actually changed, this will update every object on any cell change
return true;
}
}
}
}

View file

@ -326,7 +326,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
field.ClearUndoHistory();
field.Content.Descendants<InternalNumberEdit>().First().MaxDecimalsPlaces = 3;
var row = new SettingsRow(cell.Name == null ? cellId : cell.Name, cell.Name, field.Content, theme);
field.ValueChanged += (s, e) =>
{
cell.Expression = field.Value;
firtSheet.SheetData.Recalculate();
};
var row = new SettingsRow(cell.Name == null ? cellId : cell.Name, null, field.Content, theme);
editorPanel.AddChild(row);
}