UI: Asset Shelf (Experimental Feature) #104831

Closed
Julian Eisel wants to merge 399 commits from asset-shelf into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
131 changed files with 912 additions and 958 deletions
Showing only changes of commit 0ab8643dcd - Show all commits

View File

@ -81,7 +81,7 @@ class DeviceInfo {
bool has_gpu_queue; /* Device supports GPU queue. */
bool use_metalrt; /* Use MetalRT to accelerate ray queries (Metal only). */
KernelOptimizationLevel kernel_optimization_level; /* Optimization level applied to path tracing
kernels (Metal only). */
* kernels (Metal only). */
DenoiserTypeMask denoisers; /* Supported denoiser types. */
int cpu_threads;
vector<DeviceInfo> multi_devices;

View File

@ -278,7 +278,7 @@ int MetalDeviceQueue::num_concurrent_states(const size_t state_size) const
if (metal_device_->device_vendor == METAL_GPU_APPLE) {
result *= 4;
/* Increasing the state count doesn't notably benefit M1-family systems. */
/* Increasing the state count doesn't notably benefit M1-family systems. */
if (MetalInfo::get_apple_gpu_architecture(metal_device_->mtlDevice) != APPLE_M1) {
size_t system_ram = system_physical_ram();
size_t allocated_so_far = [metal_device_->mtlDevice currentAllocatedSize];

View File

@ -1437,6 +1437,9 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
BVHOptiX *const blas = static_cast<BVHOptiX *>(ob->get_geometry()->bvh);
OptixTraversableHandle handle = blas->traversable_handle;
if (handle == 0) {
continue;
}
OptixInstance &instance = instances[num_instances++];
memset(&instance, 0, sizeof(instance));

View File

@ -1343,7 +1343,7 @@ void PathTrace::guiding_prepare_structures()
* per update to be limited, for reproducible results and reasonable training size.
*
* Idea: we could stochastically discard samples with a probability of 1/num_samples_per_update
* we can then update only after the num_samples_per_update iterations are rendered. */
* we can then update only after the num_samples_per_update iterations are rendered. */
render_scheduler_.set_limit_samples_per_update(4);
}
else {

View File

@ -94,7 +94,7 @@ class PathTrace {
void set_adaptive_sampling(const AdaptiveSampling &adaptive_sampling);
/* Set the parameters for guiding.
* Use to setup the guiding structures before each rendering iteration.*/
* Use to setup the guiding structures before each rendering iteration. */
void set_guiding_params(const GuidingParams &params, const bool reset);
/* Sets output driver for render buffer output. */
@ -119,7 +119,7 @@ class PathTrace {
*/
void cancel();
/* Copy an entire render buffer to/from the path trace. */
/* Copy an entire render buffer to/from the path trace. */
/* Copy happens via CPU side buffer: data will be copied from every device of the path trace, and
* the data will be copied to the device of the given render buffers. */
@ -294,7 +294,7 @@ class PathTrace {
* rendering iteration. */
unique_ptr<openpgl::cpp::SampleStorage> guiding_sample_data_storage_;
/* The number of already performed training iterations for the guiding field.*/
/* The number of already performed training iterations for the guiding field. */
int guiding_update_count = 0;
#endif

View File

@ -202,7 +202,7 @@ ccl_device float2 direction_to_mirrorball(float3 dir)
}
/* Single face of a equiangular cube map projection as described in
https://blog.google/products/google-ar-vr/bringing-pixels-front-and-center-vr-video/ */
* https://blog.google/products/google-ar-vr/bringing-pixels-front-and-center-vr-video/ */
ccl_device float3 equiangular_cubemap_face_to_direction(float u, float v)
{
u = (1.0f - u);

View File

@ -136,7 +136,7 @@ ccl_device_forceinline float3 microfacet_beckmann_sample_vndf(const float3 wi,
/* Find root in a monotonic interval using newton method, under given precision and maximal
* iterations. Falls back to bisection if newton step produces results outside of the valid
* interval.*/
* interval. */
const float precision = 1e-6f;
const int max_iter = 3;
int iter = 0;

View File

@ -53,7 +53,7 @@ ccl_device_forceinline void guiding_record_surface_segment(KernelGlobals kg,
#endif
}
/* Records the surface scattering event at the current vertex position of the segment.*/
/* Records the surface scattering event at the current vertex position of the segment. */
ccl_device_forceinline void guiding_record_surface_bounce(KernelGlobals kg,
IntegratorState state,
ccl_private const ShaderData *sd,
@ -134,7 +134,7 @@ ccl_device_forceinline void guiding_record_bssrdf_segment(KernelGlobals kg,
}
/* Records the transmission of the path at the point of entry while passing
* the surface boundary.*/
* the surface boundary. */
ccl_device_forceinline void guiding_record_bssrdf_weight(KernelGlobals kg,
IntegratorState state,
const Spectrum weight,
@ -161,7 +161,7 @@ ccl_device_forceinline void guiding_record_bssrdf_weight(KernelGlobals kg,
/* Records the direction at the point of entry the path takes when sampling the SSS contribution.
* If not terminated this function is usually followed by a call of
* guiding_record_volume_transmission to record the transmittance between the point of entry and
* the point of exit.*/
* the point of exit. */
ccl_device_forceinline void guiding_record_bssrdf_bounce(KernelGlobals kg,
IntegratorState state,
const float pdf,
@ -216,7 +216,7 @@ ccl_device_forceinline void guiding_record_volume_segment(KernelGlobals kg,
#endif
}
/* Records the volume scattering event at the current vertex position of the segment.*/
/* Records the volume scattering event at the current vertex position of the segment. */
ccl_device_forceinline void guiding_record_volume_bounce(KernelGlobals kg,
IntegratorState state,
ccl_private const ShaderData *sd,
@ -247,7 +247,7 @@ ccl_device_forceinline void guiding_record_volume_bounce(KernelGlobals kg,
}
/* Records the transmission (a.k.a. transmittance weight) between the current path segment
* and the next one, when the path is inside or passes a volume.*/
* and the next one, when the path is inside or passes a volume. */
ccl_device_forceinline void guiding_record_volume_transmission(KernelGlobals kg,
IntegratorState state,
const float3 transmittance_weight)
@ -330,7 +330,7 @@ ccl_device_forceinline void guiding_record_light_surface_segment(
/* Records/Adds a final path segment when the path leaves the scene and
* intersects with a background light (e.g., background color,
* distant light, or env map). The vertex for this segment is placed along
* the current ray far out the scene.*/
* the current ray far out the scene. */
ccl_device_forceinline void guiding_record_background(KernelGlobals kg,
IntegratorState state,
const Spectrum L,
@ -359,7 +359,7 @@ ccl_device_forceinline void guiding_record_background(KernelGlobals kg,
/* Records the scattered contribution of a next event estimation
* (i.e., a direct light estimate scattered at the current path vertex
* towards the previous vertex).*/
* towards the previous vertex). */
ccl_device_forceinline void guiding_record_direct_light(KernelGlobals kg,
IntegratorShadowState state)
{
@ -397,7 +397,7 @@ ccl_device_forceinline void guiding_record_continuation_probability(
/* Path guiding debug render passes. */
/* Write a set of path guiding related debug information (e.g., guiding probability at first
* bounce) into separate rendering passes.*/
* bounce) into separate rendering passes. */
ccl_device_forceinline void guiding_write_debug_passes(KernelGlobals kg,
IntegratorState state,
ccl_private const ShaderData *sd,

View File

@ -1019,7 +1019,7 @@ ccl_device VolumeIntegrateEvent volume_integrate(KernelGlobals kg,
const float step_size = volume_stack_step_size(kg, volume_read_lambda_pass);
# if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
/* The current path throughput which is used later to calculate per-segment throughput.*/
/* The current path throughput which is used later to calculate per-segment throughput. */
const float3 initial_throughput = INTEGRATOR_STATE(state, path, throughput);
/* The path throughput used to calculate the throughput for direct light. */
float3 unlit_throughput = initial_throughput;
@ -1063,7 +1063,7 @@ ccl_device VolumeIntegrateEvent volume_integrate(KernelGlobals kg,
if (result.direct_sample_method == VOLUME_SAMPLE_DISTANCE) {
/* If the direct scatter event is generated using VOLUME_SAMPLE_DISTANCE the direct event
* will happen at the same position as the indirect event and the direct light contribution
* will contribute to the position of the next path segment.*/
* will contribute to the position of the next path segment. */
float3 transmittance_weight = spectrum_to_rgb(
safe_divide_color(result.indirect_throughput, initial_throughput));
guiding_record_volume_transmission(kg, state, transmittance_weight);
@ -1076,7 +1076,8 @@ ccl_device VolumeIntegrateEvent volume_integrate(KernelGlobals kg,
/* If the direct scatter event is generated using VOLUME_SAMPLE_EQUIANGULAR the direct
* event will happen at a separate position as the indirect event and the direct light
* contribution will contribute to the position of the current/previous path segment. The
* unlit_throughput has to be adjusted to include the scattering at the previous segment.*/
* unlit_throughput has to be adjusted to include the scattering at the previous segment.
*/
float3 scatterEval = one_float3();
if (state->guiding.path_segment) {
pgl_vec3f scatteringWeight = state->guiding.path_segment->scatteringWeight;

View File

@ -126,16 +126,16 @@ typedef struct IntegratorStateGPU {
/* Count number of kernels queued for specific shaders. */
ccl_global int *sort_key_counter[DEVICE_KERNEL_INTEGRATOR_NUM];
/* Index of shadow path which will be used by a next shadow path. */
/* Index of shadow path which will be used by a next shadow path. */
ccl_global int *next_shadow_path_index;
/* Index of main path which will be used by a next shadow catcher split. */
/* Index of main path which will be used by a next shadow catcher split. */
ccl_global int *next_main_path_index;
/* Partition/key offsets used when writing sorted active indices. */
ccl_global int *sort_partition_key_offsets;
/* Divisor used to partition active indices by locality when sorting by material. */
/* Divisor used to partition active indices by locality when sorting by material. */
uint sort_partition_divisor;
} IntegratorStateGPU;

View File

@ -38,7 +38,7 @@ ccl_device_inline void surface_shader_prepare_guiding(KernelGlobals kg,
const float surface_guiding_probability = kernel_data.integrator.surface_guiding_probability;
float rand_bsdf_guiding = path_state_rng_1D(kg, rng_state, PRNG_SURFACE_BSDF_GUIDING);
/* Compute proportion of diffuse BSDF and BSSRDFs .*/
/* Compute proportion of diffuse BSDF and BSSRDFs. */
float diffuse_sampling_fraction = 0.0f;
float bssrdf_sampling_fraction = 0.0f;
float bsdf_bssrdf_sampling_sum = 0.0f;

View File

@ -259,7 +259,7 @@ int LightTree::recursive_build(
bool should_split = false;
if (try_splitting) {
/* Find the best place to split the primitives into 2 nodes.
* If the best split cost is no better than making a leaf node, make a leaf instead.*/
* If the best split cost is no better than making a leaf node, make a leaf instead. */
float min_cost = min_split_saoh(
centroid_bounds, start, end, bbox, bcone, split_dim, split_bucket, num_left_prims, prims);
should_split = num_prims > max_lights_in_leaf_ || min_cost < energy_total;

View File

@ -351,7 +351,7 @@ class Scene : public NodeOwner {
/* Get maximum number of closures to be used in kernel. */
int get_max_closure_count();
/* Get size of a volume stack needed to render this scene. */
/* Get size of a volume stack needed to render this scene. */
int get_volume_stack_size() const;
template<typename T> void delete_node_impl(T *node)

View File

@ -507,7 +507,7 @@ void Session::do_delayed_reset()
params = delayed_reset_.session_params;
buffer_params_ = delayed_reset_.buffer_params;
/* Store parameters used for buffers access outside of scene graph. */
/* Store parameters used for buffers access outside of scene graph. */
buffer_params_.samples = params.samples;
buffer_params_.exposure = scene->film->get_exposure();
buffer_params_.use_approximate_shadow_catcher =

View File

@ -943,6 +943,11 @@ extern void GHOST_SetBacktraceHandler(GHOST_TBacktraceFn backtrace_fn);
*/
extern void GHOST_UseWindowFocus(bool use_focus);
/**
* Focus and raise windows on mouse hover.
*/
extern void GHOST_SetAutoFocus(bool auto_focus);
/**
* If window was opened using native pixel size, it returns scaling factor.
*/

View File

@ -332,6 +332,11 @@ class GHOST_ISystem {
*/
virtual void useWindowFocus(const bool use_focus) = 0;
/**
* Focus and raise windows on mouse hover.
*/
virtual void setAutoFocus(const bool auto_focus) = 0;
/**
* Get the Window under the cursor.
* \param x: The x-coordinate of the cursor.

View File

@ -918,6 +918,12 @@ void GHOST_UseWindowFocus(bool use_focus)
return system->useWindowFocus(use_focus);
}
void GHOST_SetAutoFocus(bool auto_focus)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
system->setAutoFocus(auto_focus);
}
float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;

View File

@ -878,7 +878,7 @@ GHOST_TSuccess GHOST_ContextVK::initializeDrawingContext()
}
extensions_device.push_back("VK_KHR_dedicated_allocation");
extensions_device.push_back("VK_KHR_get_memory_requirements2");
/* Enable MoltenVK required instance extensions.*/
/* Enable MoltenVK required instance extensions. */
#ifdef VK_MVK_MOLTENVK_EXTENSION_NAME
requireExtension(
extensions_available, extensions_enabled, "VK_KHR_get_physical_device_properties2");

View File

@ -23,6 +23,7 @@
GHOST_System::GHOST_System()
: m_nativePixel(false),
m_windowFocus(true),
m_autoFocus(true),
m_displayManager(nullptr),
m_timerManager(nullptr),
m_windowManager(nullptr),
@ -412,6 +413,11 @@ void GHOST_System::useWindowFocus(const bool use_focus)
m_windowFocus = use_focus;
}
void GHOST_System::setAutoFocus(const bool auto_focus)
{
m_autoFocus = auto_focus;
}
bool GHOST_System::supportsCursorWarp()
{
return true;

View File

@ -160,6 +160,12 @@ class GHOST_System : public GHOST_ISystem {
bool m_windowFocus;
/**
* Focus and raise windows on mouse hover.
*/
void setAutoFocus(const bool auto_focus);
bool m_autoFocus;
/**
* Get the Window under the cursor.
* \param x: The x-coordinate of the cursor.

View File

@ -1828,10 +1828,13 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, uint msg, WPARAM wParam,
if (!window->m_mousePresent) {
WINTAB_PRINTF("HWND %p mouse enter\n", window->getHWND());
TRACKMOUSEEVENT tme = {sizeof(tme)};
/* Request WM_MOUSELEAVE message when the cursor leaves the client area, and
* WM_MOUSEHOVER message after 50ms when in the client area. */
tme.dwFlags = TME_LEAVE | TME_HOVER;
tme.dwHoverTime = 50;
/* Request WM_MOUSELEAVE message when the cursor leaves the client area. */
tme.dwFlags = TME_LEAVE;
if (system->m_autoFocus) {
/* Request WM_MOUSEHOVER message after 100ms when in the client area. */
tme.dwFlags |= TME_HOVER;
tme.dwHoverTime = 100;
}
tme.hwndTrack = hwnd;
TrackMouseEvent(&tme);
window->m_mousePresent = true;

View File

@ -157,6 +157,7 @@ const UserDef U_default = {
.glalphaclip = 0.004,
.autokey_mode = (AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON),
.autokey_flag = AUTOKEY_FLAG_XYZ2RGB,
.animation_flag = USER_ANIM_HIGH_QUALITY_DRAWING,
.text_render = 0,
.navigation_mode = VIEW_NAVIGATION_WALK,
.view_rotate_sensitivity_turntable = DEG2RAD(0.4),

View File

@ -107,16 +107,9 @@ class GRAPH_MT_view(Menu):
layout.separator()
layout.prop(st, "show_markers")
layout.separator()
layout.prop(st, "use_beauty_drawing")
layout.separator()
layout.prop(st, "show_extrapolation")
layout.prop(st, "show_handles")
layout.prop(st, "use_only_selected_curves_handles")
layout.prop(st, "use_only_selected_keyframe_handles")
layout.prop(st, "show_seconds")

View File

@ -559,6 +559,8 @@ class USERPREF_PT_animation_fcurves(AnimationPanel, CenterAlignMixIn, Panel):
flow.prop(edit, "keyframe_new_handle_type", text="Default Handles")
flow.prop(edit, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
flow.prop(edit, "use_anim_channel_group_colors")
flow.prop(edit, "show_only_selected_curve_keyframes")
flow.prop(edit, "use_fcurve_high_quality_drawing")
# -----------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ static FT_Library ft_lib = NULL;
static FTC_Manager ftc_manager = NULL;
static FTC_CMapCache ftc_charmap_cache = NULL;
/* Lock for FreeType library, used around face creation and deletion. */
/* Lock for FreeType library, used around face creation and deletion. */
static ThreadMutex ft_lib_mutex;
/* May be set to #UI_widgetbase_draw_cache_flush. */
@ -1566,7 +1566,7 @@ FontBLF *blf_font_new_ex(const char *name,
}
}
/* Detect "Last resort" fonts. They have everything. Usually except last 5 bits. */
/* Detect "Last resort" fonts. They have everything. Usually except last 5 bits. */
if (font->unicode_ranges[0] == 0xffffffffU && font->unicode_ranges[1] == 0xffffffffU &&
font->unicode_ranges[2] == 0xffffffffU && font->unicode_ranges[3] >= 0x7FFFFFFU) {
font->flags |= BLF_LAST_RESORT;

View File

@ -300,7 +300,7 @@ typedef struct FontBLF {
/** Font size. */
float size;
/** Axes data for Adobe MM, TrueType GX, or OpenType variation fonts. */
/** Axes data for Adobe MM, TrueType GX, or OpenType variation fonts. */
FT_MM_Var *variations;
/** Character variation; 0=default, -1=min, +1=max. */

View File

@ -246,7 +246,7 @@ static const char32_t *blf_get_sample_text(FT_Face face)
return def;
}
/* Detect "Last resort" fonts. They have everything, except the last 5 bits. */
/* Detect "Last resort" fonts. They have everything, except the last 5 bits. */
if (os2_table->ulUnicodeRange1 == 0xffffffffU && os2_table->ulUnicodeRange2 == 0xffffffffU &&
os2_table->ulUnicodeRange3 == 0xffffffffU && os2_table->ulUnicodeRange4 >= 0x7FFFFFFU) {
return U"\xE000\xFFFF";

View File

@ -25,7 +25,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 1
#define BLENDER_FILE_SUBVERSION 2
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file

View File

@ -83,8 +83,10 @@ typedef enum {
BKE_CB_EVT_RENDER_CANCEL,
BKE_CB_EVT_LOAD_PRE,
BKE_CB_EVT_LOAD_POST,
BKE_CB_EVT_LOAD_POST_FAIL,
BKE_CB_EVT_SAVE_PRE,
BKE_CB_EVT_SAVE_POST,
BKE_CB_EVT_SAVE_POST_FAIL,
BKE_CB_EVT_UNDO_PRE,
BKE_CB_EVT_UNDO_POST,
BKE_CB_EVT_REDO_PRE,
@ -123,6 +125,7 @@ void BKE_callback_exec_id_depsgraph(struct Main *bmain,
struct ID *id,
struct Depsgraph *depsgraph,
eCbEvent evt);
void BKE_callback_exec_string(struct Main *bmain, eCbEvent evt, const char *str);
void BKE_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt);
void BKE_callback_remove(bCallbackFuncStore *funcstore, eCbEvent evt);

View File

@ -133,21 +133,26 @@ void BKE_curvemapping_table_RGBA(const struct CurveMapping *cumap, float **array
void BKE_curvemapping_get_range_minimums(const struct CurveMapping *curve_mapping,
float minimums[4]);
/** Get the reciprocal of the difference between the maximum and the minimum x value of each curve
/**
* Get the reciprocal of the difference between the maximum and the minimum x value of each curve
* map table. Evaluation parameters can be multiplied by this value to be normalized. If the
* difference is zero, 1^8 is returned. */
* difference is zero, 1^8 is returned.
*/
void BKE_curvemapping_compute_range_dividers(const struct CurveMapping *curve_mapping,
float dividers[4]);
/** Compute the slopes at the start and end points of each curve map. The slopes are multiplied by
/**
* Compute the slopes at the start and end points of each curve map. The slopes are multiplied by
* the range of the curve map to compensate for parameter normalization. If the slope is vertical,
* 1^8 is returned. */
* 1^8 is returned.
*/
void BKE_curvemapping_compute_slopes(const struct CurveMapping *curve_mapping,
float start_slopes[4],
float end_slopes[4]);
/** Check if the curve map at the index is identity, that is, does nothing. A curve map is said to
* be identity if:
/**
* Check if the curve map at the index is identity, that is, does nothing.
* A curve map is said to be identity if:
* - The curve mapping uses extrapolation.
* - Its range is 1.
* - The slope at its start point is 1.

View File

@ -139,11 +139,15 @@ enum {
/** Do not process ID pointers inside embedded IDs. Needed by depsgraph processing e.g. */
IDWALK_IGNORE_EMBEDDED_ID = (1 << 3),
/** Also process internal ID pointers like `ID.newid` or `ID.orig_id`.
* WARNING: Dangerous, use with caution. */
/**
* Also process internal ID pointers like `ID.newid` or `ID.orig_id`.
* WARNING: Dangerous, use with caution.
*/
IDWALK_DO_INTERNAL_RUNTIME_POINTERS = (1 << 9),
/** Also process the ID.lib pointer. It is an option because this pointer can usually be fully
ignored. */
/**
* Also process the ID.lib pointer. It is an option because this pointer can usually be fully
* ignored.
*/
IDWALK_DO_LIBRARY_POINTER = (1 << 10),
};

View File

@ -63,6 +63,9 @@ bool allow_procedural_attribute_access(StringRef attribute_name)
if (attribute_name.startswith(".hide")) {
return false;
}
if (attribute_name.startswith(".uv")) {
return false;
}
if (attribute_name.startswith("." UV_VERTSEL_NAME ".")) {
return false;
}

View File

@ -506,7 +506,7 @@ struct BlendFileData *BKE_blendfile_read(const char *filepath,
{
/* Don't print startup file loading. */
if (params->is_startup == false) {
printf("Read blend: %s\n", filepath);
printf("Read blend: \"%s\"\n", filepath);
}
BlendFileData *bfd = BLO_read_from_file(filepath, eBLOReadSkip(params->skip_flags), reports);
@ -518,7 +518,7 @@ struct BlendFileData *BKE_blendfile_read(const char *filepath,
handle_subversion_warning(bfd->main, reports);
}
else {
BKE_reports_prependf(reports->reports, "Loading '%s' failed: ", filepath);
BKE_reports_prependf(reports->reports, "Loading \"%s\" failed: ", filepath);
}
return bfd;
}
@ -768,7 +768,7 @@ bool BKE_blendfile_userdef_write_all(ReportList *reports)
bool ok_write;
BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_USERPREF_FILE);
printf("Writing userprefs: '%s' ", filepath);
printf("Writing userprefs: \"%s\" ", filepath);
if (use_template_userpref) {
ok_write = BKE_blendfile_userdef_write_app_template(filepath, reports);
}
@ -795,7 +795,7 @@ bool BKE_blendfile_userdef_write_all(ReportList *reports)
/* Also save app-template prefs */
BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_USERPREF_FILE);
printf("Writing userprefs app-template: '%s' ", filepath);
printf("Writing userprefs app-template: \"%s\" ", filepath);
if (BKE_blendfile_userdef_write(filepath, reports) != 0) {
printf("ok\n");
}

View File

@ -69,6 +69,18 @@ void BKE_callback_exec_id_depsgraph(struct Main *bmain,
BKE_callback_exec(bmain, pointers, 2, evt);
}
void BKE_callback_exec_string(struct Main *bmain, eCbEvent evt, const char *str)
{
PointerRNA str_ptr;
PrimitiveStringRNA data = {NULL};
data.value = str;
RNA_pointer_create(NULL, &RNA_PrimitiveString, &data, &str_ptr);
PointerRNA *pointers[1] = {&str_ptr};
BKE_callback_exec(bmain, pointers, 1, evt);
}
void BKE_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt)
{
ASSERT_CALLBACKS_INITIALIZED();

View File

@ -410,7 +410,7 @@ void BKE_curve_init(Curve *cu, const short curve_type)
}
cu->bevel_profile = nullptr;
/* Initialize the offset to 1.0, to compensate for it being set to -1.0
in the property getter. */
* in the property getter. */
cu->offset = 1.0f;
}

View File

@ -589,7 +589,7 @@ static bool get_fcurve_end_keyframes(const FCurve *fcu,
}
/* The binary search returns an index where a keyframe would be inserted,
so it needs to be clamped to ensure it is in range of the array. */
* so it needs to be clamped to ensure it is in range of the array. */
first_index = clamp_i(first_index, 0, fcu->totvert - 1);
last_index = clamp_i(last_index - 1, 0, fcu->totvert - 1);
}

View File

@ -1275,9 +1275,8 @@ bGPDframe *BKE_gpencil_layer_frame_get(bGPDlayer *gpl, int cframe, eGP_GetFrame_
gpl->actframe = gpf;
}
else if (addnew == GP_GETFRAME_ADD_COPY) {
/* The frame_addcopy function copies the active frame of gpl,
so we need to set the active frame before copying.
*/
/* The #BKE_gpencil_frame_addcopy function copies the active frame of gpl,
* so we need to set the active frame before copying. */
gpl->actframe = gpf;
gpl->actframe = BKE_gpencil_frame_addcopy(gpl, cframe);
}
@ -1306,9 +1305,8 @@ bGPDframe *BKE_gpencil_layer_frame_get(bGPDlayer *gpl, int cframe, eGP_GetFrame_
gpl->actframe = gpf;
}
else if (addnew == GP_GETFRAME_ADD_COPY) {
/* The frame_addcopy function copies the active frame of gpl;
so we need to set the active frame before copying.
*/
/* The #BKE_gpencil_frame_addcopy function copies the active frame of gpl;
* so we need to set the active frame before copying. */
gpl->actframe = gpf;
gpl->actframe = BKE_gpencil_frame_addcopy(gpl, cframe);
}

View File

@ -255,14 +255,17 @@ static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address
Set<std::string> names_to_skip;
if (!BLO_write_is_undo(writer)) {
/* When converting to the old mesh format, don't save redundant attributes. */
names_to_skip.add_multiple_new({".hide_vert",
names_to_skip.add_multiple_new({"position",
".hide_vert",
".hide_edge",
".hide_poly",
"position",
"material_index",
".uv_seam",
".select_vert",
".select_edge",
".select_poly"});
".select_poly",
"material_index",
"sharp_face",
"sharp_edge"});
mesh->mvert = BKE_mesh_legacy_convert_positions_to_verts(
mesh, temp_arrays_for_legacy_format, vert_layers);

View File

@ -63,7 +63,7 @@ static void merge_uvs_for_vertex(const Span<int> loops_for_vert, Span<float2 *>
if (loops_for_vert.size() <= 1) {
return;
}
/* Manipulate a copy of the loop indices, de-duplicating UVs per layer. */
/* Manipulate a copy of the loop indices, de-duplicating UVs per layer. */
Vector<int, 32> loops_merge;
loops_merge.reserve(loops_for_vert.size());
for (float2 *mloopuv : mloopuv_layers) {

View File

@ -23,6 +23,11 @@ static const aal::RelationsInNode &get_relations_in_node(const bNode &node, Reso
{
if (node.is_group()) {
if (const bNodeTree *group = reinterpret_cast<const bNodeTree *>(node.id)) {
/* Undefined tree types have no relations. */
if (!ntreeIsRegistered(group)) {
return scope.construct<aal::RelationsInNode>();
}
BLI_assert(group->runtime->anonymous_attribute_relations);
return *group->runtime->anonymous_attribute_relations;
}

View File

@ -4090,7 +4090,7 @@ bool BKE_object_minmax_empty_drawtype(const struct Object *ob, float r_min[3], f
max[0] = radius + (ofs[0] * radius);
max[1] = radius + (ofs[1] * radius);
/* Since the image aspect can shrink the bounds towards the object origin,
* adjust the min/max to account for that. */
* adjust the min/max to account for that. */
for (int i = 0; i < 2; i++) {
CLAMP_MAX(min[i], 0.0f);
CLAMP_MIN(max[i], 0.0f);

View File

@ -2803,8 +2803,7 @@ static void sculpt_attribute_update_refs(Object *ob)
{
SculptSession *ss = ob->sculpt;
/* run twice, in case sculpt_attr_update had to recreate a layer and
messed up the bmesh offsets. */
/* Run twice, in case sculpt_attr_update had to recreate a layer and messed up #BMesh offsets. */
for (int i = 0; i < 2; i++) {
for (int j = 0; j < SCULPT_MAX_ATTRIBUTES; j++) {
SculptAttribute *attr = ss->temp_attributes + j;

View File

@ -586,7 +586,7 @@ static const AVCodec *get_av1_encoder(
}
else {
/* Is not a square num, set greater side based on longer side, or use a square if both
sides are equal. */
* sides are equal. */
int sqrt_p2 = power_of_2_min_i(threads_sqrt);
if (sqrt_p2 < 2) {
/* Ensure a default minimum. */

View File

@ -10,7 +10,7 @@
#ifdef __GNUC__
/* NOTE(@ideasman42): CLANG behaves slightly differently to GCC,
* these can be enabled but do so carefully as they can introduce build-errors. */
* these can be enabled but do so carefully as they can introduce build-errors. */
# if !defined(__clang__)
# pragma GCC diagnostic error "-Wsign-compare"
# pragma GCC diagnostic error "-Wconversion"

View File

@ -783,6 +783,10 @@ void blo_do_versions_userdef(UserDef *userdef)
}
}
if (!USER_VERSION_ATLEAST(306, 2)) {
userdef->animation_flag |= USER_ANIM_HIGH_QUALITY_DRAWING;
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@ -274,7 +274,7 @@ static BMOpDefine bmo_reverse_faces_def = {
* Flip Quad Tessellation
*
* Flip the tessellation direction of the selected quads.
*/
*/
static BMOpDefine bmo_flip_quad_tessellation_def = {
"flip_quad_tessellation",
/* slot_in */

View File

@ -30,7 +30,7 @@ namespace blender::compositor {
* - Distance between the center of the image and the pixel to be evaluated.
* - Distance between the center of the image and the outer-edge.
* - Distance between the center of the image and the inner-edge.
*
* With a simple compare it can be detected if the evaluated pixel is between the outer and inner
* edge.
*/

View File

@ -102,7 +102,7 @@ void GaussianAlphaBlurBaseOperation::update_memory_buffer_partial(MemoryBuffer *
const int coord_min = max_ii(coord - filtersize_, min_input_coord);
const int coord_max = min_ii(coord + filtersize_ + 1, max_input_coord);
/* *** This is the main part which is different to #GaussianBlurBaseOperation. *** */
/* *** This is the main part which is different to #GaussianBlurBaseOperation. *** */
/* Gauss. */
float alpha_accum = 0.0f;
float multiplier_accum = 0.0f;

View File

@ -155,7 +155,7 @@ struct PersistentOperationKey : public OperationKey {
component_name_storage_ = component_node->name;
name_storage_ = operation_node->name;
/* Assign fields used by the #OperationKey API. */
/* Assign fields used by the #OperationKey API. */
id = id_node->id_orig;
component_type = component_node->type;
component_name = component_name_storage_.c_str();

View File

@ -822,7 +822,6 @@ if(WITH_GTESTS)
tests/draw_pass_test.cc
tests/draw_testing.cc
tests/eevee_test.cc
tests/shaders_test.cc
tests/draw_testing.hh
)

View File

@ -227,7 +227,7 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_effect_reflection_resolve)
.auto_resource_location(true)
.do_static_compilation(true);
/* Split reflection resolve support for Intel-based MacBooks.*/
/* Split reflection resolve support for Intel-based MacBooks. */
GPU_SHADER_CREATE_INFO(eevee_legacy_effect_reflection_resolve_probe)
.define("RESOLVE_PROBE")
.additional_info("eevee_legacy_effect_reflection_resolve")

View File

@ -1,416 +0,0 @@
/* SPDX-License-Identifier: Apache-2.0 */
#include "testing/testing.h"
#include "draw_testing.hh"
#include "GPU_context.h"
#include "GPU_index_buffer.h"
#include "GPU_init_exit.h"
#include "GPU_shader.h"
#include "GPU_texture.h"
#include "GPU_vertex_buffer.h"
#include "intern/draw_manager_testing.h"
#include "engines/basic/basic_private.h"
#include "engines/eevee/eevee_private.h"
#include "engines/gpencil/gpencil_engine.h"
#include "engines/image/image_private.hh"
#include "engines/overlay/overlay_private.hh"
#include "engines/workbench/workbench_private.h"
#include "intern/draw_shader.h"
namespace blender::draw {
using namespace blender::draw::image_engine;
static void test_workbench_glsl_shaders()
{
const int MAX_WPD = 6;
WORKBENCH_PrivateData wpds[MAX_WPD];
wpds[0].sh_cfg = GPU_SHADER_CFG_DEFAULT;
wpds[0].shading.light = V3D_LIGHTING_FLAT;
wpds[1].sh_cfg = GPU_SHADER_CFG_DEFAULT;
wpds[1].shading.light = V3D_LIGHTING_MATCAP;
wpds[2].sh_cfg = GPU_SHADER_CFG_DEFAULT;
wpds[2].shading.light = V3D_LIGHTING_STUDIO;
wpds[3].sh_cfg = GPU_SHADER_CFG_CLIPPED;
wpds[3].shading.light = V3D_LIGHTING_FLAT;
wpds[4].sh_cfg = GPU_SHADER_CFG_CLIPPED;
wpds[4].shading.light = V3D_LIGHTING_MATCAP;
wpds[5].sh_cfg = GPU_SHADER_CFG_CLIPPED;
wpds[5].shading.light = V3D_LIGHTING_STUDIO;
for (int wpd_index = 0; wpd_index < MAX_WPD; wpd_index++) {
WORKBENCH_PrivateData *wpd = &wpds[wpd_index];
EXPECT_NE(workbench_shader_opaque_get(wpd, WORKBENCH_DATATYPE_MESH), nullptr);
EXPECT_NE(workbench_shader_opaque_get(wpd, WORKBENCH_DATATYPE_HAIR), nullptr);
EXPECT_NE(workbench_shader_opaque_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD), nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_MESH, false), nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_MESH, true), nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_HAIR, false), nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_HAIR, true), nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, false),
nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, true),
nullptr);
EXPECT_NE(workbench_shader_composite_get(wpd), nullptr);
EXPECT_NE(workbench_shader_merge_infront_get(wpd), nullptr);
EXPECT_NE(workbench_shader_transparent_get(wpd, WORKBENCH_DATATYPE_MESH), nullptr);
EXPECT_NE(workbench_shader_transparent_get(wpd, WORKBENCH_DATATYPE_HAIR), nullptr);
EXPECT_NE(workbench_shader_transparent_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD), nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_MESH, false),
nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_MESH, true), nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_HAIR, false),
nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_HAIR, true), nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, false),
nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, true),
nullptr);
EXPECT_NE(workbench_shader_transparent_resolve_get(wpd), nullptr);
}
EXPECT_NE(workbench_shader_shadow_pass_get(false), nullptr);
EXPECT_NE(workbench_shader_shadow_pass_get(true), nullptr);
EXPECT_NE(workbench_shader_shadow_fail_get(false, false), nullptr);
EXPECT_NE(workbench_shader_shadow_fail_get(false, true), nullptr);
EXPECT_NE(workbench_shader_shadow_fail_get(true, false), nullptr);
EXPECT_NE(workbench_shader_shadow_fail_get(true, true), nullptr);
/* NOTE: workbench_shader_cavity_get(false, false) isn't a valid option. */
EXPECT_NE(workbench_shader_cavity_get(false, true), nullptr);
EXPECT_NE(workbench_shader_cavity_get(true, false), nullptr);
EXPECT_NE(workbench_shader_cavity_get(true, true), nullptr);
EXPECT_NE(workbench_shader_outline_get(), nullptr);
EXPECT_NE(workbench_shader_antialiasing_accumulation_get(), nullptr);
EXPECT_NE(workbench_shader_antialiasing_get(0), nullptr);
EXPECT_NE(workbench_shader_antialiasing_get(1), nullptr);
EXPECT_NE(workbench_shader_antialiasing_get(2), nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_LINEAR, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_LINEAR, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CUBIC, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CUBIC, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_LINEAR, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_LINEAR, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CUBIC, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CUBIC, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_LINEAR, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_LINEAR, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CUBIC, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CUBIC, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_LINEAR, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_LINEAR, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CUBIC, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CUBIC, true), nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
nullptr);
GPUShader *dof_prepare_sh;
GPUShader *dof_downsample_sh;
GPUShader *dof_blur1_sh;
GPUShader *dof_blur2_sh;
GPUShader *dof_resolve_sh;
workbench_shader_depth_of_field_get(
&dof_prepare_sh, &dof_downsample_sh, &dof_blur1_sh, &dof_blur2_sh, &dof_resolve_sh);
EXPECT_NE(dof_prepare_sh, nullptr);
EXPECT_NE(dof_downsample_sh, nullptr);
EXPECT_NE(dof_blur1_sh, nullptr);
EXPECT_NE(dof_blur2_sh, nullptr);
EXPECT_NE(dof_resolve_sh, nullptr);
workbench_shader_free();
}
DRAW_TEST(workbench_glsl_shaders)
static void test_gpencil_glsl_shaders()
{
EXPECT_NE(GPENCIL_shader_antialiasing(0), nullptr);
EXPECT_NE(GPENCIL_shader_antialiasing(1), nullptr);
EXPECT_NE(GPENCIL_shader_antialiasing(2), nullptr);
EXPECT_NE(GPENCIL_shader_geometry_get(), nullptr);
EXPECT_NE(GPENCIL_shader_layer_blend_get(), nullptr);
EXPECT_NE(GPENCIL_shader_mask_invert_get(), nullptr);
EXPECT_NE(GPENCIL_shader_depth_merge_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_blur_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_colorize_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_composite_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_transform_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_glow_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_pixelize_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_rim_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_shadow_get(), nullptr);
GPENCIL_shader_free();
}
DRAW_TEST(gpencil_glsl_shaders)
static void test_image_glsl_shaders()
{
EXPECT_NE(IMAGE_shader_image_get(), nullptr);
EXPECT_NE(IMAGE_shader_depth_get(), nullptr);
IMAGE_shader_free();
}
DRAW_TEST(image_glsl_shaders)
static void test_overlay_glsl_shaders()
{
for (int i = 0; i < 2; i++) {
eGPUShaderConfig sh_cfg = i == 0 ? GPU_SHADER_CFG_DEFAULT : GPU_SHADER_CFG_CLIPPED;
DRW_draw_state_init_gtests(sh_cfg);
EXPECT_NE(OVERLAY_shader_antialiasing(), nullptr);
EXPECT_NE(OVERLAY_shader_armature_degrees_of_freedom_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_armature_degrees_of_freedom_solid(), nullptr);
EXPECT_NE(OVERLAY_shader_armature_envelope(false), nullptr);
EXPECT_NE(OVERLAY_shader_armature_envelope(true), nullptr);
EXPECT_NE(OVERLAY_shader_armature_shape(false), nullptr);
EXPECT_NE(OVERLAY_shader_armature_shape(true), nullptr);
EXPECT_NE(OVERLAY_shader_armature_shape_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_armature_sphere(false), nullptr);
EXPECT_NE(OVERLAY_shader_armature_sphere(true), nullptr);
EXPECT_NE(OVERLAY_shader_armature_stick(), nullptr);
EXPECT_NE(OVERLAY_shader_armature_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_background(), nullptr);
EXPECT_NE(OVERLAY_shader_clipbound(), nullptr);
EXPECT_NE(OVERLAY_shader_depth_only(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_curve_handle(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_curve_point(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_curve_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_gpencil_guide_point(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_gpencil_point(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_gpencil_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_lattice_point(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_lattice_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_analysis(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_depth(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_edge(false), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_edge(true), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_face(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_facedot(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_normal(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_skin_root(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_vert(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_particle_strand(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_particle_point(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_edges_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_face_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_face_dots_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_verts_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_stretching_area_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_stretching_angle_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_tiled_image_borders_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_stencil_image(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_mask_image(), nullptr);
EXPECT_NE(OVERLAY_shader_extra(false), nullptr);
EXPECT_NE(OVERLAY_shader_extra(true), nullptr);
EXPECT_NE(OVERLAY_shader_extra_groundline(), nullptr);
EXPECT_NE(OVERLAY_shader_extra_wire(false, false), nullptr);
EXPECT_NE(OVERLAY_shader_extra_wire(false, true), nullptr);
EXPECT_NE(OVERLAY_shader_extra_wire(true, false), nullptr);
EXPECT_NE(OVERLAY_shader_extra_wire(true, true), nullptr);
EXPECT_NE(OVERLAY_shader_extra_loose_point(), nullptr);
EXPECT_NE(OVERLAY_shader_extra_point(), nullptr);
EXPECT_NE(OVERLAY_shader_facing(), nullptr);
EXPECT_NE(OVERLAY_shader_gpencil_canvas(), nullptr);
EXPECT_NE(OVERLAY_shader_grid(), nullptr);
EXPECT_NE(OVERLAY_shader_grid_image(), nullptr);
EXPECT_NE(OVERLAY_shader_image(), nullptr);
EXPECT_NE(OVERLAY_shader_motion_path_line(), nullptr);
EXPECT_NE(OVERLAY_shader_motion_path_vert(), nullptr);
EXPECT_NE(OVERLAY_shader_uniform_color(), nullptr);
EXPECT_NE(OVERLAY_shader_uniform_color_pointcloud(), nullptr);
EXPECT_NE(OVERLAY_shader_outline_prepass(false), nullptr);
EXPECT_NE(OVERLAY_shader_outline_prepass(true), nullptr);
EXPECT_NE(OVERLAY_shader_outline_prepass_curves(), nullptr);
EXPECT_NE(OVERLAY_shader_outline_prepass_gpencil(), nullptr);
EXPECT_NE(OVERLAY_shader_outline_prepass_pointcloud(), nullptr);
EXPECT_NE(OVERLAY_shader_extra_grid(), nullptr);
EXPECT_NE(OVERLAY_shader_outline_detect(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_face(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_point(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_texture(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_vertcol(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_weight(false), nullptr);
EXPECT_NE(OVERLAY_shader_paint_weight(true), nullptr);
EXPECT_NE(OVERLAY_shader_paint_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_particle_dot(), nullptr);
EXPECT_NE(OVERLAY_shader_particle_shape(), nullptr);
EXPECT_NE(OVERLAY_shader_sculpt_mask(), nullptr);
EXPECT_NE(OVERLAY_shader_sculpt_curves_selection(), nullptr);
EXPECT_NE(OVERLAY_shader_viewer_attribute_curve(), nullptr);
EXPECT_NE(OVERLAY_shader_viewer_attribute_curves(), nullptr);
EXPECT_NE(OVERLAY_shader_viewer_attribute_mesh(), nullptr);
EXPECT_NE(OVERLAY_shader_viewer_attribute_pointcloud(), nullptr);
EXPECT_NE(OVERLAY_shader_volume_velocity(false, false), nullptr);
EXPECT_NE(OVERLAY_shader_volume_velocity(false, true), nullptr);
EXPECT_NE(OVERLAY_shader_volume_velocity(true, false), nullptr);
EXPECT_NE(OVERLAY_shader_wireframe(false), nullptr);
EXPECT_NE(OVERLAY_shader_wireframe(true), nullptr);
EXPECT_NE(OVERLAY_shader_wireframe_select(), nullptr);
EXPECT_NE(OVERLAY_shader_xray_fade(), nullptr);
}
OVERLAY_shader_free();
}
DRAW_TEST(overlay_glsl_shaders)
static void test_eevee_glsl_shaders_static()
{
EEVEE_shaders_material_shaders_init();
EXPECT_NE(EEVEE_shaders_bloom_blit_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_blit_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_downsample_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_downsample_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_upsample_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_upsample_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_resolve_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_resolve_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_bokeh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_setup_get(), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_flatten_tiles_get(), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_dilate_tiles_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_dilate_tiles_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_downsample_get(), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_reduce_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_reduce_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_FOREGROUND, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_FOREGROUND, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_BACKGROUND, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_BACKGROUND, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_HOLEFILL, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_HOLEFILL, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_filter_get(), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(false, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(false, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(true, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(true, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(false, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(false, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(true, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(true, false), nullptr);
EXPECT_NE(EEVEE_shaders_effect_downsample_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_downsample_cube_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_minz_downlevel_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_maxz_downlevel_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_minz_downdepth_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_maxz_downdepth_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_minz_downdepth_layer_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_maxz_downdepth_layer_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_maxz_copydepth_layer_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_minz_copydepth_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_maxz_copydepth_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_mist_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_motion_blur_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_motion_blur_object_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_motion_blur_hair_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_motion_blur_velocity_tiles_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_motion_blur_velocity_tiles_expand_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_ambient_occlusion_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_ambient_occlusion_debug_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_ggx_lut_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_ggx_refraction_lut_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_filter_glossy_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_filter_diffuse_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_filter_visibility_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_grid_fill_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_planar_downsample_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_renderpasses_post_process_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_cryptomatte_sh_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_cryptomatte_sh_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_shadow_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_shadow_accum_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_subsurface_first_pass_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_subsurface_second_pass_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_clear_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_clear_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_scatter_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_scatter_with_lights_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_integration_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_resolve_sh_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_resolve_sh_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_accum_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_studiolight_probe_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_studiolight_background_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_cube_display_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_grid_display_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_planar_display_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_update_noise_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_velocity_resolve_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_taa_resolve_sh_get(EFFECT_TAA), nullptr);
EXPECT_NE(EEVEE_shaders_taa_resolve_sh_get(EFFECT_TAA_REPROJECT), nullptr);
EXPECT_NE(EEVEE_shaders_effect_reflection_trace_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_reflection_resolve_sh_get(), nullptr);
EEVEE_shaders_free();
}
DRAW_TEST(eevee_glsl_shaders_static)
static void test_draw_shaders(eParticleRefineShaderType sh_type)
{
DRW_shaders_free();
EXPECT_NE(DRW_shader_hair_refine_get(PART_REFINE_CATMULL_ROM, sh_type), nullptr);
DRW_shaders_free();
}
static void test_draw_glsl_shaders()
{
#ifndef __APPLE__
test_draw_shaders(PART_REFINE_SHADER_TRANSFORM_FEEDBACK);
test_draw_shaders(PART_REFINE_SHADER_COMPUTE);
#endif
test_draw_shaders(PART_REFINE_SHADER_TRANSFORM_FEEDBACK_WORKAROUND);
}
DRAW_TEST(draw_glsl_shaders)
static void test_basic_glsl_shaders()
{
for (int i = 0; i < GPU_SHADER_CFG_LEN; i++) {
eGPUShaderConfig sh_cfg = static_cast<eGPUShaderConfig>(i);
BASIC_shaders_depth_sh_get(sh_cfg);
BASIC_shaders_pointcloud_depth_sh_get(sh_cfg);
BASIC_shaders_curves_depth_sh_get(sh_cfg);
BASIC_shaders_depth_conservative_sh_get(sh_cfg);
BASIC_shaders_pointcloud_depth_conservative_sh_get(sh_cfg);
}
BASIC_shaders_free();
}
DRAW_TEST(basic_glsl_shaders)
} // namespace blender::draw

View File

@ -264,7 +264,7 @@ static bool graphedit_get_context(bAnimContext *ac, SpaceGraph *sipo)
ac->ads = sipo->ads;
/* set settings for Graph Editor - "Selected = Editable" */
if (sipo->flag & SIPO_SELCUVERTSONLY) {
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
sipo->ads->filterflag |= ADS_FILTER_SELEDIT;
}
else {

View File

@ -345,7 +345,7 @@ void animviz_motionpath_compute_range(Object *ob, Scene *scene)
bAnimVizSettings *avs = ob->mode == OB_MODE_POSE ? &ob->pose->avs : &ob->avs;
if (avs->path_range == MOTIONPATH_RANGE_MANUAL) {
/* Don't touch manually-determined ranges. */
/* Don't touch manually-determined ranges. */
return;
}

View File

@ -41,7 +41,9 @@
#include "anim_intern.h"
/* ********************** frame change operator ***************************/
/* -------------------------------------------------------------------- */
/** \name Frame Change Operator
* \{ */
/* Check if the operator can be run from the current context */
static bool change_frame_poll(bContext *C)
@ -349,7 +351,11 @@ static void ANIM_OT_change_frame(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ****************** Start/End Frame Operators *******************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Start/End Frame Operators
* \{ */
static bool anim_set_end_frames_poll(bContext *C)
{
@ -483,7 +489,11 @@ static void ANIM_OT_end_frame_set(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** set preview range operator ****************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Set Preview Range Operator
* \{ */
static int previewrange_define_exec(bContext *C, wmOperator *op)
{
@ -545,7 +555,11 @@ static void ANIM_OT_previewrange_set(wmOperatorType *ot)
WM_operator_properties_border(ot);
}
/* ****************** clear preview range operator ****************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Clear Preview Range Operator
* \{ */
static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
@ -586,7 +600,11 @@ static void ANIM_OT_previewrange_clear(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ************************** registration **********************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Registration
* \{ */
void ED_operatortypes_anim(void)
{
@ -632,3 +650,5 @@ void ED_keymap_anim(wmKeyConfig *keyconf)
{
WM_keymap_ensure(keyconf, "Animation", 0, 0);
}
/** \} */

View File

@ -798,7 +798,7 @@ static void gpencil_create_extensions_radius(tGPDfill *tgpf)
}
/* Don't check endpoint distances unless the bounding boxes of the strokes
are close enough together that they can plausibly be connected. */
* are close enough together that they can plausibly be connected. */
if (!extended_bbox_overlap(gps->boundbox_min,
gps->boundbox_max,
gps2->boundbox_min,

View File

@ -109,7 +109,7 @@ enum {
/* Display the hover region (edge or corner) of the underlying bounding box. */
ED_GIZMO_CAGE2D_STYLE_BOX = 0,
/* Display the bounding box plus dots on four corners while hovering, usually used for
transforming a 2D shape. */
* transforming a 2D shape. */
ED_GIZMO_CAGE2D_STYLE_BOX_TRANSFORM,
/* Display the bounding circle while hovering. */
ED_GIZMO_CAGE2D_STYLE_CIRCLE,

View File

@ -20,6 +20,7 @@ set(INC
../../python
../../render
../../windowmanager
../../../../intern/ghost
../../../../intern/guardedalloc
../../bmesh
# RNA_prototypes.h

View File

@ -47,6 +47,8 @@
#include "BKE_tracking.h"
#include "BKE_unit.h"
#include "GHOST_C-api.h"
#include "IMB_colormanagement.h"
#include "ED_screen.h"
@ -3468,6 +3470,9 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
WM_cursor_modal_set(win, WM_CURSOR_TEXT_EDIT);
/* Temporarily turn off window auto-focus on platforms that support it. */
GHOST_SetAutoFocus(false);
#ifdef WITH_INPUT_IME
if (!is_num_but) {
ui_textedit_ime_begin(win, but);
@ -3523,6 +3528,9 @@ static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
WM_cursor_modal_restore(win);
/* Turn back on the auto-focusing of windows. */
GHOST_SetAutoFocus(true);
/* Free text undo history text blocks. */
ui_textedit_undo_stack_destroy(data->undo_stack_text);
data->undo_stack_text = nullptr;

View File

@ -5814,7 +5814,6 @@ void uiLayoutSetTooltipFunc(uiLayout *layout,
if (copy_arg != nullptr && arg_used) {
arg = copy_arg(arg);
}
arg_used = true;
if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem = (uiButtonItem *)item;
@ -5822,9 +5821,11 @@ void uiLayoutSetTooltipFunc(uiLayout *layout,
continue;
}
UI_but_func_tooltip_set(bitem->but, func, arg, free_arg);
arg_used = true;
}
else {
uiLayoutSetTooltipFunc((uiLayout *)item, func, arg, copy_arg, free_arg);
arg_used = true;
}
}

View File

@ -44,7 +44,6 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent *
return OPERATOR_RUNNING_MODAL;
}
/* function used for WM_OT_save_mainfile too */
static int wm_collada_export_exec(bContext *C, wmOperator *op)
{
char filepath[FILE_MAX];
@ -673,7 +672,6 @@ void WM_OT_collada_export(wmOperatorType *ot)
"Store Bindpose information in custom bone properties for later use during Collada export");
}
/* function used for WM_OT_save_mainfile too */
static int wm_collada_import_exec(bContext *C, wmOperator *op)
{
char filename[FILE_MAX];

View File

@ -377,7 +377,7 @@ static bool screen_areas_can_align(bScreen *screen, ScrArea *sa1, ScrArea *sa2,
return false;
}
/* Areas that are _smaller_ than minimum sizes, sharing an edge to be moved. See #100772. */
/* Areas that are _smaller_ than minimum sizes, sharing an edge to be moved. See #100772. */
if (SCREEN_DIR_IS_VERTICAL(dir)) {
const short xmin = MIN2(sa1->v1->vec.x, sa2->v1->vec.x);
const short xmax = MAX2(sa1->v3->vec.x, sa2->v3->vec.x);

View File

@ -1177,7 +1177,7 @@ void SCULPT_OT_mesh_filter(wmOperatorType *ot)
ot->ui = sculpt_mesh_ui_exec;
/* Doesn't seem to actually be called?
Check `sculpt_mesh_filter_modal` to see where it's really called. */
* Check `sculpt_mesh_filter_modal` to see where it's really called. */
ot->cancel = sculpt_mesh_filter_cancel;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_CURSOR_X | OPTYPE_BLOCKING |

View File

@ -54,8 +54,9 @@
#include "action_intern.h"
/* ************************************************************************** */
/* ACTION CREATION */
/* -------------------------------------------------------------------- */
/** \name Utilities
* \{ */
AnimData *ED_actedit_animdata_from_context(const bContext *C, ID **r_adt_id_owner)
{
@ -86,9 +87,12 @@ AnimData *ED_actedit_animdata_from_context(const bContext *C, ID **r_adt_id_owne
return adt;
}
/* -------------------------------------------------------------------- */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Create New Action
* \{ */
/* Create new action */
static bAction *action_create_new(bContext *C, bAction *oldact)
{
ScrArea *area = CTX_wm_area(C);
@ -150,14 +154,18 @@ static void actedit_change_action(bContext *C, bAction *act)
RNA_property_update(C, &ptr, prop);
}
/* ******************** New Action Operator *********************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name New Action Operator
*
* Criteria:
* 1) There must be an dope-sheet/action editor, and it must be in a mode which uses actions...
* OR
* The NLA Editor is active (i.e. Animation Data panel -> new action)
* 2) The associated #AnimData block must not be in tweak-mode.
* \{ */
/* Criteria:
* 1) There must be an dopesheet/action editor, and it must be in a mode which uses actions...
* OR
* The NLA Editor is active (i.e. Animation Data panel -> new action)
* 2) The associated AnimData block must not be in tweak-mode.
*/
static bool action_new_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
@ -290,13 +298,17 @@ void ACTION_OT_new(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************* Action Push-Down Operator ******************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Action Push-Down Operator
*
* Criteria:
* 1) There must be an dope-sheet/action editor, and it must be in a mode which uses actions.
* 2) There must be an action active.
* 3) The associated #AnimData block must not be in tweak-mode.
* \{ */
/* Criteria:
* 1) There must be an dopesheet/action editor, and it must be in a mode which uses actions
* 2) There must be an action active
* 3) The associated AnimData block must not be in tweak-mode
*/
static bool action_pushdown_poll(bContext *C)
{
if (ED_operator_action_active(C)) {
@ -370,7 +382,11 @@ void ACTION_OT_push_down(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************* Action Stash Operator ******************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Action Stash Operator
* \{ */
static int action_stash_exec(bContext *C, wmOperator *op)
{
@ -432,12 +448,16 @@ void ACTION_OT_stash(wmOperatorType *ot)
"Create a new action once the existing one has been safely stored");
}
/* ----------------- */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Action Stash & Create Operator
*
* Criteria:
* 1) There must be an dope-sheet/action editor, and it must be in a mode which uses actions.
* 2) The associated #AnimData block must not be in tweak-mode.
* \{ */
/* Criteria:
* 1) There must be an dopesheet/action editor, and it must be in a mode which uses actions
* 2) The associated AnimData block must not be in tweak-mode
*/
static bool action_stash_create_poll(bContext *C)
{
if (ED_operator_action_active(C)) {
@ -536,17 +556,18 @@ void ACTION_OT_stash_and_create(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ************************************************************************** */
/* ACTION UNLINK */
/** \} */
/* ******************* Action Unlink Operator ******************** */
/* We use a custom unlink operator here, as there are some technicalities which need special care:
/* -------------------------------------------------------------------- */
/** \name Action Unlink Operator
*
* We use a custom unlink operator here, as there are some technicalities which need special care:
* 1) When in Tweak Mode, it shouldn't be possible to unlink the active action,
* or else, everything turns to custard.
* 2) If the Action doesn't have any other users, the user should at least get
* a warning that it is going to get lost.
* 3) We need a convenient way to exit Tweak Mode from the Action Editor
*/
* \{ */
void ED_animedit_unlink_action(
bContext *C, ID *id, AnimData *adt, bAction *act, ReportList *reports, bool force_delete)
@ -701,8 +722,11 @@ void ACTION_OT_unlink(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ************************************************************************** */
/* ACTION BROWSING */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Action Browsing
* \{ */
/* Try to find NLA Strip to use for action layer up/down tool */
static NlaStrip *action_layer_get_nlastrip(ListBase *strips, float ctime)
@ -775,7 +799,11 @@ static void action_layer_switch_strip(
BLI_assert(adt->actstrip == strip);
}
/* ********************** One Layer Up Operator ************************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name One Layer Up Operator
* \{ */
static bool action_layer_next_poll(bContext *C)
{
@ -886,7 +914,11 @@ void ACTION_OT_layer_next(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ********************* One Layer Down Operator ************************* */
/** \} */
/* -------------------------------------------------------------------- */
/** \name One Layer Down Operator
* \{ */
static bool action_layer_prev_poll(bContext *C)
{
@ -985,4 +1017,4 @@ void ACTION_OT_layer_prev(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ************************************************************************** */
/** \} */

View File

@ -44,8 +44,9 @@
#include "action_intern.h"
/* ************************************************************************* */
/* Channel List */
/* -------------------------------------------------------------------- */
/** \name Channel List
* \{ */
void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
{
@ -110,8 +111,11 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
ANIM_animdata_freelist(&anim_data);
}
/* ************************************************************************* */
/* Keyframes */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Keyframes
* \{ */
/* extra padding for lengths (to go under scrollers) */
#define EXTRA_SCROLL_PAD 100.0f
@ -424,8 +428,11 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region
ANIM_animdata_freelist(&anim_data);
}
/* ************************************************************************* */
/* Timeline - Caches */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Timeline - Caches
* \{ */
static bool timeline_cache_is_hidden_by_setting(SpaceAction *saction, PTCacheID *pid)
{
@ -659,4 +666,4 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene)
BLI_freelistN(&pidlist);
}
/* ************************************************************************* */
/** \} */

View File

@ -54,10 +54,9 @@
#include "action_intern.h"
/* ************************************************************************** */
/* POSE MARKERS STUFF */
/* *************************** Localize Markers ***************************** */
/* -------------------------------------------------------------------- */
/** \name Pose Markers: Localize Markers
* \{ */
/* ensure that there is:
* 1) an active action editor
@ -142,10 +141,11 @@ void ACTION_OT_markers_make_local(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ************************************************************************** */
/* KEYFRAME-RANGE STUFF */
/** \} */
/* *************************** Calculate Range ************************** */
/* -------------------------------------------------------------------- */
/** \name Calculate Range
* \{ */
/* Get the min/max keyframes. */
static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const short onlySel)
@ -242,7 +242,11 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
return found;
}
/* ****************** Automatic Preview-Range Operator ****************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name View: Automatic Preview-Range Operator
* \{ */
static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
{
@ -292,7 +296,11 @@ void ACTION_OT_previewrange_set(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** View-All Operator ****************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name View: All Operator
* \{ */
/**
* Find the extents of the active channel
@ -459,7 +467,11 @@ void ACTION_OT_view_selected(wmOperatorType *ot)
ot->flag = 0;
}
/* ****************** View-All Operator ****************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name View: Frame Operator
* \{ */
static int actkeys_view_frame_exec(bContext *C, wmOperator *op)
{
@ -484,10 +496,12 @@ void ACTION_OT_view_frame(wmOperatorType *ot)
ot->flag = 0;
}
/* ************************************************************************** */
/* GENERAL STUFF */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Keyframes: Copy/Paste Operator
* \{ */
/* ******************** Copy/Paste Keyframes Operator ************************* */
/* NOTE: the backend code for this is shared with the graph editor */
static short copy_action_keys(bAnimContext *ac)
@ -712,7 +726,11 @@ void ACTION_OT_paste(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ******************** Insert Keyframes Operator ************************* */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Keyframes: Insert Operator
* \{ */
/* defines for insert keyframes tool */
static const EnumPropertyItem prop_actkeys_insertkey_types[] = {
@ -902,7 +920,11 @@ void ACTION_OT_keyframe_insert(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_insertkey_types, 0, "Type", "");
}
/* ******************** Duplicate Keyframes Operator ************************* */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Keyframes: Duplicate Operator
* \{ */
static bool duplicate_action_keys(bAnimContext *ac)
{
@ -978,7 +1000,11 @@ void ACTION_OT_duplicate(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Delete Keyframes Operator ************************* */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Keyframes: Delete Operator
* \{ */
static bool delete_action_keys(bAnimContext *ac)
{
@ -1067,7 +1093,11 @@ void ACTION_OT_delete(wmOperatorType *ot)
WM_operator_properties_confirm_or_exec(ot);
}
/* ******************** Clean Keyframes Operator ************************* */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Keyframes: Clean Operator
* \{ */
static void clean_action_keys(bAnimContext *ac, float thresh, bool clean_chan)
{
@ -1143,7 +1173,11 @@ void ACTION_OT_clean(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "channels", false, "Channels", "");
}
/* ******************** Sample Keyframes Operator *********************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Keyframes: Sample Operator
* \{ */
/* Evaluates the curves between each selected keyframe on each frame, and keys the value. */
static void sample_action_keys(bAnimContext *ac)
@ -1208,10 +1242,11 @@ void ACTION_OT_sample(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ************************************************************************** */
/* SETTINGS STUFF */
/** \} */
/* ******************** Set Extrapolation-Type Operator *********************** */
/* -------------------------------------------------------------------- */
/** \name Settings: Set Extrapolation-Type Operator
* \{ */
/* defines for make/clear cyclic extrapolation tools */
#define MAKE_CYCLIC_EXPO -1
@ -1343,7 +1378,11 @@ void ACTION_OT_extrapolation_type(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_expo_types, 0, "Type", "");
}
/* ******************** Set Interpolation-Type Operator *********************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Settings: Set Interpolation-Type Operator
* \{ */
static int actkeys_ipo_exec(bContext *C, wmOperator *op)
{
@ -1398,7 +1437,11 @@ void ACTION_OT_interpolation_type(wmOperatorType *ot)
RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_ACTION);
}
/* ******************** Set Easing Operator *********************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Settings: Set Easing Operator
* \{ */
static int actkeys_easing_exec(bContext *C, wmOperator *op)
{
@ -1447,7 +1490,11 @@ void ACTION_OT_easing_type(wmOperatorType *ot)
ot->srna, "type", rna_enum_beztriple_interpolation_easing_items, 0, "Type", "");
}
/* ******************** Set Handle-Type Operator *********************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Settings: Set Handle-Type Operator
* \{ */
/* this function is responsible for setting handle-type of selected keyframes */
static void sethandles_action_keys(bAnimContext *ac, short mode)
@ -1532,7 +1579,11 @@ void ACTION_OT_handle_type(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_keyframe_handle_type_items, 0, "Type", "");
}
/* ******************** Set Keyframe-Type Operator *********************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Settings: Set Keyframe-Type Operator
* \{ */
/* this function is responsible for setting keyframe type for keyframes */
static void setkeytype_action_keys(bAnimContext *ac, short mode)
@ -1620,10 +1671,11 @@ void ACTION_OT_keyframe_type(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_beztriple_keyframe_type_items, 0, "Type", "");
}
/* ************************************************************************** */
/* TRANSFORM STUFF */
/** \} */
/* ***************** Jump to Selected Frames Operator *********************** */
/* -------------------------------------------------------------------- */
/** \name Transform: Jump to Selected Frames Operator
* \{ */
static bool actkeys_framejump_poll(bContext *C)
{
@ -1722,7 +1774,11 @@ void ACTION_OT_frame_jump(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Snap Keyframes Operator *********************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform: Snap Keyframes Operator
* \{ */
/* defines for snap keyframes tool */
static const EnumPropertyItem prop_actkeys_snap_types[] = {
@ -1852,7 +1908,11 @@ void ACTION_OT_snap(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_snap_types, 0, "Type", "");
}
/* ******************** Mirror Keyframes Operator *********************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform: Mirror Keyframes Operator
* \{ */
/* defines for mirror keyframes tool */
static const EnumPropertyItem prop_actkeys_mirror_types[] = {
@ -1976,4 +2036,4 @@ void ACTION_OT_mirror(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_mirror_types, 0, "Type", "");
}
/* ************************************************************************** */
/** \} */

View File

@ -48,8 +48,9 @@
#include "action_intern.h"
/* ************************************************************************** */
/* KEYFRAMES STUFF */
/* -------------------------------------------------------------------- */
/** \name Keyframes Stuff
* \{ */
static bAnimListElem *actkeys_find_list_element_at_position(bAnimContext *ac,
int filter,
@ -218,12 +219,16 @@ static bool actkeys_is_key_at_position(bAnimContext *ac, float region_x, float r
return found;
}
/* ******************** Deselect All Operator ***************************** */
/* This operator works in one of three ways:
* 1) (de)select all (AKEY) - test if select all or deselect all
* 2) invert all (CTRL-IKEY) - invert selection of all keyframes
* 3) (de)select all - no testing is done; only for use internal tools as normal function...
*/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Deselect All Operator
*
* This operator works in one of three ways:
* 1) (de)select all (AKEY) - test if select all or deselect all.
* 2) invert all (CTRL-IKEY) - invert selection of all keyframes.
* 3) (de)select all - no testing is done; only for use internal tools as normal function.
* \{ */
/* Deselects keyframes in the action editor
* - This is called by the deselect all operator, as well as other ones!
@ -352,15 +357,18 @@ void ACTION_OT_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
/* ******************** Box Select Operator **************************** */
/**
/** \} */
/* -------------------------------------------------------------------- */
/** \name Box Select Operator
*
* This operator currently works in one of three ways:
* - BKEY - 1) all keyframes within region are selected #ACTKEYS_BORDERSEL_ALLKEYS.
* - ALT-BKEY - depending on which axis of the region was larger...
* - 2) x-axis, so select all frames within frame range #ACTKEYS_BORDERSEL_FRAMERANGE.
* - 3) y-axis, so select all frames within channels that region included
* #ACTKEYS_BORDERSEL_CHANNELS.
*/
* \{ */
/* defines for box_select mode */
enum {
@ -606,11 +614,15 @@ void ACTION_OT_select_box(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ******************** Region Select Operators ***************************** */
/* "Region Select" operators include the Lasso and Circle Select operators.
/** \} */
/* -------------------------------------------------------------------- */
/** \name Region Select Operators
*
* "Region Select" operators include the Lasso and Circle Select operators.
* These two ended up being lumped together, as it was easier in the
* original Graph Editor implementation of these to do it this way.
*/
* \{ */
typedef struct RegionSelectData {
bAnimContext *ac;
@ -903,13 +915,17 @@ void ACTION_OT_select_circle(wmOperatorType *ot)
WM_operator_properties_select_operation_simple(ot);
}
/* ******************** Column Select Operator **************************** */
/* This operator works in one of four ways:
/** \} */
/* -------------------------------------------------------------------- */
/** \name Column Select Operator
*
* This operator works in one of four ways:
* - 1) select all keyframes in the same frame as a selected one (KKEY)
* - 2) select all keyframes in the same frame as the current frame marker (CTRL-KKEY)
* - 3) select all keyframes in the same frame as a selected markers (SHIFT-KKEY)
* - 4) select all keyframes that occur between selected markers (ALT-KKEY)
*/
* \{ */
/* defines for column-select mode */
static const EnumPropertyItem prop_column_select_types[] = {
@ -1140,7 +1156,11 @@ void ACTION_OT_select_column(wmOperatorType *ot)
RNA_def_property_flag(ot->prop, PROP_HIDDEN);
}
/* ******************** Select Linked Operator *********************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Select Linked Operator
* \{ */
static int actkeys_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
@ -1199,7 +1219,11 @@ void ACTION_OT_select_linked(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Select More/Less Operators *********************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Select More/Less Operators
* \{ */
/* Common code to perform selection */
static void select_moreless_action_keys(bAnimContext *ac, short mode)
@ -1322,8 +1346,13 @@ void ACTION_OT_select_less(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Select Left/Right Operator ************************* */
/* Select keyframes left/right of the current frame indicator */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Select Left/Right Operator
*
* Select keyframes left/right of the current frame indicator.
* \{ */
/* defines for left-right select tool */
static const EnumPropertyItem prop_actkeys_leftright_select_types[] = {
@ -1520,8 +1549,12 @@ void ACTION_OT_select_leftright(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ******************** Mouse-Click Select Operator *********************** */
/* This operator works in one of three ways:
/** \} */
/* -------------------------------------------------------------------- */
/** \name Mouse-Click Select Operator
*
* This operator works in one of three ways:
* - 1) keyframe under mouse - no special modifiers
* - 2) all keyframes on the same side of current frame indicator as mouse - ALT modifier
* - 3) column select all keyframes in frame under mouse - CTRL modifier
@ -1529,9 +1562,7 @@ void ACTION_OT_select_leftright(wmOperatorType *ot)
*
* In addition to these basic options, the SHIFT modifier can be used to toggle the
* selection mode between replacing the selection (without) and inverting the selection (with).
*/
/* ------------------- */
* \{ */
/* option 1) select keyframe directly under mouse */
static void actkeys_mselect_single(bAnimContext *ac,
@ -1905,4 +1936,4 @@ void ACTION_OT_clickselect(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ************************************************************************** */
/** \} */

View File

@ -46,7 +46,9 @@
#include "action_intern.h" /* own include */
/* ******************** default callbacks for action space ***************** */
/* -------------------------------------------------------------------- */
/** \name Default Callbacks for Action Space
* \{ */
static SpaceLink *action_create(const ScrArea *area, const Scene *scene)
{
@ -962,3 +964,5 @@ void ED_spacetype_action(void)
BKE_spacetype_register(st);
}
/** \} */

View File

@ -406,7 +406,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu)
uint color = GPU_vertformat_attr_add(
format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -482,7 +482,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu)
immEnd();
immUnbindProgram();
GPU_blend(GPU_BLEND_NONE);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
}
@ -515,7 +515,7 @@ static void draw_fcurve_sample_control(
}
/* helper func - draw keyframe vertices only for an F-Curve */
static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu)
static void draw_fcurve_samples(ARegion *region, FCurve *fcu)
{
FPoint *first, *last;
float hsize, xscale, yscale;
@ -531,7 +531,7 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu)
/* draw */
if (first && last) {
/* anti-aliased lines for more consistent appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -547,7 +547,7 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu)
immUnbindProgram();
GPU_blend(GPU_BLEND_NONE);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
}
@ -565,7 +565,6 @@ static void draw_fcurve_curve(bAnimContext *ac,
const bool use_nla_remap,
const bool draw_extrapolation)
{
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
short mapping_flag = ANIM_get_normalization_flags(ac);
/* when opening a blend file on a different sized screen or while dragging the toolbar this can
@ -601,7 +600,7 @@ static void draw_fcurve_curve(bAnimContext *ac,
float pixels_per_sample = 1.5f;
float samplefreq = pixels_per_sample / UI_view2d_scale_get_x(v2d);
if (sipo->flag & SIPO_BEAUTYDRAW_OFF) {
if (!(U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING)) {
/* Low Precision = coarse lower-bound clamping
*
* Although the "Beauty Draw" flag was originally for AA'd
@ -1030,7 +1029,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
}
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -1105,7 +1104,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
immUnbindProgram();
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
GPU_blend(GPU_BLEND_NONE);
@ -1115,7 +1114,8 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
* - If the option to only show controls if the F-Curve is selected is enabled,
* we must obey this.
*/
if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) {
if (!(U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) ||
(fcu->flag & FCURVE_SELECTED)) {
if (!BKE_fcurve_are_keyframes_usable(fcu) && !(fcu->fpt && fcu->totvert)) {
/* only draw controls if this is the active modifier */
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
@ -1153,7 +1153,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
}
else {
/* samples: only draw two indicators at either end as indicators */
draw_fcurve_samples(sipo, region, fcu);
draw_fcurve_samples(region, fcu);
}
GPU_matrix_pop();
@ -1300,7 +1300,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region
GPU_line_width(3.0f);
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -1333,7 +1333,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region
immUnbindProgram();
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
GPU_blend(GPU_BLEND_NONE);

View File

@ -172,8 +172,9 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY |
ANIMFILTER_NODUPLIS | ANIMFILTER_FCURVESONLY);
if (sipo->flag &
SIPO_SELCUVERTSONLY) { /* FIXME: this should really be check for by the filtering code... */
if (U.animation_flag &
USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) { /* FIXME: this should really be check for by the
filtering code... */
filter |= ANIMFILTER_SEL;
}
mapping_flag |= ANIM_get_normalization_flags(ac);
@ -336,7 +337,6 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
bAnimListElem *ale;
int filter;
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked = {{NULL}};
KeyframeEditFunc test_cb, sel_cb;
@ -374,7 +374,7 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
if (do_channels) {
/* Only change selection of channel when the visibility of keyframes
* doesn't depend on this. */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
/* deactivate the F-Curve, and deselect if deselecting keyframes.
* otherwise select the F-Curve too since we've selected all the keyframes
*/
@ -496,11 +496,11 @@ static rctf initialize_box_select_coords(const bAnimContext *ac, const rctf *rec
return rectf;
}
static int initialize_animdata_selection_filter(const SpaceGraph *sipo)
static int initialize_animdata_selection_filter(void)
{
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY |
ANIMFILTER_NODUPLIS);
if (sipo->flag & SIPO_SELCUVERTSONLY) {
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
filter |= ANIMFILTER_FOREDIT | ANIMFILTER_SELEDIT;
}
return filter;
@ -513,8 +513,7 @@ static ListBase initialize_box_select_anim_data(const int filter, bAnimContext *
return anim_data;
}
static void initialize_box_select_key_editing_data(const SpaceGraph *sipo,
const bool incl_handles,
static void initialize_box_select_key_editing_data(const bool incl_handles,
const short mode,
bAnimContext *ac,
void *data,
@ -540,7 +539,7 @@ static void initialize_box_select_key_editing_data(const SpaceGraph *sipo,
r_ked->data = scaled_rectf;
break;
}
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
if (sipo->flag & SIPO_SELVHANDLESONLY) {
r_ked->iterflags |= KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE;
}
@ -574,14 +573,13 @@ static bool box_select_graphkeys(bAnimContext *ac,
void *data)
{
const rctf rectf = initialize_box_select_coords(ac, rectf_view);
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
const int filter = initialize_animdata_selection_filter(sipo);
const int filter = initialize_animdata_selection_filter();
ListBase anim_data = initialize_box_select_anim_data(filter, ac);
rctf scaled_rectf;
KeyframeEditData ked;
int mapping_flag;
initialize_box_select_key_editing_data(
sipo, incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
/* Get beztriple editing/validation functions. */
const KeyframeEditFunc select_cb = ANIM_editkeyframes_select(selectmode);
@ -633,7 +631,7 @@ static bool box_select_graphkeys(bAnimContext *ac,
any_key_selection_changed = true;
/* Only change selection of channel when the visibility of keyframes
* doesn't depend on this. */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
/* select the curve too now that curve will be touched */
if (selectmode == SELECT_ADD) {
fcu->flag |= FCURVE_SELECTED;
@ -733,14 +731,13 @@ static void box_select_graphcurves(bAnimContext *ac,
const bool incl_handles,
void *data)
{
const SpaceGraph *sipo = (SpaceGraph *)ac->sl;
const int filter = initialize_animdata_selection_filter(sipo);
const int filter = initialize_animdata_selection_filter();
ListBase anim_data = initialize_box_select_anim_data(filter, ac);
rctf scaled_rectf;
KeyframeEditData ked;
int mapping_flag;
initialize_box_select_key_editing_data(
sipo, incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
FCurve *last_selected_curve = NULL;
@ -1707,7 +1704,7 @@ static int mouse_graph_keys(bAnimContext *ac,
/* Deselect other channels too, but only do this if selection of channel
* when the visibility of keyframes doesn't depend on this. */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
ANIM_anim_channels_select_set(ac, ACHANNEL_SETFLAG_CLEAR);
}
}
@ -1780,7 +1777,7 @@ static int mouse_graph_keys(bAnimContext *ac,
}
/* only change selection of channel when the visibility of keyframes doesn't depend on this */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
/* select or deselect curve? */
if (bezt) {
/* take selection status from item that got hit, to prevent flip/flop on channel

View File

@ -49,7 +49,6 @@ void get_graph_keyframe_extents(bAnimContext *ac,
const bool include_handles)
{
Scene *scene = ac->scene;
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@ -58,7 +57,7 @@ void get_graph_keyframe_extents(bAnimContext *ac,
/* Get data to filter, from Dopesheet. */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY |
ANIMFILTER_NODUPLIS);
if (sipo->flag & SIPO_SELCUVERTSONLY) {
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
filter |= ANIMFILTER_SEL;
}

View File

@ -68,7 +68,7 @@ static SpaceLink *graph_create(const ScrArea *UNUSED(area), const Scene *scene)
/* settings for making it easier by default to just see what you're interested in tweaking */
sipo->ads->filterflag |= ADS_FILTER_ONLYSEL;
sipo->flag |= SIPO_SELVHANDLESONLY | SIPO_SHOW_MARKERS;
sipo->flag |= SIPO_SHOW_MARKERS;
/* header */
region = MEM_callocN(sizeof(ARegion), "header for graphedit");

View File

@ -521,7 +521,7 @@ static void write_space_outliner(BlendWriter *writer, const SpaceOutliner *space
/* TODO the mempool could be moved to #SpaceOutliner_Runtime so that #SpaceOutliner could
* hold the #TreeStore directly. */
/* Address relative to the tree-store, as noted above. */
/* Address relative to the tree-store, as noted above. */
void *data_addr = (void *)POINTER_OFFSET(ts, sizeof(void *));
/* There should be plenty of memory addresses within the mempool data that we can point into,
* just double-check we don't potentially end up with a memory address that another DNA

View File

@ -3664,7 +3664,8 @@ static bool do_mesh_box_select(ViewContext *vc,
}
if (ts->selectmode & SCE_SELECT_EDGE) {
/* Does both use_zbuf and non-use_zbuf versions (need screen cos for both) */
struct BoxSelectUserData_ForMeshEdge cb_data {};
struct BoxSelectUserData_ForMeshEdge cb_data {
};
cb_data.data = &data;
cb_data.esel = use_zbuf ? esel : nullptr;
cb_data.backbuf_offset = use_zbuf ? DRW_select_buffer_context_offset_for_object_elem(

View File

@ -1440,8 +1440,9 @@ static void uvedit_pack_islands_multi(const Scene *scene,
mul_v2_m2v2(pre_translate, matrix_inverse, base_offset);
/* Translate to box_array from bounds_rect. */
pre_translate[0] += box_array[i].x - island->bounds_rect.xmin;
pre_translate[1] += box_array[i].y - island->bounds_rect.ymin;
blender::geometry::PackIsland *pack_island = pack_island_vector[box_array[i].index];
pre_translate[0] += box_array[i].x - pack_island->bounds_rect.xmin;
pre_translate[1] += box_array[i].y - pack_island->bounds_rect.ymin;
island_uv_transform(island, matrix, pre_translate);
}
@ -3169,13 +3170,12 @@ static void uv_map_mirror(BMFace *efa,
* than 0.5 units in the *u* coordinate.
* If we find such a face, we try and improve the unwrapping
* by adding (1.0, 0.0) onto some of the face's UVs.
*
* Note that this is only a heuristic. The property we're
* attempting to maintain is that the winding of the face
* in UV space corresponds with the handedness of the face
* in 3D space w.r.t to the unwrapping. Even for triangles,
* that property is somewhat complicated to evaluate.
*/
* that property is somewhat complicated to evaluate. */
float right_u = -1.0e30f;
BMLoop *l;

View File

@ -94,7 +94,7 @@ inline void execute_lazy_function_eagerly_impl(
fn.execute(params, context);
fn.destruct_storage(context.storage);
/* Make sure all outputs have been computed. */
/* Make sure all outputs have been computed. */
BLI_assert(!Span<bool>(set_outputs).contains(false));
}

View File

@ -125,7 +125,7 @@ namespace detail {
*/
template<typename MaskT, typename... Args, typename... ParamTags, size_t... I, typename ElementFn>
/* Perform additional optimizations on this loop because it is a very hot loop. For example, the
* math node in geometry nodes is processed here. */
* math node in geometry nodes is processed here. */
#if (defined(__GNUC__) && !defined(__clang__))
[[gnu::optimize("-funroll-loops")]] [[gnu::optimize("O3")]]
#endif

View File

@ -21,7 +21,7 @@ enum eUVPackIsland_MarginMethod {
struct UVPackIsland_Params {
/** Islands can be rotated to improve packing. */
bool rotate;
/** (In UV Editor) only pack islands which have one or more selected UVs.*/
/** (In UV Editor) only pack islands which have one or more selected UVs. */
bool only_selected_uvs;
/** (In 3D Viewport or UV Editor) only pack islands which have selected faces. */
bool only_selected_faces;

View File

@ -805,8 +805,6 @@ static void weld_poly_loop_ctx_alloc(Span<MPoly> polys,
const int loopstart = poly.loopstart;
const int totloop = poly.totloop;
int vert_ctx_len = 0;
int prev_wloop_len = wloop_len;
for (const int i_loop : mloop.index_range().slice(loopstart, totloop)) {
int v = mloop[i_loop].v;
@ -815,9 +813,6 @@ static void weld_poly_loop_ctx_alloc(Span<MPoly> polys,
int e_dest = edge_dest_map[e];
bool is_vert_ctx = v_dest != OUT_OF_CONTEXT;
bool is_edge_ctx = e_dest != OUT_OF_CONTEXT;
if (is_vert_ctx) {
vert_ctx_len++;
}
if (is_vert_ctx || is_edge_ctx) {
WeldLoop wl{};
wl.vert = is_vert_ctx ? v_dest : v;
@ -845,9 +840,11 @@ static void weld_poly_loop_ctx_alloc(Span<MPoly> polys,
wpoly.append(wp);
poly_map[i] = wpoly_len++;
if (totloop > 5 && vert_ctx_len > 1) {
/* Each untouched vertex pair is a candidate for a new polygon. */
int max_new = std::min(vert_ctx_len, (totloop - vert_ctx_len) / 2);
if (totloop > 5 && loops_len > 1) {
/* We could be smarter here and actually count how many new polygons will be created.
* But counting this can be inefficient as it depends on the number of non-consecutive
* self polygon merges. For now just estimate a maximum value. */
int max_new = std::min((totloop / 3), loops_len) - 1;
maybe_new_poly += max_new;
CLAMP_MIN(max_ctx_poly_len, totloop);
}
@ -1115,7 +1112,7 @@ static int poly_find_doubles(const OffsetIndices<int> poly_corners_offsets,
{
/* Fills the `r_buffer` buffer with the intersection of the arrays in `buffer_a` and `buffer_b`.
* `buffer_a` and `buffer_b` have a sequence of sorted, non-repeating indices representing
* polygons. */
* polygons. */
const auto intersect = [](const Span<int> buffer_a, const Span<int> buffer_b, int *r_buffer) {
int result_num = 0;
int index_a = 0, index_b = 0;

View File

@ -548,7 +548,7 @@ static void sample_interval_bezier(const Span<float3> src_positions,
}
}
else {
/* General case, compute the insertion point. */
/* General case, compute the insertion point. */
end_point_insert = knot_insert_bezier(
src_positions, src_handles_l, src_handles_r, end_point);
@ -1063,7 +1063,7 @@ bke::CurvesGeometry trim_curves(const bke::CurvesGeometry &src_curves,
dst_curves.attributes_for_write().remove("cyclic");
}
else {
/* Only trimmed curves are no longer cyclic. */
/* Only trimmed curves are no longer cyclic. */
if (bke::SpanAttributeWriter cyclic = dst_attributes.lookup_for_write_span<bool>("cyclic")) {
cyclic.span.fill_indices(selection, false);
cyclic.finish();

View File

@ -39,8 +39,8 @@ class UVAABBIsland {
*
* In theory, alpaca_turbo should be the fastest non-trivial packer, hence the "turbo" suffix.
*
* Technically, the algorithm here is only O(n), In practice, to get reasonable results, the input
* must be pre-sorted, which costs an additional O(nlogn) time complexity.
* Technically, the algorithm here is only `O(n)`, In practice, to get reasonable results,
* the input must be pre-sorted, which costs an additional `O(nlogn)` time complexity.
*/
static void pack_islands_alpaca_turbo(const Span<UVAABBIsland *> islands,
float *r_max_u,
@ -100,21 +100,20 @@ static float pack_islands_scale_margin(const Span<PackIsland *> islands,
const float scale,
const float margin)
{
/* #BLI_box_pack_2d produces layouts with high packing efficiency, but has O(n^3)
/* #BLI_box_pack_2d produces layouts with high packing efficiency, but has `O(n^3)`
* time complexity, causing poor performance if there are lots of islands. See: #102843.
* #pack_islands_alpaca_turbo is designed to be the fastest packing method, O(nlogn),
* #pack_islands_alpaca_turbo is designed to be the fastest packing method, `O(nlogn)`,
* but has poor packing efficiency if the AABBs have a spread of sizes and aspect ratios.
* Here, we merge the best properties of both packers into one combined packer.
*
* The free tuning parameter, `alpaca_cutoff` will determine how many islands are packed
* using each method.
*
* The current strategy is:
* - Sort islands in size order.
* - Call #BLI_box_pack_2d on the first `alpaca_cutoff` islands.
* - Call #pack_islands_alpaca_turbo on the remaining islands.
* - Combine results.
* - Sort islands in size order.
* - Call #BLI_box_pack_2d on the first `alpaca_cutoff` islands.
* - Call #pack_islands_alpaca_turbo on the remaining islands.
* - Combine results.
*/
/* First, copy information from our input into the AABB structure. */

View File

@ -4197,10 +4197,8 @@ void uv_parametrizer_pack(ParamHandle *handle, float margin, bool do_rotate, boo
for (int64_t i : pack_island_vector.index_range()) {
BoxPack *box = box_array + i;
PackIsland *pack_island = pack_island_vector[box->index];
pack_island->bounds_rect.xmin = box->x;
pack_island->bounds_rect.ymin = box->y;
pack_island->bounds_rect.xmax = box->x + box->w;
pack_island->bounds_rect.ymax = box->y + box->h;
pack_island->bounds_rect.xmin = box->x - pack_island->bounds_rect.xmin;
pack_island->bounds_rect.ymin = box->y - pack_island->bounds_rect.ymin;
}
unpacked = 0;
@ -4213,17 +4211,13 @@ void uv_parametrizer_pack(ParamHandle *handle, float margin, bool do_rotate, boo
}
PackIsland *pack_island = pack_island_vector[i - unpacked];
float minv[2];
float maxv[2];
p_chart_uv_bbox(chart, minv, maxv);
/* TODO: Replace with #mul_v2_m2_add_v2v2 here soon. */
float m[2];
float b[2];
m[0] = scale[0];
m[1] = scale[1];
b[0] = pack_island->bounds_rect.xmin - minv[0];
b[1] = pack_island->bounds_rect.ymin - minv[1];
b[0] = pack_island->bounds_rect.xmin;
b[1] = pack_island->bounds_rect.ymin;
for (PVert *v = chart->verts; v; v = v->nextlink) {
/* Unusual accumulate-and-multiply here (will) reduce round-off error. */
v->uv[0] = m[0] * (v->uv[0] + b[0]);

View File

@ -811,7 +811,6 @@ if(WITH_GTESTS)
tests/gpu_index_buffer_test.cc
tests/gpu_push_constants_test.cc
tests/gpu_shader_builtin_test.cc
tests/gpu_shader_test.cc
tests/gpu_storage_buffer_test.cc

View File

@ -1006,7 +1006,7 @@ void GPU_material_optimize(GPUMaterial *mat)
* NOTE(Threading): Need to verify if GPU_generate_pass can cause side-effects, especially when
* used with "thunk". So far, this appears to work, and deferring optimized pass creation is more
* optimal, as these do not benefit from caching, due to baked constants. However, this could
* possibly be cause for concern for certain cases. */
* possibly be cause for concern for certain cases. */
if (!mat->optimized_pass) {
mat->optimized_pass = GPU_generate_pass(
mat, &mat->graph, mat->optimize_pass_info.callback, mat->optimize_pass_info.thunk, true);

View File

@ -40,7 +40,7 @@ class MTLBatch : public Batch {
VertexBufferID bufferIds[GPU_BATCH_VBO_MAX_LEN] = {};
/* Cache life index compares a cache entry with the active MTLBatch state.
* This is initially set to the cache life index of MTLBatch. If the batch has been modified,
* this index is incremented to cheaply invalidate existing cache entries. */
* this index is incremented to cheaply invalidate existing cache entries. */
uint32_t cache_life_index = 0;
};

View File

@ -619,7 +619,7 @@ void MTLBatch::prepare_vertex_descriptor_and_bindings(
* Vertex Descriptors are required to generate a pipeline state, based on the current Batch's
* buffer bindings. These bindings are a unique matching, depending on what input attributes a
* batch has in its buffers, and those which are supported by the shader interface.
*
* We iterate through the buffers and resolve which attributes satisfy the requirements of the
* currently bound shader. We cache this data, for a given Batch<->ShderInterface pairing in a
* VAO cache to avoid the need to recalculate this data. */

View File

@ -27,7 +27,7 @@ namespace blender::gpu {
* uint32_t instanceCount;
* uint32_t vertexStart;
* uint32_t baseInstance;
};*/
* }; */
/* MTLDrawIndexedPrimitivesIndirectArguments --
* https://developer.apple.com/documentation/metal/mtldrawindexedprimitivesindirectarguments?language=objc
@ -38,7 +38,7 @@ namespace blender::gpu {
* uint32_t indexStart;
* uint32_t baseVertex;
* uint32_t baseInstance;
};*/
* }; */
#define MDI_ENABLED (buffer_size_ != 0)
#define MDI_DISABLED (buffer_size_ == 0)

View File

@ -497,7 +497,7 @@ void gpu::MTLTexture::update_sub(
}
/* Early exit if update size is zero. update_sub sometimes has a zero-sized
* extent when called from texture painting. */
* extent when called from texture painting. */
if (totalsize <= 0 || extent[0] <= 0) {
MTL_LOG_WARNING(
"MTLTexture::update_sub called with extent size of zero for one or more dimensions. "
@ -643,7 +643,7 @@ void gpu::MTLTexture::update_sub(
/* For compute, we should use a stating texture to avoid texture write usage,
* if it has not been specified for the texture. Using shader-write disables
* lossless texture compression, so this is best to avoid where possible. */
* lossless texture compression, so this is best to avoid where possible. */
if (!(gpu_image_usage_flags_ & GPU_TEXTURE_USAGE_SHADER_WRITE)) {
use_staging_texture = true;
}

View File

@ -176,7 +176,7 @@ MTLPixelFormat gpu_texture_format_to_metal(eGPUTextureFormat tex_format)
return MTLPixelFormatDepth32Float;
case GPU_DEPTH_COMPONENT24:
/* This formal is not supported on Metal.
* Use 32Float depth instead with some conversion steps for download and upload. */
* Use 32Float depth instead with some conversion steps for download and upload. */
return MTLPixelFormatDepth32Float;
case GPU_DEPTH_COMPONENT16:
return MTLPixelFormatDepth16Unorm;

View File

@ -23,7 +23,7 @@ void main()
vec2 circle_center = vec2(circle_radius_outer - text_width, 0.5);
/* radius in icon space (1 is the icon width). */
/* Radius in icon space (1 is the icon width). */
float radius = length(mask_coord_interp - circle_center);
float mask = smoothstep(circle_radius_inner, circle_radius_outer, radius);

View File

@ -55,7 +55,7 @@ GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_binding_test)
.compute_source("gpu_compute_dummy_test.glsl")
.do_static_compilation(true);
/* Push constants*/
/* Push constants. */
GPU_SHADER_CREATE_INFO(gpu_push_constants_base_test)
.local_group_size(1)
.storage_buf(0, Qualifier::WRITE, "float", "data_out[]")

View File

@ -1,68 +0,0 @@
/* SPDX-License-Identifier: Apache-2.0 */
#include "gpu_testing.hh"
#include "GPU_shader.h"
namespace blender::gpu::tests {
static void test_compile_builtin_shader(eGPUBuiltinShader shader_type, eGPUShaderConfig sh_cfg)
{
GPUShader *sh = GPU_shader_get_builtin_shader_with_config(shader_type, sh_cfg);
EXPECT_NE(sh, nullptr);
}
static void test_compile_builtin_shader(eGPUBuiltinShader shader_type)
{
test_compile_builtin_shader(shader_type, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(shader_type, GPU_SHADER_CFG_CLIPPED);
}
static void test_shader_builtin()
{
GPU_shader_free_builtin_shaders();
test_compile_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
test_compile_builtin_shader(GPU_SHADER_3D_SMOOTH_COLOR);
test_compile_builtin_shader(GPU_SHADER_3D_DEPTH_ONLY);
test_compile_builtin_shader(GPU_SHADER_3D_FLAT_COLOR);
test_compile_builtin_shader(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
test_compile_builtin_shader(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA);
test_compile_builtin_shader(GPU_SHADER_TEXT, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_KEYFRAME_SHAPE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_SIMPLE_LIGHTING, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_IMAGE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_IMAGE_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_DESATURATE_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_RECT_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_ICON_MULTI, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_CHECKER, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_DIAG_STRIPES, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR,
GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_POLYLINE_FLAT_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_OVERLAYS_STEREO_MERGE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA,
GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA,
GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR,
GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_GPENCIL_STROKE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_AREA_BORDERS, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_WIDGET_BASE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_WIDGET_BASE_INST, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_WIDGET_SHADOW, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_NODELINK, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_NODELINK_INST, GPU_SHADER_CFG_DEFAULT);
}
GPU_TEST(shader_builtin)
} // namespace blender::gpu::tests

View File

@ -19,6 +19,7 @@
#include "MEM_guardedalloc.h"
#include "gpu_shader_create_info.hh"
#include "gpu_shader_create_info_private.hh"
#include "gpu_shader_dependency_private.h"
#include "gpu_testing.hh"
@ -26,6 +27,12 @@ namespace blender::gpu::tests {
using namespace blender::gpu::shader;
static void test_shader_compile_statically_defined()
{
EXPECT_TRUE(gpu_shader_create_info_compile_all());
}
GPU_TEST(shader_compile_statically_defined)
static void test_gpu_shader_compute_2d()
{

View File

@ -70,35 +70,53 @@ bool VKBuffer::create(VKContext &context,
VkResult result = vmaCreateBuffer(
allocator, &create_info, &vma_create_info, &vk_buffer_, &allocation_, nullptr);
return result == VK_SUCCESS;
}
bool VKBuffer::update(VKContext &context, const void *data)
{
void *mapped_memory;
bool result = map(context, &mapped_memory);
if (result) {
memcpy(mapped_memory, data, size_in_bytes_);
unmap(context);
if (result != VK_SUCCESS) {
return false;
}
return result;
/* All buffers are mapped to virtual memory. */
return map(context);
}
bool VKBuffer::map(VKContext &context, void **r_mapped_memory) const
void VKBuffer::update(const void *data) const
{
BLI_assert_msg(is_mapped(), "Cannot update a non-mapped buffer.");
memcpy(mapped_memory_, data, size_in_bytes_);
}
void VKBuffer::read(void *data) const
{
BLI_assert_msg(is_mapped(), "Cannot read a non-mapped buffer.");
memcpy(data, mapped_memory_, size_in_bytes_);
}
bool VKBuffer::is_mapped() const
{
return mapped_memory_ != nullptr;
}
bool VKBuffer::map(VKContext &context)
{
BLI_assert(!is_mapped());
VmaAllocator allocator = context.mem_allocator_get();
VkResult result = vmaMapMemory(allocator, allocation_, r_mapped_memory);
VkResult result = vmaMapMemory(allocator, allocation_, &mapped_memory_);
return result == VK_SUCCESS;
}
void VKBuffer::unmap(VKContext &context) const
void VKBuffer::unmap(VKContext &context)
{
BLI_assert(is_mapped());
VmaAllocator allocator = context.mem_allocator_get();
vmaUnmapMemory(allocator, allocation_);
mapped_memory_ = nullptr;
}
bool VKBuffer::free(VKContext &context)
{
if (is_mapped()) {
unmap(context);
}
VmaAllocator allocator = context.mem_allocator_get();
vmaDestroyBuffer(allocator, vk_buffer_, allocation_);
return true;

View File

@ -21,6 +21,8 @@ class VKBuffer {
int64_t size_in_bytes_;
VkBuffer vk_buffer_ = VK_NULL_HANDLE;
VmaAllocation allocation_ = VK_NULL_HANDLE;
/* Pointer to the virtually mapped memory. */
void *mapped_memory_ = nullptr;
public:
VKBuffer() = default;
@ -33,10 +35,9 @@ class VKBuffer {
int64_t size,
GPUUsageType usage,
VkBufferUsageFlagBits buffer_usage);
bool update(VKContext &context, const void *data);
void update(const void *data) const;
void read(void *data) const;
bool free(VKContext &context);
bool map(VKContext &context, void **r_mapped_memory) const;
void unmap(VKContext &context) const;
int64_t size_in_bytes() const
{
@ -47,5 +48,11 @@ class VKBuffer {
{
return vk_buffer_;
}
private:
/** Check if this buffer is mapped. */
bool is_mapped() const;
bool map(VKContext &context);
void unmap(VKContext &context);
};
} // namespace blender::gpu

View File

@ -35,11 +35,7 @@ void VKIndexBuffer::read(uint32_t *data) const
VKCommandBuffer &command_buffer = context.command_buffer_get();
command_buffer.submit();
void *mapped_memory;
if (buffer_.map(context, &mapped_memory)) {
memcpy(data, mapped_memory, size_get());
buffer_.unmap(context);
}
buffer_.read(data);
}
void VKIndexBuffer::update_sub(uint /*start*/, uint /*len*/, const void * /*data*/)

View File

@ -15,13 +15,13 @@ namespace blender::gpu {
* Information about alignment/components and memory size for types when using std140 layout.
*/
struct Std140 {
/** Get the memory size in bytes of a single component using by the given type.*/
/** Get the memory size in bytes of a single component using by the given type. */
static uint32_t component_mem_size(const shader::Type type);
/** Get to alignment of the given type in bytes.*/
/** Get to alignment of the given type in bytes. */
static uint32_t element_alignment(const shader::Type type, bool is_array);
/** Get the number of components that should be allocated for the given type.*/
/** Get the number of components that should be allocated for the given type. */
static uint32_t element_components_len(const shader::Type type);
/** Get the number of components of the given type when used in an array.*/
/** Get the number of components of the given type when used in an array. */
static uint32_t array_components_len(const shader::Type type);
};
@ -29,13 +29,13 @@ struct Std140 {
* Information about alignment/components and memory size for types when using std430 layout.
*/
struct Std430 {
/** Get the memory size in bytes of a single component using by the given type.*/
/** Get the memory size in bytes of a single component using by the given type. */
static uint32_t component_mem_size(const shader::Type type);
/** Get to alignment of the given type in bytes.*/
/** Get to alignment of the given type in bytes. */
static uint32_t element_alignment(const shader::Type type, bool is_array);
/** Get the number of components that should be allocated for the given type.*/
/** Get the number of components that should be allocated for the given type. */
static uint32_t element_components_len(const shader::Type type);
/** Get the number of components of the given type when used in an array.*/
/** Get the number of components of the given type when used in an array. */
static uint32_t array_components_len(const shader::Type type);
};

View File

@ -45,12 +45,12 @@ class VKContext;
*/
class VKPushConstants : NonCopyable {
public:
/** Different methods to store push constants.*/
/** Different methods to store push constants. */
enum class StorageType {
/** Push constants aren't in use.*/
/** Push constants aren't in use. */
NONE,
/** Store push constants as regular vulkan push constants.*/
/** Store push constants as regular vulkan push constants. */
PUSH_CONSTANTS,
/**
@ -67,7 +67,7 @@ class VKPushConstants : NonCopyable {
static constexpr StorageType STORAGE_TYPE_FALLBACK = StorageType::UNIFORM_BUFFER;
struct PushConstant {
/* Used as lookup based on ShaderInput.*/
/* Used as lookup based on ShaderInput. */
int32_t location;
/** Offset in the push constant data (in bytes). */
@ -213,7 +213,7 @@ class VKPushConstants : NonCopyable {
}
/* Store elements in uniform buffer as array. In Std140 arrays have an element stride of 16
* bytes.*/
* bytes. */
BLI_assert(sizeof(T) == 4);
const T *src = input_data;
for (const int i : IndexRange(array_size)) {

View File

@ -909,7 +909,7 @@ static void add_descriptor_set_layout_bindings(
r_bindings.append(create_descriptor_set_layout_binding(location, resource));
}
/* Add push constants to the descriptor when push constants are stored in an uniform buffer.*/
/* Add push constants to the descriptor when push constants are stored in an uniform buffer. */
const VKPushConstants::Layout &push_constants_layout = interface.push_constants_layout_get();
if (push_constants_layout.storage_type_get() == VKPushConstants::StorageType::UNIFORM_BUFFER) {
r_bindings.append(create_descriptor_set_layout_binding(push_constants_layout));

View File

@ -138,8 +138,8 @@ void VKShaderInterface::init(const shader::ShaderCreateInfo &info)
descriptor_set_location_update(input, descriptor_set_location++);
}
/* Post initializing push constants.*/
/* Determine the binding location of push constants fallback buffer.*/
/* Post initializing push constants. */
/* Determine the binding location of push constants fallback buffer. */
int32_t push_constant_descriptor_set_location = -1;
if (push_constants_storage_type == VKPushConstants::StorageType::UNIFORM_BUFFER) {
push_constant_descriptor_set_location = descriptor_set_location++;

Some files were not shown because too many files have changed in this diff Show More