WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 357 commits from brush-assets-project into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
4 changed files with 28 additions and 23 deletions
Showing only changes of commit 99a38e9c18 - Show all commits

View File

@ -83,10 +83,10 @@ bool BKE_lib_override_library_is_user_edited(const ID *id);
bool BKE_lib_override_library_is_system_defined(const Main *bmain, const ID *id);
/**
* Count the amount of liboverride IDs of given `id_type`, using a refererence linked ID from given
* Count the number of liboverride IDs of given `id_type`, using a refererence linked ID from given
* `library`, that are user-edited.
*
* \param r_reports If not NULL, add one report for each relevant ID.
* \param r_reports: If not NULL, add one report for each relevant ID.
*/
int BKE_lib_override_user_edited_from_library_count(struct Main *bmain,
const short id_type,

View File

@ -203,11 +203,18 @@ Brush *BKE_paint_brush(Paint *paint);
const Brush *BKE_paint_brush_for_read(const Paint *p);
void BKE_paint_brush_set(Paint *paint, Brush *br);
/** Set the active brush of given paint struct, and store the weak asset reference to it.
* NOTE: Takes ownership of the given `weak_asset_reference`. */
void BKE_paint_brush_asset_set(Paint *p, Brush *br, AssetWeakReference *weak_asset_reference);
/**
* Set the active brush of given paint struct, and store the weak asset reference to it.
* \note Takes ownership of the given `weak_asset_reference`.
*/
void BKE_paint_brush_asset_set(Paint *paint,
Brush *brush,
AssetWeakReference *weak_asset_reference);
/** Attempt to restore a valid active brush in `p` from brush asset informations stored in `p`. */
/**
* Attempt to restore a valid active brush in `paint` from brush asset information stored in
* `paint`.
*/
void BKE_paint_brush_asset_restore(Main *bmain, Paint *p);
Palette *BKE_paint_palette(Paint *paint);

View File

@ -396,17 +396,18 @@ static int reuse_bmain_data_dependencies_process_cb(LibraryIDLinkCallbackData *c
return IDWALK_RET_NOP;
}
/* Selectively 'import' data from old BMain into new BMain, provided it does not conflict with data
* already present in the new BMain (name-wise and library-wise).
/**
* Selectively 'import' data from old Main into new Main, provided it does not conflict with data
* already present in the new Main (name-wise and library-wise).
*
* Dependencies from moved over old data are also imported into the new BMain, (unless, in case of
* linked data, a matching linked ID is already available in new BMain).
* Dependencies from moved over old data are also imported into the new Main, (unless, in case of
* linked data, a matching linked ID is already available in new Main).
*
* When a conflict is found, usages of the conflicted ID by the old data are stored in the
* `remapper` of `ReuseOldBMainData` to be remapped to the matching data in the new BMain later.
* `remapper` of `ReuseOldBMainData` to be remapped to the matching data in the new Main later.
*
* NOTE: This function will never remove any original new data from the new BMain, it only moves
* (some of) the old data to the new BMain.
* NOTE: This function will never remove any original new data from the new Main, it only moves
* (some of) the old data to the new Main.
*/
static void reuse_old_bmain_data_for_blendfile(ReuseOldBMainData *reuse_data, const short id_code)
{
@ -430,7 +431,8 @@ static void reuse_old_bmain_data_for_blendfile(ReuseOldBMainData *reuse_data, co
* an asset repository, and its assets should be accessed through the asset system by other
* files. */
if (!ID_IS_LINKED(old_id_iter) && !ID_IS_OVERRIDE_LIBRARY(old_id_iter) &&
ID_IS_ASSET(old_id_iter)) {
ID_IS_ASSET(old_id_iter))
{
continue;
}

View File

@ -1167,7 +1167,10 @@ static void SCULPT_CURVES_OT_min_distance_edit(wmOperatorType *ot)
static int brush_asset_select_exec(bContext *C, wmOperator * /*op*/)
{
blender::asset_system::AssetRepresentation *asset = CTX_wm_asset(C);
/* This operator currently covers both cases: the file/asset browser file list and the asset list
* used for the asset-view template. Once the asset list design is used by the Asset Browser,
* this can be simplified to just that case. */
asset_system::AssetRepresentation *asset = CTX_wm_asset(C);
if (!asset) {
return OPERATOR_CANCELLED;
}
@ -1182,19 +1185,12 @@ static int brush_asset_select_exec(bContext *C, wmOperator * /*op*/)
return OPERATOR_FINISHED;
}
/**
* This operator currently covers both cases, the File/Asset Browser file list and the asset list
* used for the asset-view template. Once the asset list design is used by the Asset Browser, this
* can be simplified to just that case.
*/
static void SCULPT_CURVES_OT_brush_asset_select(struct wmOperatorType *ot)
static void SCULPT_CURVES_OT_brush_asset_select(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Brush Asset";
ot->description = "Select a brush asset as currently sculpt/paint tool - TESTING PURPOSE ONLY";
ot->idname = "SCULPT_CURVES_OT_brush_asset_select";
/* api callbacks */
ot->exec = brush_asset_select_exec;
ot->poll = CURVES_SCULPT_mode_poll;