Closed StenBone closed 9 years ago
I'll try to answer since I don't know if Andrew is still supporting this. :)
You should be able to add the "BrickGrid" module as a dependency module to BrickGame.Build.cs. Even though BrickGrid is a module within a plugin, game projects are allowed to explicitly depend on plugin modules, which is needed if you want to inherit from types declared inside the plugin. You should then be able to include the public header files from that module. Public headers are any header files in the module's Classes or Public directories (BrickGridComponent.h is currently public.) Just keep in mind that some of the BrickGrid data structures may need to be "exported" to be able to link with them. You can do this by decorating those types with BRICKGRID_API. For example: struct BRICKGRID_API FBrickGridData
.
--Mike
Thanks Mike! I had a similar reply typed up, but then I got distracted making coffee and you beat me to it! :)
Andrew,
While we're on the topic of utilizing/expanding the BrickGame plugin I was wondering if you would foresee any issues with using multiple BrickGrids in a scene?
Background: I am working on a UE Voxelization plugin which takes static meshes and converts them to Voxel Octree Volumes. Currently I'm interfacing with the BrickGrid Plugin to render the Octrees in the single BrickGrid; however, I would like to create BrickGridActors which would have their own VoxelVolumes and BrickGridComponents and would render separately.
I realize the Ambient Occlusion calculations would also separate; however, I eventually plan on implementing Voxel Cone Tracing for illumination.
Thanks,
Aaron Blair
Sent from my iPhone
On Dec 11, 2014, at 8:59 AM, Andrew Scheidecker notifications@github.com wrote:
Thanks Mike! I had a similar reply typed up, but then I got distracted making coffee and you beat me to it! :)
— Reply to this email directly or view it on GitHub.
Thanks for the help Mike. You have got me halfway there. I changed my build file to include the "BrickGrid" module and I can now successfully include BrickGridComponent without getting any errors. Unfortunately, I am still getting an error where I am trying to use the struct.
The line I am having problems with is in my header file. struct BRICKGRID_API BrickGridData data;
The error message says that my class uses undefined struct BrickGridData.
Am I missing something here?
You only need the BRICKGRID_API in the header file that declared it. So you need to modify Andrew's original header file where the struct itself is declared (BrickGridComponent.h), not in your own project's source files. In some cases you might not even need to bother adding BRICKGRID_API. See if you get any link errors without adding that first.
So I tried building it without BRICKGRID_API and then I tried it after adding BRICKGRID_API to the declared stuct in "BrickGridComponent.h". Both failed and gave a similar error message to the one before.
So just to give some background into what I am doing. I am trying to recreate some of the functionality found in projects blueprints in C++ code. I am doing this primarily for practice.
This is the code that I have so far for my BrickSaveGame class which is based of the BrickSaveGame blueprint. I don't really have anything in the source file so I will not post it.
It is also important to note that this class is in the BrickGame folder.
// Copyright 2014 Andrew Scheidecker
#pragma once
#include "GameFramework/SaveGame.h"
#include "BrickGridComponent.h"
#include "BrickSaveGame.generated.h"
/**
*
*/
UCLASS()
class BRICKGAME_API UBrickSaveGame : public USaveGame
{
GENERATED_BODY()
private:
struct BrickGridData data;
};
Please let me know if you need anymore details.
spyd3rweb: Multiple BrickGridComponents should work fine, though I haven't tried it.
BloodHound27: I think you're just missing the F on FBrickGridData. You shouldn't need to add BRICKGRID_API anywhere if you're just reproducing the behavior of the blueprints. If you go beyond that you might run into some functions or classes I forgot to add it to, but if that happens, it goes on the declaration in the plugin.
So, I finally had time to return to the the code and it turns out that you were right @AndrewScheidecker . It needed to be FBrickGridData. I am now closing this issue and pasting my working code.
// Copyright 2014 Andrew Scheidecker
#pragma once
#include "GameFramework/SaveGame.h"
#include "BrickGridComponent.h"
#include "BrickSaveGame.generated.h"
/**
*
*/
UCLASS()
class UBrickSaveGame : public USaveGame
{
GENERATED_BODY()
private:
struct FBrickGridData data;
};
Thank you @AndrewScheidecker and @MikeFricker for your help.
Hello Everybody,
This is less of an issue and more of a question.
I am trying to use the struct FBrickGridData from BrickGridComponent, but I am having no luck. What are the appropriate includes to use this struct in a class like BrickGameCharacter?