From 9a076dd95a01135ea50f9ccc675668db9f2155f4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 12 Sep 2019 04:34:55 +1000 Subject: DNA: defaults for ID types --- source/blender/blenkernel/intern/texture.c | 116 ++--------------------------- 1 file changed, 5 insertions(+), 111 deletions(-) (limited to 'source/blender/blenkernel/intern/texture.c') diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 5c03b7730aa..fb8697b1ee0 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -41,6 +41,7 @@ #include "DNA_color_types.h" #include "DNA_particle_types.h" #include "DNA_linestyle_types.h" +#include "DNA_defaults.h" #include "IMB_imbuf.h" @@ -214,56 +215,11 @@ void BKE_texture_free(Tex *tex) void BKE_texture_default(Tex *tex) { - /* Not here, can be called with some pointers set. :/ */ - /* BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(tex, id)); */ - - tex->type = TEX_IMAGE; - tex->ima = NULL; - tex->stype = 0; - tex->flag = TEX_CHECKER_ODD; - tex->imaflag = TEX_INTERPOL | TEX_MIPMAP | TEX_USEALPHA; - tex->extend = TEX_REPEAT; - tex->cropxmin = tex->cropymin = 0.0; - tex->cropxmax = tex->cropymax = 1.0; - tex->texfilter = TXF_EWA; - tex->afmax = 8; - tex->xrepeat = tex->yrepeat = 1; - tex->sfra = 1; - tex->frames = 0; - tex->offset = 0; - tex->noisesize = 0.25; - tex->noisedepth = 2; - tex->turbul = 5.0; - tex->nabla = 0.025; // also in do_versions - tex->bright = 1.0; - tex->contrast = 1.0; - tex->saturation = 1.0; - tex->filtersize = 1.0; - tex->rfac = 1.0; - tex->gfac = 1.0; - tex->bfac = 1.0; - /* newnoise: init. */ - tex->noisebasis = 0; - tex->noisebasis2 = 0; - /* musgrave */ - tex->mg_H = 1.0; - tex->mg_lacunarity = 2.0; - tex->mg_octaves = 2.0; - tex->mg_offset = 1.0; - tex->mg_gain = 1.0; - tex->ns_outscale = 1.0; - /* distnoise */ - tex->dist_amount = 1.0; - /* voronoi */ - tex->vn_w1 = 1.0; - tex->vn_w2 = tex->vn_w3 = tex->vn_w4 = 0.0; - tex->vn_mexp = 2.5; - tex->vn_distm = 0; - tex->vn_coltype = 0; + BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(tex, id)); - BKE_imageuser_default(&tex->iuser); + MEMCPY_STRUCT_AFTER(tex, DNA_struct_default_get(Tex), id); - tex->preview = NULL; + BKE_imageuser_default(&tex->iuser); } void BKE_texture_type_set(Tex *tex, int type) @@ -288,69 +244,7 @@ Tex *BKE_texture_add(Main *bmain, const char *name) void BKE_texture_mtex_default(MTex *mtex) { - mtex->texco = TEXCO_UV; - mtex->mapto = MAP_COL; - mtex->object = NULL; - mtex->projx = PROJ_X; - mtex->projy = PROJ_Y; - mtex->projz = PROJ_Z; - mtex->mapping = MTEX_FLAT; - mtex->ofs[0] = 0.0; - mtex->ofs[1] = 0.0; - mtex->ofs[2] = 0.0; - mtex->size[0] = 1.0; - mtex->size[1] = 1.0; - mtex->size[2] = 1.0; - mtex->tex = NULL; - mtex->colormodel = 0; - mtex->r = 1.0; - mtex->g = 0.0; - mtex->b = 1.0; - mtex->k = 1.0; - mtex->def_var = 1.0; - mtex->blendtype = MTEX_BLEND; - mtex->colfac = 1.0; - mtex->norfac = 1.0; - mtex->varfac = 1.0; - mtex->dispfac = 0.2; - mtex->colspecfac = 1.0f; - mtex->mirrfac = 1.0f; - mtex->alphafac = 1.0f; - mtex->difffac = 1.0f; - mtex->specfac = 1.0f; - mtex->emitfac = 1.0f; - mtex->hardfac = 1.0f; - mtex->raymirrfac = 1.0f; - mtex->translfac = 1.0f; - mtex->ambfac = 1.0f; - mtex->colemitfac = 1.0f; - mtex->colreflfac = 1.0f; - mtex->coltransfac = 1.0f; - mtex->densfac = 1.0f; - mtex->scatterfac = 1.0f; - mtex->reflfac = 1.0f; - mtex->shadowfac = 1.0f; - mtex->zenupfac = 1.0f; - mtex->zendownfac = 1.0f; - mtex->blendfac = 1.0f; - mtex->timefac = 1.0f; - mtex->lengthfac = 1.0f; - mtex->clumpfac = 1.0f; - mtex->kinkfac = 1.0f; - mtex->kinkampfac = 1.0f; - mtex->roughfac = 1.0f; - mtex->twistfac = 1.0f; - mtex->padensfac = 1.0f; - mtex->lifefac = 1.0f; - mtex->sizefac = 1.0f; - mtex->ivelfac = 1.0f; - mtex->dampfac = 1.0f; - mtex->gravityfac = 1.0f; - mtex->fieldfac = 1.0f; - mtex->normapspace = MTEX_NSPACE_TANGENT; - mtex->brush_map_mode = MTEX_MAP_MODE_TILED; - mtex->random_angle = 2.0f * (float)M_PI; - mtex->brush_angle_mode = 0; + memcpy(mtex, DNA_struct_default_get(MTex), sizeof(*mtex)); } /* ------------------------------------------------------------------------- */ -- cgit v1.2.3