Compare commits

...

1 Commits

Author SHA1 Message Date
Claire Kuang 5e93f23d06 remove new app id on passthrough nodes (#964)
.NET Build and Publish / build-windows (push) Has been cancelled
.NET Build and Publish / build-linux (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
2025-07-03 14:25:40 +01:00
3 changed files with 7 additions and 32 deletions
@@ -84,9 +84,6 @@ public class SpeckleBlockDefinitionPassthrough : GH_Component
return;
}
// keep track of mutation
bool mutated = false;
// process the definition
// deep copy so we don't mutate the object
SpeckleBlockDefinitionWrapperGoo result = inputDefinition != null ? new(inputDefinition.Value.DeepCopy()) : new();
@@ -109,7 +106,6 @@ public class SpeckleBlockDefinitionPassthrough : GH_Component
result.Value.Objects = processedObjects;
result.Value.InstanceDefinitionProxy.objects = processedObjects.Select(o => o.ApplicationId!).ToList(); // TODO: this could also be set at the same time as `Objects` on the definition wrapper.
mutated = true;
}
// process name
@@ -122,13 +118,10 @@ public class SpeckleBlockDefinitionPassthrough : GH_Component
}
result.Value.Name = inputName;
mutated = true;
}
// process application Id. Use a new appId if mutated, or if this is a new object
result.Value.ApplicationId = mutated
? Guid.NewGuid().ToString()
: result.Value.ApplicationId ?? Guid.NewGuid().ToString();
// no need to process application Id.
// New definitions should have a new appID generated in the new() constructor, and we want to preserve old appID otherwise for changetracking.
// set outputs
da.SetData(0, result);
@@ -151,12 +151,8 @@ public class SpeckleBlockInstancePassthrough : GH_Component
SpeckleMaterialWrapperGoo? inputMaterial = null;
da.GetData(6, ref inputMaterial);
// keep track of mutation
// poc: we should not mark mutations on color or material, as this shouldn't affect the appId of the object, and will allow original display values to stay intact on send.
bool mutated = false;
// process the instance
// deep copy so we don't mutate the object
// deep copy so we don't mutate the incoming object
SpeckleBlockInstanceWrapperGoo result =
inputInstance != null ? new((SpeckleBlockInstanceWrapper)inputInstance.Value.DeepCopy()) : new();
@@ -164,7 +160,6 @@ public class SpeckleBlockInstancePassthrough : GH_Component
if (inputDefinition != null)
{
result.Value.Definition = inputDefinition.Value;
mutated = true;
}
// Process transform
@@ -174,7 +169,6 @@ public class SpeckleBlockInstancePassthrough : GH_Component
if (extractedTransform.HasValue)
{
result.Value.Transform = extractedTransform.Value;
mutated = true;
}
else
{
@@ -190,14 +184,12 @@ public class SpeckleBlockInstancePassthrough : GH_Component
if (inputName != null)
{
result.Value.Name = inputName;
mutated = true;
}
// Process properties
if (inputProperties != null)
{
result.Value.Properties = inputProperties;
mutated = true;
}
// process color (no mutation)
@@ -212,10 +204,8 @@ public class SpeckleBlockInstancePassthrough : GH_Component
result.Value.Material = inputMaterial.Value;
}
// Generate new ApplicationId if mutated
result.Value.ApplicationId = mutated
? Guid.NewGuid().ToString()
: result.Value.ApplicationId ?? Guid.NewGuid().ToString();
// no need to process application id.
// new appids are generated if this is a new object, otherwise the input object appID should be preserved for change tracking.
// Set outputs
da.SetData(0, result);
@@ -155,10 +155,6 @@ public class SpeckleObjectPassthrough : GH_Component
SpeckleMaterialWrapperGoo? inputMaterial = null;
da.GetData(5, ref inputMaterial);
// keep track of mutation
// poc: we should not mark mutations on color or material, as this shouldn't affect the appId of the object, and will allow original display values to stay intact on send.
bool mutated = false;
// process geometry
// deep copy so we don't mutate the input geo which may be speckle objects
if (inputGeometry != null)
@@ -189,8 +185,6 @@ public class SpeckleObjectPassthrough : GH_Component
result.Base = mutatingGeo.Base;
result.GeometryBase = mutatingGeo.GeometryBase;
}
mutated = true;
}
else
{
@@ -206,14 +200,12 @@ public class SpeckleObjectPassthrough : GH_Component
if (inputName != null)
{
result!.Name = inputName;
mutated = true;
}
// process properties
if (inputProperties != null)
{
result!.Properties = inputProperties;
mutated = true;
}
// process color (no mutation)
@@ -228,8 +220,8 @@ public class SpeckleObjectPassthrough : GH_Component
result!.Material = inputMaterial.Value;
}
// process application Id. Use a new appId if mutated, or if this is a new object
result!.ApplicationId = mutated ? Guid.NewGuid().ToString() : result!.ApplicationId ?? Guid.NewGuid().ToString();
// no need to process application Id.
// New definitions should have a new appID generated in the new() constructor, and we want to preserve old appID otherwise for changetracking.
// get the path
string path =