Download

Including Header from Private folder?

I am trying to write a simple function that starts the record of the Sequence recorder.

This exists, in the Editor code, here:


C:\Program Files\Epic Games\4.12\Engine\Source\Editor\SequenceRecorder\Private\SequenceRecorderBlueprintLibrary.cpp

The function is:


#include "SequenceRecorderPrivatePCH.h"
#include "SequenceRecorderBlueprintLibrary.h"
#include "SequenceRecorder.h"  

void USequenceRecorderBlueprintLibrary::StartRecordingSequence(const TArray<AActor*>& ActorsToRecord)
{
	FSequenceRecorder::Get().ClearQueuedRecordings();
	for(AActor* Actor : ActorsToRecord)
	{
		FSequenceRecorder::Get().AddNewQueuedRecording(Actor);
	}
	
	FSequenceRecorder::Get().StartRecording();
}

So, in my code, i have:


include "Editor/SequenceRecorder/Private/SequenceRecorder.h"

void UrecordTools::StartRecordz(AActor* recordtarget)
{
	TArray<AActor*> ActorsToRecord;

	ActorsToRecord.Add(recordtarget);

	FSequenceRecorder::Get().ClearQueuedRecordings();
	for (AActor* Actor : ActorsToRecord)
	{
		FSequenceRecorder::Get().AddNewQueuedRecording(Actor);
	}

	FSequenceRecorder::Get().StartRecording();


}

This will not compile, giving an error in: SequenceRecorder.h




Cannot open include file: 'MovieSceneAnimationSectionRecorder.h': No such file or directory



Is this because it is a private header and I am including it in another class? How can I get around this? (I have included every module I can think of in my Build.cs, and added the path to the headers )

On your Plugin_name.build.cs, you simple need to add the name of your module inside the string array of PublicDependencyModuleNames like this:


PublicDependencyModuleNames.AddRange(new string] { /*..other module or empty*/ "SequenceRecorder" });

And you include header on your code


#include "SequenceRecorder.h"

I hope this help you ! :slight_smile:

P.S: Wiki about plugin creation here

I had that module, and that include, already linked. But I needed to add:


#include "IMovieSceneModule.h"
#include "IMovieSceneSectionRecorder.h"
#include "IMovieSceneSectionRecorderFactory.h"

and:


 "MovieScene",  "MovieSceneTracks",

to the modules in Build.cs.

Now I get no linking errors, BUT… When I use any code from the SequenceRecorder Module, I get unresolved external symbols…



PublicDependencyModuleNames.AddRange(new string] {  "SequenceRecorder","Core",
                    "CoreUObject",
                    "InputCore",
                    "Engine",
                    "UnrealEd",
                    "EditorStyle",
                    "LevelEditor",
                    "MovieScene",
                    "MovieSceneTracks",
                    "LevelSequence",
                    "CinematicCamera", "Sequencer",});



#include "Editor.h"
#include "LevelSequence.h" 
#include "IMovieSceneModule.h"
#include "IMovieSceneSectionRecorder.h"
#include "IMovieSceneSectionRecorderFactory.h"
#include "Runtime/Engine/Classes/Animation/AnimationRecordingSettings.h"
#include "ISequenceRecorder.h"
#include "SequenceRecorder.h"
#include "SequenceRecorderBlueprintLibrary.h"
#include "SequenceRecorder.h"
#include "ActorRecording.h"
#include "SequenceRecorderUtils.h"
#include "SequenceRecorderSettings.h"


void UrecordTools::StartRecordz()
{
	
	FSequenceRecorder::Get().ClearQueuedRecordings();
	
}

gives:



unresolved external symbol "public: static struct FSequenceRecorder & __cdecl FSequenceRecorder::Get(void)" (?Get@FSequenceRecorder@@SAAEAU1@XZ) referenced in function "public: static void __cdecl UrecordTools::StartRecordz(class AActor *)" (?StartRecordz@UrecordTools@@SAXPEAVAActor@@@Z)	

unresolved external symbol "public: void __cdecl FSequenceRecorder::ClearQueuedRecordings(void)" (?ClearQueuedRecordings@FSequenceRecorder@@QEAAXXZ) referenced in function "public: static void __cdecl UrecordTools::StartRecordz(class AActor *)" (?StartRecordz@UrecordTools@@SAXPEAVAActor@@@Z)	

It seems like I am still missing a Module, right?
Thanks for your help.

Not all functions are exported from a module. That means that sometimes you have to implement those functions yourself.

You should look if the missing functions are actually exported from the module (they should have a macro like ENGINE_API or MinimalAPI in the class/function signature).

Ah I see. That would make sense. The approach, as above, calls a struct:


struct FSequenceRecorder
{
public:
	static FName MovieScenePropertyRecorderFactoryName;

	/** Singleton accessor */
	static FSequenceRecorder& Get();

void ClearQueuedRecordings();

//more things

};

from



c:\Program Files\Epic Games\4.12\Engine\Source\Editor\SequenceRecorder\Private\SequenceRecorder.h

The function I copied the code from comes from USequenceRecorderBlueprintLibrary , and the header file class declaration is:


class SEQUENCERECORDER_API USequenceRecorderBlueprintLibrary : public UBlueprintFunctionLibrary

Does this mean it would not export? Is there a way to access a different API class?

Thank you for your help!

The SEQUENCERECORDER_API means that all public methods from USequenceRecorderBlueprintLibrary are exported from the module, so you may call them from your own module.
Since the FSequenceRecorder class does not expose its methods you are not able to call them directly.

They already put the SequenceRecorder.h in their “Private” folder, so they do not want you to directly access it because it is not part of the module’s API.
If you are desperate you can of course edit the engine code and add the SEQUENCERECORDER_API tags yourself, then your code should compile.

Ok, thank you again.

So the method:


UCLASS()
class SEQUENCERECORDER_API USequenceRecorderBlueprintLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

	/** 
	 * Start recording the passed-in actors to a level sequence.
	 *  @param	ActorsToRecord	The actors to record
	 */


public:
	UFUNCTION(BlueprintCallable, Category="Sequence Recording")
	static void StartRecordingSequence(const TArray<AActor*>& ActorsToRecord);

};

Should be accessible?

I am calling it with:


void UrecordTools::StartRecordz(AActor* recordtarget)
{
	TArray<AActor*> ActorsToRecord;

	ActorsToRecord.Add(recordtarget);

	USequenceRecorderBlueprintLibrary::StartRecordingSequence(ActorsToRecord);
}

And it gives me:


unresolved external symbol "__declspec(dllimport) public: static void __cdecl USequenceRecorderBlueprintLibrary::StartRecordingSequence(class TArray<class AActor *,class FDefaultAllocator> const &)" (__imp_?StartRecordingSequence@USequenceRecorderBlueprintLibrary@@SAXAEBV?$TArray@PEAVAActor@@VFDefaultAllocator@@@@@Z) referenced in function "public: static void __cdecl UrecordTools::StartRecordz(class AActor *)" (?StartRecordz@UrecordTools@@SAXPEAVAActor@@@Z)	

…as above, I have:


PublicDependencyModuleNames.AddRange(new string] {  "Core", "CoreUObject",
                    "Engine",
                    "UnrealEd",
                    "MovieScene",
                    "MovieSceneTracks","SequenceRecorder"
                   });

If you edit the engine files, you need to rebuild the UE4 solution (from Git hub) and not just your own project solution. You’ll also need to make sure you regenerate your project solution after you recompile everything engine side.

Separately: I assume that what you want to run will only be used by people in the editor?
Anything from the editor that you reference, will not be available to players at runtime.
Also: There’s a reason the header is in the “Private” directory …

That is strange, from what you posted the StartRecordingSequence method should be accessible.
This kind of thing is exactly why I dislike the Unreal Build system.

Yes there is a reason whey they are at private sections… they are meant to be used within Unreal only, and the classes are not exported to others (dlls, exes) to use.

But if it is marked with SEQUENCERECORDER_API then it is meant to be exported and used by other modules.