Utility to extract Fantasy Grounds Unity Line-of-sight and lighting files from a Univeral VTT file exported from Dungeondraft

Overview

uvtt2fgu

Utility to extract Fantasy Grounds Unity Line-of-sight and lighting files from a Univeral VTT file exported from Dungeondraft

This program works with Fantasy Grounds Unity v4.1 or higher as that is the version where dynamic lighting effects were added. This was last used with Dungeondraft v1.0.1.3.

Requirements

uvtt2fgu.py requires a python3 installation with PIP.

Usage

  1. Create your map in Dungeondraft
  2. Export the map in Universal VTT format
    • You do not have to use the default "Best Quality" Grid Preset. You could use the "Roll20" setting as this will make the image files smaller. Remember that your players will need to download these images via FGU. The .jpg is also smaller than the .png. The pixel count is encoded in the exported file and will be correctly set up in FGU when imported.
    • You should turn off Lighting as you want FGU to draw the lighting effects and not have the underlying image with the lighting
    • You should turn off the Grid as well. The grid size will be correctly set up in FGU so you should only need to turn it on within FGU.
    • These are both "should"s and not "must"s. If you want your image to have the lighting drawn on it and/or the grid, it won't break anything.
  3. Run the script as uvtt2fgu.py sampleMap.dd2vtt. This will emit sampleMap.png, sampleMap.jpg, and sampleMap.xml into your current directory
  4. Copy the sampleMap.xml file into your campaign's images directory
  5. Import the .png or .jpg in FGU

Configuration File

The configuration file is a standard .INI format file. All of the configuration lives in a "[default]" section. This file is found In various places:

Platform Location
Windows %APPDATA%\uvtt2fgu\uvtt2fgu.conf
Mac OS $HOME/Library/Preferences/uvtt2fgu/uvtt2fgu.conf
Linux $XDG_CONFIG_HOME/uvtt2fgu.conf
$HOME/.config/uvtt2fgu.conf

The file named in the -c command-line parameter overrides this search. For Linux, it uses the XDG_CONFIG_HOME version if that environment variable is set, otherwise use the $HOME version.

Example configuration file:

[default]
xmlpath=/home/joesmith/.smiteworks/fgdata/campaigns/TestLight/images
writepng=False
jpgpath=out
force=True

This file will cause the program to write the xml file directly out to joesmith's FGU TestLight campaign's images folder. It will write the jpg to the "out" subdirectory of where the script is run. It will overwrite the xml and jpg files if they exist. It will not write out the png file.

Configuration file parameters

Parameter Description Default
alllocaldd2vttfiles If no files are specified, look for all .dd2vtt files in the current directory and convert them False
force Force overwrite destination files False
jpgpath Path where the .jpg file will be written Current working directory
pngpath Path where the .png file will be written Current working directory
remove Remove the source file after conversion False
writejpg Write the .jpg file True
writepng Write the .png file True
xmlpath Path where the .xml file will be written Current working directory

Command-line

usage: uvtt2fgu.py [OPTIONS] [FILES]

Convert Dungeondraft .dd2vtt files to .jpg/.png/.xml for Fantasy Grounds Unity
(FGU)

positional arguments:
  files                 Files to convert to .png + .xml for FGU

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Configuration file
  -f, --force           Force overwrite destination files
  -l {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --log {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Set the logging level
  -o OUTPUT, --output OUTPUT
                        Path to the output directory
  --portalwidth PORTALWIDTH
                        Width of portals
  --portallength PORTALLENGTH
                        Additional length to add to portals
  -r REMOVE, --remove REMOVE
                        Remove the input dd2vtt file after conversion
  -v, --version         show program's version number and exit

Parameters specified on the command-line will supersede parameters specified in the configuration file.

By default, the program will not overwrite destination files. You can use -f to force it to overwrite.

By default, the files are all written into your current directory. You can use -o /otherdir to have the files written into /otherdir.

--portalwidth sets how wide the FGU portals will be. This is specified either as a percentage of a grid width, or as a specific number of pixels. Either --portalwidth 36% or --portalwidth 40px. The default is 25%.

--portallength sets how much extra length for the portals. This is specified just like --portalwidth. The default is 0px.

Acknowledgements

Dungeondraft is a map drawing tool. Dungeondraft is produced by Megasploot.

Fantasy Grounds Unity is a Virtual TableTop program for playing many different table-top Role Playing Games (TTRPG), virtually. FGU is produced by SmiteWorks USA LLC.

uvtt2vtt.py is not endorsed by either of these companies, it is a community-effort to make these two programs interoperable.

Comments
  • Broken LoS when using uvtt2fgu on larger file

    Broken LoS when using uvtt2fgu on larger file

    LoS feature itself works fine, but players can move through walls (with spamming key presses or dragging their token). Will assume problem is tied with file size.

    Added the file in drive: https://drive.google.com/file/d/1O4fVdVbCiOWn12kd1o_WNeLmTiky0umE/view?usp=sharing

    Reference to forum: https://www.fantasygrounds.com/forums/showthread.php?69484-Player-token-moving-through-walls

    invalid 
    opened by Mankomancer 16
  • FA Asset Pack - Door Frame Issue

    FA Asset Pack - Door Frame Issue

    Hey there, thank you for this export. I am just getting into DD and working on a project and came across something that you may or may not have the ability to do anything about. But maybe we can get something changed.

    In the Forgotten Adventures asset pack, there is door frames that can be placed separately from doors. They are in the portal tool, so you end up with in effect, two doors. I endedup remaking my map to not use them but would love to see support for door frames.

    Anything I can do to help let me know.

    Thanks

    invalid 
    opened by rpclarke 10
  • Suggestion: run on directory using config file

    Suggestion: run on directory using config file

    Keep it command-line only and operating system agnostic Allow a configuration file to be specified ( -c , or look for a default "uvtt2fgu.yaml") Config file specifies

    • source directory (default pwd)
    • img output directory (default pwd)
    • xml output directory (default pwd)

    Runs over all .dd2vtt files and convert them Default to check modified dates on output files to determine whether to overwrite them Force (-f) overrides modified check Add a remove (-r) option that removes the .dd2vtt file once processed

    Reasoning: Can put the executable or script file in a directory and run it with a click. Can export all .dd2vtt files into a single folder and then run the script to process changed ones. With a cron job you could set up a "process queue" folder, using the -r parameter to keep the folder clean

    enhancement 
    opened by alexstreit 8
  • something wrong with the latest version of dungeondraft 1.0.1.3

    something wrong with the latest version of dungeondraft 1.0.1.3

    When i create a simple figure with some walls and maps the image is not at the same place than the walls and lights. I haven't that problem with 1.0.1.1. Thanks. FantasyGrounds_Mg5wFa1vx0 FantasyGrounds_MPVI3BX4p5

    bug 
    opened by chalard87 7
  • add jpeg quality options

    add jpeg quality options

    The default Pillow jpeg settings default to quality 75 and don't use the optimize setting. This PR adds the defaults

            self.jpgQuality = 90
            self.jpgOptimize = True
            self.jpgSubsampling = 2
    

    which results in the following improvements:

    Original: original

    With higher quality settings: higher quality

    Obviously this does increase file sizes; so I've added this as configuration that can be overridden if the user wishes.

    enhancement 
    opened by matjam 4
  • Make object LoS blockers terrain blockers instead of hard walls

    Make object LoS blockers terrain blockers instead of hard walls

    From the FGU forums: https://www.fantasygrounds.com/forums/showthread.php?68774-A-new-Dungeondraft-to-Fantasy-Grounds-Unity-conversion-tool&p=621360#post621360

    I don't know if you can differentiate types of vision blocks, but if you enable vision blocking for an object within Dungeondraft, the resulting object gets a hard wall where a terrain wall would be more suitable because the players can't see the object within the wall otherwise.

    enhancement 
    opened by Imagix 2
  • lazy conf generates error and escapes script.

    lazy conf generates error and escapes script.

    Love the script Imagix, use this for tons of my Sunday games.

    I was working with getting a JPG/XML export setup in the .conf file set in &Appdata& and the script generated a 0kb jpg with no xml.

    With the conf file:

    [default]
    xmlpath=!PATH!\ExportedMaps
    writepng=False
    jpgpath=!PATH!\ExportedMaps
    
    #jpgQuality=75
    #jpgSubsampling=2
    #jpgOptimize=True
    
    force=True
    ``
    --CMD--
    PS !PATH!> ./uvtt2fgu.exe ./SuperCave.dd2vtt
    Traceback (most recent call last):
      File "uvtt2fgu.py", line 617, in <module>
      File "uvtt2fgu.py", line 611, in main
      File "uvtt2fgu.py", line 451, in processFile
      File "uvtt2fgu.py", line 418, in writeJpg
      File "PIL\Image.py", line 2172, in save
      File "PIL\JpegImagePlugin.py", line 655, in _save
    ValueError: Invalid quality setting
    [23088] Failed to execute script uvtt2fgu
    ----
    

    The error is generated and just the 0kb jpg exists. The error can be avoided by removing the comments in the above. However I wouldn't expect that I have to set those flags as those are the default values that are used without a config.

    bug 
    opened by kanbie 1
  • Jpg quality adjustments

    Jpg quality adjustments

    The underlying jpg library has some additional controls that can adjust the quality of the jpg generated. Provide configuration parameters to allow them to be used.

    enhancement 
    opened by Imagix 1
  • lazy conf generates error and escapes script.

    lazy conf generates error and escapes script.

    Fixes #25

    The code retrieving the data from the config file wasn't defaulting to valid values, but would default to None, causing errors later. Specifying the three configuration parameters manually would workaround the issue.

    opened by Imagix 0
  • Fails to output map if the resultant map is too large

    Fails to output map if the resultant map is too large

    Attempting to convert a dd2vtt file with too large of an image file may result in an error message such as: PIL.Image.DecompressionBombError: Image size (458752000 pixels) exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.

    There should be a command-line parameter/config file parameter for changing this limit.

    enhancement 
    opened by Imagix 0
  • Pixel coordinates should be rounded to 1 decimal place

    Pixel coordinates should be rounded to 1 decimal place

    According to Smiteworks, the pixel coordinate values are floating point, but are only supposed to be 1 decimal point of precision (as opposed to whatever a float can do).

    bug 
    opened by Imagix 0
Releases(v1.5.1)
Owner
Andre Kostur
Andre Kostur
A toolkit for writing and executing automation scripts for Final Fantasy XIV

XIV Scripter This is a tool for scripting out series of actions in FFXIV. It allows for custom actions to be defined in config.yaml as well as custom

Jacob Beel 1 Dec 9, 2021
A small utility that sorts your files.

FileSorter A small utility that sorts your files. TODO: Scan directory to find files(thanks @corruptmemry for this!) Split extensions to determine fil

null 2 Jun 16, 2022
A utility tool to create .env files

A utility tool to create .env files dump-env takes an .env.template file and some optional environmental variables to create a new .env file from thes

wemake.services 89 Dec 8, 2022
Utility to add/remove licenses to/from source files

Utility to add/remove licenses to/from source files. Supports processing any combination of globs, files, and directories (recurse). Pruning options allow skipping non-licensing files.

Eduardo Ponce Mojica 2 Jan 29, 2022
A simple tool that updates your pubspec.yaml file, of a Flutter project, without altering the structure of your file.

A simple tool that updates your pubspec.yaml file, of a Flutter project, without altering the structure of your file.

null 3 Dec 10, 2021
This code renames subtitle file names to your video files names, so you don't need to rename them manually.

Rename Subtitle This code renames your subtitle file names to your video file names so you don't need to do it manually Note: It only works for series

Mostafa Kazemi 4 Sep 12, 2021
This program organizes automatically files in folders named as file's extension

Auto Sorting System by Sergiy Grimoldi - V.0.0.2 This program organizes automatically files in folders named as file's extension How to use the code T

Sergiy Grimoldi 1 Jan 7, 2022
Extract the download URL from OneDrive or SharePoint share link and push it to aria2

OneDriveShareLinkPushAria2 Extract the download URL from OneDrive or SharePoint share link and push it to aria2 从OneDrive或SharePoint共享链接提取下载URL并将其推送到a

高玩梁 262 Jan 8, 2023
Handy Tool to check the availability of onion site and to extract the title of submitted onion links.

This tool helps is to quickly investigate a huge set of onion sites based by checking its availability which helps to filter out the inactive sites and collect the site title that might helps us to categories what site we are handling.

Balaji 13 Nov 25, 2022
A simple tool to extract python code from a Jupyter notebook, and then run pylint on it for static analysis.

Jupyter Pylinter A simple tool to extract python code from a Jupyter notebook, and then run pylint on it for static analysis. If you find this tool us

Edmund Goodman 10 Oct 13, 2022
About Library for extract infomation from thai personal identity card.

ThaiPersonalCardExtract Library for extract infomation from thai personal identity card. imprement from easyocr and tesseract New Feature v1.3.2 ?? In

ggafiled 26 Nov 15, 2022
Python based tool to extract forensic info from EventTranscript.db (Windows Diagnostic Data)

EventTranscriptParser EventTranscriptParser is python based tool to extract forensically useful details from EventTranscript.db (Windows Diagnostic Da

P. Abhiram Kumar 24 Nov 18, 2022
Extract XML from the OS X dictionaries.

Extract XML from the OS X dictionaries.

Joshua Olson 13 Dec 11, 2022
A python module for extract domains

A python module for extract domains

Fayas Noushad 4 Aug 10, 2022
A hashtag from string extract python module

A hashtag from string extract python module

Fayas Noushad 3 Aug 10, 2022
Program to extract signatures from documents.

Extracting Signatures from Bank Checks Introduction Ahmed et al. [1] suggest a connected components-based method for segmenting signatures in document

Muhammad Saif Ullah Khan 9 Jan 26, 2022
A Python utility belt containing simple tools, a stdlib like feel, and extra batteries. Hashing, Caching, Timing, Progress, and more made easy!

Ubelt is a small library of robust, tested, documented, and simple functions that extend the Python standard library. It has a flat API that all behav

Jon Crall 638 Dec 13, 2022
isort is a Python utility / library to sort imports alphabetically, and automatically separated into sections and by type.

isort is a Python utility / library to sort imports alphabetically, and automatically separated into sections and by type. It provides a command line utility, Python library and plugins for various editors to quickly sort all your imports.

Python Code Quality Authority 5.5k Jan 8, 2023
Utility to play with ADCS, allows to request tickets and collect information about related objects.

certi Utility to play with ADCS, allows to request tickets and collect information about related objects. Basically, it's the impacket copy of Certify

Eloy 185 Dec 29, 2022