/* XXX Unused function. */ int BKE_brush_texture_set_nr(Brush *brush, int nr) { ID *idtest, *id = NULL; id = (ID *)brush->mtex.tex; idtest = (ID *)BLI_findlink(&G.main->tex, nr - 1); if (idtest == NULL) { /* new tex */ if (id) idtest = (ID *)BKE_texture_copy(G.main, (Tex *)id); else idtest = (ID *)BKE_texture_add(G.main, "Tex"); id_us_min(idtest); } if (idtest != id) { BKE_brush_texture_delete(brush); brush->mtex.tex = (Tex *)idtest; id_us_plus(idtest); return 1; } return 0; }
// create mtex, create texture, set texture image MTex *DocumentImporter::create_texture(COLLADAFW::EffectCommon *ef, COLLADAFW::Texture &ctex, Material *ma, int i, TexIndexTextureArrayMap &texindex_texarray_map) { COLLADAFW::SamplerPointerArray& samp_array = ef->getSamplerPointerArray(); COLLADAFW::Sampler *sampler = samp_array[ctex.getSamplerId()]; const COLLADAFW::UniqueId& ima_uid = sampler->getSourceImage(); if (uid_image_map.find(ima_uid) == uid_image_map.end()) { fprintf(stderr, "Couldn't find an image by UID.\n"); return NULL; } ma->mtex[i] = BKE_texture_mtex_add(); ma->mtex[i]->texco = TEXCO_UV; ma->mtex[i]->tex = BKE_texture_add(G.main, "Texture"); ma->mtex[i]->tex->type = TEX_IMAGE; ma->mtex[i]->tex->ima = uid_image_map[ima_uid]; texindex_texarray_map[ctex.getTextureMapId()].push_back(ma->mtex[i]); return ma->mtex[i]; }