All pastes #753772 Raw Edit

Untitled

public text v1 · immutable
#753772 ·published 2007-10-29 15:14 UTC
rendered paste body
static void rekey_element_to_time(int index, float path_time)
{
	Object *ob = OBACT;
	ParticleSystem *psys = PE_get_current(ob);
	ParticleEdit *edit=0;
	ParticleData *pa;
	ParticleKey state;
	HairKey *new_keys, *key;
	ParticleEditKey *ekey;
	int k;
	float dval, sta;

	if(psys==0) return;

	edit = psys->edit;

	pa = psys->particles + index;

	pa->flag |= PARS_REKEY;

	key = new_keys = MEM_dupallocN(pa->hair);
	
	/* interpolate new keys from old ones (roots stay the same) */
	for(k=1,key=key++; k<pa->totkey; k++,key++) {
		state.time = path_time * (float)k / (float)pa->totkey;
		psys_get_particle_on_path(ob, psys, index, &state, 0);
		VECCOPY(key->co, state.co);
	}