Esempio n. 1
0
//----------------------------------------------------------------------------------------------------------------------

        protected static bool DrawAssetSyncSettings(BaseMeshSync t)
        {
            t.foldSyncSettings = EditorGUILayout.Foldout(t.foldSyncSettings, "Asset Sync Settings", true, GetBoldFoldoutStyle());
            MeshSyncPlayerConfig config = t.GetConfigV();

            if (!t.foldSyncSettings)
            {
                return(false);
            }

            bool changed = false;

            changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Sync Transform",
                                                              guiFunc: () => EditorGUILayout.Toggle("Update Transform", config.SyncTransform),
                                                              updateFunc: (bool toggle) => { config.SyncTransform = toggle; }
                                                              );

            ComponentSyncSettings syncCameraSettings = config.GetComponentSyncSettings(MeshSyncPlayerConfig.SYNC_CAMERA);

            changed |= MeshSyncInspectorUtility.DrawComponentSyncSettings(t, "Cameras", syncCameraSettings);

            using (new EditorGUI.DisabledScope(!(syncCameraSettings.CanCreate && syncCameraSettings.CanUpdate))) {
                EditorGUI.indentLevel++;

                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Physical Camera Params",
                                                                  guiFunc: () => EditorGUILayout.Toggle("Use Physical Params", config.IsPhysicalCameraParamsUsed()),
                                                                  updateFunc: (bool toggle) => { config.UsePhysicalCameraParams(toggle); }
                                                                  );

                EditorGUI.indentLevel--;
            }

            changed |= MeshSyncInspectorUtility.DrawComponentSyncSettings(t, "Lights",
                                                                          config.GetComponentSyncSettings(MeshSyncPlayerConfig.SYNC_LIGHTS));


            changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Sync Meshes",
                                                              guiFunc: () => EditorGUILayout.Toggle("Meshes", config.SyncMeshes),
                                                              updateFunc: (bool toggle) => { config.SyncMeshes = toggle; }
                                                              );

            EditorGUI.indentLevel++;
            changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Update Mesh Colliders",
                                                              guiFunc: () => EditorGUILayout.Toggle("Update Mesh Colliders", config.UpdateMeshColliders),
                                                              updateFunc: (bool toggle) => { config.UpdateMeshColliders = toggle; }
                                                              );
            EditorGUI.indentLevel--;

            changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Sync Visibility",
                                                              guiFunc: () => EditorGUILayout.Toggle("Visibility", config.SyncVisibility),
                                                              updateFunc: (bool toggle) => { config.SyncVisibility = toggle; }
                                                              );

            EditorGUILayout.Space();

            return(changed);
        }
        protected static bool DrawImportSettings(BaseMeshSync t)
        {
            bool changed = false;
            MeshSyncPlayerConfig playerConfig = t.GetConfigV();

            t.foldImportSettings = EditorGUILayout.Foldout(t.foldImportSettings, "Import Settings", true, GetBoldFoldoutStyle());
            if (t.foldImportSettings)
            {
                MeshSyncInspectorUtility.DrawModelImporterSettingsGUI(t, playerConfig.GetModelImporterSettings());

                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Animation Interpolation",
                                                                  guiFunc: () => EditorGUILayout.Popup(new GUIContent("Animation Interpolation"),
                                                                                                       playerConfig.AnimationInterpolation, MeshSyncEditorConstants.ANIMATION_INTERPOLATION_ENUMS),
                                                                  updateFunc: (int val) => { playerConfig.AnimationInterpolation = val; }
                                                                  );


                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Keyframe Reduction",
                                                                  guiFunc: () => EditorGUILayout.Toggle("Keyframe Reduction", playerConfig.KeyframeReduction),
                                                                  updateFunc: (bool toggle) => { playerConfig.KeyframeReduction = toggle; }
                                                                  );

                if (playerConfig.KeyframeReduction)
                {
                    EditorGUI.indentLevel++;

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Threshold",
                                                                      guiFunc: () => EditorGUILayout.FloatField("Threshold", playerConfig.ReductionThreshold),
                                                                      updateFunc: (float val) => { playerConfig.ReductionThreshold = val; }
                                                                      );

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Erase Flat Curves",
                                                                      guiFunc: () => EditorGUILayout.Toggle("Erase Flat Curves", playerConfig.ReductionEraseFlatCurves),
                                                                      updateFunc: (bool toggle) => { playerConfig.ReductionEraseFlatCurves = toggle; }
                                                                      );
                    EditorGUI.indentLevel--;
                }

                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Z-Up Correction",
                                                                  guiFunc: () => EditorGUILayout.Popup(new GUIContent("Z-Up Correction"), playerConfig.ZUpCorrection,
                                                                                                       MeshSyncEditorConstants.Z_UP_CORRECTION_ENUMS),
                                                                  updateFunc: (int val) => { playerConfig.ZUpCorrection = val; }
                                                                  );

                EditorGUILayout.Space();
            }

            return(changed);
        }
 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
 {
     EditorGUI.BeginProperty(position, label, property);
     MeshSyncInspectorUtility.DrawModelImporterSettingsGUI(property);
     EditorGUI.EndProperty();
 }
//----------------------------------------------------------------------------------------------------------------------

        private static bool DrawSceneCacheImportSettings(SceneCachePlayer t)
        {
            bool changed = false;
            MeshSyncPlayerConfig playerConfig = t.GetConfigV();

            t.foldImportSettings = EditorGUILayout.Foldout(t.foldImportSettings, "Import Settings", true, GetBoldFoldoutStyle());
            if (t.foldImportSettings)
            {
                IHasModelImporterSettings importer         = AssetImporter.GetAtPath(t.GetSceneCacheFilePath()) as IHasModelImporterSettings;
                ModelImporterSettings     importerSettings = playerConfig.GetModelImporterSettings();

                if (null == importer)
                {
                    MeshSyncInspectorUtility.DrawModelImporterSettingsGUI(t, importerSettings);
                }
                else
                {
                    bool isOverride = t.IsModelImporterSettingsOverridden();

                    EditorGUILayout.BeginHorizontal();
                    EditorGUIDrawerUtility.DrawUndoableGUI(t, "Override",
                                                           guiFunc: () => GUILayout.Toggle(isOverride, "", GUILayout.MaxWidth(15.0f)),
                                                           updateFunc: (bool overrideValue) => { t.OverrideModelImporterSettings(overrideValue); });

                    using (new EditorGUI.DisabledScope(!isOverride)) {
                        EditorGUIDrawerUtility.DrawUndoableGUI(t, "Create Materials",
                                                               guiFunc: () => (bool)EditorGUILayout.Toggle("Create Materials", importerSettings.CreateMaterials),
                                                               updateFunc: (bool createMat) => { importerSettings.CreateMaterials = createMat; });
                    }

                    EditorGUILayout.EndHorizontal();

                    using (new EditorGUI.DisabledScope(!isOverride)) {
                        ++EditorGUI.indentLevel;
                        MeshSyncInspectorUtility.DrawModelImporterMaterialSearchMode(t, importerSettings);
                        --EditorGUI.indentLevel;
                    }
                }



                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Animation Interpolation",
                                                                  guiFunc: () => EditorGUILayout.Popup(new GUIContent("Animation Interpolation"),
                                                                                                       playerConfig.AnimationInterpolation, MeshSyncEditorConstants.ANIMATION_INTERPOLATION_ENUMS),
                                                                  updateFunc: (int val) => { playerConfig.AnimationInterpolation = val; }
                                                                  );


                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Keyframe Reduction",
                                                                  guiFunc: () => EditorGUILayout.Toggle("Keyframe Reduction", playerConfig.KeyframeReduction),
                                                                  updateFunc: (bool toggle) => { playerConfig.KeyframeReduction = toggle; }
                                                                  );

                if (playerConfig.KeyframeReduction)
                {
                    EditorGUI.indentLevel++;

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Threshold",
                                                                      guiFunc: () => EditorGUILayout.FloatField("Threshold", playerConfig.ReductionThreshold),
                                                                      updateFunc: (float val) => { playerConfig.ReductionThreshold = val; }
                                                                      );

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Erase Flat Curves",
                                                                      guiFunc: () => EditorGUILayout.Toggle("Erase Flat Curves", playerConfig.ReductionEraseFlatCurves),
                                                                      updateFunc: (bool toggle) => { playerConfig.ReductionEraseFlatCurves = toggle; }
                                                                      );
                    EditorGUI.indentLevel--;
                }

                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Z-Up Correction",
                                                                  guiFunc: () => EditorGUILayout.Popup(new GUIContent("Z-Up Correction"), playerConfig.ZUpCorrection,
                                                                                                       MeshSyncEditorConstants.Z_UP_CORRECTION_ENUMS),
                                                                  updateFunc: (int val) => { playerConfig.ZUpCorrection = val; }
                                                                  );

                EditorGUILayout.Space();
            }

            return(changed);
        }