Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_ID.c
| Show First 20 Lines • Show All 663 Lines • ▼ Show 20 Lines | if (newid != NULL) { | ||||
| id_us_min(newid); | id_us_min(newid); | ||||
| } | } | ||||
| WM_main_add_notifier(NC_ID | NA_ADDED, NULL); | WM_main_add_notifier(NC_ID | NA_ADDED, NULL); | ||||
| return newid; | return newid; | ||||
| } | } | ||||
| static void rna_ID_asset_mark(ID *id, bContext *C) | static void rna_ID_asset_mark(ID *id) | ||||
| { | { | ||||
| if (ED_asset_mark_id(C, id)) { | if (ED_asset_mark_id(id)) { | ||||
| WM_main_add_notifier(NC_ID | NA_EDITED, NULL); | WM_main_add_notifier(NC_ID | NA_EDITED, NULL); | ||||
| WM_main_add_notifier(NC_ASSET | NA_ADDED, NULL); | WM_main_add_notifier(NC_ASSET | NA_ADDED, NULL); | ||||
sybren: Add a negation -- the function should return if it cannot mark as asset, not when it can. | |||||
| } | } | ||||
| } | } | ||||
| static void rna_ID_asset_generate_preview(ID *id, bContext *C) | |||||
| { | |||||
| ED_asset_generate_preview(C, id); | |||||
| WM_main_add_notifier(NC_ID | NA_EDITED, NULL); | |||||
| WM_main_add_notifier(NC_ASSET | NA_EDITED, NULL); | |||||
| } | |||||
| static void rna_ID_asset_clear(ID *id) | static void rna_ID_asset_clear(ID *id) | ||||
| { | { | ||||
| if (ED_asset_clear_id(id)) { | if (ED_asset_clear_id(id)) { | ||||
| WM_main_add_notifier(NC_ID | NA_EDITED, NULL); | WM_main_add_notifier(NC_ID | NA_EDITED, NULL); | ||||
| WM_main_add_notifier(NC_ASSET | NA_REMOVED, NULL); | WM_main_add_notifier(NC_ASSET | NA_REMOVED, NULL); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,293 Lines • ▼ Show 20 Lines | static void rna_def_ID(BlenderRNA *brna) | ||||
| parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID"); | parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "asset_mark", "rna_ID_asset_mark"); | func = RNA_def_function(srna, "asset_mark", "rna_ID_asset_mark"); | ||||
| RNA_def_function_ui_description( | RNA_def_function_ui_description( | ||||
| func, | func, | ||||
| "Enable easier reuse of the data-block through the Asset Browser, with the help of " | "Enable easier reuse of the data-block through the Asset Browser, with the help of " | ||||
| "customizable metadata (like previews, descriptions and tags)"); | "customizable metadata (like previews, descriptions and tags)"); | ||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT); | |||||
| func = RNA_def_function(srna, "asset_clear", "rna_ID_asset_clear"); | func = RNA_def_function(srna, "asset_clear", "rna_ID_asset_clear"); | ||||
| RNA_def_function_ui_description( | RNA_def_function_ui_description( | ||||
| func, | func, | ||||
| "Delete all asset metadata and turn the asset data-block back into a normal data-block"); | "Delete all asset metadata and turn the asset data-block back into a normal data-block"); | ||||
| func = RNA_def_function(srna, "asset_generate_preview", "rna_ID_asset_generate_preview"); | |||||
| RNA_def_function_ui_description( | |||||
| func, "Generate preview image (might be scheduled in a background thread)"); | |||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT); | |||||
| func = RNA_def_function(srna, "override_create", "rna_ID_override_create"); | func = RNA_def_function(srna, "override_create", "rna_ID_override_create"); | ||||
| RNA_def_function_ui_description(func, | RNA_def_function_ui_description(func, | ||||
| "Create an overridden local copy of this linked data-block (not " | "Create an overridden local copy of this linked data-block (not " | ||||
| "supported for all data-blocks)"); | "supported for all data-blocks)"); | ||||
| RNA_def_function_flag(func, FUNC_USE_MAIN); | RNA_def_function_flag(func, FUNC_USE_MAIN); | ||||
| parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the ID"); | parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the ID"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| RNA_def_boolean(func, | RNA_def_boolean(func, | ||||
| ▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines | |||||
Add a negation -- the function should return if it cannot mark as asset, not when it can.