Skip to content

Commit

Permalink
Create basic Unity test project for Emotional Tissue widget. Unity v.…
Browse files Browse the repository at this point in the history
…2023.2.10f1.
  • Loading branch information
jonasluz committed Mar 9, 2024
1 parent 9bfa3b0 commit 1c3dce1
Show file tree
Hide file tree
Showing 91 changed files with 20,409 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .vsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}
8 changes: 8 additions & 0 deletions Assets/JonasLuz.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/JonasLuz/EmotionalTissue.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/JonasLuz/EmotionalTissue/Common.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/JonasLuz/EmotionalTissue/Common/Materials.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions Assets/JonasLuz/EmotionalTissue/Common/Materials/Alphed.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-7451729123616202099
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 0
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Alphed
m_Shader: {fileID: -6465566751694194690, guid: 9d50b8fc70812b34785f76f4adc04532, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Texture2D:
m_Texture: {fileID: 2800000, guid: 963532af8bec74a4b81ce7f478aa1a70, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BUILTIN_QueueControl: 0
- _BUILTIN_QueueOffset: 0
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Fuzziness: 1
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _AlphaColor: {r: 1, g: 1, b: 1, a: 0}
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _MixColor: {r: 1, g: 0, b: 0, a: 0}
m_BuildTextureStacks: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/JonasLuz/EmotionalTissue/Common/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;


namespace JALJ.Common
{
[ExecuteAlways]
public class CharacterBlendShapes : MonoBehaviour
{
public string[] blendShapesNames;

SkinnedMeshRenderer _charMeshRenderer;

public void RetrieveBlendshapes()
{
// Retrive the first mesh renderer from the children.
_charMeshRenderer = GetComponentInChildren<SkinnedMeshRenderer>();

// Retrieve the blendshapes' indexes.
var mesh = _charMeshRenderer.sharedMesh;
blendShapesNames = new string[mesh.blendShapeCount];
for (int i = 0; i < mesh.blendShapeCount; i++)
blendShapesNames[i] = mesh.GetBlendShapeName(i);
}

#region MonoBehaviour impl.
private void Awake()
{
RetrieveBlendshapes();
}
#endregion Monobehaviour impl.

#region Indexed access
int IndexOf(string key) => Array.IndexOf<string>(blendShapesNames, key);

public float this[string key]
{
get => _charMeshRenderer.GetBlendShapeWeight(IndexOf(key));
set => _charMeshRenderer.SetBlendShapeWeight(IndexOf(key), value);
}

public ICollection<string> Keys => blendShapesNames;

public ICollection<float> Values
=> blendShapesNames.Select(bs => this[bs]).ToArray();

public int Count => blendShapesNames.Length;

public bool Contains(KeyValuePair<string, float> item)
=> blendShapesNames.Contains(item.Key) && this[item.Key] == item.Value;

public bool ContainsKey(string key) => blendShapesNames.Contains(key);

public bool TryGetValue(string key, out float value)
{
if (blendShapesNames.Contains(key))
{
value = this[key];
return true;
}
else
{
value = default(float);
return false;
}
}
#endregion Indexed access
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/JonasLuz/EmotionalTissue/Common/Shaders.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1c3dce1

Please sign in to comment.