Exemplo n.º 1
0
void PluginSet::paste_keyframes(int64_t start, 
	int64_t length, 
	FileXML *file, 
	int default_only,
	int active_only)
{
	int result = 0;
	int first_keyframe = 1;
	Plugin *current;


	while(!result)
	{
		result = file->read_tag();

		if(!result)
		{
			if(file->tag.title_is("/PLUGINSET"))
				result = 1;
			else
			if(file->tag.title_is("KEYFRAME"))
			{
				int64_t position = file->tag.get_property("POSITION", 0);
				if(first_keyframe && default_only)
				{
					position = start;
				}
				else
				{
					position += start;
				}

// Get plugin owning keyframe
				for(current = (Plugin*)last; 
					current;
					current = (Plugin*)PREVIOUS)
				{
// We want keyframes to exist beyond the end of the last plugin to
// make editing intuitive, but it will always be possible to 
// paste keyframes from one plugin into an incompatible plugin.
					if(position >= current->startproject)
					{
						KeyFrame *keyframe = 0;
						if(file->tag.get_property("DEFAULT", 0) || default_only)
						{
							keyframe = (KeyFrame*)current->keyframes->default_auto;
						}
						else
						if(!default_only)
						{
							keyframe = 
								(KeyFrame*)current->keyframes->insert_auto(position);
						}

						if(keyframe)
						{
							keyframe->load(file);
							keyframe->position = position;
						}
						break;
					}
				}

				first_keyframe = 0;
			}
		}
	}
}
Exemplo n.º 2
0
void Plugin::load(FileXML *file)
{
	int result = 0;
	int first_keyframe = 1;
 	in = 0;
	out = 0;
// Currently show is ignored when loading
	show = 0;
	on = 0;
	while(keyframes->last) delete keyframes->last;

	do{
		result = file->read_tag();

//printf("Plugin::load 1 %s\n", file->tag.get_title());
		if(!result)
		{
			if(file->tag.title_is("/PLUGIN"))
			{
				result = 1;
			}
			else
			if(file->tag.title_is("SHARED_LOCATION"))
			{
				shared_location.load(file);
			}
			else
			if(file->tag.title_is("IN"))
			{
				in = 1;
			}
			else
			if(file->tag.title_is("OUT"))
			{
				out = 1;
			}
			else
			if(file->tag.title_is("SHOW"))
			{
//				show = 1;
			}
			else
			if(file->tag.title_is("ON"))
			{
				on = 1;
			}
			else
			if(file->tag.title_is("KEYFRAME"))
			{
// Default keyframe
				if(first_keyframe)
				{
					keyframes->default_auto->load(file);
					first_keyframe = 0;
				}
				else
// Override default keyframe
				{
					KeyFrame *keyframe = (KeyFrame*)keyframes->append(new KeyFrame(edl, keyframes));
					keyframe->position = file->tag.get_property("POSITION", (int64_t)0);
					keyframe->load(file);
				}
			}
		}
	}while(!result);
}