21#define DNA_DEPRECATED_ALLOW
82#define U (*((const UserDef *)&U))
87 uint *mcol, *mcoln, *mcolmain;
95 mcol = (
uint *)mesh->mcol;
98 mcoln[0] = mcol[mface->
v1];
99 mcoln[1] = mcol[mface->
v2];
100 mcoln[2] = mcol[mface->
v3];
101 mcoln[3] = mcol[mface->
v4];
106 mesh->mcol = (
MCol *)mcolmain;
129 if (bone->rad_tail == 0.0f && bone->rad_head == 0.0f) {
130 bone->rad_head = 0.25f * bone->length;
131 bone->rad_tail = 0.1f * bone->length;
133 bone->dist -= bone->rad_head;
134 bone->dist = std::max(bone->dist, 0.0f);
143 if (bone->layer == 0) {
155 if (node->storage ==
nullptr) {
157 nbd->
sizex = node->custom1;
158 nbd->
sizey = node->custom2;
164 if (node->storage ==
nullptr) {
183 if (nhs->
val == 0.0f) {
202 if (!node->storage) {
212 nodeid =
static_cast<ID *
>(
214 if (node->storage && nodeid &&
GS(nodeid->
name) ==
ID_IM) {
215 image = (
Image *)nodeid;
216 iuser =
static_cast<ImageUser *
>(node->storage);
220 if (iuser->
flag & IMA_DO_PREMUL) {
235 loop = loop->
next,
i++)
242 if (prop->
len !=
i) {
243 printf(
"Found and fixed bad id property group length.\n");
252 for (
id =
static_cast<ID *
>(idlist.
first);
id;
id =
static_cast<ID *
>(id->
next)) {
265 int a, mtfacen, mcoln;
300 for (a = 0; a < mesh->
totface_legacy; a++, mtf++, tf++, mcol += 4) {
301 memcpy(mcol, tf->col,
sizeof(tf->col));
302 memcpy(mtf->uv, tf->uv,
sizeof(tf->uv));
306 mesh->tface =
nullptr;
308 else if (mesh->mcol) {
316 mesh->tface =
nullptr;
323 if (layer->
name[0] == 0) {
334 if (layer->
name[0] == 0) {
370 iuser->
frames = nia->frames;
371 iuser->
sfra = nia->sfra;
372 iuser->
offset = nia->nr - 1;
373 iuser->
cycl = nia->cyclic;
375 node->storage = iuser;
381 node->storage = iuser;
416 con->headtail = 1.0f;
497 for (a = 0; a < ob->
totcol; a++) {
499 ob->colbits |= (1 << a);
566 if ((tex->
rfac == 0.0f) && (tex->
gfac == 0.0f) && (tex->
bfac == 0.0f)) {
580 if ((tex->
rfac == 0.0f) && (tex->
gfac == 0.0f) && (tex->
bfac == 0.0f)) {
613 mesh->smoothresh_legacy = 30;
630 for (j = 0; j < 4; j++) {
632 cp = ((
char *)&tface->col[j]) + 1;
633 for (k = 0; k < 3; k++) {
634 cp[k] = (cp[k] > 126) ? 255 : cp[k] * 2;
648 if (mesh->subdiv == 0) {
664 sipo->v2d.max[0] = 15000.0;
712 TFace *tface = mesh->tface;
714 for (
b = 0;
b < 4;
b++) {
715 tface->uv[
b][0] /= 32767.0f;
716 tface->uv[
b][1] /= 32767.0f;
729 if (sound->
volume < 0.01f) {
747 sound->
flags |= SOUND_FLAGS_3D;
750 sound->
flags &= ~SOUND_FLAGS_3D;
765 ME_SUBSURF = (1 << 7),
767 if (mesh->
flag & ME_SMESH) {
768 mesh->
flag &= ~ME_SMESH;
769 mesh->
flag |= ME_SUBSURF;
774 if (mesh->subdiv < 2) {
798 MCol *mcol = &mesh->mcol[
i];
806 TFace *tf = &((TFace *)mesh->tface)[
i];
808 for (j = 0; j < 4; j++) {
809 char *
col = (
char *)&tf->col[j];
847 enum { ME_SUBSURF = (1 << 7) };
848 if ((mesh->
flag & ME_SUBSURF) && (mesh->subdivr == 0)) {
849 mesh->subdivr = mesh->subdiv;
861 sseq->v2d.keeptot = 0;
927 sac->v2d.max[0] = 32000;
931 sla->v2d.max[0] = 32000;
987 sbuts->v2d.maxzoom = 1.2f;
989 if (sbuts->
mainb == BUTS_LAMP) {
990 sbuts->
mainb = CONTEXT_SHADING;
993 else if (sbuts->
mainb == BUTS_MAT) {
994 sbuts->
mainb = CONTEXT_SHADING;
997 else if (sbuts->
mainb == BUTS_TEX) {
998 sbuts->
mainb = CONTEXT_SHADING;
1001 else if (sbuts->
mainb == BUTS_ANIM) {
1002 sbuts->
mainb = CONTEXT_OBJECT;
1004 else if (sbuts->
mainb == BUTS_WORLD) {
1005 sbuts->
mainb = CONTEXT_SCENE;
1008 else if (sbuts->
mainb == BUTS_RENDER) {
1009 sbuts->
mainb = CONTEXT_SCENE;
1012 else if (sbuts->
mainb == BUTS_FPAINT) {
1013 sbuts->
mainb = CONTEXT_EDITING;
1015 else if (sbuts->
mainb == BUTS_RADIO) {
1016 sbuts->
mainb = CONTEXT_SHADING;
1019 else if (sbuts->
mainb == BUTS_CONSTRAINT) {
1020 sbuts->
mainb = CONTEXT_OBJECT;
1022 else if (sbuts->
mainb == BUTS_SCRIPT) {
1023 sbuts->
mainb = CONTEXT_OBJECT;
1025 else if (sbuts->
mainb == BUTS_EDIT) {
1026 sbuts->
mainb = CONTEXT_EDITING;
1029 sbuts->
mainb = CONTEXT_SCENE;
1054 sac->v2d.maxzoom = 50;
1117 if (wrld->
aodist == 0.0f) {
1136 snla->v2d.maxzoom = 50;
1185 if (tex->
nabla == 0.0f) {
1186 tex->
nabla = 0.025f;
1208 printf(
"NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
1275 enum { ARM_DRAWXRAY = (1 << 1) };
1276 if (arm->
flag & ARM_DRAWXRAY) {
1285 ME_SUBSURF = (1 << 7),
1286 ME_OPT_EDGES = (1 << 8),
1289 if (mesh->
flag & ME_SUBSURF) {
1293 smd->
levels = std::max<short>(1, mesh->subdiv);
1298 if (mesh->subdiv != 0) {
1301 if (mesh->subdivr != 0) {
1305 if (mesh->
flag & ME_OPT_EDGES) {
1353 if (lt->
fu == 0.0f && lt->
fv == 0.0f && lt->
fw == 0.0f) {
1396 if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) {
1397 pchan->limitmin[0] = pchan->limitmin[1] = pchan->limitmin[2] = -180.0f;
1398 pchan->limitmax[0] = pchan->limitmax[1] = pchan->limitmax[2] = 180.0f;
1403 data->weight = 1.0f;
1404 data->orientweight = 1.0f;
1408 data->rootbone = -1;
1420 if (paf->
disp == 0) {
1426 if (paf->
omat == 0) {
1457 if (kb->name[0] == 0) {
1462 if (kb->name[0] == 0) {
1463 SNPRINTF(kb->name,
"Key %d", index);
1476 int set_passepartout = 0;
1500 if (arm->layer == 0) {
1505 for (; sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
1507 set_passepartout = 1;
1512 for (; cam; cam =
static_cast<Camera *
>(cam->
id.
next)) {
1513 if (set_passepartout) {
1540 if (arm->layer == 0) {
1640 R_THREADS = (1 << 19),
1646 if (sce->
r.
mode & R_THREADS) {
1670 for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
1677 for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
1695 switch (curcon->type) {
1700 if (
data->flag == 0) {
1713 switch (curcon->type) {
1726 if (
data->flag == 0) {
1766 if (collection->layer == 0) {
1767 collection->layer = (1 << 20) - 1;
1800 TEX_ANIMCYCLIC = (1 << 6),
1801 TEX_ANIM5 = (1 << 7),
1805 ima =
static_cast<Image *
>(
1807 if (tex->
imaflag & TEX_ANIM5) {
1855 if (curdef->name[0] ==
'\0') {
1866 switch (mmd->axis) {
1910 saction->v2d.tot.ymin = -1000.0;
1911 saction->v2d.tot.ymax = 0.0;
1913 saction->v2d.cur.ymin = -75.0;
1914 saction->v2d.cur.ymax = 5.0;
1944 if (curcon->flag & 0x20) {
1949 switch (curcon->type) {
1971 if (curcon->flag & 0x20) {
1976 switch (curcon->type) {
2012 if (ob->
soft && !ob->
soft->pointcache) {
2017 if (psys->pointcache) {
2021 printf(
"Old memory cache isn't supported for particles, so re-bake the simulation!\n");
2044 if (ma->gloss_mir == 0.0f) {
2045 ma->gloss_mir = 1.0f;
2093 ima =
static_cast<Image *
>(
2095 if (ima && (tex->
iuser.
flag & IMA_DO_PREMUL)) {
2175 for (k = 0; k < sb->
totkey; k++) {
2200 for (k = 0; k < sb->
totkey; k++) {
2260 part->force_group = paf->
group;
2276 float fac = paf->
lifetime / 100.0f;
2310 for (; dup; dup =
static_cast<Object *
>(dup->
id.
next)) {
2334 printf(
"Old particle system converted to new system.\n");
2380 float length, actlength, repeat;
2386 repeat = strip->repeat;
2389 length = strip->end - strip->start;
2393 actlength = strip->actend - strip->actstart;
2395 strip->scale =
length / (repeat * actlength);
2396 if (strip->scale == 0.0f) {
2397 strip->scale = 1.0f;
2455 if (ob->fluidsimSettings) {
2492 nu->radius_interp = 3;
2498 if (nu->pntsv > 1) {
2499 nu->resolu = std::max(1,
int((
float(nu->resolu) /
float(nu->pntsu)) + 0.5f));
2500 nu->resolv = std::max(1,
int((
float(nu->resolv) /
float(nu->pntsv)) + 0.5f));
2527 switch (sl->spacetype) {
2571 if (strip->data && strip->data->proxy) {
2572 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])
#define SNPRINTF(dst, format,...)
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
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
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)
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
float length(VecOp< float, D >) RET
#define ID_IS_LINKED(_id)
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 for_each_callback(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 bNodeTree * nodetree
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