Skip to content

Commit

Permalink
Merge from 'develop' into 'main' for CLOiSim-4.5.2 (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunseok-yang authored May 7, 2024
2 parents 25727e2 + 8018beb commit c9632b0
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 23 deletions.
1 change: 1 addition & 0 deletions Assets/Resources/Shader/Segmentation.shader
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Shader "Sensor/Segmentation"
{
Name "Segmentation"

Cull Off // Disable backface culling

HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
Expand Down
1 change: 0 additions & 1 deletion Assets/Scripts/Core/ObjectSpawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ private IEnumerator SpawnTargetObject(PropsType type, Vector3 position, Vector3
// var propTypeName = (type.ToString() + scale.ToString()).Trim();
// Debug.Log(propTypeName);
SegmentationManager.AttachTag(type.ToString(), spawnedObject);

Main.SegmentationManager.UpdateTags();
}

Expand Down
39 changes: 20 additions & 19 deletions Assets/Scripts/Tools/SDF/Implement/Implement.Visual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ private static void OptimizeMesh(in UE.Transform target)

if (!meshFilterTable.ContainsKey(materialName))
{
var meshFilterSet = new HashSet<UE.MeshFilter>();
meshFilterSet.Add(meshFilter);
var meshFilterSet = new HashSet<UE.MeshFilter>(){
meshFilter
};
meshFilterTable.Add(materialName, meshFilterSet);
}
else
Expand Down Expand Up @@ -73,19 +74,23 @@ private static void OptimizeMesh(in UE.Transform target)
}

var meshFilterList = meshFilterSet.Value.ToArray();
var mergedMesh = SDF2Unity.MergeMeshes(meshFilterList);
if (meshFilterList.Length > 0)
{
var targetParent = meshFilterList[0].transform.parent;
var mergedMesh = SDF2Unity.MergeMeshes(meshFilterList);

var newName = meshFilterSet.Key.Replace("(Instance)", "Combined").Trim();
var newVisualGeometryObject = new UE.GameObject(newName);
var newName = meshFilterSet.Key.Replace("(Instance)", "Combined").Trim();
var newVisualGeometryObject = new UE.GameObject(newName);

var meshFilter = newVisualGeometryObject.AddComponent<UE.MeshFilter>();
mergedMesh.name = newName;
meshFilter.sharedMesh = mergedMesh;
var meshFilter = newVisualGeometryObject.AddComponent<UE.MeshFilter>();
mergedMesh.name = newName;
meshFilter.sharedMesh = mergedMesh;

var meshRenderer = newVisualGeometryObject.AddComponent<UE.MeshRenderer>();
meshRenderer.material = material;
var meshRenderer = newVisualGeometryObject.AddComponent<UE.MeshRenderer>();
meshRenderer.material = material;

newVisualGeometryObject.transform.SetParent(target, true);
newVisualGeometryObject.transform.SetParent(targetParent, true);
}
}
}

Expand All @@ -94,15 +99,11 @@ public static void OptimizeMeshes(in UE.Transform targetTransform)
for (var i = 0; i< targetTransform.childCount; i++)
{
var child = targetTransform.GetChild(i);
var optimizationTarget
= (child.GetComponent<UE.MeshFilter>() == null)
? child : targetTransform;

if (child.GetComponent<UE.MeshFilter>() == null)
{
OptimizeMesh(child);
}
else
{
OptimizeMesh(targetTransform);
}
OptimizeMesh(optimizationTarget);
}
}

Expand Down
1 change: 0 additions & 1 deletion Assets/Scripts/Tools/SDF/Import/Import.Material.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ protected override void ImportMaterial(in SDF.Material sdfMaterial, in System.Ob
// UE.Debug.Log("ImportMaterial HasColorSpecular " + material.GetColor("_SpecColor"));
}


// apply material script
if (sdfMaterial.script != null)
{
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Tools/SDF/Parser/Root.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public void UpdateResourceModelTable()
private void ConvertPathToAbsolutePath(in string targetElement)
{
var nodeList = _doc.SelectNodes($"//{targetElement}");
Console.Write("Target:" + targetElement + ", Num Of uri nodes: " + nodeList.Count);
// Console.Write("Target:" + targetElement + ", Num Of uri nodes: " + nodeList.Count);
foreach (XmlNode node in nodeList)
{
var uri = node.InnerText;
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/UI/ModelImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ void LateUpdate()

SetModelForDeploy(instantiatedObject);
// Debug.Log("Paste " + instantiatedObject.name);

var segmentationTag = instantiatedObject.GetComponentInChildren<SegmentationTag>();
segmentationTag?.Refresh();

Main.SegmentationManager.UpdateTags();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ PlayerSettings:
loadStoreDebugModeEnabled: 0
visionOSBundleVersion: 1.0
tvOSBundleVersion: 1.0
bundleVersion: 4.5.1
bundleVersion: 4.5.2
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down

0 comments on commit c9632b0

Please sign in to comment.