WIP: Brush assets project #106303

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

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
546 changed files with 5572 additions and 5542 deletions
Showing only changes of commit e9a6c790fd - Show all commits

View File

@ -1636,12 +1636,12 @@ class CyclesPreferences(bpy.types.AddonPreferences):
elif device_type == 'ONEAPI':
import sys
if sys.platform.startswith("win"):
driver_version = "XX.X.101.4824"
driver_version = "XX.X.101.5186"
col.label(text=rpt_("Requires Intel GPU with Xe-HPG architecture"), icon='BLANK1', translate=False)
col.label(text=rpt_("and Windows driver version %s or newer") % driver_version,
icon='BLANK1', translate=False)
elif sys.platform.startswith("linux"):
driver_version = "XX.XX.25812.14"
driver_version = "XX.XX.26918.50"
col.label(
text=rpt_("Requires Intel GPU with Xe-HPG architecture and"),
icon='BLANK1',

View File

@ -860,11 +860,11 @@ void OneapiDevice::get_adjusted_global_and_local_sizes(SyclQueue *queue,
/* Compute-runtime (ie. NEO) version is what gets returned by sycl/L0 on Windows
* since Windows driver 101.3268. */
static const int lowest_supported_driver_version_win = 1014824;
static const int lowest_supported_driver_version_win = 1015186;
# ifdef _WIN32
/* For Windows driver 101.4824, compute-runtime version is 26957.
/* For Windows driver 101.5186, compute-runtime version is 28044.
* This information is returned by `ocloc query OCL_DRIVER_VERSION`.*/
static const int lowest_supported_driver_version_neo = 26957;
static const int lowest_supported_driver_version_neo = 28044;
# else
static const int lowest_supported_driver_version_neo = 26918;
# endif

View File

@ -52,6 +52,11 @@ int OneapiDeviceQueue::num_concurrent_busy_states(const size_t /*state_size*/) c
return 4 * max(8 * max_num_threads, 65536);
}
int OneapiDeviceQueue::num_sort_partition_elements() const
{
return 8192;
}
void OneapiDeviceQueue::init_execution()
{
oneapi_device_->load_texture_info();

View File

@ -28,6 +28,8 @@ class OneapiDeviceQueue : public DeviceQueue {
virtual int num_concurrent_busy_states(const size_t state_size) const override;
virtual int num_sort_partition_elements() const override;
virtual void init_execution() override;
virtual bool enqueue(DeviceKernel kernel,

View File

@ -63,7 +63,7 @@ ccl_device_forceinline bool osl_closure_skip(KernelGlobals kg,
return true;
}
/* Glass Caustics */
if (reflect_caustics_disabled && refract_caustics_disabled && has_reflect && has_transmit) {
if (reflect_caustics_disabled && refract_caustics_disabled) {
return true;
}
}
@ -400,8 +400,15 @@ ccl_device void osl_closure_generalized_schlick_bsdf_setup(
preserve_energy = (closure->distribution == make_string("multi_ggx", 16842698693386468366ull));
}
fresnel->reflection_tint = rgb_to_spectrum(closure->reflection_tint);
fresnel->transmission_tint = rgb_to_spectrum(closure->transmission_tint);
const bool reflective_caustics = (kernel_data.integrator.caustics_reflective ||
(path_flag & PATH_RAY_DIFFUSE) == 0);
const bool refractive_caustics = (kernel_data.integrator.caustics_refractive ||
(path_flag & PATH_RAY_DIFFUSE) == 0);
fresnel->reflection_tint = reflective_caustics ? rgb_to_spectrum(closure->reflection_tint) :
zero_spectrum();
fresnel->transmission_tint = refractive_caustics ? rgb_to_spectrum(closure->transmission_tint) :
zero_spectrum();
fresnel->f0 = rgb_to_spectrum(closure->f0);
fresnel->f90 = rgb_to_spectrum(closure->f90);
fresnel->exponent = closure->exponent;

View File

@ -176,12 +176,11 @@ ccl_device
#ifdef __CAUSTICS_TRICKS__
const bool reflective_caustics = (kernel_data.integrator.caustics_reflective ||
(path_flag & PATH_RAY_DIFFUSE) == 0);
const bool glass_caustics = (kernel_data.integrator.caustics_reflective ||
kernel_data.integrator.caustics_refractive ||
(path_flag & PATH_RAY_DIFFUSE) == 0);
const bool refractive_caustics = (kernel_data.integrator.caustics_refractive ||
(path_flag & PATH_RAY_DIFFUSE) == 0);
#else
const bool reflective_caustics = true;
const bool glass_caustics = true;
const bool refractive_caustics = true;
#endif
/* Before any actual shader components, apply transparency. */
@ -302,7 +301,7 @@ ccl_device
/* Transmission component */
if (transmission_weight > CLOSURE_WEIGHT_CUTOFF) {
if (glass_caustics) {
if (reflective_caustics || refractive_caustics) {
ccl_private MicrofacetBsdf *bsdf = (ccl_private MicrofacetBsdf *)bsdf_alloc(
sd, sizeof(MicrofacetBsdf), transmission_weight * weight);
ccl_private FresnelGeneralizedSchlick *fresnel =
@ -320,8 +319,10 @@ ccl_device
fresnel->f0 = make_float3(F0_from_ior(ior)) * specular_tint;
fresnel->f90 = one_spectrum();
fresnel->exponent = -ior;
fresnel->reflection_tint = one_spectrum();
fresnel->transmission_tint = sqrt(rgb_to_spectrum(clamped_base_color));
fresnel->reflection_tint = reflective_caustics ? one_spectrum() : zero_spectrum();
fresnel->transmission_tint = refractive_caustics ?
sqrt(rgb_to_spectrum(clamped_base_color)) :
zero_spectrum();
/* setup bsdf */
sd->flag |= bsdf_microfacet_ggx_glass_setup(bsdf);
@ -556,9 +557,15 @@ ccl_device
case CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID:
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID: {
#ifdef __CAUSTICS_TRICKS__
if (!kernel_data.integrator.caustics_reflective &&
!kernel_data.integrator.caustics_refractive && (path_flag & PATH_RAY_DIFFUSE))
const bool reflective_caustics = (kernel_data.integrator.caustics_reflective ||
(path_flag & PATH_RAY_DIFFUSE) == 0);
const bool refractive_caustics = (kernel_data.integrator.caustics_refractive ||
(path_flag & PATH_RAY_DIFFUSE) == 0);
if (!(reflective_caustics || refractive_caustics))
break;
#else
const bool reflective_caustics = true;
const bool refractive_caustics = true;
#endif
ccl_private MicrofacetBsdf *bsdf = (ccl_private MicrofacetBsdf *)bsdf_alloc(
sd, sizeof(MicrofacetBsdf), make_spectrum(mix_weight));
@ -579,8 +586,9 @@ ccl_device
fresnel->f90 = one_spectrum();
fresnel->exponent = -ior;
const float3 color = stack_load_float3(stack, data_node.z);
fresnel->reflection_tint = color;
fresnel->transmission_tint = color;
fresnel->reflection_tint = reflective_caustics ? rgb_to_spectrum(color) : zero_spectrum();
fresnel->transmission_tint = refractive_caustics ? rgb_to_spectrum(color) :
zero_spectrum();
/* setup bsdf */
if (type == CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID) {

View File

@ -30,7 +30,7 @@
#include "GHOST_C-api.h"
#include "BLF_api.h"
#include "BLF_api.hh"
#include "Basic.h"
#include "EventToBuf.h"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -1,46 +1,186 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="320" height="64" viewBox="0 0 320 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;">
<rect id="bg" x="0" y="0" width="320" height="64" style="fill:#202020; display:none;"/>
<g id="grid" opacity="0.05" style="display:none;">
<rect x="262" y="6" width="52" height="52" style="fill:#fff;"/>
<rect x="198" y="6" width="52" height="52" style="fill:#fff;"/>
<rect x="134" y="6" width="52" height="52" style="fill:#fff;"/>
<rect x="70" y="6" width="52" height="52" style="fill:#fff;"/>
<rect x="6" y="6" width="52" height="52" style="fill:#fff;"/>
<svg
width="256"
height="64"
viewBox="0 0 256 64"
version="1.1"
xml:space="preserve"
style="clip-rule:evenodd;fill-rule:evenodd"
id="svg20"
sodipodi:docname="alert_icons.svg"
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
inkscape:export-filename="alert_icons.png"
inkscape:export-xdpi="384"
inkscape:export-ydpi="384"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs20" /><sodipodi:namedview
id="namedview20"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="3.1002213"
inkscape:cx="160.14986"
inkscape:cy="32.094483"
inkscape:window-width="1920"
inkscape:window-height="1009"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg20" />
<rect
id="bg"
x="0"
y="0"
width="320"
height="64"
style="display:none;fill:#202020" />
<g
id="grid"
opacity="0.05"
style="display:none">
<rect
x="262"
y="6"
width="52"
height="52"
style="fill:#ffffff"
id="rect1" />
<rect
x="198"
y="6"
width="52"
height="52"
style="fill:#ffffff"
id="rect2" />
<rect
x="134"
y="6"
width="52"
height="52"
style="fill:#ffffff"
id="rect3" />
<rect
x="70"
y="6"
width="52"
height="52"
style="fill:#ffffff"
id="rect4" />
<rect
x="6"
y="6"
width="52"
height="52"
style="fill:#ffffff"
id="rect5" />
</g>
<g id="WARNING">
<path d="M37.212,10.038c-1.066,-1.878 -3.059,-3.038 -5.218,-3.038c-2.159,-0 -4.152,1.16 -5.218,3.038l-21,37c-1.054,1.858 -1.042,4.135 0.033,5.981c1.075,1.846 3.049,2.981 5.185,2.981l42,-0c2.136,0 4.11,-1.135 5.185,-2.981c1.075,-1.846 1.087,-4.123 0.033,-5.981l-21,-37Zm-2.609,1.481l21,37c0.527,0.929 0.521,2.068 -0.016,2.991c-0.538,0.922 -1.525,1.49 -2.593,1.49l-42,-0c-1.068,0 -2.055,-0.568 -2.593,-1.49c-0.537,-0.923 -0.543,-2.062 -0.016,-2.991c-0,0 21,-37 21,-37c0.533,-0.939 1.529,-1.519 2.609,-1.519c1.08,0 2.076,0.58 2.609,1.519Z" style="fill:#fff;"/>
<circle cx="32" cy="45.5" r="2.5" style="fill:#fff;"/>
<path d="M32,23c1.38,0 2.5,1.12 2.5,2.5l-1.5,14.5l-2,0l-1.5,-14.5c0,-1.38 1.12,-2.5 2.5,-2.5Z" style="fill:#fff;"/>
<g
id="WARNING">
<path
d="M 37.212,10.038 C 36.146,8.16 34.153,7 31.994,7 29.835,7 27.842,8.16 26.776,10.038 l -21,37 C 4.722,48.896 4.734,51.173 5.809,53.019 6.884,54.865 8.858,56 10.994,56 h 42 c 2.136,0 4.11,-1.135 5.185,-2.981 1.075,-1.846 1.087,-4.123 0.033,-5.981 z m -2.609,1.481 21,37 c 0.527,0.929 0.521,2.068 -0.016,2.991 C 55.049,52.432 54.062,53 52.994,53 h -42 C 9.926,53 8.939,52.432 8.401,51.51 7.864,50.587 7.858,49.448 8.385,48.519 c 0,0 21,-37 21,-37 C 29.918,10.58 30.914,10 31.994,10 c 1.08,0 2.076,0.58 2.609,1.519 z"
style="fill:#ffffff"
id="path5" />
<circle
cx="32"
cy="45.5"
r="2.5"
style="fill:#ffffff"
id="circle5" />
<path
d="m 32,23 c 1.38,0 2.5,1.12 2.5,2.5 L 33,40 H 31 L 29.5,25.5 C 29.5,24.12 30.62,23 32,23 Z"
style="fill:#ffffff"
id="path6" />
</g>
<g id="QUESTION">
<path d="M96,6c14.35,-0 26,11.65 26,26c-0,14.35 -11.65,26 -26,26c-14.35,-0 -26,-11.65 -26,-26c-0,-14.35 11.65,-26 26,-26Zm-0,3c12.694,-0 23,10.306 23,23c-0,12.694 -10.306,23 -23,23c-12.694,-0 -23,-10.306 -23,-23c-0,-12.694 10.306,-23 23,-23Z" style="fill:#fff;"/>
<circle cx="96" cy="44" r="3" style="fill:#fff;"/>
<path d="M90.549,23.479l-1.513,-3.293c-0.002,-0.011 3.28,-2.209 7.964,-2.186c3.557,0.018 5.213,1.34 5.855,1.849c1.185,0.939 2.131,2.714 2.131,5.105c-0,0.741 -0.095,1.683 -0.424,2.567c-0.292,0.787 -0.706,1.528 -1.226,2.142c-0.883,1.042 -2.347,2.273 -2.825,2.656c-0.477,0.382 -1.73,1.348 -2.411,2.341c-0.48,0.7 -0.6,1.743 -0.6,2.485l-0,0.855l-3.5,0l0,-1.236c0,-0.269 0.032,-2.339 0.716,-3.511c0.709,-1.212 1.371,-1.885 2.599,-2.906c1.204,-1.002 2.275,-1.967 2.841,-2.814c0.54,-0.81 0.637,-1.629 0.637,-2.399c0,-0.77 -0.167,-1.716 -1.036,-2.482c-0.797,-0.702 -2.36,-0.865 -3.257,-0.865c-1.083,-0 -1.867,0.158 -2.99,0.526c-1.448,0.475 -2.961,1.166 -2.961,1.166Z" style="fill:#fff;"/>
<g
id="QUESTION">
<path
d="m 96,6 c 14.35,0 26,11.65 26,26 0,14.35 -11.65,26 -26,26 C 81.65,58 70,46.35 70,32 70,17.65 81.65,6 96,6 Z m 0,3 c 12.694,0 23,10.306 23,23 0,12.694 -10.306,23 -23,23 C 83.306,55 73,44.694 73,32 73,19.306 83.306,9 96,9 Z"
style="fill:#ffffff"
id="path7" />
<circle
cx="96"
cy="44"
r="3"
style="fill:#ffffff"
id="circle7" />
<path
d="M 90.549,23.479 89.036,20.186 C 89.034,20.175 92.316,17.977 97,18 c 3.557,0.018 5.213,1.34 5.855,1.849 1.185,0.939 2.131,2.714 2.131,5.105 0,0.741 -0.095,1.683 -0.424,2.567 -0.292,0.787 -0.706,1.528 -1.226,2.142 -0.883,1.042 -2.347,2.273 -2.825,2.656 -0.477,0.382 -1.73,1.348 -2.411,2.341 -0.48,0.7 -0.6,1.743 -0.6,2.485 V 38 H 94 v -1.236 c 0,-0.269 0.032,-2.339 0.716,-3.511 0.709,-1.212 1.371,-1.885 2.599,-2.906 1.204,-1.002 2.275,-1.967 2.841,-2.814 0.54,-0.81 0.637,-1.629 0.637,-2.399 0,-0.77 -0.167,-1.716 -1.036,-2.482 -0.797,-0.702 -2.36,-0.865 -3.257,-0.865 -1.083,0 -1.867,0.158 -2.99,0.526 -1.448,0.475 -2.961,1.166 -2.961,1.166 z"
style="fill:#ffffff"
id="path8" />
</g>
<g id="ERROR">
<path d="M186,22.059c0,-0.531 -0.211,-1.039 -0.586,-1.414l-14.059,-14.059c-0.375,-0.375 -0.883,-0.586 -1.414,-0.586l-19.882,0c-0.531,0 -1.039,0.211 -1.414,0.586l-14.059,14.059c-0.375,0.375 -0.586,0.883 -0.586,1.414l-0,19.882c0,0.531 0.211,1.039 0.586,1.414l14.059,14.059c0.375,0.375 0.883,0.586 1.414,0.586l19.882,-0c0.531,-0 1.039,-0.211 1.414,-0.586l14.059,-14.059c0.375,-0.375 0.586,-0.883 0.586,-1.414l-0,-19.882Zm-3,0.828c0,-0.265 -0.105,-0.519 -0.293,-0.707l-12.887,-12.887c-0.188,-0.188 -0.442,-0.293 -0.707,-0.293l-18.226,0c-0.265,0 -0.519,0.105 -0.707,0.293l-12.887,12.887c-0.188,0.188 -0.293,0.442 -0.293,0.707l0,18.226c0,0.265 0.105,0.519 0.293,0.707l12.887,12.887c0.188,0.188 0.442,0.293 0.707,0.293l18.226,-0c0.265,0 0.519,-0.105 0.707,-0.293l12.887,-12.887c0.188,-0.188 0.293,-0.442 0.293,-0.707l0,-18.226Z" style="fill:#fff;"/>
<path d="M150.808,19.979c-0.391,-0.39 -1.024,-0.39 -1.415,0l-1.414,1.414c-0.39,0.391 -0.39,1.024 0,1.415l21.213,21.213c0.391,0.39 1.024,0.39 1.415,-0l1.414,-1.414c0.39,-0.391 0.39,-1.024 -0,-1.415l-21.213,-21.213Z" style="fill:#fff;"/>
<path d="M172.021,22.808c0.39,-0.391 0.39,-1.024 -0,-1.415l-1.414,-1.414c-0.391,-0.39 -1.024,-0.39 -1.415,0l-21.213,21.213c-0.39,0.391 -0.39,1.024 0,1.415l1.414,1.414c0.391,0.39 1.024,0.39 1.415,-0l21.213,-21.213Z" style="fill:#fff;"/>
<g
id="ERROR">
<path
d="m 186,22.059 c 0,-0.531 -0.211,-1.039 -0.586,-1.414 L 171.355,6.586 C 170.98,6.211 170.472,6 169.941,6 h -19.882 c -0.531,0 -1.039,0.211 -1.414,0.586 L 134.586,20.645 C 134.211,21.02 134,21.528 134,22.059 v 19.882 c 0,0.531 0.211,1.039 0.586,1.414 l 14.059,14.059 c 0.375,0.375 0.883,0.586 1.414,0.586 h 19.882 c 0.531,0 1.039,-0.211 1.414,-0.586 L 185.414,43.355 C 185.789,42.98 186,42.472 186,41.941 Z m -3,0.828 c 0,-0.265 -0.105,-0.519 -0.293,-0.707 L 169.82,9.293 C 169.632,9.105 169.378,9 169.113,9 h -18.226 c -0.265,0 -0.519,0.105 -0.707,0.293 L 137.293,22.18 C 137.105,22.368 137,22.622 137,22.887 v 18.226 c 0,0.265 0.105,0.519 0.293,0.707 l 12.887,12.887 c 0.188,0.188 0.442,0.293 0.707,0.293 h 18.226 c 0.265,0 0.519,-0.105 0.707,-0.293 L 182.707,41.82 C 182.895,41.632 183,41.378 183,41.113 Z"
style="fill:#ffffff"
id="path9" />
<path
d="m 150.808,19.979 c -0.391,-0.39 -1.024,-0.39 -1.415,0 l -1.414,1.414 c -0.39,0.391 -0.39,1.024 0,1.415 l 21.213,21.213 c 0.391,0.39 1.024,0.39 1.415,0 l 1.414,-1.414 c 0.39,-0.391 0.39,-1.024 0,-1.415 z"
style="fill:#ffffff"
id="path10" />
<path
d="m 172.021,22.808 c 0.39,-0.391 0.39,-1.024 0,-1.415 l -1.414,-1.414 c -0.391,-0.39 -1.024,-0.39 -1.415,0 l -21.213,21.213 c -0.39,0.391 -0.39,1.024 0,1.415 l 1.414,1.414 c 0.391,0.39 1.024,0.39 1.415,0 z"
style="fill:#ffffff"
id="path11" />
</g>
<g id="ERROR-ALT" style="display:none;">
<path d="M186,22.059c0,-0.531 -0.211,-1.039 -0.586,-1.414l-14.059,-14.059c-0.375,-0.375 -0.883,-0.586 -1.414,-0.586l-19.882,0c-0.531,0 -1.039,0.211 -1.414,0.586l-14.059,14.059c-0.375,0.375 -0.586,0.883 -0.586,1.414l-0,19.882c0,0.531 0.211,1.039 0.586,1.414l14.059,14.059c0.375,0.375 0.883,0.586 1.414,0.586l19.882,-0c0.531,-0 1.039,-0.211 1.414,-0.586l14.059,-14.059c0.375,-0.375 0.586,-0.883 0.586,-1.414l-0,-19.882Zm-3,0.828c0,-0.265 -0.105,-0.519 -0.293,-0.707l-12.887,-12.887c-0.188,-0.188 -0.442,-0.293 -0.707,-0.293l-18.226,0c-0.265,0 -0.519,0.105 -0.707,0.293l-12.887,12.887c-0.188,0.188 -0.293,0.442 -0.293,0.707l0,18.226c0,0.265 0.105,0.519 0.293,0.707l12.887,12.887c0.188,0.188 0.442,0.293 0.707,0.293l18.226,-0c0.265,0 0.519,-0.105 0.707,-0.293l12.887,-12.887c0.188,-0.188 0.293,-0.442 0.293,-0.707l0,-18.226Z" style="fill:#fff;"/>
<circle cx="160" cy="44" r="3" style="fill:#fff;"/>
<path d="M160,18c1.656,0 3,1.344 3,3l-2,16l-2,0l-2,-16c0,-1.656 1.344,-3 3,-3Z" style="fill:#fff;"/>
<g
id="ERROR-ALT"
style="display:none">
<path
d="m 186,22.059 c 0,-0.531 -0.211,-1.039 -0.586,-1.414 L 171.355,6.586 C 170.98,6.211 170.472,6 169.941,6 h -19.882 c -0.531,0 -1.039,0.211 -1.414,0.586 L 134.586,20.645 C 134.211,21.02 134,21.528 134,22.059 v 19.882 c 0,0.531 0.211,1.039 0.586,1.414 l 14.059,14.059 c 0.375,0.375 0.883,0.586 1.414,0.586 h 19.882 c 0.531,0 1.039,-0.211 1.414,-0.586 L 185.414,43.355 C 185.789,42.98 186,42.472 186,41.941 Z m -3,0.828 c 0,-0.265 -0.105,-0.519 -0.293,-0.707 L 169.82,9.293 C 169.632,9.105 169.378,9 169.113,9 h -18.226 c -0.265,0 -0.519,0.105 -0.707,0.293 L 137.293,22.18 C 137.105,22.368 137,22.622 137,22.887 v 18.226 c 0,0.265 0.105,0.519 0.293,0.707 l 12.887,12.887 c 0.188,0.188 0.442,0.293 0.707,0.293 h 18.226 c 0.265,0 0.519,-0.105 0.707,-0.293 L 182.707,41.82 C 182.895,41.632 183,41.378 183,41.113 Z"
style="fill:#ffffff"
id="path12" />
<circle
cx="160"
cy="44"
r="3"
style="fill:#ffffff"
id="circle12" />
<path
d="m 160,18 c 1.656,0 3,1.344 3,3 l -2,16 h -2 l -2,-16 c 0,-1.656 1.344,-3 3,-3 z"
style="fill:#ffffff"
id="path13" />
</g>
<g id="INFO">
<path d="M224,6c14.35,-0 26,11.65 26,26c-0,14.35 -11.65,26 -26,26c-14.35,-0 -26,-11.65 -26,-26c-0,-14.35 11.65,-26 26,-26Zm-0,3c12.694,-0 23,10.306 23,23c-0,12.694 -10.306,23 -23,23c-12.694,-0 -23,-10.306 -23,-23c-0,-12.694 10.306,-23 23,-23Z" style="fill:#fff;"/>
<path d="M217.675,29.977l0.232,-1.395c0,0 2.519,-1.582 5.587,-1.582c3.067,-0 4.005,1.542 4.005,3.758c0,3.17 -2.242,7.836 -2.242,10.262c-0,1.379 0.725,1.645 1.861,1.645c0.945,-0 1.921,-0.136 2.367,-0.57l-0.492,1.602c-0,-0 -2.626,1.303 -5.207,1.303c-3.241,0 -4.297,-1.5 -4.28,-3.758c0.018,-2.4 2.249,-7.276 2.249,-10.099c0,-1.734 -1.269,-1.641 -1.917,-1.641c-1.32,-0 -2.163,0.475 -2.163,0.475Z" style="fill:#fff;"/>
<ellipse cx="226.5" cy="21" rx="3.5" ry="3" style="fill:#fff;"/>
<g
id="INFO">
<path
d="m 224,6 c 14.35,0 26,11.65 26,26 0,14.35 -11.65,26 -26,26 -14.35,0 -26,-11.65 -26,-26 0,-14.35 11.65,-26 26,-26 z m 0,3 c 12.694,0 23,10.306 23,23 0,12.694 -10.306,23 -23,23 -12.694,0 -23,-10.306 -23,-23 0,-12.694 10.306,-23 23,-23 z"
style="fill:#ffffff"
id="path14" />
<path
d="m 217.675,29.977 0.232,-1.395 c 0,0 2.519,-1.582 5.587,-1.582 3.067,0 4.005,1.542 4.005,3.758 0,3.17 -2.242,7.836 -2.242,10.262 0,1.379 0.725,1.645 1.861,1.645 0.945,0 1.921,-0.136 2.367,-0.57 l -0.492,1.602 c 0,0 -2.626,1.303 -5.207,1.303 -3.241,0 -4.297,-1.5 -4.28,-3.758 0.018,-2.4 2.249,-7.276 2.249,-10.099 0,-1.734 -1.269,-1.641 -1.917,-1.641 -1.32,0 -2.163,0.475 -2.163,0.475 z"
style="fill:#ffffff"
id="path15" />
<ellipse
cx="226.5"
cy="21"
rx="3.5"
ry="3"
style="fill:#ffffff"
id="ellipse15" />
</g>
<g id="BLENDER">
<path d="M310.66,22.503l-18.849,-14.481c-1.34,-1.042 -3.719,-0.803 -4.899,0.315c-1.14,1.078 -1.095,2.428 0.265,3.486l7.609,6.177l-23.895,0c-1.805,0 -3.795,1.138 -4.224,2.835c-0.482,1.91 1.059,3.165 3.103,3.165l11.938,0l-21.565,16.506c-2.094,1.619 -2.827,4.19 -1.508,5.787c1.289,1.559 3.983,1.635 6.073,0.122l11.865,-9.71c-0.193,1.075 -0.219,2.327 -0.065,3.264c1.52,9.103 10.046,16.034 20.637,16.034c11.525,0 20.855,-8.55 20.855,-18.96c0.007,-5.892 -2.877,-11.109 -7.34,-14.54Zm-13.534,24.534c-7.022,0 -12.714,-5.181 -12.714,-11.515c-0,-6.337 5.692,-11.577 12.714,-11.577c7.022,-0 12.714,5.131 12.714,11.577c0,6.295 -5.692,11.515 -12.714,11.515Z" style="fill:#fff;fill-rule:nonzero;"/>
<path d="M297.391,27.766c-4.479,-0 -8.113,3.342 -8.113,7.383c-0,4.04 3.634,7.343 8.113,7.343c4.48,0 8.114,-3.303 8.114,-7.343c0,-4.041 -3.634,-7.383 -8.114,-7.383Z" style="fill:#fff;fill-rule:nonzero;"/>
</g>
<g id="BLENDER-COLOR" style="display:none;">
<path d="M297,21.75c-8.282,0 -15,6.205 -15,13.75c0,7.545 6.718,13.75 15,13.75c8.282,0 15,-6.205 15,-13.75c0,-7.545 -6.718,-13.75 -15,-13.75Z" style="fill:#fff;fill-rule:nonzero;"/>
<path d="M310.66,22.503l-18.849,-14.481c-1.34,-1.042 -3.719,-0.803 -4.899,0.315c-1.14,1.078 -1.095,2.428 0.265,3.486l7.609,6.177l-23.895,0c-1.805,0 -3.795,1.138 -4.224,2.835c-0.482,1.91 1.059,3.165 3.103,3.165l11.938,0l-21.565,16.506c-2.094,1.619 -2.827,4.19 -1.508,5.787c1.289,1.559 3.983,1.635 6.073,0.122l11.865,-9.71c-0.193,1.075 -0.219,2.327 -0.065,3.264c1.52,9.103 10.046,16.034 20.637,16.034c11.525,0 20.855,-8.55 20.855,-18.96c0.007,-5.892 -2.877,-11.109 -7.34,-14.54Zm-13.534,24.534c-7.022,0 -12.714,-5.181 -12.714,-11.515c-0,-6.337 5.692,-11.577 12.714,-11.577c7.022,-0 12.714,5.131 12.714,11.577c0,6.295 -5.692,11.515 -12.714,11.515Z" style="fill:#e87d0d;fill-rule:nonzero;"/>
<path d="M297.391,27.766c-4.479,-0 -8.113,3.342 -8.113,7.383c-0,4.04 3.634,7.343 8.113,7.343c4.48,0 8.114,-3.303 8.114,-7.343c0,-4.041 -3.634,-7.383 -8.114,-7.383Z" style="fill:#265787;fill-rule:nonzero;"/>
<g
id="BLENDER-COLOR"
style="display:none">
<path
d="m 297,21.75 c -8.282,0 -15,6.205 -15,13.75 0,7.545 6.718,13.75 15,13.75 8.282,0 15,-6.205 15,-13.75 0,-7.545 -6.718,-13.75 -15,-13.75 z"
style="fill:#ffffff;fill-rule:nonzero"
id="path18" />
<path
d="M 310.66,22.503 291.811,8.022 c -1.34,-1.042 -3.719,-0.803 -4.899,0.315 -1.14,1.078 -1.095,2.428 0.265,3.486 L 294.786,18 h -23.895 c -1.805,0 -3.795,1.138 -4.224,2.835 -0.482,1.91 1.059,3.165 3.103,3.165 h 11.938 l -21.565,16.506 c -2.094,1.619 -2.827,4.19 -1.508,5.787 1.289,1.559 3.983,1.635 6.073,0.122 l 11.865,-9.71 c -0.193,1.075 -0.219,2.327 -0.065,3.264 1.52,9.103 10.046,16.034 20.637,16.034 11.525,0 20.855,-8.55 20.855,-18.96 0.007,-5.892 -2.877,-11.109 -7.34,-14.54 z m -13.534,24.534 c -7.022,0 -12.714,-5.181 -12.714,-11.515 0,-6.337 5.692,-11.577 12.714,-11.577 7.022,0 12.714,5.131 12.714,11.577 0,6.295 -5.692,11.515 -12.714,11.515 z"
style="fill:#e87d0d;fill-rule:nonzero"
id="path19" />
<path
d="m 297.391,27.766 c -4.479,0 -8.113,3.342 -8.113,7.383 0,4.04 3.634,7.343 8.113,7.343 4.48,0 8.114,-3.303 8.114,-7.343 0,-4.041 -3.634,-7.383 -8.114,-7.383 z"
style="fill:#265787;fill-rule:nonzero"
id="path20" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -19,7 +19,7 @@ if not (inkscape_bin := os.environ.get("INKSCAPE_BIN")):
cmd = (
inkscape_bin,
os.path.join(BASEDIR, "alert_icons.svg"),
"--export-width=1280",
"--export-width=1024",
"--export-height=256",
"--export-type=png",
"--export-filename=" + os.path.join(BASEDIR, "alert_icons.png"),

View File

@ -632,24 +632,36 @@ def _fake_module_from_extension(mod_name, mod_path, force_support=None):
try:
with open(filepath, "rb") as fh:
data = tomllib.load(fh)
bl_info["name"] = data["name"]
bl_info["version"] = data["version"]
bl_info["author"] = data["author"]
bl_info["category"] = "Development" # Dummy, will be removed.
except BaseException as ex:
print("Error:", str(ex), "in", filepath)
return None
# Full validation must be done on install.
try:
assert type(bl_info["name"]) is str
assert type(bl_info["version"]) is str
assert type(bl_info["author"]) is str
assert type(bl_info["category"]) is str
except BaseException as ex:
print("Error:", str(ex), "in", filepath)
# This isn't a full validation which happens on package install/update.
if (value := data.get("name", None)) is None:
print("Error: missing \"name\" from in", filepath)
return None
if type(value) is not str:
print("Error: \"name\" is not a string in", filepath)
return None
bl_info["name"] = value
if (value := data.get("version", None)) is None:
print("Error: missing \"version\" from in", filepath)
return None
if type(value) is not str:
print("Error: \"version\" is not a string in", filepath)
return None
bl_info["version"] = value
if (value := data.get("author", None)) is None:
print("Error: missing \"author\" from in", filepath)
return None
if (type(value) is not list) or any(x for x in value if type(x) is not str):
print("Error: \"author\" is not a list of strings in", filepath)
return None
bl_info["author"] = ", ".join(value)
bl_info["category"] = "Development" # Dummy, will be removed.
if force_support is not None:
bl_info["support"] = force_support
@ -691,7 +703,7 @@ class _ext_global:
# The name (in `sys.modules`) keep this short because it's stored as part of add-on modules name.
_ext_base_pkg_idname = "bl_ext"
_ext_base_pkg_idname_with_dot = _ext_base_pkg_idname + "."
_ext_manifest_filename_toml = "bl_manifest.toml"
_ext_manifest_filename_toml = "blender_manifest.toml"
def _extension_preferences_idmap():

View File

@ -83,6 +83,7 @@ def rna_idprop_ui_create(
step=None,
precision=None,
id_type='OBJECT',
items=None,
):
"""Create and initialize a custom property with limits, defaults and other settings."""
@ -129,16 +130,24 @@ def rna_idprop_ui_create(
if step is None:
step = 1
ui_data.update(
subtype=subtype,
min=min,
max=max,
soft_min=soft_min,
soft_max=soft_max,
step=step,
description=description,
default=default,
)
if items is None:
ui_data.update(
subtype=subtype,
min=min,
max=max,
soft_min=soft_min,
soft_max=soft_max,
step=step,
description=description,
default=default,
)
else:
ui_data.update(
subtype=subtype,
description=description,
default=default,
items=items,
)
else:
raise TypeError("Unexpected value type")

View File

@ -160,7 +160,7 @@ class BakeToKeyframes(Operator):
# NOTE: assume that on first frame, the starting rotation is appropriate
obj.rotation_euler = mat.to_euler(rot_mode, obj.rotation_euler)
bpy.ops.anim.keyframe_insert(type='BUILTIN_KSI_LocRot')
bpy.ops.anim.keyframe_insert_by_name(type='BUILTIN_KSI_LocRot')
# remove baked objects from simulation
bpy.ops.rigidbody.objects_remove()

View File

@ -674,6 +674,13 @@ class PREFERENCES_OT_addon_install(Operator):
return {'CANCELLED'}
file_to_extract_root = _zipfile_root_namelist(file_to_extract)
if "__init__.py" in file_to_extract_root:
self.report({'ERROR'}, rpt_(
"ZIP packaged incorrectly; __init__.py should be in a directory, not at top-level"
))
return {'CANCELLED'}
if self.overwrite:
for f in file_to_extract_root:
_module_filesystem_remove(path_addons, f)

View File

@ -226,7 +226,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
def poll(cls, context):
engine = context.engine
obj = context.object
return (obj and obj.type in {'MESH', 'LATTICE'} and (engine in cls.COMPAT_ENGINES))
return (obj and obj.type in {'MESH', 'LATTICE', 'GREASEPENCIL'} and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout

View File

@ -150,6 +150,7 @@ class OBJECT_MT_modifier_add_generate(ModifierAddMenu, Menu):
if ob_type == 'MESH':
self.operator_modifier_add(layout, 'WIREFRAME')
if ob_type == 'GREASEPENCIL':
self.operator_modifier_add(layout, 'GREASE_PENCIL_MIRROR')
self.operator_modifier_add(layout, 'GREASE_PENCIL_SUBDIV')
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)
@ -188,9 +189,10 @@ class OBJECT_MT_modifier_add_deform(ModifierAddMenu, Menu):
if ob_type == 'VOLUME':
self.operator_modifier_add(layout, 'VOLUME_DISPLACE')
if ob_type == 'GREASEPENCIL':
self.operator_modifier_add(layout, 'GREASE_PENCIL_SMOOTH')
self.operator_modifier_add(layout, 'GREASE_PENCIL_OFFSET')
self.operator_modifier_add(layout, 'GREASE_PENCIL_NOISE')
self.operator_modifier_add(layout, 'GREASE_PENCIL_OFFSET')
self.operator_modifier_add(layout, 'GREASE_PENCIL_SMOOTH')
self.operator_modifier_add(layout, 'GREASE_PENCIL_THICKNESS')
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)

View File

@ -393,7 +393,14 @@ class StrokePanel(BrushPanel):
col.row().prop(brush, "jitter_unit", expand=True)
col.separator()
col.prop(settings, "input_samples")
UnifiedPaintPanel.prop_unified(
layout,
context,
brush,
"input_samples",
unified_name="use_unified_input_samples",
slider=True,
)
class SmoothStrokePanel(BrushPanel):

View File

@ -2000,39 +2000,37 @@ class USERPREF_PT_keymap(KeymapPanel, Panel):
# -----------------------------------------------------------------------------
# Extension Panels
class ExtensionsPanel:
bl_space_type = 'PREFERENCES'
bl_region_type = 'WINDOW'
bl_context = "extensions"
class USERPREF_PT_extensions(ExtensionsPanel, Panel):
bl_label = "Extensions"
class USERPREF_PT_extensions_repos(Panel):
bl_label = "Repositories"
bl_options = {'HIDE_HEADER'}
# NOTE: currently disabled by an add-on when used.
unused = True
bl_space_type = 'TOPBAR' # dummy.
bl_region_type = 'HEADER'
# Show wider than most panels so the URL & directory aren't overly clipped.
bl_ui_units_x = 24
# NOTE: ideally `if panel := layout.panel("extensions_repo_advanced", default_closed=True):`
# would be used but it isn't supported here, use a kludge to achieve a similar UI.
_panel_layout_kludge_state = False
@classmethod
def poll(cls, _context):
return cls.unused
def _panel_layout_kludge(cls, layout, *, text):
row = layout.row(align=True)
row.alignment = 'LEFT'
show_advanced = USERPREF_PT_extensions_repos._panel_layout_kludge_state
props = row.operator(
"wm.context_toggle",
text="Advanced",
icon='DOWNARROW_HLT' if show_advanced else 'RIGHTARROW',
emboss=False,
)
props.module = "bl_ui.space_userpref"
props.data_path = "USERPREF_PT_extensions_repos._panel_layout_kludge_state"
def draw(self, context):
layout = self.layout
row = layout.row()
row.label(text="The add-on to use extensions is disabled!")
row = layout.row()
row.label(text="Enable \"Blender Extensions\" add-on in Testing to use extensions.")
class USERPREF_PT_extensions_repos(ExtensionsPanel, Panel):
bl_label = "Repositories"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
return context.preferences.experimental.use_extension_repos
if show_advanced:
return layout.column()
return None
def draw(self, context):
layout = self.layout
@ -2065,11 +2063,13 @@ class USERPREF_PT_extensions_repos(ExtensionsPanel, Panel):
layout.separator()
layout.prop(active_repo, "directory")
layout.prop(active_repo, "remote_path")
row = layout.row()
row.prop(active_repo, "use_cache")
row.prop(active_repo, "module")
if layout_panel := self._panel_layout_kludge(layout, text="Advanced"):
layout_panel.prop(active_repo, "directory")
row = layout_panel.row()
row.prop(active_repo, "use_cache")
row.prop(active_repo, "module")
# -----------------------------------------------------------------------------
@ -2120,6 +2120,23 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
return True
return False
@staticmethod
def draw_addon_preferences(layout, context, addon_preferences):
if (draw := getattr(addon_preferences, "draw", None)) is None:
return
addon_preferences_class = type(addon_preferences)
box_prefs = layout.box()
box_prefs.label(text="Preferences:")
addon_preferences_class.layout = box_prefs
try:
draw(context)
except BaseException:
import traceback
traceback.print_exc()
box_prefs.label(text="Error (see console)", icon='ERROR')
del addon_preferences_class.layout
@staticmethod
def draw_error(layout, message):
lines = message.split("\n")
@ -2146,13 +2163,6 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
row.prop(wm, "addon_filter", text="")
row.prop(wm, "addon_search", text="", icon='VIEWZOOM')
@staticmethod
def _draw_addon_header_for_extensions(layout, prefs, wm):
row = layout.row()
row.prop(wm, "addon_search", text="", icon='VIEWZOOM')
row.popover("USERPREF_PT_addons_filter", text="", icon='FILTER')
# See `_draw_addon_header_for_extensions_popover` for most content.
@staticmethod
def _draw_addon_header_for_extensions_popover(layout, context):
@ -2174,14 +2184,17 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
import os
import addon_utils
layout = self.layout
wm = context.window_manager
prefs = context.preferences
used_ext = {ext.module for ext in prefs.addons}
# Experimental UI changes proposed in: #117285.
use_extension_repos = prefs.experimental.use_extension_repos
if use_extension_repos:
# Rely on the draw function being appended to by the extensions add-on.
return
layout = self.layout
wm = context.window_manager
used_addon_module_name_map = {addon.module: addon for addon in prefs.addons}
addon_user_dirs = tuple(
p for p in (
@ -2197,10 +2210,7 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
for mod in addon_utils.modules(refresh=False)
]
if use_extension_repos:
self._draw_addon_header_for_extensions(layout, prefs, wm)
else:
self._draw_addon_header(layout, prefs, wm)
self._draw_addon_header(layout, prefs, wm)
col = layout.column()
@ -2230,16 +2240,13 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
search = wm.addon_search.lower()
support = wm.addon_support
if use_extension_repos:
filter = "All"
# initialized on demand
user_addon_paths = []
for mod, info in addons:
module_name = mod.__name__
is_enabled = module_name in used_ext
is_enabled = module_name in used_addon_module_name_map
if info["support"] not in support:
continue
@ -2279,26 +2286,21 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
emboss=False,
).module = module_name
if not use_extension_repos:
row.operator(
"preferences.addon_disable" if is_enabled else "preferences.addon_enable",
icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', text="",
emboss=False,
).module = module_name
row.operator(
"preferences.addon_disable" if is_enabled else "preferences.addon_enable",
icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', text="",
emboss=False,
).module = module_name
sub = row.row()
sub.active = is_enabled
if use_extension_repos:
sub.label(text=iface_(info["name"]))
else:
sub.label(text="%s: %s" % (iface_(info["category"]), iface_(info["name"])))
sub.label(text="%s: %s" % (iface_(info["category"]), iface_(info["name"])))
if info["warning"]:
sub.label(icon='ERROR')
# icon showing support level.
if not use_extension_repos:
sub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION'))
sub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION'))
# Expanded UI (only if additional info is available)
if info["show_expanded"]:
@ -2367,32 +2369,16 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
# Show addon user preferences
if is_enabled:
addon_preferences = prefs.addons[module_name].preferences
if addon_preferences is not None:
draw = getattr(addon_preferences, "draw", None)
if draw is not None:
addon_preferences_class = type(addon_preferences)
box_prefs = col_box.box()
box_prefs.label(text="Preferences:")
addon_preferences_class.layout = box_prefs
try:
draw(context)
except BaseException:
import traceback
traceback.print_exc()
box_prefs.label(text="Error (see console)", icon='ERROR')
del addon_preferences_class.layout
if use_extension_repos:
row.operator(
"preferences.addon_disable" if is_enabled else "preferences.addon_enable",
icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', text="",
emboss=False,
).module = module_name
if (addon_preferences := used_addon_module_name_map[module_name].preferences) is not None:
self.draw_addon_preferences(col_box, context, addon_preferences)
# Append missing scripts
# First collect scripts that are used but have no script file.
module_names = {mod.__name__ for mod, info in addons}
missing_modules = {ext for ext in used_ext if ext not in module_names}
missing_modules = {
module_name for module_name in used_addon_module_name_map
if module_name not in module_names
}
if missing_modules and filter in {"All", "Enabled"}:
col.column().separator()
@ -2400,7 +2386,7 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
module_names = {mod.__name__ for mod, info in addons}
for module_name in sorted(missing_modules):
is_enabled = module_name in used_ext
is_enabled = module_name in used_addon_module_name_map
# Addon UI Code
box = col.column().box()
colsub = box.column()
@ -2779,7 +2765,6 @@ classes = (
USERPREF_PT_addons,
USERPREF_PT_extensions,
USERPREF_PT_extensions_repos,
USERPREF_PT_studiolight_lights,

View File

@ -948,19 +948,18 @@ void insert_key_rna(PointerRNA *rna_pointer,
rna_path.c_str());
continue;
}
char *rna_path_id_to_prop = RNA_path_from_ID_to_property(&ptr, prop);
const std::optional<std::string> rna_path_id_to_prop = RNA_path_from_ID_to_property(&ptr,
prop);
Vector<float> rna_values = get_keyframe_values(&ptr, prop, visual_keyframing);
insert_key_count += insert_key_action(bmain,
action,
rna_pointer,
rna_path_id_to_prop,
rna_path_id_to_prop->c_str(),
nla_frame,
rna_values.as_span(),
insert_key_flags,
key_type);
MEM_freeN(rna_path_id_to_prop);
}
if (insert_key_count == 0) {

View File

@ -353,7 +353,7 @@ bool autokeyframe_property(bContext *C,
ReportList *reports = CTX_wm_reports(C);
ToolSettings *ts = scene->toolsettings;
const eInsertKeyFlags flag = get_autokey_flags(scene);
char *path = RNA_path_from_ID_to_property(ptr, prop);
const std::optional<std::string> path = RNA_path_from_ID_to_property(ptr, prop);
if (only_if_property_keyed) {
/* NOTE: We use rnaindex instead of fcu->array_index,
@ -366,14 +366,12 @@ bool autokeyframe_property(bContext *C,
id,
action,
(fcu && fcu->grp) ? fcu->grp->name : nullptr,
fcu ? fcu->rna_path : path,
fcu ? fcu->rna_path : (path ? path->c_str() : nullptr),
rnaindex,
&anim_eval_context,
eBezTriple_KeyframeType(ts->keyframe_type),
flag) != 0;
if (path) {
MEM_freeN(path);
}
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr);
}
}

View File

@ -11,10 +11,6 @@
#include "BLI_compiler_attrs.h"
#include "BLI_sys_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Name of sub-directory inside #BLENDER_DATAFILES that contains font files. */
#define BLF_DATAFILES_FONTS_DIR "fonts"
@ -407,7 +403,3 @@ struct ResultBLF {
*/
int width;
};
#ifdef __cplusplus
}
#endif

View File

@ -25,9 +25,9 @@ set(SRC
intern/blf_thumbs.cc
intern/blf_util.cc
BLF_api.h
intern/blf_internal.h
intern/blf_internal_types.h
BLF_api.hh
intern/blf_internal.hh
intern/blf_internal_types.hh
)
set(LIB

View File

@ -28,15 +28,15 @@
#include "BLI_string.h"
#include "BLI_threads.h"
#include "BLF_api.h"
#include "BLF_api.hh"
#include "IMB_colormanagement.hh"
#include "GPU_matrix.h"
#include "GPU_shader.h"
#include "blf_internal.h"
#include "blf_internal_types.h"
#include "blf_internal.hh"
#include "blf_internal_types.hh"
#define BLF_RESULT_CHECK_INIT(r_info) \
if (r_info) { \

View File

@ -13,9 +13,9 @@
#include "BLI_assert.h"
#include "BLI_math_vector_types.hh"
#include "BLF_api.h"
#include "BLF_api.hh"
#include "blf_internal.h"
#include "blf_internal.hh"
/* call BLF_default_set first! */
#define ASSERT_DEFAULT_SET BLI_assert(global_font_default != -1)

View File

@ -24,8 +24,8 @@
#include "BLI_fileops.h"
#include "BLI_string.h"
#include "BLF_api.h"
#include "blf_internal.h"
#include "BLF_api.hh"
#include "blf_internal.hh"
char *blf_dir_metrics_search(const char *filepath)
{

View File

@ -38,13 +38,13 @@
#include "BLI_string_utf8.h"
#include "BLI_threads.h"
#include "BLF_api.h"
#include "BLF_api.hh"
#include "GPU_batch.h"
#include "GPU_matrix.h"
#include "blf_internal.h"
#include "blf_internal_types.h"
#include "blf_internal.hh"
#include "blf_internal_types.hh"
#include "BLI_strict_flags.h"

View File

@ -10,7 +10,7 @@
#include <cstdio>
#include "BLF_api.h"
#include "BLF_api.hh"
#include "BLI_fileops.h"
#include "BLI_path_util.h"

View File

@ -22,7 +22,7 @@
# include "BLI_fileops.h"
# include "BLI_utildefines.h"
# include "blf_internal.h"
# include "blf_internal.hh"
/* internal freetype defines */
# define STREAM_FILE(stream) static_cast<FILE *>(stream->descriptor.pointer)

View File

@ -28,14 +28,14 @@
#include "BLI_rect.h"
#include "BLI_threads.h"
#include "BLF_api.h"
#include "BLF_api.hh"
#include "DNA_curve_types.h"
#include "GPU_capabilities.h"
#include "blf_internal.h"
#include "blf_internal_types.h"
#include "blf_internal.hh"
#include "blf_internal_types.hh"
#include "BLI_math_vector.h"
#include "BLI_strict_flags.h"

View File

@ -8,10 +8,6 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
struct FontBLF;
struct GlyphBLF;
struct GlyphCacheBLF;
@ -208,7 +204,3 @@ extern FT_Error FT_New_Face__win32_compat(FT_Library library,
FT_Face *aface);
# endif
#endif
#ifdef __cplusplus
}
#endif

View File

@ -11,10 +11,6 @@
#include "GPU_texture.h"
#include "GPU_vertex_buffer.h"
#ifdef __cplusplus
extern "C" {
#endif
#include FT_MULTIPLE_MASTERS_H /* Variable font support. */
/** Maximum variation axes per font. */
@ -387,7 +383,3 @@ typedef struct FontBLF {
/** Mutex lock for glyph cache. */
ThreadMutex glyph_cache_mutex;
} FontBLF;
#ifdef __cplusplus
}
#endif

View File

@ -28,10 +28,10 @@
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "blf_internal.h"
#include "blf_internal_types.h"
#include "blf_internal.hh"
#include "blf_internal_types.hh"
#include "BLF_api.h"
#include "BLF_api.hh"
#include "BLI_strict_flags.h"

View File

@ -14,7 +14,7 @@
#include "BLI_utildefines.h"
#include "blf_internal.h"
#include "blf_internal.hh"
uint blf_next_p2(uint x)
{

View File

@ -29,7 +29,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 16
#define BLENDER_FILE_SUBVERSION 17
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and cancel loading the file, showing a warning to

View File

@ -157,6 +157,9 @@ void BKE_brush_alpha_set(Scene *scene, Brush *brush, float alpha);
float BKE_brush_weight_get(const Scene *scene, const Brush *brush);
void BKE_brush_weight_set(const Scene *scene, Brush *brush, float value);
int BKE_brush_input_samples_get(const Scene *scene, const Brush *brush);
void BKE_brush_input_samples_set(const Scene *scene, Brush *brush, int value);
bool BKE_brush_use_locked_size(const Scene *scene, const Brush *brush);
bool BKE_brush_use_alpha_pressure(const Brush *brush);
bool BKE_brush_use_size_pressure(const Brush *brush);

View File

@ -4,15 +4,9 @@
#pragma once
#ifdef __cplusplus
# include "BLI_math_vector_types.hh"
# include "BLI_offset_indices.hh"
# include "BLI_virtual_array.hh"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include "BLI_math_vector_types.hh"
#include "BLI_offset_indices.hh"
#include "BLI_virtual_array.hh"
/** \file
* \ingroup bke
@ -24,45 +18,46 @@ struct BlendWriter;
struct ID;
struct ListBase;
struct MDeformVert;
struct MDeformWeight;
struct Object;
struct bDeformGroup;
bool BKE_id_supports_vertex_groups(const struct ID *id);
bool BKE_object_supports_vertex_groups(const struct Object *ob);
const struct ListBase *BKE_object_defgroup_list(const struct Object *ob);
struct ListBase *BKE_object_defgroup_list_mutable(struct Object *ob);
bool BKE_id_supports_vertex_groups(const ID *id);
bool BKE_object_supports_vertex_groups(const Object *ob);
const ListBase *BKE_object_defgroup_list(const Object *ob);
ListBase *BKE_object_defgroup_list_mutable(Object *ob);
int BKE_object_defgroup_count(const struct Object *ob);
int BKE_object_defgroup_count(const Object *ob);
/**
* \note For historical reasons, the index starts at 1 rather than 0.
*/
int BKE_object_defgroup_active_index_get(const struct Object *ob);
int BKE_object_defgroup_active_index_get(const Object *ob);
/**
* \note For historical reasons, the index starts at 1 rather than 0.
*/
void BKE_object_defgroup_active_index_set(struct Object *ob, int new_index);
void BKE_object_defgroup_active_index_set(Object *ob, int new_index);
/**
* Return the ID's vertex group names.
* Supports Mesh (ME), Lattice (LT), and GreasePencil (GD) IDs.
* \return ListBase of bDeformGroup pointers.
*/
const struct ListBase *BKE_id_defgroup_list_get(const struct ID *id);
struct ListBase *BKE_id_defgroup_list_get_mutable(struct ID *id);
int BKE_id_defgroup_name_index(const struct ID *id, const char *name);
const ListBase *BKE_id_defgroup_list_get(const ID *id);
ListBase *BKE_id_defgroup_list_get_mutable(ID *id);
int BKE_id_defgroup_name_index(const ID *id, const char *name);
bool BKE_defgroup_listbase_name_find(const ListBase *defbase,
const char *name,
int *r_index,
struct bDeformGroup **r_group);
bool BKE_id_defgroup_name_find(const struct ID *id,
bDeformGroup **r_group);
bool BKE_id_defgroup_name_find(const ID *id,
const char *name,
int *r_index,
struct bDeformGroup **r_group);
bDeformGroup **r_group);
struct bDeformGroup *BKE_object_defgroup_new(struct Object *ob, const char *name);
void BKE_defgroup_copy_list(struct ListBase *outbase, const struct ListBase *inbase);
struct bDeformGroup *BKE_defgroup_duplicate(const struct bDeformGroup *ingroup);
struct bDeformGroup *BKE_object_defgroup_find_name(const struct Object *ob, const char *name);
bDeformGroup *BKE_object_defgroup_new(Object *ob, const char *name);
void BKE_defgroup_copy_list(ListBase *outbase, const ListBase *inbase);
bDeformGroup *BKE_defgroup_duplicate(const bDeformGroup *ingroup);
bDeformGroup *BKE_object_defgroup_find_name(const Object *ob, const char *name);
/**
* Returns flip map for the vertex-groups of `ob`.
*
@ -77,60 +72,60 @@ struct bDeformGroup *BKE_object_defgroup_find_name(const struct Object *ob, cons
* referencing the index of the symmetrical vertex-group of a fall-back value (see `use_default`).
* The caller is responsible for freeing the array.
*/
int *BKE_object_defgroup_flip_map(const struct Object *ob, bool use_default, int *r_flip_map_num);
int *BKE_object_defgroup_flip_map(const Object *ob, bool use_default, int *r_flip_map_num);
/**
* A version of #BKE_object_defgroup_flip_map that ignores locked groups.
*/
int *BKE_object_defgroup_flip_map_unlocked(const struct Object *ob,
int *BKE_object_defgroup_flip_map_unlocked(const Object *ob,
bool use_default,
int *r_flip_map_num);
/**
* A version of #BKE_object_defgroup_flip_map that only takes a single group into account.
*/
int *BKE_object_defgroup_flip_map_single(const struct Object *ob,
int *BKE_object_defgroup_flip_map_single(const Object *ob,
bool use_default,
int defgroup,
int *r_flip_map_num);
int BKE_object_defgroup_flip_index(const struct Object *ob, int index, bool use_default);
int BKE_object_defgroup_name_index(const struct Object *ob, const char *name);
void BKE_object_defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob);
int BKE_object_defgroup_flip_index(const Object *ob, int index, bool use_default);
int BKE_object_defgroup_name_index(const Object *ob, const char *name);
void BKE_object_defgroup_unique_name(bDeformGroup *dg, Object *ob);
struct MDeformWeight *BKE_defvert_find_index(const struct MDeformVert *dv, int defgroup);
MDeformWeight *BKE_defvert_find_index(const MDeformVert *dv, int defgroup);
/**
* Ensures that `dv` has a deform weight entry for the specified defweight group.
*
* \note this function is mirrored in editmesh_tools.cc, for use for edit-vertices.
*/
struct MDeformWeight *BKE_defvert_ensure_index(struct MDeformVert *dv, int defgroup);
MDeformWeight *BKE_defvert_ensure_index(MDeformVert *dv, int defgroup);
/**
* Adds the given vertex to the specified vertex group, with given weight.
*
* \warning this does NOT check for existing, assume caller already knows its not there.
*/
void BKE_defvert_add_index_notest(struct MDeformVert *dv, int defgroup, float weight);
void BKE_defvert_add_index_notest(MDeformVert *dv, int defgroup, float weight);
/**
* Removes the given vertex from the vertex group.
*
* \warning This function frees the given #MDeformWeight, do not use it afterward!
*/
void BKE_defvert_remove_group(struct MDeformVert *dvert, struct MDeformWeight *dw);
void BKE_defvert_clear(struct MDeformVert *dvert);
void BKE_defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw);
void BKE_defvert_clear(MDeformVert *dvert);
/**
* \return The first group index shared by both deform verts
* or -1 if none are found.
*/
int BKE_defvert_find_shared(const struct MDeformVert *dvert_a, const struct MDeformVert *dvert_b);
int BKE_defvert_find_shared(const MDeformVert *dvert_a, const MDeformVert *dvert_b);
/**
* \return true if has no weights.
*/
bool BKE_defvert_is_weight_zero(const struct MDeformVert *dvert, int defgroup_tot);
bool BKE_defvert_is_weight_zero(const MDeformVert *dvert, int defgroup_tot);
void BKE_defvert_array_free_elems(struct MDeformVert *dvert, int totvert);
void BKE_defvert_array_free(struct MDeformVert *dvert, int totvert);
void BKE_defvert_array_copy(struct MDeformVert *dst, const struct MDeformVert *src, int totvert);
void BKE_defvert_array_free_elems(MDeformVert *dvert, int totvert);
void BKE_defvert_array_free(MDeformVert *dvert, int totvert);
void BKE_defvert_array_copy(MDeformVert *dst, const MDeformVert *src, int totvert);
float BKE_defvert_find_weight(const struct MDeformVert *dvert, int defgroup);
float BKE_defvert_find_weight(const MDeformVert *dvert, int defgroup);
/**
* Take care with this the rationale is:
* - if the object has no vertex group. act like vertex group isn't set and return 1.0.
@ -138,12 +133,12 @@ float BKE_defvert_find_weight(const struct MDeformVert *dvert, int defgroup);
*
* This is a bit confusing, just saves some checks from the caller.
*/
float BKE_defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index, int defgroup);
float BKE_defvert_array_find_weight_safe(const MDeformVert *dvert, int index, int defgroup);
/**
* \return The total weight in all groups marked in the selection mask.
*/
float BKE_defvert_total_selected_weight(const struct MDeformVert *dv,
float BKE_defvert_total_selected_weight(const MDeformVert *dv,
int defbase_num,
const bool *defbase_sel);
@ -155,7 +150,7 @@ float BKE_defvert_total_selected_weight(const struct MDeformVert *dv,
* Value is not clamped, since painting relies on multiplication being always
* commutative with the collective weight function.
*/
float BKE_defvert_multipaint_collective_weight(const struct MDeformVert *dv,
float BKE_defvert_multipaint_collective_weight(const MDeformVert *dv,
int defbase_num,
const bool *defbase_sel,
int defbase_sel_num,
@ -178,19 +173,19 @@ float BKE_defvert_calc_lock_relative_weight(float weight,
* \return weight divided by unlocked, or 1-locked_weight with division by zero check.
*/
float BKE_defvert_lock_relative_weight(float weight,
const struct MDeformVert *dv,
const MDeformVert *dv,
int defbase_num,
const bool *defbase_locked,
const bool *defbase_unlocked);
void BKE_defvert_copy(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src);
void BKE_defvert_copy(MDeformVert *dvert_dst, const MDeformVert *dvert_src);
/**
* Overwrite weights filtered by vgroup_subset.
* - do nothing if neither are set.
* - add destination weight if needed
*/
void BKE_defvert_copy_subset(struct MDeformVert *dvert_dst,
const struct MDeformVert *dvert_src,
void BKE_defvert_copy_subset(MDeformVert *dvert_dst,
const MDeformVert *dvert_src,
const bool *vgroup_subset,
int vgroup_num);
/**
@ -198,8 +193,8 @@ void BKE_defvert_copy_subset(struct MDeformVert *dvert_dst,
* - do nothing if neither are set.
* - add destination weight if needed
*/
void BKE_defvert_mirror_subset(struct MDeformVert *dvert_dst,
const struct MDeformVert *dvert_src,
void BKE_defvert_mirror_subset(MDeformVert *dvert_dst,
const MDeformVert *dvert_src,
const bool *vgroup_subset,
int vgroup_num,
const int *flip_map,
@ -209,49 +204,45 @@ void BKE_defvert_mirror_subset(struct MDeformVert *dvert_dst,
* - do nothing if neither are set.
* - add destination weight if needed.
*/
void BKE_defvert_copy_index(struct MDeformVert *dvert_dst,
void BKE_defvert_copy_index(MDeformVert *dvert_dst,
int defgroup_dst,
const struct MDeformVert *dvert_src,
const MDeformVert *dvert_src,
int defgroup_src);
/**
* Only sync over matching weights, don't add or remove groups
* warning, loop within loop.
*/
void BKE_defvert_sync(struct MDeformVert *dvert_dst,
const struct MDeformVert *dvert_src,
bool use_ensure);
void BKE_defvert_sync(MDeformVert *dvert_dst, const MDeformVert *dvert_src, bool use_ensure);
/**
* be sure all flip_map values are valid
*/
void BKE_defvert_sync_mapped(struct MDeformVert *dvert_dst,
const struct MDeformVert *dvert_src,
void BKE_defvert_sync_mapped(MDeformVert *dvert_dst,
const MDeformVert *dvert_src,
const int *flip_map,
int flip_map_num,
bool use_ensure);
/**
* be sure all flip_map values are valid
*/
void BKE_defvert_remap(struct MDeformVert *dvert, const int *map, int map_len);
void BKE_defvert_flip(struct MDeformVert *dvert, const int *flip_map, int flip_map_num);
void BKE_defvert_flip_merged(struct MDeformVert *dvert, const int *flip_map, int flip_map_num);
void BKE_defvert_normalize(struct MDeformVert *dvert);
void BKE_defvert_remap(MDeformVert *dvert, const int *map, int map_len);
void BKE_defvert_flip(MDeformVert *dvert, const int *flip_map, int flip_map_num);
void BKE_defvert_flip_merged(MDeformVert *dvert, const int *flip_map, int flip_map_num);
void BKE_defvert_normalize(MDeformVert *dvert);
/**
* Same as #BKE_defvert_normalize but takes a bool array.
*/
void BKE_defvert_normalize_subset(struct MDeformVert *dvert,
const bool *vgroup_subset,
int vgroup_num);
void BKE_defvert_normalize_subset(MDeformVert *dvert, const bool *vgroup_subset, int vgroup_num);
/**
* Same as BKE_defvert_normalize() if the locked vgroup is not a member of the subset
*/
void BKE_defvert_normalize_lock_single(struct MDeformVert *dvert,
void BKE_defvert_normalize_lock_single(MDeformVert *dvert,
const bool *vgroup_subset,
int vgroup_num,
uint def_nr_lock);
/**
* Same as BKE_defvert_normalize() if no locked vgroup is a member of the subset
*/
void BKE_defvert_normalize_lock_map(struct MDeformVert *dvert,
void BKE_defvert_normalize_lock_map(MDeformVert *dvert,
const bool *vgroup_subset,
int vgroup_num,
const bool *lock_flags,
@ -260,11 +251,8 @@ void BKE_defvert_normalize_lock_map(struct MDeformVert *dvert,
/* Utilities to 'extract' a given vgroup into a simple float array,
* for verts, but also edges/faces/loops. */
void BKE_defvert_extract_vgroup_to_vertweights(const struct MDeformVert *dvert,
int defgroup,
int verts_num,
bool invert_vgroup,
float *r_weights);
void BKE_defvert_extract_vgroup_to_vertweights(
const MDeformVert *dvert, int defgroup, int verts_num, bool invert_vgroup, float *r_weights);
#ifdef __cplusplus
@ -272,14 +260,14 @@ void BKE_defvert_extract_vgroup_to_vertweights(const struct MDeformVert *dvert,
* The following three make basic interpolation,
* using temp vert_weights array to avoid looking up same weight several times.
*/
void BKE_defvert_extract_vgroup_to_edgeweights(const struct MDeformVert *dvert,
void BKE_defvert_extract_vgroup_to_edgeweights(const MDeformVert *dvert,
int defgroup,
int verts_num,
const blender::int2 *edges,
int edges_num,
bool invert_vgroup,
float *r_weights);
void BKE_defvert_extract_vgroup_to_loopweights(const struct MDeformVert *dvert,
void BKE_defvert_extract_vgroup_to_loopweights(const MDeformVert *dvert,
int defgroup,
int verts_num,
const int *corner_verts,
@ -287,7 +275,7 @@ void BKE_defvert_extract_vgroup_to_loopweights(const struct MDeformVert *dvert,
bool invert_vgroup,
float *r_weights);
void BKE_defvert_extract_vgroup_to_faceweights(const struct MDeformVert *dvert,
void BKE_defvert_extract_vgroup_to_faceweights(const MDeformVert *dvert,
int defgroup,
int verts_num,
const int *corner_verts,
@ -299,23 +287,20 @@ void BKE_defvert_extract_vgroup_to_faceweights(const struct MDeformVert *dvert,
void BKE_defvert_weight_to_rgb(float r_rgb[3], float weight);
void BKE_defvert_blend_write(struct BlendWriter *writer,
int count,
const struct MDeformVert *dvlist);
void BKE_defvert_blend_read(struct BlendDataReader *reader,
int count,
struct MDeformVert *mdverts);
void BKE_defbase_blend_write(struct BlendWriter *writer, const ListBase *defbase);
void BKE_defvert_blend_write(BlendWriter *writer, int count, const MDeformVert *dvlist);
void BKE_defvert_blend_read(BlendDataReader *reader, int count, MDeformVert *mdverts);
void BKE_defbase_blend_write(BlendWriter *writer, const ListBase *defbase);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
namespace blender::bke {
VArray<float> varray_for_deform_verts(Span<MDeformVert> dverts, int defgroup_index);
VMutableArray<float> varray_for_mutable_deform_verts(MutableSpan<MDeformVert> dverts,
int defgroup_index);
void remove_defgroup_index(MutableSpan<MDeformVert> dverts, int defgroup_index);
void gather_deform_verts(Span<MDeformVert> src, Span<int> indices, MutableSpan<MDeformVert> dst);
void gather_deform_verts(Span<MDeformVert> src,
const IndexMask &indices,
MutableSpan<MDeformVert> dst);
} // namespace blender::bke
#endif

View File

@ -0,0 +1,34 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup bke
* \brief Utility functions for vertex groups in grease pencil objects
*/
#include "DNA_grease_pencil_types.h"
namespace blender::bke::greasepencil {
/** Make sure drawings only contain vertex groups of the #GreasePencil. */
void validate_drawing_vertex_groups(GreasePencil &grease_pencil);
/** Assign selected vertices to the vertex group. */
void assign_to_vertex_group(GreasePencil &grease_pencil, StringRef name, float weight);
/**
* Remove selected vertices from the vertex group.
* \return True if at least one vertex was removed from the group.
*/
bool remove_from_vertex_group(GreasePencil &grease_pencil, StringRef name, bool use_selection);
/** Remove vertices from all vertex groups. */
void clear_vertex_groups(GreasePencil &grease_pencil);
/** Select or deselect vertices assigned to this group. */
void select_from_group(GreasePencil &grease_pencil, StringRef name, bool select);
} // namespace blender::bke::greasepencil

View File

@ -1,226 +0,0 @@
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/** \file
* \ingroup bke
*/
struct Curve;
struct ID;
struct Key;
struct KeyBlock;
struct Lattice;
struct ListBase;
struct Main;
struct Mesh;
struct Object;
/* Kernel prototypes */
#ifdef __cplusplus
extern "C" {
#endif
/**
* Free (or release) any data used by this shape-key (does not free the key itself).
*/
void BKE_key_free_data(struct Key *key);
void BKE_key_free_nolib(struct Key *key);
struct Key *BKE_key_add(struct Main *bmain, struct ID *id);
/**
* Sort shape keys after a change.
* This assumes that at most one key was moved,
* which is a valid assumption for the places it's currently being called.
*/
void BKE_key_sort(struct Key *key);
void key_curve_position_weights(float t, float data[4], int type);
/**
* First derivative.
*/
void key_curve_tangent_weights(float t, float data[4], int type);
/**
* Second derivative.
*/
void key_curve_normal_weights(float t, float data[4], int type);
/**
* Returns key coordinates (+ tilt) when key applied, NULL otherwise.
*
* \param obdata: if given, also update that geometry with the result of the shape keys evaluation.
*/
float *BKE_key_evaluate_object_ex(
struct Object *ob, int *r_totelem, float *arr, size_t arr_size, struct ID *obdata);
float *BKE_key_evaluate_object(struct Object *ob, int *r_totelem);
/**
* \param shape_index: The index to use or all (when -1).
*/
int BKE_keyblock_element_count_from_shape(const struct Key *key, int shape_index);
int BKE_keyblock_element_count(const struct Key *key);
/**
* \param shape_index: The index to use or all (when -1).
*/
size_t BKE_keyblock_element_calc_size_from_shape(const struct Key *key, int shape_index);
size_t BKE_keyblock_element_calc_size(const struct Key *key);
bool BKE_key_idtype_support(short id_type);
struct Key **BKE_key_from_id_p(struct ID *id);
struct Key *BKE_key_from_id(struct ID *id);
struct Key **BKE_key_from_object_p(struct Object *ob);
struct Key *BKE_key_from_object(struct Object *ob);
/**
* Only the active key-block.
*/
struct KeyBlock *BKE_keyblock_from_object(struct Object *ob);
struct KeyBlock *BKE_keyblock_from_object_reference(struct Object *ob);
struct KeyBlock *BKE_keyblock_add(struct Key *key, const char *name);
/**
* \note sorting is a problematic side effect in some cases,
* better only do this explicitly by having its own function,
*
* \param key: The key datablock to add to.
* \param name: Optional name for the new keyblock.
* \param do_force: always use ctime even for relative keys.
*/
struct KeyBlock *BKE_keyblock_add_ctime(struct Key *key, const char *name, bool do_force);
/**
* Get the appropriate #KeyBlock given an index (0 refers to the basis key). Key may be null.
*/
struct KeyBlock *BKE_keyblock_find_by_index(struct Key *key, int index);
/**
* Get the appropriate #KeyBlock given a name to search for.
*/
struct KeyBlock *BKE_keyblock_find_name(struct Key *key, const char name[]);
struct KeyBlock *BKE_keyblock_find_uid(struct Key *key, int uid);
/**
* \brief copy shape-key attributes, but not key data or name/UID.
*/
void BKE_keyblock_copy_settings(struct KeyBlock *kb_dst, const struct KeyBlock *kb_src);
/**
* Get RNA-Path for 'value' setting of the given shape-key.
* \note the user needs to free the returned string once they're finished with it.
*/
char *BKE_keyblock_curval_rnapath_get(const struct Key *key, const struct KeyBlock *kb);
/* conversion functions */
/* NOTE: 'update_from' versions do not (re)allocate mem in kb, while 'convert_from' do. */
void BKE_keyblock_update_from_lattice(const struct Lattice *lt, struct KeyBlock *kb);
void BKE_keyblock_convert_from_lattice(const struct Lattice *lt, struct KeyBlock *kb);
void BKE_keyblock_convert_to_lattice(const struct KeyBlock *kb, struct Lattice *lt);
int BKE_keyblock_curve_element_count(const struct ListBase *nurb);
void BKE_keyblock_curve_data_transform(const struct ListBase *nurb,
const float mat[4][4],
const void *src,
void *dst);
void BKE_keyblock_update_from_curve(const struct Curve *cu,
struct KeyBlock *kb,
const struct ListBase *nurb);
void BKE_keyblock_convert_from_curve(const struct Curve *cu,
struct KeyBlock *kb,
const struct ListBase *nurb);
void BKE_keyblock_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
void BKE_keyblock_update_from_mesh(const struct Mesh *mesh, struct KeyBlock *kb);
void BKE_keyblock_convert_from_mesh(const struct Mesh *mesh,
const struct Key *key,
struct KeyBlock *kb);
void BKE_keyblock_convert_to_mesh(const struct KeyBlock *kb,
float (*vert_positions)[3],
int totvert);
/**
* Computes normals (vertices, faces and/or loops ones) of given mesh for given shape key.
*
* \param kb: the KeyBlock to use to compute normals.
* \param mesh: the Mesh to apply key-block to.
* \param r_vert_normals: if non-NULL, an array of vectors, same length as number of vertices.
* \param r_face_normals: if non-NULL, an array of vectors, same length as number of faces.
* \param r_loop_normals: if non-NULL, an array of vectors, same length as number of loops.
*/
void BKE_keyblock_mesh_calc_normals(const struct KeyBlock *kb,
struct Mesh *mesh,
float (*r_vert_normals)[3],
float (*r_face_normals)[3],
float (*r_loop_normals)[3]);
void BKE_keyblock_update_from_vertcos(const struct Object *ob,
struct KeyBlock *kb,
const float (*vertCos)[3]);
void BKE_keyblock_convert_from_vertcos(const struct Object *ob,
struct KeyBlock *kb,
const float (*vertCos)[3]);
float (*BKE_keyblock_convert_to_vertcos(const struct Object *ob, const struct KeyBlock *kb))[3];
/** RAW coordinates offsets. */
void BKE_keyblock_update_from_offset(const struct Object *ob,
struct KeyBlock *kb,
const float (*ofs)[3]);
/* other management */
/**
* Move shape key from org_index to new_index. Safe, clamps index to valid range,
* updates reference keys, the object's active shape index,
* the 'frame' value in case of absolute keys, etc.
* Note indices are expected in real values (not *fake* `shapenr +1` ones).
*
* \param org_index: if < 0, current object's active shape will be used as shape-key to move.
* \return true if something was done, else false.
*/
bool BKE_keyblock_move(struct Object *ob, int org_index, int new_index);
/**
* Check if given key-block (as index) is used as basis by others in given key.
*/
bool BKE_keyblock_is_basis(const struct Key *key, int index);
/**
* Returns a newly allocated array containing true for every key that has this one as basis.
* If none are found, returns null.
*/
bool *BKE_keyblock_get_dependent_keys(const struct Key *key, int index);
/* -------------------------------------------------------------------- */
/** \name Key-Block Data Access
* \{ */
/**
* \param shape_index: The index to use or all (when -1).
*/
void BKE_keyblock_data_get_from_shape(const struct Key *key, float (*arr)[3], int shape_index);
void BKE_keyblock_data_get(const struct Key *key, float (*arr)[3]);
/**
* Set the data to all key-blocks (or shape_index if != -1).
*/
void BKE_keyblock_data_set_with_mat4(struct Key *key,
int shape_index,
const float (*coords)[3],
const float mat[4][4]);
/**
* Set the data for all key-blocks (or shape_index if != -1),
* transforming by \a mat.
*/
void BKE_keyblock_curve_data_set_with_mat4(struct Key *key,
const struct ListBase *nurb,
int shape_index,
const void *data,
const float mat[4][4]);
/**
* Set the data for all key-blocks (or shape_index if != -1).
*/
void BKE_keyblock_data_set(struct Key *key, int shape_index, const void *data);
/** \} */
#ifdef __cplusplus
};
#endif

View File

@ -0,0 +1,203 @@
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <optional>
#include <string>
/** \file
* \ingroup bke
*/
struct Curve;
struct ID;
struct Key;
struct KeyBlock;
struct Lattice;
struct ListBase;
struct Main;
struct Mesh;
struct Object;
/**
* Free (or release) any data used by this shape-key (does not free the key itself).
*/
void BKE_key_free_data(Key *key);
void BKE_key_free_nolib(Key *key);
Key *BKE_key_add(Main *bmain, ID *id);
/**
* Sort shape keys after a change.
* This assumes that at most one key was moved,
* which is a valid assumption for the places it's currently being called.
*/
void BKE_key_sort(Key *key);
void key_curve_position_weights(float t, float data[4], int type);
/**
* First derivative.
*/
void key_curve_tangent_weights(float t, float data[4], int type);
/**
* Second derivative.
*/
void key_curve_normal_weights(float t, float data[4], int type);
/**
* Returns key coordinates (+ tilt) when key applied, NULL otherwise.
*
* \param obdata: if given, also update that geometry with the result of the shape keys evaluation.
*/
float *BKE_key_evaluate_object_ex(
Object *ob, int *r_totelem, float *arr, size_t arr_size, ID *obdata);
float *BKE_key_evaluate_object(Object *ob, int *r_totelem);
/**
* \param shape_index: The index to use or all (when -1).
*/
int BKE_keyblock_element_count_from_shape(const Key *key, int shape_index);
int BKE_keyblock_element_count(const Key *key);
/**
* \param shape_index: The index to use or all (when -1).
*/
size_t BKE_keyblock_element_calc_size_from_shape(const Key *key, int shape_index);
size_t BKE_keyblock_element_calc_size(const Key *key);
bool BKE_key_idtype_support(short id_type);
Key **BKE_key_from_id_p(ID *id);
Key *BKE_key_from_id(ID *id);
Key **BKE_key_from_object_p(Object *ob);
Key *BKE_key_from_object(Object *ob);
/**
* Only the active key-block.
*/
KeyBlock *BKE_keyblock_from_object(Object *ob);
KeyBlock *BKE_keyblock_from_object_reference(Object *ob);
KeyBlock *BKE_keyblock_add(Key *key, const char *name);
/**
* \note sorting is a problematic side effect in some cases,
* better only do this explicitly by having its own function,
*
* \param key: The key datablock to add to.
* \param name: Optional name for the new keyblock.
* \param do_force: always use ctime even for relative keys.
*/
KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, bool do_force);
/**
* Get the appropriate #KeyBlock given an index (0 refers to the basis key). Key may be null.
*/
KeyBlock *BKE_keyblock_find_by_index(Key *key, int index);
/**
* Get the appropriate #KeyBlock given a name to search for.
*/
KeyBlock *BKE_keyblock_find_name(Key *key, const char name[]);
KeyBlock *BKE_keyblock_find_uid(Key *key, int uid);
/**
* \brief copy shape-key attributes, but not key data or name/UID.
*/
void BKE_keyblock_copy_settings(KeyBlock *kb_dst, const KeyBlock *kb_src);
/**
* Get RNA-Path for 'value' setting of the given shape-key.
* \note the user needs to free the returned string once they're finished with it.
*/
std::optional<std::string> BKE_keyblock_curval_rnapath_get(const Key *key, const KeyBlock *kb);
/* conversion functions */
/* NOTE: 'update_from' versions do not (re)allocate mem in kb, while 'convert_from' do. */
void BKE_keyblock_update_from_lattice(const Lattice *lt, KeyBlock *kb);
void BKE_keyblock_convert_from_lattice(const Lattice *lt, KeyBlock *kb);
void BKE_keyblock_convert_to_lattice(const KeyBlock *kb, Lattice *lt);
int BKE_keyblock_curve_element_count(const ListBase *nurb);
void BKE_keyblock_curve_data_transform(const ListBase *nurb,
const float mat[4][4],
const void *src,
void *dst);
void BKE_keyblock_update_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb);
void BKE_keyblock_convert_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb);
void BKE_keyblock_convert_to_curve(KeyBlock *kb, Curve *cu, ListBase *nurb);
void BKE_keyblock_update_from_mesh(const Mesh *mesh, KeyBlock *kb);
void BKE_keyblock_convert_from_mesh(const Mesh *mesh, const Key *key, KeyBlock *kb);
void BKE_keyblock_convert_to_mesh(const KeyBlock *kb, float (*vert_positions)[3], int totvert);
/**
* Computes normals (vertices, faces and/or loops ones) of given mesh for given shape key.
*
* \param kb: the KeyBlock to use to compute normals.
* \param mesh: the Mesh to apply key-block to.
* \param r_vert_normals: if non-NULL, an array of vectors, same length as number of vertices.
* \param r_face_normals: if non-NULL, an array of vectors, same length as number of faces.
* \param r_loop_normals: if non-NULL, an array of vectors, same length as number of loops.
*/
void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
Mesh *mesh,
float (*r_vert_normals)[3],
float (*r_face_normals)[3],
float (*r_loop_normals)[3]);
void BKE_keyblock_update_from_vertcos(const Object *ob, KeyBlock *kb, const float (*vertCos)[3]);
void BKE_keyblock_convert_from_vertcos(const Object *ob, KeyBlock *kb, const float (*vertCos)[3]);
float (*BKE_keyblock_convert_to_vertcos(const Object *ob, const KeyBlock *kb))[3];
/** RAW coordinates offsets. */
void BKE_keyblock_update_from_offset(const Object *ob, KeyBlock *kb, const float (*ofs)[3]);
/* other management */
/**
* Move shape key from org_index to new_index. Safe, clamps index to valid range,
* updates reference keys, the object's active shape index,
* the 'frame' value in case of absolute keys, etc.
* Note indices are expected in real values (not *fake* `shapenr +1` ones).
*
* \param org_index: if < 0, current object's active shape will be used as shape-key to move.
* \return true if something was done, else false.
*/
bool BKE_keyblock_move(Object *ob, int org_index, int new_index);
/**
* Check if given key-block (as index) is used as basis by others in given key.
*/
bool BKE_keyblock_is_basis(const Key *key, int index);
/**
* Returns a newly allocated array containing true for every key that has this one as basis.
* If none are found, returns null.
*/
bool *BKE_keyblock_get_dependent_keys(const Key *key, int index);
/* -------------------------------------------------------------------- */
/** \name Key-Block Data Access
* \{ */
/**
* \param shape_index: The index to use or all (when -1).
*/
void BKE_keyblock_data_get_from_shape(const Key *key, float (*arr)[3], int shape_index);
void BKE_keyblock_data_get(const Key *key, float (*arr)[3]);
/**
* Set the data to all key-blocks (or shape_index if != -1).
*/
void BKE_keyblock_data_set_with_mat4(Key *key,
int shape_index,
const float (*coords)[3],
const float mat[4][4]);
/**
* Set the data for all key-blocks (or shape_index if != -1),
* transforming by \a mat.
*/
void BKE_keyblock_curve_data_set_with_mat4(
Key *key, const ListBase *nurb, int shape_index, const void *data, const float mat[4][4]);
/**
* Set the data for all key-blocks (or shape_index if != -1).
*/
void BKE_keyblock_data_set(Key *key, int shape_index, const void *data);
/** \} */

View File

@ -23,6 +23,7 @@
struct ID;
struct IDProperty;
struct LibraryForeachIDData;
struct Main;
/* Tips for the callback for cases it's gonna to modify the pointer. */
@ -201,8 +202,6 @@ enum {
IDWALK_DO_DEPRECATED_POINTERS = (1 << 11),
};
typedef struct LibraryForeachIDData LibraryForeachIDData;
/**
* Check whether current iteration over ID usages should be stopped or not.
* \return true if the iteration should be stopped, false otherwise.

View File

@ -9,11 +9,10 @@
* \brief Blender kernel freestyle line style functionality.
*/
#include "DNA_linestyle_types.h"
#include <optional>
#include <string>
#ifdef __cplusplus
extern "C" {
#endif
#include "DNA_linestyle_types.h"
#define LS_MODIFIER_TYPE_COLOR 1
#define LS_MODIFIER_TYPE_ALPHA 2
@ -83,13 +82,9 @@ bool BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle,
int direction);
void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase);
char *BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle,
struct ColorBand *color_ramp);
std::optional<std::string> BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle,
struct ColorBand *color_ramp);
bool BKE_linestyle_use_textures(FreestyleLineStyle *linestyle, bool use_shading_nodes);
void BKE_linestyle_default_shader(const struct bContext *C, FreestyleLineStyle *linestyle);
#ifdef __cplusplus
}
#endif

View File

@ -29,6 +29,7 @@ struct BLI_mempool;
struct BlendThumbnail;
struct GHash;
struct GSet;
struct ID;
struct IDNameLib_Map;
struct ImBuf;
struct Library;
@ -47,13 +48,13 @@ struct BlendThumbnail {
/** Structs caching relations between data-blocks in a given Main. */
struct MainIDRelationsEntryItem {
struct MainIDRelationsEntryItem *next;
MainIDRelationsEntryItem *next;
union {
/* For `from_ids` list, a user of the hashed ID. */
struct ID *from;
ID *from;
/* For `to_ids` list, an ID used by the hashed ID. */
struct ID **to;
ID **to;
} id_pointer;
/* Session uid of the `id_pointer`. */
uint session_uid;
@ -63,9 +64,9 @@ struct MainIDRelationsEntryItem {
struct MainIDRelationsEntry {
/* Linked list of IDs using that ID. */
struct MainIDRelationsEntryItem *from_ids;
MainIDRelationsEntryItem *from_ids;
/* Linked list of IDs used by that ID. */
struct MainIDRelationsEntryItem *to_ids;
MainIDRelationsEntryItem *to_ids;
/* Session uid of the ID matching that entry. */
uint session_uid;
@ -104,13 +105,13 @@ enum eMainIDRelationsEntryTags {
struct MainIDRelations {
/* Mapping from an ID pointer to all of its parents (IDs using it) and children (IDs it uses).
* Values are `MainIDRelationsEntry` pointers. */
struct GHash *relations_from_pointers;
GHash *relations_from_pointers;
/* NOTE: we could add more mappings when needed (e.g. from session uid?). */
short flag;
/* Private... */
struct BLI_mempool *entry_items_pool;
BLI_mempool *entry_items_pool;
};
enum {

View File

@ -42,21 +42,18 @@ struct PointCloudRuntime {
} // namespace blender::bke
void *BKE_pointcloud_add(struct Main *bmain, const char *name);
void *BKE_pointcloud_add_default(struct Main *bmain, const char *name);
struct PointCloud *BKE_pointcloud_new_nomain(int totpoint);
void BKE_pointcloud_nomain_to_pointcloud(struct PointCloud *pointcloud_src,
struct PointCloud *pointcloud_dst);
void *BKE_pointcloud_add(Main *bmain, const char *name);
void *BKE_pointcloud_add_default(Main *bmain, const char *name);
PointCloud *BKE_pointcloud_new_nomain(int totpoint);
void BKE_pointcloud_nomain_to_pointcloud(PointCloud *pointcloud_src, PointCloud *pointcloud_dst);
bool BKE_pointcloud_attribute_required(const struct PointCloud *pointcloud, const char *name);
bool BKE_pointcloud_attribute_required(const PointCloud *pointcloud, const char *name);
/* Dependency Graph */
struct PointCloud *BKE_pointcloud_copy_for_eval(const struct PointCloud *pointcloud_src);
PointCloud *BKE_pointcloud_copy_for_eval(const PointCloud *pointcloud_src);
void BKE_pointcloud_data_update(struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *object);
void BKE_pointcloud_data_update(Depsgraph *depsgraph, Scene *scene, Object *object);
/* Draw Cache */
@ -64,8 +61,8 @@ enum {
BKE_POINTCLOUD_BATCH_DIRTY_ALL = 0,
};
void BKE_pointcloud_batch_cache_dirty_tag(struct PointCloud *pointcloud, int mode);
void BKE_pointcloud_batch_cache_free(struct PointCloud *pointcloud);
void BKE_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode);
void BKE_pointcloud_batch_cache_free(PointCloud *pointcloud);
extern void (*BKE_pointcloud_batch_cache_dirty_tag_cb)(struct PointCloud *pointcloud, int mode);
extern void (*BKE_pointcloud_batch_cache_free_cb)(struct PointCloud *pointcloud);
extern void (*BKE_pointcloud_batch_cache_dirty_tag_cb)(PointCloud *pointcloud, int mode);
extern void (*BKE_pointcloud_batch_cache_free_cb)(PointCloud *pointcloud);

View File

@ -154,13 +154,12 @@ void BKE_sound_update_scene_sound(void *handle, struct bSound *sound);
*/
void BKE_sound_update_sequence_handle(void *handle, void *sound_handle);
void BKE_sound_set_cfra(int cfra);
void BKE_sound_set_scene_volume(struct Scene *scene, float volume);
void BKE_sound_set_scene_sound_volume(void *handle, float volume, char animated);
void BKE_sound_set_scene_sound_pitch(void *handle, float pitch, char animated);
void BKE_sound_set_scene_sound_volume_at_frame(void *handle,
int frame,
float volume,
char animated);
void BKE_sound_set_scene_sound_pitch_at_frame(void *handle, int frame, float pitch, char animated);
@ -169,7 +168,7 @@ void BKE_sound_set_scene_sound_pitch_constant_range(void *handle,
int frame_end,
float pitch);
void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated);
void BKE_sound_set_scene_sound_pan_at_frame(void *handle, int frame, float pan, char animated);
void BKE_sound_update_sequencer(struct Main *main, struct bSound *sound);

View File

@ -150,6 +150,7 @@ set(SRC
intern/gpencil_update_cache_legacy.cc
intern/grease_pencil.cc
intern/grease_pencil_convert_legacy.cc
intern/grease_pencil_vertex_groups.cc
intern/icons.cc
intern/icons_rasterize.cc
intern/idprop.cc
@ -377,7 +378,7 @@ set(SRC
BKE_customdata.hh
BKE_customdata_file.h
BKE_data_transfer.h
BKE_deform.h
BKE_deform.hh
BKE_displist.h
BKE_duplilist.h
BKE_dynamicpaint.h
@ -403,6 +404,7 @@ set(SRC
BKE_gpencil_update_cache_legacy.h
BKE_grease_pencil.h
BKE_grease_pencil.hh
BKE_grease_pencil_vertex_groups.hh
BKE_icons.h
BKE_idprop.h
BKE_idprop.hh
@ -415,7 +417,7 @@ set(SRC
BKE_instances.hh
BKE_ipo.h
BKE_kelvinlet.h
BKE_key.h
BKE_key.hh
BKE_keyconfig.h
BKE_lattice.hh
BKE_layer.hh

View File

@ -34,12 +34,12 @@
#include "BKE_DerivedMesh.hh"
#include "BKE_bvhutils.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_editmesh.hh"
#include "BKE_editmesh_cache.hh"
#include "BKE_geometry_set.hh"
#include "BKE_geometry_set_instances.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_material.h"

View File

@ -41,7 +41,7 @@
#include "BKE_armature.hh"
#include "BKE_asset.hh"
#include "BKE_constraint.h"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_fcurve.h"
#include "BKE_idprop.h"
#include "BKE_idtype.hh"
@ -1480,7 +1480,6 @@ eAction_TransformFlags BKE_action_get_item_transform_flags(bAction *act,
ListBase *curves)
{
PointerRNA ptr;
char *basePath = nullptr;
short flags = 0;
/* build PointerRNA from provided data to obtain the paths to use */
@ -1495,8 +1494,8 @@ eAction_TransformFlags BKE_action_get_item_transform_flags(bAction *act,
}
/* get the basic path to the properties of interest */
basePath = RNA_path_from_ID_to_struct(&ptr);
if (basePath == nullptr) {
const std::optional<std::string> basePath = RNA_path_from_ID_to_struct(&ptr);
if (!basePath) {
return eAction_TransformFlags(0);
}
@ -1518,13 +1517,13 @@ eAction_TransformFlags BKE_action_get_item_transform_flags(bAction *act,
}
/* step 1: check for matching base path */
bPtr = strstr(fcu->rna_path, basePath);
bPtr = strstr(fcu->rna_path, basePath->c_str());
if (bPtr) {
/* we must add len(basePath) bytes to the match so that we are at the end of the
* base path so that we don't get false positives with these strings in the names
*/
bPtr += strlen(basePath);
bPtr += strlen(basePath->c_str());
/* step 2: check for some property with transforms
* - to speed things up, only check for the ones not yet found
@ -1597,9 +1596,6 @@ eAction_TransformFlags BKE_action_get_item_transform_flags(bAction *act,
}
}
/* free basePath */
MEM_freeN(basePath);
/* return flags found */
return eAction_TransformFlags(flags);
}

View File

@ -19,7 +19,7 @@
#include "BKE_anim_path.h"
#include "BKE_curve.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_object_types.hh"
#include "CLG_log.h"

View File

@ -141,39 +141,33 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports,
return nullptr;
}
/* if there is already a motionpath, just return that,
* provided its settings are ok (saves extra free+alloc)
*/
if (*dst != nullptr) {
int expected_length = avs->path_ef - avs->path_sf;
const int expected_length = avs->path_ef - avs->path_sf;
BLI_assert(expected_length > 0); /* Because the `if` above. */
/* If there is already a motionpath, just return that, provided its settings
* are ok (saves extra free+alloc). */
if (*dst != nullptr) {
mpath = *dst;
/* Path is "valid" if length is valid,
* but must also be of the same length as is being requested. */
if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) {
/* outer check ensures that we have some curve data for this path */
if (mpath->length == expected_length) {
mpath->start_frame = avs->path_sf;
mpath->end_frame = avs->path_ef;
/* return/use this as it is already valid length */
return mpath;
}
/* clear the existing path (as the range has changed), and reallocate below */
animviz_free_motionpath_cache(mpath);
/* Only reuse a path if it was already a valid path, and of the expected length. */
if (mpath->start_frame != mpath->end_frame && mpath->length == expected_length) {
mpath->start_frame = avs->path_sf;
mpath->end_frame = avs->path_ef;
return mpath;
}
/* Clear the existing cache, to allocate a new one below. */
animviz_free_motionpath_cache(mpath);
}
else {
/* create a new motionpath, and assign it */
mpath = static_cast<bMotionPath *>(MEM_callocN(sizeof(bMotionPath), "bMotionPath"));
*dst = mpath;
}
/* set settings from the viz settings */
/* Copy mpath settings from the viz settings. */
mpath->start_frame = avs->path_sf;
mpath->end_frame = avs->path_ef;
mpath->length = mpath->end_frame - mpath->start_frame;
mpath->length = expected_length;
if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS) {
mpath->flag |= MOTIONPATH_FLAG_BHEAD;
@ -182,22 +176,21 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports,
mpath->flag &= ~MOTIONPATH_FLAG_BHEAD;
}
/* set default custom values */
mpath->color[0] = 1.0; /* Red */
/* Set default custom values (RGB). */
mpath->color[0] = 1.0;
mpath->color[1] = 0.0;
mpath->color[2] = 0.0;
mpath->line_thickness = 2;
mpath->flag |= MOTIONPATH_FLAG_LINES; /* draw lines by default */
mpath->flag |= MOTIONPATH_FLAG_LINES;
/* allocate a cache */
/* Allocate a cache. */
mpath->points = static_cast<bMotionPathVert *>(
MEM_callocN(sizeof(bMotionPathVert) * mpath->length, "bMotionPathVerts"));
/* tag viz settings as currently having some path(s) which use it */
/* Tag viz settings as currently having some path(s) which use it. */
avs->path_bakeflag |= MOTIONPATH_BAKE_HAS_PATHS;
/* return it */
return mpath;
}

View File

@ -35,7 +35,7 @@
#include "BKE_action.h"
#include "BKE_armature.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_editmesh.hh"
#include "BKE_lattice.hh"
#include "BKE_mesh.hh"

View File

@ -6,7 +6,7 @@
#include "BKE_attribute_math.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_geometry_set.hh"
#include "BKE_type_conversions.hh"

View File

@ -98,14 +98,13 @@ std::optional<std::string> get_modifier_bake_path(const Main &bmain,
const Object &object,
const NodesModifierData &nmd)
{
const StringRefNull bmain_path = BKE_main_blendfile_path(&bmain);
if (bmain_path.is_empty()) {
return std::nullopt;
}
if (StringRef(nmd.bake_directory).is_empty()) {
return std::nullopt;
}
const char *base_path = ID_BLEND_PATH(&bmain, &object.id);
if (StringRef(base_path).is_empty()) {
return std::nullopt;
}
char absolute_bake_dir[FILE_MAX];
STRNCPY(absolute_bake_dir, nmd.bake_directory);
BLI_path_abs(absolute_bake_dir, base_path);
@ -126,6 +125,9 @@ std::optional<bake::BakePath> get_node_bake_path(const Main &bmain,
return std::nullopt;
}
const char *base_path = ID_BLEND_PATH(&bmain, &object.id);
if (StringRef(base_path).is_empty()) {
return std::nullopt;
}
char absolute_bake_dir[FILE_MAX];
STRNCPY(absolute_bake_dir, bake->directory);
BLI_path_abs(absolute_bake_dir, base_path);

View File

@ -47,7 +47,7 @@
#include "SEQ_sequencer.hh"
#include "BLF_api.h"
#include "BLF_api.hh"
Global G;
UserDef U;

View File

@ -37,7 +37,7 @@
#include "BLT_translation.h"
#include "BKE_idtype.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_override.hh"

View File

@ -2524,6 +2524,25 @@ void BKE_brush_weight_set(const Scene *scene, Brush *brush, float value)
}
}
int BKE_brush_input_samples_get(const Scene *scene, const Brush *brush)
{
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
return (ups->flag & UNIFIED_PAINT_INPUT_SAMPLES) ? ups->input_samples : brush->input_samples;
}
void BKE_brush_input_samples_set(const Scene *scene, Brush *brush, int value)
{
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
if (ups->flag & UNIFIED_PAINT_INPUT_SAMPLES) {
ups->input_samples = value;
}
else {
brush->input_samples = value;
}
}
void BKE_brush_scale_unprojected_radius(float *unprojected_radius,
int new_brush_size,
int old_brush_size)

View File

@ -17,7 +17,7 @@
#include "DNA_texture_types.h"
#include "BKE_colorband.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_material.h"
void BKE_colorband_init(ColorBand *coba, bool rangetype)

View File

@ -53,7 +53,7 @@
#include "BKE_camera.h"
#include "BKE_constraint.h"
#include "BKE_curve.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_displist.h"
#include "BKE_editmesh.hh"
#include "BKE_fcurve_driver.h"

View File

@ -45,7 +45,7 @@
#include "BKE_curveprofile.h"
#include "BKE_displist.h"
#include "BKE_idtype.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_main.hh"

View File

@ -29,7 +29,7 @@
#include "BKE_modifier.hh"
#include "BKE_object_types.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
/* -------------------------------------------------------------------- */
/** \name Curve Deform Internal Utilities

View File

@ -29,7 +29,7 @@
#include "BKE_curves.hh"
#include "BKE_curves_utils.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
namespace blender::bke {

View File

@ -45,7 +45,7 @@
#include "BKE_anonymous_attribute_id.hh"
#include "BKE_customdata.hh"
#include "BKE_customdata_file.h"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_main.hh"
#include "BKE_mesh_mapping.hh"
#include "BKE_mesh_remap.hh"

View File

@ -21,7 +21,7 @@
#include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_data_transfer.h"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_mapping.hh"
#include "BKE_mesh_remap.hh"

View File

@ -15,6 +15,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_gpencil_legacy_types.h"
#include "DNA_grease_pencil_types.h"
#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@ -32,7 +33,9 @@
#include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_data_transfer.h"
#include "BKE_deform.h" /* own include */
#include "BKE_deform.hh" /* own include */
#include "BKE_grease_pencil.hh"
#include "BKE_grease_pencil_vertex_groups.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_mapping.hh"
#include "BKE_object.hh"
@ -57,6 +60,11 @@ bDeformGroup *BKE_object_defgroup_new(Object *ob, const char *name)
BLI_addtail(defbase, defgroup);
BKE_object_defgroup_unique_name(defgroup, ob);
if (ob->type == OB_GREASE_PENCIL) {
blender::bke::greasepencil::validate_drawing_vertex_groups(
*static_cast<GreasePencil *>(ob->data));
}
BKE_object_batch_cache_dirty_tag(ob);
return defgroup;
@ -440,7 +448,7 @@ bool BKE_id_supports_vertex_groups(const ID *id)
if (id == nullptr) {
return false;
}
return ELEM(GS(id->name), ID_ME, ID_LT, ID_GD_LEGACY);
return ELEM(GS(id->name), ID_ME, ID_LT, ID_GD_LEGACY, ID_GP);
}
bool BKE_object_supports_vertex_groups(const Object *ob)
@ -465,6 +473,10 @@ const ListBase *BKE_id_defgroup_list_get(const ID *id)
const bGPdata *gpd = (const bGPdata *)id;
return &gpd->vertex_group_names;
}
case ID_GP: {
const GreasePencil *grease_pencil = (const GreasePencil *)id;
return &grease_pencil->vertex_group_names;
}
default: {
BLI_assert_unreachable();
}
@ -488,6 +500,10 @@ static const int *object_defgroup_active_index_get_p(const Object *ob)
const bGPdata *gpd = (const bGPdata *)ob->data;
return &gpd->vertex_group_active_index;
}
case OB_GREASE_PENCIL: {
const GreasePencil *grease_pencil = (const GreasePencil *)ob->data;
return &grease_pencil->vertex_group_active_index;
}
}
return nullptr;
}
@ -1768,6 +1784,30 @@ void remove_defgroup_index(MutableSpan<MDeformVert> dverts, const int defgroup_i
});
}
void gather_deform_verts(const Span<MDeformVert> src,
const Span<int> indices,
MutableSpan<MDeformVert> dst)
{
threading::parallel_for(indices.index_range(), 512, [&](const IndexRange range) {
for (const int dst_i : range) {
const int src_i = indices[dst_i];
dst[dst_i].dw = static_cast<MDeformWeight *>(MEM_dupallocN(src[src_i].dw));
dst[dst_i].totweight = src[src_i].totweight;
dst[dst_i].flag = src[src_i].flag;
}
});
}
void gather_deform_verts(const Span<MDeformVert> src,
const IndexMask &indices,
MutableSpan<MDeformVert> dst)
{
indices.foreach_index(GrainSize(512), [&](const int64_t src_i, const int64_t dst_i) {
dst[dst_i].dw = static_cast<MDeformWeight *>(MEM_dupallocN(src[src_i].dw));
dst[dst_i].totweight = src[src_i].totweight;
dst[dst_i].flag = src[src_i].flag;
});
}
} // namespace blender::bke
/** \} */

View File

@ -34,7 +34,7 @@
#include "BKE_curve_legacy_convert.hh"
#include "BKE_displist.h"
#include "BKE_geometry_set.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lib_id.hh"
#include "BKE_mball.hh"
#include "BKE_mesh.hh"

View File

@ -45,7 +45,7 @@
#include "BKE_colorband.hh"
#include "BKE_constraint.h"
#include "BKE_customdata.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_dynamicpaint.h"
#include "BKE_effect.h"
#include "BKE_image.h"

View File

@ -18,8 +18,8 @@
#include "BLI_listbase.h"
#include "BLI_math_vector.h"
#include "BKE_deform.h"
#include "BKE_key.h"
#include "BKE_deform.hh"
#include "BKE_key.hh"
#include "BKE_editlattice.h" /* own include */

View File

@ -238,15 +238,16 @@ FCurve *id_data_find_fcurve(
return nullptr;
}
char *path = RNA_path_from_ID_to_property(&ptr, prop);
if (path == nullptr) {
const std::optional<std::string> path = RNA_path_from_ID_to_property(&ptr, prop);
if (!path) {
return nullptr;
}
/* FIXME: The way drivers are handled here (always nullptr-ifying `fcu`) is very weird, this
* needs to be re-checked I think?. */
bool is_driven = false;
FCurve *fcu = BKE_animadata_fcurve_find_by_rna_path(adt, path, index, nullptr, &is_driven);
FCurve *fcu = BKE_animadata_fcurve_find_by_rna_path(
adt, path->c_str(), index, nullptr, &is_driven);
if (is_driven) {
if (r_driven != nullptr) {
*r_driven = is_driven;
@ -254,8 +255,6 @@ FCurve *id_data_find_fcurve(
fcu = nullptr;
}
MEM_freeN(path);
return fcu;
}
@ -454,19 +453,19 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext * /*C*/,
}
/* XXX This function call can become a performance bottleneck. */
char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
if (rna_path == nullptr) {
const std::optional<std::string> rna_path = RNA_path_from_ID_to_property(ptr, prop);
if (!rna_path) {
return nullptr;
}
/* Standard F-Curve from animdata - Animation (Action) or Drivers. */
FCurve *fcu = BKE_animadata_fcurve_find_by_rna_path(adt, rna_path, rnaindex, r_action, r_driven);
FCurve *fcu = BKE_animadata_fcurve_find_by_rna_path(
adt, rna_path->c_str(), rnaindex, r_action, r_driven);
if (fcu != nullptr && r_animdata != nullptr) {
*r_animdata = adt;
}
MEM_freeN(rna_path);
return fcu;
}

View File

@ -57,7 +57,7 @@
# include "BKE_bvhutils.hh"
# include "BKE_collision.h"
# include "BKE_customdata.hh"
# include "BKE_deform.h"
# include "BKE_deform.hh"
# include "BKE_mesh.hh"
# include "BKE_mesh_runtime.hh"
# include "BKE_object.hh"

View File

@ -10,7 +10,7 @@
#include "BKE_attribute_math.hh"
#include "BKE_curve.hh"
#include "BKE_curves.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_geometry_fields.hh"
#include "BKE_geometry_set.hh"
#include "BKE_lib_id.hh"
@ -368,8 +368,7 @@ class CurvesVertexGroupsAttributeProvider final : public DynamicAttributesProvid
}
const Span<MDeformVert> dverts = curves->deform_verts();
if (dverts.is_empty()) {
static const float default_value = 0.0f;
return {VArray<float>::ForSingle(default_value, curves->points_num()), AttrDomain::Point};
return {VArray<float>::ForSingle(0.0f, curves->points_num()), AttrDomain::Point};
}
return {varray_for_deform_verts(dverts, vertex_group_index), AttrDomain::Point};
}

View File

@ -9,7 +9,7 @@
#include "DNA_object_types.h"
#include "BKE_attribute_math.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_geometry_fields.hh"
#include "BKE_geometry_set.hh"
#include "BKE_lib_id.hh"

View File

@ -44,7 +44,7 @@
#include "BKE_attribute.hh"
#include "BKE_context.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_gpencil_curve_legacy.h"
#include "BKE_gpencil_geom_legacy.h"
#include "BKE_gpencil_legacy.h"

View File

@ -37,7 +37,7 @@
#include "BKE_anim_data.h"
#include "BKE_collection.h"
#include "BKE_colortools.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_gpencil_geom_legacy.h"
#include "BKE_gpencil_legacy.h"
#include "BKE_gpencil_update_cache_legacy.h"

View File

@ -31,7 +31,7 @@
#include "DNA_screen_types.h"
#include "BKE_colortools.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_gpencil_geom_legacy.h"
#include "BKE_gpencil_legacy.h"
#include "BKE_gpencil_modifier_legacy.h"

View File

@ -11,6 +11,7 @@
#include "BKE_anim_data.h"
#include "BKE_curves.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.hh"
#include "BKE_geometry_set.hh"
#include "BKE_grease_pencil.h"
#include "BKE_grease_pencil.hh"
@ -116,6 +117,9 @@ static void grease_pencil_copy_data(Main * /*bmain*/,
CD_MASK_ALL,
grease_pencil_dst->layers().size());
BKE_defgroup_copy_list(&grease_pencil_dst->vertex_group_names,
&grease_pencil_src->vertex_group_names);
/* Make sure the runtime pointer exists. */
grease_pencil_dst->runtime = MEM_new<bke::GreasePencilRuntime>(__func__);
}
@ -132,6 +136,8 @@ static void grease_pencil_free_data(ID *id)
free_drawing_array(*grease_pencil);
MEM_delete(&grease_pencil->root_group());
BLI_freelistN(&grease_pencil->vertex_group_names);
BKE_grease_pencil_batch_cache_free(grease_pencil);
MEM_delete(grease_pencil->runtime);
@ -179,6 +185,8 @@ static void grease_pencil_blend_write(BlendWriter *writer, ID *id, const void *i
/* Write materials. */
BLO_write_pointer_array(
writer, grease_pencil->material_array_num, grease_pencil->material_array);
/* Write vertex group names. */
BKE_defbase_blend_write(writer, &grease_pencil->vertex_group_names);
}
static void grease_pencil_blend_read_data(BlendDataReader *reader, ID *id)
@ -195,6 +203,8 @@ static void grease_pencil_blend_read_data(BlendDataReader *reader, ID *id)
/* Read materials. */
BLO_read_pointer_array(reader, reinterpret_cast<void **>(&grease_pencil->material_array));
/* Read vertex group names. */
BLO_read_list(reader, &grease_pencil->vertex_group_names);
grease_pencil->runtime = MEM_new<blender::bke::GreasePencilRuntime>(__func__);
}

View File

@ -0,0 +1,196 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup bke
*/
#include "DNA_meshdata_types.h"
#include "BLI_listbase.h"
#include "BLI_set.hh"
#include "BLI_string.h"
#include "BLI_string_utils.hh"
#include "BKE_curves.hh"
#include "BKE_deform.hh"
#include "BKE_grease_pencil.hh"
#include "BKE_grease_pencil_vertex_groups.hh"
#include "BLT_translation.h"
namespace blender::bke::greasepencil {
/* ------------------------------------------------------------------- */
/** \name Vertex groups in drawings
* \{ */
void validate_drawing_vertex_groups(GreasePencil &grease_pencil)
{
Set<std::string> valid_names;
LISTBASE_FOREACH (const bDeformGroup *, defgroup, &grease_pencil.vertex_group_names) {
valid_names.add_new(defgroup->name);
}
for (GreasePencilDrawingBase *base : grease_pencil.drawings()) {
if (base->type != GP_DRAWING) {
continue;
}
Drawing &drawing = reinterpret_cast<GreasePencilDrawing *>(base)->wrap();
/* Remove unknown vertex groups. */
CurvesGeometry &curves = drawing.strokes_for_write();
int defgroup_index = 0;
LISTBASE_FOREACH_MUTABLE (bDeformGroup *, defgroup, &curves.vertex_group_names) {
if (!valid_names.contains(defgroup->name)) {
remove_defgroup_index(curves.deform_verts_for_write(), defgroup_index);
BLI_remlink(&curves.vertex_group_names, defgroup);
MEM_SAFE_FREE(defgroup);
}
++defgroup_index;
}
}
}
void assign_to_vertex_group(GreasePencil &grease_pencil, const StringRef name, const float weight)
{
for (GreasePencilDrawingBase *base : grease_pencil.drawings()) {
if (base->type != GP_DRAWING) {
continue;
}
Drawing &drawing = reinterpret_cast<GreasePencilDrawing *>(base)->wrap();
bke::CurvesGeometry &curves = drawing.strokes_for_write();
ListBase &vertex_group_names = curves.vertex_group_names;
const bke::AttributeAccessor attributes = curves.attributes();
const VArray<bool> selection = *attributes.lookup_or_default<bool>(
".selection", bke::AttrDomain::Point, true);
/* Look for existing group, otherwise lazy-initialize if any vertex is selected. */
int def_nr = BLI_findstringindex(
&vertex_group_names, name.data(), offsetof(bDeformGroup, name));
const MutableSpan<MDeformVert> dverts = curves.deform_verts_for_write();
for (const int i : dverts.index_range()) {
if (selection[i]) {
/* Lazily add the vertex group if any vertex is selected. */
if (def_nr < 0) {
bDeformGroup *defgroup = MEM_cnew<bDeformGroup>(__func__);
STRNCPY(defgroup->name, name.data());
BLI_addtail(&vertex_group_names, defgroup);
def_nr = BLI_listbase_count(&vertex_group_names) - 1;
BLI_assert(def_nr >= 0);
}
MDeformWeight *dw = BKE_defvert_ensure_index(&dverts[i], def_nr);
if (dw) {
dw->weight = weight;
}
}
}
}
}
/** Remove selected vertices from the vertex group. */
bool remove_from_vertex_group(GreasePencil &grease_pencil,
const StringRef name,
const bool use_selection)
{
bool changed = false;
for (GreasePencilDrawingBase *base : grease_pencil.drawings()) {
if (base->type != GP_DRAWING) {
continue;
}
Drawing &drawing = reinterpret_cast<GreasePencilDrawing *>(base)->wrap();
bke::CurvesGeometry &curves = drawing.strokes_for_write();
ListBase &vertex_group_names = curves.vertex_group_names;
const int def_nr = BLI_findstringindex(
&vertex_group_names, name.data(), offsetof(bDeformGroup, name));
if (def_nr < 0) {
/* No vertices assigned to the group in this drawing. */
continue;
}
const MutableSpan<MDeformVert> dverts = curves.deform_verts_for_write();
const bke::AttributeAccessor attributes = curves.attributes();
const VArray<bool> selection = *attributes.lookup_or_default<bool>(
".selection", bke::AttrDomain::Point, true);
for (const int i : dverts.index_range()) {
if (!use_selection || selection[i]) {
MDeformVert *dv = &dverts[i];
MDeformWeight *dw = BKE_defvert_find_index(dv, def_nr);
BKE_defvert_remove_group(dv, dw);
/* Adjust remaining vertex group indices. */
for (const int j : IndexRange(dv->totweight)) {
if (dv->dw[j].def_nr > def_nr) {
dv->dw[j].def_nr--;
}
}
changed = true;
}
}
}
return changed;
}
void clear_vertex_groups(GreasePencil &grease_pencil)
{
for (GreasePencilDrawingBase *base : grease_pencil.drawings()) {
if (base->type != GP_DRAWING) {
continue;
}
Drawing &drawing = reinterpret_cast<GreasePencilDrawing *>(base)->wrap();
bke::CurvesGeometry &curves = drawing.strokes_for_write();
for (MDeformVert &dvert : curves.deform_verts_for_write()) {
BKE_defvert_clear(&dvert);
}
}
}
void select_from_group(GreasePencil &grease_pencil, const StringRef name, const bool select)
{
for (GreasePencilDrawingBase *base : grease_pencil.drawings()) {
if (base->type != GP_DRAWING) {
continue;
}
Drawing &drawing = reinterpret_cast<GreasePencilDrawing *>(base)->wrap();
bke::CurvesGeometry &curves = drawing.strokes_for_write();
ListBase &vertex_group_names = curves.vertex_group_names;
const int def_nr = BLI_findstringindex(
&vertex_group_names, name.data(), offsetof(bDeformGroup, name));
if (def_nr < 0) {
/* No vertices assigned to the group in this drawing. */
continue;
}
const Span<MDeformVert> dverts = curves.deform_verts_for_write();
if (!dverts.is_empty()) {
bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
SpanAttributeWriter<bool> selection = attributes.lookup_or_add_for_write_span<bool>(
".selection",
bke::AttrDomain::Point,
AttributeInitVArray(VArray<bool>::ForSingle(true, curves.point_num)));
for (const int i : selection.span.index_range()) {
if (BKE_defvert_find_index(&dverts[i], def_nr)) {
selection.span[i] = select;
}
}
selection.finish();
}
}
}
/** \} */
} // namespace blender::bke::greasepencil

View File

@ -80,7 +80,7 @@
#include "BKE_scene.h"
#include "BKE_workspace.h"
#include "BLF_api.h"
#include "BLF_api.hh"
#include "RE_pipeline.h"

View File

@ -18,7 +18,7 @@
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "BLF_api.h"
#include "BLF_api.hh"
struct FillColorThreadData {
uchar *rect;

View File

@ -50,7 +50,7 @@
#include "BKE_global.h"
#include "BKE_idtype.hh"
#include "BKE_ipo.h"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_main.hh"

View File

@ -37,10 +37,10 @@
#include "BKE_anim_data.h"
#include "BKE_curve.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_editmesh.hh"
#include "BKE_idtype.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lattice.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
@ -1946,21 +1946,13 @@ void BKE_keyblock_copy_settings(KeyBlock *kb_dst, const KeyBlock *kb_src)
kb_dst->slidermax = kb_src->slidermax;
}
char *BKE_keyblock_curval_rnapath_get(const Key *key, const KeyBlock *kb)
std::optional<std::string> BKE_keyblock_curval_rnapath_get(const Key *key, const KeyBlock *kb)
{
PropertyRNA *prop;
/* sanity checks */
if (ELEM(nullptr, key, kb)) {
return nullptr;
}
/* create the RNA pointer */
PointerRNA ptr = RNA_pointer_create((ID *)&key->id, &RNA_ShapeKey, (KeyBlock *)kb);
/* get pointer to the property too */
prop = RNA_struct_find_property(&ptr, "value");
/* return the path */
PropertyRNA *prop = RNA_struct_find_property(&ptr, "value");
return RNA_path_from_ID_to_property(&ptr, prop);
}

View File

@ -34,7 +34,7 @@
#include "BKE_anim_data.h"
#include "BKE_curve.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_displist.h"
#include "BKE_idtype.hh"
#include "BKE_lattice.hh"

View File

@ -31,14 +31,14 @@
#include "BKE_curve.hh"
#include "BKE_displist.h"
#include "BKE_editmesh.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lattice.hh"
#include "BKE_mesh.hh"
#include "BKE_modifier.hh"
#include "BKE_object.hh"
#include "BKE_object_types.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
/* -------------------------------------------------------------------- */
/** \name Lattice Deform API

View File

@ -49,7 +49,7 @@
#include "BKE_gpencil_legacy.h"
#include "BKE_idprop.h"
#include "BKE_idtype.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_override.hh"
#include "BKE_lib_query.hh"

View File

@ -26,7 +26,7 @@
#include "BKE_asset.hh"
#include "BKE_idprop.h"
#include "BKE_idtype.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_override.hh"

View File

@ -32,7 +32,7 @@
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_idtype.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_override.hh"

View File

@ -9,6 +9,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fmt/format.h>
#include "MEM_guardedalloc.h"
@ -1844,7 +1845,8 @@ void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, List
}
}
char *BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *color_ramp)
std::optional<std::string> BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle,
ColorBand *color_ramp)
{
bool found = false;
@ -1895,11 +1897,11 @@ char *BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand
if (found) {
char name_esc[sizeof(m->name) * 2];
BLI_str_escape(name_esc, m->name, sizeof(name_esc));
return BLI_sprintfN("color_modifiers[\"%s\"].color_ramp", name_esc);
return fmt::format("color_modifiers[\"{}\"].color_ramp", name_esc);
}
}
printf("BKE_linestyle_path_to_color_ramp: No color ramps correspond to the given pointer.\n");
return nullptr;
return std::nullopt;
}
bool BKE_linestyle_use_textures(FreestyleLineStyle *linestyle, const bool use_shading_nodes)

View File

@ -45,12 +45,12 @@
#include "BKE_anim_data.h"
#include "BKE_attribute.hh"
#include "BKE_bpath.h"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_editmesh.hh"
#include "BKE_editmesh_cache.hh"
#include "BKE_global.h"
#include "BKE_idtype.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_main.hh"

View File

@ -28,12 +28,12 @@
#include "BKE_DerivedMesh.hh"
#include "BKE_curves.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_displist.h"
#include "BKE_editmesh.hh"
#include "BKE_geometry_set.hh"
#include "BKE_geometry_set_instances.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_main.hh"

View File

@ -15,7 +15,7 @@
#include "DNA_object_types.h"
#include "BKE_attribute.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_mesh.hh"

View File

@ -28,7 +28,7 @@
#include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_mesh.hh"
#include "DEG_depsgraph.hh"

View File

@ -53,7 +53,7 @@
#include "BKE_global.h"
#include "BKE_gpencil_modifier_legacy.h"
#include "BKE_idtype.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_mesh.hh"

View File

@ -79,7 +79,7 @@
#include "BKE_crazyspace.hh"
#include "BKE_curve.hh"
#include "BKE_curves.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_displist.h"
#include "BKE_duplilist.h"
#include "BKE_editmesh.hh"
@ -97,7 +97,7 @@
#include "BKE_idprop.h"
#include "BKE_idtype.hh"
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lattice.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"

View File

@ -22,6 +22,7 @@
#include "DNA_cloth_types.h"
#include "DNA_curve_types.h"
#include "DNA_gpencil_legacy_types.h"
#include "DNA_grease_pencil_types.h"
#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@ -32,9 +33,10 @@
#include "DNA_scene_types.h"
#include "BKE_action.h"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_editmesh.hh"
#include "BKE_gpencil_legacy.h"
#include "BKE_grease_pencil_vertex_groups.hh"
#include "BKE_mesh.hh"
#include "BKE_modifier.hh"
#include "BKE_object.hh"
@ -197,6 +199,11 @@ bool BKE_object_defgroup_clear(Object *ob, bDeformGroup *dg, const bool use_sele
}
}
}
else if (ob->type == OB_GREASE_PENCIL) {
GreasePencil *grease_pencil = static_cast<GreasePencil *>(ob->data);
changed = blender::bke::greasepencil::remove_from_vertex_group(
*grease_pencil, dg->name, use_selection);
}
return changed;
}
@ -264,6 +271,10 @@ static void object_defgroup_remove_common(Object *ob, bDeformGroup *dg, const in
Lattice *lt = object_defgroup_lattice_get((ID *)(ob->data));
MEM_SAFE_FREE(lt->dvert);
}
else if (ob->type == OB_GREASE_PENCIL) {
GreasePencil *grease_pencil = static_cast<GreasePencil *>(ob->data);
blender::bke::greasepencil::clear_vertex_groups(*grease_pencil);
}
}
else if (BKE_object_defgroup_active_index_get(ob) < 1) {
/* Keep a valid active index if we still have some vgroups. */
@ -281,24 +292,30 @@ static void object_defgroup_remove_object_mode(Object *ob, bDeformGroup *dg)
BLI_assert(def_nr != -1);
BKE_object_defgroup_array_get(static_cast<ID *>(ob->data), &dvert_array, &dvert_tot);
if (ob->type == OB_GREASE_PENCIL) {
GreasePencil *grease_pencil = static_cast<GreasePencil *>(ob->data);
blender::bke::greasepencil::remove_from_vertex_group(*grease_pencil, dg->name, false);
}
else {
BKE_object_defgroup_array_get(static_cast<ID *>(ob->data), &dvert_array, &dvert_tot);
if (dvert_array) {
int i, j;
MDeformVert *dv;
for (i = 0, dv = dvert_array; i < dvert_tot; i++, dv++) {
MDeformWeight *dw;
if (dvert_array) {
int i, j;
MDeformVert *dv;
for (i = 0, dv = dvert_array; i < dvert_tot; i++, dv++) {
MDeformWeight *dw;
dw = BKE_defvert_find_index(dv, def_nr);
BKE_defvert_remove_group(dv, dw); /* dw can be nullptr */
dw = BKE_defvert_find_index(dv, def_nr);
BKE_defvert_remove_group(dv, dw); /* dw can be nullptr */
/* inline, make into a function if anything else needs to do this */
for (j = 0; j < dv->totweight; j++) {
if (dv->dw[j].def_nr > def_nr) {
dv->dw[j].def_nr--;
/* inline, make into a function if anything else needs to do this */
for (j = 0; j < dv->totweight; j++) {
if (dv->dw[j].def_nr > def_nr) {
dv->dw[j].def_nr--;
}
}
/* done */
}
/* done */
}
}
@ -357,6 +374,10 @@ static void object_defgroup_remove_edit_mode(Object *ob, bDeformGroup *dg)
}
}
}
else if (ob->type == OB_GREASE_PENCIL) {
GreasePencil *grease_pencil = static_cast<GreasePencil *>(ob->data);
blender::bke::greasepencil::remove_from_vertex_group(*grease_pencil, dg->name, false);
}
object_defgroup_remove_common(ob, dg, def_nr);
}
@ -374,6 +395,11 @@ void BKE_object_defgroup_remove(Object *ob, bDeformGroup *defgroup)
object_defgroup_remove_object_mode(ob, defgroup);
}
if (ob->type == OB_GREASE_PENCIL) {
blender::bke::greasepencil::validate_drawing_vertex_groups(
*static_cast<GreasePencil *>(ob->data));
}
BKE_object_batch_cache_dirty_tag(ob);
}
}
@ -411,6 +437,10 @@ void BKE_object_defgroup_remove_all_ex(Object *ob, bool only_unlocked)
Lattice *lt = object_defgroup_lattice_get((ID *)(ob->data));
MEM_SAFE_FREE(lt->dvert);
}
else if (ob->type == OB_GREASE_PENCIL) {
GreasePencil *grease_pencil = static_cast<GreasePencil *>(ob->data);
blender::bke::greasepencil::clear_vertex_groups(*grease_pencil);
}
/* Fix counters/indices */
BKE_object_defgroup_active_index_set(ob, 0);
}
@ -506,6 +536,10 @@ bool BKE_object_defgroup_array_get(ID *id, MDeformVert **dvert_arr, int *dvert_t
*dvert_tot = lt->pntsu * lt->pntsv * lt->pntsw;
return true;
}
case ID_GP:
/* Should not be used with grease pencil objects.*/
BLI_assert_unreachable();
break;
default:
break;
}

View File

@ -36,7 +36,7 @@
#include "BKE_grease_pencil.h"
#include "BKE_grease_pencil.hh"
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lattice.hh"
#include "BKE_layer.hh"
#include "BKE_light.h"

View File

@ -46,11 +46,11 @@
#include "BKE_colortools.hh"
#include "BKE_context.hh"
#include "BKE_crazyspace.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_gpencil_legacy.h"
#include "BKE_idtype.hh"
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
@ -1337,10 +1337,6 @@ void BKE_paint_blend_write(BlendWriter *writer, Paint *p)
void BKE_paint_blend_read_data(BlendDataReader *reader, const Scene *scene, Paint *p)
{
if (p->num_input_samples < 1) {
p->num_input_samples = 1;
}
BLO_read_data_address(reader, &p->cavity_curve);
if (p->cavity_curve) {
BKE_curvemapping_blend_read(reader, p->cavity_curve);

View File

@ -54,11 +54,11 @@
#include "BKE_collection.h"
#include "BKE_colortools.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_displist.h"
#include "BKE_effect.h"
#include "BKE_idtype.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_lattice.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"

View File

@ -2641,7 +2641,6 @@ void BKE_scene_graph_update_for_newframe_ex(Depsgraph *depsgraph, const bool cle
* call this at the start so modifiers with textures don't lag 1 frame.
*/
BKE_image_editors_update_frame(bmain, scene->r.cfra);
BKE_sound_set_cfra(scene->r.cfra);
DEG_graph_relations_update(depsgraph);
/* Update all objects: drivers, matrices, etc. flags set
* by depsgraph or manual, no layer check here, gets correct flushed.

View File

@ -34,7 +34,7 @@
#include "BKE_modifier.hh"
#include "BKE_shrinkwrap.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_editmesh.hh"
#include "BKE_mesh.hh" /* for OMP limits. */
#include "BKE_mesh_runtime.hh"

View File

@ -54,7 +54,7 @@
#include "BKE_collision.h"
#include "BKE_curve.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h"
#include "BKE_deform.hh"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_layer.hh"

View File

@ -221,7 +221,6 @@ IDTypeInfo IDType_ID_SO = {
#ifdef WITH_AUDASPACE
/* evil globals ;-) */
static int sound_cfra;
static char **audio_device_names = nullptr;
#endif
@ -802,11 +801,6 @@ void BKE_sound_update_sequence_handle(void *handle, void *sound_handle)
#ifdef WITH_AUDASPACE
void BKE_sound_set_cfra(int cfra)
{
sound_cfra = cfra;
}
void BKE_sound_set_scene_volume(Scene *scene, float volume)
{
sound_verify_evaluated_id(&scene->id);
@ -820,33 +814,37 @@ void BKE_sound_set_scene_volume(Scene *scene, float volume)
(scene->audio.flag & AUDIO_VOLUME_ANIMATED) != 0);
}
void BKE_sound_set_scene_sound_volume(void *handle, float volume, char animated)
void BKE_sound_set_scene_sound_volume_at_frame(void *handle,
const int frame,
float volume,
const char animated)
{
AUD_SequenceEntry_setAnimationData(handle, AUD_AP_VOLUME, sound_cfra, &volume, animated);
AUD_SequenceEntry_setAnimationData(handle, AUD_AP_VOLUME, frame, &volume, animated);
}
void BKE_sound_set_scene_sound_pitch(void *handle, float pitch, char animated)
{
AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PITCH, sound_cfra, &pitch, animated);
}
void BKE_sound_set_scene_sound_pitch_at_frame(void *handle, int frame, float pitch, char animated)
void BKE_sound_set_scene_sound_pitch_at_frame(void *handle,
const int frame,
float pitch,
const char animated)
{
AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PITCH, frame, &pitch, animated);
}
void BKE_sound_set_scene_sound_pitch_constant_range(void *handle,
int frame_start,
int frame_end,
const int frame_start,
const int frame_end,
float pitch)
{
AUD_SequenceEntry_setConstantRangeAnimationData(
handle, AUD_AP_PITCH, frame_start, frame_end, &pitch);
}
void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated)
void BKE_sound_set_scene_sound_pan_at_frame(void *handle,
const int frame,
float pan,
const char animated)
{
AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PANNING, sound_cfra, &pan, animated);
AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PANNING, frame, &pan, animated);
}
void BKE_sound_update_sequencer(Main *main, bSound *sound)
@ -1379,16 +1377,24 @@ void BKE_sound_read_waveform(Main *bmain,
UNUSED_VARS(sound, stop, bmain);
}
void BKE_sound_init_main(Main * /*bmain*/) {}
void BKE_sound_set_cfra(int /*cfra*/) {}
void BKE_sound_update_sequencer(Main * /*main*/, bSound * /*sound*/) {}
void BKE_sound_update_scene(Depsgraph * /*depsgraph*/, Scene * /*scene*/) {}
void BKE_sound_update_scene_sound(void * /*handle*/, bSound * /*sound*/) {}
void BKE_sound_update_scene_listener(Scene * /*scene*/) {}
void BKE_sound_update_fps(Main * /*bmain*/, Scene * /*scene*/) {}
void BKE_sound_set_scene_sound_volume(void * /*handle*/, float /*volume*/, char /*animated*/) {}
void BKE_sound_set_scene_sound_pan(void * /*handle*/, float /*pan*/, char /*animated*/) {}
void BKE_sound_set_scene_sound_volume_at_frame(void * /*handle*/,
int /* frame */,
float /*volume*/,
char /*animated*/)
{
}
void BKE_sound_set_scene_sound_pan_at_frame(void * /*handle*/,
int /* frame */,
float /*pan*/,
char /*animated*/)
{
}
void BKE_sound_set_scene_volume(Scene * /*scene*/, float /*volume*/) {}
void BKE_sound_set_scene_sound_pitch(void * /*handle*/, float /*pitch*/, char /*animated*/) {}
void BKE_sound_set_scene_sound_pitch_at_frame(void * /*handle*/,
int /*frame*/,
float /*pitch*/,

View File

@ -16,7 +16,7 @@
#include "BLI_task.h"
#include "BKE_customdata.hh"
#include "BKE_key.h"
#include "BKE_key.hh"
#include "BKE_mesh.hh"
#include "BKE_subdiv.hh"
#include "BKE_subdiv_mesh.hh"

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