[Beta Release] Folder Generator for World Machine Projects (v0.2.6)

I like organization, almost to the point of being OCD about it; well, not almost. I will spend hours trying to organize folder structures >.<

Anyways, I made a simple and code inflated (I forgot how to properly had a class/module/function or w/e, so it has about 10 lines of code for folder creation) application for Windows (sorry Mac and Linux people) that will create a series of folders in a main directory. Here are some S.S:


[hr]


[hr]

[hr]

Here is the link to download it:

Google Drive Link

Update 1:

World Machine Pro Only Feature (Automation):

  • Added support for creation of simple automation: Creates (and updates) an XML file with that will load the Project Name and build the level
  • Added a “Tiled Builds” checkbox: See above, this will allow you to created a tiled or normal build
  • Please note that in order for the automation script to function correctly, the XML File must be located in the “main directory” and you MUST save the Project into it’s respective folder, for example:

Project Name: Example1
Project Folder: Example1
Project WM Saved File: Example1\Example1.tmd

Update 2:

Behind the scenes change, tided a few things up code-wise, standardized the XML generation stuff to XML DOM (was using a mix between XMLWriter and XML DOM).

3 known bugs:

  • The program doesn’t save the XML declaration properly and won’t save the standalone=“no” string. This doesn’t seem to affect the WM automation process though.
  • XComment won’t save to the XML document
  • No spacing between parents. Not really necessary unless your directly editing the XML file, I find spacing parents makes stuff a bit more legible.

(Once I figure out how to gitHub stuff, I’ll delete this post and add it to the main post… this code is now outdated with 2nd release)

I should also note, that I myself am a computer security minded individual, so in the name of full disclosure, here is the visual basic code (if you want to copy/paste/compile):

Note that I use MenuStrip1 (options menu), StatusStrip1 (me + version at bottom) and a FolderBrowserDialog (the select button is tied to this)

Public Class Form1
    Private Sub folderBtn_Click(sender As Object, e As EventArgs) Handles folderBtn.Click
        Dim folderDlg As New FolderBrowserDialog
        folderDlg.ShowNewFolderButton = True
        If (folderDlg.ShowDialog() = DialogResult.OK) Then
            TextBox1.Text = folderDlg.SelectedPath
            Dim root As Environment.SpecialFolder = folderDlg.RootFolder
        End If
    End Sub

    Private Sub btnGenerate_Click(sender As Object, e As EventArgs) Handles btnGenerate.Click
        If My.Computer.FileSystem.DirectoryExists(TextBox1.Text + "\" + TextBox2.Text) Then
            Dim msg = "Folder already exists, do you wish to overwrite?"
            Dim style = MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2 Or MsgBoxStyle.Critical
            Dim title = "Warning!"
            Dim response = MsgBox(msg, style, title)
            If response = MsgBoxResult.Yes Then
                My.Computer.FileSystem.CreateDirectory(TextBox1.Text + "\" + TextBox2.Text)
                ProgressBar.Value = 20
                My.Computer.FileSystem.CreateDirectory(TextBox1.Text + "\" + TextBox2.Text + "\HeightMaps")
                ProgressBar.Value = 40
                My.Computer.FileSystem.CreateDirectory(TextBox1.Text + "\" + TextBox2.Text + "\NormalMaps")
                ProgressBar.Value = 60
                My.Computer.FileSystem.CreateDirectory(TextBox1.Text + "\" + TextBox2.Text + "\SplatMaps")
                ProgressBar.Value = 80
                My.Computer.FileSystem.CreateDirectory(TextBox1.Text + "\" + TextBox2.Text + "\Tiles")
                ProgressBar.Value = 100
                TextBox2.Text = ""
                ProgressBar.Value = 0
            Else
                TextBox2.Text = ""
            End If
        Else
            My.Computer.FileSystem.CreateDirectory(TextBox1.Text + "\" + TextBox2.Text)
            ProgressBar.Value = 20
            My.Computer.FileSystem.CreateDirectory(TextBox1.Text + "\" + TextBox2.Text + "\HeightMaps")
            ProgressBar.Value = 40
            My.Computer.FileSystem.CreateDirectory(TextBox1.Text + "\" + TextBox2.Text + "\NormalMaps")
            ProgressBar.Value = 60
            My.Computer.FileSystem.CreateDirectory(TextBox1.Text + "\" + TextBox2.Text + "\SplatMaps")
            ProgressBar.Value = 80
            My.Computer.FileSystem.CreateDirectory(TextBox1.Text + "\" + TextBox2.Text + "\Tiles")
            ProgressBar.Value = 100
            TextBox2.Text = ""
            ProgressBar.Value = 0
        End If   
    End Sub

    Private Sub NewFolderStructureToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NewFolderStructureToolStripMenuItem.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
    End Sub

    Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click
        Application.Exit()
        End
    End Sub

End Class