Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 UE4 "create implementation" order
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

CitizenMM
New Member

USA
6 Posts

Posted - Jan 25 2022 :  09:39:03 AM  Show Profile  Reply with Quote
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;
}


CitizenMM

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Jan 25 2022 :  12:38:01 PM  Show Profile  Reply with Quote
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

zen is the art of being at one with the two'ness
Go to Top of Page

CitizenMM
New Member

USA
6 Posts

Posted - Jan 25 2022 :  12:50:46 PM  Show Profile  Reply with Quote
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.

CitizenMM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Jan 26 2022 :  11:23:44 AM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page

CitizenMM
New Member

USA
6 Posts

Posted - Jan 26 2022 :  12:11:16 PM  Show Profile  Reply with Quote
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. :)

CitizenMM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Jan 27 2022 :  07:29:17 AM  Show Profile  Reply with Quote
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

zen is the art of being at one with the two'ness
Go to Top of Page

CitizenMM
New Member

USA
6 Posts

Posted - Jan 27 2022 :  09:10:06 AM  Show Profile  Reply with Quote
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.

CitizenMM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Jan 27 2022 :  10:05:44 AM  Show Profile  Reply with Quote
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

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000