Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AnimBlueprint Talkback w/ C++ Code

7) I think this bit of documentation will be helpful, but can you break this out into it's own question and go into a bit more depth about what you're wondering about? Cheers, Michael Noland

So I'm following up from an old question. With unrealscript, we had the ability for AnimTrees to "listen in" for a specific variable. If the value in this variable changed in any way, the corresponding blend node(s) within the tree having the same node name would be updated as well. Now I read the link provided, and it describes similar behavior with blueprints in some light detail.

However, can I accomplish similar functionality in C++? Can I create a variable that an animation blueprint will attempt to "read" within C++ code? I'm specifically asking about this as it pertains to code, not blueprints.

It's not that I have it out for blueprints or anything like that :), it's just that having worked on my projects in UDK over time, I have found kismet to be inflexible to certain issues like moving nodes and corresponding actors across streamed levels, and unrealscript having two lines of code replace several dozen kismet nodes needed to do the same thing, etc. With unrealscript, I could code an actor with custom behavior, and just simply place it in the level and/or migrate it across multiple streamed levels with no muss no fuss. And duplication wasn't a problem either, because each copy of the custom actor possessed innate functionality. It was coding and behavior "that just worked".

Whereas with kismet, I had to keep spelling it out each time, and getting these annoying prompts anytime I moved a kismet-connected actor to a different level/streamed level. So as you can imagine, my bias is heavily towards coding.

That said, my question pertains to how an animation blueprint would talk to C++. Do animation blueprints possess the innate ability to have "listeners" for specific variables defined in C++, or for C++ to fire a "notify" into Rocket animblueprints when a variable changes, and thus update the animblueprint that way?

Product Version: Not Selected
more ▼

asked Mar 11 '14 at 02:09 AM in C++ Programming

avatar image

ue4-archive ♦♦ STAFF
49.9k 3662 1988 9113

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hi Markus,

If you want to 'push' data from C++ to your Vim, you would create a UVimInstance subclass in C++, and add any state variables you want to set. When you create a Vim, you select a parent class, and you'd pick that class instead of UVimInstance (if you have an existing Vim, you can Reparent the vim to target the new class).

Some actor will have a skeletal mesh component that references your vim; from there you can push whatever data you want by doing:

 if (UMyVimInstance* MyVim = Cast(SkeletalMeshComponent->AnimInstance))
     MyVim->MySpeedProperty = MyVelocity.Length();

You could also do the same thing with a weaker binding and no C++ subclass using UKismetSystemLibrary::SetFloatPropertyByName et al, assuming that the Vim contains some variables added in the blueprint.

If you want to 'pull' data ,you can use GetPawnOwner in the Vim's event graph, and Cast it to your game-specific pawn, and access game-specific properties that way as well. In this case, you have a dependency between the vim and the code, but there is no 'level to level' dependency, and you shouldn't run into the same sorts of issues you had with Kismet in UE3.

For either path, you don't need to 'notify' the vim that things have changed, it is re-evaluated every frame.

Cheers, Michael Noland

more ▼

answered Mar 11 '14 at 11:10 AM

avatar image

ue4-archive ♦♦ STAFF
49.9k 3662 1988 9113

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question