21#define DNA_DEPRECATED_ALLOW
83#define U (*((const UserDef *)&U))
88 uint *mcol, *mcoln, *mcolmain;
96 mcol = (
uint *)mesh->mcol;
99 mcoln[0] = mcol[mface->
v1];
100 mcoln[1] = mcol[mface->
v2];
101 mcoln[2] = mcol[mface->
v3];
102 mcoln[3] = mcol[mface->
v4];
107 mesh->mcol = (
MCol *)mcolmain;
130 if (bone->rad_tail == 0.0f && bone->rad_head == 0.0f) {
131 bone->rad_head = 0.25f * bone->length;
132 bone->rad_tail = 0.1f * bone->length;
134 bone->dist -= bone->rad_head;
135 bone->dist = std::max(bone->dist, 0.0f);
144 if (bone->layer == 0) {
156 if (node->storage ==
nullptr) {
158 nbd->sizex = node->custom1;
159 nbd->sizey = node->custom2;
165 if (node->storage ==
nullptr) {
167 nbd->samples = node->custom1;
168 nbd->maxspeed = node->custom2;
184 if (nhs->val == 0.0f) {
203 if (!node->storage) {
213 nodeid =
static_cast<ID *
>(
215 if (node->storage && nodeid &&
GS(nodeid->
name) ==
ID_IM) {
216 image = (
Image *)nodeid;
217 iuser =
static_cast<ImageUser *
>(node->storage);
221 if (iuser->
flag & IMA_DO_PREMUL) {
236 loop = loop->
next,
i++)
243 if (prop->
len !=
i) {
244 printf(
"Found and fixed bad id property group length.\n");
253 for (
id =
static_cast<ID *
>(idlist.
first);
id;
id =
static_cast<ID *
>(id->
next)) {
266 int a, mtfacen, mcoln;
301 for (a = 0; a < mesh->
totface_legacy; a++, mtf++, tf++, mcol += 4) {
302 memcpy(mcol, tf->col,
sizeof(tf->col));
303 memcpy(mtf->uv, tf->uv,
sizeof(tf->uv));
307 mesh->tface =
nullptr;
309 else if (mesh->mcol) {
317 mesh->tface =
nullptr;
324 if (layer->
name[0] == 0) {
335 if (layer->
name[0] == 0) {
371 iuser->
frames = nia->frames;
372 iuser->
sfra = nia->sfra;
373 iuser->
offset = nia->nr - 1;
374 iuser->
cycl = nia->cyclic;
376 node->storage = iuser;
382 node->storage = iuser;
417 con->headtail = 1.0f;
498 for (a = 0; a < ob->
totcol; a++) {
500 ob->colbits |= (1 << a);
567 if ((tex->
rfac == 0.0f) && (tex->
gfac == 0.0f) && (tex->
bfac == 0.0f)) {
581 if ((tex->
rfac == 0.0f) && (tex->
gfac == 0.0f) && (tex->
bfac == 0.0f)) {
614 mesh->smoothresh_legacy = 30;
631 for (j = 0; j < 4; j++) {
633 cp = ((
char *)&tface->col[j]) + 1;
634 for (k = 0; k < 3; k++) {
635 cp[k] = (cp[k] > 126) ? 255 : cp[k] * 2;
649 if (mesh->subdiv == 0) {
665 sipo->v2d.max[0] = 15000.0;
713 TFace *tface = mesh->tface;
715 for (
b = 0;
b < 4;
b++) {
716 tface->uv[
b][0] /= 32767.0f;
717 tface->uv[
b][1] /= 32767.0f;
730 if (sound->
volume < 0.01f) {
748 sound->
flags |= SOUND_FLAGS_3D;
751 sound->
flags &= ~SOUND_FLAGS_3D;
766 ME_SUBSURF = (1 << 7),
768 if (mesh->
flag & ME_SMESH) {
769 mesh->
flag &= ~ME_SMESH;
770 mesh->
flag |= ME_SUBSURF;
775 if (mesh->subdiv < 2) {
799 MCol *mcol = &mesh->mcol[
i];
807 TFace *tf = &((TFace *)mesh->tface)[
i];
809 for (j = 0; j < 4; j++) {
810 char *
col = (
char *)&tf->col[j];
848 enum { ME_SUBSURF = (1 << 7) };
849 if ((mesh->
flag & ME_SUBSURF) && (mesh->subdivr == 0)) {
850 mesh->subdivr = mesh->subdiv;
862 sseq->v2d.keeptot = 0;
928 sac->v2d.max[0] = 32000;
932 sla->v2d.max[0] = 32000;
988 sbuts->v2d.maxzoom = 1.2f;
990 if (sbuts->
mainb == BUTS_LAMP) {
991 sbuts->
mainb = CONTEXT_SHADING;
994 else if (sbuts->
mainb == BUTS_MAT) {
995 sbuts->
mainb = CONTEXT_SHADING;
998 else if (sbuts->
mainb == BUTS_TEX) {
999 sbuts->
mainb = CONTEXT_SHADING;
1002 else if (sbuts->
mainb == BUTS_ANIM) {
1003 sbuts->
mainb = CONTEXT_OBJECT;
1005 else if (sbuts->
mainb == BUTS_WORLD) {
1006 sbuts->
mainb = CONTEXT_SCENE;
1009 else if (sbuts->
mainb == BUTS_RENDER) {
1010 sbuts->
mainb = CONTEXT_SCENE;
1013 else if (sbuts->
mainb == BUTS_FPAINT) {
1014 sbuts->
mainb = CONTEXT_EDITING;
1016 else if (sbuts->
mainb == BUTS_RADIO) {
1017 sbuts->
mainb = CONTEXT_SHADING;
1020 else if (sbuts->
mainb == BUTS_CONSTRAINT) {
1021 sbuts->
mainb = CONTEXT_OBJECT;
1023 else if (sbuts->
mainb == BUTS_SCRIPT) {
1024 sbuts->
mainb = CONTEXT_OBJECT;
1026 else if (sbuts->
mainb == BUTS_EDIT) {
1027 sbuts->
mainb = CONTEXT_EDITING;
1030 sbuts->
mainb = CONTEXT_SCENE;
1055 sac->v2d.maxzoom = 50;
1118 if (wrld->
aodist == 0.0f) {
1137 snla->v2d.maxzoom = 50;
1186 if (tex->
nabla == 0.0f) {
1187 tex->
nabla = 0.025f;
1209 printf(
"NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
1276 enum { ARM_DRAWXRAY = (1 << 1) };
1277 if (arm->
flag & ARM_DRAWXRAY) {
1286 ME_SUBSURF = (1 << 7),
1287 ME_OPT_EDGES = (1 << 8),
1290 if (mesh->
flag & ME_SUBSURF) {
1294 smd->
levels = std::max<short>(1, mesh->subdiv);
1299 if (mesh->subdiv != 0) {
1302 if (mesh->subdivr != 0) {
1306 if (mesh->
flag & ME_OPT_EDGES) {
1354 if (lt->
fu == 0.0f && lt->
fv == 0.0f && lt->
fw == 0.0f) {
1397 if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) {
1398 pchan->limitmin[0] = pchan->limitmin[1] = pchan->limitmin[2] = -180.0f;
1399 pchan->limitmax[0] = pchan->limitmax[1] = pchan->limitmax[2] = 180.0f;
1404 data->weight = 1.0f;
1405 data->orientweight = 1.0f;
1409 data->rootbone = -1;
1421 if (paf->
disp == 0) {
1427 if (paf->
omat == 0) {
1458 if (kb->name[0] == 0) {
1463 if (kb->name[0] == 0) {
1477 int set_passepartout = 0;
1501 if (arm->layer == 0) {
1506 for (; sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
1508 set_passepartout = 1;
1513 for (; cam; cam =
static_cast<Camera *
>(cam->
id.
next)) {
1514 if (set_passepartout) {
1541 if (arm->layer == 0) {
1565 if (sce->nodetree) {
1641 R_THREADS = (1 << 19),
1647 if (sce->
r.
mode & R_THREADS) {
1654 if (sce->nodetree) {
1671 for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
1678 for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
1696 switch (curcon->type) {
1701 if (
data->flag == 0) {
1714 switch (curcon->type) {
1727 if (
data->flag == 0) {
1767 if (collection->layer == 0) {
1768 collection->layer = (1 << 20) - 1;
1801 TEX_ANIMCYCLIC = (1 << 6),
1802 TEX_ANIM5 = (1 << 7),
1806 ima =
static_cast<Image *
>(
1808 if (tex->
imaflag & TEX_ANIM5) {
1820 if (sce->nodetree) {
1845 if (curdef->name[0] ==
'\0') {
1856 switch (mmd->axis) {
1900 saction->v2d.tot.ymin = -1000.0;
1901 saction->v2d.tot.ymax = 0.0;
1903 saction->v2d.cur.ymin = -75.0;
1904 saction->v2d.cur.ymax = 5.0;
1934 if (curcon->flag & 0x20) {
1939 switch (curcon->type) {
1961 if (curcon->flag & 0x20) {
1966 switch (curcon->type) {
2002 if (ob->
soft && !ob->
soft->pointcache) {
2007 if (psys->pointcache) {
2011 printf(
"Old memory cache isn't supported for particles, so re-bake the simulation!\n");
2034 if (ma->gloss_mir == 0.0f) {
2035 ma->gloss_mir = 1.0f;
2050 if (sce->nodetree) {
2083 ima =
static_cast<Image *
>(
2085 if (ima && (tex->
iuser.
flag & IMA_DO_PREMUL)) {
2165 for (k = 0; k < sb->
totkey; k++) {
2190 for (k = 0; k < sb->
totkey; k++) {
2250 part->force_group = paf->
group;
2266 float fac = paf->
lifetime / 100.0f;
2300 for (; dup; dup =
static_cast<Object *
>(dup->
id.
next)) {
2324 printf(
"Old particle system converted to new system.\n");
2409 if (ob->fluidsimSettings) {
2444 nu->radius_interp = 3;
2450 if (nu->pntsv > 1) {
2451 nu->resolu = std::max(1,
int((
float(nu->resolu) /
float(nu->pntsu)) + 0.5f));
2452 nu->resolv = std::max(1,
int((
float(nu->resolv) /
float(nu->pntsv)) + 0.5f));
2479 switch (sl->spacetype) {
2523 if (strip->data && strip->data->proxy) {
2524 strip->data->proxy->quality = 90;
Blender kernel action and pose functionality.
void BKE_pose_tag_recalc(Main *bmain, bPose *pose) ATTR_NONNULL(1
void BKE_armature_where_is(bArmature *arm)
struct bConstraint * BKE_constraint_add_for_object(struct Object *ob, const char *name, short type)
CustomData interface, see also DNA_customdata_types.h.
const void * CustomData_add_layer_with_data(CustomData *data, eCustomDataType type, void *layer_data, int totelem, const blender::ImplicitSharingInfo *sharing_info)
void * CustomData_add_layer(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem)
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du)
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
void BKE_mesh_strip_loose_faces(Mesh *mesh)
void BKE_mesh_calc_edges_legacy(Mesh *mesh)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
void BKE_modifier_unique_name(ListBase *modifiers, ModifierData *md)
ModifierData * BKE_modifier_new(int type)
#define CMP_NODE_ALPHAOVER
General operations, lookup, etc. for blender objects.
PartEff * BKE_object_do_version_give_parteff_245(Object *ob)
struct ParticleSettings * BKE_particlesettings_add(struct Main *bmain, const char *name)
struct PointCache * BKE_ptcache_add(struct ListBase *ptcaches)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void unit_m4(float m[4][4])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
char * STRNCPY(char(&dst)[N], const char *src)
int bool bool BLI_str_endswith(const char *__restrict str, const char *__restrict end) ATTR_NONNULL(1
#define SNPRINTF_UTF8(dst, format,...)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
Platform independent time functions.
double BLI_time_now_seconds(void)
#define STREQLEN(a, b, n)
Compatibility-like things for windows.
external readfile function prototypes.
ID_Readfile_Data::Tags BLO_readfile_id_runtime_tags(ID &id)
ID_Readfile_Data::Tags & BLO_readfile_id_runtime_tags_for_write(ID &id)
#define ID_IS_LINKED(_id)
Object groups, one object can be in many groups at once.
@ CONSTRAINT_TYPE_TRACKTO
@ CONSTRAINT_TYPE_LOCLIKE
@ CONSTRAINT_TYPE_ROTLIKE
@ CONSTRAINT_TYPE_KINEMATIC
@ CONSTRAINT_TYPE_LOCLIMIT
@ CONSTRAINT_TYPE_FOLLOWPATH
@ eModifierType_ParticleSystem
@ eSubsurfModifierFlag_Incremental
@ eSubsurfModifierFlag_DebugIncr
@ eSubsurfModifierFlag_ControlEdges
Object is a sort of wrapper for general info.
@ UVCALC_UNWRAP_METHOD_CONFORMAL
@ UVCALC_UNWRAP_METHOD_ANGLE
Read Guarded memory(de)allocation.
BMesh const char void * data
void * MEM_callocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
void foreach_strip(ListBase *seqbase, ForEachFunc callback, void *user_data)
ListBase * active_seqbase_get(const Editing *ed)
void * blo_do_versions_newlibadr(FileData *fd, ID *self_id, const bool is_linked_only, const void *adr)
void blo_do_versions_oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr, const int nr)
struct PointCache * point_cache
struct FluidsimSettings * fss
struct FluidVertexVelocity * meshVelocities
struct PreviewImage * preview
bool is_locked_for_linking
struct bNodeTree * nodetree
struct ModifierData * next
float instance_faces_scale
struct Collection * group
ParticleBrushData brush[7]
struct Object * instance_object
struct ParticleSystem * psys
struct PointCache * pointcache
float motion_blur_shutter
struct ToolSettings * toolsettings
struct PackedFile * packedfile
struct PackedFile * newpackedfile
static bool strip_set_alpha_mode_cb(Strip *strip, void *)
static void bone_version_239(ListBase *lb)
static void do_version_free_effects_245(ListBase *lb)
static bool strip_set_alpha_mode_cb(Strip *strip, void *)
static void ntree_version_245(FileData *fd, Library *, bNodeTree *ntree)
static void idproperties_fix_groups_lengths_recurse(IDProperty *prop)
void blo_do_version_old_trackto_to_constraints(Object *ob)
static void ntree_version_242(bNodeTree *ntree)
static void ntree_version_241(bNodeTree *ntree)
static void customdata_version_242(Mesh *mesh)
static void vcol_to_fcol(Mesh *mesh)
static void do_version_constraints_245(ListBase *lb)
static void do_version_bone_head_tail_237(Bone *bone)
static void bone_version_238(ListBase *lb)
static void do_version_free_effect_245(Effect *eff)
static void customdata_version_243(Mesh *mesh)
static void do_version_ntree_242_2(bNodeTree *ntree)
static bool strip_set_blend_mode_cb(Strip *strip, void *)
static void idproperties_fix_group_lengths(ListBase idlist)
void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
static DynamicLibrary lib