[Tool] Blender XML Exporter

Started by GangstaRas, Jun 29, 2019, 11:42 PM

Previous topic - Next topic

GangstaRas

Blender XML Exporter



For those of you looking to develop custom maps for VC:MP, the scale of islands and cities, I've made the process a little easier if you're using Blender. With this rudimentary plugin, you can now directly export the XML mapping data of all objects within your scene in Blender.

So for example:



This scene of an island has almost 2,300 objects, as denoted in the top-right. Quite the hell to record all these coordinates manually. With this plugin, it will generate the xml data of all these objects' coordinates and axes rotations and compile it into one XML file that you put into your maps folder for your server. For the curious, the result of this export looks like this:


Installation:


Download the attached plugin then open Blender. In Blender, go to File > User Preferences (Ctrl + Alt + U) and click on the 'Addons' tab where you will see a button at the bottom of the window that says "Install Addon from file". From there, search for the directory you downloaded this plugin to, and click the python script to install.

Ensure that you enable the plugin by typing 'output' in the search bar at the top left under the 'Addons' tab. The plugin should show up named as "VC:MP Output to XML". Simply click the checkbox to enable. You should see a tick within the box if all is successful.

To use the function, in the open scene, hit Spacebar to bring up the universal searcher and type in 'output' where you should see "Export: Output to XML". Click on this and output to the directory you see fit. The XML file will be called "map.xml" once exported.



Features:

  • Exports coordinates directly from Blender's scene coordinates (ensure that you are within VC:MP limits when creating your scenes)
    • X - -2350 to 1550
    • Y - -1950 to 1950
  • Automatically exports the quaternion rotation data needed by XML mapping (work in Euler angles in Blender and don't worry about it, if you don't understand what I'm saying here, don't worry about it ^-^)
  • Ensures that multiple copies of the same object are given the same ID number (essential for massive exports like these)

Limitations:
  • Currently only exports meshes. You can edit the plugin to add support to export other object types; a UI based system in Blender to easily change these settings have not been made yet.
  • No assigning of object IDs per object. So you will have to use the old fashion way of opening the XML document, finding a particular ID value and do Replace All, so that it matches with your ID setup in your objects.xml



Compatibility

Tested on Blender 2.79. Should work for any of the 2.7 versions, unsure if it would work with Blender 2.80 beta.



Credits:

Thanks to Thijn for creating the plugin to help me out. Grateful for his contribution. Thanks to Drake and Thomas for active support in helping me make changes and necessary fixes to the plugin to ensure maximum capability and compatibility with VC:MP.



Fun Fact:

Not sure if it's documented anywhere but VC:MP does have an object limit with XML objects as well. Through our testing, you can go as high as approximately 13,222 objects

Sebastian

Woah, that's awesome!
Great job!

Klaus


GangstaRas

UPDATE:

  • Fixed an issue where plugin would not export any rotational values unless the object was set to Quaternion Rotation Mode beforehand in the 3D View Window.

Simply re-download the updated plugin, and overwrite the previous version upon installing in Blender.

Stormeus

Quote from: GangstaRas on Jun 29, 2019, 11:42 PMNot sure if it's documented anywhere but VC:MP does have an object limit with XML objects as well. Through our testing, you can go as high as approximately 13,222 objects

This is weirdly specific and probably shouldn't be the case. I'll give it a look sometime soon.

ridonkleberries