x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to create your own ScriptGenerator

I'm working on a language plugin for Unreal, and I've been trying to figure out how does UHT pick up your own ScriptGenerator plugin. By reading the source code, I understand I should inherit from IScriptGeneratorPluginInterface and do something like IModularFeatures::Get().RegisterModularFeature(TEXT("ScriptGenerator"), this); at startup. However, I've been having trouble to even get my module loaded.

By following ScriptGeneratorPlugin example, I've made a new plugin with the following .uplugin:

 {
     "FileVersion" : 3,
     "FriendlyName" : "UE4Haxe Extern Generator plugin",
     "Version" : 1,
     "VersionName": "alpha",
     "FriendlyVersion" : "1.0",
     "EngineVersion" : "4.8.0",
     "Description" : "Automatically generate externs from UHT definitions",
     "Category" : "Scripting",
     "EnabledByDefault" : true,
     "IsBetaVersion" : true,
     "Modules" :
     [
         {
             "Name" : "HaxeExternGenerator",
             "Type" : "Program",
             "LoadingPhase" : "PostConfigInit"
         }
     ]
 }

Right now my implementation of the module just consists of stub calls. For example, the header is:

 #pragma once
 
 #include <IScriptGeneratorPluginInterface.h>
 #include <Modules/ModuleManager.h>
 
 class IHaxeExternGenerator : public IScriptGeneratorPluginInterface
 {
 public:
   static inline IHaxeExternGenerator& Get() {
     return FModuleManager::LoadModuleChecked<IHaxeExternGenerator>("HaxeExternGenerator");
   }
 
   static inline bool IsAvailable() {
     return FModuleManager::Get().IsModuleLoaded("HaxeExternGenerator");
   }
 };


And the C++ file implements all abstract functions from IScriptGeneratorPluginInterface and StartupModule/ShutdownModule. The C++ code also calls IMPLEMENT_MODULE(FHaxeExternGenerator, HaxeExternGenerator)

The strange part is that when the .uplugin is defined as a program - like it is right now - UBT won't even build it when building the main project. When I change it to Editor, it does build, but the resulting module doesn't get loaded in UBT in time for it to be picked up by UHT.

Am I missing something?

Product Version: UE 4.9
Tags:
more ▼

asked Oct 27 '15 at 04:10 PM in C++ Programming

avatar image

waneck
16 6

avatar image Robert A. Sep 29 '16 at 07:03 PM

Any answer to this question?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

It turns out you'll need to actually change the Target.cs file of UnrealHeaderTool to make the program build, like this: https://github.com/proletariatgames/UE4HaxeExternGenerator

more ▼

answered Sep 29 '16 at 07:06 PM

avatar image

waneck
16 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question