2019-06-21, 11:10 AM
(This post was last modified: 2020-04-16, 04:32 AM by Sasino97.
Edit Reason: New repository link (unwillingly had to switch from Mercurial to Git)
)
SceneEditor
By
Sasinosoft Scene Editor For SA-MP Map Editor for SA-MP San Andreas Multiplayer edit map objects by Sasino97 Sasino
Introduction
This tool is an upcoming replacement for Map Construction?by Jernej L. which aims to provide a new range of functionality,?some of which?weren't available in SA-MP at the time of the editor. It's completely open source (as required by this forum's rules)?and anyone is welcomed to?contribute. I especially need your help with regards to TXD textures, since I am having hard time to make them?work correctly.
What Has Already Been Done
Important note:?At this stage, the software app is?not?usable for the purpose (you cannot make SA-MP?maps with it yet).
To date (21/06/2019), the following things have been done:
- A main window with a 3D Viewport and a menu
- The camera mouse/keyboard/touch gestures with Helix Toolkit
- A settings window in which you can configure the path to GTA SA
- An IMG Archive reader (translated from an existent C code)
- Parser for RenderWare .DFF models (certain models are not being loaded correctly)
- Parser for RenderWare .TXD texture dictionaries (some types of decompression are missing)
- Model classes for IDE files
I want to say thanks to JernejL, kcow, steve-m and the other authors of free/open source software found on the GTA Forums regarding the RW formats.
Planned Features
1. Not Only Objects!
One of the main differences between this Scene Editor and JernejL's is that, while the latter only allowed to create objects and vehicles (and to remove buildings), this one will support much more:
- Objects
- Building Removal
- Vehicles
- Pickups
- Actors / FCNPCs
- Checkpoints and Race Checkpoints (streamer)
- 3D Text Labels
- Custom Entities (e.g. gates, elevators, spawn points, teleports)
2. Import / Export
The app will export all the scene data to a .JSON file. This JSON file can be loaded again into the app to resume the previous work, but the point is that this JSON file can also be loaded by the?open.mp/SA-MP scripts using a library?that contains a function which parses that kind of file and creates the objects accordingly. The library?will use dynamic objects/actors/pickups/text3ds if Incognito's streamer is included. The checkpoints/race checkpoints will be created only if the Streamer is included. The editor will allow you to apply IDs to any object/vehicle/... in order to retreive them later in the code; an example are gates, which often need to be opened and closed.
An example of how it could be used, in the case of a Pawn game mode:
#include <streamer>
#include <Scene>
#include <zcmd>
new Scene: islandScene;
new objGate1;
public OnGameModeInit()
{
? ? // Note:?Scenes/Island.json is inside scriptfiles
? ? islandScene = Scene.Load("Scenes/Island.json"); // this single line creates all the objects, pickups, vehicles, actors (etc...) found in this file, and stores references to those who have an ID
? ? objGate1 = Scene.FindById(islandScene, "Gate1");
? ? return 1;
}
CMD:opengate1(playerid, params[])
{
? ? MoveDynamicObject(objGate1, 1242.47, 4214.55, 16.5, 1.0);
? ? return 1;
}
A C# API is also planned for SampSharp and open.mp.
The app will also be able to import a normal .pwn file and interpret all the CreateObject(/CreateDynamicObject/CreateActor/CreateVehicle, etc...) found in it, and save them into the JSON format. This is for backwards compatibility with JernejL's map editor. There will also be an option to export a plain .pwn file, but in that case the advantages of code/resource separation will be lost.
3. Scene Editor
The main scene editor will be pretty much the same as JernejL's. It will feature an object browser window in which you will be able to search through all the objects using their name, id, and maybe category and description.
It will probably support multiple tabs each of which contains a viewport, enabling you to quickly switch between two or more views.
You will move around the scene in almost the same way as with JernejL's editor, but since the Helix 3D Viewport also handles touch gestures, it will be a lot easier to use this editor with a tablet (a Windows tablet, of course).
The right click (or long touch) on an object will open the context menu that offers the ability to delete the object, edit the materials or add attachments (in case of vehicles/FCNPCs). Of course keyboard shortcuts will be also provided.
4. Material Editor
You will be able to use the material editor to change the materials and material text of any object. This editor will also feature a texture browser in which you will be able to search through all textures.?
The material editor can be used both while editing a scene to make a specific object in the scene have a specific set of materials, or alone, allowing you to export only the fragment of JSON data needed for that particular material configuration.
5. Attached Offsets Editor
The editor will feature an editor for Player/Vehicle attachments of objects. If used together with the Scene Editor (for example by right-clicking a vehicle or an FCNPC), then the changes will reflect in the scene, but in a similar way to the Material Editor, the data can be exported separately.
6. DL?Support
It will allow the scene designers?of open.mp and?SA-MP DL?to use their custom models in the Scene Editor. They will simply have to add one or more model folders in the settings, and the app will load them.
7. Properties
You will be able to attach properties to scene objects. For example, you could add a?weight?property to doors, so that you can access that value from code and make the door open after the player presses a certain button a number of times.
8. Add-ons / plugins
There will be support for add-ons that add custom entities. For example, one could create a house system filterscript, and then create an add-on for the Scene Editor, so that you can add houses in it.
9. Team
This will be an exciting feature: two or more people can work together on the same scene at the same time in order to enhance productivity. The file on which the team works will only be accessible to the host of the team session; the clients can only work on the scene without the possibility of saving the file on their machines (unless they hack the program of course).
10. Themes
The application will support default white and dark themes as well as custom themes.
11. Additional Tools
A few tools that could be useful which don't directly relate to map editing:
- Animation Browser
- Sound Browser
Technical Information
- The programming language is?C#
- The app platform is Windows Presentation Foundation a.k.a. WPF?(requires .NET Framework >=?4.6.1)
- 3D rendering is done by WPF 3D (which in turn uses Direct3D)
- Uses the Helix Toolkit (?link?) for some advanced 3D controls, like their enhanced 3D Viewport
- Uses a managed wrapper for Libsquish for texture decompression (DXT)
- The Version Control System is?Mercurial?is now Git
Contribute To Development
Everyone is welcomed to contribute to the development of this awesome scene editor! Just send me an email (address at the bottom of my signature) and I will give you write permissions.
Repository
Since Bitbucket removed Mercurial support, I finally decided to move to Git and GitHub.
I still sincerely hate?Git, and I still believe?Mercurial is 100 times better,?but I like how the GitHub platform works, so I decided to switch.
This is the new repository:
https://github.com/SaSiNO97/scene-editor
Building
Visual Studio?and the?.NET desktop development?workload?are required to build the project. I am using Visual Studio 2019.
During the first build, an internet connection is required to download the necessary NuGet packages.
License
Mozilla Public License