LmbrCentral relative includes

0

Hi, So I've seen this come up a number of times already and not found anyone with a solution to it. When including a header from LmbrCentral it seems everyone is using relative includes, which should be avoided. For example:

#include "..\..\..\..\LmbrCentral\Code\include\LmbrCentral\Physics\PhysicsComponentBus.h"

There has to be a better way of doing this. A number of Gems with such includes broke between versions because the relative include path changed. Shouldn't the VS Solution have LmbrCentral as an Include Directory by default, or am I missing something?

Regards, Uriah

asked 7 years ago165 views
5 Answers
0
Accepted Answer

should be able to use the includes declaration in the wscript by using bld.Path but I cant find the LmbrCentral folder to make use of it as a suggestion to avoid it. Where is the LmbrCentral includes folder anyway?

answered 7 years ago
0

So LmbrCentral is a Gem, with the includes here:

dev\Gems\LmbrCentral\Code\include\LmbrCentral\

If you make a new project the LmbrCentral project will be in Visual Studio Solution, so in the project solution it is fine, the include will be:

#include <LmbrCentral\Physics\PhysicsComponentBus.h>

But, referring to my other post, I am not clear what the workflow for a Gem is exactly (independent from a project), and from a Gems' header/source file, the path to LmbrCentral must be relative.

answered 7 years ago
0

Well, I had done something similar when CryMovie migrated into Maestro.

In my game's gem wscript's includes definition i added "bld.Path('Gems/Maestro/Code/Source')" to be able to use source code in that is in maestro.

But any gem that uses the "Include" folder within it's Code folder should have it exposed.

Though since I did have some issues, that I got help with, when trying to use another gem's includes I've had to use the gem.json's Dependencies definition in order to be able to use another gem's includes.

I believe the Dependencies definition is your best bet for that.

Example gem.json:

	{
"Dependencies": [
{
"Uuid": "3b9a978ed6f742a1acb99f74379a342c",
"VersionConstraints": [
">=0.1"
],
"_comment": "Maestro"
}
],
"GemFormatVersion": 4,
"Uuid": "<GUUID>",
"Name": "<Name>",
"DisplayName": "<Name>",
"Version": "0.1.0",
"Summary": "Summary",
"Tags": [ "Game" ],
"IconPath": "preview.png",
"IsGameGem": true,
"Modules": [
{
"Type": "GameModule"
}
]
}
answered 7 years ago
0

That worked perfectly! Thanks a lot! :D

Now if I build LumberyardSDK and open the Solution, the Gems' includes to the LmbrCentral Gem are valid, for example:

#include <LmbrCentral\Scripting\TriggerAreaComponentBus.h>
answered 7 years ago
0

No problem, glad to have helped. ^.^

answered 7 years ago

This post is closed: Adding new answers, comments, and votes is disabled.