21#define DNA_DEPRECATED_ALLOW
86#define U (*((const UserDef *)&U))
91 uint *mcol, *mcoln, *mcolmain;
94 if (
mesh->totface_legacy == 0 ||
mesh->mcol ==
nullptr) {
99 mcol =
reinterpret_cast<uint *
>(
mesh->mcol);
101 for (a =
mesh->totface_legacy; a > 0; a--, mface++) {
102 mcoln[0] = mcol[mface->
v1];
103 mcoln[1] = mcol[mface->
v2];
104 mcoln[2] = mcol[mface->
v3];
105 mcoln[3] = mcol[mface->
v4];
109 MEM_delete(
mesh->mcol);
110 mesh->mcol =
reinterpret_cast<MCol *
>(mcolmain);
132 for (
Bone &bone : *lb) {
133 if (bone.rad_tail == 0.0f && bone.rad_head == 0.0f) {
134 bone.rad_head = 0.25f * bone.length;
135 bone.rad_tail = 0.1f * bone.length;
137 bone.dist -= bone.rad_head;
138 bone.dist = std::max(bone.dist, 0.0f);
146 for (
Bone &bone : *lb) {
147 if (bone.layer == 0) {
159 if (
node.storage ==
nullptr) {
160 NodeBlurData *nbd = MEM_new<NodeBlurData>(
"node blur patch");
168 if (
node.storage ==
nullptr) {
169 NodeBlurData *nbd = MEM_new<NodeBlurData>(
"node blur patch");
187 if (nhs->
val == 0.0f) {
207 ntf = MEM_new<NodeTwoFloats>(
"NodeTwoFloats");
216 nodeid =
static_cast<ID *
>(
219 image = id_cast<Image *>(nodeid);
238 for (loop = prop->
data.
group.first(), i = 0; loop; loop = loop->
next, i++) {
244 if (prop->
len != i) {
245 printf(
"Found and fixed bad id property group length.\n");
265 int a, mtfacen, mcoln;
267 if (!
mesh->vert_data.totlayer) {
269 &
mesh->vert_data, CD_MVERT,
mesh->mvert,
mesh->verts_num,
nullptr);
277 if (!
mesh->edge_data.totlayer) {
279 &
mesh->edge_data, CD_MEDGE,
mesh->medge,
mesh->edges_num,
nullptr);
282 if (!
mesh->fdata_legacy.totlayer) {
288 MEM_delete(
mesh->mcol);
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));
305 MEM_delete(
mesh->tface);
306 mesh->tface =
nullptr;
308 else if (
mesh->mcol) {
315 MEM_delete(
mesh->tface);
316 mesh->tface =
nullptr;
319 for (a = 0, mtfacen = 0, mcoln = 0; a <
mesh->fdata_legacy.totlayer; a++) {
323 if (
layer->name[0] == 0) {
334 if (
layer->name[0] == 0) {
353 for (a = 0; a <
mesh->fdata_legacy.totlayer; a++) {
368 ImageUser *iuser = MEM_new<ImageUser>(
"ima user node");
375 node.storage = iuser;
379 ImageUser *iuser = MEM_new<ImageUser>(
"node image user");
381 node.storage = iuser;
393 paf =
reinterpret_cast<PartEff *
>(eff);
395 MEM_delete(paf->
keys);
450 strip->blend_opacity = 100.0f;
497 for (a = 0; a < ob->
totcol; 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;
626 nr =
mesh->totface_legacy;
630 for (j = 0; j < 4; j++) {
632 cp = (
reinterpret_cast<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;
713 for (a = 0; a <
mesh->totface_legacy; a++, tface++) {
714 for (
b = 0;
b < 4;
b++) {
715 tface->uv[
b][0] /= 32767.0f;
716 tface->uv[
b][1] /= 32767.0f;
727 sound = bmain->
sounds.first();
729 if (sound->
volume < 0.01f) {
740 sound = bmain->
sounds.first();
747 sound->
flags |= SOUND_FLAGS_3D;
750 sound->
flags &= ~SOUND_FLAGS_3D;
763 if (
mesh->flag & ME_SMESH) {
764 mesh->flag &= ~ME_SMESH;
765 mesh->flag |= ME_SUBSURF;
770 if (
mesh->subdiv < 2) {
791 for (i = 0; i <
mesh->totface_legacy * 4; i++) {
799 for (i = 0; i <
mesh->totface_legacy; i++) {
800 TFace *tf = &(
static_cast<TFace *
>(
mesh->tface))[i];
802 for (j = 0; j < 4; j++) {
803 char *col =
reinterpret_cast<char *
>(&tf->col[j]);
814 for (vf = bmain->
fonts.first(); vf; vf =
static_cast<VFont *
>(vf->
id.
next)) {
826 for (sound = bmain->
sounds.first(); sound; sound =
static_cast<bSound *
>(sound->
id.
next)) {
837 if ((
mesh->flag & ME_SUBSURF) && (
mesh->subdivr == 0)) {
900 for (sce = bmain->
scenes.first(); sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
1030 for (screen = bmain->
screens.first(); screen; screen =
static_cast<bScreen *
>(screen->
id.
next))
1100 if (wrld->aodist == 0.0f) {
1101 wrld->aodist = 10.0f;
1103 if (wrld->aoenergy == 0.0f) {
1104 wrld->aoenergy = 1.0f;
1106 wrld =
static_cast<World *
>(wrld->id.next);
1111 for (screen = bmain->
screens.first(); screen; screen =
static_cast<bScreen *
>(screen->
id.
next))
1128 for (screen = bmain->
screens.first(); screen; screen =
static_cast<bScreen *
>(screen->
id.
next))
1144 for (screen = bmain->
screens.first(); screen; screen =
static_cast<bScreen *
>(screen->
id.
next))
1165 if (tex->
nabla == 0.0f) {
1166 tex->
nabla = 0.025f;
1185 if (cam->ortho_scale == 0.0f) {
1186 cam->ortho_scale = 256.0f / cam->lens;
1188 printf(
"NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
1191 cam =
static_cast<Camera *
>(cam->id.next);
1249 enum { ARM_DRAWXRAY = (1 << 1) };
1261 if (
mesh->flag & ME_SUBSURF) {
1265 smd->
levels = std::max<short>(1,
mesh->subdiv);
1270 if (
mesh->subdiv != 0) {
1273 if (
mesh->subdivr != 0) {
1277 if (
mesh->flag & ME_OPT_EDGES) {
1316 sce->
toolsettings = MEM_new<ToolSettings>(
"Tool Settings Struct");
1323 if (lt->
fu == 0.0f && lt->
fv == 0.0f && lt->
fw == 0.0f) {
1368 data->weight = 1.0f;
1369 data->orientweight = 1.0f;
1373 data->rootbone = -1;
1385 if (paf->
disp == 0) {
1391 if (paf->
omat == 0) {
1415 if (&kb == key->
refkey) {
1416 if (kb.
name[0] == 0) {
1421 if (kb.
name[0] == 0) {
1435 int set_passepartout = 0;
1455 if (arm->
layer == 0) {
1460 for (; sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
1462 set_passepartout = 1;
1467 for (; cam; cam =
static_cast<Camera *
>(cam->id.next)) {
1468 if (set_passepartout) {
1478 if (!(cam->passepartalpha)) {
1479 cam->passepartalpha = 0.2f;
1493 if (arm->
layer == 0) {
1497 for (sce = bmain->
scenes.first(); sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
1542 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
1543 if (
STREQ(ima->filepath,
"Compositor")) {
1544 BLI_strncpy_utf8(ima->id.name + 2,
"Viewer Node",
sizeof(ima->id.name) - 2);
1545 STRNCPY(ima->filepath,
"Viewer Node");
1564 for (screen = bmain->
screens.first(); screen; screen =
static_cast<bScreen *
>(screen->
id.
next))
1581 for (sce = bmain->
scenes.first(); sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
1583 R_THREADS = (1 << 19),
1589 if (sce->
r.
mode & R_THREADS) {
1610 for (bezt = nu.
bezt, a = 0; a < nu.
pntsu; a++, bezt++) {
1617 for (bp = nu.
bp, a = 0; a < nu.
pntsu * nu.
pntsv; a++, bp++) {
1633 switch (curcon.type) {
1638 if (
data->flag == 0) {
1653 switch (curcon.
type) {
1666 if (
data->flag == 0) {
1691 for (ma = bmain->
materials.first(); ma; ma =
static_cast<Material *
>(ma->id.next)) {
1701 for (collection = bmain->
collections.first(); collection;
1704 if (collection->
layer == 0) {
1705 collection->
layer = (1 << 20) - 1;
1715 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
1723 if (
STREQLEN(ima->id.name + 2,
"Viewer Node",
sizeof(ima->id.name) - 2)) {
1727 if (
STREQLEN(ima->id.name + 2,
"Render Result",
sizeof(ima->id.name) - 2)) {
1732 for (tex = bmain->
textures.first(); tex; tex =
static_cast<Tex *
>(tex->
id.
next)) {
1734 TEX_ANIMCYCLIC = (1 << 6),
1735 TEX_ANIM5 = (1 << 7),
1739 ima =
static_cast<Image *
>(
1750 for (sce = bmain->
scenes.first(); sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
1755 for (ntree = bmain->
nodetrees.first(); ntree;
1760 for (ma = bmain->
materials.first(); ma; ma =
static_cast<Material *
>(ma->id.next)) {
1774 if (curdef.
name[0] ==
'\0') {
1785 switch (mmd->
axis) {
1817 for (screen = bmain->
screens.first(); screen;
1859 if (curcon.flag & 0x20) {
1864 switch (curcon.type) {
1869 if (
int(
data->flag2)) {
1888 if (curcon.
flag & 0x20) {
1893 switch (curcon.
type) {
1920 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
1921 ima->preview =
nullptr;
1936 printf(
"Old memory cache isn't supported for particles, so re-bake the simulation!\n");
1956 for (ma = bmain->
materials.first(); ma; ma =
static_cast<Material *
>(ma->id.next)) {
1957 if (ma->gloss_mir == 0.0f) {
1958 ma->gloss_mir = 1.0f;
1962 for (part = bmain->
particles.first(); part;
1970 for (sce = bmain->
scenes.first(); sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
1987 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
1994 for (tex = bmain->
textures.first(); tex; tex =
static_cast<Tex *
>(tex->
id.
next)) {
1999 ima =
static_cast<Image *
>(
2001 if (ima && (
int(tex->
iuser.
flag) &
int(IMA_DO_PREMUL))) {
2012 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
2013 ima->aspx = ima->aspy = 1.0f;
2037 for (sce = bmain->
scenes.first(); sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
2047 for (sce = bmain->
scenes.first(); sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
2069 for (k = 0; k < sb->
totkey; k++) {
2071 MEM_delete(sb->
keys[k]);
2075 MEM_delete(sb->
keys);
2092 for (k = 0; k < sb->
totkey; k++) {
2094 MEM_delete(sb->
keys[k]);
2098 MEM_delete(sb->
keys);
2113 psys = MEM_new<ParticleSystem>(
"particle_system");
2168 float fac = paf->
lifetime / 100.0f;
2203 for (; dup; dup =
static_cast<Object *
>(dup->
id.
next)) {
2227 printf(
"Old particle system converted to new system.\n");
2231 for (sce = bmain->
scenes.first(); sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
2264 for (sce = bmain->
scenes.first(); sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
2304 if (ob->fluidsimSettings) {
2309 MEM_delete(fluidmd->
fss);
2310 fluidmd->
fss = MEM_dupalloc(ob->fluidsimSettings);
2311 MEM_delete(ob->fluidsimSettings);
2353 for (sce = bmain->
scenes.first(); sce; sce =
static_cast<Scene *
>(sce->
id.
next)) {
2363 for (screen = bmain->
screens.first(); screen; screen =
static_cast<bScreen *
>(screen->
id.
next))
2409 if (strip.data && strip.data->proxy) {
2410 strip.data->proxy->quality = 90;
Blender kernel action and pose functionality.
CustomData interface, see also DNA_customdata_types.h.
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
#define CMP_NODE_ALPHAOVER
General operations, lookup, etc. for blender objects.
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
Platform independent time functions.
Compatibility-like things for windows.
external readfile function prototypes.
#define ID_IS_LINKED(_id)
Object groups, one object can be in many groups at once.
These structs are the foundation for all linked lists in the library system.
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define STREQLEN(a, b, n)
ccl_device_inline int4 cast(const float4 a)
ccl_device_inline int4 srl(const int4 a, const int i)
ListBaseT< Strip > * active_seqbase_get(const Editing *ed)
void foreach_strip(ListBaseT< Strip > *seqbase, ForEachFunc callback, void *user_data)
ID_Readfile_Data::Tags & BLO_readfile_id_runtime_tags_for_write(ID &id)
static void do_version_free_effects_245(ListBaseT< Effect > *lb)
static void vcol_to_fcol(Mesh *mesh)
void BKE_object_defgroup_unique_name(bDeformGroup *dg, Object *ob)
char * STRNCPY(char(&dst)[N], const char *src)
void BKE_pose_tag_recalc(Main *bmain, bPose *pose) ATTR_NONNULL(1
MINLINE void copy_v3_v3(float r[3], const float a[3])
static void idproperties_fix_groups_lengths_recurse(IDProperty *prop)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
static void ntree_version_242(bNodeTree *ntree)
@ CONSTRAINT_TYPE_KINEMATIC
@ CONSTRAINT_TYPE_FOLLOWPATH
@ CONSTRAINT_TYPE_LOCLIMIT
@ CONSTRAINT_TYPE_TRACKTO
@ CONSTRAINT_TYPE_ROTLIKE
@ CONSTRAINT_TYPE_LOCLIKE
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
bDeformGroup * BKE_object_defgroup_find_name(const Object *ob, StringRef name)
int bool bool BLI_str_endswith(const char *__restrict str, const char *__restrict end) ATTR_NONNULL(1
void * blo_do_versions_newlibadr(FileData *fd, ID *self_id, const bool is_linked_only, const void *adr)
PartEff * BKE_object_do_version_give_parteff_245(Object *ob)
@ eModifierType_ParticleSystem
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
static void bone_version_238(ListBaseT< Bone > *lb)
struct bConstraint * BKE_constraint_add_for_object(struct Object *ob, const char *name, eBConstraint_Types type)
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du)
struct ParticleSettings * BKE_particlesettings_add(struct Main *bmain, const char *name)
static void bone_version_239(ListBaseT< Bone > *lb)
MINLINE void mul_v3_fl(float r[3], float f)
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
void BKE_modifier_unique_name(ListBaseT< ModifierData > *modifiers, ModifierData *md)
static void do_version_free_effect_245(Effect *eff)
@ CMP_NODE_BLUR_TYPE_QUAD
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
const void * CustomData_add_layer_with_data(CustomData *data, eCustomDataType type, void *layer_data, int totelem, const ImplicitSharingInfo *sharing_info)
@ UVCALC_UNWRAP_METHOD_ANGLE
@ UVCALC_UNWRAP_METHOD_CONFORMAL
@ eSubsurfModifierFlag_DebugIncr
@ eSubsurfModifierFlag_Incremental
@ eSubsurfModifierFlag_ControlEdges
void blo_do_versions_oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr, const int nr)
BMesh const char void * data
ModifierData * BKE_modifier_new(int type)
static void idproperties_fix_group_lengths(const ListBaseT< T > &idlist)
static void customdata_version_242(Mesh *mesh)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
static void customdata_version_243(Mesh *mesh)
void BKE_mesh_calc_edges_legacy(Mesh *mesh)
void unit_m4(float m[4][4])
void BKE_armature_where_is(bArmature *arm)
void blo_do_version_old_trackto_to_constraints(Object *ob)
static void ntree_version_245(FileData *fd, Library *, bNodeTree *ntree)
static void ntree_version_241(bNodeTree *ntree)
enum DNA_DEPRECATED SACTSNAP_FRAME
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
void BKE_mesh_strip_loose_faces(Mesh *mesh)
static void do_version_constraints_245(ListBaseT< bConstraint > *lb)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
static void do_version_bone_head_tail_237(Bone *bone)
ID_Type GS(const char *name)
struct PointCache * BKE_ptcache_add(ListBaseT< PointCache > *ptcaches)
double BLI_time_now_seconds()
static bool strip_set_blend_mode_cb(Strip *strip, void *)
static void do_version_ntree_242_2(bNodeTree *ntree)
static bool strip_set_alpha_mode_cb(Strip *strip, void *)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
ID_Readfile_Data::Tags BLO_readfile_id_runtime_tags(const ID &id)
void * CustomData_add_layer(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem)
ListBaseT< Bone > childbase
struct PointCache * point_cache
struct ListBaseT< PointCache > ptcaches
DNA_DEPRECATED unsigned int layer
CurveModifierDefaultAxis defaxis
ListBaseT< Strip > seqbase
struct FluidsimSettings * fss
struct FluidVertexVelocity * meshVelocities
ListBaseT< struct IDProperty > group
ListBaseT< KeyBlock > block
ListBaseT< Key > shapekeys
ListBaseT< Collection > collections
ListBaseT< bArmature > armatures
ListBaseT< Lattice > lattices
ListBaseT< bNodeTree > nodetrees
ListBaseT< Camera > cameras
ListBaseT< MetaBall > metaballs
bool is_locked_for_linking
ListBaseT< Library > libraries
ListBaseT< Light > lights
ListBaseT< World > worlds
ListBaseT< Brush > brushes
ListBaseT< Material > materials
ListBaseT< Object > objects
ListBaseT< Curve > curves
ListBaseT< bSound > sounds
ListBaseT< ParticleSettings > particles
ListBaseT< Image > images
ListBaseT< bAction > actions
ListBaseT< Scene > scenes
ListBaseT< Tex > textures
ListBaseT< bScreen > screens
DNA_DEPRECATED short axis
struct ModifierData * next
DNA_DEPRECATED short samples
DNA_DEPRECATED short filtertype
DNA_DEPRECATED short maxspeed
DNA_DEPRECATED short sizex
DNA_DEPRECATED short sizey
DNA_DEPRECATED int frames
DNA_DEPRECATED char cyclic
ListBaseT< ModifierData > modifiers
eObject_DrawExtraFlag dtx
ListBaseT< struct ParticleSystem > particlesystem
DNA_DEPRECATED short colbits
ListBaseT< Effect > effect
ListBaseT< bConstraint > constraints
ListBaseT< bDeformGroup > defbase
eObject_EmptyDrawType empty_drawtype
eObject_TransFlag transflag
float instance_faces_scale
struct Collection * group
ParticleBrushData brush[7]
struct Object * instance_object
DNA_DEPRECATED struct Collection * force_group
eParticleRotationMode rotmode
struct ParticleSystem * psys
ListBaseT< PointCache > ptcaches
eParticleSystem_Flag flag
struct PointCache * pointcache
ListBaseT< SceneRenderLayer > layers
float motion_blur_shutter
DNA_DEPRECATED struct bNodeTree * nodetree
struct ToolSettings * toolsettings
ListBaseT< SpaceLink > spacedata
DNA_DEPRECATED struct PointCache * pointcache
ListBaseT< PointCache > ptcaches
DNA_DEPRECATED View2D v2d
DNA_DEPRECATED char autosnap
DNA_DEPRECATED short autosnap
DNA_DEPRECATED View2D v2d
DNA_DEPRECATED View2D v2d
DNA_DEPRECATED short autosnap
DNA_DEPRECATED View2D v2d
eSpaceButtons_Context mainb
DNA_DEPRECATED View2D v2d
SubsurfModifierFlag flags
DNA_DEPRECATED int frames
DNA_DEPRECATED int offset
eView3D_GridFlag gridflag
DNA_DEPRECATED unsigned int layer
eArmature_DeformFlag deformflag
ListBaseT< Bone > bonebase
eBConstraint_SpaceTypes ownspace
eBConstraint_SpaceTypes tarspace
ListBaseT< struct bConstraint > constraints
ListBaseT< bPoseChannel > chanbase
ListBaseT< struct ScrArea > areabase
struct PackedFile * newpackedfile
struct PackedFile * packedfile