Exemplo n.º 1
0
        private static RigInfo DefaultRigInfo()
        {
            RigInfo info = new RigInfo();

            info.template     = RigTemplate.Basic;
            info.selection    = (RigSelection)0;
            info.name         = "Htw.Cave";
            info.width        = 3f;
            info.height       = 2.45f;
            info.length       = 3f;
            info.position     = Vector3.zero;
            info.buildReady   = true;
            info.assetsFolder = "Htw.Cave Assets";
            info.sceneTools   = true;
            info.menu         = true;
            info.kinect       = true;
            info.joycon       = true;

            return(info);
        }
Exemplo n.º 2
0
        public void OnGUI()
        {
            this.windowMode = GUILayout.Toolbar(this.windowMode, new string[] { "Edit", "Preferences" });         //EditorGUILayout.Popup(this.windowMode, new string[]{"Edit", "Preferences"}, EditorStyles.toolbarDropDown);

            EditorGUILayout.Separator();

            if (this.windowMode > 0)
            {
                if (GUILayout.Button("Reset Changes"))
                {
                    savedRigInfo = DefaultRigInfo();
                    this.rigInfo = savedRigInfo;
                }

                EditorGUILayout.LabelField("Version: " + Version, EditorStyles.miniLabel);
            }
            else
            {
                this.rigInfo.name     = EditorGUILayout.TextField("Name", this.rigInfo.name);
                this.rigInfo.template = (RigTemplate)EditorGUILayout.EnumPopup("Template", this.rigInfo.template);

                TemplateToSelection();

                using (new EditorGUI.DisabledScope(this.rigInfo.template != RigTemplate.Custom))
                    this.rigInfo.selection = (RigSelection)EditorGUILayout.EnumFlagsField(this.rigInfo.selection);

                EditorGUILayout.Separator();

                this.rigInfo.width    = EditorGUILayout.FloatField("Width (m)", this.rigInfo.width);
                this.rigInfo.height   = EditorGUILayout.FloatField("Height (m)", this.rigInfo.height);
                this.rigInfo.length   = EditorGUILayout.FloatField("Length (m)", this.rigInfo.length);
                this.rigInfo.position = EditorGUILayout.Vector3Field("Position", this.rigInfo.position);

                EditorGUILayout.Separator();
                EditorGUILayout.LabelField("Assets", EditorStyles.boldLabel);

                this.rigInfo.assetsFolder = EditorGUILayout.TextField("Assets Folder", this.rigInfo.assetsFolder);
                this.rigInfo.menu         = EditorGUILayout.Toggle("Game Menu (Calibration)", this.rigInfo.menu);
                this.rigInfo.buildReady   = EditorGUILayout.Toggle("Build Ready", this.rigInfo.buildReady);
                this.rigInfo.sceneTools   = EditorGUILayout.Toggle("Scene Tools", this.rigInfo.sceneTools);

                EditorGUILayout.Separator();
                EditorGUILayout.LabelField("Additional Features", EditorStyles.boldLabel);

                this.rigInfo.kinect = EditorGUILayout.Toggle("Microsoft Kinect 2.0 Addin", this.rigInfo.kinect);
                this.rigInfo.joycon = EditorGUILayout.Toggle("Nintendo Joycons", this.rigInfo.joycon);

                EditorGUILayout.Separator();

                EditorGUILayout.BeginHorizontal();
                using (new EditorGUI.DisabledScope(!this.rigInScene))
                {
                    if (GUILayout.Button("Replace"))
                    {
                        RemoveRig();
                        CreateRig();
                        base.Close();
                    }
                }

                if (GUILayout.Button("Create"))
                {
                    CreateRig();
                    base.Close();
                }
                EditorGUILayout.EndHorizontal();
            }
        }
Exemplo n.º 3
0
 public void OnEnable()
 {
     this.rigInScene = FindObjectOfType <ProjectorBrain>() != null;
     this.windowMode = 0;
     this.rigInfo    = savedRigInfo;
 }
Exemplo n.º 4
0
 static RigWindow()
 {
     savedRigInfo = DefaultRigInfo();
 }
Exemplo n.º 5
0
 private void CreateRig()
 {
     RigBuilder.CreateRig(this.rigInfo);
     savedRigInfo = this.rigInfo;
 }
Exemplo n.º 6
0
        public static void CreateRig(RigInfo rigInfo)
        {
            RigUtility.CreateAssetsFolder(rigInfo.assetsFolder);

            ProjectorBrain brain = RigUtility.CreateBrain(rigInfo.position, rigInfo.name);
            ProjectorEyes  eyes  = RigUtility.CreateEyes(brain);
            ProjectorMount mount = RigUtility.CreateMount(brain, eyes);

            if (rigInfo.selection.HasFlag(RigSelection.Front))
            {
                ProjectorPlane   plane   = RigUtility.CreatePlane(brain, new Vector3(0, rigInfo.height * 0.5f, rigInfo.length * 0.5f), Vector3.zero, "Projector Plane Front");
                ProjectorEmitter emitter = RigUtility.CreateEmitter(mount, plane, "Projector Emitter Front");

                if (rigInfo.buildReady)
                {
                    emitter.Configuration = RigUtility.CreateConfiguration(emitter, rigInfo.assetsFolder, "Projector_Configuration_Front");
                    RigUtility.DefaultConfiguration(emitter.Configuration, rigInfo.width, rigInfo.height, 2, "Front");
                }
            }

            if (rigInfo.selection.HasFlag(RigSelection.Back))
            {
                ProjectorPlane   plane   = RigUtility.CreatePlane(brain, new Vector3(0, rigInfo.height * 0.5f, -rigInfo.length * 0.5f), Vector3.up * 180f, "Projector Plane Back");
                ProjectorEmitter emitter = RigUtility.CreateEmitter(mount, plane, "Projector Emitter Back");

                if (rigInfo.buildReady)
                {
                    emitter.Configuration = RigUtility.CreateConfiguration(emitter, rigInfo.assetsFolder, "Projector_Configuration_Back");
                    RigUtility.DefaultConfiguration(emitter.Configuration, rigInfo.width, rigInfo.height, 4, "Back");
                }
            }

            if (rigInfo.selection.HasFlag(RigSelection.Top))
            {
                ProjectorPlane   plane   = RigUtility.CreatePlane(brain, new Vector3(0, rigInfo.height, 0), Vector3.right * -90f, "Projector Plane Top");
                ProjectorEmitter emitter = RigUtility.CreateEmitter(mount, plane, "Projector Emitter Top");

                if (rigInfo.buildReady)
                {
                    emitter.Configuration = RigUtility.CreateConfiguration(emitter, rigInfo.assetsFolder, "Projector_Configuration_Top");
                    RigUtility.DefaultConfiguration(emitter.Configuration, rigInfo.width, rigInfo.length, 5, "Top");
                }
            }

            if (rigInfo.selection.HasFlag(RigSelection.Bottom))
            {
                ProjectorPlane   plane   = RigUtility.CreatePlane(brain, Vector3.zero, Vector3.right * 90f, "Projector Plane Bottom");
                ProjectorEmitter emitter = RigUtility.CreateEmitter(mount, plane, "Projector Emitter Bottom");

                if (rigInfo.buildReady)
                {
                    emitter.Configuration = RigUtility.CreateConfiguration(emitter, rigInfo.assetsFolder, "Projector_Configuration_Bottom");
                    RigUtility.DefaultConfiguration(emitter.Configuration, rigInfo.width, rigInfo.length, 6, "Bottom");
                }
            }

            if (rigInfo.selection.HasFlag(RigSelection.Left))
            {
                ProjectorPlane   plane   = RigUtility.CreatePlane(brain, new Vector3(-rigInfo.width * 0.5f, rigInfo.height * 0.5f, 0), Vector3.up * -90f, "Projector Plane Left");
                ProjectorEmitter emitter = RigUtility.CreateEmitter(mount, plane, "Projector Emitter Left");

                if (rigInfo.buildReady)
                {
                    emitter.Configuration = RigUtility.CreateConfiguration(emitter, rigInfo.assetsFolder, "Projector_Configuration_Left");
                    RigUtility.DefaultConfiguration(emitter.Configuration, rigInfo.length, rigInfo.height, 1, "Left");
                }
            }

            if (rigInfo.selection.HasFlag(RigSelection.Right))
            {
                ProjectorPlane   plane   = RigUtility.CreatePlane(brain, new Vector3(rigInfo.width * 0.5f, rigInfo.height * 0.5f, 0), Vector3.up * 90f, "Projector Plane Right");
                ProjectorEmitter emitter = RigUtility.CreateEmitter(mount, plane, "Projector Emitter Right");

                if (rigInfo.buildReady)
                {
                    emitter.Configuration = RigUtility.CreateConfiguration(emitter, rigInfo.assetsFolder, "Projector_Configuration_Right");
                    RigUtility.DefaultConfiguration(emitter.Configuration, rigInfo.length, rigInfo.height, 3, "Right");
                }
            }

            if (rigInfo.buildReady)
            {
                brain.Settings = RigUtility.CreateSettings(rigInfo.assetsFolder);
                RigUtility.DefaultSettings(brain.Settings);
                RigUtility.AttachController(brain, eyes, rigInfo.joycon);
            }

            if (rigInfo.sceneTools)
            {
                mount.Gizmos = ProjectorGizmos.Viewport | ProjectorGizmos.Wireframe;
            }

            if (rigInfo.kinect)
            {
                RigUtility.AttachKinect(brain, eyes, new Vector3(0f, rigInfo.height + 0.25f, rigInfo.length * 0.5f), rigInfo.assetsFolder);
            }

            RigUtility.InstantiateImportExport(brain, mount, brain.GetComponent <KinectBrain>(), rigInfo.name, rigInfo.assetsFolder);

            if (rigInfo.menu)
            {
                RigUtility.InstantiateMenu(brain, mount, brain.GetComponent <KinectBrain>(), rigInfo.name);
            }

            if (rigInfo.joycon)
            {
                RigUtility.InstantiateJoycons();
            }

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }