Example #1
0
        protected void Start()
        {
            if (!Application.isEditor || !Application.isPlaying)
            {
                return;
            }

            PipelineSaver ps = GameObject.FindObjectOfType <PipelineSaver>();

            pipelineManager = ps.gameObject.GetComponent <PipelineManager>();

            imageCapture            = GetComponent <CameraImageCapture>();
            imageCapture.shotCamera = GameObject.Find("VRCCam").GetComponent <Camera>();

            LoadUploadRetryStateFromCache();

            forceNewFileCreation = UnityEditor.EditorPrefs.GetBool("forceNewFileCreation", true);
            useFileApi           = UnityEditor.EditorPrefs.GetBool("useFileApi", false);

            API.SetOnlineMode(true);

            string testImage = System.IO.File.ReadAllText("Assets/VRCSDK/Dependencies/VRChat/Editor/ControlPanel/customImage.cfg");

            if (testImage != "")
            {
                imagePath = testImage;
                Debug.Log("Image path found! using this for upload.");
            }
        }
    public void OnEnable()
    {
        /*
         * if (EyelidSkinnedMesh == null)
         *  EyelidSkinnedMesh = (target as Component).GetComponentInChildren<SkinnedMeshRenderer>(true);
         * if (EyelidBlendShapes == null)
         *  EyelidBlendShapes = GetBlendShapeNames(EyelidSkinnedMesh);
         */

        if (avatarDescriptor == null)
        {
            avatarDescriptor = (VRCAvatarDescriptor)target;
        }

        if (pipelineManager == null)
        {
            pipelineManager = avatarDescriptor.GetComponent <VRC.Core.PipelineManager>();
            if (pipelineManager == null)
            {
                avatarDescriptor.gameObject.AddComponent <VRC.Core.PipelineManager>();
            }
        }

        if (!_doCustomizeAnimLayers.boolValue)
        {
            ResetAnimLayersToDefault();
        }

        EnforceAnimLayerSetup(true);
        serializedObject.ApplyModifiedProperties();

        InitEyeLook();
        Init_Expressions();
    }
Example #3
0
    void DeleteVrcComponents()
    {
        Debug.Log("Deleting vrc components...");

        VRC.Core.PipelineManager pipelineManager = vrcAvatarDescriptor.gameObject.GetComponent <VRC.Core.PipelineManager>();

        if (pipelineManager == null)
        {
            throw new Exception("Cannot delete pipeline manager: cannot find it!");
        }

        DestroyImmediate(vrcAvatarDescriptor);
        DestroyImmediate(pipelineManager);

        Debug.Log("Vrc components deleted");
    }
    public override void OnInspectorGUI()
    {
        if (sceneDescriptor == null)
        {
            sceneDescriptor = (VRCSDK2.VRC_SceneDescriptor)target;
        }

        if (pipelineManager == null)
        {
            pipelineManager = sceneDescriptor.GetComponent <VRC.Core.PipelineManager>();
            if (pipelineManager == null)
            {
                sceneDescriptor.gameObject.AddComponent <VRC.Core.PipelineManager>();
            }
        }

        DrawDefaultInspector();
    }
Example #5
0
        protected void Start()
        {
            if (!Application.isEditor || !Application.isPlaying)
            {
                return;
            }

            PipelineSaver ps = GameObject.FindObjectOfType <PipelineSaver>();

            pipelineManager = ps.gameObject.GetComponent <PipelineManager>();

            imageCapture            = GetComponent <CameraImageCapture>();
            imageCapture.shotCamera = GameObject.Find("VRCCam").GetComponent <Camera>();

            LoadUploadRetryStateFromCache();

            forceNewFileCreation = UnityEditor.EditorPrefs.GetBool("forceNewFileCreation", true);
        }
        void Start()
        {
            if (Application.isEditor && Application.isPlaying)
            {
                Application.runInBackground       = true;
                UnityEngine.VR.VRSettings.enabled = false;

                PipelineSaver ps = GameObject.FindObjectOfType <PipelineSaver>();
                pipelineManager = ps.gameObject.GetComponent <PipelineManager>();

                imageCapture            = GetComponent <CameraImageCapture>();
                imageCapture.shotCamera = GameObject.Find("VRCCam").GetComponent <Camera>();
                uploadButton.onClick.AddListener(SetupUpload);

                shouldUpdateImageToggle.onValueChanged.AddListener(ToggleUpdateImage);

                Login();
                SetupUI();
            }
        }
        protected void Start()
        {
            if (!Application.isEditor || !Application.isPlaying)
            {
                return;
            }

            PipelineSaver ps = GameObject.FindObjectOfType <PipelineSaver>();

            pipelineManager = ps.gameObject.GetComponent <PipelineManager>();

            imageCapture            = GetComponent <CameraImageCapture>();
            imageCapture.shotCamera = GameObject.Find("VRCCam").GetComponent <Camera>();

            LoadUploadRetryStateFromCache();

            forceNewFileCreation = UnityEditor.EditorPrefs.GetBool("forceNewFileCreation", true);
            useFileApi           = UnityEditor.EditorPrefs.GetBool("useFileApi", VRC.Core.ApiFile.kDefaultUseFileAPI);

            API.InitializeDebugLevel();
            API.SetOnlineMode(true);
        }
    public override void OnInspectorGUI()
    {
        if (avatarDescriptor == null)
        {
            avatarDescriptor = (VRCSDK2.VRC_AvatarDescriptor)target;
        }

        if (pipelineManager == null)
        {
            pipelineManager = avatarDescriptor.GetComponent <VRC.Core.PipelineManager>();
            if (pipelineManager == null)
            {
                avatarDescriptor.gameObject.AddComponent <VRC.Core.PipelineManager>();
            }
        }

        // DrawDefaultInspector();

        if (VRCSdkControlPanel.window != null)
        {
            if (GUILayout.Button("Select this avatar in the SDK control panel"))
            {
                VRCSdkControlPanelAvatarBuilder.SelectAvatar(avatarDescriptor);
            }
        }

        avatarDescriptor.ViewPosition = EditorGUILayout.Vector3Field("View Position", avatarDescriptor.ViewPosition);
        //avatarDescriptor.Name = EditorGUILayout.TextField("Avatar Name", avatarDescriptor.Name);
        avatarDescriptor.Animations          = (VRCSDK2.VRC_AvatarDescriptor.AnimationSet)EditorGUILayout.EnumPopup("Default Animation Set", avatarDescriptor.Animations);
        avatarDescriptor.CustomStandingAnims = (AnimatorOverrideController)EditorGUILayout.ObjectField("Custom Standing Anims", avatarDescriptor.CustomStandingAnims, typeof(AnimatorOverrideController), true, null);
        avatarDescriptor.CustomSittingAnims  = (AnimatorOverrideController)EditorGUILayout.ObjectField("Custom Sitting Anims", avatarDescriptor.CustomSittingAnims, typeof(AnimatorOverrideController), true, null);
        avatarDescriptor.ScaleIPD            = EditorGUILayout.Toggle("Scale IPD", avatarDescriptor.ScaleIPD);

        avatarDescriptor.lipSync = (VRCSDK2.VRC_AvatarDescriptor.LipSyncStyle)EditorGUILayout.EnumPopup("Lip Sync", avatarDescriptor.lipSync);
        switch (avatarDescriptor.lipSync)
        {
        case VRCSDK2.VRC_AvatarDescriptor.LipSyncStyle.Default:
            if (GUILayout.Button("Auto Detect!"))
            {
                AutoDetectLipSync();
            }
            break;

        case VRCSDK2.VRC_AvatarDescriptor.LipSyncStyle.JawFlapBlendShape:
            avatarDescriptor.VisemeSkinnedMesh = (SkinnedMeshRenderer)EditorGUILayout.ObjectField("Face Mesh", avatarDescriptor.VisemeSkinnedMesh, typeof(SkinnedMeshRenderer), true);
            if (avatarDescriptor.VisemeSkinnedMesh != null)
            {
                DetermineBlendShapeNames();

                int current = -1;
                for (int b = 0; b < blendShapeNames.Count; ++b)
                {
                    if (avatarDescriptor.MouthOpenBlendShapeName == blendShapeNames[b])
                    {
                        current = b;
                    }
                }

                string title = "Jaw Flap Blend Shape";
                int    next  = EditorGUILayout.Popup(title, current, blendShapeNames.ToArray());
                if (next >= 0)
                {
                    avatarDescriptor.MouthOpenBlendShapeName = blendShapeNames[next];
                }
            }
            break;

        case VRCSDK2.VRC_AvatarDescriptor.LipSyncStyle.JawFlapBone:
            avatarDescriptor.lipSyncJawBone = (Transform)EditorGUILayout.ObjectField("Jaw Bone", avatarDescriptor.lipSyncJawBone, typeof(Transform), true);
            break;

        case VRCSDK2.VRC_AvatarDescriptor.LipSyncStyle.VisemeBlendShape:
            SkinnedMeshRenderer prev = avatarDescriptor.VisemeSkinnedMesh;
            avatarDescriptor.VisemeSkinnedMesh = (SkinnedMeshRenderer)EditorGUILayout.ObjectField("Face Mesh", avatarDescriptor.VisemeSkinnedMesh, typeof(SkinnedMeshRenderer), true);
            if (avatarDescriptor.VisemeSkinnedMesh != prev)
            {
                shouldRefreshVisemes = true;
            }
            if (avatarDescriptor.VisemeSkinnedMesh != null)
            {
                DetermineBlendShapeNames();

                if (avatarDescriptor.VisemeBlendShapes == null || avatarDescriptor.VisemeBlendShapes.Length != (int)VRCSDK2.VRC_AvatarDescriptor.Viseme.Count)
                {
                    avatarDescriptor.VisemeBlendShapes = new string[(int)VRCSDK2.VRC_AvatarDescriptor.Viseme.Count];
                }
                for (int i = 0; i < (int)VRCSDK2.VRC_AvatarDescriptor.Viseme.Count; ++i)
                {
                    int current = -1;
                    for (int b = 0; b < blendShapeNames.Count; ++b)
                    {
                        if (avatarDescriptor.VisemeBlendShapes[i] == blendShapeNames[b])
                        {
                            current = b;
                        }
                    }

                    string title = "Viseme: " + ((VRCSDK2.VRC_AvatarDescriptor.Viseme)i).ToString();
                    int    next  = EditorGUILayout.Popup(title, current, blendShapeNames.ToArray());
                    if (next >= 0)
                    {
                        avatarDescriptor.VisemeBlendShapes[i] = blendShapeNames[next];
                    }
                }

                if (shouldRefreshVisemes)
                {
                    AutoDetectVisemes();
                }
            }
            break;
        }
        EditorGUILayout.LabelField("Unity Version", avatarDescriptor.unityVersion);
    }