Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 "Implement Virtual Methods" in UE4 .sln bug

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
Quexlaw Posted - Jan 20 2019 : 3:00:31 PM
Hello, first post here.

I'm using Visual Assist and the function "Implement Virtual Methods" seems to be bugged quite a bit. I have not tested this outside of UE4 solutions, but I guess that this is a UE4-specific issue.

When I implement one of the functions, what happens is that some weird mess gets inserted in both header and .cpp.

When I press Ctrl + Z in the header once, it actually corrects itself and has the proper code. I tried this also in a class without UE4 syntax (UClass macros etc.) and the same happened, except for 6 different methods at once although I selected just one. I'm using Visual Studio 2017 (up to date) and the newest VA version.







11   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jan 23 2019 : 4:59:20 PM
I have the settings files, thank you for these:

case=135452

Unfortunately still no sign of the problem here. I have replied via email.
Quexlaw Posted - Jan 22 2019 : 3:30:27 PM
Consistent line endings was and is turned on.

Both functions fail, but I noticed something. It doesn't seem like the move-part is what's wrong, but the selection part. When reverting once with Ctrl-Z, the broken parts get restored and the part that was moved and restored actually gets selected.









I will still send my settings regardless.
feline Posted - Jan 22 2019 : 1:10:51 PM
I agree, this is frustrating, but I intend to get to the bottom of this for you! You are using the same version of Unreal Engine as I am, so that does not seem to be a factor.

First a simple check, can you please look and see if you have the setting:

IDE tools menu -> Options -> Environment -> Documents -> Check for consistent line endings on load

turned On or Off. If this is turned Off, can you please turn it On, and reload the test code files you are trying this in. We do try to handle mixed line endings correctly, but occasionally they can and do cause odd problems to happen.

If this does not help, can you please try triggering Move Implementation to Source File on the new functions "VerySimpleBeforeGeneratedBodyTest()" and "templateMemberFuncTest()" in this test code, and see what happens:

UCLASS()
class ME_DIALOGUE_EDITOR_API AMyCharacter : public ACharacter
{
private:
	void VerySimpleBeforeGeneratedBodyTest()
	{
		// an empty function to move, placed before the GENERATED_BODY macro
	}

	template<typename T>
	T templateMemberFuncTest(T moveThis)
	{
		// should update parameter somehow here
		return moveThis;
	}

	GENERATED_BODY()

public:
	// simple comment before function
	virtual void BeginPlay() override
	{
		// simple comment inside function body, before the code
		Super::BeginPlay();
		throw std::logic_error("The method or operation is not implemented.");
	}
};

Here I am just trying to eliminate variables, to give VA a couple of very simple test case, and see if that makes any difference.

The first function is about as basic as we can get. The second, template function, is to see if the problem is somehow related to changing files, since this should be moved to after the class, in the same file.

If you still see the problem with both tests, can you please export your VA and IDE settings and send them to me:

VA Options -> Performance -> Export Settings
IDE tools menu -> Import and Export Settings -> Export selected environment settings

I can then import them here and see if I can reproduce the problem. I don't know what setting could have this effect, but it's a sensible next step.

Please submit the files via the form:

http://www.wholetomato.com/support/contact.asp

including this thread ID or URL in the description, so we can match it up.
Quexlaw Posted - Jan 22 2019 : 11:22:15 AM
I am using 4.20.3, and I do not have any file with that name in my source.

This is getting a little frustrating.
feline Posted - Jan 22 2019 : 10:44:16 AM
Thank you, this is interesting. The fact that the template function does not have this problem is interesting, and suggests that the VA Snippet used for Move Implementation to Source File is not a factor. Also other include files don't seem to be the source.

Which version of the Unreal Engine is your project using?

Can you please look and see if you have a file called "va_stdafx.h" anywhere inside your source code tree? It should be placed in the same directory as your SLN or .uproject files. This file can be used to give VA's parser hints and help. If you have something in here, it might explain why you are getting different results to me.
Quexlaw Posted - Jan 22 2019 : 09:13:32 AM
When I press Ctrl-Z, yes, the .cpp implementation is removed.

I tested all your suggestions, here are the results:

1) New Character in existing header with other includes: Same error.
2) New Character in new header without any includes: .cpp file generated, but same issue in both files.
3) Template class: works as intended.

Seems like you are right on the money with the move implementation being the problem.
feline Posted - Jan 22 2019 : 08:30:29 AM
Thank you for the new images, they are a bit larger, making it a lot easier to read the code and follow what is going wrong here. Just to double check, when you get the problem and do the first Undo, Ctrl-Z in the header file, is the implementation being removed from the cpp file? It should be, since you should be undoing the Move Implementation to Source File part of the refactoring.

Based on the theory that the problem is with the Move Implementation to Source File part, can you please copy the following code into your header file, and then trigger the Move Implementation to Source File command on the BeginPlay function, and see what happens?

UCLASS()
class ME_DIALOGUE_EDITOR_API AMyCharacter : public ACharacter
{
	GENERATED_BODY()

public:
	// simple comment before function
	virtual void BeginPlay() override
	{
		// simple comment inside function body, before the code
		Super::BeginPlay();
		throw std::logic_error("The method or operation is not implemented.");
	}

};

if you still get the same problem, can you please try making a new, default .h file, and then copy the code into this new file, without adding any #include lines, and then try the command, and see what happens? If there is no matching cpp file, VA will offer to create one for you. Here I am testing to see if the #include lines could somehow be a factor, maybe including something that is confusing our parser.

If you have the time, another interesting test would be this code, again placed into a header file:

template<typename T>
class testMoveImpTemplate
{
public:
	const int getTemplateHeight()	{ return 3; }
};

again, triggering Move Implementation to Source File to see what happens. Because this is a template class, VA should move the implementation into the current file, so it should just appear just below the class declaration.
Quexlaw Posted - Jan 21 2019 : 6:52:03 PM
I am using the binary distribution.

Game Solution is under C:\Users\MyName\Documents\Unreal Projects\Project\Project.sln.
ChrisG Posted - Jan 21 2019 : 5:37:37 PM
Are you using the binary distribution (through the epic games installer) or the source distribution (through github)?

Where is your game solution / folder located? (C:\...)
Quexlaw Posted - Jan 21 2019 : 12:51:49 PM
My class is not in the default UE4 library, but it inherits from one of its members, namely UEdGraphNode.

Also, I tested your suggestion and the same happens.









feline Posted - Jan 21 2019 : 05:44:55 AM
Is your base class, "UDialogueGraphNode_Base" a standard Unreal library class, or one of your own classes? VA on my system, using UE 4.20.3 does not know this base class. If this is one of your classes, then it is possible this bug is somehow related to the class.

To test this, can you please try the very simple test case:

UCLASS()
class SimpleTestCharacterChild : public ACharacter
{
	GENERATED_BODY()

};

and then use Implement Virtual Methods to implement one or two methods, and see if the correct code is generated?

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