Cleanup and rename of ImportProcessor
MODIFY
package/com.unity.formats.usd/Runtime/Scripts/IO/ImportProcessor/CombineMeshes.cs
package/com.unity.formats.usd/Runtime/Scripts/IO/ImportProcessor/CombineMeshes.cs
@@ -7,11 +7,11 @@ using pxr;
//possibly move this to Examples
// also not sure how well this will work with reloads or anim..
namespace Unity.Formats.USD {
- public class CombineMeshes : RegexImportProcessor, IImportProcessGeometry {
+ public class CombineMeshes : RegexImportProcessor, IImportPostProcessGeometry {
const int VERTEX_LIMIT = 65534;
public bool enforceU16VertexLimit;
- public void ProcessGeometry(PrimMap primMap)
+ public void PostProcessGeometry(PrimMap primMap)
{
InitRegex();
@@ -25,7 +25,7 @@ namespace Unity.Formats.USD {
void Reset()
{
- expression = "Geom";
+ matchExpression = "Geom";
isNot = false;
matchType = EMatchType.Wildcard;
compareAgainst = ECompareAgainst.UsdName;

MODIFY
package/com.unity.formats.usd/Runtime/Scripts/IO/ImportProcessor/ImportProcessor.cs
package/com.unity.formats.usd/Runtime/Scripts/IO/ImportProcessor/ImportProcessor.cs
@@ -6,17 +6,21 @@ using Unity.Formats.USD;
using pxr;
namespace Unity.Formats.USD {
- public interface IImportProcessUsd
+ // happens while hierarchy is loading
+ public interface IImportProcessSdfPath
{
- void ProcessUsd(PrimMap primMap);
+ bool ProcessSdfPath(SdfPath sdfPath);
}
- public interface IImportProcessPrimMap
+
+ // happens after GameObject Hierarchy created
+ public interface IImportPostProcessHierarchy
{
- void ProcessPrimMap(PrimMap primMap);
+ void PostProcessHierarchy(PrimMap primMap);
}
- public interface IImportProcessGeometry
+ // happens after GameObject Hierarchy created and Geometry created
+ public interface IImportPostProcessGeometry
{
- void ProcessGeometry(PrimMap primMap);
+ void PostProcessGeometry(PrimMap primMap);
}
}
\ No newline at end of file

MODIFY
package/com.unity.formats.usd/Runtime/Scripts/IO/ImportProcessor/RegexImportProcessor.cs
package/com.unity.formats.usd/Runtime/Scripts/IO/ImportProcessor/RegexImportProcessor.cs
@@ -18,7 +18,7 @@ namespace Unity.Formats.USD
public bool isNot = false;
- public string expression = "*";
+ public string matchExpression = "*";
private Regex m_regex;
protected bool IsMatch(SdfPath sdfPath)
@@ -32,10 +32,10 @@ namespace Unity.Formats.USD
switch (matchType)
{
case EMatchType.Wildcard:
- m_regex = new Regex(WildcardToRegex(expression));
+ m_regex = new Regex(WildcardToRegex(matchExpression));
break;
case EMatchType.Regex:
- m_regex = new Regex(expression);
+ m_regex = new Regex(matchExpression);
break;
}
}

MODIFY
package/com.unity.formats.usd/Runtime/Scripts/IO/ImportProcessor/SetHideFlags.cs
package/com.unity.formats.usd/Runtime/Scripts/IO/ImportProcessor/SetHideFlags.cs
@@ -7,10 +7,10 @@ using pxr;
//possibly move this to Examples
namespace Unity.Formats.USD
{
- public class SetHideFlags : RegexImportProcessor, IImportProcessPrimMap
+ public class SetHideFlags : RegexImportProcessor, IImportPostProcessHierarchy
{
public HideFlags hideFlagsSettings = HideFlags.DontSave;
- public void ProcessPrimMap(PrimMap primMap)
+ public void PostProcessHierarchy(PrimMap primMap)
{
InitRegex();
@@ -24,7 +24,7 @@ namespace Unity.Formats.USD
void Reset()
{
- expression = "/";
+ matchExpression = "/";
isNot = true;
matchType = EMatchType.Wildcard;
compareAgainst = ECompareAgainst.UsdName;

MODIFY
package/com.unity.formats.usd/Runtime/Scripts/IO/Scene/SceneImporter.cs
package/com.unity.formats.usd/Runtime/Scripts/IO/Scene/SceneImporter.cs
@@ -61,23 +61,6 @@ namespace Unity.Formats.USD {
/// </summary>
public static IImporter ActiveMeshImporter;
- public delegate void ImportNotice(PrimMap primMap,
- Scene usdScene,
- pxr.SdfPath usdPrimRoot,
- GameObject unityRoot,
- SceneImportOptions importOptions);
-
- /// <summary>
- /// Executes after the PrimMap has been constructed and before import.
- /// </summary>
- public static event ImportNotice AfterBuildPrimMap;
-
- /// <summary>
- /// Executes after the entire import process (BuildScene) completes. Note that this event may
- /// fire after several frames, when the coroutine overload of BuildScene is used.
- /// </summary>
- public static event ImportNotice AfterImport;
-
static SceneImporter() {
SceneImporter.ActiveMeshImporter = new MeshImportStrategy(
MeshImporter.BuildMesh,
@@ -338,14 +321,10 @@ namespace Unity.Formats.USD {
if (ShouldYield(targetTime, timer)) { yield return null; ResetTimer(timer); }
- Profiler.BeginSample("USD: AfterBuildPrimMap");
- if (AfterBuildPrimMap != null) {
- AfterBuildPrimMap(primMap, scene, usdPrimRoot, root, importOptions);
- }
-
- foreach( var processor in root.GetComponents<IImportProcessPrimMap>())
+ Profiler.BeginSample("USD: PostProcessHierarchy");
+ foreach( var processor in root.GetComponents<IImportPostProcessHierarchy>())
{
- processor.ProcessPrimMap(primMap);
+ processor.PostProcessHierarchy(primMap);
}
Profiler.EndSample();
@@ -934,17 +913,10 @@ namespace Unity.Formats.USD {
}
Profiler.EndSample();
- //
- // AfterImport callback.
- //
- Profiler.BeginSample("AfterImport callback");
- if (AfterImport != null) {
- AfterImport(primMap, scene, usdPrimRoot, root, importOptions);
- }
- Debug.LogError("IImportProcessGeometry");
- foreach( var processor in root.GetComponents<IImportProcessGeometry>())
+ Profiler.BeginSample("USD: PostProcessGeometry");
+ foreach( var processor in root.GetComponents<IImportPostProcessGeometry>())
{
- processor.ProcessGeometry(primMap);
+ processor.PostProcessGeometry(primMap);
}
Profiler.EndSample();
}

Cleanup and rename of ImportProcessor