コード例 #1
0
 internal static void UpdateAspectRatio(SerializedImageTarget it, Vector2 size)
 {
     it.AspectRatio = size[1] / size[0];
     using (List <ImageTargetAbstractBehaviour> .Enumerator enumerator = it.GetBehaviours().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             ImageTargetEditor.UpdateMesh(enumerator.Current.gameObject, it.AspectRatio);
         }
     }
 }
コード例 #2
0
 private static void CheckMesh(SerializedImageTarget serializedObject)
 {
     using (List <ImageTargetAbstractBehaviour> .Enumerator enumerator = serializedObject.GetBehaviours().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             GameObject gameObject = enumerator.Current.gameObject;
             MeshFilter component  = gameObject.GetComponent <MeshFilter>();
             if ((component == null || component.sharedMesh == null) && !serializedObject.AspectRatioProperty.hasMultipleDifferentValues)
             {
                 ImageTargetEditor.UpdateMesh(gameObject, serializedObject.AspectRatio);
             }
         }
     }
     if (!serializedObject.DataSetPathProperty.hasMultipleDifferentValues && !serializedObject.TrackableNameProperty.hasMultipleDifferentValues)
     {
         ImageTargetEditor.UpdateMaterial(serializedObject);
     }
 }
コード例 #3
0
 internal static void UpdateScale(SerializedImageTarget serializedObject, Vector2 size)
 {
     foreach (ImageTargetAbstractBehaviour current in serializedObject.GetBehaviours())
     {
         float num = current.GetSize()[0] / size[0];
         if (serializedObject.AspectRatio <= 1f)
         {
             current.transform.localScale = new Vector3(size[0], size[0], size[0]);
         }
         else
         {
             current.transform.localScale = new Vector3(size[1], size[1], size[1]);
         }
         if (serializedObject.PreserveChildSize)
         {
             foreach (Transform transform in current.transform)
             {
                 transform.localPosition = new Vector3(transform.localPosition.x * num, transform.localPosition.y * num, transform.localPosition.z * num);
                 transform.localScale    = new Vector3(transform.localScale.x * num, transform.localScale.y * num, transform.localScale.z * num);
             }
         }
     }
 }