Merge branch 'blender-v4.2-release'
This commit is contained in:
@@ -319,6 +319,7 @@ class EEVEE_NEXT_MATERIAL_PT_settings_surface(MaterialButtonsPanel, Panel):
|
||||
col = layout.column(heading="Backface Culling")
|
||||
col.prop(mat, "use_backface_culling", text="Camera")
|
||||
col.prop(mat, "use_backface_culling_shadow", text="Shadow")
|
||||
col.prop(mat, "use_backface_culling_lightprobe_volume", text="Light Probe Volume")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.prop(mat, "displacement_method", text="Displacement")
|
||||
@@ -343,9 +344,6 @@ class EEVEE_NEXT_MATERIAL_PT_settings_surface(MaterialButtonsPanel, Panel):
|
||||
if mat.surface_render_method == 'DITHERED':
|
||||
col.prop(mat, "use_thickness_from_shadow", text="From Shadow")
|
||||
|
||||
col = layout.column(heading="Light Probe Volume")
|
||||
col.prop(mat, "lightprobe_volume_single_sided", text="Single Sided")
|
||||
|
||||
|
||||
class EEVEE_NEXT_MATERIAL_PT_settings_volume(MaterialButtonsPanel, Panel):
|
||||
bl_label = "Volume"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_array_utils.hh"
|
||||
#include "BLI_math_euler.hh"
|
||||
#include "BLI_math_matrix.hh"
|
||||
#include "BLI_math_quaternion.hh"
|
||||
|
||||
@@ -47,7 +48,10 @@ float4x4 mix3(const float3 &weights, const float4x4 &v0, const float4x4 &v1, con
|
||||
{
|
||||
const float3 location = mix3(weights, v0.location(), v1.location(), v2.location());
|
||||
const math::Quaternion rotation = mix3(
|
||||
weights, math::to_quaternion(v0), math::to_quaternion(v1), math::to_quaternion(v2));
|
||||
weights,
|
||||
math::normalized_to_quaternion_safe(math::normalize(float3x3(v0))),
|
||||
math::normalized_to_quaternion_safe(math::normalize(float3x3(v1))),
|
||||
math::normalized_to_quaternion_safe(math::normalize(float3x3(v2))));
|
||||
const float3 scale = mix3(weights, math::to_scale(v0), math::to_scale(v1), math::to_scale(v2));
|
||||
return math::from_loc_rot_scale<float4x4>(location, rotation, scale);
|
||||
}
|
||||
|
||||
@@ -144,6 +144,7 @@ typedef struct TicketMutex TicketMutex;
|
||||
TicketMutex *BLI_ticket_mutex_alloc(void);
|
||||
void BLI_ticket_mutex_free(TicketMutex *ticket);
|
||||
void BLI_ticket_mutex_lock(TicketMutex *ticket);
|
||||
bool BLI_ticket_mutex_lock_check_recursive(TicketMutex *ticket);
|
||||
void BLI_ticket_mutex_unlock(TicketMutex *ticket);
|
||||
|
||||
/* Condition */
|
||||
|
||||
@@ -504,6 +504,8 @@ struct TicketMutex {
|
||||
pthread_cond_t cond;
|
||||
pthread_mutex_t mutex;
|
||||
uint queue_head, queue_tail;
|
||||
pthread_t owner;
|
||||
bool has_owner;
|
||||
};
|
||||
|
||||
TicketMutex *BLI_ticket_mutex_alloc()
|
||||
@@ -524,24 +526,46 @@ void BLI_ticket_mutex_free(TicketMutex *ticket)
|
||||
MEM_freeN(ticket);
|
||||
}
|
||||
|
||||
void BLI_ticket_mutex_lock(TicketMutex *ticket)
|
||||
static bool ticket_mutex_lock(TicketMutex *ticket, const bool check_recursive)
|
||||
{
|
||||
uint queue_me;
|
||||
|
||||
pthread_mutex_lock(&ticket->mutex);
|
||||
|
||||
/* Check for recursive locks, for debugging only. */
|
||||
if (check_recursive && ticket->has_owner && pthread_equal(pthread_self(), ticket->owner)) {
|
||||
pthread_mutex_unlock(&ticket->mutex);
|
||||
return false;
|
||||
}
|
||||
|
||||
queue_me = ticket->queue_tail++;
|
||||
|
||||
while (queue_me != ticket->queue_head) {
|
||||
pthread_cond_wait(&ticket->cond, &ticket->mutex);
|
||||
}
|
||||
|
||||
ticket->owner = pthread_self();
|
||||
ticket->has_owner = true;
|
||||
|
||||
pthread_mutex_unlock(&ticket->mutex);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BLI_ticket_mutex_lock(TicketMutex *ticket)
|
||||
{
|
||||
ticket_mutex_lock(ticket, false);
|
||||
}
|
||||
|
||||
bool BLI_ticket_mutex_lock_check_recursive(TicketMutex *ticket)
|
||||
{
|
||||
return ticket_mutex_lock(ticket, true);
|
||||
}
|
||||
|
||||
void BLI_ticket_mutex_unlock(TicketMutex *ticket)
|
||||
{
|
||||
pthread_mutex_lock(&ticket->mutex);
|
||||
ticket->queue_head++;
|
||||
ticket->has_owner = false;
|
||||
pthread_cond_broadcast(&ticket->cond);
|
||||
pthread_mutex_unlock(&ticket->mutex);
|
||||
}
|
||||
|
||||
@@ -3843,6 +3843,14 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 31)) {
|
||||
bool only_uses_eevee_legacy_or_workbench = true;
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
if (!(STREQ(scene->r.engine, RE_engine_id_BLENDER_EEVEE) ||
|
||||
STREQ(scene->r.engine, RE_engine_id_BLENDER_WORKBENCH)))
|
||||
{
|
||||
only_uses_eevee_legacy_or_workbench = false;
|
||||
}
|
||||
}
|
||||
/* Mark old EEVEE world volumes for showing conversion operator. */
|
||||
LISTBASE_FOREACH (World *, world, &bmain->worlds) {
|
||||
if (world->nodetree) {
|
||||
@@ -3854,6 +3862,14 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
LISTBASE_FOREACH (bNodeLink *, node_link, &world->nodetree->links) {
|
||||
if (node_link->tonode == output_node && node_link->tosock == volume_input_socket) {
|
||||
world->flag |= WO_USE_EEVEE_FINITE_VOLUME;
|
||||
/* Only display a warning message if we are sure this can be used by EEVEE. */
|
||||
if (only_uses_eevee_legacy_or_workbench) {
|
||||
BLO_reportf_wrap(fd->reports,
|
||||
RPT_WARNING,
|
||||
RPT_("%s contains a volume shader that might need to be "
|
||||
"converted to object (see world volume panel)\n"),
|
||||
world->id.name + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3920,7 +3936,10 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
world->sun_threshold = default_world->sun_threshold;
|
||||
world->sun_angle = default_world->sun_angle;
|
||||
world->sun_shadow_maximum_resolution = default_world->sun_shadow_maximum_resolution;
|
||||
world->flag |= WO_USE_SUN_SHADOW;
|
||||
/* Having the sun extracted is mandatory to keep the same look and avoid too much light
|
||||
* leaking compared to EEVEE-Legacy. But adding shadows might create performance overhead and
|
||||
* change the result in a very different way. So we disable shadows in older file. */
|
||||
world->flag &= ~WO_USE_SUN_SHADOW;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "CLG_log.h"
|
||||
|
||||
#include "BLI_alloca.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_memblock.h"
|
||||
@@ -103,6 +105,8 @@
|
||||
|
||||
#include "DRW_select_buffer.hh"
|
||||
|
||||
static CLG_LogRef LOG = {"draw.manager"};
|
||||
|
||||
/** Render State: No persistent data between draw calls. */
|
||||
DRWManager DST = {nullptr};
|
||||
|
||||
@@ -1327,10 +1331,17 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
|
||||
|
||||
const bool gpencil_engine_needed = drw_gpencil_engine_needed(depsgraph, v3d);
|
||||
|
||||
/* XXX Really nasty locking. But else this could
|
||||
* be executed by the material previews thread
|
||||
* while rendering a viewport. */
|
||||
BLI_ticket_mutex_lock(DST.system_gpu_context_mutex);
|
||||
/* XXX Really nasty locking. But else this could be executed by the
|
||||
* material previews thread while rendering a viewport.
|
||||
*
|
||||
* Check for recursive lock which can deadlock. This should not
|
||||
* happen, but in case there is a bug where depsgraph update is called
|
||||
* during drawing we try not to hang Blender. */
|
||||
if (!BLI_ticket_mutex_lock_check_recursive(DST.system_gpu_context_mutex)) {
|
||||
CLOG_ERROR(&LOG, "GPU context already bound");
|
||||
BLI_assert_unreachable();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Reset before using it. */
|
||||
drw_state_prepare_clean_for_draw(&DST);
|
||||
|
||||
@@ -828,7 +828,7 @@ void ED_info_draw_stats(
|
||||
}
|
||||
else if (!(object_mode & OB_MODE_SCULPT)) {
|
||||
/* No objects in scene. */
|
||||
stats_row(col1, labels[OBJ], col2, 0, nullptr, y, height);
|
||||
stats_row(col1, labels[OBJ], col2, stats_fmt.totobj, nullptr, y, height);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ static void rna_def_lightprobe(BlenderRNA *brna)
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "data_display_size", PROP_FLOAT, PROP_DISTANCE);
|
||||
prop = RNA_def_property(srna, "data_display_size", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "data_display_size");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 3);
|
||||
|
||||
@@ -996,6 +996,16 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
prop, "Shadow Backface Culling", "Use back face culling when casting shadows");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_backface_culling_lightprobe_volume", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(
|
||||
prop, nullptr, "blend_flag", MA_BL_LIGHTPROBE_VOLUME_DOUBLE_SIDED);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Light Probe Volume Backface Culling",
|
||||
"Consider material single sided for light probe volume capture. "
|
||||
"Additionally helps rejecting probes inside the object to avoid light leaks");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_transparent_shadow", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_TRANSPARENT_SHADOW);
|
||||
RNA_def_property_ui_text(
|
||||
@@ -1005,16 +1015,6 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
"disabling will render faster but not give accurate shadows");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "lightprobe_volume_single_sided", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(
|
||||
prop, nullptr, "blend_flag", MA_BL_LIGHTPROBE_VOLUME_DOUBLE_SIDED);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Light Probe Volume Single Sided",
|
||||
"Consider material single sided for light probe volume capture. "
|
||||
"Additionally helps rejecting probes inside the object to avoid light leaks");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_raytrace_refraction", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MA_BL_SS_REFRACTION);
|
||||
RNA_def_property_ui_text(
|
||||
|
||||
@@ -33,6 +33,7 @@ static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, Pointer
|
||||
DEG_get_evaluated_rna_pointer(depsgraph, &obptr, &eval_obptr);
|
||||
PointerRNA dataptr = RNA_pointer_get(&eval_obptr, "data");
|
||||
uiItemPointerR(layout, ptr, "layer_name", &dataptr, "color_attributes", "", ICON_GROUP_VCOL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user