diff --git a/README.rst b/README.rst index 2a195b6..b273969 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ Github code repository: http://github.com/overviewer/Minecraft-Overviewer Blog: - http://mcoverviewer.blogspot.com/ + http://overviewer.org/blog/ The Minecraft Overviewer is a command-line tool for rendering high-resolution diff --git a/docs/config.rst b/docs/config.rst index 93dcfe7..d6d26bd 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -39,12 +39,14 @@ The ``worlds`` dictionary lines like this one. Otherwise, one is sufficient. The ``renders`` dictionary - Each item here declares a "render" which is a map of a world rendered with a - set of options. If you have more than one, when viewing the maps, you will - get a dropdown box to choose which map you want to look at. + Each item here declares a "render" which is a map of one dimension of one + world rendered with the given options. If you declare more than one render, + then you will get a dropdown box to choose which map you want to look at + when viewing the maps. - You can render the same world multiple times with different options, or - render multiple worlds. + You are free to declare as many renders as you want with whatever options + you want. For example, you are allowed to render multiple worlds, or even + render the same world multiple times with different options. .. note:: @@ -80,14 +82,6 @@ A more complicated example "dimension": "nether", } - renders["survivalspawnoverlay"] = { - "world": "survival", - "title": "Spawn Overlay", - "rendermode": spawn_overlay, - "dimension": "overworld", - "overlay": ["survivalday", "survivalnight"], - } - renders["creative"] = { "world": "creative", "title": "Creative", @@ -96,24 +90,30 @@ A more complicated example } outputdir = "/home/username/mcmap" - textures = "/home/username/my_texture_pack.zip" + texturepath = "/home/username/my_texture_pack.zip" -This config defines four maps for render, and one overlay. Two of them are of -the survival world's overworld, one is for the survival's nether, and one is for -a creative world. The overlay is the "spawn_overlay" (which highlights areas -that are dark enough for monsters to spawn) and it will be available when -viewing the survivalday and survivalnight maps. +This config defines four maps for render. Two of them are of the survival +world's overworld, one is for the survival's nether, and one is for the creative +world. Notice here we explicitly set the dimension property on each render. If -dimension is not specified, the default or overworld dimension is used. +dimension is not specified, the default or overworld dimension is used. It is +necessary e.g. for the nether render. Also note here we specify some different rendermodes. A rendermode refers to how the map is rendered. The Overviewer can render a map in many different ways, and there are many preset rendermodes, and you can even create your own (more on that later). -And finally, note the usage of the ``textures`` option. This specifies a texture -pack to use for the rendering. +And finally, note the usage of the ``texturepath`` option. This specifies a +texture pack to use for the rendering. Also note that it is set at the top level +of the config file, and therefore applies to every render. It could be set on +individual renders to apply to just those renders. + +.. note:: + + See the ``sample_config.py`` file included in the repository for another + example. Config File Specifications ========================== diff --git a/docs/index.rst b/docs/index.rst index e553d42..5cd2696 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,7 +10,7 @@ See also the `Github Homepage`_ and the `Updates Blog`_ .. _Github Homepage: https://github.com/overviewer/Minecraft-Overviewer -.. _Updates Blog: http://mcoverviewer.blogspot.com/ +.. _Updates Blog: http://overviewer.org/blog/ Introduction ============ @@ -111,6 +111,9 @@ our `Github Homepage`_. packages and don't want to have to compile anything yourself**, head to the :doc:`installing` page. +**Running Windows and not familiar with the command line?** Head to the +:doc:`win_tut/windowsguide` page. + **If you would like to build the Overviewer from source yourself (it's not that bad)**, head to the :doc:`Building ` page. @@ -148,6 +151,7 @@ Documentation Contents building running config + win_tut/windowsguide faq design/designdoc diff --git a/docs/win_tut/changed_dir.png b/docs/win_tut/changed_dir.png new file mode 100644 index 0000000..74b88e2 Binary files /dev/null and b/docs/win_tut/changed_dir.png differ diff --git a/docs/win_tut/cmd.png b/docs/win_tut/cmd.png new file mode 100644 index 0000000..625e32b Binary files /dev/null and b/docs/win_tut/cmd.png differ diff --git a/docs/win_tut/computer_properties.png b/docs/win_tut/computer_properties.png new file mode 100644 index 0000000..fe74df2 Binary files /dev/null and b/docs/win_tut/computer_properties.png differ diff --git a/docs/win_tut/extracting.png b/docs/win_tut/extracting.png new file mode 100644 index 0000000..47f0cd4 Binary files /dev/null and b/docs/win_tut/extracting.png differ diff --git a/docs/win_tut/location1.png b/docs/win_tut/location1.png new file mode 100644 index 0000000..116215c Binary files /dev/null and b/docs/win_tut/location1.png differ diff --git a/docs/win_tut/location2.png b/docs/win_tut/location2.png new file mode 100644 index 0000000..529ab03 Binary files /dev/null and b/docs/win_tut/location2.png differ diff --git a/docs/win_tut/opening_cmd.png b/docs/win_tut/opening_cmd.png new file mode 100644 index 0000000..4d91ca1 Binary files /dev/null and b/docs/win_tut/opening_cmd.png differ diff --git a/docs/win_tut/system.png b/docs/win_tut/system.png new file mode 100644 index 0000000..62dd637 Binary files /dev/null and b/docs/win_tut/system.png differ diff --git a/docs/win_tut/usage.png b/docs/win_tut/usage.png new file mode 100644 index 0000000..1d8b5b9 Binary files /dev/null and b/docs/win_tut/usage.png differ diff --git a/docs/win_tut/windowsguide.rst b/docs/win_tut/windowsguide.rst new file mode 100644 index 0000000..6097402 --- /dev/null +++ b/docs/win_tut/windowsguide.rst @@ -0,0 +1,139 @@ +==================== +Windows Newbie Guide +==================== +If you're running Windows and aren't as familiar with the Windows command +prompt as the rest of the documentation assumes you are, this page is for you! + +The Overviewer is a *command line* tool, which means you will need to use the command line to run it. + +**First step:** Open the command line. + Open your Start menu and type in the box 'cmd' and press enter. If you're + running XP you'll go to the "run" option instead and then type 'cmd' and + press enter. + + .. image:: opening_cmd.png + + This should bring up the *command prompt*, a black window with a prompt + where you can type *commands*. The prompt part will probably look something + like ``C:\Users\andrew>`` followed by a cursor where you type your commands. + + .. image:: cmd.png + + Leave this window open and move on to step 2. + +Now that you know how to open a command line, and haven't been scared off yet, +the next step is to download the latest Overviewer. + +**Step 2:** Download Overviewer + Go to the `Downloads Page + `_ and + download the *latest* version for your architecture, either 32 bit or 64 + bit. + + *This is important. If you don't know which to choose, 32 or 64,* then you + can find out by clicking on the start menu, *right clicking* on the + "Computer" icon or "My Computer" icon (depending on your version of + Windows), and then selecting "Properties." Somewhere among the information + about your computer it should tell you if you're running a *32 bit operating + system* or *64 bit operating system*. + + .. image:: computer_properties.png + + .. image:: system.png + + Once you know if your computer is 32 or 64 bit, go and download the latest + version. We make small changes all the time, and a new version is uploaded + to that page for every change we make. It's usually best to just get the + latest. + +Okay, you've got a command prompt open. You've got The Overviewer downloaded. +We're half way there! + +**Step 3:** Extract the Overviewer zip you downloaded. + This is easy. I assume you know how to unzip things. Unzip the contents to + somewhere you can find easily. You'll need to find it in the command + prompt. It may help to leave the window with the unzipped contents open so + you can remind yourself where it is. + + *Keep all those files together!* They're all needed to run The Overviewer. + + .. image:: extracting.png + +**Step 4:** Change directory in command prompt to the location of overviewer.exe + You remember the location of the files you just extracted? Windows doesn't + always make it easy. Here's how in windows 7: just click on the little icon + to the left of the directory name. + + .. image:: location1.png + + .. image:: location2.png + + Got the location? Good. We're going to *change directory* to that directory + with the command prompt. Bring the command prompot window back up. The + command we're going to use is called ``cd``, it stands for ... *change + directory*! + + I'm going to illustrate this with an example. Let's say you extracted + Overviewer to the directory + ``c:\users\andrew\overviewer``. Here is exactly + what you'll type into the command prompt and then press enter:: + + cd c:\users\andrew\overviewer + + .. image:: changed_dir.png + + Okay, did it work? Your command *prompt* should now have the *current + working directory* in it. If your prompt changed to the directory that you + just cd'd to, then your current directory changed successfully! You're ready + for the next step! + +Okay before we actually run Overviewer for real, let's do a checkpoint. You +should have *cd*'d to the directory where overviewer.exe is. To test, type this +in and you should see the help text print out:: + + overviewer.exe --help + +note the two hyphens before "help". You should see something like this: + +.. image:: usage.png + +The help text displays the *usage* of overviewer.exe, or the parameters it takes +to run it. It's kind of long, I had to make my window larger to show it all. + +:: + + Usage: + overviewer.exe [OPTIONS] + +Command line tool usage convention says that items in [square brackets] are +*optional*, while items in are *required*. + +**Step 5** Render a map! + Okay, so to render a map, you have to run ``overviewer.exe`` with two + *parameters*: the *world name* and a *destination directory*. + + Let's say you have a world named "Singleplayer world" and you want to put + the tiles into a directory on your desktop. Try typing this into the command + prompt:: + + overviewer.exe "Singleplayer world" c:\users\andrew\desktop\mymap + + .. note:: + You can also use a path to your world instead of a world name if you + know where it's stored. World names only work for single-player worlds. + + If everything went according to plan, The Overviewer should now be churning + away furiously on your world, rendering thousands of image files that + compose a map of your world. + + When it's done, open up the file ``index.html`` in a web browser and you + should see your map! + +I hope this has been enough to get some of you Windows noobs started on The +Overviewer. Sorry there's no easy-to-use graphical interface right now. We want +to make one, we really do, but we haven't had the time and the talent to do so +yet. + +As a next step, head to the :doc:`../options` page to see what else The Overviewer +can do. And as always, feel free to drop by in `IRC +`_ if you have any questions! We're glad to help! diff --git a/overviewer_core/assetmanager.py b/overviewer_core/assetmanager.py index 7b231c3..5d60cae 100644 --- a/overviewer_core/assetmanager.py +++ b/overviewer_core/assetmanager.py @@ -141,6 +141,8 @@ directory. # create overviewer.js from the source js files js_src = os.path.join(util.get_program_path(), "overviewer_core", "data", "js_src") + if not os.path.isdir(js_src): + js_src = os.path.join(util.get_program_path(), "js_src") with open(os.path.join(self.outputdir, "overviewer.js"), "w") as fout: # first copy in js_src/overviewer.js with open(os.path.join(js_src, "overviewer.js")) as f: diff --git a/overviewer_core/data/js_src/util.js b/overviewer_core/data/js_src/util.js index 17390ee..0ac5f25 100644 --- a/overviewer_core/data/js_src/util.js +++ b/overviewer_core/data/js_src/util.js @@ -239,7 +239,7 @@ overviewer.util = { var zoomLevels = model.get("zoomLevels"); var north_direction = model.get('north_direction'); - console.log("fromWorldToLatLng: north_direction is %r", north_direction); + //console.log("fromWorldToLatLng: north_direction is %r", north_direction); // the width and height of all the highest-zoom tiles combined, // inverted @@ -404,7 +404,7 @@ overviewer.util = { // save this info is a nice easy to parse format var currentWorldView = overviewer.mapModel.get("currentWorldView"); currentWorldView.options.lastViewport = [x,y,z,zoom]; - console.log("Updated lastViewport: %r" , [x,y,z,zoom]); + //console.log("Updated lastViewport: %r" , [x,y,z,zoom]); window.location.replace("#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + w + "/" + maptype); }, 'updateHash': function() { diff --git a/overviewer_core/data/js_src/views.js b/overviewer_core/data/js_src/views.js index ff1ac43..bde253e 100644 --- a/overviewer_core/data/js_src/views.js +++ b/overviewer_core/data/js_src/views.js @@ -3,13 +3,13 @@ overviewer.views= {} overviewer.views.WorldView = Backbone.View.extend({ initialize: function(opts) { - console.log("WorldView::initialize()"); - console.log(this.model.get("tileSets")); + //console.log("WorldView::initialize()"); + //console.log(this.model.get("tileSets")); this.options.mapTypes = []; this.options.mapTypeIds = []; this.model.get("tileSets").each(function(tset, index, list) { - console.log(" eaching"); - console.log(" Working on tileset %s" , tset.get("name")); + //console.log(" eaching"); + //console.log(" Working on tileset %s" , tset.get("name")); var ops = { getTileUrl: overviewer.gmap.getTileUrlGenerator(tset.get("path"), tset.get("base"), tset.get("imgextension")), 'tileSize': new google.maps.Size( @@ -55,7 +55,7 @@ overviewer.views.WorldSelectorView = Backbone.View.extend({ "change select": "changeWorld" }, changeWorld: function() { - console.log("change world!"); + //console.log("change world!"); var selectObj = this.$("select")[0]; var selectedOption = selectObj.options[selectObj.selectedIndex]; @@ -63,7 +63,7 @@ overviewer.views.WorldSelectorView = Backbone.View.extend({ // }, render: function(t) { - console.log("WorldSelectorView::render() TODO implement this (low priority)"); + //console.log("WorldSelectorView::render() TODO implement this (low priority)"); } }); @@ -118,11 +118,11 @@ overviewer.views.CoordboxView = Backbone.View.extend({ overviewer.views.GoogleMapView = Backbone.View.extend({ initialize: function(opts) { - console.log(this); + //console.log(this); this.options.map = null; var curWorld = this.model.get("currentWorldView").model; - console.log("Current world:"); - console.log(curWorld); + //console.log("Current world:"); + //console.log(curWorld); var curTset = curWorld.get("tileSets").at(0); @@ -144,9 +144,9 @@ overviewer.views.GoogleMapView = Backbone.View.extend({ var mapOptions = {}; // curWorld.get("tileSets").each(function(elem, index, list) { - console.log("Setting up map for:"); - console.log(elem); - console.log("for %s generating url func with %s and %s", elem.get("name"), elem.get("path"), elem.get("base")); + //console.log("Setting up map for:"); + //console.log(elem); + //console.log("for %s generating url func with %s and %s", elem.get("name"), elem.get("path"), elem.get("base")); }); // init the map with some default options. use the first tileset in the first world @@ -172,7 +172,7 @@ overviewer.views.GoogleMapView = Backbone.View.extend({ // register every ImageMapType with the map $.each(overviewer.collections.worldViews, function( index, worldView) { $.each(worldView.options.mapTypes, function(i_index, maptype) { - console.log("registered %s with the maptype registery", worldView.model.get("name") + maptype.shortname); + //console.log("registered %s with the maptype registery", worldView.model.get("name") + maptype.shortname); overviewer.map.mapTypes.set(overviewerConfig.CONST.mapDivId + worldView.model.get("name") + maptype.shortname , maptype); }); @@ -183,7 +183,7 @@ overviewer.views.GoogleMapView = Backbone.View.extend({ * Should be called when the current world has changed in GoogleMapModel */ render: function() { - console.log("GoogleMapView::render()"); + //console.log("GoogleMapView::render()"); var view = this.model.get("currentWorldView"); this.options.mapOptions.mapTypeControlOptions = { mapTypeIds: view.options.mapTypeIds}; @@ -198,14 +198,14 @@ overviewer.views.GoogleMapView = Backbone.View.extend({ * Keeps track of the currently visible tileset */ updateCurrentTileset: function() { - console.log("GoogleMapView::updateCurrentTileset()"); + //console.log("GoogleMapView::updateCurrentTileset()"); var currentWorldView = this.model.get("currentWorldView"); var gmapCurrent = overviewer.map.getMapTypeId(); for (id in currentWorldView.options.mapTypeIds) { if (currentWorldView.options.mapTypeIds[id] == gmapCurrent) { - console.log("updating currenttileset"); + //console.log("updating currenttileset"); this.options.currentTileSet = currentWorldView.model.get("tileSets").at(id); - console.log(this); + //console.log(this); } } diff --git a/overviewer_core/settingsValidators.py b/overviewer_core/settingsValidators.py index a378108..2cbeaaf 100644 --- a/overviewer_core/settingsValidators.py +++ b/overviewer_core/settingsValidators.py @@ -16,7 +16,35 @@ class Setting(object): self.validator = validator self.default = default +def checkBadEscape(s): + fixed = False + fixed_string = s + if "\a" in fixed_string: + fixed_string = s.replace("\a", r"\a") + fixed = True + if "\b" in fixed_string: + fixed_string = s.replace("\b", r"\b") + fixed = True + if "\t" in fixed_string: + fixed_string = s.replace("\t", r"\t") + fixed = True + if "\n" in fixed_string: + fixed_string = s.replace("\n", r"\n") + fixed = True + if "\v" in fixed_string: + fixed_string = s.replace("\v", r"\v") + fixed = True + if "\f" in fixed_string: + fixed_string = s.replace("\f", r"\f") + fixed = True + if "\r" in fixed_string: + fixed_string = s.replace("\r", r"\r") + fixed = True + return (fixed, fixed_string) + + def validateWorldPath(worldpath): + _, worldpath = checkBadEscape(worldpath) abs_path = os.path.abspath(worldpath) if not os.path.exists(os.path.join(abs_path, "level.dat")): raise ValidationException("No level.dat file in '%s'. Are you sure you have the right path?" % (abs_path,)) @@ -133,6 +161,7 @@ def validateDimension(d): raise ValidationException("%r is not a valid dimension" % d) def validateOutputDir(d): + _, d = checkBadEscape(d) if not d.strip(): raise ValidationException("You must specify a valid output directory") return os.path.abspath(d) diff --git a/overviewer_core/tileset.py b/overviewer_core/tileset.py index aab021c..4a45a08 100644 --- a/overviewer_core/tileset.py +++ b/overviewer_core/tileset.py @@ -398,7 +398,8 @@ class TileSet(object): path = self.options.get('name'), base = '', bgcolor = bgcolorformat(self.options.get('bgcolor')), - world = self.options.get('worldname_orig') + " - " + self.options.get('dimension'), + world = self.options.get('worldname_orig') + + (" - " + self.options.get('dimension') if self.options.get('dimension') != 'default' else ''), last_rendertime = self.this_rendertime, imgextension = self.imgextension, ) diff --git a/overviewer_core/util.py b/overviewer_core/util.py index 50c51ae..3661b2e 100644 --- a/overviewer_core/util.py +++ b/overviewer_core/util.py @@ -64,7 +64,7 @@ def findGitHash(): def findGitVersion(): try: - p = Popen(['git', 'describe', '--tags'], stdout=PIPE, stderr=PIPE) + p = Popen(['git', 'describe', '--tags'], stdout=PIPE, stderr=PIPE, shell=True) p.stderr.close() line = p.stdout.readlines()[0] if line.startswith('release-'): diff --git a/setup.py b/setup.py index c1743ab..e571fa9 100755 --- a/setup.py +++ b/setup.py @@ -100,6 +100,7 @@ if py2exe is not None: setup_kwargs['data_files'] = [('', doc_files)] setup_kwargs['data_files'] += recursive_data_files('overviewer_core/data/textures', 'textures') setup_kwargs['data_files'] += recursive_data_files('overviewer_core/data/web_assets', 'web_assets') + setup_kwargs['data_files'] += recursive_data_files('overviewer_core/data/js_src', 'js_src') setup_kwargs['data_files'] += recursive_data_files('contrib', 'contrib') setup_kwargs['zipfile'] = None if platform.system() == 'Windows' and '64bit' in platform.architecture():