public void OnEnable()
        {
            CylinderTargetAbstractBehaviour arg_22_0 = (CylinderTargetAbstractBehaviour)base.target;

            this.mSerializedObject = new SerializedCylinderTarget(base.serializedObject);
            CylinderTargetEditor.EditorConfigureTarget(arg_22_0, this.mSerializedObject);
        }
 private static void CheckMesh(SerializedCylinderTarget serializedObject)
 {
     foreach (CylinderTargetAbstractBehaviour expr_15 in serializedObject.GetBehaviours())
     {
         MeshFilter   component  = expr_15.gameObject.GetComponent <MeshFilter>();
         MeshRenderer component2 = expr_15.gameObject.GetComponent <MeshRenderer>();
         if (component == null || component.sharedMesh == null || component2 == null || component2.sharedMaterials.Length == 0 || component2.sharedMaterials[0] == null)
         {
             ConfigData.CylinderTargetData ctConfig;
             ConfigDataManager.Instance.GetConfigData(serializedObject.GetDataSetName()).GetCylinderTarget(serializedObject.TrackableName, out ctConfig);
             CylinderTargetEditor.UpdateAspectRatio(serializedObject, ctConfig);
         }
     }
 }
 internal static void UpdateScale(SerializedCylinderTarget serializedObject, float scale)
 {
     foreach (CylinderTargetAbstractBehaviour current in serializedObject.GetBehaviours())
     {
         float num = current.transform.localScale.x / scale;
         current.transform.localScale = new Vector3(scale, scale, scale);
         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);
             }
         }
     }
 }
        internal static void UpdateAspectRatio(SerializedCylinderTarget serializedObject, ConfigData.CylinderTargetData ctConfig)
        {
            float num  = ctConfig.topDiameter / ctConfig.sideLength;
            float num2 = ctConfig.bottomDiameter / ctConfig.sideLength;

            serializedObject.TopDiameterRatio    = num;
            serializedObject.BottomDiameterRatio = num2;
            UnityEngine.Object[] targetObjects = serializedObject.SerializedObject.targetObjects;
            for (int i = 0; i < targetObjects.Length; i++)
            {
                CylinderTargetEditor.UpdateGeometry(((CylinderTargetAbstractBehaviour)targetObjects[i]).gameObject, 1f, num, num2, ctConfig.hasTopGeometry, ctConfig.hasBottomGeometry);
            }
            string arg_92_0      = serializedObject.GetDataSetName();
            string trackableName = serializedObject.TrackableName;

            Material[] material = CylinderTargetEditor.UpdateMaterials(arg_92_0, trackableName, ctConfig.hasBottomGeometry, ctConfig.hasTopGeometry, true, serializedObject.GetMaterials());
            serializedObject.SetMaterial(material);
        }
 public static void EditorConfigureTarget(CylinderTargetAbstractBehaviour ctb, SerializedCylinderTarget serializedObject)
 {
     if (ctb == null)
     {
         Debug.LogError("CylinderTargetAbstractBehaviour parameter is null !");
         return;
     }
     if (VuforiaUtilities.GetPrefabType(ctb) == PrefabType.Prefab)
     {
         return;
     }
     if (!SceneManager.Instance.SceneInitialized)
     {
         SceneManager.Instance.InitScene();
     }
     using (serializedObject.Edit())
     {
         if (!serializedObject.InitializedInEditor && !EditorApplication.isPlaying)
         {
             ConfigData.CylinderTargetData cylinderTargetData;
             ConfigDataManager.Instance.GetConfigData("--- EMPTY ---").GetCylinderTarget("--- EMPTY ---", out cylinderTargetData);
             serializedObject.DataSetPath   = "--- EMPTY ---";
             serializedObject.TrackableName = "--- EMPTY ---";
             CylinderTargetEditor.UpdateAspectRatio(serializedObject, cylinderTargetData);
             CylinderTargetEditor.UpdateScale(serializedObject, cylinderTargetData.sideLength);
             serializedObject.InitializedInEditor = true;
         }
         else if (!EditorApplication.isPlaying)
         {
             CylinderTargetEditor.CheckMesh(serializedObject);
         }
     }
 }
예제 #6
0
 public CylinderTargetAccessor(CylinderTargetAbstractBehaviour target)
 {
     this.mTarget           = target;
     this.mSerializedObject = new SerializedCylinderTarget(new SerializedObject(this.mTarget));
 }