UE4 Control Rig: How to fix missing 'Rig Graph'

· Read in about 3 min · (615 Words)

Intro

I’ve been experimenting with UE4’s Control Rig recently, in my case in order to be able to do custom skeletal animation in level sequences - this is really handy when you want to animate something in the context of the actual level, instead of just in isolation.

I’ve generally found it very useful, if a little under-documented, but that’s understandable since it’s still beta software (but as of 4.27, pretty robust). I found this video series very instructive, even if some of it is a little out of date.

Where’s My Rig Graph?

I had a good experience with my little test projects, but when I came to enable control rig in my main project, I had a bizarre problem which completely blocked my use of it. When you create a control rig asset, you should immediately get a Rig Graph with a Forward Solve node, like this:

Expected Rig Graph

However, in my project when I created any control rig asset, all I got was an Event Graph:

Wrong Event Graph

This event graph doesn’t have a Forward Solve node, and none of the other Control Rig nodes are available either. The rest of the editor is fine and customised for Control Rig, so the plugin is clearly loaded. But, just in my project, I could not get a Rig Graph to appear.

I thrashed around on this for almost a day until I just debugged the source to figure it out.

TL;DR: The Fix

To cut to the chase, the fix is this: make sure the “Spawn Default Blueprint Nodes” editor option is checked.

Spawn Default Blueprint Nodes checkbox

Yes, really! WTF? Read on if you want to know why.

What This Option Does

The reason I’d disabled this option is that I don’t like the editor creating default nodes every time I create a new Blueprint. With it enabled, new Blueprint event graphs look like this:

Blueprint default nodes

I got bored of deleting these all the time so I disabled the “Spawn Default Blueprint Nodes” option months ago so it wouldn’t do it anymore.

Why It Breaks Control Rig

Unfortunately, this breaks Control Rig, and the reason is that it relies on a post-Blueprint-creation callback, to change the Event Graph into a Control Rig Graph instead. The callback in question is FKismetEditorUtilities::RegisterOnBlueprintCreatedCallback.

This callback is supposed to fire after a Blueprint is created, but if you disable the spawning of default Blueprint nodes, as of 4.27.1 the code path that raises the event is completely skipped. The offending code is in FKismetEditorUtilities::CreateBlueprint:

	UBlueprintEditorSettings* Settings = GetMutableDefault<UBlueprintEditorSettings>();
	if(Settings && Settings->bSpawnDefaultBlueprintNodes)
	{
        // ... Steve's Notes
        // Removed code for brevity that actually creates the starting nodes
        // And yet, inside this same code block is where the post-create event is raised
        // ...


		// Give anyone who wants to do more advanced BP modification post-creation a chance to do so.
		// Anim Blueprints, for example, adds a non-event node to the main ubergraph.
		for (TMultiMap<void*, FKismetEditorUtilities::FOnBlueprintCreatedData>::TIterator DataIt(OnBlueprintCreatedCallbacks); DataIt; ++DataIt)
		{
			FOnBlueprintCreatedData Data = DataIt.Value();
			if (NewBP->GeneratedClass->IsChildOf(Data.TargetClass))
			{
				FKismetEditorUtilities::FOnBlueprintCreated BlueprintCreatedDelegate = Data.OnBlueprintCreated;
				BlueprintCreatedDelegate.Execute(NewBP);
			}
		}
	}

Thus, Control Rig never gets told about the creation of new Blueprints, so never gets the chance to replace the Event Graph with a Rig Graph, and everything is broken.

I think this is an engine bug, personally. I think this FOnBlueprintCreated event should be outside the check for bSpawnDefaultBlueprintNodes. I’ve let a Control Rig dev know about this, so hopefully it’ll get fixed for a future version.

I would have submitted a patch, except I can’t physically fit a full source build of UE on my disk right now without being so close to the edge I can’t do anything else 🙄 (A bigger disk is on the way!).