Jump to content

Select a .node file using a dialog in the editor


photo

Recommended Posts

Hi,

When you click on Create -> Node -> Reference, you get a dialog as shown bellow to select a .node file.

image.thumb.png.ecb6c8e182ada27e0339853ee1bcb6b7.png

Can a dialog like this be shown using the editor's API in C++?

Thanks

Link to comment

Hello Karim,

There are examples of API using.

E.g. how to open a dialog to browse one asset:

#include <editor/AssetDialogs.h>

auto callback = MakeCallback([](const ::Editor::AssetDialogs::SelectedAsset &s) {
	Log::message("asset: %s, runtime: %s, asset path: %asset\n",
		s.asset_guid.getString(), s.runtime_guid.getString(), s.asset_guid.getFileSystemString());
});
::Editor::AssetDialogs::browseAsset(callback, "Select Node or Mesh", ".node.mesh", "some/existed/my.node");

How to open a dialog to browse a lot of assets:

auto callback = MakeCallback([](const Vector<::Editor::AssetDialogs::SelectedAsset> &vec) {
	for (const ::Editor::AssetDialogs::SelectedAsset &s : vec)
	{
		Log::message("asset: %s, runtime: %s, asset path: %asset\n",
			s.asset_guid.getString(), a.runtime_guid.getString(), s.asset_guid.getFileSystemString());
	}
});
::Editor::AssetDialogs::browseAssetList(callback, "Select Nodes and Meshes and Material Graphs", ".node.mesh.mgraph", "some/existed/my.mesh");

How to open a dialog to choose a path for saving a new asset:

auto callback = Unigine::MakeCallback([](const char *s) {
	Log::message("New path: %s\n", s);
});
::Editor::AssetDialogs::saveAsset(callback, "Save My Asset", ".node.mesh", "demos/oil_platform");

 

  • Thanks 1
Link to comment
×
×
  • Create New...