Example #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (mLightSet.getObjectIDForFLSGen() == -1)
            {
                MessageBox.Show("You must specify a light probe object before generating an FLS file");
                return;
            }

            EditorObject eo = SimGlobals.getSimMain().GetEditorObjectByID(mLightSet.getObjectIDForFLSGen());

            if (eo == null)
            {
                return;
            }

            HelperPositionObject hao = eo as HelperPositionObject;

            string lightsetFile = Path.Combine(CoreGlobals.ScenarioDirectory, CoreGlobals.ScenarioLightsetFilename);
            string flsName      = Path.ChangeExtension(lightsetFile, ".fls");

            //  CoreGlobals.getEditorMain().mIGUI.doQuickView(false);

            //  System.Threading.Thread.Sleep(10000);
            XFSInterface.generateFLS(hao.getPosition().X, hao.getPosition().Y, hao.getPosition().Z, flsName);
        }
Example #2
0
        private void QuickViewButton_Click(object sender, EventArgs e)
        {
            WriteParticleSystem(CoreGlobals.getWorkPaths().mGameArtDirectory + @"\system\quickview.pfx");
            CreateNewEffectVisFile(@"system\quickview.vis", @"system\quickview.pfx");

            if (!s_bParticleQuickViewClicked)
            {
                if (XFSInterface.launchApp())
                {
                    XFSInterface.launchGame();

                    XFSInterface.launchVisual("sys_quickview");

                    s_bParticleQuickViewClicked = true;
                }
            }
        }
Example #3
0
        private void generateFLSToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (LightsetListBox.SelectedItem == null)
            {
                return;
            }

            EditorLightset ls = CoreGlobals.getGameResources().getLightset(LightsetListBox.SelectedIndex);

            if (ls.ObjectIDForFLSGen == -1)
            {
                MessageBox.Show("You must specify a light probe object before generating an FLS file");
                return;
            }

            EditorObject eo = SimGlobals.getSimMain().GetEditorObjectByID(ls.ObjectIDForFLSGen);

            if (eo == null)
            {
                MessageBox.Show("The specified light probe object does not exist. Please select a new one.");
                ls.ObjectPropertyForFLSGen = "";
                return;
            }

            HelperPositionObject hao = eo as HelperPositionObject;

            if (hao == null)
            {
                MessageBox.Show("Error converting EditorObject to HelperPositionObject");
                ls.ObjectPropertyForFLSGen = "";
                return;
            }

            Vector3 pos = hao.getPosition();

            string lightsetFile = CoreGlobals.getWorkPaths().mGameArtDirectory + "\\" + LightsetListBox.SelectedItem.ToString().Split('#')[1];
            string flsName      = lightsetFile + ".fls";

            CoreGlobals.getEditorMain().mIGUI.doQuickView();

            System.Threading.Thread.Sleep(8000);
            XFSInterface.generateFLS(pos.X, pos.Y, pos.Z, flsName);
        }
Example #4
0
        private static void generateFileListsinternal(object objin)
        {
            List <string> scenariosToProcess = objin as List <string>;

            //if we had some problem launching XFS, die out
            if (!XFSInterface.launchApp())
            {
                return;
            }


            //perforce connections
            P4Interface         perforce = new P4Interface();
            P4PendingChangelist cl       = perforce.createChangeList("openFileLists for archive reordering");


            //wait a bit after game launch to ensure that the game is loaded
            XFSInterface.launchGame();
            System.Threading.Thread.Sleep(10000);



            for (int i = 0; i < scenariosToProcess.Count; i++)
            {
                //Has the user pressed 'cancel' ?
                if (mIsWorking == false)
                {
                    sendStatusMsg("User stopped work");
                    break;
                }

                string launchString      = scenariosToProcess[i].Substring(0, scenariosToProcess[i].LastIndexOf(@"."));
                string scenariodir       = gameDirectory + @"\scenario\" + scenariosToProcess[i].Substring(0, scenariosToProcess[i].LastIndexOf(@"\"));
                string fileOpenLogStr    = scenariodir + @"\FileopenLog.txt";
                bool   addFileToPerforce = true;

                sendStatusMsg("Processing " + scenariosToProcess[i]);

                //there's a bit of logic here that we have to do.
                //considering there's like 800 states that a file can be in wrt perforce...
                if (File.Exists(fileOpenLogStr))
                {
                    P4FileStatus fstat = perforce.getFileStatus(fileOpenLogStr);

                    //is the file checked into perforce?
                    if (!fstat.IsFileInPerforce)
                    {
                        addFileToPerforce = true;
                    }
                    else
                    {
                        addFileToPerforce = false;

                        if (!fstat.IsFileCheckedOutByMe)
                        {
                            //checkout the file
                            //NOTE .txt isn't exclusive, so we don't care if someone else has it checked out.
                            perforce.checkoutFileToChangelist(fileOpenLogStr, cl);
                            sendStatusMsg("..Checking out " + fileOpenLogStr);
                        }
                    }

                    //this is a local delete so we can use the MOVE command;
                    try
                    {
                        File.Delete(fileOpenLogStr);
                    }
                    catch (System.Exception e)
                    {
                        sendStatusMsg("..Error Deleting " + fileOpenLogStr);
                        sendStatusMsg("..Skipping File " + fileOpenLogStr);
                        continue;
                    }
                }


                //do this a couple times to esnure it's actualy being done!
                for (int k = 0; k < 3; k++)
                {
                    XFSInterface.clearOpenFileList();
                    System.Threading.Thread.Sleep(100);
                }

                const int cNumSecondsToWait = 45;
                sendStatusMsg("..Launching " + launchString);
                XFSInterface.launchScenario(launchString);
                System.Threading.Thread.Sleep(cNumSecondsToWait * 1000);

                XFSInterface.safeOpenFileList();
                System.Threading.Thread.Sleep(10000);


                //move the file from work to the directory
                do
                {
                    try
                    {
                        File.Move(gameDirectory + @"\FileopenLog.txt", fileOpenLogStr);
                        break;
                    }
                    catch (System.Exception e)
                    {
                    }
                } while (true);


                //check file back into perforce here.
                if (addFileToPerforce)
                {
                    perforce.addFileToChangelist(fileOpenLogStr, cl);
                    sendStatusMsg("..Adding " + fileOpenLogStr);
                }

                //update our status message on the main form
                sendStatusMsg("..Finished " + scenariosToProcess[i]);

                System.Threading.Thread.Sleep(5000);
            }

            perforce.submitChangelist(cl);
            sendStatusMsg("..Changelist " + cl.Number + " submitted");
            perforce.Disconnect();

            mIsWorking = false;
            sendStatusMsg("!DONE");
        }