Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Extract Method with Extract to Source enabled

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
Sodrek Posted - Jun 04 2020 : 01:17:49 AM
I'm using UE4 and when I'm using Extract Method with Extract to Source enabled, the implementation will be still generated in the header file. How do I fix this?
6   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jun 09 2020 : 12:40:46 PM
Please do. Since this example works correctly, a silly question occurs to me. Does your solution currently compile? I am simply wondering if the problem is related to incomplete code. If you are currently working in the files where you want to run Extract Method, it is possible the function you are sitting in doesn't compile. This could then confused VA, and help to explain the problem you are seeing.
Sodrek Posted - Jun 09 2020 : 12:22:43 PM
Both tests ran fine.
When I encounter an example where it didn't extract in source, I try to simplify it and post it here for you to test as well.
feline Posted - Jun 04 2020 : 12:04:55 PM
Strange. I am assuming you are working inside an Unreal Engine solution. I have a very simple UE solution here, and I have added a simple character class to the solution. In the header file, I have:

UFUNCTION(BlueprintNativeEvent)
void TestVA(int32 paramOne, int32 paramTwo, int32 paramThree, int32 paramFour);

and in the matching cpp file I have the following very simple test cases:
void AFelineCharacter::TestVA_Implementation(int32 paramOne, int32 paramTwo, int32 paramThree, int32 paramFour)
{
	int simpleLocalVar = 2;
	// test 1 - select the next 4 lines, and use Extract Method
	// new function returning int is created in this cpp file
	for (int n = 0; n < 10; n++)
	{
		simpleLocalVar += n;
	}

	char *pszTest = "hello world";
	// test 2 - select the next 4 lines, and use Extract Method
	// new function returning char * is created in this cpp file
	while (NULL != pszTest)
	{
		++pszTest
	}
}

can you please try this simple test on your system and see what results you get?
Sodrek Posted - Jun 04 2020 : 10:53:34 AM
Thanks for the fast reply.
I'm using VS2019 and VA 2375.

I triggered Extract Method in the .cpp file.
Alt-O functions fine. It switches to the .h and .cpp file.

After I made the post, I continued using it and sometimes it worked (with the implementation being generated inside the .cpp file. The difference to before was that the functions returns void while the functions where the implementation went inside the .h file were returning a pointer. Not sure if that is the cause.
feline Posted - Jun 04 2020 : 05:43:29 AM
Which IDE and version of VA are you using?

Are you triggering Extract Method in the .h or the .cpp file?

So far I cannot reproduce this problem here, using VS2017 and VA 2375.0.

When you are sitting in the .h file, if you press Alt-O to swap to the matching cpp file, what, if anything, happens? If VA cannot find the matching cpp file this could explain why you are seeing this problem.
Sodrek Posted - Jun 04 2020 : 01:51:19 AM
Oh and can I change the access modifier of the Extracted method in the VA Action window?

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