FComponentVisualizer not associated anymore with object if the inherited blueprint is recompiled

Hey,

I have an C++ USceneComponent, with a FComponentVisualizer. If the component is added to an actor, everything is working fine. If I create an blueprint based on the C++ USceneComponent, and place that blueprint as child on an actor, the FComponentVisualizer is visible and working. If I then change something in the blueprint and compile it, the FComponentVisualizer isn’t working anymore. I need to destroy and recreate the component before the FComponentVisualizer is working again (or restart the editor).

I think the problem is that if an blueprint is recompiled, it update all his instances. While updating, the components are unregistered and not registered again (or the register data is invalid/outdated). If I call Component->RegisterComponent(); then the FComponentVisualizer starts working again.

Hey Daxiuz-

Could you post the code you’re using for your FComponentVisualizer? I’m would like to reproduce this on my end and want to make sure that I’m following the same setup.

Cheers

The Visualizer. file are in an separate editor project. If you need more info, please let me know. I can also demonstrate it if you want (skype, twitch.tv etc).
link text

I’m slightly confused, are you saying that the FComponentVisualizer is being used as a plugin? Looking at the files your sent I see that MovePathRouteVisualizer is parented to FComponentVisualizer however I can’t find where you’re using MovePathRouteVisualizer. Can you reproduce this in a new project with no additional content? If so please include the steps that caused the ComponentVisualizer not work properly in the blueprint.

To create a new project with used the code that produce the bug will take some time (the zip file only contains the relevant code, not everything). I’ll make a new project a bit later. I hope to post it in a hour or so.

It have to wait until tomorrow (it’s also pretty late here :)). I’ll try to make an example project as soon as possible.

Hey,

The project can be donwloaded from: http://elderson.net/BugReport01.zip (27mb).

If you open the project and select “Actor” in the world outliner, you will see a red line going from the actor to x + 100. If you then open the blueprint “B_TestSceneComponent” under Content, and select the variable “Test” and change the default value. You can then recompile the blueprint, after compiling (saving doesn’t matter), the red line is not there anymore.

Any change to the blueprint that cause it to be marked modified, so you can recompile it will cause this. I’ve implemented a “trigger” boolean value on the TestSceneComponent, when changed (thru PostEditChangeProperty) will register the component again with “this->RegisterComponent();”. That will cause the Visualizer to start working again.

Cheers,

Alex

Hey Daxiuz-

I tired taking a look at the code for the project you sent and was not able to get the project to compile. Is what you sent the full project as well as latest version of all of the files? Additionally, were any files added manually without using File->Add Code to Project through the editor?

It’s the full project, it’s compiling fine (I did a full rebuild to test it, using VS2013). I added the editor module and classes from VS, all the classes in the game module thru the content browser “New C++ Class”.

I did some more testing and the project is compiling correctly even after I changed the location, the only thing I can think of is that you have the engine source code on a different location (I have it at C:\Program Files\Epic Games\4.8\Engine). Could you try to regenerate the Visual Studio project files (by right clicking the BugReport01.uproject file)?

Any status update? Where you able to compile the code?

I was able to compile the project however I having a difficult time following how the TestActorComponentVisualizer class is being used by the Actor in the project. I can find where BugReport01Editor.cpp references the TestActorComponentVisualizer class however I don’t see any other class referencing either of these. Since this is the only place in the code I can find a reference to your Component Visualizer, how is it being registered by the Actor in the project? Is the actor in the level an instance of the TestActor class? How would I create a new actor that used the TestActorComponentVisualizer in your setup?

The test actor has a component “UTestSceneComponent”, in BugReport01Editor.cpp I register a ComponentVisualizer for the “UTestSceneComponent”

  TSharedPtr<FComponentVisualizer> Visualizer = MakeShareable(new FTestActorComponentVisualizer());

  if (Visualizer.IsValid() && GUnrealEd) {
    GUnrealEd->RegisterComponentVisualizer(UTestSceneComponent::StaticClass()->GetFName(), Visualizer);
  }

Hey Daxiuz-

After more testing I found that this case only occurs when using an Empty Actor from the modes panel. Creating a blueprint actor and adding the same TestSceneComponent to it does not affect the ComponentVisualizer after compiling.

Cheers

It will also not work on a C++ based actor.

I’ve an empty C++ actor with only the following function:

AMovePathRouteEditor::AMovePathRouteEditor(class FObjectInitializer const &ObjectInitializer) {

  RootComponent = ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("MovePathRouteEditorRootComponent"));

  if (RootComponent)
    RootComponent->SetWorldTransform(FTransform::Identity);

}

This actor will also have the problem. After some more testing it seems that if the actor is blueprint based, then the components that are recompiled are being registered correctly, otherwise they won’t.

Hey Daxiuz-

We will continue to investigate this issue however the workaround of creating a blueprint for your actor should allow you to continue with your project.