Merge branch 'blender-v4.3-release'
This commit is contained in:
@@ -3729,7 +3729,11 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
|
||||
/* Yep, second splitting... but this is a very cheap operation, so no big deal. */
|
||||
blo_split_main(&mainlist, bfd->main);
|
||||
LISTBASE_FOREACH (Main *, mainvar, &mainlist) {
|
||||
BLI_assert(mainvar->versionfile != 0);
|
||||
/* Do versioning for newly added linked data-blocks. If no data-blocks were read from a
|
||||
* library versionfile will still be zero and we can skip it. */
|
||||
if (mainvar->versionfile == 0) {
|
||||
continue;
|
||||
}
|
||||
do_versions_after_linking((mainvar->curlib && mainvar->curlib->runtime.filedata) ?
|
||||
mainvar->curlib->runtime.filedata :
|
||||
fd,
|
||||
@@ -3745,12 +3749,33 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
|
||||
BKE_main_id_refcount_recompute(bfd->main, false);
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (Library *, lib, &bfd->main->libraries) {
|
||||
LISTBASE_FOREACH_MUTABLE (Library *, lib, &bfd->main->libraries) {
|
||||
/* Now we can clear this runtime library filedata, it is not needed anymore. */
|
||||
if (lib->runtime.filedata) {
|
||||
BLI_assert(lib->runtime.versionfile != 0);
|
||||
blo_filedata_free(lib->runtime.filedata);
|
||||
lib->runtime.filedata = nullptr;
|
||||
}
|
||||
/* If no data-blocks were read from a library (should only happen when all references to a
|
||||
* library's data are `ID_FLAG_INDIRECT_WEAK_LINK`), its versionfile will still be zero and
|
||||
* it can be deleted.
|
||||
*
|
||||
* NOTES:
|
||||
* - In case the library blendfile exists but is missing all the referenced linked IDs, the
|
||||
* placeholders IDs created will reference the library ID, and the library ID will have a
|
||||
* valid version number as the file was read to search for the linked IDs.
|
||||
* - In case the library blendfile does not exist, its local Library ID will get the version
|
||||
* of the current local Main (i.e. the loaded blendfile). */
|
||||
else if (lib->runtime.versionfile == 0) {
|
||||
#ifndef NDEBUG
|
||||
ID *id_iter;
|
||||
FOREACH_MAIN_ID_BEGIN (bfd->main, id_iter) {
|
||||
BLI_assert(id_iter->lib != lib);
|
||||
}
|
||||
FOREACH_MAIN_ID_END;
|
||||
#endif
|
||||
BKE_id_delete(bfd->main, lib);
|
||||
}
|
||||
}
|
||||
|
||||
if (bfd->main->is_read_invalid) {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "BKE_brush.hh"
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_paint.hh"
|
||||
|
||||
#include "ED_paint.hh"
|
||||
@@ -145,6 +146,13 @@ static char paintcurve_point_side_index(const BezTriple *bezt,
|
||||
|
||||
/******************* Operators *********************************/
|
||||
|
||||
static PaintCurve *paintcurve_for_brush_add(Main *bmain, const char *name, const Brush *brush)
|
||||
{
|
||||
PaintCurve *curve = BKE_paint_curve_add(bmain, name);
|
||||
BKE_id_move_to_same_lib(*bmain, curve->id, brush->id);
|
||||
return curve;
|
||||
}
|
||||
|
||||
static int paintcurve_new_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
@@ -152,7 +160,7 @@ static int paintcurve_new_exec(bContext *C, wmOperator * /*op*/)
|
||||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
if (brush) {
|
||||
brush->paint_curve = BKE_paint_curve_add(bmain, DATA_("PaintCurve"));
|
||||
brush->paint_curve = paintcurve_for_brush_add(bmain, DATA_("PaintCurve"), brush);
|
||||
BKE_brush_tag_unsaved_changes(brush);
|
||||
}
|
||||
|
||||
@@ -187,7 +195,7 @@ static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2])
|
||||
|
||||
PaintCurve *pc = br->paint_curve;
|
||||
if (!pc) {
|
||||
br->paint_curve = pc = BKE_paint_curve_add(bmain, DATA_("PaintCurve"));
|
||||
br->paint_curve = pc = paintcurve_for_brush_add(bmain, DATA_("PaintCurve"), br);
|
||||
}
|
||||
|
||||
ED_paintcurve_undo_push_begin(op->type->name);
|
||||
|
||||
@@ -653,7 +653,7 @@ typedef struct PreviewImage {
|
||||
|
||||
#define ID_IS_LINKED(_id) (((const ID *)(_id))->lib != NULL)
|
||||
|
||||
#define ID_TYPE_SUPPORTS_ASSET_EDITABLE(id_type) ELEM(id_type, ID_BR, ID_TE, ID_NT, ID_IM)
|
||||
#define ID_TYPE_SUPPORTS_ASSET_EDITABLE(id_type) ELEM(id_type, ID_BR, ID_TE, ID_NT, ID_IM, ID_PC)
|
||||
|
||||
#define ID_IS_EDITABLE(_id) \
|
||||
((((const ID *)(_id))->lib == NULL) || \
|
||||
|
||||
Reference in New Issue
Block a user