void DrawPropertyGUI()
        {
            serializedPosePreset.UpdateIfRequiredOrScript();

            EditorGUILayout.PropertyField(pName, new GUIContent(Strings.Presets.presetName));

            Helpers.DrawGUILine();

            EditorGUILayout.PropertyField(pPresetMode, new GUIContent(Strings.Presets.mode));

            Helpers.DrawGUILine();

            if ((PumkinsPosePreset.PosePresetMode)pPresetMode.enumValueIndex == PumkinsPosePreset.PosePresetMode.HumanPose)
            {
                Helpers.DrawPropertyArrayWithNames(pMuscles, Strings.PoseEditor.muscles, defaultMusclesNames, ref muscles_expand, 0, 185, false);
            }
            else
            {
                Helpers.DrawPropertyArraysHorizontalWithDeleteAndAdd(new SerializedProperty[] { pTransformPaths, pTransformRotations }, Strings.PoseEditor.transformRotations, ref transforms_expand);
            }

            Helpers.DrawGUILine();

            if (GUILayout.Button(Strings.Buttons.selectInToolsWindow))
            {
                PumkinsPresetManager.SelectPresetInToolWindow(preset);
            }

            serializedPosePreset.ApplyModifiedProperties();
        }
示例#2
0
        public override void OnInspectorGUI()
        {
            serializedPreset.Update();
            EditorGUILayout.LabelField(Strings.Presets.blendshapePreset, Styles.Label_mainTitle);
            Helpers.DrawGUILine();
            EditorGUILayout.PropertyField(pName, new GUIContent(Strings.Presets.presetName));
            Helpers.DrawGUILine();
            Helpers.DrawBlendshapeSlidersWithDeleteAndAdd(ref preset.renderers, null);

            Helpers.DrawGUILine();

            if (GUILayout.Button(Strings.Buttons.selectInToolsWindow, Styles.BigButton))
            {
                PumkinsPresetManager.SelectPresetInToolWindow(preset);
            }

            serializedPreset.ApplyModifiedProperties();
        }
示例#3
0
 public void SavePreset(bool overwriteExisting)
 {
     ScriptableObjectUtility.SaveAsset(this, name, PumkinsAvatarTools.MainFolderPath + "/Resources/Presets/Blendshapes/", overwriteExisting);
     PumkinsPresetManager.LoadPresets <PumkinsBlendshapePreset>();
 }
示例#4
0
        void DrawPropertyGUI()
        {
            st.UpdateIfRequiredOrScript();

            EditorGUILayout.PropertyField(pName, new GUIContent("Preset Name"));

            Helpers.DrawGUILine();

            EditorGUILayout.PropertyField(pOffsetMode, new GUIContent("Offset Mode"));

            if ((PumkinsCameraPreset.CameraOffsetMode)pOffsetMode.enumValueIndex == PumkinsCameraPreset.CameraOffsetMode.Transform)
            {
                EditorGUILayout.PropertyField(pTransformPath, new GUIContent("Transform Path"));
            }

            EditorGUILayout.Space();


            EditorGUILayout.PropertyField(pPositionOffset, new GUIContent("Position Offset"));
            EditorGUILayout.PropertyField(pRotationAnglesOffset, new GUIContent("Rotation Offset"));

            Helpers.DrawGUILine();

            EditorGUILayout.PropertyField(pUseOverlay, new GUIContent("Use Camera Overlay"));

            if (pUseOverlay.boolValue)
            {
                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(pOverlayImagePath, new GUIContent("Overlay Image Path"));
                EditorGUILayout.PropertyField(pOverlayImageTint, new GUIContent("Overlay Tint"));
            }

            Helpers.DrawGUILine();

            EditorGUILayout.PropertyField(pUseBackground, new GUIContent("Use Camera Background"));

            if (pUseBackground.boolValue)
            {
                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(pBackgroundType, new GUIContent("Background Type"));

                EditorGUILayout.Space();

                switch ((PumkinsAvatarTools.CameraBackgroundOverrideType)pBackgroundType.enumValueIndex)
                {
                case PumkinsAvatarTools.CameraBackgroundOverrideType.Color:
                    EditorGUILayout.PropertyField(pBackgroundColor, new GUIContent("Background Color"));
                    break;

                case PumkinsAvatarTools.CameraBackgroundOverrideType.Image:
                    EditorGUILayout.PropertyField(pBackgroundImagePath, new GUIContent("Image Path"));
                    EditorGUILayout.PropertyField(pBackgroundImageTint, new GUIContent("Image Tint"));
                    break;

                case PumkinsAvatarTools.CameraBackgroundOverrideType.Skybox:
                    EditorGUILayout.PropertyField(pBackgroundMaterial, new GUIContent("Material"));
                    break;

                default:
                    break;
                }
            }

            Helpers.DrawGUILine();

            if (GUILayout.Button(Strings.Buttons.selectInToolsWindow, Styles.BigButton))
            {
                PumkinsPresetManager.SelectPresetInToolWindow(preset);
            }

            st.ApplyModifiedProperties();
        }
示例#5
0
        /// <summary>
        /// Creates new preset based on camera and reference, applies all settings from this object then saves it to assets
        /// </summary>
        public bool SavePreset(GameObject referenceObject, Camera camera, bool overwriteExisting)
        {
            PumkinsCameraPreset p = ScriptableObjectUtility.CreateAndSaveAsset <PumkinsCameraPreset>(name, PumkinsAvatarTools.MainFolderPath + "/Resources/Presets/Cameras/", overwriteExisting) as PumkinsCameraPreset;

            if (!p)
            {
                return(false);
            }

            p.name       = name;
            p.offsetMode = offsetMode;

            if (p.offsetMode == CameraOffsetMode.AvatarRoot)
            {
                CalculateOffsets(referenceObject.transform.root, camera);
            }
            else if (p.offsetMode == CameraOffsetMode.Transform)
            {
                CalculateOffsets(referenceObject.transform, camera);
            }
            else
            {
                CalculateOffsets(PumkinsAvatarTools.SelectedAvatar.GetComponent <VRC_AvatarDescriptor>(), camera);
            }

            p.positionOffset       = positionOffset;
            p.rotationAnglesOffset = rotationAnglesOffset;
            p.transformPath        = transformPath;

            p.useOverlay = PumkinsAvatarTools.Instance.bThumbnails_use_camera_overlay;

            if (p.useOverlay)
            {
                p.overlayImagePath = PumkinsAvatarTools.Instance._overlayPath;
                p.overlayImageTint = PumkinsAvatarTools.Instance.cameraOverlayImageTint;
            }

            p.useBackground  = PumkinsAvatarTools.Instance.bThumbnails_use_camera_background;
            p.backgroundType = PumkinsAvatarTools.Instance.cameraBackgroundType;

            if (p.useBackground)
            {
                switch (p.backgroundType)
                {
                case PumkinsAvatarTools.CameraBackgroundOverrideType.Color:
                    p.backgroundColor = PumkinsAvatarTools.Instance._thumbsCamBgColor;
                    break;

                case PumkinsAvatarTools.CameraBackgroundOverrideType.Image:
                    p.backgroundImagePath = PumkinsAvatarTools.Instance._backgroundPath;
                    p.backgroundImageTint = PumkinsAvatarTools.Instance.cameraBackgroundImageTint;
                    break;

                case PumkinsAvatarTools.CameraBackgroundOverrideType.Skybox:
                    p.backgroundMaterial = RenderSettings.skybox;
                    break;

                default:
                    break;
                }
            }
            EditorUtility.SetDirty(p);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            PumkinsPresetManager.LoadPresets <PumkinsCameraPreset>();
            return(true);
        }