Ejemplo n.º 1
0
        private ConstraintInspector GetConstraintInspector(Constraint constraint)
        {
            ConstraintInspector inspector = null;

            if (!m_constraintInspectors.TryGetValue(BTConstraintInspectorFactory.GetInspectorTypeForConstraint(constraint.GetType()), out inspector))
            {
                inspector = BTConstraintInspectorFactory.CreateInspectorForConstraint(constraint);
                m_constraintInspectors.Add(inspector.GetType(), inspector);
            }

            inspector.Target = constraint;
            return(inspector);
        }
        public static ConstraintInspector CreateInspectorForConstraint(Constraint constraint)
        {
            if (constraint != null)
            {
                Type inspectorType = GetInspectorTypeForConstraint(constraint.GetType());
                if (inspectorType != null)
                {
                    ConstraintInspector inspector = Activator.CreateInstance(inspectorType) as ConstraintInspector;
                    inspector.Target = constraint;

                    return(inspector);
                }
            }

            return(null);
        }