public void UnsubscribeToExpression(MRFaceExpression expression, Action <float> engaged, Action <float> disengaged)
        {
            var expressionActions = m_ExpressionActionsMap[expression];

            expressionActions.Engaged    -= engaged;
            expressionActions.Disengaged -= disengaged;
        }
 void OnExpressionDisengaged(MRFaceExpression expression, float coefficient)
 {
     m_FaceExpressionEvents.Add(new FaceExpressionDataEvent
     {
         Time        = GetCurrentTime(),
         Expression  = expression,
         Coefficient = coefficient,
         Engaged     = false
     });
 }
Example #3
0
        protected ARFoundationFaceExpression(MRFaceExpression name)
        {
            m_Name = name;
            var index    = (int)name;
            var settings = ARFoundationFaceExpressionSettings.instance;

            m_Threshold              = settings.thresholds[index];
            m_SmoothingFilter        = settings.expressionChangeSmoothingFilter;
            m_EventCooldownInSeconds = settings.eventCooldownInSeconds;
        }
        public static FacialExpressionsRecording Create(SignalTrack faceExpressionEventsTrack, MRFaceExpression[] expressionEnumValues)
        {
            var recording = CreateInstance <FacialExpressionsRecording>();

            recording.m_SignalTrack = faceExpressionEventsTrack;
            var expressionEnumValuesCopy = new MRFaceExpression[expressionEnumValues.Length];

            expressionEnumValues.CopyTo(expressionEnumValuesCopy, 0);
            recording.m_ExpressionEnumValues = expressionEnumValuesCopy;
            return(recording);
        }
Example #5
0
        public static void UnsubscribeToExpression(MRFaceExpression name, Action<float> engaged, Action<float> disengaged)
        {
            if (k_Expressions.TryGetValue(name, out var expression))
            {
                if (engaged != null)
                    expression.Engaged -= engaged;

                if (disengaged != null)
                    expression.Disengaged -= disengaged;
            }
        }
Example #6
0
        // For the basic use case of 1:1 relation between ARKit blendshape and MRFaceExpression,
        // provide the ARKit blendshape name here & GetCoefficient will be handled for you
        public ARKitFaceExpression(MRFaceExpression name, string blendshapeLocation = null)
        {
            m_Name = name;
            var index    = (int)name;
            var settings = ARKitFacialExpressionSettings.instance;

            m_Threshold              = settings.thresholds[index];
            m_SmoothingFilter        = settings.expressionChangeSmoothingFilter;
            m_EventCooldownInSeconds = settings.eventCooldownInSeconds;
            m_BlendshapeLocation     = blendshapeLocation;
        }
        public void SetData(FaceExpressionDataEvent expressionEvent)
        {
            var expression = expressionEvent.Expression;
            var engaged    = expressionEvent.Engaged;

            m_Expression  = expression;
            m_Coefficient = expressionEvent.Coefficient;
            m_Engaged     = engaged;
            var engagedString = engaged ? "Engaged" : "Disengaged";

            name = $"{expression} {engagedString}";
        }
Example #8
0
        internal static void SubscribeToExpression(MRFaceExpression name, Action <float> engaged, Action <float> disengaged)
        {
            if (k_Expressions.TryGetValue(name, out var expression))
            {
                if (engaged != null)
                {
                    expression.Engaged += engaged;
                }

                if (disengaged != null)
                {
                    expression.Disengaged += disengaged;
                }
            }
        }
        public static FaceTrackingRecording Create(SignalTrack faceEventsTrack, int maxFaceCount,
                                                   MRFaceLandmark[] landmarkEnumValues, MRFaceExpression[] expressionEnumValues)
        {
            var recording = CreateInstance <FaceTrackingRecording>();

            recording.m_SignalTrack  = faceEventsTrack;
            recording.m_MaxFaceCount = maxFaceCount;
            var landmarkEnumValuesCopy = new MRFaceLandmark[landmarkEnumValues.Length];

            landmarkEnumValues.CopyTo(landmarkEnumValuesCopy, 0);
            recording.m_LandmarkEnumValues = landmarkEnumValuesCopy;
            var expressionEnumValuesCopy = new MRFaceExpression[expressionEnumValues.Length];

            expressionEnumValues.CopyTo(expressionEnumValuesCopy, 0);
            recording.m_ExpressionEnumValues = expressionEnumValuesCopy;
            return(recording);
        }
Example #10
0
 /// <summary>
 /// Unsubscribe from the facial expression
 /// </summary>
 public static void UnsubscribeToExpression(this IUsesFacialExpressions obj, MRFaceExpression expression, Action <float> onEngage, Action <float> onDisengage = null)
 {
     obj.provider.UnsubscribeToExpression(expression, onEngage, onDisengage);
 }
Example #11
0
 public void UnsubscribeToExpression(MRFaceExpression expression, Action <float> engaged, Action <float> disengaged)
 {
 }