示例#1
0
static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level, int animated)
{	
	if ((ob->transflag & OB_DUPLI)==0)
		return;
	
	/* Should the dupli's be generated for this object? - Respect restrict flags */
	if (G.rendering) {
		if (ob->restrictflag & OB_RESTRICT_RENDER) {
			return;
		}
	}
	else {
		if (ob->restrictflag & OB_RESTRICT_VIEW) {
			return;
		}
	}

	if (ob->transflag & OB_DUPLIPARTS) {
		ParticleSystem *psys = ob->particlesystem.first;
		for (; psys; psys=psys->next)
			new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, psys, level+1, animated);
	}
	else if (ob->transflag & OB_DUPLIVERTS) {
		if (ob->type==OB_MESH) {
			vertex_duplilist(duplilist, id, scene, ob, par_space_mat, level+1, animated);
		}
		else if (ob->type==OB_FONT) {
			if (GS(id->name)==ID_SCE) { /* TODO - support dupligroups */
				font_duplilist(duplilist, scene, ob, level+1, animated);
			}
		}
	}
	else if (ob->transflag & OB_DUPLIFACES) {
		if (ob->type==OB_MESH)
			face_duplilist(duplilist, id, scene, ob, par_space_mat, level+1, animated);
	}
	else if (ob->transflag & OB_DUPLIFRAMES) {
		if (GS(id->name)==ID_SCE) { /* TODO - support dupligroups */
			frames_duplilist(duplilist, scene, ob, level+1, animated);
		}
	}
	else if (ob->transflag & OB_DUPLIGROUP) {
		DupliObject *dob;
		
		group_duplilist(duplilist, scene, ob, level+1, animated); /* now recursive */

		if (level==0) {
			for (dob= duplilist->first; dob; dob= dob->next)
				if (dob->type == OB_DUPLIGROUP)
					copy_m4_m4(dob->ob->obmat, dob->mat);
		}
	}
}
示例#2
0
static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[4][4],
                                       int persistent_id[MAX_DUPLI_RECUR], int level, int index, short flag)
{	
	if ((ob->transflag & OB_DUPLI) == 0)
		return;
	
	/* Should the dupli's be generated for this object? - Respect restrict flags */
	if (G.is_rendering) {
		if (ob->restrictflag & OB_RESTRICT_RENDER) {
			return;
		}
	}
	else {
		if (ob->restrictflag & OB_RESTRICT_VIEW) {
			return;
		}
	}

	/* keep track of persistent id */
	if (level > 0)
		persistent_id[level - 1] = index;

	if (ob->transflag & OB_DUPLIPARTS) {
		ParticleSystem *psys = ob->particlesystem.first;
		int psysid = 0;

		/* particle system take up one level in id, the particles another */
		for (; psys; psys = psys->next, psysid++) {
			persistent_id[level] = psysid;
			new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, persistent_id, psys, level + 2, flag);
		}

		persistent_id[level] = 0;
	}
	else if (ob->transflag & OB_DUPLIVERTS) {
		if (ob->type == OB_MESH) {
			vertex_duplilist(duplilist, id, scene, ob, par_space_mat, persistent_id, level + 1, flag);
		}
		else if (ob->type == OB_FONT) {
			if (GS(id->name) == ID_SCE) { /* TODO - support dupligroups */
				font_duplilist(duplilist, scene, ob, persistent_id, level + 1, flag);
			}
		}
	}
	else if (ob->transflag & OB_DUPLIFACES) {
		if (ob->type == OB_MESH)
			face_duplilist(duplilist, id, scene, ob, par_space_mat, persistent_id, level + 1, flag);
	}
	else if (ob->transflag & OB_DUPLIFRAMES) {
		if (GS(id->name) == ID_SCE) { /* TODO - support dupligroups */
			frames_duplilist(duplilist, scene, ob, persistent_id, level + 1, flag);
		}
	}
	else if (ob->transflag & OB_DUPLIGROUP) {
		DupliObject *dob;
		
		group_duplilist(duplilist, scene, ob, persistent_id, level + 1, flag); /* now recursive */

		if (level == 0) {
			for (dob = duplilist->first; dob; dob = dob->next)
				if (dob->type == OB_DUPLIGROUP)
					copy_m4_m4(dob->ob->obmat, dob->mat);
		}
	}

	/* clear persistent id */
	if (level > 0)
		persistent_id[level - 1] = 0;
}