Jump to content

scrub animation in tracker


photo

Recommended Posts

Hello Gary,

Could you please explain what do you mean by "scrub"? If the question is about animating MeshSkinned objects in the Tracker - the answer is no. Tracker can control a number of other node parameters, but not the animation.

Animation is usually described in code, you can check animation samples in SDK (Samples -> UnigineScript -> Animation)

Maybe you can elaborate on the task?

Thanks.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

No problem... scrubbing animation is when you move the timeline indicator back and fourth to various points the timeline and the animation will play backwards or forwards according to where the indicator is.

As far as I can see, the tracker can tell the animation to start but after that I can't find how to control where I'm at in the animation. (see the attached screen record of how it works in aftereffects)

Edited by gary
Link to comment

Oh, thanks. I was confused a bit by the word "scrub" :)

As I mentioned before, Tracker is not that advanced in animating Skinned models. You can switch *.anim files and start/stop animation playback. You can't reverse it or scrub.

We're planning major Tracker update and similar functionality is in our scope.

UPD

Gary, what do you mean by animation? I kept saying about Mesh Skinned objects - animated characters. Scrubbing isn't possible for them. Bu you can do it with any other sequence, just drag the time slider.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Thanks Morbid. Yes my naming protocol for mesh skinned objects is 'animation'. So my bone rigged character is exported (.fbx)with animation into Unigine. My goal is to be able to 'scrub' back and fourth through the animation in the tracker and sync camera moves with it at specific times in the timeline. 

I can eyeball it for now but it would be great if the tracker had this function in further updates.

Link to comment

Hello,

The Tracker is an outdated but still pretty powerful tool. It supports animating properties and, therefore, anything that is available from API. You can use UnigineScript to make it work in the Editor, just like in this sample.

Open the spoiler for a 2.12-relevant code sample.

Spoiler

#include <core/unigine.h>

ObjectMeshSkinned skinned_meshes[0];

int init() {
	updateSkinnedMeshesList();
	return 1;
}

int update() {
	animateSkinnedMeshes();
	return 1;
}

// create the list of skinned meshes to animate
void updateSkinnedMeshesList()
{
	skinned_meshes.clear();
	Node nodes[0];
	engine.world.getNodes(nodes);
	foreach(Node n; nodes)
	{
		Property prop = n.getProperty(0);
		if(n.getType() == NODE_OBJECT_MESH_SKINNED && prop != NULL && (prop.isParent("meshskinned_track") || prop.getName() == "meshskinned_track" ))
		{
			skinned_meshes.append(node_cast(n));
		}
	}
	nodes.clear();
}
void animateSkinnedMeshes()
{
	int update = 0;
	foreach(ObjectMeshSkinned mesh; skinned_meshes)
	{
		Property mesh_track = mesh.getProperty(0);
		if(mesh_track != NULL)
		{
			PropertyParameter param = mesh_track.getParameterPtr("time");
			float time = param.getValueFloat();
          	// multiplying the time by the playback speed (fps) lets us know the exact frame
			mesh.setFrame(0, time * mesh.getSpeed());
		}
		else
		{
			update = 1;
		}
	}
	if(update)
		updateSkinnedMeshesList();
}

int shutdown() {
	skinned_meshes.clear();
	return 1;
}

Also, this quick video guide might come in handy for non-coders. Please note that you need to reload the world after assigning the script and every time after making any changes to properties (assignment/removal). Required assets are attached to the post.

animate_script_2.12.uscmeshskinned_track.prop

Create a property with a single Time parameter and assign it to all animated skinned meshes you want to control. After that it's easy to control animations via scripting according to this parameter. It can be done, for example, via this code:

int update() {
	/*
	..
	*/

	forloop(int i = 0; engine.editor.getNumNodes()) {
		Node node = engine.editor.getNode(i);
		Property property = node.getProperty();
		if(node.getType() == NODE_OBJECT_MESH_SKINNED && property != NULL && property.getName() == "meshskinned_track") {
			ObjectMeshSkinned mesh = node_cast(node);
			if (mesh != NULL)
			{
				float time = property.getParameter("time");
				// multiplying the time by the playback speed (fps) lets us know the exact frame
				mesh.setFrame(0, time * mesh.getSpeed());
			}
		}
	}
	return 1;
}

Then, animate the Time parameter via the Tracker and here it is.

You can try the attached assets in your project, import the meshskinned_track property and the world script (or add corresponding code to your existing script), then open the world and assign the property to all MeshSkinned objects you'd like to control via Add New Property.

image.png

This will let you animate the Time property parameter by using the Tracker tool (you can load the attached track file and check it out). Simply set the second keyframe value equal to its time position so the animation will have appropriate playback speed.

All these settings are only for working in the Editor, you won't need them in release builds unless you want to achieve time remapping — in that case you will need logic for running tracks, you can find usage examples in the corresponding article and the default samples.

Thanks.

mesh_skinned_anim.track worldscript.uscmeshskinned_track.prop

  • Like 4
Link to comment
On 6/16/2019 at 8:04 AM, thomalex said:

The Tracker is an outdated but still pretty powerful tool

I totally agree.

Its a pitty, that this tool hasnt got an update yet- O__+

 

Link to comment

We plan to update the Tracker this year, but it requires to release new app logic workflow first. I do hope to see the new Tracker by the end of this year, at the moment we just don't have enough people to handle all the feature requests at the same time.

Link to comment
  • 5 months later...
On 6/16/2019 at 7:04 AM, thomalex said:

Hello,

The Tracker is an outdated but still pretty powerful tool. It supports animating properties and, therefore, anything that is available from API. You can use UnigineScript to make it work in the Editor, just like in this sample.

Create a property with a single Time parameter and assign it to all animated skinned meshes you want to control. After that it's easy to control animations via scripting according to this parameter. It can be done, for example, via this code:


int update() {
	/*
	..
	*/

	forloop(int i = 0; engine.editor.getNumNodes()) {
		Node node = engine.editor.getNode(i);
		Property property = node.getProperty();
		if(node.getType() == NODE_OBJECT_MESH_SKINNED && property != NULL && property.getName() == "meshskinned_track") {
			ObjectMeshSkinned mesh = node_cast(node);
			if (mesh != NULL)
			{
				float time = property.getParameter("time");
				// multiplying the time by the playback speed (fps) lets us know the exact frame
				mesh.setFrame(0, time * mesh.getSpeed());
			}
		}
	}
	return 1;
}

Then, animate the Time parameter via the Tracker and here it is.

You can try the attached assets in your project, import the meshskinned_track property and the world script (or add corresponding code to your existing script), then open the world and assign the property to all MeshSkinned objects you'd like to control via Add New Property.

image.png

This will let you animate the Time property parameter by using the Tracker tool (you can load the attached track file and check it out). Simply set the second keyframe value equal to its time position so the animation will have appropriate playback speed.

All these settings are only for working in the Editor, you won't need them in release builds unless you want to achieve time remapping — in that case you will need logic for running tracks, you can find usage examples in the corresponding article and the default samples.

Thanks.

mesh_skinned_anim.track 276 B · 3 downloads meshskinned_track.prop 263 B · 3 downloads worldscript.usc 1.85 kB · 2 downloads

Thanks Thomalex that looks like what I'm looking for! 

Link to comment
×
×
  • Create New...