UI: Asset Shelf (Experimental Feature) #104831

Closed
Julian Eisel wants to merge 399 commits from asset-shelf into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
100 changed files with 620 additions and 390 deletions
Showing only changes of commit ec275484b7 - Show all commits

View File

@ -38,7 +38,7 @@ PROJECT_NAME = Blender
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = V3.6
PROJECT_NUMBER = V4.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@ -78,29 +78,30 @@ class PREFERENCES_OT_copy_prev(Operator):
@classmethod
def previous_version(cls):
# Find config folder from previous version.
import os
version = bpy.app.version
version_new = ((version[0] * 100) + version[1])
version_old = ((version[0] * 100) + version[1]) - 1
# Find config folder from previous version.
#
# Always allow to load startup data from any release from current major release cycle, and the previous one.
# Ensure we only try to copy files from a point release.
# The check below ensures the second numbers match.
while (version_new % 100) // 10 == (version_old % 100) // 10:
version_split = version_old // 100, version_old % 100
if os.path.isdir(cls._old_version_path(version_split)):
return version_split
version_old = version_old - 1
# NOTE: This value may need to be updated when the release cycle system is modified.
# Here could be `6` in theory (Blender 3.6 LTS), just give it a bit of extra room, such that it does not have to
# be updated if there ever exist a 3.7 release e.g.
MAX_MINOR_VERSION_FOR_PREVIOUS_MAJOR_LOOKUP = 10
# Support loading 2.8x..2.9x startup (any older isn't so useful to load).
# NOTE: remove this block for Blender 4.0 and later.
if version_old == 299:
version_old = 294
while version_old >= 280:
version_split = version_old // 100, version_old % 100
if os.path.isdir(cls._old_version_path(version_split)):
return version_split
version_old = version_old - 1
version_new = bpy.app.version[:2]
version_old = [version_new[0], version_new[1] - 1]
while True:
while version_old[1] >= 0:
if os.path.isdir(cls._old_version_path(version_old)):
return tuple(version_old)
version_old[1] -= 1
if version_new[0] == version_old[0]:
# Retry with older major version.
version_old[0] -= 1
version_old[1] = MAX_MINOR_VERSION_FOR_PREVIOUS_MAJOR_LOOKUP
else:
break
return None

View File

@ -147,6 +147,9 @@ class VIEWLAYER_PT_eevee_layer_passes_effects(ViewLayerButtonsPanel, Panel):
col.prop(view_layer_eevee, "use_pass_bloom", text="Bloom")
col.active = scene_eevee.use_bloom
col = layout.column()
col.prop(view_layer_eevee, "use_pass_transparent")
class ViewLayerAOVPanel(ViewLayerButtonsPanel, Panel):
bl_label = "Shader AOV"

View File

@ -17,7 +17,7 @@ extern "C" {
*/
/* Blender major and minor version. */
#define BLENDER_VERSION 306
#define BLENDER_VERSION 400
/* Blender patch version for bugfix releases. */
#define BLENDER_VERSION_PATCH 0
/** Blender release cycle stage: alpha/beta/rc/release. */
@ -25,7 +25,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 11
#define BLENDER_FILE_SUBVERSION 1
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file

View File

@ -322,7 +322,7 @@ void BKE_collection_blend_read_expand(struct BlendExpander *expander,
void BKE_collection_compat_blend_read_data(struct BlendDataReader *reader,
struct SceneCollection *sc);
void BKE_collection_compat_blend_read_lib(struct BlendLibReader *reader,
struct Library *lib,
struct ID *self_id,
struct SceneCollection *sc);
void BKE_collection_compat_blend_read_expand(struct BlendExpander *expander,
struct SceneCollection *sc);

View File

@ -315,7 +315,7 @@ void IDP_BlendReadData_impl(struct BlendDataReader *reader,
struct IDProperty **prop,
const char *caller_func_id);
#define IDP_BlendDataRead(reader, prop) IDP_BlendReadData_impl(reader, prop, __func__)
void IDP_BlendReadLib(struct BlendLibReader *reader, struct Library *lib, struct IDProperty *prop);
void IDP_BlendReadLib(struct BlendLibReader *reader, struct ID *self_id, struct IDProperty *prop);
void IDP_BlendReadExpand(struct BlendExpander *expander, struct IDProperty *prop);
typedef enum eIDPropertyUIDataType {

View File

@ -275,7 +275,7 @@ void BKE_view_layer_blend_write(struct BlendWriter *writer,
struct ViewLayer *view_layer);
void BKE_view_layer_blend_read_data(struct BlendDataReader *reader, struct ViewLayer *view_layer);
void BKE_view_layer_blend_read_lib(struct BlendLibReader *reader,
struct Library *lib,
struct ID *self_id,
struct ViewLayer *view_layer);
/* iterators */

View File

@ -40,7 +40,7 @@ bool BKE_viewer_path_equal(const ViewerPath *a, const ViewerPath *b);
void BKE_viewer_path_blend_write(struct BlendWriter *writer, const ViewerPath *viewer_path);
void BKE_viewer_path_blend_read_data(struct BlendDataReader *reader, ViewerPath *viewer_path);
void BKE_viewer_path_blend_read_lib(struct BlendLibReader *reader,
struct Library *lib,
struct ID *self_id,
ViewerPath *viewer_path);
void BKE_viewer_path_foreach_id(struct LibraryForeachIDData *data, ViewerPath *viewer_path);
void BKE_viewer_path_id_remap(ViewerPath *viewer_path, const struct IDRemapper *mappings);

View File

@ -222,7 +222,7 @@ static void action_blend_read_data(BlendDataReader *reader, ID *id)
static void blend_read_lib_constraint_channels(BlendLibReader *reader, ID *id, ListBase *chanbase)
{
LISTBASE_FOREACH (bConstraintChannel *, chan, chanbase) {
BLO_read_id_address(reader, id->lib, &chan->ipo);
BLO_read_id_address(reader, id, &chan->ipo);
}
}
@ -232,16 +232,16 @@ static void action_blend_read_lib(BlendLibReader *reader, ID *id)
/* XXX deprecated - old animation system <<< */
LISTBASE_FOREACH (bActionChannel *, chan, &act->chanbase) {
BLO_read_id_address(reader, act->id.lib, &chan->ipo);
BLO_read_id_address(reader, id, &chan->ipo);
blend_read_lib_constraint_channels(reader, &act->id, &chan->constraintChannels);
}
/* >>> XXX deprecated - old animation system */
BKE_fcurve_blend_read_lib(reader, &act->id, &act->curves);
BKE_fcurve_blend_read_lib(reader, id, &act->curves);
LISTBASE_FOREACH (TimeMarker *, marker, &act->markers) {
if (marker->camera) {
BLO_read_id_address(reader, act->id.lib, &marker->camera);
BLO_read_id_address(reader, id, &marker->camera);
}
}
}
@ -1952,9 +1952,9 @@ void BKE_pose_blend_read_lib(BlendLibReader *reader, Object *ob, bPose *pose)
pchan->bone = BKE_armature_find_bone_name(arm, pchan->name);
IDP_BlendReadLib(reader, ob->id.lib, pchan->prop);
IDP_BlendReadLib(reader, &ob->id, pchan->prop);
BLO_read_id_address(reader, ob->id.lib, &pchan->custom);
BLO_read_id_address(reader, &ob->id, &pchan->custom);
if (UNLIKELY(pchan->bone == NULL)) {
rebuild = true;
}

View File

@ -1479,8 +1479,8 @@ void BKE_animdata_blend_read_lib(BlendLibReader *reader, ID *id, AnimData *adt)
}
/* link action data */
BLO_read_id_address(reader, id->lib, &adt->action);
BLO_read_id_address(reader, id->lib, &adt->tmpact);
BLO_read_id_address(reader, id, &adt->action);
BLO_read_id_address(reader, id, &adt->tmpact);
/* link drivers */
BKE_fcurve_blend_read_lib(reader, id, &adt->drivers);

View File

@ -329,7 +329,7 @@ void BKE_keyingsets_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *lis
{
LISTBASE_FOREACH (KeyingSet *, ks, list) {
LISTBASE_FOREACH (KS_Path *, ksp, &ks->paths) {
BLO_read_id_address(reader, id->lib, &ksp->id);
BLO_read_id_address(reader, id, &ksp->id);
}
}
}

View File

@ -261,12 +261,12 @@ static void armature_blend_read_data(BlendDataReader *reader, ID *id)
BKE_armature_bone_hash_make(arm);
}
static void lib_link_bones(BlendLibReader *reader, Library *lib, Bone *bone)
static void lib_link_bones(BlendLibReader *reader, ID *self_id, Bone *bone)
{
IDP_BlendReadLib(reader, lib, bone->prop);
IDP_BlendReadLib(reader, self_id, bone->prop);
LISTBASE_FOREACH (Bone *, curbone, &bone->childbase) {
lib_link_bones(reader, lib, curbone);
lib_link_bones(reader, self_id, curbone);
}
}
@ -274,7 +274,7 @@ static void armature_blend_read_lib(BlendLibReader *reader, ID *id)
{
bArmature *arm = (bArmature *)id;
LISTBASE_FOREACH (Bone *, curbone, &arm->bonebase) {
lib_link_bones(reader, id->lib, curbone);
lib_link_bones(reader, id, curbone);
}
}

View File

@ -361,16 +361,16 @@ static void brush_blend_read_lib(BlendLibReader *reader, ID *id)
Brush *brush = (Brush *)id;
/* brush->(mask_)mtex.obj is ignored on purpose? */
BLO_read_id_address(reader, brush->id.lib, &brush->mtex.tex);
BLO_read_id_address(reader, brush->id.lib, &brush->mask_mtex.tex);
BLO_read_id_address(reader, brush->id.lib, &brush->clone.image);
BLO_read_id_address(reader, brush->id.lib, &brush->toggle_brush);
BLO_read_id_address(reader, brush->id.lib, &brush->paint_curve);
BLO_read_id_address(reader, id, &brush->mtex.tex);
BLO_read_id_address(reader, id, &brush->mask_mtex.tex);
BLO_read_id_address(reader, id, &brush->clone.image);
BLO_read_id_address(reader, id, &brush->toggle_brush);
BLO_read_id_address(reader, id, &brush->paint_curve);
/* link default grease pencil palette */
if (brush->gpencil_settings != nullptr) {
if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
BLO_read_id_address(reader, brush->id.lib, &brush->gpencil_settings->material);
BLO_read_id_address(reader, id, &brush->gpencil_settings->material);
if (!brush->gpencil_settings->material) {
brush->gpencil_settings->flag &= ~GP_BRUSH_MATERIAL_PINNED;
@ -379,7 +379,7 @@ static void brush_blend_read_lib(BlendLibReader *reader, ID *id)
else {
brush->gpencil_settings->material = nullptr;
}
BLO_read_id_address(reader, brush->id.lib, &brush->gpencil_settings->material_alt);
BLO_read_id_address(reader, id, &brush->gpencil_settings->material_alt);
}
}
@ -399,10 +399,12 @@ static void brush_blend_read_expand(BlendExpander *expander, ID *id)
static int brush_undo_preserve_cb(LibraryIDLinkCallbackData *cb_data)
{
BlendLibReader *reader = (BlendLibReader *)cb_data->user_data;
ID *self_id = cb_data->self_id;
ID *id_old = *cb_data->id_pointer;
/* Old data has not been remapped to new values of the pointers, if we want to keep the old
* pointer here we need its new address. */
ID *id_old_new = id_old != nullptr ? BLO_read_get_new_id_address(reader, id_old->lib, id_old) :
ID *id_old_new = id_old != nullptr ? BLO_read_get_new_id_address(
reader, self_id, ID_IS_LINKED(self_id), id_old) :
nullptr;
BLI_assert(id_old_new == nullptr || ELEM(id_old, id_old_new, id_old_new->orig_id));
if (cb_data->cb_flag & IDWALK_CB_USER) {

View File

@ -142,14 +142,14 @@ static void camera_blend_read_data(BlendDataReader *reader, ID *id)
static void camera_blend_read_lib(BlendLibReader *reader, ID *id)
{
Camera *ca = (Camera *)id;
BLO_read_id_address(reader, ca->id.lib, &ca->ipo); /* deprecated, for versioning */
BLO_read_id_address(reader, id, &ca->ipo); /* deprecated, for versioning */
BLO_read_id_address(reader, ca->id.lib, &ca->dof_ob); /* deprecated, for versioning */
BLO_read_id_address(reader, ca->id.lib, &ca->dof.focus_object);
BLO_read_id_address(reader, id, &ca->dof_ob); /* deprecated, for versioning */
BLO_read_id_address(reader, id, &ca->dof.focus_object);
LISTBASE_FOREACH (CameraBGImage *, bgpic, &ca->bg_images) {
BLO_read_id_address(reader, ca->id.lib, &bgpic->ima);
BLO_read_id_address(reader, ca->id.lib, &bgpic->clip);
BLO_read_id_address(reader, id, &bgpic->ima);
BLO_read_id_address(reader, id, &bgpic->clip);
}
}

View File

@ -325,11 +325,11 @@ static void collection_blend_read_data(BlendDataReader *reader, ID *id)
BKE_collection_blend_read_data(reader, collection, NULL);
}
static void lib_link_collection_data(BlendLibReader *reader, Library *lib, Collection *collection)
static void lib_link_collection_data(BlendLibReader *reader, ID *self_id, Collection *collection)
{
BLI_assert(collection->runtime.gobject_hash == NULL);
LISTBASE_FOREACH_MUTABLE (CollectionObject *, cob, &collection->gobject) {
BLO_read_id_address(reader, lib, &cob->ob);
BLO_read_id_address(reader, self_id, &cob->ob);
if (cob->ob == NULL) {
BLI_freelinkN(&collection->gobject, cob);
@ -337,22 +337,20 @@ static void lib_link_collection_data(BlendLibReader *reader, Library *lib, Colle
}
LISTBASE_FOREACH (CollectionChild *, child, &collection->children) {
BLO_read_id_address(reader, lib, &child->collection);
BLO_read_id_address(reader, self_id, &child->collection);
}
}
#ifdef USE_COLLECTION_COMPAT_28
void BKE_collection_compat_blend_read_lib(BlendLibReader *reader,
Library *lib,
SceneCollection *sc)
void BKE_collection_compat_blend_read_lib(BlendLibReader *reader, ID *self_id, SceneCollection *sc)
{
LISTBASE_FOREACH (LinkData *, link, &sc->objects) {
BLO_read_id_address(reader, lib, &link->data);
BLO_read_id_address(reader, self_id, &link->data);
BLI_assert(link->data);
}
LISTBASE_FOREACH (SceneCollection *, nsc, &sc->scene_collections) {
BKE_collection_compat_blend_read_lib(reader, lib, nsc);
BKE_collection_compat_blend_read_lib(reader, self_id, nsc);
}
}
#endif
@ -361,15 +359,15 @@ void BKE_collection_blend_read_lib(BlendLibReader *reader, Collection *collectio
{
#ifdef USE_COLLECTION_COMPAT_28
if (collection->collection) {
BKE_collection_compat_blend_read_lib(reader, collection->id.lib, collection->collection);
BKE_collection_compat_blend_read_lib(reader, &collection->id, collection->collection);
}
if (collection->view_layer) {
BKE_view_layer_blend_read_lib(reader, collection->id.lib, collection->view_layer);
BKE_view_layer_blend_read_lib(reader, &collection->id, collection->view_layer);
}
#endif
lib_link_collection_data(reader, collection->id.lib, collection);
lib_link_collection_data(reader, &collection->id, collection);
}
static void collection_blend_read_lib(BlendLibReader *reader, ID *id)

View File

@ -6556,7 +6556,7 @@ static void lib_link_constraint_cb(bConstraint *UNUSED(con),
void *userdata)
{
tConstraintLinkData *cld = (tConstraintLinkData *)userdata;
BLO_read_id_address(cld->reader, cld->id->lib, idpoin);
BLO_read_id_address(cld->reader, cld->id, idpoin);
}
void BKE_constraint_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *conlist)
@ -6571,7 +6571,7 @@ void BKE_constraint_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *con
con->type = CONSTRAINT_TYPE_NULL;
}
/* own ipo, all constraints have it */
BLO_read_id_address(reader, id->lib, &con->ipo); /* XXX deprecated - old animation system */
BLO_read_id_address(reader, id, &con->ipo); /* XXX deprecated - old animation system */
/* If linking from a library, clear 'local' library override flag. */
if (ID_IS_LINKED(id)) {

View File

@ -270,19 +270,19 @@ static void curve_blend_read_lib(BlendLibReader *reader, ID *id)
{
Curve *cu = (Curve *)id;
for (int a = 0; a < cu->totcol; a++) {
BLO_read_id_address(reader, cu->id.lib, &cu->mat[a]);
BLO_read_id_address(reader, id, &cu->mat[a]);
}
BLO_read_id_address(reader, cu->id.lib, &cu->bevobj);
BLO_read_id_address(reader, cu->id.lib, &cu->taperobj);
BLO_read_id_address(reader, cu->id.lib, &cu->textoncurve);
BLO_read_id_address(reader, cu->id.lib, &cu->vfont);
BLO_read_id_address(reader, cu->id.lib, &cu->vfontb);
BLO_read_id_address(reader, cu->id.lib, &cu->vfonti);
BLO_read_id_address(reader, cu->id.lib, &cu->vfontbi);
BLO_read_id_address(reader, id, &cu->bevobj);
BLO_read_id_address(reader, id, &cu->taperobj);
BLO_read_id_address(reader, id, &cu->textoncurve);
BLO_read_id_address(reader, id, &cu->vfont);
BLO_read_id_address(reader, id, &cu->vfontb);
BLO_read_id_address(reader, id, &cu->vfonti);
BLO_read_id_address(reader, id, &cu->vfontbi);
BLO_read_id_address(reader, cu->id.lib, &cu->ipo); /* XXX deprecated - old animation system */
BLO_read_id_address(reader, cu->id.lib, &cu->key);
BLO_read_id_address(reader, id, &cu->ipo); /* XXX deprecated - old animation system */
BLO_read_id_address(reader, id, &cu->key);
}
static void curve_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -137,9 +137,9 @@ static void curves_blend_read_lib(BlendLibReader *reader, ID *id)
{
Curves *curves = (Curves *)id;
for (int a = 0; a < curves->totcol; a++) {
BLO_read_id_address(reader, curves->id.lib, &curves->mat[a]);
BLO_read_id_address(reader, id, &curves->mat[a]);
}
BLO_read_id_address(reader, curves->id.lib, &curves->surface);
BLO_read_id_address(reader, id, &curves->surface);
}
static void curves_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -2540,7 +2540,7 @@ void BKE_fmodifiers_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *fmo
switch (fcm->type) {
case FMODIFIER_TYPE_PYTHON: {
FMod_Python *data = (FMod_Python *)fcm->data;
BLO_read_id_address(reader, id->lib, &data->script);
BLO_read_id_address(reader, id, &data->script);
break;
}
}
@ -2670,7 +2670,7 @@ void BKE_fcurve_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *fcurves
DRIVER_TARGETS_LOOPER_BEGIN (dvar) {
/* only relink if still used */
if (tarIndex < dvar->num_targets) {
BLO_read_id_address(reader, id->lib, &dtar->id);
BLO_read_id_address(reader, id, &dtar->id);
}
else {
dtar->id = NULL;

View File

@ -275,12 +275,12 @@ static void greasepencil_blend_read_lib(BlendLibReader *reader, ID *id)
/* Layers */
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
/* Layer -> Parent References */
BLO_read_id_address(reader, gpd->id.lib, &gpl->parent);
BLO_read_id_address(reader, id, &gpl->parent);
}
/* materials */
for (int a = 0; a < gpd->totcol; a++) {
BLO_read_id_address(reader, gpd->id.lib, &gpd->mat[a]);
BLO_read_id_address(reader, id, &gpd->mat[a]);
}
}

View File

@ -1495,7 +1495,7 @@ void IDP_BlendReadData_impl(BlendDataReader *reader, IDProperty **prop, const ch
}
}
void IDP_BlendReadLib(BlendLibReader *reader, Library *lib, IDProperty *prop)
void IDP_BlendReadLib(BlendLibReader *reader, ID *self_id, IDProperty *prop)
{
if (!prop) {
return;
@ -1504,7 +1504,8 @@ void IDP_BlendReadLib(BlendLibReader *reader, Library *lib, IDProperty *prop)
switch (prop->type) {
case IDP_ID: /* PointerProperty */
{
void *newaddr = BLO_read_get_new_id_address(reader, lib, IDP_Id(prop));
void *newaddr = BLO_read_get_new_id_address(
reader, self_id, ID_IS_LINKED(self_id), IDP_Id(prop));
if (IDP_Id(prop) && !newaddr && G.debug) {
printf("Error while loading \"%s\". Data not found in file!\n", prop->name);
}
@ -1515,14 +1516,14 @@ void IDP_BlendReadLib(BlendLibReader *reader, Library *lib, IDProperty *prop)
{
IDProperty *idp_array = IDP_IDPArray(prop);
for (int i = 0; i < prop->len; i++) {
IDP_BlendReadLib(reader, lib, &(idp_array[i]));
IDP_BlendReadLib(reader, self_id, &(idp_array[i]));
}
break;
}
case IDP_GROUP: /* PointerProperty */
{
LISTBASE_FOREACH (IDProperty *, loop, &prop->data.group) {
IDP_BlendReadLib(reader, lib, loop);
IDP_BlendReadLib(reader, self_id, loop);
}
break;
}

View File

@ -144,7 +144,7 @@ static void ipo_blend_read_lib(BlendLibReader *reader, ID *id)
LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) {
if (icu->driver) {
BLO_read_id_address(reader, ipo->id.lib, &icu->driver->ob);
BLO_read_id_address(reader, id, &icu->driver->ob);
}
}
}

View File

@ -185,8 +185,8 @@ static void shapekey_blend_read_lib(BlendLibReader *reader, ID *id)
Key *key = (Key *)id;
BLI_assert((key->id.tag & LIB_TAG_EXTERN) == 0);
BLO_read_id_address(reader, key->id.lib, &key->ipo); /* XXX deprecated - old animation system */
BLO_read_id_address(reader, key->id.lib, &key->from);
BLO_read_id_address(reader, id, &key->ipo); /* XXX deprecated - old animation system */
BLO_read_id_address(reader, id, &key->from);
}
static void shapekey_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -161,8 +161,8 @@ static void lattice_blend_read_data(BlendDataReader *reader, ID *id)
static void lattice_blend_read_lib(BlendLibReader *reader, ID *id)
{
Lattice *lt = (Lattice *)id;
BLO_read_id_address(reader, lt->id.lib, &lt->ipo); // XXX deprecated - old animation system
BLO_read_id_address(reader, lt->id.lib, &lt->key);
BLO_read_id_address(reader, id, &lt->ipo); // XXX deprecated - old animation system
BLO_read_id_address(reader, id, &lt->key);
}
static void lattice_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -2438,35 +2438,35 @@ void BKE_view_layer_blend_read_data(BlendDataReader *reader, ViewLayer *view_lay
}
static void lib_link_layer_collection(BlendLibReader *reader,
Library *lib,
ID *self_id,
LayerCollection *layer_collection,
bool master)
const bool master)
{
/* Master collection is not a real data-block. */
if (!master) {
BLO_read_id_address(reader, lib, &layer_collection->collection);
BLO_read_id_address(reader, self_id, &layer_collection->collection);
}
LISTBASE_FOREACH (
LayerCollection *, layer_collection_nested, &layer_collection->layer_collections) {
lib_link_layer_collection(reader, lib, layer_collection_nested, false);
lib_link_layer_collection(reader, self_id, layer_collection_nested, false);
}
}
void BKE_view_layer_blend_read_lib(BlendLibReader *reader, Library *lib, ViewLayer *view_layer)
void BKE_view_layer_blend_read_lib(BlendLibReader *reader, ID *self_id, ViewLayer *view_layer)
{
LISTBASE_FOREACH (FreestyleModuleConfig *, fmc, &view_layer->freestyle_config.modules) {
BLO_read_id_address(reader, lib, &fmc->script);
BLO_read_id_address(reader, self_id, &fmc->script);
}
LISTBASE_FOREACH (FreestyleLineSet *, fls, &view_layer->freestyle_config.linesets) {
BLO_read_id_address(reader, lib, &fls->linestyle);
BLO_read_id_address(reader, lib, &fls->group);
BLO_read_id_address(reader, self_id, &fls->linestyle);
BLO_read_id_address(reader, self_id, &fls->group);
}
LISTBASE_FOREACH_MUTABLE (Base *, base, &view_layer->object_bases) {
/* we only bump the use count for the collection objects */
BLO_read_id_address(reader, lib, &base->object);
BLO_read_id_address(reader, self_id, &base->object);
if (base->object == nullptr) {
/* Free in case linked object got lost. */
@ -2478,12 +2478,12 @@ void BKE_view_layer_blend_read_lib(BlendLibReader *reader, Library *lib, ViewLay
}
LISTBASE_FOREACH (LayerCollection *, layer_collection, &view_layer->layer_collections) {
lib_link_layer_collection(reader, lib, layer_collection, true);
lib_link_layer_collection(reader, self_id, layer_collection, true);
}
BLO_read_id_address(reader, lib, &view_layer->mat_override);
BLO_read_id_address(reader, self_id, &view_layer->mat_override);
IDP_BlendReadLib(reader, lib, view_layer->id_properties);
IDP_BlendReadLib(reader, self_id, view_layer->id_properties);
}
/** \} */

View File

@ -167,7 +167,7 @@ static void light_blend_read_data(BlendDataReader *reader, ID *id)
static void light_blend_read_lib(BlendLibReader *reader, ID *id)
{
Light *la = (Light *)id;
BLO_read_id_address(reader, la->id.lib, &la->ipo); // XXX deprecated - old animation system
BLO_read_id_address(reader, id, &la->ipo); // XXX deprecated - old animation system
}
static void light_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -66,7 +66,7 @@ static void lightprobe_blend_read_data(BlendDataReader *reader, ID *id)
static void lightprobe_blend_read_lib(BlendLibReader *reader, ID *id)
{
LightProbe *prb = (LightProbe *)id;
BLO_read_id_address(reader, prb->id.lib, &prb->visibility_grp);
BLO_read_id_address(reader, &prb->id, &prb->visibility_grp);
}
IDTypeInfo IDType_ID_LP = {

View File

@ -682,7 +682,7 @@ static void linestyle_blend_read_lib(BlendLibReader *reader, ID *id)
case LS_MODIFIER_DISTANCE_FROM_OBJECT: {
LineStyleColorModifier_DistanceFromObject *cm =
(LineStyleColorModifier_DistanceFromObject *)m;
BLO_read_id_address(reader, linestyle->id.lib, &cm->target);
BLO_read_id_address(reader, id, &cm->target);
break;
}
}
@ -692,7 +692,7 @@ static void linestyle_blend_read_lib(BlendLibReader *reader, ID *id)
case LS_MODIFIER_DISTANCE_FROM_OBJECT: {
LineStyleAlphaModifier_DistanceFromObject *am =
(LineStyleAlphaModifier_DistanceFromObject *)m;
BLO_read_id_address(reader, linestyle->id.lib, &am->target);
BLO_read_id_address(reader, id, &am->target);
break;
}
}
@ -702,7 +702,7 @@ static void linestyle_blend_read_lib(BlendLibReader *reader, ID *id)
case LS_MODIFIER_DISTANCE_FROM_OBJECT: {
LineStyleThicknessModifier_DistanceFromObject *tm =
(LineStyleThicknessModifier_DistanceFromObject *)m;
BLO_read_id_address(reader, linestyle->id.lib, &tm->target);
BLO_read_id_address(reader, id, &tm->target);
break;
}
}
@ -710,8 +710,8 @@ static void linestyle_blend_read_lib(BlendLibReader *reader, ID *id)
for (int a = 0; a < MAX_MTEX; a++) {
MTex *mtex = linestyle->mtex[a];
if (mtex) {
BLO_read_id_address(reader, linestyle->id.lib, &mtex->tex);
BLO_read_id_address(reader, linestyle->id.lib, &mtex->object);
BLO_read_id_address(reader, id, &mtex->tex);
BLO_read_id_address(reader, id, &mtex->object);
}
}
}

View File

@ -183,7 +183,7 @@ static void mask_blend_read_data(BlendDataReader *reader, ID *id)
static void lib_link_mask_parent(BlendLibReader *reader, Mask *mask, MaskParent *parent)
{
BLO_read_id_address(reader, mask->id.lib, &parent->id);
BLO_read_id_address(reader, &mask->id, &parent->id);
}
static void mask_blend_read_lib(BlendLibReader *reader, ID *id)

View File

@ -223,16 +223,16 @@ static void material_blend_read_data(BlendDataReader *reader, ID *id)
static void material_blend_read_lib(BlendLibReader *reader, ID *id)
{
Material *ma = (Material *)id;
BLO_read_id_address(reader, ma->id.lib, &ma->ipo); /* XXX deprecated - old animation system */
BLO_read_id_address(reader, id, &ma->ipo); /* XXX deprecated - old animation system */
/* relink grease pencil settings */
if (ma->gp_style != nullptr) {
MaterialGPencilStyle *gp_style = ma->gp_style;
if (gp_style->sima != nullptr) {
BLO_read_id_address(reader, ma->id.lib, &gp_style->sima);
BLO_read_id_address(reader, id, &gp_style->sima);
}
if (gp_style->ima != nullptr) {
BLO_read_id_address(reader, ma->id.lib, &gp_style->ima);
BLO_read_id_address(reader, id, &gp_style->ima);
}
}
}

View File

@ -141,10 +141,10 @@ static void metaball_blend_read_lib(BlendLibReader *reader, ID *id)
{
MetaBall *mb = (MetaBall *)id;
for (int a = 0; a < mb->totcol; a++) {
BLO_read_id_address(reader, mb->id.lib, &mb->mat[a]);
BLO_read_id_address(reader, id, &mb->mat[a]);
}
BLO_read_id_address(reader, mb->id.lib, &mb->ipo); // XXX deprecated - old animation system
BLO_read_id_address(reader, id, &mb->ipo); // XXX deprecated - old animation system
}
static void metaball_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -420,16 +420,16 @@ static void mesh_blend_read_lib(BlendLibReader *reader, ID *id)
/* this check added for python created meshes */
if (me->mat) {
for (int i = 0; i < me->totcol; i++) {
BLO_read_id_address(reader, me->id.lib, &me->mat[i]);
BLO_read_id_address(reader, id, &me->mat[i]);
}
}
else {
me->totcol = 0;
}
BLO_read_id_address(reader, me->id.lib, &me->ipo); // XXX: deprecated: old anim sys
BLO_read_id_address(reader, me->id.lib, &me->key);
BLO_read_id_address(reader, me->id.lib, &me->texcomesh);
BLO_read_id_address(reader, id, &me->ipo); // XXX: deprecated: old anim sys
BLO_read_id_address(reader, id, &me->key);
BLO_read_id_address(reader, id, &me->texcomesh);
}
static void mesh_read_expand(BlendExpander *expander, ID *id)

View File

@ -350,7 +350,7 @@ static void movieclip_blend_read_data(BlendDataReader *reader, ID *id)
static void lib_link_movieTracks(BlendLibReader *reader, MovieClip *clip, ListBase *tracksbase)
{
LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
BLO_read_id_address(reader, clip->id.lib, &track->gpd);
BLO_read_id_address(reader, &clip->id, &track->gpd);
}
}
@ -359,7 +359,7 @@ static void lib_link_moviePlaneTracks(BlendLibReader *reader,
ListBase *tracksbase)
{
LISTBASE_FOREACH (MovieTrackingPlaneTrack *, plane_track, tracksbase) {
BLO_read_id_address(reader, clip->id.lib, &plane_track->image);
BLO_read_id_address(reader, &clip->id, &plane_track->image);
}
}
@ -368,7 +368,7 @@ static void movieclip_blend_read_lib(BlendLibReader *reader, ID *id)
MovieClip *clip = (MovieClip *)id;
MovieTracking *tracking = &clip->tracking;
BLO_read_id_address(reader, clip->id.lib, &clip->gpd);
BLO_read_id_address(reader, id, &clip->gpd);
LISTBASE_FOREACH (MovieTrackingObject *, object, &tracking->objects) {
lib_link_movieTracks(reader, clip, &object->tracks);

View File

@ -2387,7 +2387,7 @@ static void blend_lib_read_nla_strips(BlendLibReader *reader, ID *id, ListBase *
BKE_fcurve_blend_read_lib(reader, id, &strip->fcurves);
/* reassign the counted-reference to action */
BLO_read_id_address(reader, id->lib, &strip->act);
BLO_read_id_address(reader, id, &strip->act);
}
}

View File

@ -879,9 +879,9 @@ static void ntree_blend_read_data(BlendDataReader *reader, ID *id)
ntreeBlendReadData(reader, nullptr, ntree);
}
static void lib_link_node_socket(BlendLibReader *reader, Library *lib, bNodeSocket *sock)
static void lib_link_node_socket(BlendLibReader *reader, ID *self_id, bNodeSocket *sock)
{
IDP_BlendReadLib(reader, lib, sock->prop);
IDP_BlendReadLib(reader, self_id, sock->prop);
/* This can happen for all socket types when a file is saved in an older version of Blender than
* it was originally created in (#86298). Some socket types still require a default value. The
@ -893,26 +893,27 @@ static void lib_link_node_socket(BlendLibReader *reader, Library *lib, bNodeSock
switch (eNodeSocketDatatype(sock->type)) {
case SOCK_OBJECT: {
BLO_read_id_address(
reader, lib, &sock->default_value_typed<bNodeSocketValueObject>()->value);
reader, self_id, &sock->default_value_typed<bNodeSocketValueObject>()->value);
break;
}
case SOCK_IMAGE: {
BLO_read_id_address(reader, lib, &sock->default_value_typed<bNodeSocketValueImage>()->value);
BLO_read_id_address(
reader, self_id, &sock->default_value_typed<bNodeSocketValueImage>()->value);
break;
}
case SOCK_COLLECTION: {
BLO_read_id_address(
reader, lib, &sock->default_value_typed<bNodeSocketValueCollection>()->value);
reader, self_id, &sock->default_value_typed<bNodeSocketValueCollection>()->value);
break;
}
case SOCK_TEXTURE: {
BLO_read_id_address(
reader, lib, &sock->default_value_typed<bNodeSocketValueTexture>()->value);
reader, self_id, &sock->default_value_typed<bNodeSocketValueTexture>()->value);
break;
}
case SOCK_MATERIAL: {
BLO_read_id_address(
reader, lib, &sock->default_value_typed<bNodeSocketValueMaterial>()->value);
reader, self_id, &sock->default_value_typed<bNodeSocketValueMaterial>()->value);
break;
}
case SOCK_FLOAT:
@ -929,32 +930,30 @@ static void lib_link_node_socket(BlendLibReader *reader, Library *lib, bNodeSock
}
}
static void lib_link_node_sockets(BlendLibReader *reader, Library *lib, ListBase *sockets)
static void lib_link_node_sockets(BlendLibReader *reader, ID *self_id, ListBase *sockets)
{
LISTBASE_FOREACH (bNodeSocket *, sock, sockets) {
lib_link_node_socket(reader, lib, sock);
lib_link_node_socket(reader, self_id, sock);
}
}
void ntreeBlendReadLib(BlendLibReader *reader, bNodeTree *ntree)
{
Library *lib = ntree->id.lib;
BLO_read_id_address(reader, lib, &ntree->gpd);
BLO_read_id_address(reader, &ntree->id, &ntree->gpd);
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
/* Link ID Properties -- and copy this comment EXACTLY for easy finding
* of library blocks that implement this. */
IDP_BlendReadLib(reader, lib, node->prop);
IDP_BlendReadLib(reader, &ntree->id, node->prop);
BLO_read_id_address(reader, lib, &node->id);
BLO_read_id_address(reader, &ntree->id, &node->id);
lib_link_node_sockets(reader, lib, &node->inputs);
lib_link_node_sockets(reader, lib, &node->outputs);
lib_link_node_sockets(reader, &ntree->id, &node->inputs);
lib_link_node_sockets(reader, &ntree->id, &node->outputs);
}
lib_link_node_sockets(reader, lib, &ntree->inputs);
lib_link_node_sockets(reader, lib, &ntree->outputs);
lib_link_node_sockets(reader, &ntree->id, &ntree->inputs);
lib_link_node_sockets(reader, &ntree->id, &ntree->outputs);
/* Set `node->typeinfo` pointers. This is done in lib linking, after the
* first versioning that can change types still without functions that

View File

@ -845,11 +845,11 @@ static void object_blend_read_data(BlendDataReader *reader, ID *id)
static void lib_link_nlastrips(BlendLibReader *reader, ID *id, ListBase *striplist)
{
LISTBASE_FOREACH (bActionStrip *, strip, striplist) {
BLO_read_id_address(reader, id->lib, &strip->object);
BLO_read_id_address(reader, id->lib, &strip->act);
BLO_read_id_address(reader, id->lib, &strip->ipo);
BLO_read_id_address(reader, id, &strip->object);
BLO_read_id_address(reader, id, &strip->act);
BLO_read_id_address(reader, id, &strip->ipo);
LISTBASE_FOREACH (bActionModifier *, amod, &strip->modifiers) {
BLO_read_id_address(reader, id->lib, &amod->ob);
BLO_read_id_address(reader, id, &amod->ob);
}
}
}
@ -858,7 +858,7 @@ static void lib_link_nlastrips(BlendLibReader *reader, ID *id, ListBase *stripli
static void lib_link_constraint_channels(BlendLibReader *reader, ID *id, ListBase *chanbase)
{
LISTBASE_FOREACH (bConstraintChannel *, chan, chanbase) {
BLO_read_id_address(reader, id->lib, &chan->ipo);
BLO_read_id_address(reader, id, &chan->ipo);
}
}
@ -870,23 +870,24 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
BlendFileReadReport *reports = BLO_read_lib_reports(reader);
/* XXX deprecated - old animation system <<< */
BLO_read_id_address(reader, ob->id.lib, &ob->ipo);
BLO_read_id_address(reader, ob->id.lib, &ob->action);
BLO_read_id_address(reader, id, &ob->ipo);
BLO_read_id_address(reader, id, &ob->action);
/* >>> XXX deprecated - old animation system */
BLO_read_id_address(reader, ob->id.lib, &ob->parent);
BLO_read_id_address(reader, ob->id.lib, &ob->track);
BLO_read_id_address(reader, id, &ob->parent);
BLO_read_id_address(reader, id, &ob->track);
/* XXX deprecated - old pose library, deprecated in Blender 3.5. */
BLO_read_id_address(reader, ob->id.lib, &ob->poselib);
BLO_read_id_address(reader, id, &ob->poselib);
/* 2.8x drops support for non-empty dupli instances. */
if (ob->type == OB_EMPTY) {
BLO_read_id_address(reader, ob->id.lib, &ob->instance_collection);
BLO_read_id_address(reader, id, &ob->instance_collection);
}
else {
if (ob->instance_collection != nullptr) {
ID *new_id = BLO_read_get_new_id_address(reader, ob->id.lib, &ob->instance_collection->id);
ID *new_id = BLO_read_get_new_id_address(
reader, id, ID_IS_LINKED(id), &ob->instance_collection->id);
BLO_reportf_wrap(reports,
RPT_INFO,
TIP_("Non-Empty object '%s' cannot duplicate collection '%s' "
@ -898,7 +899,7 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
ob->transflag &= ~OB_DUPLICOLLECTION;
}
BLO_read_id_address(reader, ob->id.lib, &ob->proxy);
BLO_read_id_address(reader, id, &ob->proxy);
if (ob->proxy) {
/* paranoia check, actually a proxy_from pointer should never be written... */
if (!ID_IS_LINKED(ob->proxy)) {
@ -923,10 +924,10 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
ob->proxy->proxy_from = ob;
}
}
BLO_read_id_address(reader, ob->id.lib, &ob->proxy_group);
BLO_read_id_address(reader, id, &ob->proxy_group);
void *poin = ob->data;
BLO_read_id_address(reader, ob->id.lib, &ob->data);
BLO_read_id_address(reader, id, &ob->data);
if (ob->data == nullptr && poin != nullptr) {
ob->type = OB_EMPTY;
@ -959,7 +960,7 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
reports->count.missing_obdata++;
}
for (int a = 0; a < ob->totcol; a++) {
BLO_read_id_address(reader, ob->id.lib, &ob->mat[a]);
BLO_read_id_address(reader, id, &ob->mat[a]);
}
/* When the object is local and the data is library its possible
@ -968,7 +969,7 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
BKE_object_materials_test(bmain, ob, (ID *)ob->data);
}
BLO_read_id_address(reader, ob->id.lib, &ob->gpd);
BLO_read_id_address(reader, id, &ob->gpd);
/* if id.us==0 a new base will be created later on */
@ -983,7 +984,7 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
LISTBASE_FOREACH (PartEff *, paf, &ob->effect) {
if (paf->type == EFF_PARTICLE) {
BLO_read_id_address(reader, ob->id.lib, &paf->group);
BLO_read_id_address(reader, id, &paf->group);
}
}
@ -993,7 +994,7 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
if (fluidmd && fluidmd->fss) {
/* XXX: deprecated - old animation system. */
BLO_read_id_address(reader, ob->id.lib, &fluidmd->fss->ipo);
BLO_read_id_address(reader, id, &fluidmd->fss->ipo);
}
}
@ -1019,9 +1020,9 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
}
if (ob->soft) {
BLO_read_id_address(reader, ob->id.lib, &ob->soft->collision_group);
BLO_read_id_address(reader, id, &ob->soft->collision_group);
BLO_read_id_address(reader, ob->id.lib, &ob->soft->effector_weights->group);
BLO_read_id_address(reader, id, &ob->soft->effector_weights->group);
}
BKE_particle_system_blend_read_lib(reader, ob, &ob->id, &ob->particlesystem);
@ -1030,8 +1031,8 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
BKE_shaderfx_blend_read_lib(reader, ob);
if (ob->rigidbody_constraint) {
BLO_read_id_address(reader, ob->id.lib, &ob->rigidbody_constraint->ob1);
BLO_read_id_address(reader, ob->id.lib, &ob->rigidbody_constraint->ob2);
BLO_read_id_address(reader, id, &ob->rigidbody_constraint->ob1);
BLO_read_id_address(reader, id, &ob->rigidbody_constraint->ob2);
}
}
@ -5648,7 +5649,7 @@ void BKE_object_modifiers_lib_link_common(void *userData,
{
BlendLibReader *reader = (BlendLibReader *)userData;
BLO_read_id_address(reader, ob->id.lib, idpoin);
BLO_read_id_address(reader, &ob->id, idpoin);
if (*idpoin != nullptr && (cb_flag & IDWALK_CB_USER) != 0) {
id_us_plus_no_lib(*idpoin);
}

View File

@ -1246,13 +1246,13 @@ void BKE_paint_blend_read_data(BlendDataReader *reader, const Scene *scene, Pain
void BKE_paint_blend_read_lib(BlendLibReader *reader, Scene *sce, Paint *p)
{
if (p) {
BLO_read_id_address(reader, sce->id.lib, &p->brush);
BLO_read_id_address(reader, &sce->id, &p->brush);
for (int i = 0; i < p->tool_slots_len; i++) {
if (p->tool_slots[i].brush != nullptr) {
BLO_read_id_address(reader, sce->id.lib, &p->tool_slots[i].brush);
BLO_read_id_address(reader, &sce->id, &p->tool_slots[i].brush);
}
}
BLO_read_id_address(reader, sce->id.lib, &p->palette);
BLO_read_id_address(reader, &sce->id, &p->palette);
p->paint_cursor = nullptr;
BKE_paint_runtime_init(sce->toolsettings, p);

View File

@ -365,10 +365,10 @@ static void particle_settings_blend_read_data(BlendDataReader *reader, ID *id)
void BKE_particle_partdeflect_blend_read_lib(BlendLibReader *reader, ID *id, PartDeflect *pd)
{
if (pd && pd->tex) {
BLO_read_id_address(reader, id->lib, &pd->tex);
BLO_read_id_address(reader, id, &pd->tex);
}
if (pd && pd->f_source) {
BLO_read_id_address(reader, id->lib, &pd->f_source);
BLO_read_id_address(reader, id, &pd->f_source);
}
}
@ -377,19 +377,19 @@ static void particle_settings_blend_read_lib(BlendLibReader *reader, ID *id)
ParticleSettings *part = (ParticleSettings *)id;
/* XXX: deprecated - old animation system. */
BLO_read_id_address(reader, part->id.lib, &part->ipo);
BLO_read_id_address(reader, id, &part->ipo);
BLO_read_id_address(reader, part->id.lib, &part->instance_object);
BLO_read_id_address(reader, part->id.lib, &part->instance_collection);
BLO_read_id_address(reader, part->id.lib, &part->force_group);
BLO_read_id_address(reader, part->id.lib, &part->bb_ob);
BLO_read_id_address(reader, part->id.lib, &part->collision_group);
BLO_read_id_address(reader, id, &part->instance_object);
BLO_read_id_address(reader, id, &part->instance_collection);
BLO_read_id_address(reader, id, &part->force_group);
BLO_read_id_address(reader, id, &part->bb_ob);
BLO_read_id_address(reader, id, &part->collision_group);
BKE_particle_partdeflect_blend_read_lib(reader, &part->id, part->pd);
BKE_particle_partdeflect_blend_read_lib(reader, &part->id, part->pd2);
BKE_particle_partdeflect_blend_read_lib(reader, id, part->pd);
BKE_particle_partdeflect_blend_read_lib(reader, id, part->pd2);
if (part->effector_weights) {
BLO_read_id_address(reader, part->id.lib, &part->effector_weights->group);
BLO_read_id_address(reader, id, &part->effector_weights->group);
}
else {
part->effector_weights = BKE_effector_add_weights(part->force_group);
@ -397,7 +397,7 @@ static void particle_settings_blend_read_lib(BlendLibReader *reader, ID *id)
if (part->instance_weights.first && part->instance_collection) {
LISTBASE_FOREACH (ParticleDupliWeight *, dw, &part->instance_weights) {
BLO_read_id_address(reader, part->id.lib, &dw->ob);
BLO_read_id_address(reader, id, &dw->ob);
}
}
else {
@ -411,12 +411,12 @@ static void particle_settings_blend_read_lib(BlendLibReader *reader, ID *id)
case eBoidRuleType_Goal:
case eBoidRuleType_Avoid: {
BoidRuleGoalAvoid *brga = (BoidRuleGoalAvoid *)rule;
BLO_read_id_address(reader, part->id.lib, &brga->ob);
BLO_read_id_address(reader, id, &brga->ob);
break;
}
case eBoidRuleType_FollowLeader: {
BoidRuleFollowLeader *brfl = (BoidRuleFollowLeader *)rule;
BLO_read_id_address(reader, part->id.lib, &brfl->ob);
BLO_read_id_address(reader, id, &brfl->ob);
break;
}
}
@ -427,8 +427,8 @@ static void particle_settings_blend_read_lib(BlendLibReader *reader, ID *id)
for (int a = 0; a < MAX_MTEX; a++) {
MTex *mtex = part->mtex[a];
if (mtex) {
BLO_read_id_address(reader, part->id.lib, &mtex->tex);
BLO_read_id_address(reader, part->id.lib, &mtex->object);
BLO_read_id_address(reader, id, &mtex->tex);
BLO_read_id_address(reader, id, &mtex->object);
}
}
}
@ -5474,21 +5474,21 @@ void BKE_particle_system_blend_read_lib(BlendLibReader *reader,
{
LISTBASE_FOREACH_MUTABLE (ParticleSystem *, psys, particles) {
BLO_read_id_address(reader, id->lib, &psys->part);
BLO_read_id_address(reader, id, &psys->part);
if (psys->part) {
LISTBASE_FOREACH (ParticleTarget *, pt, &psys->targets) {
BLO_read_id_address(reader, id->lib, &pt->ob);
BLO_read_id_address(reader, id, &pt->ob);
}
BLO_read_id_address(reader, id->lib, &psys->parent);
BLO_read_id_address(reader, id->lib, &psys->target_ob);
BLO_read_id_address(reader, id, &psys->parent);
BLO_read_id_address(reader, id, &psys->target_ob);
if (psys->clmd) {
/* XXX(@ideasman42): from reading existing code this seems correct but intended usage
* of point-cache with cloth should be added in #ParticleSystem. */
psys->clmd->point_cache = psys->pointcache;
psys->clmd->ptcaches.first = psys->clmd->ptcaches.last = nullptr;
BLO_read_id_address(reader, id->lib, &psys->clmd->coll_parms->group);
BLO_read_id_address(reader, id, &psys->clmd->coll_parms->group);
psys->clmd->modifier.error = nullptr;
}
}

View File

@ -151,7 +151,7 @@ static void pointcloud_blend_read_lib(BlendLibReader *reader, ID *id)
{
PointCloud *pointcloud = (PointCloud *)id;
for (int a = 0; a < pointcloud->totcol; a++) {
BLO_read_id_address(reader, pointcloud->id.lib, &pointcloud->mat[a]);
BLO_read_id_address(reader, id, &pointcloud->mat[a]);
}
}

View File

@ -487,6 +487,7 @@ enum eSceneForeachUndoPreserveProcess {
};
static void scene_foreach_toolsettings_id_pointer_process(
Scene *scene,
ID **id_p,
const eSceneForeachUndoPreserveProcess action,
BlendLibReader *reader,
@ -498,9 +499,9 @@ static void scene_foreach_toolsettings_id_pointer_process(
ID *id_old = *id_old_p;
/* Old data has not been remapped to new values of the pointers, if we want to keep the old
* pointer here we need its new address. */
ID *id_old_new = id_old != nullptr ?
BLO_read_get_new_id_address(reader, id_old->lib, id_old) :
nullptr;
ID *id_old_new = id_old != nullptr ? BLO_read_get_new_id_address(
reader, &scene->id, ID_IS_LINKED(scene), id_old) :
nullptr;
if (id_old_new != nullptr) {
BLI_assert(ELEM(id_old, id_old_new, id_old_new->orig_id));
*id_old_p = id_old_new;
@ -526,11 +527,11 @@ static void scene_foreach_toolsettings_id_pointer_process(
* `scene_foreach_paint`) are also used by `scene_undo_preserve`, where `LibraryForeachIDData
* *data` is nullptr. */
#define BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER( \
__data, __id, __do_undo_restore, __action, __reader, __id_old, __cb_flag) \
__data, __scene, __id, __do_undo_restore, __action, __reader, __id_old, __cb_flag) \
{ \
if (__do_undo_restore) { \
scene_foreach_toolsettings_id_pointer_process( \
(ID **)&(__id), __action, __reader, (ID **)&(__id_old), __cb_flag); \
__scene, (ID **)&(__id), __action, __reader, (ID **)&(__id_old), __cb_flag); \
} \
else { \
BLI_assert((__data) != nullptr); \
@ -553,12 +554,14 @@ static void scene_foreach_toolsettings_id_pointer_process(
(void)0
static void scene_foreach_paint(LibraryForeachIDData *data,
Scene *scene,
Paint *paint,
const bool do_undo_restore,
BlendLibReader *reader,
Paint *paint_old)
{
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
paint->brush,
do_undo_restore,
SCENE_FOREACH_UNDO_RESTORE,
@ -577,6 +580,7 @@ static void scene_foreach_paint(LibraryForeachIDData *data,
Brush *brush_tmp = nullptr;
Brush **brush_p = i < paint->tool_slots_len ? &paint->tool_slots[i].brush : &brush_tmp;
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
*brush_p,
do_undo_restore,
SCENE_FOREACH_UNDO_RESTORE,
@ -585,6 +589,7 @@ static void scene_foreach_paint(LibraryForeachIDData *data,
IDWALK_CB_USER);
}
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
paint->palette,
do_undo_restore,
SCENE_FOREACH_UNDO_RESTORE,
@ -594,12 +599,14 @@ static void scene_foreach_paint(LibraryForeachIDData *data,
}
static void scene_foreach_toolsettings(LibraryForeachIDData *data,
Scene *scene,
ToolSettings *toolsett,
const bool do_undo_restore,
BlendLibReader *reader,
ToolSettings *toolsett_old)
{
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
toolsett->particle.scene,
do_undo_restore,
SCENE_FOREACH_UNDO_NO_RESTORE,
@ -607,6 +614,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
toolsett_old->particle.scene,
IDWALK_CB_NOP);
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
toolsett->particle.object,
do_undo_restore,
SCENE_FOREACH_UNDO_NO_RESTORE,
@ -614,6 +622,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
toolsett_old->particle.object,
IDWALK_CB_NOP);
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
toolsett->particle.shape_object,
do_undo_restore,
SCENE_FOREACH_UNDO_NO_RESTORE,
@ -621,9 +630,14 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
toolsett_old->particle.shape_object,
IDWALK_CB_NOP);
scene_foreach_paint(
data, &toolsett->imapaint.paint, do_undo_restore, reader, &toolsett_old->imapaint.paint);
scene_foreach_paint(data,
scene,
&toolsett->imapaint.paint,
do_undo_restore,
reader,
&toolsett_old->imapaint.paint);
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
toolsett->imapaint.stencil,
do_undo_restore,
SCENE_FOREACH_UNDO_RESTORE,
@ -631,6 +645,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
toolsett_old->imapaint.stencil,
IDWALK_CB_USER);
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
toolsett->imapaint.clone,
do_undo_restore,
SCENE_FOREACH_UNDO_RESTORE,
@ -638,6 +653,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
toolsett_old->imapaint.clone,
IDWALK_CB_USER);
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
toolsett->imapaint.canvas,
do_undo_restore,
SCENE_FOREACH_UNDO_RESTORE,
@ -650,6 +666,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
data,
do_undo_restore,
scene_foreach_paint(data,
scene,
&toolsett->vpaint->paint,
do_undo_restore,
reader,
@ -660,6 +677,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
data,
do_undo_restore,
scene_foreach_paint(data,
scene,
&toolsett->wpaint->paint,
do_undo_restore,
reader,
@ -670,11 +688,13 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
data,
do_undo_restore,
scene_foreach_paint(data,
scene,
&toolsett->sculpt->paint,
do_undo_restore,
reader,
&toolsett_old->sculpt->paint));
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
toolsett->sculpt->gravity_object,
do_undo_restore,
SCENE_FOREACH_UNDO_NO_RESTORE,
@ -687,6 +707,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
data,
do_undo_restore,
scene_foreach_paint(data,
scene,
&toolsett->uvsculpt->paint,
do_undo_restore,
reader,
@ -697,6 +718,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
data,
do_undo_restore,
scene_foreach_paint(data,
scene,
&toolsett->gp_paint->paint,
do_undo_restore,
reader,
@ -707,6 +729,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
data,
do_undo_restore,
scene_foreach_paint(data,
scene,
&toolsett->gp_vertexpaint->paint,
do_undo_restore,
reader,
@ -717,6 +740,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
data,
do_undo_restore,
scene_foreach_paint(data,
scene,
&toolsett->gp_sculptpaint->paint,
do_undo_restore,
reader,
@ -727,6 +751,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
data,
do_undo_restore,
scene_foreach_paint(data,
scene,
&toolsett->gp_weightpaint->paint,
do_undo_restore,
reader,
@ -737,6 +762,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
data,
do_undo_restore,
scene_foreach_paint(data,
scene,
&toolsett->curves_sculpt->paint,
do_undo_restore,
reader,
@ -744,6 +770,7 @@ static void scene_foreach_toolsettings(LibraryForeachIDData *data,
}
BKE_LIB_FOREACHID_UNDO_PRESERVE_PROCESS_IDSUPER(data,
scene,
toolsett->gp_sculpt.guide.reference_object,
do_undo_restore,
SCENE_FOREACH_UNDO_NO_RESTORE,
@ -876,7 +903,7 @@ static void scene_foreach_id(ID *id, LibraryForeachIDData *data)
ToolSettings *toolsett = scene->toolsettings;
if (toolsett) {
BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(
data, scene_foreach_toolsettings(data, toolsett, false, nullptr, toolsett));
data, scene_foreach_toolsettings(data, scene, toolsett, false, nullptr, toolsett));
}
if (scene->rigidbody_world) {
@ -1487,10 +1514,10 @@ static void scene_blend_read_lib(BlendLibReader *reader, ID *id)
BKE_keyingsets_blend_read_lib(reader, &sce->id, &sce->keyingsets);
BLO_read_id_address(reader, sce->id.lib, &sce->camera);
BLO_read_id_address(reader, sce->id.lib, &sce->world);
BLO_read_id_address(reader, sce->id.lib, &sce->set);
BLO_read_id_address(reader, sce->id.lib, &sce->gpd);
BLO_read_id_address(reader, id, &sce->camera);
BLO_read_id_address(reader, id, &sce->world);
BLO_read_id_address(reader, id, &sce->set);
BLO_read_id_address(reader, id, &sce->gpd);
BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->imapaint.paint);
if (sce->toolsettings->sculpt) {
@ -1522,27 +1549,27 @@ static void scene_blend_read_lib(BlendLibReader *reader, ID *id)
}
if (sce->toolsettings->sculpt) {
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->sculpt->gravity_object);
BLO_read_id_address(reader, id, &sce->toolsettings->sculpt->gravity_object);
}
if (sce->toolsettings->imapaint.stencil) {
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.stencil);
BLO_read_id_address(reader, id, &sce->toolsettings->imapaint.stencil);
}
if (sce->toolsettings->imapaint.clone) {
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.clone);
BLO_read_id_address(reader, id, &sce->toolsettings->imapaint.clone);
}
if (sce->toolsettings->imapaint.canvas) {
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.canvas);
BLO_read_id_address(reader, id, &sce->toolsettings->imapaint.canvas);
}
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->particle.shape_object);
BLO_read_id_address(reader, id, &sce->toolsettings->particle.shape_object);
BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->gp_sculpt.guide.reference_object);
BLO_read_id_address(reader, id, &sce->toolsettings->gp_sculpt.guide.reference_object);
LISTBASE_FOREACH_MUTABLE (Base *, base_legacy, &sce->base) {
BLO_read_id_address(reader, sce->id.lib, &base_legacy->object);
BLO_read_id_address(reader, id, &base_legacy->object);
if (base_legacy->object == nullptr) {
BLO_reportf_wrap(BLO_read_lib_reports(reader),
@ -1562,10 +1589,10 @@ static void scene_blend_read_lib(BlendLibReader *reader, ID *id)
}
LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
IDP_BlendReadLib(reader, sce->id.lib, marker->prop);
IDP_BlendReadLib(reader, id, marker->prop);
if (marker->camera) {
BLO_read_id_address(reader, sce->id.lib, &marker->camera);
BLO_read_id_address(reader, id, &marker->camera);
}
}
@ -1573,13 +1600,13 @@ static void scene_blend_read_lib(BlendLibReader *reader, ID *id)
if (sce->rigidbody_world) {
RigidBodyWorld *rbw = sce->rigidbody_world;
if (rbw->group) {
BLO_read_id_address(reader, sce->id.lib, &rbw->group);
BLO_read_id_address(reader, id, &rbw->group);
}
if (rbw->constraints) {
BLO_read_id_address(reader, sce->id.lib, &rbw->constraints);
BLO_read_id_address(reader, id, &rbw->constraints);
}
if (rbw->effector_weights) {
BLO_read_id_address(reader, sce->id.lib, &rbw->effector_weights->group);
BLO_read_id_address(reader, id, &rbw->effector_weights->group);
}
}
@ -1588,30 +1615,30 @@ static void scene_blend_read_lib(BlendLibReader *reader, ID *id)
}
LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) {
BLO_read_id_address(reader, sce->id.lib, &srl->mat_override);
BLO_read_id_address(reader, id, &srl->mat_override);
LISTBASE_FOREACH (FreestyleModuleConfig *, fmc, &srl->freestyleConfig.modules) {
BLO_read_id_address(reader, sce->id.lib, &fmc->script);
BLO_read_id_address(reader, id, &fmc->script);
}
LISTBASE_FOREACH (FreestyleLineSet *, fls, &srl->freestyleConfig.linesets) {
BLO_read_id_address(reader, sce->id.lib, &fls->linestyle);
BLO_read_id_address(reader, sce->id.lib, &fls->group);
BLO_read_id_address(reader, id, &fls->linestyle);
BLO_read_id_address(reader, id, &fls->group);
}
}
/* Motion Tracking */
BLO_read_id_address(reader, sce->id.lib, &sce->clip);
BLO_read_id_address(reader, id, &sce->clip);
#ifdef USE_COLLECTION_COMPAT_28
if (sce->collection) {
BKE_collection_compat_blend_read_lib(reader, sce->id.lib, sce->collection);
BKE_collection_compat_blend_read_lib(reader, id, sce->collection);
}
#endif
LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) {
BKE_view_layer_blend_read_lib(reader, sce->id.lib, view_layer);
BKE_view_layer_blend_read_lib(reader, id, view_layer);
}
if (sce->r.bake.cage_object) {
BLO_read_id_address(reader, sce->id.lib, &sce->r.bake.cage_object);
BLO_read_id_address(reader, id, &sce->r.bake.cage_object);
}
#ifdef USE_SETSCENE_CHECK
@ -1714,7 +1741,7 @@ static void scene_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old)
* palettes), and counteract the swap of the whole ToolSettings structs below for the others
* (like object ones). */
scene_foreach_toolsettings(
nullptr, scene_new->toolsettings, true, reader, scene_old->toolsettings);
nullptr, scene_new, scene_new->toolsettings, true, reader, scene_old->toolsettings);
std::swap(*scene_old->toolsettings, *scene_new->toolsettings);
}
}

View File

@ -368,7 +368,7 @@ static void screen_blend_read_lib(BlendLibReader *reader, ID *id)
{
bScreen *screen = (bScreen *)id;
/* deprecated, but needed for versioning (will be NULL'ed then) */
BLO_read_id_address(reader, screen->id.lib, &screen->scene);
BLO_read_id_address(reader, id, &screen->scene);
screen->animtimer = NULL; /* saved in rare cases */
screen->tool_tip = NULL;
@ -1484,7 +1484,7 @@ bool BKE_screen_area_map_blend_read_data(BlendDataReader *reader, ScrAreaMap *ar
void BKE_screen_area_blend_read_lib(BlendLibReader *reader, ID *parent_id, ScrArea *area)
{
BLO_read_id_address(reader, parent_id->lib, &area->full);
BLO_read_id_address(reader, parent_id, &area->full);
memset(&area->runtime, 0x0, sizeof(area->runtime));

View File

@ -183,7 +183,7 @@ static void sound_blend_read_lib(BlendLibReader *reader, ID *id)
{
bSound *sound = (bSound *)id;
/* XXX: deprecated - old animation system. */
BLO_read_id_address(reader, sound->id.lib, &sound->ipo);
BLO_read_id_address(reader, id, &sound->ipo);
}
static void sound_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -67,7 +67,7 @@ static void speaker_blend_read_data(BlendDataReader *reader, ID *id)
static void speaker_blend_read_lib(BlendLibReader *reader, ID *id)
{
Speaker *spk = (Speaker *)id;
BLO_read_id_address(reader, spk->id.lib, &spk->sound);
BLO_read_id_address(reader, id, &spk->sound);
}
static void speaker_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -194,8 +194,8 @@ static void texture_blend_read_data(BlendDataReader *reader, ID *id)
static void texture_blend_read_lib(BlendLibReader *reader, ID *id)
{
Tex *tex = (Tex *)id;
BLO_read_id_address(reader, tex->id.lib, &tex->ima);
BLO_read_id_address(reader, tex->id.lib, &tex->ipo); /* XXX deprecated - old animation system */
BLO_read_id_address(reader, id, &tex->ima);
BLO_read_id_address(reader, id, &tex->ipo); /* XXX deprecated - old animation system */
}
static void texture_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -103,13 +103,13 @@ void BKE_viewer_path_blend_read_data(struct BlendDataReader *reader, ViewerPath
}
}
void BKE_viewer_path_blend_read_lib(BlendLibReader *reader, Library *lib, ViewerPath *viewer_path)
void BKE_viewer_path_blend_read_lib(BlendLibReader *reader, ID *self_id, ViewerPath *viewer_path)
{
LISTBASE_FOREACH (ViewerPathElem *, elem, &viewer_path->path) {
switch (ViewerPathElemType(elem->type)) {
case VIEWER_PATH_ELEM_TYPE_ID: {
auto *typed_elem = reinterpret_cast<IDViewerPathElem *>(elem);
BLO_read_id_address(reader, lib, &typed_elem->id);
BLO_read_id_address(reader, self_id, &typed_elem->id);
break;
}
case VIEWER_PATH_ELEM_TYPE_MODIFIER:

View File

@ -631,7 +631,7 @@ static void volume_blend_read_lib(BlendLibReader *reader, ID *id)
BKE_volume_init_grids(volume);
for (int a = 0; a < volume->totcol; a++) {
BLO_read_id_address(reader, volume->id.lib, &volume->mat[a]);
BLO_read_id_address(reader, id, &volume->mat[a]);
}
}

View File

@ -136,7 +136,7 @@ static void workspace_blend_read_lib(BlendLibReader *reader, ID *id)
workspace->pin_scene = nullptr;
}
else {
BLO_read_id_address(reader, nullptr, &workspace->pin_scene);
BLO_read_id_address(reader, id, &workspace->pin_scene);
}
/* Restore proper 'parent' pointers to relevant data, and clean up unused/invalid entries. */
@ -155,7 +155,7 @@ static void workspace_blend_read_lib(BlendLibReader *reader, ID *id)
}
LISTBASE_FOREACH_MUTABLE (WorkSpaceLayout *, layout, &workspace->layouts) {
BLO_read_id_address(reader, id->lib, &layout->screen);
BLO_read_id_address(reader, id, &layout->screen);
if (layout->screen) {
if (ID_IS_LINKED(id)) {
@ -173,7 +173,7 @@ static void workspace_blend_read_lib(BlendLibReader *reader, ID *id)
}
}
BKE_viewer_path_blend_read_lib(reader, id->lib, &workspace->viewer_path);
BKE_viewer_path_blend_read_lib(reader, id, &workspace->viewer_path);
}
static void workspace_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -178,7 +178,7 @@ static void world_blend_read_data(BlendDataReader *reader, ID *id)
static void world_blend_read_lib(BlendLibReader *reader, ID *id)
{
World *wrld = (World *)id;
BLO_read_id_address(reader, wrld->id.lib, &wrld->ipo); /* XXX deprecated, old animation system */
BLO_read_id_address(reader, id, &wrld->ipo); /* XXX deprecated, old animation system */
}
static void world_blend_read_expand(BlendExpander *expander, ID *id)

View File

@ -271,10 +271,20 @@ struct BlendFileReadReport *BLO_read_data_reports(BlendDataReader *reader);
* However, now only pointers to ID data blocks are updated.
* \{ */
ID *BLO_read_get_new_id_address(BlendLibReader *reader, struct Library *lib, struct ID *id);
/** Search for the new address of given `id`, during liblinking part of blendfile reading process.
*
* \param self_id the ID owner of the given `id` pointer. Note that it may be an embedded ID.
* \param do_linked_only If `true`, only return found pointer if it is a linked ID. Used to
* preventlinked data to point to local IDs.
* \return the new address of the given ID pointer, or null if not found. */
ID *BLO_read_get_new_id_address(BlendLibReader *reader,
struct ID *self_id,
const bool do_linked_only,
struct ID *id) ATTR_NONNULL(2);
#define BLO_read_id_address(reader, lib, id_ptr_p) \
*((void **)id_ptr_p) = (void *)BLO_read_get_new_id_address((reader), (lib), (ID *)*(id_ptr_p))
#define BLO_read_id_address(reader, self_id, id_ptr_p) \
*((void **)id_ptr_p) = (void *)BLO_read_get_new_id_address( \
(reader), (self_id), (self_id) && ID_IS_LINKED(self_id), (ID *)*(id_ptr_p))
/* Misc. */

View File

@ -285,7 +285,7 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, const void *addr, bool inc
}
/* for libdata, NewAddress.nr has ID code, no increment */
static void *oldnewmap_liblookup(OldNewMap *onm, const void *addr, const void *lib)
static void *oldnewmap_liblookup(OldNewMap *onm, const void *addr, const bool is_linked_only)
{
if (addr == nullptr) {
return nullptr;
@ -295,7 +295,7 @@ static void *oldnewmap_liblookup(OldNewMap *onm, const void *addr, const void *l
if (id == nullptr) {
return nullptr;
}
if (!lib || id->lib) {
if (!is_linked_only || ID_IS_LINKED(id)) {
return id;
}
return nullptr;
@ -1386,14 +1386,20 @@ static void *newpackedadr(FileData *fd, const void *adr)
}
/* only lib data */
static void *newlibadr(FileData *fd, const void *lib, const void *adr)
static void *newlibadr(FileData *fd,
ID * /* self_id */,
const bool is_linked_only,
const void *adr)
{
return oldnewmap_liblookup(fd->libmap, adr, lib);
return oldnewmap_liblookup(fd->libmap, adr, is_linked_only);
}
void *blo_do_versions_newlibadr(FileData *fd, const void *lib, const void *adr)
void *blo_do_versions_newlibadr(FileData *fd,
ID *self_id,
const bool is_linked_only,
const void *adr)
{
return newlibadr(fd, lib, adr);
return newlibadr(fd, self_id, is_linked_only, adr);
}
/* increases user number */
@ -1860,7 +1866,7 @@ static void lib_link_id(BlendLibReader *reader, ID *id)
{
/* NOTE: WM IDProperties are never written to file, hence they should always be nullptr here. */
BLI_assert((GS(id->name) != ID_WM) || id->properties == nullptr);
IDP_BlendReadLib(reader, id->lib, id->properties);
IDP_BlendReadLib(reader, id, id->properties);
AnimData *adt = BKE_animdata_from_id(id);
if (adt != nullptr) {
@ -1868,9 +1874,9 @@ static void lib_link_id(BlendLibReader *reader, ID *id)
}
if (id->override_library) {
BLO_read_id_address(reader, id->lib, &id->override_library->reference);
BLO_read_id_address(reader, id->lib, &id->override_library->storage);
BLO_read_id_address(reader, id->lib, &id->override_library->hierarchy_root);
BLO_read_id_address(reader, id, &id->override_library->reference);
BLO_read_id_address(reader, id, &id->override_library->storage);
BLO_read_id_address(reader, id, &id->override_library->hierarchy_root);
}
lib_link_id_embedded_id(reader, id);
@ -3444,8 +3450,8 @@ static void link_global(FileData *fd, BlendFileData *bfd)
{
bfd->cur_view_layer = static_cast<ViewLayer *>(
blo_read_get_new_globaldata_address(fd, bfd->cur_view_layer));
bfd->curscreen = static_cast<bScreen *>(newlibadr(fd, nullptr, bfd->curscreen));
bfd->curscene = static_cast<Scene *>(newlibadr(fd, nullptr, bfd->curscene));
bfd->curscreen = static_cast<bScreen *>(newlibadr(fd, nullptr, false, bfd->curscreen));
bfd->curscene = static_cast<Scene *>(newlibadr(fd, nullptr, false, bfd->curscene));
/* this happens in files older than 2.35 */
if (bfd->curscene == nullptr) {
if (bfd->curscreen) {
@ -4996,9 +5002,12 @@ void *BLO_read_get_new_packed_address(BlendDataReader *reader, const void *old_a
return newpackedadr(reader->fd, old_address);
}
ID *BLO_read_get_new_id_address(BlendLibReader *reader, Library *lib, ID *id)
ID *BLO_read_get_new_id_address(BlendLibReader *reader,
ID *self_id,
const bool is_linked_only,
ID *id)
{
return static_cast<ID *>(newlibadr(reader->fd, lib, id));
return static_cast<ID *>(newlibadr(reader->fd, self_id, is_linked_only, id));
}
int BLO_read_fileversion_get(BlendDataReader *reader)

View File

@ -201,8 +201,10 @@ void blo_do_versions_oldnewmap_insert(struct OldNewMap *onm,
/**
* Only library data.
*/
void *blo_do_versions_newlibadr(struct FileData *fd, const void *lib, const void *adr);
void *blo_do_versions_newlibadr_us(struct FileData *fd, const void *lib, const void *adr);
void *blo_do_versions_newlibadr(struct FileData *fd,
ID *self_id,
const bool is_linked_only,
const void *adr);
/**
* \note this version patch is intended for versions < 2.52.2,

View File

@ -668,7 +668,7 @@ static bool seq_set_pitch_cb(Sequence *seq, void *UNUSED(user_data))
}
/* NOLINTNEXTLINE: readability-function-size */
void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
void blo_do_versions_250(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@ -727,10 +727,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* move to cameras */
if (sce->r.mode & R_PANORAMA) {
for (base = sce->base.first; base; base = base->next) {
ob = blo_do_versions_newlibadr(fd, lib, base->object);
ob = blo_do_versions_newlibadr(fd, &sce->id, ID_IS_LINKED(sce), base->object);
if (ob->type == OB_CAMERA && !ob->id.lib) {
cam = blo_do_versions_newlibadr(fd, lib, ob->data);
cam = blo_do_versions_newlibadr(fd, &ob->id, ID_IS_LINKED(ob), ob->data);
cam->flag |= CAM_PANORAMA;
}
}
@ -996,7 +996,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
* to the evaluated #Mesh, so here we ensure that the basis
* shape key is always set in the mesh coordinates. */
for (me = bmain->meshes.first; me; me = me->id.next) {
if ((key = blo_do_versions_newlibadr(fd, lib, me->key)) && key->refkey) {
if ((key = blo_do_versions_newlibadr(fd, &me->id, ID_IS_LINKED(me), me->key)) &&
key->refkey) {
data = key->refkey->data;
tot = MIN2(me->totvert, key->refkey->totelem);
MVert *verts = (MVert *)CustomData_get_layer_for_write(&me->vdata, CD_MVERT, me->totvert);
@ -1007,7 +1008,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
for (lt = bmain->lattices.first; lt; lt = lt->id.next) {
if ((key = blo_do_versions_newlibadr(fd, lib, lt->key)) && key->refkey) {
if ((key = blo_do_versions_newlibadr(fd, &lt->id, ID_IS_LINKED(lt), lt->key)) &&
key->refkey) {
data = key->refkey->data;
tot = MIN2(lt->pntsu * lt->pntsv * lt->pntsw, key->refkey->totelem);
@ -1018,7 +1020,8 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
for (cu = bmain->curves.first; cu; cu = cu->id.next) {
if ((key = blo_do_versions_newlibadr(fd, lib, cu->key)) && key->refkey) {
if ((key = blo_do_versions_newlibadr(fd, &cu->id, ID_IS_LINKED(cu), cu->key)) &&
key->refkey) {
data = key->refkey->data;
for (nu = cu->nurb.first; nu; nu = nu->next) {
@ -1294,7 +1297,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
* performing initialization where appropriate
*/
if (ob->pose && ob->data) {
bArmature *arm = blo_do_versions_newlibadr(fd, lib, ob->data);
bArmature *arm = blo_do_versions_newlibadr(fd, &ob->id, ID_IS_LINKED(ob), ob->data);
if (arm) { /* XXX: why does this fail in some cases? */
bAnimVizSettings *avs = &ob->pose->avs;
@ -1628,12 +1631,14 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
/* parent type to modifier */
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->parent) {
Object *parent = (Object *)blo_do_versions_newlibadr(fd, lib, ob->parent);
Object *parent = (Object *)blo_do_versions_newlibadr(
fd, &ob->id, ID_IS_LINKED(ob), ob->parent);
if (parent) { /* parent may not be in group */
enum { PARCURVE = 1 };
if (parent->type == OB_ARMATURE && ob->partype == PARSKEL) {
ArmatureModifierData *amd;
bArmature *arm = (bArmature *)blo_do_versions_newlibadr(fd, lib, parent->data);
bArmature *arm = (bArmature *)blo_do_versions_newlibadr(
fd, &parent->id, ID_IS_LINKED(parent), parent->data);
amd = (ArmatureModifierData *)BKE_modifier_new(eModifierType_Armature);
amd->object = ob->parent;

View File

@ -1813,7 +1813,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (tex = bmain->textures.first; tex; tex = tex->id.next) {
if (tex->type == TEX_IMAGE && (tex->imaflag & TEX_USEALPHA) == 0) {
Image *image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima);
Image *image = blo_do_versions_newlibadr(fd, &tex->id, ID_IS_LINKED(tex), tex->ima);
if (image && (image->flag & IMA_DO_PREMUL) == 0) {
enum { IMA_IGNORE_ALPHA = (1 << 12) };
@ -1827,7 +1827,8 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
bNode *node;
for (node = ntree->nodes.first; node; node = node->next) {
if (node->type == CMP_NODE_IMAGE) {
Image *image = blo_do_versions_newlibadr(fd, ntree->id.lib, node->id);
Image *image = blo_do_versions_newlibadr(
fd, &ntree->id, ID_IS_LINKED(ntree), node->id);
if (image) {
if ((image->flag & IMA_DO_PREMUL) == 0 && image->alpha_mode == IMA_ALPHA_STRAIGHT) {

View File

@ -199,7 +199,7 @@ static void ntree_version_242(bNodeTree *ntree)
}
}
static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
static void ntree_version_245(FileData *fd, Library *UNUSED(lib), bNodeTree *ntree)
{
bNode *node;
NodeTwoFloats *ntf;
@ -220,7 +220,7 @@ static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
}
/* fix for temporary flag changes during 245 cycle */
nodeid = blo_do_versions_newlibadr(fd, lib, node->id);
nodeid = blo_do_versions_newlibadr(fd, &ntree->id, ID_IS_LINKED(ntree), node->id);
if (node->storage && nodeid && GS(nodeid->name) == ID_IM) {
image = (Image *)nodeid;
iuser = node->storage;
@ -1286,7 +1286,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
}
for (ob = bmain->objects.first; ob; ob = ob->id.next) {
if (ob->parent) {
Object *parent = blo_do_versions_newlibadr(fd, lib, ob->parent);
Object *parent = blo_do_versions_newlibadr(fd, &ob->id, ID_IS_LINKED(ob), ob->parent);
if (parent && parent->type == OB_LATTICE) {
ob->partype = PARSKEL;
}
@ -1302,14 +1302,14 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
ob->id.recalc |= ID_RECALC_ALL;
/* New generic X-ray option. */
arm = blo_do_versions_newlibadr(fd, lib, ob->data);
arm = blo_do_versions_newlibadr(fd, &ob->id, ID_IS_LINKED(ob), ob->data);
enum { ARM_DRAWXRAY = (1 << 1) };
if (arm->flag & ARM_DRAWXRAY) {
ob->dtx |= OB_DRAW_IN_FRONT;
}
}
else if (ob->type == OB_MESH) {
Mesh *me = blo_do_versions_newlibadr(fd, lib, ob->data);
Mesh *me = blo_do_versions_newlibadr(fd, &ob->id, ID_IS_LINKED(ob), ob->data);
enum {
ME_SUBSURF = (1 << 7),
@ -1346,10 +1346,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (con = ob->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) {
bFollowPathConstraint *data = con->data;
Object *obc = blo_do_versions_newlibadr(fd, lib, data->tar);
Object *obc = blo_do_versions_newlibadr(fd, &ob->id, ID_IS_LINKED(ob), data->tar);
if (obc && obc->type == OB_CURVES_LEGACY) {
Curve *cu = blo_do_versions_newlibadr(fd, lib, obc->data);
Curve *cu = blo_do_versions_newlibadr(fd, &obc->id, ID_IS_LINKED(obc), obc->data);
if (cu) {
cu->flag |= CU_PATH;
}
@ -1503,8 +1503,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (md->type == eModifierType_Armature) {
ArmatureModifierData *amd = (ArmatureModifierData *)md;
if (amd->object && amd->deformflag == 0) {
Object *oba = blo_do_versions_newlibadr(fd, lib, amd->object);
arm = blo_do_versions_newlibadr(fd, lib, oba->data);
Object *oba = blo_do_versions_newlibadr(fd, &ob->id, ID_IS_LINKED(ob), amd->object);
arm = blo_do_versions_newlibadr(fd, &oba->id, ID_IS_LINKED(oba), oba->data);
amd->deformflag = arm->deformflag;
}
}
@ -1807,7 +1807,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
};
if (tex->type == TEX_IMAGE && tex->ima) {
ima = blo_do_versions_newlibadr(fd, lib, tex->ima);
ima = blo_do_versions_newlibadr(fd, &tex->id, ID_IS_LINKED(tex), tex->ima);
if (tex->imaflag & TEX_ANIM5) {
ima->source = IMA_SRC_MOVIE;
}
@ -2090,7 +2090,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
tex->iuser.flag &= ~IMA_OLD_PREMUL;
}
ima = blo_do_versions_newlibadr(fd, lib, tex->ima);
ima = blo_do_versions_newlibadr(fd, &tex->id, ID_IS_LINKED(tex), tex->ima);
if (ima && (tex->iuser.flag & IMA_DO_PREMUL)) {
ima->flag &= ~IMA_OLD_PREMUL;
ima->alpha_mode = IMA_ALPHA_STRAIGHT;
@ -2291,7 +2291,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Object *dup = bmain->objects.first;
for (; dup; dup = dup->id.next) {
if (ob == blo_do_versions_newlibadr(fd, lib, dup->parent)) {
if (ob == blo_do_versions_newlibadr(fd, &dup->id, ID_IS_LINKED(dup), dup->parent)) {
part->instance_object = dup;
ob->transflag |= OB_DUPLIPARTS;
ob->transflag &= ~OB_DUPLIVERTS;
@ -2433,7 +2433,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
MEM_freeN(fluidmd->fss);
fluidmd->fss = MEM_dupallocN(ob->fluidsimSettings);
fluidmd->fss->ipo = blo_do_versions_newlibadr(fd, ob->id.lib, ob->fluidsimSettings->ipo);
fluidmd->fss->ipo = blo_do_versions_newlibadr(
fd, &ob->id, ID_IS_LINKED(ob), ob->fluidsimSettings->ipo);
MEM_freeN(ob->fluidsimSettings);
fluidmd->fss->lastgoodframe = INT_MAX;

View File

@ -1276,6 +1276,9 @@ static void bm_to_mesh_verts(const BMesh &bm,
bmesh_block_copy_to_mesh_attributes(info, vert_i, src_vert.head.data);
any_loose_vert_local = any_loose_vert_local || src_vert.e == nullptr;
}
if (any_loose_vert_local) {
any_loose_vert.store(true, std::memory_order_relaxed);
}
if (!select_vert.is_empty()) {
for (const int vert_i : range) {
select_vert[vert_i] = BM_elem_flag_test(bm_verts[vert_i], BM_ELEM_SELECT);

View File

@ -399,6 +399,7 @@ set(GLSL_SRC
engines/eevee/shaders/bsdf_sampling_lib.glsl
engines/eevee/shaders/random_lib.glsl
engines/eevee/shaders/raytrace_lib.glsl
engines/eevee/shaders/renderpass_accumulate_frag.glsl
engines/eevee/shaders/renderpass_lib.glsl
engines/eevee/shaders/renderpass_postprocess_frag.glsl
engines/eevee/shaders/cryptomatte_frag.glsl

View File

@ -329,6 +329,7 @@ static void eevee_draw_scene(void *vedata)
EEVEE_renderpasses_output_accumulate(sldata, vedata, false);
/* Transparent */
EEVEE_material_transparent_output_accumulate(vedata);
/* TODO(@fclem): should be its own Frame-buffer.
* This is needed because dual-source blending only works with 1 color buffer. */
GPU_framebuffer_texture_attach(fbl->main_color_fb, dtxl->depth, 0, 0);

View File

@ -1186,4 +1186,77 @@ void EEVEE_material_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *v
}
}
void EEVEE_material_transparent_output_init(EEVEE_Data *vedata)
{
EEVEE_PassList *psl = vedata->psl;
EEVEE_FramebufferList *fbl = vedata->fbl;
EEVEE_PrivateData *pd = vedata->stl->g_data;
EEVEE_TextureList *txl = vedata->txl;
if (pd->render_passes & EEVEE_RENDER_PASS_TRANSPARENT) {
/* Intermediate result to blend objects on. */
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
DRW_texture_ensure_fullscreen_2d_ex(
&txl->transparent_depth_tmp, GPU_DEPTH24_STENCIL8, usage, 0);
DRW_texture_ensure_fullscreen_2d_ex(&txl->transparent_color_tmp, GPU_RGBA16F, usage, 0);
GPU_framebuffer_ensure_config(&fbl->transparent_rpass_fb,
{GPU_ATTACHMENT_TEXTURE(txl->transparent_depth_tmp),
GPU_ATTACHMENT_TEXTURE(txl->transparent_color_tmp)});
/* Final result to with AntiAliasing. */
/* TODO mem usage. */
const eGPUTextureFormat texture_format = (true) ? GPU_RGBA32F : GPU_RGBA16F;
eGPUTextureUsage usage_accum = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_HOST_READ |
GPU_TEXTURE_USAGE_ATTACHMENT;
DRW_texture_ensure_fullscreen_2d_ex(&txl->transparent_accum, texture_format, usage_accum, 0);
GPU_framebuffer_ensure_config(
&fbl->transparent_rpass_accum_fb,
{GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->transparent_accum)});
{
/* This pass Accumulate 1 sample of the transparent pass into the the transparent
* accumulation buffer. */
DRW_PASS_CREATE(psl->transparent_accum_ps, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL);
DRWShadingGroup *grp = DRW_shgroup_create(EEVEE_shaders_renderpasses_accumulate_sh_get(),
psl->transparent_accum_ps);
DRW_shgroup_uniform_texture(grp, "inputBuffer", txl->transparent_color_tmp);
DRW_shgroup_call(grp, DRW_cache_fullscreen_quad_get(), NULL);
}
}
}
void EEVEE_material_transparent_output_accumulate(EEVEE_Data *vedata)
{
EEVEE_EffectsInfo *effects = vedata->stl->effects;
EEVEE_FramebufferList *fbl = vedata->fbl;
EEVEE_PassList *psl = vedata->psl;
EEVEE_PrivateData *pd = vedata->stl->g_data;
EEVEE_TextureList *txl = vedata->txl;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
if (pd->render_passes & EEVEE_RENDER_PASS_TRANSPARENT) {
const float clear[4] = {0.0f, 0.0f, 0.0f, 0.0f};
pd->renderpass_current_sample = effects->taa_current_sample;
/* Work on a copy of the depth texture to allow re-rendering
* the transparent object to the main pass. */
GPU_texture_copy(txl->transparent_depth_tmp, dtxl->depth);
/* Render transparent objects on a black background. */
GPU_framebuffer_bind(fbl->transparent_rpass_fb);
GPU_framebuffer_clear_color(fbl->transparent_rpass_fb, clear);
DRW_draw_pass(psl->transparent_pass);
/* Accumulate the resulting color buffer. */
GPU_framebuffer_bind(fbl->transparent_rpass_accum_fb);
if (effects->taa_current_sample == 1) {
GPU_framebuffer_clear_color(fbl->transparent_rpass_accum_fb, clear);
}
DRW_draw_pass(psl->transparent_accum_ps);
/* Restore default. */
GPU_framebuffer_bind(fbl->main_fb);
}
}
/** \} */

View File

@ -267,6 +267,7 @@ typedef struct EEVEE_PassList {
/* Render-pass Accumulation. */
struct DRWPass *material_accum_ps;
struct DRWPass *background_accum_ps;
struct DRWPass *transparent_accum_ps;
struct DRWPass *cryptomatte_ps;
struct DRWPass *depth_ps;
@ -350,6 +351,8 @@ typedef struct EEVEE_FramebufferList {
struct GPUFrameBuffer *double_buffer_fb;
struct GPUFrameBuffer *double_buffer_color_fb;
struct GPUFrameBuffer *double_buffer_depth_fb;
struct GPUFrameBuffer *transparent_rpass_fb;
struct GPUFrameBuffer *transparent_rpass_accum_fb;
struct GPUFrameBuffer *taa_history_fb;
struct GPUFrameBuffer *taa_history_color_fb;
} EEVEE_FramebufferList;
@ -370,6 +373,9 @@ typedef struct EEVEE_TextureList {
struct GPUTexture *bloom_accum;
struct GPUTexture *ssr_accum;
struct GPUTexture *shadow_accum;
struct GPUTexture *transparent_accum;
struct GPUTexture *transparent_depth_tmp;
struct GPUTexture *transparent_color_tmp;
struct GPUTexture *cryptomatte;
struct GPUTexture *taa_history;
/* Could not be pool texture because of mipmapping. */
@ -1217,6 +1223,7 @@ struct GPUShader *EEVEE_shaders_effect_reflection_trace_sh_get(void);
struct GPUShader *EEVEE_shaders_effect_reflection_resolve_sh_get(void);
struct GPUShader *EEVEE_shaders_effect_reflection_resolve_probe_sh_get(void);
struct GPUShader *EEVEE_shaders_effect_reflection_resolve_refl_sh_get(void);
struct GPUShader *EEVEE_shaders_renderpasses_accumulate_sh_get(void);
struct GPUShader *EEVEE_shaders_renderpasses_post_process_sh_get(void);
struct GPUShader *EEVEE_shaders_cryptomatte_sh_get(bool is_hair);
struct GPUShader *EEVEE_shaders_shadow_sh_get(void);
@ -1475,6 +1482,8 @@ void EEVEE_renderpasses_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *ve
void EEVEE_renderpasses_output_accumulate(EEVEE_ViewLayerData *sldata,
EEVEE_Data *vedata,
bool post_effect);
void EEVEE_material_transparent_output_init(EEVEE_Data *vedata);
void EEVEE_material_transparent_output_accumulate(EEVEE_Data *vedata);
/**
* Post-process data to construct a specific render-pass
*

View File

@ -381,6 +381,19 @@ static void eevee_render_result_bloom(RenderLayer *rl,
}
}
static void eevee_render_result_transparent(RenderLayer *rl,
const char *viewname,
const rcti *rect,
EEVEE_Data *vedata,
EEVEE_ViewLayerData *sldata)
{
if ((vedata->stl->g_data->render_passes & EEVEE_RENDER_PASS_TRANSPARENT) != 0) {
EEVEE_renderpasses_postprocess(sldata, vedata, EEVEE_RENDER_PASS_TRANSPARENT, 0);
eevee_render_color_result(
rl, viewname, rect, RE_PASSNAME_TRANSPARENT, 4, vedata->fbl->renderpass_fb, vedata);
}
}
#define EEVEE_RENDER_RESULT_MATERIAL_PASS(pass_name, eevee_pass_type) \
if ((vedata->stl->g_data->render_passes & EEVEE_RENDER_PASS_##eevee_pass_type) != 0) { \
EEVEE_renderpasses_postprocess(sldata, vedata, EEVEE_RENDER_PASS_##eevee_pass_type, 0); \
@ -631,6 +644,7 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl
/* Subsurface output, Occlusion output, Mist output */
EEVEE_renderpasses_output_accumulate(sldata, vedata, false);
/* Transparent */
EEVEE_material_transparent_output_accumulate(vedata);
GPU_framebuffer_texture_attach(fbl->main_color_fb, dtxl->depth, 0, 0);
GPU_framebuffer_bind(fbl->main_color_fb);
DRW_draw_pass(psl->transparent_pass);
@ -672,6 +686,7 @@ void EEVEE_render_read_result(EEVEE_Data *vedata,
eevee_render_result_environment(rl, viewname, rect, vedata, sldata);
eevee_render_result_bloom(rl, viewname, rect, vedata, sldata);
eevee_render_result_volume_light(rl, viewname, rect, vedata, sldata);
eevee_render_result_transparent(rl, viewname, rect, vedata, sldata);
eevee_render_result_aovs(rl, viewname, rect, vedata, sldata);
eevee_render_result_cryptomatte(rl, viewname, rect, vedata, sldata);
}
@ -706,6 +721,7 @@ void EEVEE_render_update_passes(RenderEngine *engine, Scene *scene, ViewLayer *v
CHECK_PASS_LEGACY(SHADOW, SOCK_RGBA, 3, "RGB");
CHECK_PASS_LEGACY(AO, SOCK_RGBA, 3, "RGB");
CHECK_PASS_EEVEE(BLOOM, SOCK_RGBA, 3, "RGB");
CHECK_PASS_EEVEE(TRANSPARENT, SOCK_RGBA, 4, "RGBA");
LISTBASE_FOREACH (ViewLayerAOV *, aov, &view_layer->aovs) {
if ((aov->flag & AOV_CONFLICT) != 0) {

View File

@ -36,7 +36,7 @@ typedef enum eRenderPassPostProcessType {
#define EEVEE_RENDERPASSES_WITH_POST_PROCESSING \
(EEVEE_RENDER_PASS_Z | EEVEE_RENDER_PASS_MIST | EEVEE_RENDER_PASS_NORMAL | \
EEVEE_RENDER_PASS_AO | EEVEE_RENDER_PASS_BLOOM | EEVEE_RENDER_PASS_VOLUME_LIGHT | \
EEVEE_RENDER_PASS_SHADOW | EEVEE_RENDERPASSES_MATERIAL)
EEVEE_RENDER_PASS_TRANSPARENT | EEVEE_RENDER_PASS_SHADOW | EEVEE_RENDERPASSES_MATERIAL)
#define EEVEE_RENDERPASSES_ALL \
(EEVEE_RENDERPASSES_WITH_POST_PROCESSING | EEVEE_RENDER_PASS_COMBINED)
@ -130,6 +130,7 @@ void EEVEE_renderpasses_init(EEVEE_Data *vedata)
EEVEE_RENDER_PASS_COMBINED;
}
EEVEE_material_renderpasses_init(vedata);
EEVEE_material_transparent_output_init(vedata);
EEVEE_cryptomatte_renderpasses_init(vedata);
}
@ -356,6 +357,11 @@ void EEVEE_renderpasses_postprocess(EEVEE_ViewLayerData *UNUSED(sldata),
g_data->renderpass_input = txl->aov_surface_accum[aov_index];
break;
}
case EEVEE_RENDER_PASS_TRANSPARENT: {
g_data->renderpass_postprocess = PASS_POST_ACCUMULATED_COLOR_ALPHA;
g_data->renderpass_input = txl->transparent_accum;
break;
}
case EEVEE_RENDER_PASS_BLOOM: {
g_data->renderpass_postprocess = PASS_POST_ACCUMULATED_COLOR;
g_data->renderpass_input = txl->bloom_accum;

View File

@ -107,6 +107,7 @@ static struct {
struct GPUShader *ggx_refraction_lut_sh;
/* Render Passes */
struct GPUShader *rpass_accumulate_sh;
struct GPUShader *postprocess_sh;
struct GPUShader *cryptomatte_sh[2];
@ -605,6 +606,15 @@ GPUShader *EEVEE_shaders_effect_ambient_occlusion_debug_sh_get(void)
/** \name Render Passes
* \{ */
GPUShader *EEVEE_shaders_renderpasses_accumulate_sh_get(void)
{
if (e_data.rpass_accumulate_sh == nullptr) {
e_data.rpass_accumulate_sh = DRW_shader_create_from_info_name(
"eevee_legacy_renderpass_accumulate");
}
return e_data.rpass_accumulate_sh;
}
GPUShader *EEVEE_shaders_renderpasses_post_process_sh_get(void)
{
if (e_data.postprocess_sh == nullptr) {
@ -1467,6 +1477,7 @@ void EEVEE_shaders_free(void)
DRW_SHADER_FREE_SAFE(e_data.gtao_layer_sh);
DRW_SHADER_FREE_SAFE(e_data.gtao_debug_sh);
DRW_SHADER_FREE_SAFE(e_data.velocity_resolve_sh);
DRW_SHADER_FREE_SAFE(e_data.rpass_accumulate_sh);
DRW_SHADER_FREE_SAFE(e_data.postprocess_sh);
DRW_SHADER_FREE_SAFE(e_data.shadow_sh);
DRW_SHADER_FREE_SAFE(e_data.shadow_accum_sh);

View File

@ -305,6 +305,14 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_post_process)
.auto_resource_location(true)
.do_static_compilation(true);
/* EEVEE_shaders_renderpasses_accumulate_sh_get */
GPU_SHADER_CREATE_INFO(eevee_legacy_renderpass_accumulate)
.additional_info("draw_fullscreen")
.fragment_source("renderpass_accumulate_frag.glsl")
.sampler(1, ImageType::FLOAT_2D, "inputBuffer")
.fragment_out(0, Type::VEC4, "fragColor")
.do_static_compilation(true);
/* EEVEE_shaders_effect_mist_sh_get */
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_mist_FIRST_PASS)
.define("FIRST_PASS")

View File

@ -0,0 +1,8 @@
/** Stupidly simple shader to allow alpha blended accumulation. */
void main()
{
ivec2 texel = ivec2(gl_FragCoord.xy);
fragColor = texelFetch(inputBuffer, texel, 0);
}

View File

@ -23,6 +23,7 @@ GPU_SHADER_CREATE_INFO(workbench_volume)
GPU_SHADER_CREATE_INFO(workbench_next_volume)
.define("WORKBENCH_NEXT")
.sampler(6, ImageType::UINT_2D, "stencil_tx")
.additional_info("workbench_volume_common", "draw_object_infos_new", "draw_view");
/** \} */

View File

@ -222,6 +222,14 @@ vec4 volume_integration(vec3 ray_ori, vec3 ray_dir, float ray_inc, float ray_max
void main()
{
#ifdef WORKBENCH_NEXT
uint stencil = texelFetch(stencil_tx, ivec2(gl_FragCoord.xy), 0).r;
if (stencil != 0) {
/* Don't draw on top of "in front" objects. */
discard;
return;
}
#endif
#ifdef VOLUME_SLICE
/* Manual depth test. TODO: remove. */
float depth = texelFetch(depthBuffer, ivec2(gl_FragCoord.xy), 0).r;

View File

@ -102,6 +102,7 @@ class Instance {
if (::Material *_mat = BKE_object_material_get_eval(ob_ref.object, slot + 1)) {
return Material(*_mat);
}
ATTR_FALLTHROUGH;
default:
return Material(*BKE_material_default_empty());
}

View File

@ -334,6 +334,8 @@ class VolumePass {
Texture dummy_volume_tx_ = {"Volume.Dummy Volume Tx"};
Texture dummy_coba_tx_ = {"Volume.Dummy Coba Tx"};
GPUTexture *stencil_tx_ = nullptr;
GPUShader *shaders_[2 /*slice*/][2 /*coba*/][3 /*interpolation*/][2 /*smoke*/];
public:

View File

@ -19,6 +19,8 @@ void VolumePass::sync(SceneResources &resources)
dummy_shadow_tx_.ensure_3d(GPU_RGBA8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(1));
dummy_volume_tx_.ensure_3d(GPU_RGBA8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(0));
dummy_coba_tx_.ensure_1d(GPU_RGBA8, 1, GPU_TEXTURE_USAGE_SHADER_READ, float4(0));
stencil_tx_ = resources.depth_tx.stencil_view();
}
void VolumePass::object_sync_volume(Manager &manager,
@ -53,6 +55,7 @@ void VolumePass::object_sync_volume(Manager &manager,
BKE_volume_density_scale(volume, ob->object_to_world);
sub_ps.bind_texture("depthBuffer", &resources.depth_tx);
sub_ps.bind_texture("stencil_tx", &stencil_tx_);
sub_ps.bind_texture("densityTexture", grid->texture);
/* TODO: implement shadow texture, see manta_smoke_calc_transparency. */
sub_ps.bind_texture("shadowTexture", dummy_shadow_tx_);
@ -66,9 +69,8 @@ void VolumePass::object_sync_volume(Manager &manager,
manager, sub_ps, ob_ref, volume->display.slice_axis, volume->display.slice_depth);
}
else {
float3 world_size;
float4x4 texture_to_world = float4x4(ob->object_to_world) * float4x4(grid->texture_to_object);
math::normalize_and_get_size(float3x3(texture_to_world), world_size);
float3 world_size = math::to_scale(texture_to_world);
int3 resolution;
GPU_texture_get_mipmap_size(grid->texture, 0, resolution);
@ -158,6 +160,7 @@ void VolumePass::object_sync_modifier(Manager &manager,
sub_ps.push_constant("densityScale", 10.0f * settings.display_thickness);
sub_ps.bind_texture("depthBuffer", &resources.depth_tx);
sub_ps.bind_texture("stencil_tx", &stencil_tx_);
if (use_slice) {
draw_slice_ps(manager, sub_ps, ob_ref, settings.slice_axis, settings.slice_depth);

View File

@ -29,6 +29,8 @@
#include "UI_interface.hh"
#include "WM_types.h"
struct bContext;
struct uiBlock;
struct uiLayout;
@ -244,7 +246,7 @@ class AbstractViewItemDragController {
AbstractViewItemDragController(AbstractView &view);
virtual ~AbstractViewItemDragController() = default;
virtual int get_drag_type() const = 0;
virtual eWM_DragDataType get_drag_type() const = 0;
virtual void *create_drag_data() const = 0;
virtual void on_drag_start();

View File

@ -254,8 +254,7 @@ struct uiBut {
ListBase extra_op_icons = {nullptr, nullptr}; /** #uiButExtraOpIcon */
/* Drag-able data, type is WM_DRAG_... */
char dragtype = WM_DRAG_ID;
eWM_DragDataType dragtype = WM_DRAG_ID;
short dragflag = 0;
void *dragpoin = nullptr;
ImBuf *imb = nullptr;

View File

@ -88,9 +88,8 @@ static void asset_view_draw_item(uiList *ui_list,
uiBlock *block = uiLayoutGetBlock(layout);
const bool show_names = list_data->show_names;
/* TODO ED_fileselect_init_layout(). Share somehow? */
const float size_x = (96.0f / 20.0f) * UI_UNIT_X;
const float size_y = (96.0f / 20.0f) * UI_UNIT_Y - (show_names ? 0 : UI_UNIT_Y);
const float size_x = UI_preview_tile_size_x();
const float size_y = show_names ? UI_preview_tile_size_y() : UI_preview_tile_size_y_no_label();
uiBut *but = uiDefIconTextBut(block,
UI_BTYPE_PREVIEW_TILE,
0,
@ -110,6 +109,7 @@ static void asset_view_draw_item(uiList *ui_list,
ED_asset_handle_get_preview_icon_id(&asset_handle),
/* NOLINTNEXTLINE: bugprone-suspicious-enum-usage */
UI_HAS_ICON | UI_BUT_ICON_PREVIEW);
but->emboss = UI_EMBOSS_NONE;
if (!ui_list->dyn_data->custom_drag_optype) {
asset_view_item_but_drag_set(but, &asset_handle);
}
@ -267,9 +267,14 @@ void uiTemplateAssetView(uiLayout *layout,
template_list_flags |= UI_TEMPLATE_LIST_NO_FILTER_OPTIONS;
}
uiLayout *subcol = uiLayoutColumn(col, false);
uiLayoutSetScaleX(subcol, 0.8f);
uiLayoutSetScaleY(subcol, 0.8f);
/* TODO can we have some kind of model-view API to handle referencing, filtering and lazy loading
* (of previews) of the items? */
uiList *list = uiTemplateList_ex(col,
uiList *list = uiTemplateList_ex(subcol,
C,
"UI_UL_asset_view",
list_id,

View File

@ -4114,7 +4114,9 @@ static void widget_preview_tile(uiBut *but,
int roundboxalign,
const float zoom)
{
widget_list_itembut(wcol, rect, state, roundboxalign, zoom);
if (!ELEM(but->emboss, UI_EMBOSS_NONE, UI_EMBOSS_NONE_OR_STATUS)) {
widget_list_itembut(wcol, rect, state, roundboxalign, zoom);
}
ui_draw_preview_item_stateless(
&UI_style_get()->widget, rect, but->drawstr, but->icon, wcol->text, UI_STYLE_TEXT_CENTER);
@ -4685,6 +4687,9 @@ void ui_draw_but(const bContext *C, ARegion *region, uiStyle *style, uiBut *but,
but->drawflag |= UI_BUT_NO_TEXT_PADDING;
}
break;
case UI_BTYPE_PREVIEW_TILE:
wt = widget_type(UI_WTYPE_PREVIEW_TILE);
break;
default:
wt = widget_type(UI_WTYPE_ICON);
break;
@ -5473,7 +5478,6 @@ void ui_draw_preview_item_stateless(const uiFontStyle *fstyle,
{
rcti trect = *rect;
const float text_size = UI_UNIT_Y;
float font_dims[2] = {0.0f, 0.0f};
const bool has_text = name && name[0];
if (has_text) {
@ -5488,15 +5492,11 @@ void ui_draw_preview_item_stateless(const uiFontStyle *fstyle,
return;
}
BLF_width_and_height(
fstyle->uifont_id, name, BLF_DRAW_STR_DUMMY_MAX, &font_dims[0], &font_dims[1]);
/* text rect */
trect.ymin += U.widget_unit / 2;
trect.ymax = trect.ymin + font_dims[1];
if (trect.xmax > rect->xmax - PREVIEW_PAD) {
trect.xmax = rect->xmax - PREVIEW_PAD;
}
trect.ymax = trect.ymin + text_size;
trect.ymin += PREVIEW_PAD;
trect.xmin += PREVIEW_PAD;
trect.xmax -= PREVIEW_PAD;
{
char drawstr[UI_MAX_DRAW_STR];

View File

@ -328,6 +328,7 @@ void GridViewLayoutBuilder::build_grid_tile(uiLayout &grid_layout,
AbstractGridViewItem &item) const
{
uiLayout *overlap = uiLayoutOverlap(&grid_layout);
uiLayoutSetFixedSize(overlap, true);
item.add_grid_tile_button(block_);
item.build_grid_tile(*uiLayoutRow(overlap, false));
@ -338,7 +339,7 @@ void GridViewLayoutBuilder::build_from_view(const AbstractGridView &grid_view,
{
uiLayout *parent_layout = current_layout();
uiLayout &layout = *uiLayoutColumn(current_layout(), false);
uiLayout &layout = *uiLayoutColumn(current_layout(), true);
const GridViewStyle &style = grid_view.get_style();
const int cols_per_row = std::max(uiLayoutGetWidth(&layout) / style.tile_width, 1);
@ -347,12 +348,8 @@ void GridViewLayoutBuilder::build_from_view(const AbstractGridView &grid_view,
build_visible_helper.fill_layout_before_visible(block_);
/* Use `-cols_per_row` because the grid layout uses a multiple of the passed absolute value for
* the number of columns then, rather than distributing the number of items evenly over rows and
* stretching the items to fit (see #uiLayoutItemGridFlow.columns_len). */
uiLayout *grid_layout = uiLayoutGridFlow(&layout, true, -cols_per_row, true, true, true);
int item_idx = 0;
uiLayout *row = nullptr;
grid_view.foreach_item([&](AbstractGridViewItem &item) {
/* Skip if item isn't visible. */
if (!build_visible_helper.is_item_visible(item_idx)) {
@ -360,20 +357,15 @@ void GridViewLayoutBuilder::build_from_view(const AbstractGridView &grid_view,
return;
}
build_grid_tile(*grid_layout, item);
/* Start a new row for every first item in the row. */
if ((item_idx % cols_per_row) == 0) {
row = uiLayoutRow(&layout, true);
}
build_grid_tile(*row, item);
item_idx++;
});
/* If there are not enough items to fill the layout, add padding items so the layout doesn't
* stretch over the entire width. */
if (grid_view.get_item_count() < cols_per_row) {
for (int padding_item_idx = 0; padding_item_idx < (cols_per_row - grid_view.get_item_count());
padding_item_idx++)
{
uiItemS(grid_layout);
}
}
UI_block_layout_set_current(&block_, parent_layout);
build_visible_helper.fill_layout_after_visible(block_);
@ -435,6 +427,7 @@ void PreviewGridItem::build_grid_tile(uiLayout &layout) const
preview_icon_id,
/* NOLINTNEXTLINE: bugprone-suspicious-enum-usage */
UI_HAS_ICON | UI_BUT_ICON_PREVIEW);
but->emboss = UI_EMBOSS_NONE;
}
void PreviewGridItem::set_on_activate_fn(ActivateFn fn)
JulianEisel marked this conversation as resolved Outdated

-Wextra warns: grid_view.cc:432:68: warning: enumerated and non-enumerated type in conditional expression. int(UI_BUT_ICON_PREVIEW).

`-Wextra` warns: `grid_view.cc:432:68: warning: enumerated and non-enumerated type in conditional expression`. `int(UI_BUT_ICON_PREVIEW)`.

View File

@ -865,11 +865,11 @@ static void action_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, S
bDopeSheet *ads = &saction->ads;
if (ads) {
BLO_read_id_address(reader, parent_id->lib, &ads->source);
BLO_read_id_address(reader, parent_id->lib, &ads->filter_grp);
BLO_read_id_address(reader, parent_id, &ads->source);
BLO_read_id_address(reader, parent_id, &ads->filter_grp);
}
BLO_read_id_address(reader, parent_id->lib, &saction->action);
BLO_read_id_address(reader, parent_id, &saction->action);
}
static void action_space_blend_write(BlendWriter *writer, SpaceLink *sl)

View File

@ -922,7 +922,7 @@ static void buttons_space_blend_read_data(BlendDataReader *UNUSED(reader), Space
static void buttons_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, SpaceLink *sl)
{
SpaceProperties *sbuts = (SpaceProperties *)sl;
BLO_read_id_address(reader, parent_id->lib, &sbuts->pinid);
BLO_read_id_address(reader, parent_id, &sbuts->pinid);
if (sbuts->pinid == NULL) {
sbuts->flag &= ~SB_PIN_CONTEXT;
}

View File

@ -1133,8 +1133,8 @@ static void clip_space_blend_read_data(BlendDataReader * /*reader*/, SpaceLink *
static void clip_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, SpaceLink *sl)
{
SpaceClip *sclip = (SpaceClip *)sl;
BLO_read_id_address(reader, parent_id->lib, &sclip->clip);
BLO_read_id_address(reader, parent_id->lib, &sclip->mask_info.mask);
BLO_read_id_address(reader, parent_id, &sclip->clip);
BLO_read_id_address(reader, parent_id, &sclip->mask_info.mask);
}
static void clip_space_blend_write(BlendWriter *writer, SpaceLink *sl)

View File

@ -103,7 +103,7 @@ class AssetCatalogDragController : public ui::AbstractViewItemDragController {
explicit AssetCatalogDragController(AssetCatalogTreeView &tree_view,
AssetCatalogTreeItem &catalog_item);
int get_drag_type() const override;
eWM_DragDataType get_drag_type() const override;
void *create_drag_data() const override;
void on_drag_start() override;
};
@ -545,7 +545,7 @@ AssetCatalogDragController::AssetCatalogDragController(AssetCatalogTreeView &tre
{
}
int AssetCatalogDragController::get_drag_type() const
eWM_DragDataType AssetCatalogDragController::get_drag_type() const
{
return WM_DRAG_ASSET_CATALOG;
}

View File

@ -848,8 +848,8 @@ static void graph_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, Sp
bDopeSheet *ads = sipo->ads;
if (ads) {
BLO_read_id_address(reader, parent_id->lib, &ads->source);
BLO_read_id_address(reader, parent_id->lib, &ads->filter_grp);
BLO_read_id_address(reader, parent_id, &ads->source);
BLO_read_id_address(reader, parent_id, &ads->filter_grp);
}
}

View File

@ -1064,13 +1064,13 @@ static void image_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, Sp
{
SpaceImage *sima = (SpaceImage *)sl;
BLO_read_id_address(reader, parent_id->lib, &sima->image);
BLO_read_id_address(reader, parent_id->lib, &sima->mask_info.mask);
BLO_read_id_address(reader, parent_id, &sima->image);
BLO_read_id_address(reader, parent_id, &sima->mask_info.mask);
/* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data
* so fingers crossed this works fine!
*/
BLO_read_id_address(reader, parent_id->lib, &sima->gpd);
BLO_read_id_address(reader, parent_id, &sima->gpd);
}
static void image_space_blend_write(BlendWriter *writer, SpaceLink *sl)

View File

@ -577,8 +577,8 @@ static void nla_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, Spac
bDopeSheet *ads = snla->ads;
if (ads) {
BLO_read_id_address(reader, parent_id->lib, &ads->source);
BLO_read_id_address(reader, parent_id->lib, &ads->filter_grp);
BLO_read_id_address(reader, parent_id, &ads->source);
BLO_read_id_address(reader, parent_id, &ads->filter_grp);
}
}

View File

@ -1057,15 +1057,15 @@ static void node_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, Spa
SpaceNode *snode = (SpaceNode *)sl;
/* node tree can be stored locally in id too, link this first */
BLO_read_id_address(reader, parent_id->lib, &snode->id);
BLO_read_id_address(reader, parent_id->lib, &snode->from);
BLO_read_id_address(reader, parent_id, &snode->id);
BLO_read_id_address(reader, parent_id, &snode->from);
bNodeTree *ntree = snode->id ? ntreeFromID(snode->id) : nullptr;
if (ntree) {
snode->nodetree = ntree;
}
else {
BLO_read_id_address(reader, parent_id->lib, &snode->nodetree);
BLO_read_id_address(reader, parent_id, &snode->nodetree);
}
bNodeTreePath *path;
@ -1075,7 +1075,7 @@ static void node_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, Spa
path->nodetree = snode->nodetree;
}
else {
BLO_read_id_address(reader, parent_id->lib, &path->nodetree);
BLO_read_id_address(reader, parent_id, &path->nodetree);
}
if (!path->nodetree) {

View File

@ -1461,7 +1461,7 @@ static int outliner_item_drag_drop_invoke(bContext *C, wmOperator * /*op*/, cons
TSE_GPENCIL_EFFECT,
TSE_GPENCIL_EFFECT_BASE);
const int wm_drag_type = use_datastack_drag ? WM_DRAG_DATASTACK : WM_DRAG_ID;
const eWM_DragDataType wm_drag_type = use_datastack_drag ? WM_DRAG_DATASTACK : WM_DRAG_ID;
wmDrag *drag = WM_drag_data_create(C, data.icon, wm_drag_type, nullptr, 0.0, WM_DRAG_NOP);
if (use_datastack_drag) {

View File

@ -479,9 +479,7 @@ static void outliner_space_blend_read_data(BlendDataReader *reader, SpaceLink *s
space_outliner->runtime = nullptr;
}
static void outliner_space_blend_read_lib(BlendLibReader *reader,
ID * /*parent_id*/,
SpaceLink *sl)
static void outliner_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, SpaceLink *sl)
{
SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
@ -492,7 +490,7 @@ static void outliner_space_blend_read_lib(BlendLibReader *reader,
BLI_mempool_iternew(space_outliner->treestore, &iter);
while ((tselem = static_cast<TreeStoreElem *>(BLI_mempool_iterstep(&iter)))) {
if (TSE_IS_REAL_ID(tselem)) {
BLO_read_id_address(reader, nullptr, &tselem->id);
BLO_read_id_address(reader, parent_id, &tselem->id);
}
else {
tselem->id = nullptr;

View File

@ -151,7 +151,7 @@ static void script_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, S
SpaceScript *scpt = (SpaceScript *)sl;
/*scpt->script = NULL; - 2.45 set to null, better re-run the script */
if (scpt->script) {
BLO_read_id_address(reader, parent_id->lib, &scpt->script);
BLO_read_id_address(reader, parent_id, &scpt->script);
if (scpt->script) {
SCRIPT_SET_NULL(scpt->script);
}

View File

@ -987,7 +987,7 @@ static void sequencer_space_blend_read_lib(BlendLibReader *reader, ID *parent_id
/* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data
* so fingers crossed this works fine!
*/
BLO_read_id_address(reader, parent_id->lib, &sseq->gpd);
BLO_read_id_address(reader, parent_id, &sseq->gpd);
}
static void sequencer_space_blend_write(BlendWriter *writer, SpaceLink *sl)

View File

@ -687,7 +687,7 @@ static void spreadsheet_blend_read_data(BlendDataReader *reader, SpaceLink *sl)
static void spreadsheet_blend_read_lib(BlendLibReader *reader, ID *parent_id, SpaceLink *sl)
{
SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)sl;
BKE_viewer_path_blend_read_lib(reader, parent_id->lib, &sspreadsheet->viewer_path);
BKE_viewer_path_blend_read_lib(reader, parent_id, &sspreadsheet->viewer_path);
}
static void spreadsheet_blend_write(BlendWriter *writer, SpaceLink *sl)

View File

@ -405,7 +405,7 @@ static void text_space_blend_read_data(BlendDataReader *UNUSED(reader), SpaceLin
static void text_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, SpaceLink *sl)
{
SpaceText *st = (SpaceText *)sl;
BLO_read_id_address(reader, parent_id->lib, &st->text);
BLO_read_id_address(reader, parent_id, &st->text);
}
static void text_space_blend_write(BlendWriter *writer, SpaceLink *sl)

View File

@ -2126,14 +2126,14 @@ static void view3d_space_blend_read_lib(BlendLibReader *reader, ID *parent_id, S
{
View3D *v3d = (View3D *)sl;
BLO_read_id_address(reader, parent_id->lib, &v3d->camera);
BLO_read_id_address(reader, parent_id->lib, &v3d->ob_center);
BLO_read_id_address(reader, parent_id, &v3d->camera);
BLO_read_id_address(reader, parent_id, &v3d->ob_center);
if (v3d->localvd) {
BLO_read_id_address(reader, parent_id->lib, &v3d->localvd->camera);
BLO_read_id_address(reader, parent_id, &v3d->localvd->camera);
}
BKE_viewer_path_blend_read_lib(reader, parent_id->lib, &v3d->viewer_path);
BKE_viewer_path_blend_read_lib(reader, parent_id, &v3d->viewer_path);
}
static void view3d_space_blend_write(BlendWriter *writer, SpaceLink *sl)

View File

@ -437,7 +437,7 @@ void USDCurvesWriter::do_write(HierarchyContext &context)
"%s on frame %f",
IFACE_(first_frame_curve_type_name),
IFACE_(current_curve_type_name),
timecode);
timecode.GetValue());
return;
}

View File

@ -44,6 +44,7 @@ typedef enum eViewLayerEEVEEPassType {
EEVEE_RENDER_PASS_CRYPTOMATTE_ASSET = (1 << 17),
EEVEE_RENDER_PASS_CRYPTOMATTE_MATERIAL = (1 << 18),
EEVEE_RENDER_PASS_VECTOR = (1 << 19),
EEVEE_RENDER_PASS_TRANSPARENT = (1 << 20),
} eViewLayerEEVEEPassType;
#define EEVEE_RENDER_PASS_MAX_BIT 20

View File

@ -312,6 +312,7 @@ typedef enum eScenePassType {
#define RE_PASSNAME_FREESTYLE "Freestyle"
#define RE_PASSNAME_BLOOM "BloomCol"
#define RE_PASSNAME_VOLUME_LIGHT "VolumeDir"
#define RE_PASSNAME_TRANSPARENT "Transp"
#define RE_PASSNAME_CRYPTOMATTE_OBJECT "CryptoObject"
#define RE_PASSNAME_CRYPTOMATTE_ASSET "CryptoAsset"

View File

@ -4354,6 +4354,12 @@ static void rna_def_view_layer_eevee(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "render_passes", EEVEE_RENDER_PASS_BLOOM);
RNA_def_property_ui_text(prop, "Bloom", "Deliver bloom pass");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
prop = RNA_def_property(srna, "use_pass_transparent", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "render_passes", EEVEE_RENDER_PASS_TRANSPARENT);
RNA_def_property_ui_text(
prop, "Transparent", "Deliver alpha blended surfaces in a separate pass");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
}
static void rna_def_view_layer_aovs(BlenderRNA *brna, PropertyRNA *cprop)

View File

@ -448,6 +448,7 @@ static const EnumPropertyItem rna_enum_view3dshading_render_pass_type_items[] =
{EEVEE_RENDER_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""},
{EEVEE_RENDER_PASS_AO, "AO", 0, "Ambient Occlusion", ""},
{EEVEE_RENDER_PASS_SHADOW, "SHADOW", 0, "Shadow", ""},
{EEVEE_RENDER_PASS_TRANSPARENT, "TRANSPARENT", 0, "Transparent", ""},
RNA_ENUM_ITEM_HEADING(N_("Light"), NULL),
{EEVEE_RENDER_PASS_DIFFUSE_LIGHT, "DIFFUSE_LIGHT", 0, "Diffuse Light", ""},

View File

@ -1619,7 +1619,7 @@ void SEQ_modifier_blend_read_lib(BlendLibReader *reader, Scene *scene, ListBase
{
LISTBASE_FOREACH (SequenceModifierData *, smd, lb) {
if (smd->mask_id) {
BLO_read_id_address(reader, scene->id.lib, &smd->mask_id);
BLO_read_id_address(reader, &scene->id, &smd->mask_id);
}
}
}

View File

@ -860,25 +860,25 @@ static bool seq_read_lib_cb(Sequence *seq, void *user_data)
BlendLibReader *reader = data->reader;
Scene *sce = data->scene;
IDP_BlendReadLib(reader, sce->id.lib, seq->prop);
IDP_BlendReadLib(reader, &sce->id, seq->prop);
if (seq->ipo) {
/* XXX: deprecated - old animation system. */
BLO_read_id_address(reader, sce->id.lib, &seq->ipo);
BLO_read_id_address(reader, &sce->id, &seq->ipo);
}
seq->scene_sound = NULL;
if (seq->scene) {
BLO_read_id_address(reader, sce->id.lib, &seq->scene);
BLO_read_id_address(reader, &sce->id, &seq->scene);
seq->scene_sound = NULL;
}
if (seq->clip) {
BLO_read_id_address(reader, sce->id.lib, &seq->clip);
BLO_read_id_address(reader, &sce->id, &seq->clip);
}
if (seq->mask) {
BLO_read_id_address(reader, sce->id.lib, &seq->mask);
BLO_read_id_address(reader, &sce->id, &seq->mask);
}
if (seq->scene_camera) {
BLO_read_id_address(reader, sce->id.lib, &seq->scene_camera);
BLO_read_id_address(reader, &sce->id, &seq->scene_camera);
}
if (seq->sound) {
seq->scene_sound = NULL;
@ -886,7 +886,7 @@ static bool seq_read_lib_cb(Sequence *seq, void *user_data)
seq->type = SEQ_TYPE_SOUND_RAM;
}
else {
BLO_read_id_address(reader, sce->id.lib, &seq->sound);
BLO_read_id_address(reader, &sce->id, &seq->sound);
}
if (seq->sound) {
id_us_plus_no_lib((ID *)seq->sound);
@ -895,7 +895,7 @@ static bool seq_read_lib_cb(Sequence *seq, void *user_data)
}
if (seq->type == SEQ_TYPE_TEXT) {
TextVars *t = seq->effectdata;
BLO_read_id_address(reader, sce->id.lib, &t->text_font);
BLO_read_id_address(reader, &sce->id, &t->text_font);
}
BLI_listbase_clear(&seq->anims);

View File

@ -1360,8 +1360,12 @@ int WM_operator_flag_only_pass_through_on_press(int retval, const struct wmEvent
* Start dragging immediately with the given data.
* Note that \a poin should be valid allocated and not on stack.
*/
void WM_event_start_drag(
struct bContext *C, int icon, int type, void *poin, double value, unsigned int flags);
void WM_event_start_drag(struct bContext *C,
int icon,
eWM_DragDataType type,
void *poin,
double value,
unsigned int flags);
/**
* Create and fill the dragging data, but don't start dragging just yet (unlike
* #WM_event_start_drag()). Must be followed up by #WM_event_start_prepared_drag(), otherwise the
@ -1369,15 +1373,19 @@ void WM_event_start_drag(
*
* Note that \a poin should be valid allocated and not on stack.
*/
wmDrag *WM_drag_data_create(
struct bContext *C, int icon, int type, void *poin, double value, unsigned int flags);
wmDrag *WM_drag_data_create(struct bContext *C,
int icon,
eWM_DragDataType type,
void *poin,
double value,
unsigned int flags);
/**
* Invoke dragging using the given \a drag data.
*/
void WM_event_start_prepared_drag(struct bContext *C, wmDrag *drag);
void WM_event_drag_image(struct wmDrag *, struct ImBuf *, float scale);
void WM_drag_free(struct wmDrag *drag);
void WM_drag_data_free(int dragtype, void *poin);
void WM_drag_data_free(eWM_DragDataType dragtype, void *poin);
void WM_drag_free_list(struct ListBase *lb);
struct wmDropBox *WM_dropbox_add(
ListBase *lb,

View File

@ -1064,19 +1064,21 @@ typedef void (*wmPaintCursorDraw)(struct bContext *C, int, int, void *customdata
/* *************** Drag and drop *************** */
#define WM_DRAG_ID 0
#define WM_DRAG_ASSET 1
/** The user is dragging multiple assets. This is only supported in few specific cases, proper
* multi-item support for dragging isn't supported well yet. Therefore this is kept separate from
* #WM_DRAG_ASSET. */
#define WM_DRAG_ASSET_LIST 2
#define WM_DRAG_RNA 3
#define WM_DRAG_PATH 4
#define WM_DRAG_NAME 5
#define WM_DRAG_VALUE 6
#define WM_DRAG_COLOR 7
#define WM_DRAG_DATASTACK 8
#define WM_DRAG_ASSET_CATALOG 9
typedef enum eWM_DragDataType {
WM_DRAG_ID,
WM_DRAG_ASSET,
/** The user is dragging multiple assets. This is only supported in few specific cases, proper
* multi-item support for dragging isn't supported well yet. Therefore this is kept separate from
* #WM_DRAG_ASSET. */
WM_DRAG_ASSET_LIST,
WM_DRAG_RNA,
WM_DRAG_PATH,
WM_DRAG_NAME,
WM_DRAG_VALUE,
WM_DRAG_COLOR,
WM_DRAG_DATASTACK,
WM_DRAG_ASSET_CATALOG,
} eWM_DragDataType;
typedef enum eWM_DragFlags {
WM_DRAG_NOP = 0,
@ -1176,8 +1178,7 @@ typedef struct wmDrag {
struct wmDrag *next, *prev;
int icon;
/** See 'WM_DRAG_' defines above. */
int type;
eWM_DragDataType type;
void *poin;
double value;

View File

@ -224,7 +224,7 @@ static void window_manager_blend_read_data(BlendDataReader *reader, ID *id)
static void lib_link_wm_xr_data(BlendLibReader *reader, ID *parent_id, wmXrData *xr_data)
{
BLO_read_id_address(reader, parent_id->lib, &xr_data->session_settings.base_pose_object);
BLO_read_id_address(reader, parent_id, &xr_data->session_settings.base_pose_object);
}
static void lib_link_workspace_instance_hook(BlendLibReader *reader,
@ -232,7 +232,7 @@ static void lib_link_workspace_instance_hook(BlendLibReader *reader,
ID *id)
{
WorkSpace *workspace = BKE_workspace_active_get(hook);
BLO_read_id_address(reader, id->lib, &workspace);
BLO_read_id_address(reader, id, &workspace);
BKE_workspace_active_set(hook, workspace);
}
@ -243,22 +243,22 @@ static void window_manager_blend_read_lib(BlendLibReader *reader, ID *id)
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
if (win->workspace_hook) { /* NULL for old files */
lib_link_workspace_instance_hook(reader, win->workspace_hook, &wm->id);
lib_link_workspace_instance_hook(reader, win->workspace_hook, id);
}
BLO_read_id_address(reader, wm->id.lib, &win->scene);
BLO_read_id_address(reader, id, &win->scene);
/* deprecated, but needed for versioning (will be NULL'ed then) */
BLO_read_id_address(reader, NULL, &win->screen);
BLO_read_id_address(reader, id, &win->screen);
/* The unpinned scene is a UI->Scene-data pointer, and should be NULL'ed on linking (like
* WorkSpace.pin_scene). But the WindowManager ID (owning the window) is never linked. */
BLI_assert(!ID_IS_LINKED(id));
BLO_read_id_address(reader, id->lib, &win->unpinned_scene);
BLO_read_id_address(reader, id, &win->unpinned_scene);
LISTBASE_FOREACH (ScrArea *, area, &win->global_areas.areabase) {
BKE_screen_area_blend_read_lib(reader, &wm->id, area);
BKE_screen_area_blend_read_lib(reader, id, area);
}
lib_link_wm_xr_data(reader, &wm->id, &wm->xr);
lib_link_wm_xr_data(reader, id, &wm->xr);
}
}

View File

@ -177,7 +177,8 @@ static void wm_dropbox_invoke(bContext *C, wmDrag *drag)
}
}
wmDrag *WM_drag_data_create(bContext *C, int icon, int type, void *poin, double value, uint flags)
wmDrag *WM_drag_data_create(
bContext *C, int icon, eWM_DragDataType type, void *poin, double value, uint flags)
{
wmDrag *drag = MEM_cnew<wmDrag>(__func__);
@ -232,7 +233,8 @@ void WM_event_start_prepared_drag(bContext *C, wmDrag *drag)
wm_dropbox_invoke(C, drag);
}
void WM_event_start_drag(bContext *C, int icon, int type, void *poin, double value, uint flags)
void WM_event_start_drag(
bContext *C, int icon, eWM_DragDataType type, void *poin, double value, uint flags)
{
wmDrag *drag = WM_drag_data_create(C, icon, type, poin, value, flags);
WM_event_start_prepared_drag(C, drag);
@ -288,7 +290,7 @@ void WM_event_drag_image(wmDrag *drag, ImBuf *imb, float scale)
drag->imbuf_scale = scale;
}
void WM_drag_data_free(int dragtype, void *poin)
void WM_drag_data_free(eWM_DragDataType dragtype, void *poin)
{
/* Don't require all the callers to have a nullptr-check, just allow passing nullptr. */
if (!poin) {
@ -849,6 +851,8 @@ const char *WM_drag_get_item_name(wmDrag *drag)
}
case WM_DRAG_NAME:
return static_cast<const char *>(drag->poin);
default:
break;
}
return "";
}