12.11.2018, 14:12
(
Last edited by Sasino97; 10/01/2019 at 07:44 PM.
)
SceneEditor
By
IntroductionBy
Hello there, I hope you are doing fine. Good news for SA-MP mappers: In my spare time I am working on a new Scene Editor for SA-MP.
It's been a while since Jernej L. left SA-MP, and unfortunately his awesome map editor that I used a lot, now has become outdated: it does not support some features that were added in SA-MP relatively recently. That is why I think a new editor is needed.
I am posting this thread only because I need help with the development.
What Has Already Been Done
At this stage, the software app is not useable for the purpose.
As of 12/11/2018, 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)
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 / FC-NPCs
- Checkpoints
- Race Checkpoints
- 3D Text Labels
- Custom Entities (e.g. gates, elevators, barriers)
- Maybe more...
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 SA-MP scripts using an include that contains a function which parses that kind of file and creates the objects accordingly. The include 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:
pawn Code:
#include <streamer>
#include <Scene>
#include <zcmd>
new Scene: islandScene;
new objGate1;
public OnGameModeInit()
{
// 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;
}
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/FC-NPCs). 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 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 FC-NPC), then the changes will reflect in the scene, but in a similar way to the Material Editor, the data can be exported separately.
6. SA-MP DL Support
It will allow the users of the DL editions of SA-MP to also 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 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.
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
- The programming language is C#
- The app platform is WPF (> .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 and not Git, because it's better
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 permissions to commit in the repository.
Repository
Follow this link to see the source code:
Bitbucket
Building
Visual Studio 2017 and the .NET desktop development workload are required to build the project. During the first build, an internet connection is required to download the NuGet packages.
License
Mozilla Public License