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
 Extract Method with Extract to Source enabled
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Sodrek
New Member

Germany
4 Posts

Posted - Jun 04 2020 :  01:17:49 AM  Show Profile  Reply with Quote
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?

Sodrek
New Member

Germany
4 Posts

Posted - Jun 04 2020 :  01:51:19 AM  Show Profile  Reply with Quote
Oh and can I change the access modifier of the Extracted method in the VA Action window?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jun 04 2020 :  05:43:29 AM  Show Profile  Reply with Quote
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.

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

Sodrek
New Member

Germany
4 Posts

Posted - Jun 04 2020 :  10:53:34 AM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jun 04 2020 :  12:04:55 PM  Show Profile  Reply with Quote
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?

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

Sodrek
New Member

Germany
4 Posts

Posted - Jun 09 2020 :  12:22:43 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jun 09 2020 :  12:40:46 PM  Show Profile  Reply with Quote
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.

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