Merge branch 'blender-v4.1-release'
This commit is contained in:
@@ -430,8 +430,15 @@ bool ED_mesh_color_ensure(Mesh *mesh, const char *name)
|
||||
{
|
||||
using namespace blender;
|
||||
BLI_assert(mesh->edit_mesh == nullptr);
|
||||
if (mesh->attributes().contains(mesh->active_color_attribute)) {
|
||||
return true;
|
||||
const bke::AttributeAccessor attributes = mesh->attributes();
|
||||
if (const std::optional<bke::AttributeMetaData> meta_data = attributes.lookup_meta_data(
|
||||
mesh->active_color_attribute))
|
||||
{
|
||||
if ((ATTR_DOMAIN_AS_MASK(meta_data->domain) & ATTR_DOMAIN_MASK_COLOR) &&
|
||||
(CD_TYPE_AS_MASK(meta_data->data_type) & CD_MASK_COLOR_ALL))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string unique_name = BKE_id_attribute_calc_unique_name(mesh->id, name);
|
||||
|
||||
@@ -598,6 +598,24 @@ void smooth_brush_toggle_on(const bContext *C, Paint *paint, StrokeCache *cache)
|
||||
/** \} */
|
||||
} // namespace blender::ed::sculpt_paint::vwpaint
|
||||
|
||||
static bool color_attribute_supported(const std::optional<bke::AttributeMetaData> meta_data)
|
||||
{
|
||||
if (!meta_data) {
|
||||
return false;
|
||||
}
|
||||
if (!(ATTR_DOMAIN_AS_MASK(meta_data->domain) & ATTR_DOMAIN_MASK_COLOR) ||
|
||||
!(CD_TYPE_AS_MASK(meta_data->data_type) & CD_MASK_COLOR_ALL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool color_attribute_supported(const Mesh &mesh, const StringRef name)
|
||||
{
|
||||
return color_attribute_supported(mesh.attributes().lookup_meta_data(name));
|
||||
}
|
||||
|
||||
bool vertex_paint_mode_poll(bContext *C)
|
||||
{
|
||||
const Object *ob = CTX_data_active_object(C);
|
||||
@@ -610,7 +628,7 @@ bool vertex_paint_mode_poll(bContext *C)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mesh->attributes().contains(mesh->active_color_attribute)) {
|
||||
if (!color_attribute_supported(*mesh, mesh->active_color_attribute)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -992,8 +1010,7 @@ static bool vpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
|
||||
|
||||
const std::optional<bke::AttributeMetaData> meta_data = *mesh->attributes().lookup_meta_data(
|
||||
mesh->active_color_attribute);
|
||||
|
||||
if (!meta_data) {
|
||||
if (!color_attribute_supported(meta_data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1543,6 +1543,13 @@ void wm_draw_update(bContext *C)
|
||||
|
||||
BKE_image_free_unused_gpu_textures();
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
/* Reset drawable to ensure GPU context activation happens at least once per frame if only a
|
||||
* single context exists. This is required to ensure the default framebuffer is updated
|
||||
* to be the latest backbuffer. */
|
||||
wm_window_clear_drawable(wm);
|
||||
#endif
|
||||
|
||||
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
|
||||
#ifdef WIN32
|
||||
GHOST_TWindowState state = GHOST_GetWindowState(
|
||||
|
||||
Reference in New Issue
Block a user