Animation code: Passing TagState's directly into fragments

Basically this:

I have a fragment playing. I want to apply a new Tag to the fragment (action) running. I don't know how I'm supposed to pass a modified TagState into SetFragment.

I assume that global tags are updated on the fragment when the `AUTO_REINSTALL_BEST_MATCH` (via Auto-Update in the editor) is set on the fragment, in addition to on creation (I see a union with globalTags).

I think that global tags can be edited by accessing the AnimationContext's CTagState and doing a Set() for the new tag.

How do I apply it to only a specific fragment? There is only a `pass in the fragment tags you want` statement in the documentation, and I can't find a sample that doesn't use TAG_STATE_EMPTY.

Since there is only (one?) instance of CTagState (in the animation context) and creating a TagState depends on the CTagDefinition (Since CTagState just passes it along) I have no idea what I should do.

Do something like this? (pseudo code-ish)

Code: Select all

CTagState cState(ctagDefinition) ; cState.Set(TagID, true) SetFragment (.... cState.GetMask() ... )
But since it passes a ref to that TagState I'm not sure if this won't cause harm somewhere.

Plus, if I were to directly re-queue the fragment via the below, in order to (for example) clear the already-set tag or add another one:

Code: Select all

pAct->SetFragment(fragID, tagState.GetMask(), OPTION_IDX_RANDOM, 0, false);
Would that break something since I do that directly? (Yes, I know the function's protected, I got around that through inheritance etc.)
I'm calling this outside of an Action so ti's independent of the Update() and Pre-Update(). What kind of checks do I need to make this work? (Or would this work just fine for action updates?)

Re: Animation code: Passing TagState's directly into fragments

Where can I find details on the animation motion params? All I can get is this:
Some more practical example for 1D blend spaces with the remaining motion parameters:


All these parameters are linked to specialized C++ code, which extracts the values from the root-motion and uses them to drive the blend-spaces. Adding new parameters requires a change in C++ code.


Code: Select all

enum EMotionParamID { eMotionParamID_TravelSpeed = 0, eMotionParamID_TurnSpeed, eMotionParamID_TravelAngle, //!< Forward, backwards and sidestepping. eMotionParamID_TravelSlope, eMotionParamID_TurnAngle, //!< Idle2Move and idle-rotations. eMotionParamID_TravelDist, //!< Idle-steps. eMotionParamID_StopLeg, //!< Move2Idle. eMotionParamID_BlendWeight, //!< Custom parameters. eMotionParamID_BlendWeight2, eMotionParamID_BlendWeight3, eMotionParamID_BlendWeight4, eMotionParamID_BlendWeight5, eMotionParamID_BlendWeight6, eMotionParamID_BlendWeight7, eMotionParamID_BlendWeight_Last = eMotionParamID_BlendWeight7, eMotionParamID_COUNT, };

No comment on most of them....and it's not like 'forward,backwards, and sidestepping' describes what it does

Yes, the templates use them, but they just 'use' them it doesn't really describe it much either.

Re: Animation code: Passing TagState's directly into fragments

I'm shifting my work into other parts of the project so yeah, I'm waiting.

I do appreciate knowing that these forums are actually read and that the lack of a reply isn't because you treat me like an idiot, but rather because the people who can respond are busy. Which is fine, although obviously the questions I'm asking can be answered in 5 minutes by someone who knows the animation system. Which is really the only reason why I'm bothering, because 3 days of my time = 5 minutes of yours.

Re: Animation code: Passing TagState's directly into fragments

Hi, first for the TagState to using tagstate on fragments, you need to get id in animation context like this:

Code: Select all

TagID tid = m_pAnimationContext->state.GetDef().Find("TAG");
Then with animation context you set the new state to TRUE or FALSE, like this:

Code: Select all

m_pAnimationContext->state.Set(tid, true);
Maybe, you need set AUTO UPDATE flag to true on mannequin.

For AimIK i can't help you, I've never used it. But depending on the situation you can write a procedural clip
to make simple rotation of bone directly.

For motion params, in c++ don't have much to do, you only update values to been processed in mannequin.
The greater part of work is maded in Blendspace file, If you need to pass values to procedural clips you can use params.

sorry for my english.

Re: Animation code: Passing TagState's directly into fragments

None of that is what I was asking for.

The recommendation that you posted only changes GLOBAL tags (which I mentioned already).

The 'auto-update' is unrelated (and I mentioned that too), that just makes the fragment re-queue itself once global tags have changed, but it doesn't remove/add any fragment-related tags (not to sure on this last one, need to refresh memory). Even if it did check for that, it doesn't set the fragment specific tags. Which is what I need.

Using set-fragment directly makes it automatically register as 're-queuing self'.

Again, FRAGMENT-specific tags. NOT global tags. ... in+Actions
tagState: the fragtags you want to set.

I still appreciate the help, better than the zip from others so far.

Re: Animation code: Passing TagState's directly into fragments

I'm sorry, the command to update fragmentTag is similar to global, you actually use the same command but it should be a small adaptation to a TAction class.

Code: Select all

pAnimationContext->state.GetDef().Set(FragState, tagID, <value>);
So if you call the method using the GetFragTagState command from TAction it will not change the state because the tag state class is passed by copy.

Then you can create a command within a custom IAction to update it by using GetContext (), or create a command to pass m_fragTags by reference and use it in:

Code: Select all

pAnimationContext->state.GetDef().Set(FragState, tagID, <value>);
This way it is not necessary to call SetFragment.


Code: Select all

class TMyAction : public TAction<SAnimationContext> { public: ... // METHOD 1 TagState& GetFragTag() { << Pass m_fragTags by reference return m_fragTags; } // METHOD 2 void SetFlagId(TagID flag, bool value) { GetContext().state.GetDef().Set(m_fragTags, tag, value); } }; // Set fragID // METHOD 1 m_pAnimationContext->state.GetDef().Set(pMyAction->GetFragTag(), id, true); // METHOD 2 pAction->SetFlagId(<tagID>, true|false);

Who is online

Users browsing this forum: No registered users and 1 guest