Skip to content

Commit

Permalink
Merge pull request #29 from didimoinc/release/4.6.1
Browse files Browse the repository at this point in the history
Release 4.6.1
  • Loading branch information
Hugo-Pereira authored Nov 15, 2022
2 parents ebf7f8c + 61fd548 commit cc0f7c6
Show file tree
Hide file tree
Showing 21 changed files with 235 additions and 293 deletions.
3 changes: 2 additions & 1 deletion com.didimo.sdk.assetfitter/Editor/Scripts/Nodes/FieldView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public class FieldViewEnum : FieldView
public FieldViewEnum(object target, FieldInfo fieldInfo) : base(target, fieldInfo) { }
protected override VisualElement createElement()
{
BaseField<Enum> field = fieldInfo.GetCustomAttribute<FlagsAttribute>() == null ?
var flagAtrribute = fieldInfo.FieldType.GetCustomAttribute<System.FlagsAttribute>();
BaseField<Enum> field = flagAtrribute == null ?
new EnumField(fieldInfo.GetValue(target) as System.Enum) as BaseField<Enum> :
new EnumFlagsField(fieldInfo.GetValue(target) as System.Enum) as BaseField<Enum>;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#endif
namespace Didimo.AssetFitter.Editor.Graph
{
[CreateAssetMenu(fileName = "New Graph Data", menuName = "Didimo/Graph/Graph Data", order = 10)]
[CreateAssetMenu(fileName = "New Graph Data", menuName = "Didimo/Graph/Graph Data")]
public class GraphData : ScriptableObject
{
[SerializeReference] public List<GraphNode> nodes = new List<GraphNode>();
Expand All @@ -30,29 +30,41 @@ public class Config
public void Run()
{
#if UNITY_EDITOR
if (State) return;

//Phase 2
EditorApplication.delayCall += () => EditorApplication.delayCall += () =>
{
Debug.Log("Run Complete");
State.Dispose();
State = null;
};

// Phase 0
State = new CachedState(this);
Debug.Log("State Created");
// if (State) return;

// //Phase 2
// EditorApplication.delayCall += () => EditorApplication.delayCall += () =>
// {
// Debug.Log("Run Complete");
// State.Dispose();
// State = null;
// };

// // Phase 0
// // State = new CachedState(this);
// // Debug.Log("State Created");

// Debug.Log("Starting Graph: '" + this.name + "'");
// Build();

// //Phase 1
// EditorApplication.delayCall += () =>
// {
// Debug.Log("Parsing End Points");
// this.nodes.ForEach(n => n.EndPoint());
// };

Debug.Log("Starting Graph: '" + this.name + "'");
Build();

//Phase 1
EditorApplication.delayCall += () =>
using (State = new CachedState(this))
{
Debug.Log("Parsing End Points");
Build();
this.nodes.ForEach(n => n.EndPoint());
};

// State.Dispose();
}
State = null;

Debug.Log("Run Complete");
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using System.Reflection;
using UnityEngine;
using UnityEditor;
using System.Globalization;
using Didimo.Extensions;
using static Didimo.AssetFitter.Editor.Graph.GeomTools;
using static Didimo.AssetFitter.Editor.Graph.AssetTools;
using static Didimo.AssetFitter.Editor.Graph.AssetFitterHelper;
Expand All @@ -24,7 +26,7 @@ public class CommandFitToDidimo : GraphNode
[Input("Prefab", true)] public GameObject prefabInput;
[Input("TPS", true)] public TPSWeights tpsWeightsInput;
[Output("Prefab")] public GameObject prefabOutput;
[Expose] public bool excludeDidimoMeshes;
[Expose] public Options options = Options.IncludeDidimoMeshes;

protected override bool GetOutputValues(FieldInfo info, out List<object> values)
{
Expand All @@ -40,9 +42,6 @@ protected override bool GetOutputValues(FieldInfo info, out List<object> values)
GameObject didimo = CloneAsset(GetInputValue<GameObject>(nameof(prefabInput)));
values = new List<object> { didimo };

//excludeDidimoMeshes
//exclude didimo.GetComponentsInChildren<Renderer>(true);

SkinnedMeshRenderer primarySkin = didimo.GetComponentInChildren<SkinnedMeshRenderer>();

Transform[] sourceBones = shapeSkin.bones;
Expand Down Expand Up @@ -123,8 +122,10 @@ protected override bool GetOutputValues(FieldInfo info, out List<object> values)
obj.AddComponent<MeshRenderer>().sharedMaterials = filter.GetComponent<MeshRenderer>().sharedMaterials;
}

//exclude didimo meshes here:`
// renderers.ForEach(r=>DestroyImmediate(r.gameObject))
if ((options & Options.IncludeDidimoMeshes) == 0)
didimo.GetComponentsInChildren<SkinnedMeshRenderer>().
Where(s => s.name.StartsWith("ddmo_", true, new CultureInfo("en-US"))).
ForEach(s => Object.DestroyImmediate(s));
return true;
}
return base.GetOutputValues(info, out values);
Expand Down Expand Up @@ -167,4 +168,10 @@ BoneIndexRemap GetBoneIndexRemap(AccessoryType type = AccessoryType.Auto)
return remap;
}
}

[System.Flags]
public enum Options
{
IncludeDidimoMeshes = 1 << 0,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
namespace Didimo.AssetFitter.Editor.Graph
{
[System.Serializable]
[MenuPath("Object/MetaverseMe")]
[DisplayName("MetaverseMe")]
[MenuPath("Object/ReadyPlayerMe")]
[DisplayName("ReadyPlayerMe")]
[Width(240)]
[HeaderColor("#685cd4")]
public class CommandMetaverseMe : CommandAvatar
public class CommandReadyPlayerMe : CommandAvatar
{
[Output("Prefab"), Expose] public GameObject prefabOutput;
[Output("Skin")] public SkinnedMeshRenderer shapeOutput;
Expand Down
Loading

0 comments on commit cc0f7c6

Please sign in to comment.