Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 UE4 "create implementation" order

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
CitizenMM Posted - Jan 25 2022 : 09:39:03 AM
When I have the following code (first block) and click on Server_StartANewGroup to create the implementation, the _Validate and _Implementation is created in the cpp as expected but the order is reversed (Second block), with the Implementation showing first, then the Validate under it. All the tutorials I have done always show the Validate before the Implementation, as shown in the declaration order below. Have I been doing this wrong and should have the Validate last? (Note: Changing the declaration order makes no difference, the Validate still shows up below the Implementation)


UFUNCTION(Server, Reliable, WithValidation)
	void Server_StartANewGroup(FGroupData NewGroupData);
	bool Server_StartANewGroup_Validate(FGroupData NewGroupData);
	void Server_StartANewGroup_Implementation(FGroupData NewGroupData);



void UGI_Groups_Subsystem::Server_StartANewGroup_Implementation(FGroupData NewGroupData)
{

}

bool UGI_Groups_Subsystem::Server_StartANewGroup_Validate(FGroupData NewGroupData)
{
    return true;
}

7   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jan 27 2022 : 10:05:44 AM
Interesting, when I was first looking into this the examples I found only had the "main" declaration, which makes having two implementations with different names really confusing at first.

This might also be why various of our users who work with Unreal Engine have reported turning off IDE intellisense, which also stops any IDE intellisense warnings from showing up, and instead just using VA's intellisense parser.

If you want to try, this is normally done via:

IDE tools menu -> Options -> Text Editor -> C/C++ -> Advanced -> IntelliSense -> Disable IntelliSense = True
CitizenMM Posted - Jan 27 2022 : 09:10:06 AM
It does compile without the 2nd and 3rd declarations (weird) but it leaves the IntelliSense red squiggles under the functions. I guess that's why the tutorials I've followed declare them, to avoid it looking like an error, or to feed their OCD, lol.

Thanks again for your insight!

Cheers.
feline Posted - Jan 27 2022 : 07:29:17 AM
My understanding, which may well be wrong, is that you don't need, perhaps don't even want, the 2nd and 3rd function declarations in your header file. By passing the flags you are passing to UFUNCTION() you are telling Unreal Engine to generate these two versions of the function for you, so there is no need to specify them yourself.

Which is why I misunderstood your first post, I just assumed you weren't actually placing 3 declarations into the header file, since UFUNCTION() and the first declaration already did all of this for you. The joys of assuming things
CitizenMM Posted - Jan 26 2022 : 12:11:16 PM
I do start with the 3 function declarations in the header. However, I just tried the Create Implementation with only the first entry specified (void Server_StartANewGroup(FGroupData NewGroupData);) After testing it that way, it does indeed create the Validate and Implementation functions in the cpp, even when not specified in the header. It also creates them in the same order as my original post, which means it will do that regardless of what's in the header.

So, it's not really an inversion so much as that's just the order in which they are created and if I don't prefer it I guess I just reorder them as necessary.

Thanks for helping me understand. :)
feline Posted - Jan 26 2022 : 11:23:44 AM
OK, I am going to have to start asking "stupid" questions now, since my knowledge of Unreal Engine is rather random.

Are you actually starting with 3 function declarations in your header file? Or only one function declaration?

Since you have marked the first function declaration the way you have, when you trigger Create Implementation on it, VA will generate the _Implementation and _Validate versions of the function automatically, no need and no expectation of these versions being declared manually in the header file.

As I understand the macros, these declarations are created in the background, at compile time, by Unreal Engine. Since VA is not expecting to see declarations of the _Implementation and _Validate versions, it doesn't have (doesn't look for) an order to copy.
CitizenMM Posted - Jan 25 2022 : 12:50:46 PM
True, the ordering doesn't matter in regards to functionality, it's more of a nitpick than anything and I have been manually adjusting as necessary. I just find it weird that the functions get reversed from the order I declare them.
feline Posted - Jan 25 2022 : 12:38:01 PM
Normally the ordering of class member functions doesn't matter. I am not aware of any reason this would matter in Unreal Engine, but to be fair I know very little about using Unreal Engine.

Does your code work correctly with this ordering?

In case you are not aware, VA Outline can be used to drag and drop items to reorder functions in the current file, which might be helpful here, and just generally helpful:

https://docs.wholetomato.com/default.asp?W187

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000