Skip to content

Commit

Permalink
cleanup and code sanity 2
Browse files Browse the repository at this point in the history
  • Loading branch information
emperorofmars committed Dec 11, 2024
1 parent b749d70 commit 5b624b8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
9 changes: 3 additions & 6 deletions AVA/Common/Editor/AVA_Collider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,39 +37,36 @@ public void Process(NNAContext Context, Transform Node, string Name)
if(Regex.Match(Name, _Match_Sphere) is var match && match.Success)
{
Context.AddResultById(
ParseUtil.GetNameComponentId(Node.name),
ParseUtil.GetNameComponentId(Name),
BuildSphereCollider(Context, Node,
match.Groups["inside_bounds"].Success,
float.Parse(match.Groups["radius"].Value[1..])
)
);
if(Name.Contains("$$")) Node.name = Name[..Name.IndexOf('$')];
return;
}
}
{
if(Regex.Match(Name, _Match_Capsule) is var match && match.Success)
{
Context.AddResultById(
ParseUtil.GetNameComponentId(Node.name),
ParseUtil.GetNameComponentId(Name),
BuildCapsuleCollider(Context, Node,
match.Groups["inside_bounds"].Success,
float.Parse(match.Groups["radius"].Value[1..]),
float.Parse(match.Groups["height"].Value[1..])
)
);
if(Name.Contains("$$")) Node.name = Name[..Name.IndexOf('$')];
return;
}
}
{
if(Regex.Match(Name, _Match_Plane) is var match && match.Success)
{
Context.AddResultById(
ParseUtil.GetNameComponentId(Node.name),
ParseUtil.GetNameComponentId(Name),
BuildPlaneCollider(Context, Node)
);
if(Name.Contains("$$")) Node.name = Name[..Name.IndexOf('$')];
return;
}
}
Expand Down
1 change: 0 additions & 1 deletion AVA/VRChat/Editor/Processors/NNA_Twist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public void Process(NNAContext Context, Transform Node, string Name)

var converted = CreateVRCTwistBoneConstraint.CreateConstraint(Node, sourceNode, sourceWeight);
if(ParseUtil.GetNameComponentId(Node.name) is var componentId && componentId != null) Context.AddResultById(componentId, converted);
Node.name = ParseUtil.GetNodeNameCleaned(Node.name);
}
}

Expand Down
5 changes: 0 additions & 5 deletions AVA/VRChat/Editor/Processors/VRC_ImposterSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ public void Process(NNAContext Context, Transform Node, JObject Json)
var transformsToIgnore = new List<Transform>();
foreach(string name in transformsToIgnoreNames)
{
Debug.Log("transformsToIgnoreNames");
Debug.Log(name);

var node = ParseUtil.FindNode(Context.Root.transform, name);
Debug.Log(node);

transformsToIgnore.Add(node);
}
imposterSettings.transformsToIgnore = transformsToIgnore.ToArray();
Expand Down
12 changes: 9 additions & 3 deletions NNA/Runtime/NNAConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public static ImportResult Convert(
if(node.name == "$meta")
{
State.SetNNAMeta(ParseUtil.ParseMetaNode(node, State.Trash));
State.AddTrash(node);
//State.AddTrash(node);
continue;
}
if(node.name == "$nna")
{
State.AddTrash(node);
State.AddTrash(node.GetComponentsInChildren<Transform>());
continue;
}

Expand Down Expand Up @@ -115,10 +115,16 @@ public static ImportResult Convert(
if(selectedProcessor != null)
{
State.RegisterNameComponent(node, selectedProcessor.Type);
var nameDefinition = node.name;
node.name = ParseUtil.GetNodeNameCleaned(node.name);
State.AddProcessorTask(selectedProcessor.Order, new Task(() => {
selectedProcessor.Process(Context, node, node.name);
selectedProcessor.Process(Context, node, nameDefinition);
}));
}
else
{
State.Errors.Add(new System.AggregateException(new NNAException($"Invalid Name Component: {node.name}", null, node)));
}
}

// Processor execution.
Expand Down
2 changes: 1 addition & 1 deletion NNA/Runtime/Processors/NNA_Humanoid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void Process(NNAContext Context, Transform Node, string Name)
var locomotionType = match.Groups["digi"].Success ? "digi" : "planti";
var noJaw = match.Groups["no_jaw"].Success;

Node.name = ParseUtil.GetNodeNameCleaned(Node.name); // Get clean node-name before the humanoid avatar is created
//Node.name = ParseUtil.GetNodeNameCleaned(Node.name); // Get clean node-name before the humanoid avatar is created

var converted = CreateHumanoidMapping.Create(Context, Node, locomotionType, noJaw);

Expand Down
1 change: 0 additions & 1 deletion NNA/Runtime/Processors/NNA_Twist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public void Process(NNAContext Context, Transform Node, string Name)
: Node.transform.parent.parent;
var constraint = CreateTwistBoneConstraint.CreateConstraint(Node, sourceNode, sourceWeight);
if(ParseUtil.GetNameComponentId(Node.name) is var componentId && componentId != null) Context.AddResultById(componentId, constraint);
Node.name = ParseUtil.GetNodeNameCleaned(Node.name);
}

public static (string SourceName, float Weight, int startIndex) ParseName(Transform Node, string Name)
Expand Down

0 comments on commit 5b624b8

Please sign in to comment.