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"

Developing Particle Module

Hello,

I am following the steps on Particle Module Technical Guide to create a cusotomized particle module in C++.

I started out with the Add Code wizard (in UE 4.7.1) and chose ParticleModuleColor as the base class (since ParticleModuleColorBase was for some reasone not selectable) and named the new class MyParticleModuleColor. Then when the new classes were being created an error message popped up:

Failed to add class MyParticleModuleColor. Failed to automatically hot reload the MyCppTestProject module.

But the .h and .cpp files had already been created despite the error message. So I went to VS 2013 and tried to build the project and got the errors:

 1>------ Build started: Project: MyCppTestProject, Configuration: Development_Editor x64 ------
 2>------ Skipped Build: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
 2>Project not selected to build for this solution configuration 
 1>  Compiling game modules for hot reload
 1>  Performing 3 actions (4 in parallel)
 1>  MyParticleModuleColor.cpp
 1>  MyCppTestProject.generated.cpp
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/ParticleModule.h(372): error C2061: syntax error : identifier 'UDistributionFloat'C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/ParticleModule.h(372) : error C2061: syntax error : identifier 'UDistributionFloat'
 1>  
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/ParticleModule.h(382): error C2061: syntax error : identifier 'UDistributionVector'
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/ParticleModule.h(382): error C2061: syntax error : identifier 'UDistributionVector'
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/ParticleModule.h(580): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/ParticleModule.h(580): error C2143: syntax error : missing ',' before '*'
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/ParticleModule.h(580): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/ParticleModule.h(580): error C2143: syntax error : missing ',' before '*'
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/Color/ParticleModuleColor.h(15): error C2079: 'UParticleModuleColor::StartColor' uses undefined struct 'FRawDistributionVector'
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/Color/ParticleModuleColor.h(19): error C2079: 'UParticleModuleColor::StartAlpha' uses undefined struct 'FRawDistributionFloat'
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/Color/ParticleModuleColor.h(15): error C2079: 'UParticleModuleColor::StartColor' uses undefined struct 'FRawDistributionVector'
 1>C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Particles/Color/ParticleModuleColor.h(19): error C2079: 'UParticleModuleColor::StartAlpha' uses undefined struct 'FRawDistributionFloat'
 1>  -------- End Detailed Actions Stats -----------------------------------------------------------
 1>ERROR : UBT error : Failed to produce item: C:\Users\Me\Documents\Unreal Projects\MyCppTestProject\Binaries\Win64\UE4Editor-MyCppTestProject-7247.dll
 1>  Cumulative action seconds (8 processors): 0.00 building projects, 0.80 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.00 linking, 0.00 other
 1>  UBT execution time: 4.14 seconds
 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""C:\Program Files\Epic Games\4.7\Engine\Build\BatchFiles\Build.bat" MyCppTestProjectEditor Win64 Development "C:\Users\Me\Documents\Unreal Projects\MyCppTestProject\MyCppTestProject.uproject" -rocket" exited with code -1.
 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========


Is there a way to fix the problems in UE Editor and VS? And why cannot ParticleModuleColorBase be selected as a base class?

Thank you in advance.

Product Version: Not Selected
Tags:
more ▼

asked Mar 01 '15 at 09:12 PM in C++ Programming

avatar image

dale_z
24 3 4 9

avatar image maschu Oct 21 '16 at 02:07 PM

Hi Epic. I would appreciate if it will be possible to extend particle modules in the game and not the engine itself. It is a hard restriction somehow.

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

2 answers: sort voted first

If you want to derive a particle module classes you have to export them from the engine DLL by adding ENGINE_API modifier:

 class ENGINE_API UParticleModuleColorBase : public UParticleModule

You have to add this too in the UParticleModule, additional in this class remove MinimalAPI:

 UCLASS(editinlinenew, hidecategories=Object, abstract)
 class ENGINE_API UParticleModule : public UObject

and by default some of the UParticleModule methods are marked with ENGINE_API, remove ENGINE_API modifier from them.

And remember to add:

 #include "ParticleDefinitions.h"

in your derived ParticleModule cpp file.

Hope this will help you:)

Regards

Pierdek

more ▼

answered Mar 06 '15 at 08:23 AM

avatar image

Pierdek
2.6k 73 49 131

avatar image dale_z Mar 06 '15 at 04:24 PM

Thank you, Pierdek! Your solution works for me - Exposing the classes from the engine's source and referencing this modified version from a game project. Though in the future it is up to the UE team to decide whether to export these classes in release versions or not, for now this solution somehow maintains the independence of the added functionality from the engine.

As the discussion goes in another thread (https://answers.unrealengine.com/questions/184806/add-new-hcpp-files-to-engine.html), an alternative method would be adding the feature directly inside the engine without changing export modifiers.

Best regards, D

avatar image ZenMonkey May 23 '15 at 05:50 PM

Hi,

I've been trying the same thing here and I must say I'm a little lost as to how to get this work.

I am following the Particle Module Technical Guide and the generated result of this wizard doest compile. With much the same issues as in the first post here. I'm very new to C++ but have several years of C# experience. (not that thats helping)

I've no idea how to apply Pierdek's suggestions here.

Do the changes you mention need to go in the UE4 code base or my game projects code?

The broken starting point that the wizard gives are:

MyParticleModuleColorTest.h:

 #pragma once
 #include "Particles/Color/ParticleModuleColor.h"
 #include "MyParticleModuleColorTest.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class EFFECTSTESTER_API UMyParticleModuleColorTest : public UParticleModuleColor
 {
     GENERATED_BODY()
 };
 

and

MyParticleModuleColorTest.cpp:

 #include "EffectsTester.h"
 #include "MyParticleModuleColorTest.h"

Thanks in advance to anyone who can help here,

Regards

Zen

avatar image respinoza Mar 06 '18 at 08:42 PM

Can't find the Particle Module Technical Guide in the Unreal documentation anymore. Does anyone know why they removed it?

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

Hi there team at Epic! I've been experiencing this particular issue as well. I'm using perforce, and I think that is a part of the equation. Please let us know at your earliest convenience whether this is a bug or if there is a tricky way around it that we haven't quite figure out.

You guys are awesome, and I love your work, keep it up!

more ▼

answered Mar 05 '15 at 11:57 PM

avatar image

HypnosisDigital
1

(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