Exemple #1
0
static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, int animated)
{
	Object *ob, *obar[256] = {NULL};
	Curve *cu;
	struct chartrans *ct, *chartransdata;
	float vec[3], obmat[4][4], pmat[4][4], fsize, xof, yof;
	int slen, a;
	
	/* simple preventing of too deep nested groups */
	if (level > MAX_DUPLI_RECUR) return;
	
	copy_m4_m4(pmat, par->obmat);
	
	/* in par the family name is stored, use this to find the other objects */
	
	chartransdata = BKE_vfont_to_curve(G.main, scene, par, FO_DUPLI);
	if (chartransdata == NULL) return;

	cu = par->data;
	slen = strlen(cu->str);
	fsize = cu->fsize;
	xof = cu->xof;
	yof = cu->yof;
	
	ct = chartransdata;
	
	for (a = 0; a < slen; a++, ct++) {
		
		ob = find_family_object(obar, cu->family, cu->str[a]);
		if (ob) {
			vec[0] = fsize * (ct->xof - xof);
			vec[1] = fsize * (ct->yof - yof);
			vec[2] = 0.0;
			
			mul_m4_v3(pmat, vec);
			
			copy_m4_m4(obmat, par->obmat);
			copy_v3_v3(obmat[3], vec);
			
			new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIVERTS, animated);
		}
	}
	
	MEM_freeN(chartransdata);
}
Exemple #2
0
static void rna_ID_update_tag(ID *id, ReportList *reports, int flag)
{
	/* XXX, new function for this! */
#if 0
	if (ob->type == OB_FONT) {
		Curve *cu = ob->data;
		freedisplist(&cu->disp);
		BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, NULL);
	}
#endif

	if (flag == 0) {
		/* pass */
	}
	else {
		/* ensure flag us correct for the type */
		switch (GS(id->name)) {
			case ID_OB:
				if (flag & ~(OB_RECALC_ALL)) {
					BKE_report(reports, RPT_ERROR, "'Refresh' incompatible with Object ID type");
					return;
				}
				break;
				/* Could add particle updates later */
#if 0
			case ID_PA:
				if (flag & ~(OB_RECALC_ALL | PSYS_RECALC)) {
					BKE_report(reports, RPT_ERROR, "'Refresh' incompatible with ParticleSettings ID type");
					return;
				}
				break;
#endif
			default:
				BKE_report(reports, RPT_ERROR, "This ID type is not compatible with any 'refresh' options");
				return;
		}
	}

	DAG_id_tag_update(id, flag);
}