Compare commits

...

38 Commits

Author SHA1 Message Date
5be8cc6556 FIx: Change to instance domain 2021-11-24 01:29:45 +01:00
c853826ed1 Merge branch 'master' into temp-geometry-nodes-text 2021-11-23 17:59:13 +01:00
e4986f92f3 Geometry Nodes: Node execution time overlay
Adds a new overlay called "Timings" to the Geometry Node editor.
This shows the node execution time in milliseconds above the node.
For group nodes and frames, the total time for all nodes inside
(recursively) is shown. Group output node shows the node tree total.
The code is prepared for easily adding new rows of information
to the box above the node in the future.

Differential Revision: https://developer.blender.org/D13256
2021-11-23 17:37:31 +01:00
fab39440e9 Cleanup: Simplify geometry node function names
With this commit, we no longer use the prefixes for every node type
function like `geo_node_translate_instances_`. They just added more
places to change when adding a new node, for no real benefit.

Differential Revision: https://developer.blender.org/D13337
2021-11-23 10:55:51 -05:00
a9eb4e6f59 Merge branch 'blender-v3.0-release' 2021-11-23 16:41:53 +01:00
a6b7f32112 Fix T93297: incorrect eevee motion blur with geometry instances
This disables motion blur for geometry instances in eevee, which did
not work correctly anyway. See code comment for more details.

Differential Revision: https://developer.blender.org/D13334
2021-11-23 16:40:21 +01:00
db450c9320 Merge branch 'blender-v3.0-release' 2021-11-23 16:38:30 +01:00
70424195a8 Cycles: Fix possible access to non-initialized light sample in volume
Happened in barbershop file where number of bounces to the light was
reached.

Differential Revision: https://developer.blender.org/D13336
2021-11-23 16:38:15 +01:00
71c80bd939 Merge branch 'blender-v3.0-release' 2021-11-23 16:32:13 +01:00
2cbb9d7a76 Fix T93322: Freestyle Sinus Displacement Division by Zero Crash
This happens if the Wavelength is set to 0.0f.

Not sure if we really need a do_version patch for old files, as an
alternative we could also force a slight offset in the
SinusDisplacementShader. This patch does not do either, just force a
positive range from now on.

Maniphest Tasks: T93322

Differential Revision: https://developer.blender.org/D13329
2021-11-23 16:29:37 +01:00
b716a771b4 Merge branch 'blender-v3.0-release' 2021-11-23 15:46:28 +01:00
Sayak Biswas
3bb8d173e7 Fix T93109: Cycles HIP missing check for correct driver version
21.Q4 is required, older version should not show devices in the preferences.
This adds a check for the file version of amdhip64.dll file during hipew
initialization.

Differential Revision: https://developer.blender.org/D13324
2021-11-23 15:45:37 +01:00
fca8eb0185 Cleanup: Suppress clang-tidy warning. 2021-11-23 15:41:28 +01:00
2c2b79191f Merge branch 'blender-v3.0-release' 2021-11-23 15:41:09 +01:00
1a7c32a0ab Fix T93320: Freestyle LineStyleModifier blend 'Minimum' error
This was just a typo in {rBb408d8af31c9}
Must be 'MINIMUM' (instead of 'MININUM').

Maniphest Tasks: T93320

Differential Revision: https://developer.blender.org/D13328
2021-11-23 15:38:52 +01:00
4b13dcaf02 Merge branch 'blender-v3.0-release' 2021-11-23 15:35:09 +01:00
ceb25cbeba Fix compilation warnings when building without OpenImageDenoiser
Reported by Sybren, thanks!
2021-11-23 15:34:54 +01:00
8897e0aa8f Fix add-on Preferences using the .blend file icon, not the Blender logo
Intention of the icon is to mark add-ons that are official/bundled.
Doesn't make much sense to use the .blend file icon for that. It's
arguable if the Blender logo should be used for this, but the file icon
is definitely the wrong choice.
2021-11-23 15:30:28 +01:00
5efddc4347 Fix add-on Preferences using the .blend file icon, not the Blender logo
Intention of the icon is to mark add-ons that are official/bundled.
Doesn't make much sense to use the .blend file icon for that. It's
arguable if the Blender logo should be used for this, but the file icon
is definitely the wrong choice.
2021-11-23 15:30:05 +01:00
1df8abff25 Geometry Nodes: add namespace for every file
This puts all static functions in geometry node files into a new
namespace. This allows using unity build which can improve
compile times significantly (P2578).

* The name space name is derived from the file name. That makes
  it possible to write some tooling that checks the names later on.
  The file name extension (`cc`) is added to the namespace name as
  well. This also possibly simplifies tooling but also makes it more
  obvious that this namespace is specific to a file.
* In the register function of every node, I added a namespace alias
  `namespace file_ns = blender::nodes::node_geo_*_cc;`. This avoids
  some duplication of the file name and may also simplify tooling,
  because this line is easy to detect. The name `file_ns` stands for "file
  namespace" and also indicates that this namespace corresponds to
  the current file. In the beginning I used `node_ns` but `file_ns` is more
  generic which may make it more suitable when we want to use unity
  builds outside of the nodes modules in the future.
* Some node files contain code that is actually shared between
  different nodes. For now I left that code in the `blender::nodes`
  namespace and moved it to the top of the file (couldn't move it to
  the bottom in all cases, so I just moved it to the top everywhere).
  As a separate cleanup step, this shared code should actually be
  moved to a separate file.

Differential Revision: https://developer.blender.org/D13330
2021-11-23 14:56:01 +01:00
47276b8470 Geometry Nodes: reduce overhead when processing single values
Currently the geometry nodes evaluator always stores a field for every
type that supports it, even if it is just a single value. This results in a lot
of overhead when there are many sockets that just contain a single
value, which is often the case.

This introduces a new `ValueOrField<T>` type that is used by the geometry
nodes evaluator. Now a field will only be created when it is actually
necessary. See D13307 for more details. In extrem cases this can speed
up the evaluation 2-3x (those cases are probably never hit in practice
though, but it's good to get rid of unnecessary overhead nevertheless).

Differential Revision: https://developer.blender.org/D13307
2021-11-23 14:49:26 +01:00
0bedd5d14f Merge branch 'blender-v3.0-release' 2021-11-23 14:39:55 +01:00
436ce22194 Fix T93296: raycast node uses wrong domain for face corner attributes
This changes what domain is used by the raycast mode. This should fix the
behavior for face corner attributes (but may make it a bit slower for other
attributes). I think for 3.0 this is an acceptable trade off. For 3.1 we can do
what the comment suggests already.

Differential Revision: https://developer.blender.org/D13333
2021-11-23 14:38:02 +01:00
dab04bc053 Fix T93231: crash when overwriting vertex group with other domain
The problem was that we forgot to actually remove the vertex group when
it should be deleted. We only removed all the data that was attached to it.

Differential Revision: https://developer.blender.org/D13326
2021-11-23 14:38:02 +01:00
d7b7cbb047 Merge branch 'blender-v3.0-release' 2021-11-23 14:36:57 +01:00
0479a66313 Fix broken versionning after recent refactor of insertion in liboverrides.
rB33c5e7bcd5e5b79 doversion code was incorrectly dealing with 'insert in
first position' case from older blendfiles.

Specifically, a NULL anchor is valid (it means that the new item is the
first of the stored override data, and should be inserted at start of
the list).

Reported as part of T93321.
2021-11-23 14:36:40 +01:00
611e4ffaab Icons: Replace .blend file icons, add "Current File" icon
The Blender icon must not be used to refer to anything that is not
Blender itself. Using the Blender icon on its own to refer to .blend
files or the currently open file is a no-go, which was brought up by
Ton.

This does the following changes to the icon file:
* Add new "Current File" icon
* Change the .blend file icon to contain a file icon with the Blender
  logo, but not merely the Blender logo.
* Change the backup .blend file icon accordingly.

The new "Current File" icon is used in the Asset Browser, but
could/should be used in the Outliner as well. That needs more design
discussion though.
2021-11-23 14:32:35 +01:00
89b927a720 Cleanup: Silence compilation warning.
For now made DRW_notify_view_update_offscreen static.
2021-11-23 14:30:14 +01:00
fecdf9d44b Merge branch 'blender-v3.0-release'
Conflicts:
	source/blender/editors/transform/transform_generics.c
2021-11-23 10:17:24 -03:00
b7c98c87ac Cleanup: clang-tidy warnings
Silenciate warnings of usage of 'else' after 'return'
2021-11-23 10:15:00 -03:00
a6d1a2d3fc Merge branch 'blender-v3.0-release' 2021-11-23 14:08:53 +01:00
Christian Stolze
bba6fe83e2 Fix T89204: slow repeated rendering with GPUOffscreen.draw_view3d.
Reviewed By: fclem
Differential Revision: D13235
2021-11-23 14:08:38 +01:00
6ab3349bd4 Documentation: Remove deprecated glColor* from bgl module.
glColor isn't supported but still part of the documentation. This
patch removes the glColor from the documentation.

Ref {T93315}
2021-11-23 13:03:12 +01:00
3aab18f0ae Add default value to String to Curves string input 2021-10-29 16:59:07 +02:00
423a931ce5 Rename socket "Curves" to "Curve Instances" on String to Curves-node 2021-10-29 16:58:30 +02:00
be109b60e7 Fix typo Curve -> Curves in socket name 2021-10-29 16:57:27 +02:00
98df4c4040 Add Line and Pivot outputs to String to Curves 2021-10-29 16:56:20 +02:00
43a56ea1e7 Initial support for custom attributes on instances 2021-10-29 16:54:05 +02:00
183 changed files with 3021 additions and 1803 deletions

View File

@@ -106,24 +106,6 @@ including advanced features.
floating-point values. These values are interpreted as a plane equation.
.. function:: glColor (red, green, blue, alpha):
B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us,
glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us,
glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv,
glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv,
glColor4uiv, glColor4usv}
Set a new color.
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glColor.xhtml>`__
:type red, green, blue, alpha: Depends on function prototype.
:arg red, green, blue: Specify new red, green, and blue values for the current color.
:arg alpha: Specifies a new alpha value for the current color. Included only in the
four-argument glColor4 commands. (With '4' colors only)
.. function:: glColorMask(red, green, blue, alpha):
Enable and disable writing of frame buffer color components

View File

@@ -1333,6 +1333,7 @@ enum {
HIPEW_SUCCESS = 0,
HIPEW_ERROR_OPEN_FAILED = -1,
HIPEW_ERROR_ATEXIT_FAILED = -2,
HIPEW_ERROR_OLD_DRIVER = -3,
};
enum {

View File

@@ -214,6 +214,36 @@ static void hipewHipExit(void) {
}
}
#ifdef _WIN32
static int hipewHasOldDriver(const char *hip_path) {
DWORD verHandle = 0;
DWORD verSize = GetFileVersionInfoSize(hip_path, &verHandle);
int old_driver = 0;
if(verSize != 0) {
LPSTR verData = (LPSTR)malloc(verSize);
if(GetFileVersionInfo(hip_path, verHandle, verSize, verData)) {
LPBYTE lpBuffer = NULL;
UINT size = 0;
if(VerQueryValue(verData, "\\", (VOID FAR * FAR *)&lpBuffer, &size)) {
if(size) {
VS_FIXEDFILEINFO *verInfo = (VS_FIXEDFILEINFO *)lpBuffer;
/* Magic value from
* https://docs.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo */
if(verInfo->dwSignature == 0xfeef04bd) {
unsigned int fileVersionLS0 = (verInfo->dwFileVersionLS >> 16) & 0xffff;
unsigned int fileversionLS1 = (verInfo->dwFileVersionLS >> 0) & 0xffff;
/* Corresponds to versions older than AMD Radeon Pro 21.Q4. */
old_driver = ((fileVersionLS0 < 3354) || (fileVersionLS0 == 3354 && fileversionLS1 < 13));
}
}
}
}
free(verData);
}
return old_driver;
}
#endif
static int hipewHipInit(void) {
/* Library paths. */
#ifdef _WIN32
@@ -241,6 +271,14 @@ static int hipewHipInit(void) {
return result;
}
#ifdef _WIN32
/* Test for driver version. */
if(hipewHasOldDriver(hip_paths[0])) {
result = HIPEW_ERROR_OLD_DRIVER;
return result;
}
#endif
/* Load library. */
hip_lib = dynamic_library_open_find(hip_paths);

View File

@@ -57,9 +57,16 @@ bool device_hip_init()
}
}
else {
VLOG(1) << "HIPEW initialization failed: "
<< ((hipew_result == HIPEW_ERROR_ATEXIT_FAILED) ? "Error setting up atexit() handler" :
"Error opening the library");
if (hipew_result == HIPEW_ERROR_ATEXIT_FAILED) {
VLOG(1) << "HIPEW initialization failed: Error setting up atexit() handler";
}
else if (hipew_result == HIPEW_ERROR_OLD_DRIVER) {
VLOG(1) << "HIPEW initialization failed: Driver version too old, requires AMD Radeon Pro "
"21.Q4 driver or newer";
}
else {
VLOG(1) << "HIPEW initialization failed: Error opening HIP dynamic library";
}
}
return result;

View File

@@ -47,9 +47,6 @@ static bool oidn_progress_monitor_function(void *user_ptr, double /*n*/)
OIDNDenoiser *oidn_denoiser = reinterpret_cast<OIDNDenoiser *>(user_ptr);
return !oidn_denoiser->is_cancelled();
}
#endif
#ifdef WITH_OPENIMAGEDENOISE
class OIDNPass {
public:
@@ -547,7 +544,6 @@ class OIDNDenoiseContext {
* the fake values and denoising of passes which do need albedo can no longer happen. */
bool albedo_replaced_with_fake_ = false;
};
#endif
static unique_ptr<DeviceQueue> create_device_queue(const RenderBuffers *render_buffers)
{
@@ -582,18 +578,20 @@ static void copy_render_buffers_to_device(unique_ptr<DeviceQueue> &queue,
}
}
#endif
bool OIDNDenoiser::denoise_buffer(const BufferParams &buffer_params,
RenderBuffers *render_buffers,
const int num_samples,
bool allow_inplace_modification)
{
#ifdef WITH_OPENIMAGEDENOISE
thread_scoped_lock lock(mutex_);
/* Make sure the host-side data is available for denoising. */
unique_ptr<DeviceQueue> queue = create_device_queue(render_buffers);
copy_render_buffers_from_device(queue, render_buffers);
#ifdef WITH_OPENIMAGEDENOISE
OIDNDenoiseContext context(
this, params_, buffer_params, render_buffers, num_samples, allow_inplace_modification);
@@ -620,6 +618,11 @@ bool OIDNDenoiser::denoise_buffer(const BufferParams &buffer_params,
* copies data from the device it doesn't overwrite the denoiser buffers. */
copy_render_buffers_to_device(queue, render_buffers);
}
#else
(void)buffer_params;
(void)render_buffers;
(void)num_samples;
(void)allow_inplace_modification;
#endif
/* This code is not supposed to run when compiled without OIDN support, so can assume if we made

View File

@@ -699,8 +699,10 @@ ccl_device_forceinline bool integrate_volume_sample_light(
float light_u, light_v;
path_state_rng_2D(kg, rng_state, PRNG_LIGHT_U, &light_u, &light_v);
light_distribution_sample_from_volume_segment(
kg, light_u, light_v, sd->time, sd->P, bounce, path_flag, ls);
if (!light_distribution_sample_from_volume_segment(
kg, light_u, light_v, sd->time, sd->P, bounce, path_flag, ls)) {
return false;
}
if (ls->shader & SHADER_EXCLUDE_SCATTER) {
return false;

View File

@@ -73,7 +73,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg,
ls->P = zero_float3();
ls->Ng = zero_float3();
ls->D = zero_float3();
ls->pdf = true;
ls->pdf = 1.0f;
ls->t = FLT_MAX;
return true;
}
@@ -131,7 +131,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg,
float3 dir = make_float3(klight->spot.dir[0], klight->spot.dir[1], klight->spot.dir[2]);
ls->eval_fac *= spot_light_attenuation(
dir, klight->spot.spot_angle, klight->spot.spot_smooth, ls->Ng);
if (ls->eval_fac == 0.0f) {
if (!in_volume_segment && ls->eval_fac == 0.0f) {
return false;
}
}
@@ -170,7 +170,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg,
float3 sample_axisu = axisu;
float3 sample_axisv = axisv;
if (klight->area.tan_spread > 0.0f) {
if (!in_volume_segment && klight->area.tan_spread > 0.0f) {
if (!light_spread_clamp_area_light(
P, Ng, &ls->P, &sample_axisu, &sample_axisv, klight->area.tan_spread)) {
return false;
@@ -203,7 +203,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg,
ls->pdf *= kernel_data.integrator.pdf_lights;
return (ls->pdf > 0.0f);
return in_volume_segment || (ls->pdf > 0.0f);
}
ccl_device bool lights_intersect(KernelGlobals kg,

View File

@@ -8520,26 +8520,6 @@
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssssssssssssss" />
</g>
<g
transform="matrix(0.92857149,0,0,0.92857137,106.93015,-501.7093)"
style="display:inline;opacity:0.98999999;fill:#ffffff;stroke-width:1.07692313;enable-background:new"
id="g8599"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<path
sodipodi:nodetypes="cccccccccccssccsssss"
inkscape:connector-curvature="0"
id="path8595"
transform="matrix(1.076923,0,0,1.0769231,-739.76878,506.92345)"
d="m 992.67578,105.26367 c -0.19597,-0.18575 -0.45872,-0.28437 -0.72851,-0.27344 -0.89539,0.0396 -1.29072,1.14623 -0.62305,1.74415 L 992.69727,108 H 986 c -1.36099,-0.0279 -1.36099,2.02794 0,2 h 3.0918 c -0.003,0.002 -0.005,0.004 -0.008,0.006 l -4.75,4.24805 c -0.99479,0.88933 0.3392,2.38151 1.33399,1.49218 l 2.33984,-2.09375 C 988.08993,116.60772 990.52575,119 993.5,119 c 3.02565,0 5.49805,-2.47428 5.49805,-5.5 0,-1.56564 -0.66395,-2.97983 -1.72241,-3.98356 z M 993.5,110 c 1.94471,0 3.5,1.5551 3.5,3.5 0,1.94489 -1.55529,3.5 -3.5,3.5 -1.94472,0 -3.5,-1.55511 -3.5,-3.5 0,-1.9449 1.55528,-3.5 3.5,-3.5 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<path
id="path8597"
d="m 331.99999,629.15424 a 1.86519,1.8457757 0 0 1 -1.86519,1.84577 1.86519,1.8457757 0 0 1 -1.86519,-1.84577 1.86519,1.8457757 0 0 1 1.86519,-1.84578 1.86519,1.8457757 0 0 1 1.86519,1.84578 z"
style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2.15384626;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke"
inkscape:connector-curvature="0" />
</g>
<g
id="g12575"
transform="matrix(0.8666665,0,0,0.8666665,-253.07368,16.407198)"
@@ -13729,11 +13709,6 @@
id="g16343-6"
style="display:inline;opacity:0.98999999;fill:#ffffff;enable-background:new" />
</g>
<path
inkscape:connector-curvature="0"
id="path18041"
d="m 517.0019,53.000264 c -0.47496,-0.0438 -0.94252,0.0803 -1.30468,0.35742 -0.28815,0.22047 -0.55389,0.56737 -0.6211,1.0332 -0.0672,0.46584 0.11485,1.01133 0.57227,1.46876 l 0.14648,0.14648 h -4.29297 c -0.53506,4e-5 -1.03128,0.28661 -1.29883,0.75 -0.26752,0.46339 -0.26752,1.03661 0,1.5 0.26755,0.46339 0.76375,0.75 1.29883,0.75 h 0.79297 l -2.64648,2.64648 c -0.79091,0.79079 -0.84722,1.93194 -0.29297,2.65625 0.22044,0.28814 0.56748,0.55402 1.0332,0.6211 0.46572,0.0671 1.0091,-0.11342 1.4668,-0.57031 l 1.4043,-1.40235 c 0.55515,1.96585 2.10614,3.53021 4.16406,3.94141 2.37442,0.47444 4.78539,-0.66388 5.92773,-2.79883 1.14235,-2.13495 0.75134,-4.77035 -0.96094,-6.48242 a 0.50005,0.50005 0 0 0 -0.002,-0.004 l -4.0332,-3.96094 c -0.39539,-0.39541 -0.87856,-0.60853 -1.35352,-0.65234 z m -0.0957,1.00195 c 0.24304,0.0198 0.50958,0.1248 0.74219,0.35743 a 0.50005,0.50005 0 0 0 0.004,0.002 l 4.03125,3.96289 c 1.40369,1.40351 1.72164,3.55449 0.78516,5.30469 -0.93648,1.7502 -2.90114,2.678 -4.84766,2.28906 -1.9465,-0.38894 -3.40679,-2.00407 -3.60937,-3.97266 a 0.50005,0.50005 0 0 0 -0.85156,-0.30273 l -2.01172,2.00976 c -0.29296,0.29245 -0.47153,0.30809 -0.61719,0.28711 -0.14566,-0.021 -0.29945,-0.12932 -0.38281,-0.23828 -0.21096,-0.27568 -0.25826,-0.87658 0.20703,-1.34179 l 3.5,-3.5 a 0.50005,0.50005 0 0 0 -0.35352,-0.85352 h -2 c -0.17943,0 -0.34387,-0.0946 -0.43359,-0.25 -0.0897,-0.15539 -0.0897,-0.34461 0,-0.5 0.0897,-0.15539 0.25413,-0.24999 0.43359,-0.25 h 5.5 a 0.50005,0.50005 0 0 0 0.35352,-0.85352 l -1,-1 c -0.29258,-0.29257 -0.31008,-0.47147 -0.28906,-0.61718 0.021,-0.14571 0.13127,-0.29945 0.24023,-0.38282 0.13784,-0.10546 0.35657,-0.17021 0.59961,-0.15039 z m 1.5957,5.00391 c -1.37479,0 -2.5,1.12521 -2.5,2.5 0,1.37479 1.12521,2.5 2.5,2.5 1.37479,0 2.5,-1.12521 2.5,-2.5 0,-1.37479 -1.12521,-2.5 -2.5,-2.5 z m 0,1 c 0.83435,0 1.5,0.66565 1.5,1.5 0,0.83435 -0.66565,1.5 -1.5,1.5 -0.83435,0 -1.5,-0.66565 -1.5,-1.5 0,-0.83435 0.66565,-1.5 1.5,-1.5 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.98999999;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<path
id="path14479-6"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
@@ -17373,6 +17348,107 @@
d="m 417.92349,304.73964 c -0.7818,-0.0644 -0.86293,1.09626 -0.0796,1.1383 l 0.41758,0.0202 c 0.78182,0.0644 0.86296,-1.09626 0.0796,-1.13831 z m -7.87437,1.29265 c -0.65325,0.42724 0.0163,1.38626 0.65667,0.94062 l 0.34001,-0.23929 c 0.65327,-0.42727 -0.0163,-1.38631 -0.65662,-0.94061 z m 5.26412,-0.10772 c 0.785,-0.0185 0.73895,-1.18175 -0.0451,-1.14009 -0.6811,-0.0652 -1.43225,-0.0213 -2.22341,0.0851 -0.785,0.0185 -0.73896,1.18176 0.0451,1.14011 0.8585,-0.10954 1.60282,-0.14009 2.22342,-0.0852 z m -5.74172,5.34858 c -0.17789,-0.75187 -1.32618,-0.47161 -1.12597,0.27482 -0.008,0.72815 0.18352,1.43475 0.53595,2.12392 0.17789,0.75187 1.32617,0.47159 1.12598,-0.27483 -0.40688,-0.70818 -0.47775,-1.41605 -0.53596,-2.12391 z m 1.14987,4.81425 c 0.55238,0.5479 1.3799,-0.2833 0.81165,-0.81524 l -0.30437,-0.28193 c -0.55238,-0.54789 -1.37991,0.2833 -0.81163,0.81524 z m 2.55883,0.11471 c -0.78112,0.0716 -0.65484,1.22767 0.12391,1.13446 0.79706,0.0708 1.5429,0.0136 2.2124,-0.23372 0.7811,-0.0716 0.65482,-1.22768 -0.12391,-1.13445 -0.66955,0.35373 -1.42049,0.37687 -2.2124,0.23371 z m 4.35036,-1.24066 c 0.39775,-0.66505 -0.63058,-1.23994 -1.00859,-0.56384 l -0.19953,0.36135 c -0.39776,0.66506 0.63057,1.23995 1.00857,0.56383 z m -1.53457,-4.82813 c -0.44444,-0.63566 -1.409,0.0364 -0.94666,0.65956 0.53116,0.53126 0.99257,1.10609 1.28624,1.78569 0.44445,0.63565 1.40902,-0.0364 0.94667,-0.65956 -0.24301,-0.74231 -0.69323,-1.32054 -1.28625,-1.78569 z m -2.73483,-1.49223 c -0.72218,-0.30138 -1.16808,0.7761 -0.43732,1.05681 l 0.39025,0.14758 c 0.7222,0.30141 1.1681,-0.7761 0.43732,-1.0568 z m -7.60223,1.91562 c -0.52109,0.57678 0.37464,1.33651 0.87855,0.74515 l 0.26685,-0.31654 c 0.52111,-0.57679 -0.37465,-1.33654 -0.87854,-0.74516 z m 1.15912,7.09355 c -0.1906,-0.74845 -1.33363,-0.44917 -1.12109,0.29354 l 0.11543,0.39523 c 0.19062,0.74845 1.33365,0.44917 1.12109,-0.29354 z m -0.68592,-4.36328 c -0.0858,-0.76698 -1.25912,-0.62352 -1.15127,0.14077 -0.065,0.75431 -0.008,1.50847 0.28594,2.26232 0.0859,0.76696 1.25912,0.62352 1.15129,-0.14076 -0.28468,-0.81162 -0.29126,-1.53878 -0.28596,-2.26233 z m 1.97398,-4.7241 c -0.77314,0.13162 -0.55483,1.27463 0.21417,1.12135 0.7762,-0.30633 1.5005,-0.42412 2.18687,-0.40397 0.77313,-0.13163 0.55482,-1.27462 -0.21418,-1.12137 -0.74152,0.0229 -1.4733,0.13255 -2.18686,0.40399 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.15052;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:2.2;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
id="path4101-2-6-9-1_GP_dotdash" />
<g
id="g4112">
<g
transform="matrix(0.55059923,0,0,0.55059916,233.59783,-262.1787)"
style="display:inline;opacity:0.99;fill:#ffffff;stroke-width:1.07692;enable-background:new"
id="g8599"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<path
id="path8597"
d="m 331.99999,629.15424 a 1.86519,1.8457757 0 0 1 -1.86519,1.84577 1.86519,1.8457757 0 0 1 -1.86519,-1.84577 1.86519,1.8457757 0 0 1 1.86519,-1.84578 1.86519,1.8457757 0 0 1 1.86519,1.84578 z"
style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2.15385;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke"
inkscape:connector-curvature="0" />
</g>
<path
sodipodi:nodetypes="cccccccccccssccsssss"
inkscape:connector-curvature="0"
id="path8595"
d="m 414.89176,79.34933 c -0.1162,-0.110141 -0.272,-0.168618 -0.43197,-0.162137 -0.53092,0.02348 -0.76534,0.67966 -0.36944,1.034198 l 0.81415,0.750454 h -3.97116 c -0.807,-0.01654 -0.807,1.202473 0,1.185905 h 1.83329 c -0.002,0.0012 -0.003,0.0024 -0.005,0.0036 l -2.81653,2.518894 c -0.58986,0.527331 0.20113,1.412123 0.79099,0.884793 l 1.38742,-1.241496 c 0.0488,1.752319 1.49313,3.170828 3.25672,3.170828 1.79406,0 3.26008,-1.467132 3.26008,-3.261241 0,-0.928351 -0.39369,-1.766899 -1.02131,-2.362064 z m 0.48873,2.80842 c 1.15312,0 2.07533,0.922102 2.07533,2.075336 0,1.153228 -0.92221,2.075335 -2.07533,2.075335 -1.15313,0 -2.07534,-0.922107 -2.07534,-2.075335 0,-1.153234 0.92221,-2.075336 2.07534,-2.075336 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.18591;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<g
style="display:inline;fill:#ffffff;enable-background:new"
id="g15543-3"
transform="translate(21.029034,-20.999943)">
<g
id="g15520-6"
transform="translate(231.97182,-397.99995)"
style="display:inline;opacity:0.6;fill:#ffffff;enable-background:new"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<g
id="g4103">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
d="m 430.48047,53 c -0.15153,0.004 -0.29304,0.07659 -0.38477,0.197266 l -3.94922,3.949218 C 425.83169,57.461484 426.05468,57.99983 426.5,58 h 4 c 0.27613,-3e-5 0.49997,-0.22387 0.5,-0.5 V 54 h 6 v 3.5 c -0.01,0.676161 1.00956,0.676161 1,0 v -4 c -3e-5,-0.276131 -0.22387,-0.499972 -0.5,-0.5 h -7 c -0.005,-6.2e-5 -0.009,-6.2e-5 -0.0137,0 -6.7e-4,1.8e-5 -0.001,-2.1e-5 -0.002,0 -0.001,4.1e-5 -0.003,-5e-5 -0.004,0 z M 426,59.000004 V 66.5 c 3e-5,0.276131 0.22387,0.499972 0.5,0.5 h 4.25 c 0.67616,0.0096 0.67616,-1.009563 0,-1 H 427 v -6.999996 z"
transform="translate(-273.99999,439.99994)"
id="path15514-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccccccccccccc" />
</g>
</g>
</g>
</g>
<g
id="g4115"
transform="matrix(1.1626173,0,0,1.1626173,-76.104888,-15.461598)">
<g
id="g4081"
transform="matrix(0.83071001,0,0,0.85634802,340.90207,-327.16835)"
style="display:inline;opacity:0.6;fill:#ffffff;enable-background:new"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
d="m 164.00001,502.51502 v 3.48493 h -10 v -6 h -1 v 6.5 c 3e-5,0.27613 0.22387,0.49997 0.5,0.5 h 11 c 0.27613,-3e-5 0.49997,-0.22387 0.5,-0.5 v -3.98493 c 0,-0.20663 -0.12519,-0.386 -0.5,-0.386 -0.35128,0 -0.5,0.17937 -0.5,0.386 z m 1,-8.21753 v -0.79754 c -3e-5,-0.27613 -0.22387,-0.49997 -0.5,-0.5 h -6 c -0.005,-6e-5 -0.009,-6e-5 -0.0137,0 -6.7e-4,2e-5 -0.001,-2e-5 -0.002,0 -0.001,4e-5 -0.003,-5e-5 -0.004,0 h 1.7e-4 c -0.15153,0.004 -0.29304,0.0766 -0.38477,0.19727 l -4.94922,4.94921 c -0.31479,0.315 -0.0918,0.85335 0.35352,0.85352 h 5 c 0.27613,-3e-5 0.49997,-0.22387 0.5,-0.5 v -4.5 h 5 v 0.2975 c 0,0.23264 0.20298,0.33811 0.5,0.33811 0.34336,0 0.5,-0.1072 0.5,-0.33807 z"
id="path4079"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sccccccccssscccccccccccccccscc" />
</g>
<g
style="display:inline;fill:#ffffff;enable-background:new"
inkscape:export-ydpi="96"
inkscape:export-xdpi="96"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
transform="matrix(0.56694736,0,0,0.56694736,277.87149,-171.0587)"
id="g12839-3">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
d="m 353.13867,473.0332 c -0.49613,-0.0451 -1.03862,0.15972 -1.49219,0.61328 l -0.75,0.75 c -0.19519,0.19527 -0.19519,0.51177 0,0.70704 l 3,3 c 0.19527,0.19519 0.51177,0.19519 0.70704,0 l 0.75,-0.75 c 0.45356,-0.45357 0.65838,-0.99606 0.61328,-1.49219 -0.0451,-0.49613 -0.30436,-0.90592 -0.61328,-1.21485 l -1,-1 c -0.30893,-0.30892 -0.71872,-0.56817 -1.21485,-0.61328 z m -3.39644,2.7168 c -0.12989,0.002 -0.25387,0.0546 -0.34571,0.14648 l -6.25,6.25 c -0.0639,0.0642 -0.10909,0.14453 -0.13086,0.23243 l -1,4 c -0.0904,0.36537 0.2401,0.69582 0.60547,0.60547 l 4,-1 c 0.0879,-0.0218 0.16823,-0.067 0.23243,-0.13086 l 6.25,-6.25 c 0.19519,-0.19527 0.19519,-0.51177 0,-0.70704 l -3,-3 c -0.0957,-0.0957 -0.22605,-0.14856 -0.36137,-0.14648 z"
id="path12837-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccscccccccccccccccc" />
</g>
</g>
<g
id="g4125"
transform="translate(1.6871136,-0.5076635)">
<path
inkscape:connector-curvature="0"
id="path18041"
d="m 517.77147,58.722239 c -0.2809,-0.0259 -0.5574,0.04749 -0.77158,0.211377 -0.17042,0.130386 -0.32757,0.335543 -0.36733,0.611033 -0.0396,0.275496 0.0679,0.598097 0.33844,0.868617 l 0.0866,0.08662 h -2.53884 c -0.31644,2.9e-5 -0.60991,0.1695 -0.76813,0.44355 -0.1582,0.274049 -0.1582,0.61305 0,0.8871 0.15822,0.274039 0.45168,0.44354 0.76813,0.44354 h 0.46895 l -1.56512,1.565122 c -0.46774,0.467671 -0.50105,1.142542 -0.17326,1.570897 0.13038,0.170405 0.33561,0.327646 0.61103,0.367321 0.27542,0.03967 0.59678,-0.06708 0.86747,-0.337281 l 0.83049,-0.829342 c 0.32831,1.162599 1.24557,2.08775 2.46262,2.330933 1.40423,0.280582 2.83006,-0.392618 3.50563,-1.655214 0.6756,-1.262608 0.44435,-2.821177 -0.56829,-3.83369 a 0.29572815,0.29572815 0 0 0 -9.4e-4,-0.0019 l -2.38521,-2.342487 c -0.23385,-0.233844 -0.51957,-0.359883 -0.80048,-0.385791 z m -0.0567,0.592551 c 0.14373,0.01171 0.30137,0.0738 0.43893,0.211383 a 0.29572815,0.29572815 0 0 0 0.002,0.0013 l 2.38407,2.343643 c 0.83014,0.830032 1.01818,2.102118 0.46434,3.137175 -0.55382,1.035068 -1.71572,1.583769 -2.86689,1.35375 -1.15115,-0.230019 -2.01477,-1.185201 -2.13458,-2.349424 a 0.29572815,0.29572815 0 0 0 -0.50361,-0.179037 l -1.18971,1.188575 c -0.17327,0.172952 -0.27888,0.182198 -0.36501,0.169792 -0.0861,-0.01244 -0.17709,-0.07651 -0.22639,-0.140918 -0.12477,-0.163036 -0.15274,-0.518409 0.12244,-0.793527 l 2.06987,-2.069891 a 0.29572815,0.29572815 0 0 0 -0.20906,-0.504769 h -1.1828 c -0.10611,0 -0.20337,-0.0559 -0.25643,-0.147851 -0.0529,-0.09187 -0.0529,-0.203798 0,-0.295699 0.053,-0.09188 0.1503,-0.14784 0.25643,-0.14785 h 3.2527 a 0.29572815,0.29572815 0 0 0 0.20906,-0.504769 l -0.5914,-0.591399 c -0.17302,-0.173025 -0.18336,-0.278826 -0.17094,-0.364998 0.0124,-0.08618 0.0776,-0.177095 0.14206,-0.226399 0.0815,-0.06238 0.21088,-0.100658 0.35461,-0.08895 z m 0.94369,2.959298 c -0.81305,0 -1.47849,0.665441 -1.47849,1.47849 0,0.813049 0.66544,1.478491 1.47849,1.478491 0.81305,0 1.47849,-0.665442 1.47849,-1.478491 0,-0.813049 -0.66544,-1.47849 -1.47849,-1.47849 z m 0,0.5914 c 0.49344,0 0.8871,0.393657 0.8871,0.88709 0,0.493434 -0.39366,0.887101 -0.8871,0.887101 -0.49343,0 -0.88709,-0.393667 -0.88709,-0.887101 0,-0.493433 0.39366,-0.88709 0.88709,-0.88709 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.99;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.591397;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<g
id="g4092"
transform="translate(356.31374,-439.49223)"
style="display:inline;opacity:0.6;fill:#ffffff;enable-background:new"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
d="m 430.48047,53 c -0.15153,0.004 -0.29304,0.07659 -0.38477,0.197266 l -3.94922,3.949218 C 425.83169,57.461484 426.05468,57.99983 426.5,58 h 4 c 0.27613,-3e-5 0.49997,-0.22387 0.5,-0.5 V 54 h 6 v 3.5 c -0.01,0.676161 1.00956,0.676161 1,0 v -4 c -3e-5,-0.276131 -0.22387,-0.499972 -0.5,-0.5 h -7 c -0.005,-6.2e-5 -0.009,-6.2e-5 -0.0137,0 -6.7e-4,1.8e-5 -0.001,-2.1e-5 -0.002,0 -0.001,4.1e-5 -0.003,-5e-5 -0.004,0 z M 426,59.000004 V 66.5 c 3e-5,0.276131 0.22387,0.499972 0.5,0.5 h 4.25 c 0.67616,0.0096 0.67616,-1.009563 0,-1 H 427 v -6.999996 z"
transform="translate(-273.99999,439.99994)"
id="path4090"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccccccccccccc" />
</g>
</g>
</g>
<g
inkscape:groupmode="layer"

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

@@ -166,7 +166,7 @@ class ScalarBlendModifier(StrokeShader):
v1 = facm * v1 + fac * v1 / v2 if v2 != 0.0 else v1
elif self.blend_type == 'DIFFERENCE':
v1 = facm * v1 + fac * abs(v1 - v2)
elif self.blend_type == 'MININUM':
elif self.blend_type == 'MINIMUM':
v1 = min(fac * v2, v1)
elif self.blend_type == 'MAXIMUM':
v1 = max(fac * v2, v1)

View File

@@ -721,6 +721,10 @@ class NODE_PT_overlay(Panel):
col.prop(snode, "show_annotation", text="Annotations")
if snode.tree_type == 'GeometryNodeTree':
col.separator()
col.prop(overlay, "show_timing", text="Timings")
class NODE_UL_interface_sockets(bpy.types.UIList):
def draw_item(self, context, layout, _data, item, icon, _active_data, _active_propname, _index):

View File

@@ -1818,7 +1818,7 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
bl_options = {'HIDE_HEADER'}
_support_icon_mapping = {
'OFFICIAL': 'FILE_BLEND',
'OFFICIAL': 'BLENDER',
'COMMUNITY': 'COMMUNITY',
'TESTING': 'EXPERIMENTAL',
}

View File

@@ -50,6 +50,10 @@ void BKE_object_defgroup_active_index_set(struct Object *ob, const int new_index
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);
bool BKE_id_defgroup_name_find(const struct ID *id,
const char *name,
int *r_index,
struct 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);

View File

@@ -557,11 +557,35 @@ bDeformGroup *BKE_object_defgroup_find_name(const Object *ob, const char *name)
int BKE_id_defgroup_name_index(const ID *id, const char *name)
{
if (name == NULL || name[0] == '\0') {
int index;
if (!BKE_id_defgroup_name_find(id, name, &index, NULL)) {
return -1;
}
return index;
}
bool BKE_id_defgroup_name_find(const struct ID *id,
const char *name,
int *r_index,
struct bDeformGroup **r_group)
{
if (name == NULL || name[0] == '\0') {
return false;
}
const ListBase *defbase = BKE_id_defgroup_list_get(id);
return BLI_findstringindex(defbase, name, offsetof(bDeformGroup, name));
int index;
LISTBASE_FOREACH_INDEX (bDeformGroup *, group, defbase, index) {
if (STREQ(name, group->name)) {
if (r_index != NULL) {
*r_index = index;
}
if (r_group != NULL) {
*r_group = group;
}
return true;
}
}
return false;
}
const ListBase *BKE_object_defgroup_list(const Object *ob)

View File

@@ -1127,16 +1127,19 @@ class VertexGroupsAttributeProvider final : public DynamicAttributesProvider {
}
const std::string name = attribute_id.name();
const int vertex_group_index = BLI_findstringindex(
&mesh->vertex_group_names, name.c_str(), offsetof(bDeformGroup, name));
if (vertex_group_index < 0) {
int index;
bDeformGroup *group;
if (!BKE_id_defgroup_name_find(&mesh->id, name.c_str(), &index, &group)) {
return false;
}
BLI_remlink(&mesh->vertex_group_names, group);
MEM_freeN(group);
if (mesh->dvert == nullptr) {
return true;
}
for (MDeformVert &dvert : MutableSpan(mesh->dvert, mesh->totvert)) {
MDeformWeight *weight = BKE_defvert_find_index(&dvert, vertex_group_index);
MDeformWeight *weight = BKE_defvert_find_index(&dvert, index);
BKE_defvert_remove_group(&dvert, weight);
}
return true;

View File

@@ -170,7 +170,7 @@ TEST(virtual_array, MutableToImmutable)
EXPECT_TRUE(varray.is_span());
EXPECT_EQ(varray.size(), 4);
EXPECT_EQ(varray[1], 2);
EXPECT_EQ(mutable_varray.size(), 0);
EXPECT_EQ(mutable_varray.size(), 0); /* NOLINT: bugprone-use-after-move */
}
{
VArray<int> varray = VMutableArray<int>::ForSpan(array);

View File

@@ -1321,13 +1321,16 @@ static void version_liboverride_rnacollections_insertion_object_constraints(
opop->subitem_local_name,
offsetof(bConstraint, name),
opop->subitem_local_index);
if (constraint_anchor == NULL || constraint_anchor->next == NULL) {
bConstraint *constraint_src = constraint_anchor != NULL ? constraint_anchor->next :
constraints->first;
if (constraint_src == NULL) {
/* Invalid case, just remove that override property operation. */
CLOG_ERROR(&LOG, "Could not find anchor or source constraints in stored override data");
CLOG_ERROR(&LOG, "Could not find source constraint in stored override data");
BKE_lib_override_library_property_operation_delete(op, opop);
continue;
}
bConstraint *constraint_src = constraint_anchor->next;
opop->subitem_reference_name = opop->subitem_local_name;
opop->subitem_local_name = BLI_strdup(constraint_src->name);
opop->subitem_reference_index = opop->subitem_local_index;
@@ -1350,13 +1353,15 @@ static void version_liboverride_rnacollections_insertion_object(Object *object)
opop->subitem_local_name,
offsetof(ModifierData, name),
opop->subitem_local_index);
if (mod_anchor == NULL || mod_anchor->next == NULL) {
ModifierData *mod_src = mod_anchor != NULL ? mod_anchor->next : object->modifiers.first;
if (mod_src == NULL) {
/* Invalid case, just remove that override property operation. */
CLOG_ERROR(&LOG, "Could not find anchor or source modifiers in stored override data");
CLOG_ERROR(&LOG, "Could not find source modifier in stored override data");
BKE_lib_override_library_property_operation_delete(op, opop);
continue;
}
ModifierData *mod_src = mod_anchor->next;
opop->subitem_reference_name = opop->subitem_local_name;
opop->subitem_local_name = BLI_strdup(mod_src->name);
opop->subitem_reference_index = opop->subitem_local_index;
@@ -1375,13 +1380,17 @@ static void version_liboverride_rnacollections_insertion_object(Object *object)
opop->subitem_local_name,
offsetof(GpencilModifierData, name),
opop->subitem_local_index);
if (gp_mod_anchor == NULL || gp_mod_anchor->next == NULL) {
GpencilModifierData *gp_mod_src = gp_mod_anchor != NULL ?
gp_mod_anchor->next :
object->greasepencil_modifiers.first;
if (gp_mod_src == NULL) {
/* Invalid case, just remove that override property operation. */
CLOG_ERROR(&LOG, "Could not find anchor GP modifier in stored override data");
CLOG_ERROR(&LOG, "Could not find source GP modifier in stored override data");
BKE_lib_override_library_property_operation_delete(op, opop);
continue;
}
GpencilModifierData *gp_mod_src = gp_mod_anchor->next;
opop->subitem_reference_name = opop->subitem_local_name;
opop->subitem_local_name = BLI_strdup(gp_mod_src->name);
opop->subitem_reference_index = opop->subitem_local_index;
@@ -2395,6 +2404,12 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
* \note Keep this message at the bottom of the function.
*/
{
LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
if (ntree->type == NTREE_GEOMETRY) {
version_node_output_socket_name(
ntree, GEO_NODE_STRING_TO_CURVES, "Curves", "Curve Instances");
}
}
/* Keep this block, even when empty. */
}
}

View File

@@ -29,6 +29,7 @@
#include "BKE_animsys.h"
#include "BKE_camera.h"
#include "BKE_duplilist.h"
#include "BKE_object.h"
#include "BKE_screen.h"
@@ -318,6 +319,14 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata),
return;
}
const DupliObject *dup = DRW_object_get_dupli(ob);
if (dup != NULL && dup->ob->data != dup->ob_data) {
/* Geometry instances do not support motion blur correctly yet. The #key used in
* #motion_blur_deform_data_get has to take ids of instances (#DupliObject.persistent_id) into
* account. Otherwise it can't find matching geometry instances at different points in time. */
return;
}
EEVEE_ObjectMotionData *mb_data = EEVEE_motion_blur_object_data_get(
&effects->motion_blur, ob, false);

View File

@@ -1367,6 +1367,61 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
BLI_ticket_mutex_unlock(DST.gl_context_mutex);
}
/* update a viewport which belongs to a GPUOffscreen */
static void DRW_notify_view_update_offscreen(struct Depsgraph *depsgraph,
RenderEngineType *engine_type,
ARegion *region,
View3D *v3d,
GPUViewport *viewport)
{
if (viewport && GPU_viewport_do_update(viewport)) {
Scene *scene = DEG_get_evaluated_scene(depsgraph);
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
RegionView3D *rv3d = region->regiondata;
const bool gpencil_engine_needed = drw_gpencil_engine_needed(depsgraph, v3d);
/* Reset before using it. */
drw_state_prepare_clean_for_draw(&DST);
DST.draw_ctx = (DRWContextState){
.region = region,
.rv3d = rv3d,
.v3d = v3d,
.scene = scene,
.view_layer = view_layer,
.obact = OBACT(view_layer),
.engine_type = engine_type,
.depsgraph = depsgraph,
};
/* Custom lightweight initialize to avoid resetting the memory-pools. */
DST.viewport = viewport;
DST.vmempool = drw_viewport_data_ensure(DST.viewport);
/* Separate update for each stereo view. */
int view_count = GPU_viewport_is_stereo_get(viewport) ? 2 : 1;
for (int view = 0; view < view_count; view++) {
DST.view_data_active = DST.vmempool->view_data[view];
drw_engines_enable(view_layer, engine_type, gpencil_engine_needed);
drw_engines_data_validate();
DRW_ENABLED_ENGINE_ITER (DST.view_data_active, draw_engine, data) {
if (draw_engine->view_update) {
draw_engine->view_update(data);
}
}
drw_engines_disable();
}
drw_manager_exit(&DST);
}
}
/** \} */
/* -------------------------------------------------------------------- */
@@ -1742,11 +1797,14 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
GPUOffScreen *ofs,
GPUViewport *viewport)
{
/* Create temporary viewport if needed. */
/* Create temporary viewport if needed or update the existing viewport. */
GPUViewport *render_viewport = viewport;
if (viewport == NULL) {
render_viewport = GPU_viewport_create();
}
else {
DRW_notify_view_update_offscreen(depsgraph, engine_type, region, v3d, render_viewport);
}
GPU_viewport_bind_from_offscreen(render_viewport, ofs);

View File

@@ -113,7 +113,7 @@ const EnumPropertyItem *ED_asset_library_reference_to_rna_enum_itemf(
// {ASSET_REPO_BUNDLED, "BUNDLED", 0, "Bundled", "Show the default user assets"},
{ASSET_LIBRARY_LOCAL,
"LOCAL",
ICON_BLENDER,
ICON_CURRENT_FILE,
"Current File",
"Show the assets currently available in this Blender session"},
{0, nullptr, 0, nullptr, nullptr},

View File

@@ -619,6 +619,7 @@ set(ICON_NAMES
outliner_ob_volume
outliner_data_volume
volume_data
current_file
home
documents
temp

View File

@@ -774,7 +774,7 @@ DEF_ICON_BLANK(276)
DEF_ICON_BLANK(277)
DEF_ICON_BLANK(772)
DEF_ICON_BLANK(773)
DEF_ICON_BLANK(774)
DEF_ICON(CURRENT_FILE)
DEF_ICON(HOME)
DEF_ICON(DOCUMENTS)
DEF_ICON(TEMP)

View File

@@ -479,7 +479,7 @@ static void file_draw_preview(const SpaceFile *sfile,
const uchar light[4] = {255, 255, 255, 255};
icon_x = xco + ex - UI_UNIT_X;
icon_y = yco + ey - UI_UNIT_Y;
UI_icon_draw_ex(icon_x, icon_y, ICON_FILE_BLEND, 1.0f / U.dpi_fac, 0.6f, 0.0f, light, false);
UI_icon_draw_ex(icon_x, icon_y, ICON_CURRENT_FILE, 1.0f / U.dpi_fac, 0.6f, 0.0f, light, false);
}
/* Contrasting outline around some preview types. */

View File

@@ -337,8 +337,9 @@ static void node_draw_frame_prepare(const bContext *UNUSED(C), bNodeTree *ntree,
node->totr = rect;
}
static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float aspect)
static void node_draw_frame_label(bNodeTree *ntree, bNode *node, SpaceNode *snode)
{
const float aspect = snode->runtime->aspect;
/* XXX font id is crap design */
const int fontid = UI_style_get()->widgetlabel.uifont_id;
NodeFrame *data = (NodeFrame *)node->storage;
@@ -468,7 +469,9 @@ static void node_draw_frame(const bContext *C,
}
/* label and text */
node_draw_frame_label(ntree, node, snode->runtime->aspect);
node_draw_frame_label(ntree, node, snode);
node_draw_extra_info_panel(snode, node);
UI_block_end(C, node->block);
UI_block_draw(C, node->block);

View File

@@ -87,6 +87,8 @@
#include "node_intern.hh" /* own include */
#include <iomanip>
#ifdef WITH_COMPOSITOR
# include "COM_compositor.h"
#endif
@@ -843,29 +845,43 @@ struct SocketTooltipData {
bNodeSocket *socket;
};
static void create_inspection_string_for_generic_value(const geo_log::GenericValueLog &value_log,
std::stringstream &ss)
static void create_inspection_string_for_generic_value(const GPointer value, std::stringstream &ss)
{
auto id_to_inspection_string = [&](ID *id, short idcode) {
ss << (id ? id->name + 2 : TIP_("None")) << " (" << BKE_idtype_idcode_to_name(idcode) << ")";
};
const GPointer value = value_log.value();
const CPPType &type = *value.type();
const void *buffer = value.get();
if (type.is<Object *>()) {
id_to_inspection_string((ID *)*value.get<Object *>(), ID_OB);
id_to_inspection_string((ID *)buffer, ID_OB);
}
else if (type.is<Material *>()) {
id_to_inspection_string((ID *)*value.get<Material *>(), ID_MA);
id_to_inspection_string((ID *)buffer, ID_MA);
}
else if (type.is<Tex *>()) {
id_to_inspection_string((ID *)*value.get<Tex *>(), ID_TE);
id_to_inspection_string((ID *)buffer, ID_TE);
}
else if (type.is<Image *>()) {
id_to_inspection_string((ID *)*value.get<Image *>(), ID_IM);
id_to_inspection_string((ID *)buffer, ID_IM);
}
else if (type.is<Collection *>()) {
id_to_inspection_string((ID *)*value.get<Collection *>(), ID_GR);
id_to_inspection_string((ID *)buffer, ID_GR);
}
else if (type.is<int>()) {
ss << *(int *)buffer << TIP_(" (Integer)");
}
else if (type.is<float>()) {
ss << *(float *)buffer << TIP_(" (Float)");
}
else if (type.is<blender::float3>()) {
ss << *(blender::float3 *)buffer << TIP_(" (Vector)");
}
else if (type.is<bool>()) {
ss << ((*(bool *)buffer) ? TIP_("True") : TIP_("False")) << TIP_(" (Boolean)");
}
else if (type.is<std::string>()) {
ss << *(std::string *)buffer << TIP_(" (String)");
}
}
@@ -880,21 +896,7 @@ static void create_inspection_string_for_gfield(const geo_log::GFieldValueLog &v
if (field) {
BUFFER_FOR_CPP_TYPE_VALUE(type, buffer);
blender::fn::evaluate_constant_field(field, buffer);
if (type.is<int>()) {
ss << *(int *)buffer << TIP_(" (Integer)");
}
else if (type.is<float>()) {
ss << *(float *)buffer << TIP_(" (Float)");
}
else if (type.is<blender::float3>()) {
ss << *(blender::float3 *)buffer << TIP_(" (Vector)");
}
else if (type.is<bool>()) {
ss << ((*(bool *)buffer) ? TIP_("True") : TIP_("False")) << TIP_(" (Boolean)");
}
else if (type.is<std::string>()) {
ss << *(std::string *)buffer << TIP_(" (String)");
}
create_inspection_string_for_generic_value({type, buffer}, ss);
type.destruct(buffer);
}
else {
@@ -1023,7 +1025,7 @@ static std::optional<std::string> create_socket_inspection_string(bContext *C,
std::stringstream ss;
if (const geo_log::GenericValueLog *generic_value_log =
dynamic_cast<const geo_log::GenericValueLog *>(value_log)) {
create_inspection_string_for_generic_value(*generic_value_log, ss);
create_inspection_string_for_generic_value(generic_value_log->value(), ss);
}
if (const geo_log::GFieldValueLog *gfield_value_log =
dynamic_cast<const geo_log::GFieldValueLog *>(value_log)) {
@@ -1577,6 +1579,237 @@ static void node_add_error_message_button(
UI_block_emboss_set(node.block, UI_EMBOSS);
}
static void get_exec_time_other_nodes(const bNode *node,
const SpaceNode *snode,
std::chrono::microseconds &exec_time,
int &node_count)
{
if (node->type == NODE_GROUP) {
const geo_log::TreeLog *root_tree_log = geo_log::ModifierLog::find_tree_by_node_editor_context(
*snode);
if (root_tree_log == nullptr) {
return;
}
const geo_log::TreeLog *tree_log = root_tree_log->lookup_child_log(node->name);
if (tree_log == nullptr) {
return;
}
tree_log->foreach_node_log([&](const geo_log::NodeLog &node_log) {
exec_time += node_log.execution_time();
node_count++;
});
}
else {
const geo_log::NodeLog *node_log = geo_log::ModifierLog::find_node_by_node_editor_context(
*snode, *node);
if (node_log) {
exec_time += node_log->execution_time();
node_count++;
}
}
}
static std::chrono::microseconds node_get_execution_time(const bNodeTree *ntree,
const bNode *node,
const SpaceNode *snode,
int &node_count)
{
std::chrono::microseconds exec_time = std::chrono::microseconds::zero();
if (node->type == NODE_GROUP_OUTPUT) {
const geo_log::TreeLog *tree_log = geo_log::ModifierLog::find_tree_by_node_editor_context(
*snode);
if (tree_log == nullptr) {
return exec_time;
}
tree_log->foreach_node_log([&](const geo_log::NodeLog &node_log) {
exec_time += node_log.execution_time();
node_count++;
});
}
else if (node->type == NODE_FRAME) {
/* Could be cached in the future if this recursive code turns out to be slow. */
LISTBASE_FOREACH (bNode *, tnode, &ntree->nodes) {
if (tnode->parent != node) {
continue;
}
if (tnode->type == NODE_FRAME) {
exec_time += node_get_execution_time(ntree, tnode, snode, node_count);
}
else {
get_exec_time_other_nodes(tnode, snode, exec_time, node_count);
}
}
}
else {
get_exec_time_other_nodes(node, snode, exec_time, node_count);
}
return exec_time;
}
static std::string node_get_execution_time_label(const SpaceNode *snode, const bNode *node)
{
int node_count = 0;
std::chrono::microseconds exec_time = node_get_execution_time(
snode->nodetree, node, snode, node_count);
if (node_count == 0) {
return std::string("");
}
uint64_t exec_time_us = exec_time.count();
/* Don't show time if execution time is 0 microseconds. */
if (exec_time_us == 0) {
return std::string("-");
}
else if (exec_time_us < 100) {
return std::string("< 0.1 ms");
}
else {
short precision = 0;
/* Show decimal if value is below 1ms */
if (exec_time_us < 1000) {
precision = 2;
}
else if (exec_time_us < 10000) {
precision = 1;
}
std::stringstream stream;
stream << std::fixed << std::setprecision(precision) << (exec_time_us / 1000.0f);
return std::string(stream.str() + " ms");
}
return std::string("");
}
struct NodeExtraInfoRow {
std::string text;
const char *tooltip;
int icon;
};
static Vector<NodeExtraInfoRow> node_get_extra_info(const SpaceNode *snode, const bNode *node)
{
Vector<NodeExtraInfoRow> rows;
if (!(snode->overlay.flag & SN_OVERLAY_SHOW_OVERLAYS)) {
return rows;
}
if (snode->overlay.flag & SN_OVERLAY_SHOW_TIMINGS && snode->edittree->type == NTREE_GEOMETRY &&
(ELEM(node->typeinfo->nclass, NODE_CLASS_GEOMETRY, NODE_CLASS_GROUP, NODE_CLASS_ATTRIBUTE) ||
ELEM(node->type, NODE_FRAME, NODE_GROUP_OUTPUT))) {
NodeExtraInfoRow row;
row.text = node_get_execution_time_label(snode, node);
if (!row.text.empty()) {
row.tooltip = TIP_(
"The execution time from the node tree's latest evaluation. For frame and group nodes, "
"the time for all sub-nodes");
row.icon = ICON_PREVIEW_RANGE;
rows.append(std::move(row));
}
}
return rows;
}
static void node_draw_extra_info_row(const bNode *node,
const rctf *rect,
const int row,
const NodeExtraInfoRow &extra_info_row)
{
uiBut *but_timing = uiDefBut(node->block,
UI_BTYPE_LABEL,
0,
extra_info_row.text.c_str(),
(int)(rect->xmin + 4.0f * U.dpi_fac + NODE_MARGIN_X + 0.4f),
(int)(rect->ymin + row * (20.0f * U.dpi_fac)),
(short)(rect->xmax - rect->xmin),
(short)NODE_DY,
nullptr,
0,
0,
0,
0,
"");
UI_block_emboss_set(node->block, UI_EMBOSS_NONE);
uiBut *but_icon = uiDefIconBut(node->block,
UI_BTYPE_BUT,
0,
extra_info_row.icon,
(int)(rect->xmin + 6.0f * U.dpi_fac),
(int)(rect->ymin + row * (20.0f * U.dpi_fac)),
NODE_HEADER_ICON_SIZE * 0.8f,
UI_UNIT_Y,
nullptr,
0,
0,
0,
0,
extra_info_row.tooltip);
UI_block_emboss_set(node->block, UI_EMBOSS);
if (node->flag & NODE_MUTED) {
UI_but_flag_enable(but_timing, UI_BUT_INACTIVE);
UI_but_flag_enable(but_icon, UI_BUT_INACTIVE);
}
}
void node_draw_extra_info_panel(const SpaceNode *snode, const bNode *node)
{
Vector<NodeExtraInfoRow> extra_info_rows = node_get_extra_info(snode, node);
if (extra_info_rows.size() == 0) {
return;
}
const rctf *rct = &node->totr;
float color[4];
rctf extra_info_rect;
if (node->type == NODE_FRAME) {
extra_info_rect.xmin = rct->xmin;
extra_info_rect.xmax = rct->xmin + 95.0f * U.dpi_fac;
extra_info_rect.ymin = rct->ymin + 2.0f * U.dpi_fac;
extra_info_rect.ymax = rct->ymin + 2.0f * U.dpi_fac;
}
else {
extra_info_rect.xmin = rct->xmin + 3.0f * U.dpi_fac;
extra_info_rect.xmax = rct->xmin + 95.0f * U.dpi_fac;
extra_info_rect.ymin = rct->ymax;
extra_info_rect.ymax = rct->ymax + extra_info_rows.size() * (20.0f * U.dpi_fac);
if (node->flag & NODE_MUTED) {
UI_GetThemeColorBlend4f(TH_BACK, TH_NODE, 0.2f, color);
}
else {
UI_GetThemeColorBlend4f(TH_BACK, TH_NODE, 0.75f, color);
}
color[3] -= 0.35f;
UI_draw_roundbox_corner_set(
UI_CNR_ALL & ~UI_CNR_BOTTOM_LEFT &
((rct->xmax) > extra_info_rect.xmax ? ~UI_CNR_BOTTOM_RIGHT : UI_CNR_ALL));
UI_draw_roundbox_4fv(&extra_info_rect, true, BASIS_RAD, color);
/* Draw outline. */
const float outline_width = 1.0f;
extra_info_rect.xmin = rct->xmin + 3.0f * U.dpi_fac - outline_width;
extra_info_rect.xmax = rct->xmin + 95.0f * U.dpi_fac + outline_width;
extra_info_rect.ymin = rct->ymax - outline_width;
extra_info_rect.ymax = rct->ymax + outline_width +
extra_info_rows.size() * (20.0f * U.dpi_fac);
UI_GetThemeColorBlendShade4fv(TH_BACK, TH_NODE, 0.4f, -20, color);
UI_draw_roundbox_corner_set(
UI_CNR_ALL & ~UI_CNR_BOTTOM_LEFT &
((rct->xmax) > extra_info_rect.xmax ? ~UI_CNR_BOTTOM_RIGHT : UI_CNR_ALL));
UI_draw_roundbox_4fv(&extra_info_rect, false, BASIS_RAD, color);
}
for (int row : extra_info_rows.index_range()) {
node_draw_extra_info_row(node, &extra_info_rect, row, extra_info_rows[row]);
}
}
static void node_draw_basis(const bContext *C,
const View2D *v2d,
const SpaceNode *snode,
@@ -1602,6 +1835,8 @@ static void node_draw_basis(const bContext *C,
GPU_line_width(1.0f);
node_draw_extra_info_panel(snode, node);
/* Header. */
{
const rctf rect = {

View File

@@ -96,6 +96,7 @@ void node_link_calculate_multi_input_position(const float socket_x,
float r[2]);
int node_get_colorid(bNode *node);
void node_draw_extra_info_panel(const SpaceNode *snode, const bNode *node);
int node_get_resize_cursor(int directions);
void node_draw_shadow(const SpaceNode *snode, const bNode *node, float radius, float alpha);
void node_draw_default(const bContext *C,

View File

@@ -158,27 +158,34 @@ static int t_around_get(TransInfo *t)
}
ScrArea *area = t->area;
if (t->spacetype == SPACE_VIEW3D) {
/* Bend always uses the cursor. */
if (t->mode == TFM_BEND) {
return V3D_AROUND_CURSOR;
switch (t->spacetype) {
case SPACE_VIEW3D: {
if (t->mode == TFM_BEND) {
/* Bend always uses the cursor. */
return V3D_AROUND_CURSOR;
}
return t->settings->transform_pivot_point;
}
return t->settings->transform_pivot_point;
}
if (t->spacetype == SPACE_IMAGE) {
SpaceImage *sima = area->spacedata.first;
return sima->around;
}
if (t->spacetype == SPACE_GRAPH) {
SpaceGraph *sipo = area->spacedata.first;
return sipo->around;
}
if (t->spacetype == SPACE_CLIP) {
SpaceClip *sclip = area->spacedata.first;
return sclip->around;
}
if (t->spacetype == SPACE_SEQ && t->region->regiontype == RGN_TYPE_PREVIEW) {
return SEQ_tool_settings_pivot_point_get(t->scene);
case SPACE_IMAGE: {
SpaceImage *sima = area->spacedata.first;
return sima->around;
}
case SPACE_GRAPH: {
SpaceGraph *sipo = area->spacedata.first;
return sipo->around;
}
case SPACE_CLIP: {
SpaceClip *sclip = area->spacedata.first;
return sclip->around;
}
case SPACE_SEQ: {
if (t->region->regiontype == RGN_TYPE_PREVIEW) {
return SEQ_tool_settings_pivot_point_get(t->scene);
}
break;
}
default:
break;
}
return V3D_AROUND_CENTER_BOUNDS;

View File

@@ -178,11 +178,19 @@ class GFieldRef : public GFieldBase<const FieldNode *> {
}
};
namespace detail {
/* Utility class to make #is_field_v work. */
struct TypedFieldBase {
};
} // namespace detail
/**
* A typed version of #GField. It has the same memory layout as #GField.
*/
template<typename T> class Field : public GField {
template<typename T> class Field : public GField, detail::TypedFieldBase {
public:
using base_type = T;
Field() = default;
Field(GField field) : GField(std::move(field))
@@ -196,6 +204,11 @@ template<typename T> class Field : public GField {
}
};
/** True when T is any Field<...> type. */
template<typename T>
static constexpr bool is_field_v = std::is_base_of_v<detail::TypedFieldBase, T> &&
!std::is_same_v<detail::TypedFieldBase, T>;
/**
* A #FieldNode that allows composing existing fields into new fields.
*/
@@ -419,6 +432,8 @@ template<typename T> Field<T> make_constant_field(T value)
return Field<T>{GField{std::move(operation), 0}};
}
GField make_constant_field(const CPPType &type, const void *value);
GField make_field_constant_if_possible(GField field);
class IndexFieldInput final : public FieldInput {
@@ -437,6 +452,52 @@ class IndexFieldInput final : public FieldInput {
/** \} */
/* -------------------------------------------------------------------- */
/** \name Value or Field Class
*
* Utility class that wraps a single value and a field, to simplify accessing both of the types.
* \{ */
template<typename T> struct ValueOrField {
/** Value that is used when the field is empty. */
T value{};
Field<T> field;
ValueOrField() = default;
ValueOrField(T value) : value(std::move(value))
{
}
ValueOrField(Field<T> field) : field(std::move(field))
{
}
bool is_field() const
{
return (bool)this->field;
}
Field<T> as_field() const
{
if (this->field) {
return this->field;
}
return make_constant_field(this->value);
}
T as_value() const
{
if (this->field) {
/* This returns a default value when the field is not constant. */
return evaluate_constant_field(this->field);
}
return this->value;
}
};
/** \} */
/* -------------------------------------------------------------------- */
/** \name #FieldNode Inline Methods
* \{ */

View File

@@ -60,6 +60,84 @@ class FieldCPPType : public CPPType {
}
};
class ValueOrFieldCPPType : public CPPType {
private:
const CPPType &base_type_;
void (*construct_from_value_)(void *dst, const void *value);
void (*construct_from_field_)(void *dst, GField field);
const void *(*get_value_ptr_)(const void *value_or_field);
const GField *(*get_field_ptr_)(const void *value_or_field);
bool (*is_field_)(const void *value_or_field);
GField (*as_field_)(const void *value_or_field);
public:
template<typename T>
ValueOrFieldCPPType(FieldCPPTypeParam<ValueOrField<T>> /* unused */, StringRef debug_name)
: CPPType(CPPTypeParam<ValueOrField<T>, CPPTypeFlags::None>(), debug_name),
base_type_(CPPType::get<T>())
{
construct_from_value_ = [](void *dst, const void *value_or_field) {
new (dst) ValueOrField<T>(*(const T *)value_or_field);
};
construct_from_field_ = [](void *dst, GField field) {
new (dst) ValueOrField<T>(Field<T>(std::move(field)));
};
get_value_ptr_ = [](const void *value_or_field) {
return (const void *)&((ValueOrField<T> *)value_or_field)->value;
};
get_field_ptr_ = [](const void *value_or_field) -> const GField * {
return &((ValueOrField<T> *)value_or_field)->field;
};
is_field_ = [](const void *value_or_field) {
return ((ValueOrField<T> *)value_or_field)->is_field();
};
as_field_ = [](const void *value_or_field) -> GField {
return ((ValueOrField<T> *)value_or_field)->as_field();
};
}
const CPPType &base_type() const
{
return base_type_;
}
void construct_from_value(void *dst, const void *value) const
{
construct_from_value_(dst, value);
}
void construct_from_field(void *dst, GField field) const
{
construct_from_field_(dst, field);
}
const void *get_value_ptr(const void *value_or_field) const
{
return get_value_ptr_(value_or_field);
}
void *get_value_ptr(void *value_or_field) const
{
/* Use `const_cast` to avoid duplicating the callback for the non-const case. */
return const_cast<void *>(get_value_ptr_(value_or_field));
}
const GField *get_field_ptr(const void *value_or_field) const
{
return get_field_ptr_(value_or_field);
}
bool is_field(const void *value_or_field) const
{
return is_field_(value_or_field);
}
GField as_field(const void *value_or_field) const
{
return as_field_(value_or_field);
}
};
} // namespace blender::fn
#define MAKE_FIELD_CPP_TYPE(DEBUG_NAME, FIELD_TYPE) \
@@ -69,4 +147,13 @@ class FieldCPPType : public CPPType {
static blender::fn::FieldCPPType cpp_type{ \
blender::fn::FieldCPPTypeParam<blender::fn::Field<FIELD_TYPE>>(), STRINGIFY(DEBUG_NAME)}; \
return cpp_type; \
} \
template<> \
const blender::fn::CPPType & \
blender::fn::CPPType::get_impl<blender::fn::ValueOrField<FIELD_TYPE>>() \
{ \
static blender::fn::ValueOrFieldCPPType cpp_type{ \
blender::fn::FieldCPPTypeParam<blender::fn::ValueOrField<FIELD_TYPE>>(), \
STRINGIFY(DEBUG_NAME##OrValue)}; \
return cpp_type; \
}

View File

@@ -511,10 +511,16 @@ GField make_field_constant_if_possible(GField field)
const CPPType &type = field.cpp_type();
BUFFER_FOR_CPP_TYPE_VALUE(type, buffer);
evaluate_constant_field(field, buffer);
auto constant_fn = std::make_unique<CustomMF_GenericConstant>(type, buffer, true);
GField new_field = make_constant_field(type, buffer);
type.destruct(buffer);
return new_field;
}
GField make_constant_field(const CPPType &type, const void *value)
{
auto constant_fn = std::make_unique<CustomMF_GenericConstant>(type, value, true);
auto operation = std::make_shared<FieldOperation>(std::move(constant_fn));
return GField{operation, 0};
return GField{std::move(operation), 0};
}
GVArray FieldContext::get_varray_for_input(const FieldInput &field_input,

View File

@@ -1581,7 +1581,8 @@ typedef struct NodeGeometryStringToCurves {
uint8_t align_x;
/* GeometryNodeStringToCurvesAlignYMode */
uint8_t align_y;
char _pad[1];
/* GeometryNodeStringToCurvesPivotMode */
uint8_t pivot_mode;
} NodeGeometryStringToCurves;
typedef struct NodeGeometryDeleteGeometry {
@@ -2266,6 +2267,16 @@ typedef enum GeometryNodeStringToCurvesAlignYMode {
GEO_NODE_STRING_TO_CURVES_ALIGN_Y_BOTTOM = 4,
} GeometryNodeStringToCurvesAlignYMode;
typedef enum GeometryNodeStringToCurvesPivotMode {
GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT = 0,
GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT = 1,
GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_CENTER = 2,
GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT = 3,
GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT = 4,
GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_CENTER = 5,
GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_RIGHT = 6,
} GeometryNodeStringToCurvesPivotMode;
typedef enum GeometryNodeDeleteGeometryMode {
GEO_NODE_DELETE_GEOMETRY_MODE_ALL = 0,
GEO_NODE_DELETE_GEOMETRY_MODE_EDGE_FACE = 1,

View File

@@ -1520,6 +1520,7 @@ typedef struct SpaceNodeOverlay {
typedef enum eSpaceNodeOverlay_Flag {
SN_OVERLAY_SHOW_OVERLAYS = (1 << 1),
SN_OVERLAY_SHOW_WIRE_COLORS = (1 << 2),
SN_OVERLAY_SHOW_TIMINGS = (1 << 3),
} eSpaceNodeOverlay_Flag;
typedef struct SpaceNode {

View File

@@ -1306,8 +1306,9 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna)
srna, "Sinus Displacement", "Add sinus displacement to stroke backbone geometry");
rna_def_geometry_modifier(srna);
prop = RNA_def_property(srna, "wavelength", PROP_FLOAT, PROP_NONE);
prop = RNA_def_property(srna, "wavelength", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "wavelength");
RNA_def_property_range(prop, 0.0001f, FLT_MAX);
RNA_def_property_ui_text(prop, "Wavelength", "Wavelength of the sinus displacement");
RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");

View File

@@ -11031,6 +11031,33 @@ static void def_geo_string_to_curves(StructRNA *srna)
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_node_geometry_string_to_curves_pivot_mode[] = {
{GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_MIDPOINT, "MIDPOINT", 0, "Midpoint", "Midpoint"},
{GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_LEFT, "TOP_LEFT", 0, "Top Left", "Top Left"},
{GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_CENTER,
"TOP_CENTER",
0,
"Top Center",
"Top Center"},
{GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_TOP_RIGHT, "TOP_RIGHT", 0, "Top Right", "Top Right"},
{GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT,
"BOTTOM_LEFT",
0,
"Bottom Left",
"Bottom Left"},
{GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_CENTER,
"BOTTOM_CENTER",
0,
"Bottom Center",
"Bottom Center"},
{GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_RIGHT,
"BOTTOM_RIGHT",
0,
"Bottom Right",
"Bottom Right"},
{0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
@@ -11063,6 +11090,13 @@ static void def_geo_string_to_curves(StructRNA *srna)
RNA_def_property_enum_default(prop, GEO_NODE_STRING_TO_CURVES_ALIGN_Y_TOP_BASELINE);
RNA_def_property_ui_text(prop, "Align Y", "");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "pivot_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "pivot_mode");
RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_pivot_mode);
RNA_def_property_enum_default(prop, GEO_NODE_STRING_TO_CURVES_PIVOT_MODE_BOTTOM_LEFT);
RNA_def_property_ui_text(prop, "Pivot Point", "The pivot point used when rotating characters");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_geo_separate_geometry(StructRNA *srna)

View File

@@ -7110,6 +7110,12 @@ static void rna_def_space_node_overlay(BlenderRNA *brna)
RNA_def_property_ui_text(
prop, "Show Wire Colors", "Color node links based on their connected sockets");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
prop = RNA_def_property(srna, "show_timing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", SN_OVERLAY_SHOW_TIMINGS);
RNA_def_property_boolean_default(prop, false);
RNA_def_property_ui_text(prop, "Show Timing", "Display each node's last execution time");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
}
static void rna_def_space_node(BlenderRNA *brna)

View File

@@ -98,6 +98,7 @@
#include "NOD_node_declaration.hh"
#include "FN_field.hh"
#include "FN_field_cpp_type.hh"
#include "FN_multi_function.hh"
using blender::Array;
@@ -113,9 +114,11 @@ using blender::StringRef;
using blender::StringRefNull;
using blender::Vector;
using blender::bke::OutputAttribute;
using blender::fn::Field;
using blender::fn::GField;
using blender::fn::GMutablePointer;
using blender::fn::GPointer;
using blender::fn::ValueOrField;
using blender::nodes::FieldInferencingInterface;
using blender::nodes::GeoNodeExecParams;
using blender::nodes::InputSocketFieldType;
@@ -491,35 +494,34 @@ static void init_socket_cpp_value_from_property(const IDProperty &property,
else if (property.type == IDP_DOUBLE) {
value = (float)IDP_Double(&property);
}
new (r_value) blender::fn::Field<float>(blender::fn::make_constant_field(value));
new (r_value) ValueOrField<float>(value);
break;
}
case SOCK_INT: {
int value = IDP_Int(&property);
new (r_value) blender::fn::Field<int>(blender::fn::make_constant_field(value));
new (r_value) ValueOrField<int>(value);
break;
}
case SOCK_VECTOR: {
float3 value;
copy_v3_v3(value, (const float *)IDP_Array(&property));
new (r_value) blender::fn::Field<float3>(blender::fn::make_constant_field(value));
new (r_value) ValueOrField<float3>(value);
break;
}
case SOCK_RGBA: {
blender::ColorGeometry4f value;
copy_v4_v4((float *)value, (const float *)IDP_Array(&property));
new (r_value) blender::fn::Field<ColorGeometry4f>(blender::fn::make_constant_field(value));
new (r_value) ValueOrField<ColorGeometry4f>(value);
break;
}
case SOCK_BOOLEAN: {
bool value = IDP_Int(&property) != 0;
new (r_value) blender::fn::Field<bool>(blender::fn::make_constant_field(value));
new (r_value) ValueOrField<bool>(value);
break;
}
case SOCK_STRING: {
std::string value = IDP_String(&property);
new (r_value)
blender::fn::Field<std::string>(blender::fn::make_constant_field(std::move(value)));
new (r_value) ValueOrField<std::string>(std::move(value));
break;
}
case SOCK_OBJECT: {
@@ -740,7 +742,12 @@ static void initialize_group_input(NodesModifierData &nmd,
const StringRef attribute_name{IDP_String(property_attribute_name)};
auto attribute_input = std::make_shared<blender::bke::AttributeFieldInput>(
attribute_name, *socket_type.base_cpp_type);
new (r_value) blender::fn::GField(std::move(attribute_input), 0);
GField attribute_field{std::move(attribute_input), 0};
const blender::fn::ValueOrFieldCPPType *cpp_type =
dynamic_cast<const blender::fn::ValueOrFieldCPPType *>(
socket_type.geometry_nodes_cpp_type);
BLI_assert(cpp_type != nullptr);
cpp_type->construct_from_field(r_value, std::move(attribute_field));
}
else {
init_socket_cpp_value_from_property(
@@ -904,7 +911,11 @@ static void store_output_value_in_geometry(GeometrySet &geometry_set,
if (attribute_name.is_empty()) {
return;
}
const GField &field = *(const GField *)value.get();
const blender::fn::ValueOrFieldCPPType *cpp_type =
dynamic_cast<const blender::fn::ValueOrFieldCPPType *>(value.type());
BLI_assert(cpp_type != nullptr);
const GField field = cpp_type->as_field(value.get());
const bNodeSocket *interface_socket = (bNodeSocket *)BLI_findlink(&nmd->node_group->outputs,
socket.index());
const AttributeDomain domain = (AttributeDomain)interface_socket->attribute_domain;

View File

@@ -35,13 +35,17 @@
#include "BLI_task.hh"
#include "BLI_vector_set.hh"
#include <chrono>
namespace blender::modifiers::geometry_nodes {
using fn::CPPType;
using fn::Field;
using fn::FieldCPPType;
using fn::GField;
using fn::GValueMap;
using fn::GVArray;
using fn::ValueOrField;
using fn::ValueOrFieldCPPType;
using nodes::GeoNodeExecParams;
using namespace fn::multi_function_types;
@@ -348,18 +352,19 @@ static bool get_implicit_socket_input(const SocketRef &socket, void *r_value)
GEO_NODE_CURVE_HANDLE_LEFT ?
"handle_left" :
"handle_right";
new (r_value) Field<float3>(bke::AttributeFieldInput::Create<float3>(side));
new (r_value) ValueOrField<float3>(bke::AttributeFieldInput::Create<float3>(side));
return true;
}
new (r_value) Field<float3>(bke::AttributeFieldInput::Create<float3>("position"));
new (r_value) ValueOrField<float3>(bke::AttributeFieldInput::Create<float3>("position"));
return true;
}
if (socket.typeinfo()->type == SOCK_INT) {
if (ELEM(bnode.type, FN_NODE_RANDOM_VALUE, GEO_NODE_INSTANCE_ON_POINTS)) {
new (r_value) Field<int>(std::make_shared<bke::IDAttributeFieldInput>());
new (r_value)
ValueOrField<int>(Field<int>(std::make_shared<bke::IDAttributeFieldInput>()));
return true;
}
new (r_value) Field<int>(std::make_shared<fn::IndexFieldInput>());
new (r_value) ValueOrField<int>(Field<int>(std::make_shared<fn::IndexFieldInput>()));
return true;
}
}
@@ -926,7 +931,13 @@ class GeometryNodesEvaluator {
params.error_message_add(geo_log::NodeWarningType::Legacy,
TIP_("Legacy node will be removed before Blender 4.0"));
}
using Clock = std::chrono::steady_clock;
Clock::time_point begin = Clock::now();
bnode.typeinfo->geometry_node_execute(params);
Clock::time_point end = Clock::now();
const std::chrono::microseconds duration =
std::chrono::duration_cast<std::chrono::microseconds>(end - begin);
params_.geo_logger->local().log_execution_time(node, duration);
}
void execute_multi_function_node(const DNode node,
@@ -943,8 +954,9 @@ class GeometryNodesEvaluator {
LinearAllocator<> &allocator = local_allocators_.local();
/* Prepare the inputs for the multi function. */
Vector<GField> input_fields;
bool any_input_is_field = false;
Vector<const void *, 16> input_values;
Vector<const ValueOrFieldCPPType *, 16> input_types;
for (const int i : node->inputs().index_range()) {
const InputSocketRef &socket_ref = node->input(i);
if (!socket_ref.is_available()) {
@@ -955,7 +967,37 @@ class GeometryNodesEvaluator {
BLI_assert(input_state.was_ready_for_execution);
SingleInputValue &single_value = *input_state.value.single;
BLI_assert(single_value.value != nullptr);
input_fields.append(std::move(*(GField *)single_value.value));
const ValueOrFieldCPPType &field_cpp_type = static_cast<const ValueOrFieldCPPType &>(
*input_state.type);
input_values.append(single_value.value);
input_types.append(&field_cpp_type);
if (field_cpp_type.is_field(single_value.value)) {
any_input_is_field = true;
}
}
if (any_input_is_field) {
this->execute_multi_function_node__field(
node, fn_item, node_state, allocator, input_values, input_types);
}
else {
this->execute_multi_function_node__value(
node, *fn_item.fn, node_state, allocator, input_values, input_types);
}
}
void execute_multi_function_node__field(const DNode node,
const nodes::NodeMultiFunctions::Item &fn_item,
NodeState &node_state,
LinearAllocator<> &allocator,
Span<const void *> input_values,
Span<const ValueOrFieldCPPType *> input_types)
{
Vector<GField> input_fields;
for (const int i : input_values.index_range()) {
const void *input_value_or_field = input_values[i];
const ValueOrFieldCPPType &field_cpp_type = *input_types[i];
input_fields.append(field_cpp_type.as_field(input_value_or_field));
}
std::shared_ptr<fn::FieldOperation> operation;
@@ -966,7 +1008,6 @@ class GeometryNodesEvaluator {
operation = std::make_shared<fn::FieldOperation>(*fn_item.fn, std::move(input_fields));
}
/* Forward outputs. */
int output_index = 0;
for (const int i : node->outputs().index_range()) {
const OutputSocketRef &socket_ref = node->output(i);
@@ -975,16 +1016,68 @@ class GeometryNodesEvaluator {
}
OutputState &output_state = node_state.outputs[i];
const DOutputSocket socket{node.context(), &socket_ref};
const CPPType *cpp_type = get_socket_cpp_type(socket_ref);
const ValueOrFieldCPPType *cpp_type = static_cast<const ValueOrFieldCPPType *>(
get_socket_cpp_type(socket_ref));
GField new_field{operation, output_index};
new_field = fn::make_field_constant_if_possible(std::move(new_field));
GField &field_to_forward = *allocator.construct<GField>(std::move(new_field)).release();
this->forward_output(socket, {cpp_type, &field_to_forward});
void *buffer = allocator.allocate(cpp_type->size(), cpp_type->alignment());
cpp_type->construct_from_field(buffer, std::move(new_field));
this->forward_output(socket, {cpp_type, buffer});
output_state.has_been_computed = true;
output_index++;
}
}
void execute_multi_function_node__value(const DNode node,
const MultiFunction &fn,
NodeState &node_state,
LinearAllocator<> &allocator,
Span<const void *> input_values,
Span<const ValueOrFieldCPPType *> input_types)
{
MFParamsBuilder params{fn, 1};
for (const int i : input_values.index_range()) {
const void *input_value_or_field = input_values[i];
const ValueOrFieldCPPType &field_cpp_type = *input_types[i];
const CPPType &base_type = field_cpp_type.base_type();
const void *input_value = field_cpp_type.get_value_ptr(input_value_or_field);
params.add_readonly_single_input(GVArray::ForSingleRef(base_type, 1, input_value));
}
Vector<GMutablePointer, 16> output_buffers;
for (const int i : node->outputs().index_range()) {
const DOutputSocket socket = node.output(i);
if (!socket->is_available()) {
output_buffers.append({});
continue;
}
const ValueOrFieldCPPType *value_or_field_type = static_cast<const ValueOrFieldCPPType *>(
get_socket_cpp_type(socket));
const CPPType &base_type = value_or_field_type->base_type();
void *value_or_field_buffer = allocator.allocate(value_or_field_type->size(),
value_or_field_type->alignment());
value_or_field_type->default_construct(value_or_field_buffer);
void *value_buffer = value_or_field_type->get_value_ptr(value_or_field_buffer);
base_type.destruct(value_buffer);
params.add_uninitialized_single_output(GMutableSpan{base_type, value_buffer, 1});
output_buffers.append({value_or_field_type, value_or_field_buffer});
}
MFContextBuilder context;
fn.call(IndexRange(1), params, context);
for (const int i : output_buffers.index_range()) {
GMutablePointer buffer = output_buffers[i];
if (buffer.get() == nullptr) {
continue;
}
const DOutputSocket socket = node.output(i);
this->forward_output(socket, buffer);
OutputState &output_state = node_state.outputs[i];
output_state.has_been_computed = true;
}
}
void execute_unknown_node(const DNode node, NodeState &node_state)
{
LinearAllocator<> &allocator = local_allocators_.local();
@@ -1466,18 +1559,28 @@ class GeometryNodesEvaluator {
from_type.copy_construct(from_value, to_value);
return;
}
const FieldCPPType *from_field_type = dynamic_cast<const FieldCPPType *>(&from_type);
const FieldCPPType *to_field_type = dynamic_cast<const FieldCPPType *>(&to_type);
const ValueOrFieldCPPType *from_field_type = dynamic_cast<const ValueOrFieldCPPType *>(
&from_type);
const ValueOrFieldCPPType *to_field_type = dynamic_cast<const ValueOrFieldCPPType *>(&to_type);
if (from_field_type != nullptr && to_field_type != nullptr) {
const CPPType &from_base_type = from_field_type->base_type();
const CPPType &to_base_type = to_field_type->base_type();
if (conversions_.is_convertible(from_base_type, to_base_type)) {
const MultiFunction &fn = *conversions_.get_conversion_multi_function(
MFDataType::ForSingle(from_base_type), MFDataType::ForSingle(to_base_type));
const GField &from_field = *(const GField *)from_value;
auto operation = std::make_shared<fn::FieldOperation>(fn, Vector<GField>{from_field});
new (to_value) GField(std::move(operation), 0);
if (from_field_type->is_field(from_value)) {
const GField &from_field = *from_field_type->get_field_ptr(from_value);
const MultiFunction &fn = *conversions_.get_conversion_multi_function(
MFDataType::ForSingle(from_base_type), MFDataType::ForSingle(to_base_type));
auto operation = std::make_shared<fn::FieldOperation>(fn, Vector<GField>{from_field});
to_field_type->construct_from_field(to_value, GField(std::move(operation), 0));
}
else {
to_field_type->default_construct(to_value);
const void *from_value_ptr = from_field_type->get_value_ptr(from_value);
void *to_value_ptr = to_field_type->get_value_ptr(to_value);
conversions_.get_conversion_functions(from_base_type, to_base_type)
->convert_single_to_initialized(from_value_ptr, to_value_ptr);
}
return;
}
}
@@ -1493,14 +1596,6 @@ class GeometryNodesEvaluator {
void construct_default_value(const CPPType &type, void *r_value)
{
if (const FieldCPPType *field_cpp_type = dynamic_cast<const FieldCPPType *>(&type)) {
const CPPType &base_type = field_cpp_type->base_type();
auto constant_fn = std::make_unique<fn::CustomMF_GenericConstant>(
base_type, base_type.default_value(), false);
auto operation = std::make_shared<fn::FieldOperation>(std::move(constant_fn));
new (r_value) GField(std::move(operation), 0);
return;
}
type.copy_construct(type.default_value(), r_value);
}

View File

@@ -59,6 +59,7 @@ using fn::GVArray;
using fn::GVArray_GSpan;
using fn::GVMutableArray;
using fn::GVMutableArray_GSpan;
using fn::ValueOrField;
using geometry_nodes_eval_log::NodeWarningType;
/**
@@ -129,7 +130,7 @@ class GeoNodeExecParams {
}
template<typename T>
static inline constexpr bool is_stored_as_field_v = std::is_same_v<T, float> ||
static inline constexpr bool is_field_base_type_v = std::is_same_v<T, float> ||
std::is_same_v<T, int> ||
std::is_same_v<T, bool> ||
std::is_same_v<T, ColorGeometry4f> ||
@@ -157,9 +158,15 @@ class GeoNodeExecParams {
*/
template<typename T> T extract_input(StringRef identifier)
{
if constexpr (is_stored_as_field_v<T>) {
Field<T> field = this->extract_input<Field<T>>(identifier);
return fn::evaluate_constant_field(field);
if constexpr (is_field_base_type_v<T>) {
ValueOrField<T> value_or_field = this->extract_input<ValueOrField<T>>(identifier);
return value_or_field.as_value();
}
else if constexpr (fn::is_field_v<T>) {
using BaseType = typename T::base_type;
ValueOrField<BaseType> value_or_field = this->extract_input<ValueOrField<BaseType>>(
identifier);
return value_or_field.as_field();
}
else {
#ifdef DEBUG
@@ -186,9 +193,9 @@ class GeoNodeExecParams {
Vector<GMutablePointer> gvalues = provider_->extract_multi_input(identifier);
Vector<T> values;
for (GMutablePointer gvalue : gvalues) {
if constexpr (is_stored_as_field_v<T>) {
const Field<T> field = gvalue.relocate_out<Field<T>>();
values.append(fn::evaluate_constant_field(field));
if constexpr (is_field_base_type_v<T>) {
const ValueOrField<T> value_or_field = gvalue.relocate_out<ValueOrField<T>>();
values.append(value_or_field.as_value());
}
else {
values.append(gvalue.relocate_out<T>());
@@ -200,11 +207,16 @@ class GeoNodeExecParams {
/**
* Get the input value for the input socket with the given identifier.
*/
template<typename T> const T get_input(StringRef identifier) const
template<typename T> T get_input(StringRef identifier) const
{
if constexpr (is_stored_as_field_v<T>) {
const Field<T> &field = this->get_input<Field<T>>(identifier);
return fn::evaluate_constant_field(field);
if constexpr (is_field_base_type_v<T>) {
ValueOrField<T> value_or_field = this->get_input<ValueOrField<T>>(identifier);
return value_or_field.as_value();
}
else if constexpr (fn::is_field_v<T>) {
using BaseType = typename T::base_type;
ValueOrField<BaseType> value_or_field = this->get_input<ValueOrField<BaseType>>(identifier);
return value_or_field.as_field();
}
else {
#ifdef DEBUG
@@ -226,9 +238,12 @@ class GeoNodeExecParams {
template<typename T> void set_output(StringRef identifier, T &&value)
{
using StoredT = std::decay_t<T>;
if constexpr (is_stored_as_field_v<StoredT>) {
this->set_output<Field<StoredT>>(identifier,
fn::make_constant_field<StoredT>(std::forward<T>(value)));
if constexpr (is_field_base_type_v<StoredT>) {
this->set_output(identifier, ValueOrField<StoredT>(std::forward<T>(value)));
}
else if constexpr (fn::is_field_v<StoredT>) {
using BaseType = typename StoredT::base_type;
this->set_output(identifier, ValueOrField<BaseType>(std::forward<T>(value)));
}
else {
const CPPType &type = CPPType::get<StoredT>();

View File

@@ -41,6 +41,8 @@
#include "NOD_derived_node_tree.hh"
#include <chrono>
struct SpaceNode;
struct SpaceSpreadsheet;
@@ -169,6 +171,11 @@ struct NodeWithWarning {
NodeWarning warning;
};
struct NodeWithExecutionTime {
DNode node;
std::chrono::microseconds exec_time;
};
/** The same value can be referenced by multiple sockets when they are linked. */
struct ValueOfSockets {
Span<DSocket> sockets;
@@ -189,6 +196,7 @@ class LocalGeoLogger {
std::unique_ptr<LinearAllocator<>> allocator_;
Vector<ValueOfSockets> values_;
Vector<NodeWithWarning> node_warnings_;
Vector<NodeWithExecutionTime> node_exec_times_;
friend ModifierLog;
@@ -201,6 +209,7 @@ class LocalGeoLogger {
void log_value_for_sockets(Span<DSocket> sockets, GPointer value);
void log_multi_value_socket(DSocket socket, Span<GPointer> values);
void log_node_warning(DNode node, NodeWarningType type, std::string message);
void log_execution_time(DNode node, std::chrono::microseconds exec_time);
};
/** The root logger class. */
@@ -274,12 +283,14 @@ class NodeLog {
Vector<SocketLog> input_logs_;
Vector<SocketLog> output_logs_;
Vector<NodeWarning, 0> warnings_;
std::chrono::microseconds exec_time_;
friend ModifierLog;
public:
const SocketLog *lookup_socket_log(eNodeSocketInOut in_out, int index) const;
const SocketLog *lookup_socket_log(const bNode &node, const bNodeSocket &socket) const;
void execution_time(std::chrono::microseconds exec_time);
Span<SocketLog> input_logs() const
{
@@ -296,6 +307,11 @@ class NodeLog {
return warnings_;
}
std::chrono::microseconds execution_time() const
{
return exec_time_;
}
Vector<const GeometryAttributeInfo *> lookup_available_attributes() const;
};

View File

@@ -22,9 +22,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_align_rotation_to_vector_cc {
static void geo_node_align_rotation_to_vector_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Factor"));
@@ -40,9 +40,7 @@ static void geo_node_align_rotation_to_vector_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_align_rotation_to_vector_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "axis", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
uiLayoutSetPropSep(layout, true);
@@ -53,7 +51,7 @@ static void geo_node_align_rotation_to_vector_layout(uiLayout *layout,
uiItemR(col, ptr, "input_type_vector", 0, IFACE_("Vector"), ICON_NONE);
}
static void geo_node_align_rotation_to_vector_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeGeometryAlignRotationToVector *node_storage = (NodeGeometryAlignRotationToVector *)
MEM_callocN(sizeof(NodeGeometryAlignRotationToVector), __func__);
@@ -65,7 +63,7 @@ static void geo_node_align_rotation_to_vector_init(bNodeTree *UNUSED(ntree), bNo
node->storage = node_storage;
}
static void geo_node_align_rotation_to_vector_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeGeometryAlignRotationToVector *node_storage = (NodeGeometryAlignRotationToVector *)
node->storage;
@@ -199,7 +197,7 @@ static void align_rotations_on_component(GeometryComponent &component,
rotations.save();
}
static void geo_node_align_rotation_to_vector_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -219,10 +217,12 @@ static void geo_node_align_rotation_to_vector_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_align_rotation_to_vector_cc
void register_node_type_geo_align_rotation_to_vector()
{
namespace file_ns = blender::nodes::node_geo_legacy_align_rotation_to_vector_cc;
static bNodeType ntype;
geo_node_type_base(&ntype,
@@ -230,14 +230,14 @@ void register_node_type_geo_align_rotation_to_vector()
"Align Rotation to Vector",
NODE_CLASS_GEOMETRY,
0);
node_type_init(&ntype, blender::nodes::geo_node_align_rotation_to_vector_init);
node_type_update(&ntype, blender::nodes::geo_node_align_rotation_to_vector_update);
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
node_type_storage(&ntype,
"NodeGeometryAlignRotationToVector",
node_free_standard_storage,
node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_align_rotation_to_vector_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_align_rotation_to_vector_exec;
ntype.draw_buttons = blender::nodes::geo_node_align_rotation_to_vector_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -20,9 +20,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_clamp_cc {
static void geo_node_attribute_clamp_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Attribute"));
@@ -38,13 +38,13 @@ static void geo_node_attribute_clamp_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_clamp_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
}
static void geo_node_attribute_clamp_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeClamp *data = (NodeAttributeClamp *)MEM_callocN(sizeof(NodeAttributeClamp),
__func__);
@@ -53,7 +53,7 @@ static void geo_node_attribute_clamp_init(bNodeTree *UNUSED(tree), bNode *node)
node->storage = data;
}
static void geo_node_attribute_clamp_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock_min_vector = (bNodeSocket *)BLI_findlink(&node->inputs, 3);
bNodeSocket *sock_max_vector = sock_min_vector->next;
@@ -243,7 +243,7 @@ static void clamp_attribute(GeometryComponent &component, const GeoNodeExecParam
attribute_result.save();
}
static void geo_node_attribute_clamp_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -262,19 +262,21 @@ static void geo_node_attribute_clamp_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_clamp_cc
void register_node_type_geo_attribute_clamp()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_clamp_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_CLAMP, "Attribute Clamp", NODE_CLASS_ATTRIBUTE, 0);
node_type_init(&ntype, blender::nodes::geo_node_attribute_clamp_init);
node_type_update(&ntype, blender::nodes::geo_node_attribute_clamp_update);
ntype.declare = blender::nodes::geo_node_attribute_clamp_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_clamp_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_clamp_layout;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
node_type_storage(
&ntype, "NodeAttributeClamp", node_free_standard_storage, node_copy_standard_storage);
nodeRegisterType(&ntype);

View File

@@ -23,9 +23,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attributes_color_ramp_cc {
static void geo_node_attribute_color_ramp_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Attribute"));
@@ -33,14 +33,12 @@ static void geo_node_attribute_color_ramp_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_color_ramp_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiTemplateColorRamp(layout, ptr, "color_ramp", false);
}
static void geo_node_attribute_color_ramp_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeAttributeColorRamp *node_storage = (NodeAttributeColorRamp *)MEM_callocN(
sizeof(NodeAttributeColorRamp), __func__);
@@ -100,7 +98,7 @@ static void execute_on_component(const GeoNodeExecParams &params, GeometryCompon
attribute_result.save();
}
static void geo_node_attribute_color_ramp_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -119,10 +117,12 @@ static void geo_node_attribute_color_ramp_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attributes_color_ramp_cc
void register_node_type_geo_attribute_color_ramp()
{
namespace file_ns = blender::nodes::node_geo_legacy_attributes_color_ramp_cc;
static bNodeType ntype;
geo_node_type_base(&ntype,
@@ -132,10 +132,10 @@ void register_node_type_geo_attribute_color_ramp()
0);
node_type_storage(
&ntype, "NodeAttributeColorRamp", node_free_standard_storage, node_copy_standard_storage);
node_type_init(&ntype, blender::nodes::geo_node_attribute_color_ramp_init);
node_type_init(&ntype, file_ns::node_init);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
ntype.declare = blender::nodes::geo_node_attribute_color_ramp_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_color_ramp_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_color_ramp_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -19,9 +19,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_combine_xyz_cc {
static void geo_node_attribute_combine_xyz_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("X"));
@@ -34,9 +34,7 @@ static void geo_node_attribute_combine_xyz_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_combine_xyz_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -46,7 +44,7 @@ static void geo_node_attribute_combine_xyz_layout(uiLayout *layout,
uiItemR(col, ptr, "input_type_z", 0, IFACE_("Z"), ICON_NONE);
}
static void geo_node_attribute_combine_xyz_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeCombineXYZ *data = (NodeAttributeCombineXYZ *)MEM_callocN(
sizeof(NodeAttributeCombineXYZ), __func__);
@@ -57,7 +55,7 @@ static void geo_node_attribute_combine_xyz_init(bNodeTree *UNUSED(tree), bNode *
node->storage = data;
}
static void geo_node_attribute_combine_xyz_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeAttributeCombineXYZ *node_storage = (NodeAttributeCombineXYZ *)node->storage;
update_attribute_input_socket_availabilities(
@@ -111,7 +109,7 @@ static void combine_attributes(GeometryComponent &component, const GeoNodeExecPa
attribute_result.save();
}
static void geo_node_attribute_combine_xyz_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -130,10 +128,12 @@ static void geo_node_attribute_combine_xyz_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_combine_xyz_cc
void register_node_type_geo_attribute_combine_xyz()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_combine_xyz_cc;
static bNodeType ntype;
geo_node_type_base(&ntype,
@@ -141,13 +141,13 @@ void register_node_type_geo_attribute_combine_xyz()
"Attribute Combine XYZ",
NODE_CLASS_ATTRIBUTE,
0);
node_type_init(&ntype, blender::nodes::geo_node_attribute_combine_xyz_init);
node_type_update(&ntype, blender::nodes::geo_node_attribute_combine_xyz_update);
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
node_type_storage(
&ntype, "NodeAttributeCombineXYZ", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_attribute_combine_xyz_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_combine_xyz_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_combine_xyz_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -21,9 +21,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_compare_cc {
static void geo_node_attribute_compare_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("A"));
@@ -39,9 +39,7 @@ static void geo_node_attribute_compare_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_compare_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
uiLayoutSetPropSep(layout, true);
@@ -50,7 +48,7 @@ static void geo_node_attribute_compare_layout(uiLayout *layout,
uiItemR(layout, ptr, "input_type_b", 0, IFACE_("B"), ICON_NONE);
}
static void geo_node_attribute_compare_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeCompare *data = (NodeAttributeCompare *)MEM_callocN(sizeof(NodeAttributeCompare),
__func__);
@@ -65,7 +63,7 @@ static bool operation_tests_equality(const NodeAttributeCompare &node_storage)
return ELEM(node_storage.operation, NODE_FLOAT_COMPARE_EQUAL, NODE_FLOAT_COMPARE_NOT_EQUAL);
}
static void geo_node_attribute_compare_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeAttributeCompare *node_storage = (NodeAttributeCompare *)node->storage;
update_attribute_input_socket_availabilities(
@@ -322,7 +320,7 @@ static void attribute_compare_calc(GeometryComponent &component, const GeoNodeEx
attribute_result.save();
}
static void geo_node_attribute_compare_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -341,20 +339,22 @@ static void geo_node_attribute_compare_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_compare_cc
void register_node_type_geo_attribute_compare()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_compare_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_COMPARE, "Attribute Compare", NODE_CLASS_ATTRIBUTE, 0);
ntype.declare = blender::nodes::geo_node_attribute_compare_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_compare_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_compare_layout;
node_type_update(&ntype, blender::nodes::geo_node_attribute_compare_update);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
node_type_update(&ntype, file_ns::node_update);
node_type_storage(
&ntype, "NodeAttributeCompare", node_free_standard_storage, node_copy_standard_storage);
node_type_init(&ntype, blender::nodes::geo_node_attribute_compare_init);
node_type_init(&ntype, file_ns::node_init);
nodeRegisterType(&ntype);
}

View File

@@ -19,9 +19,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_convert_cc {
static void geo_node_attribute_convert_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Attribute"));
@@ -29,9 +29,7 @@ static void geo_node_attribute_convert_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_convert_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -39,7 +37,7 @@ static void geo_node_attribute_convert_layout(uiLayout *layout,
uiItemR(layout, ptr, "data_type", 0, IFACE_("Type"), ICON_NONE);
}
static void geo_node_attribute_convert_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeConvert *data = (NodeAttributeConvert *)MEM_callocN(sizeof(NodeAttributeConvert),
__func__);
@@ -130,7 +128,7 @@ static void attribute_convert_calc(GeometryComponent &component,
result_attribute.save();
}
static void geo_node_attribute_convert_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -175,18 +173,20 @@ static void geo_node_attribute_convert_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_convert_cc
void register_node_type_geo_attribute_convert()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_convert_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_CONVERT, "Attribute Convert", NODE_CLASS_ATTRIBUTE, 0);
ntype.declare = blender::nodes::geo_node_attribute_convert_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_convert_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_convert_layout;
node_type_init(&ntype, blender::nodes::geo_node_attribute_convert_init);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
node_type_init(&ntype, file_ns::node_init);
node_type_storage(
&ntype, "NodeAttributeConvert", node_free_standard_storage, node_copy_standard_storage);

View File

@@ -24,9 +24,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_curve_map_cc {
static void geo_node_attribute_curve_map_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Attribute"));
@@ -34,9 +34,7 @@ static void geo_node_attribute_curve_map_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_curve_map_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
bNode *node = (bNode *)ptr->data;
@@ -54,7 +52,7 @@ static void geo_node_attribute_curve_map_layout(uiLayout *layout,
}
}
static void geo_node_attribute_curve_map_free_storage(bNode *node)
static void node_free_storage(bNode *node)
{
if (node->storage) {
NodeAttributeCurveMap *data = (NodeAttributeCurveMap *)node->storage;
@@ -64,9 +62,9 @@ static void geo_node_attribute_curve_map_free_storage(bNode *node)
}
}
static void geo_node_attribute_curve_map_copy_storage(bNodeTree *UNUSED(dest_ntree),
bNode *dest_node,
const bNode *src_node)
static void node_copy_storage(bNodeTree *UNUSED(dest_ntree),
bNode *dest_node,
const bNode *src_node)
{
dest_node->storage = MEM_dupallocN(src_node->storage);
NodeAttributeCurveMap *src_data = (NodeAttributeCurveMap *)src_node->storage;
@@ -75,7 +73,7 @@ static void geo_node_attribute_curve_map_copy_storage(bNodeTree *UNUSED(dest_ntr
dest_data->curve_rgb = BKE_curvemapping_copy(src_data->curve_rgb);
}
static void geo_node_attribute_curve_map_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeAttributeCurveMap *data = (NodeAttributeCurveMap *)MEM_callocN(sizeof(NodeAttributeCurveMap),
__func__);
@@ -87,7 +85,7 @@ static void geo_node_attribute_curve_map_init(bNodeTree *UNUSED(ntree), bNode *n
node->storage = data;
}
static void geo_node_attribute_curve_map_update(bNodeTree *UNUSED(ntree), bNode *node)
static void node_update(bNodeTree *UNUSED(ntree), bNode *node)
{
/* Set the active curve when data type is changed. */
NodeAttributeCurveMap *data = (NodeAttributeCurveMap *)node->storage;
@@ -179,7 +177,7 @@ static void execute_on_component(const GeoNodeExecParams &params, GeometryCompon
attribute_result.save();
}
static void geo_node_attribute_curve_map_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
const bNode &bnode = params.node();
NodeAttributeCurveMap *data = (NodeAttributeCurveMap *)bnode.storage;
@@ -203,23 +201,23 @@ static void geo_node_attribute_curve_map_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_curve_map_cc
void register_node_type_geo_attribute_curve_map()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_curve_map_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_CURVE_MAP, "Attribute Curve Map", NODE_CLASS_ATTRIBUTE, 0);
node_type_update(&ntype, blender::nodes::geo_node_attribute_curve_map_update);
node_type_init(&ntype, blender::nodes::geo_node_attribute_curve_map_init);
node_type_update(&ntype, file_ns::node_update);
node_type_init(&ntype, file_ns::node_init);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_storage(&ntype,
"NodeAttributeCurveMap",
blender::nodes::geo_node_attribute_curve_map_free_storage,
blender::nodes::geo_node_attribute_curve_map_copy_storage);
ntype.declare = blender::nodes::geo_node_attribute_curve_map_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_curve_map_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_curve_map_layout;
node_type_storage(
&ntype, "NodeAttributeCurveMap", file_ns::node_free_storage, file_ns::node_copy_storage);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -19,9 +19,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_fill_cc {
static void geo_node_attribute_fill_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Attribute")).is_attribute_name();
@@ -33,7 +33,7 @@ static void geo_node_attribute_fill_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_fill_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -41,13 +41,13 @@ static void geo_node_attribute_fill_layout(uiLayout *layout, bContext *UNUSED(C)
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
}
static void geo_node_attribute_fill_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
node->custom1 = CD_PROP_FLOAT;
node->custom2 = ATTR_DOMAIN_AUTO;
}
static void geo_node_attribute_fill_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
bNodeSocket *socket_value_vector = (bNodeSocket *)BLI_findlink(&node->inputs, 2);
bNodeSocket *socket_value_float = socket_value_vector->next;
@@ -127,7 +127,7 @@ static void fill_attribute(GeometryComponent &component, const GeoNodeExecParams
attribute.save();
}
static void geo_node_attribute_fill_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -146,18 +146,20 @@ static void geo_node_attribute_fill_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_fill_cc
void register_node_type_geo_attribute_fill()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_fill_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_FILL, "Attribute Fill", NODE_CLASS_ATTRIBUTE, 0);
node_type_init(&ntype, blender::nodes::geo_node_attribute_fill_init);
node_type_update(&ntype, blender::nodes::geo_node_attribute_fill_update);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_fill_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_fill_layout;
ntype.declare = blender::nodes::geo_node_attribute_fill_declare;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
ntype.declare = file_ns::node_declare;
nodeRegisterType(&ntype);
}

View File

@@ -22,9 +22,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_map_range_cc {
static void geo_node_attribute_map_range_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Attribute"));
@@ -49,7 +49,7 @@ static void fn_attribute_map_range_layout(uiLayout *layout, bContext *UNUSED(C),
uiItemR(layout, ptr, "interpolation_type", 0, "", ICON_NONE);
}
static void geo_node_attribute_map_range_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeAttributeMapRange *data = (NodeAttributeMapRange *)MEM_callocN(sizeof(NodeAttributeMapRange),
__func__);
@@ -58,7 +58,7 @@ static void geo_node_attribute_map_range_init(bNodeTree *UNUSED(ntree), bNode *n
node->storage = data;
}
static void geo_node_attribute_map_range_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeAttributeMapRange &node_storage = *(NodeAttributeMapRange *)node->storage;
@@ -399,7 +399,7 @@ static void map_range_attribute(GeometryComponent &component, const GeoNodeExecP
attribute_result.save();
}
static void geo_node_attribute_map_range_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -416,20 +416,22 @@ static void geo_node_attribute_map_range_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_map_range_cc
void register_node_type_geo_attribute_map_range()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_map_range_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_MAP_RANGE, "Attribute Map Range", NODE_CLASS_ATTRIBUTE, 0);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_map_range_exec;
node_type_init(&ntype, blender::nodes::geo_node_attribute_map_range_init);
node_type_update(&ntype, blender::nodes::geo_node_attribute_map_range_update);
ntype.geometry_node_execute = file_ns::node_geo_exec;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
node_type_storage(
&ntype, "NodeAttributeMapRange", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_attribute_map_range_declare;
ntype.draw_buttons = blender::nodes::fn_attribute_map_range_layout;
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::fn_attribute_map_range_layout;
nodeRegisterType(&ntype);
}

View File

@@ -25,9 +25,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_math_cc {
static void geo_node_attribute_math_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("A"));
@@ -100,7 +100,7 @@ static bool operation_use_input_b(const NodeMathOperation operation)
return false;
}
static void geo_node_attribute_math_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
bNode *node = (bNode *)ptr->data;
NodeAttributeMath *node_storage = (NodeAttributeMath *)node->storage;
@@ -119,7 +119,7 @@ static void geo_node_attribute_math_layout(uiLayout *layout, bContext *UNUSED(C)
}
}
static void geo_node_attribute_math_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeMath *data = (NodeAttributeMath *)MEM_callocN(sizeof(NodeAttributeMath), __func__);
@@ -141,7 +141,7 @@ static void geo_node_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *lab
BLI_strncpy(label, IFACE_(name), maxlen);
}
static void geo_node_attribute_math_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeAttributeMath &node_storage = *(NodeAttributeMath *)node->storage;
NodeMathOperation operation = static_cast<NodeMathOperation>(node_storage.operation);
@@ -278,7 +278,7 @@ static void attribute_math_calc(GeometryComponent &component, const GeoNodeExecP
attribute_result.save();
}
static void geo_node_attribute_math_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -297,20 +297,22 @@ static void geo_node_attribute_math_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_math_cc
void register_node_type_geo_attribute_math()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_math_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_MATH, "Attribute Math", NODE_CLASS_ATTRIBUTE, 0);
ntype.declare = blender::nodes::geo_node_attribute_math_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_math_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_math_layout;
node_type_label(&ntype, blender::nodes::geo_node_math_label);
node_type_update(&ntype, blender::nodes::geo_node_attribute_math_update);
node_type_init(&ntype, blender::nodes::geo_node_attribute_math_init);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
node_type_label(&ntype, file_ns::geo_node_math_label);
node_type_update(&ntype, file_ns::node_update);
node_type_init(&ntype, file_ns::node_init);
node_type_storage(
&ntype, "NodeAttributeMath", node_free_standard_storage, node_copy_standard_storage);
nodeRegisterType(&ntype);

View File

@@ -25,9 +25,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_mix_cc {
static void geo_node_mix_attribute_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Factor"));
@@ -48,7 +48,7 @@ static void geo_node_mix_attribute_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_mix_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -59,7 +59,7 @@ static void geo_node_attribute_mix_layout(uiLayout *layout, bContext *UNUSED(C),
uiItemR(col, ptr, "input_type_b", 0, IFACE_("B"), ICON_NONE);
}
static void geo_node_attribute_mix_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeAttributeMix *data = (NodeAttributeMix *)MEM_callocN(sizeof(NodeAttributeMix),
"attribute mix node");
@@ -70,7 +70,7 @@ static void geo_node_attribute_mix_init(bNodeTree *UNUSED(ntree), bNode *node)
node->storage = data;
}
static void geo_node_attribute_mix_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeAttributeMix *node_storage = (NodeAttributeMix *)node->storage;
update_attribute_input_socket_availabilities(
@@ -222,7 +222,7 @@ static void attribute_mix_calc(GeometryComponent &component, const GeoNodeExecPa
attribute_result.save();
}
static void geo_node_attribute_mix_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -241,19 +241,21 @@ static void geo_node_attribute_mix_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_mix_cc
void register_node_type_geo_attribute_mix()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_mix_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_MIX, "Attribute Mix", NODE_CLASS_ATTRIBUTE, 0);
node_type_init(&ntype, blender::nodes::geo_node_attribute_mix_init);
node_type_update(&ntype, blender::nodes::geo_node_attribute_mix_update);
ntype.declare = blender::nodes::geo_node_mix_attribute_declare;
ntype.draw_buttons = blender::nodes::geo_node_attribute_mix_layout;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
node_type_storage(
&ntype, "NodeAttributeMix", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_mix_exec;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -26,9 +26,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_proximity_cc {
static void geo_node_attribute_proximity_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Geometry>(N_("Target"));
@@ -37,14 +37,12 @@ static void geo_node_attribute_proximity_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_proximity_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "target_geometry_element", 0, "", ICON_NONE);
}
static void geo_attribute_proximity_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeGeometryAttributeProximity *node_storage = (NodeGeometryAttributeProximity *)MEM_callocN(
sizeof(NodeGeometryAttributeProximity), __func__);
@@ -203,7 +201,7 @@ static void attribute_calc_proximity(GeometryComponent &component,
}
}
static void geo_node_attribute_proximity_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
GeometrySet geometry_set_target = params.extract_input<GeometrySet>("Target");
@@ -230,22 +228,24 @@ static void geo_node_attribute_proximity_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_proximity_cc
void register_node_type_geo_legacy_attribute_proximity()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_proximity_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_PROXIMITY, "Attribute Proximity", NODE_CLASS_ATTRIBUTE, 0);
node_type_init(&ntype, blender::nodes::geo_attribute_proximity_init);
node_type_init(&ntype, file_ns::node_init);
node_type_storage(&ntype,
"NodeGeometryAttributeProximity",
node_free_standard_storage,
node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_attribute_proximity_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_proximity_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_proximity_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -25,7 +25,41 @@
namespace blender::nodes {
static void geo_node_legacy_attribute_randomize_declare(NodeDeclarationBuilder &b)
Array<uint32_t> get_geometry_element_ids_as_uints(const GeometryComponent &component,
const AttributeDomain domain)
{
const int domain_size = component.attribute_domain_size(domain);
/* Hash the reserved name attribute "id" as a (hopefully) stable seed for each point. */
GVArray hash_attribute = component.attribute_try_get_for_read("id", domain);
Array<uint32_t> hashes(domain_size);
if (hash_attribute) {
BLI_assert(hashes.size() == hash_attribute.size());
const CPPType &cpp_type = hash_attribute.type();
BLI_assert(cpp_type.is_hashable());
GVArray_GSpan items{hash_attribute};
threading::parallel_for(hashes.index_range(), 512, [&](IndexRange range) {
for (const int i : range) {
hashes[i] = cpp_type.hash(items[i]);
}
});
}
else {
/* If there is no "id" attribute for per-point variation, just create it here. */
RandomNumberGenerator rng(0);
for (const int i : hashes.index_range()) {
hashes[i] = rng.get_uint32();
}
}
return hashes;
}
} // namespace blender::nodes
namespace blender::nodes::node_geo_legacy_attribute_randomize_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Attribute"));
@@ -39,15 +73,13 @@ static void geo_node_legacy_attribute_randomize_declare(NodeDeclarationBuilder &
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_legacy_attribute_random_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
}
static void geo_node_legacy_attribute_randomize_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeRandomize *data = (NodeAttributeRandomize *)MEM_callocN(
sizeof(NodeAttributeRandomize), __func__);
@@ -57,7 +89,7 @@ static void geo_node_legacy_attribute_randomize_init(bNodeTree *UNUSED(tree), bN
node->storage = data;
}
static void geo_node_legacy_attribute_randomize_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock_min_vector = (bNodeSocket *)BLI_findlink(&node->inputs, 2);
bNodeSocket *sock_max_vector = sock_min_vector->next;
@@ -174,36 +206,6 @@ static void randomize_attribute_bool(MutableSpan<bool> span,
});
}
Array<uint32_t> get_geometry_element_ids_as_uints(const GeometryComponent &component,
const AttributeDomain domain)
{
const int domain_size = component.attribute_domain_size(domain);
/* Hash the reserved name attribute "id" as a (hopefully) stable seed for each point. */
GVArray hash_attribute = component.attribute_try_get_for_read("id", domain);
Array<uint32_t> hashes(domain_size);
if (hash_attribute) {
BLI_assert(hashes.size() == hash_attribute.size());
const CPPType &cpp_type = hash_attribute.type();
BLI_assert(cpp_type.is_hashable());
GVArray_GSpan items{hash_attribute};
threading::parallel_for(hashes.index_range(), 512, [&](IndexRange range) {
for (const int i : range) {
hashes[i] = cpp_type.hash(items[i]);
}
});
}
else {
/* If there is no "id" attribute for per-point variation, just create it here. */
RandomNumberGenerator rng(0);
for (const int i : hashes.index_range()) {
hashes[i] = rng.get_uint32();
}
}
return hashes;
}
static AttributeDomain get_result_domain(const GeometryComponent &component,
const GeoNodeExecParams &params,
const StringRef name)
@@ -280,7 +282,7 @@ static void randomize_attribute_on_component(GeometryComponent &component,
attribute.save();
}
static void geo_node_legacy_random_attribute_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
const std::string attribute_name = params.get_input<std::string>("Attribute");
@@ -324,20 +326,22 @@ static void geo_node_legacy_random_attribute_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_randomize_cc
void register_node_type_geo_legacy_attribute_randomize()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_randomize_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_RANDOMIZE, "Attribute Randomize", NODE_CLASS_ATTRIBUTE, 0);
node_type_init(&ntype, blender::nodes::geo_node_legacy_attribute_randomize_init);
node_type_update(&ntype, blender::nodes::geo_node_legacy_attribute_randomize_update);
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
ntype.declare = blender::nodes::geo_node_legacy_attribute_randomize_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_legacy_random_attribute_exec;
ntype.draw_buttons = blender::nodes::geo_node_legacy_attribute_random_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
node_type_storage(
&ntype, "NodeAttributeRandomize", node_free_standard_storage, node_copy_standard_storage);
nodeRegisterType(&ntype);

View File

@@ -28,9 +28,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_sample_texture_cc {
static void geo_node_attribute_sample_texture_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Texture>(N_("Texture")).hide_label();
@@ -100,7 +100,7 @@ static void execute_on_component(GeometryComponent &component, const GeoNodeExec
attribute_out.save();
}
static void geo_node_attribute_sample_texture_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -119,10 +119,12 @@ static void geo_node_attribute_sample_texture_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_sample_texture_cc
void register_node_type_geo_sample_texture()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_sample_texture_cc;
static bNodeType ntype;
geo_node_type_base(&ntype,
@@ -131,7 +133,7 @@ void register_node_type_geo_sample_texture()
NODE_CLASS_ATTRIBUTE,
0);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
ntype.declare = blender::nodes::geo_node_attribute_sample_texture_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_sample_texture_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -19,9 +19,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_separate_xyz_cc {
static void geo_node_attribute_separate_xyz_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Vector"));
@@ -32,16 +32,14 @@ static void geo_node_attribute_separate_xyz_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_separate_xyz_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "input_type", 0, IFACE_("Type"), ICON_NONE);
}
static void geo_node_attribute_separate_xyz_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeSeparateXYZ *data = (NodeAttributeSeparateXYZ *)MEM_callocN(
sizeof(NodeAttributeSeparateXYZ), __func__);
@@ -49,7 +47,7 @@ static void geo_node_attribute_separate_xyz_init(bNodeTree *UNUSED(tree), bNode
node->storage = data;
}
static void geo_node_attribute_separate_xyz_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeAttributeSeparateXYZ *node_storage = (NodeAttributeSeparateXYZ *)node->storage;
update_attribute_input_socket_availabilities(
@@ -132,7 +130,7 @@ static void separate_attribute(GeometryComponent &component, const GeoNodeExecPa
}
}
static void geo_node_attribute_separate_xyz_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -151,10 +149,12 @@ static void geo_node_attribute_separate_xyz_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_separate_xyz_cc
void register_node_type_geo_attribute_separate_xyz()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_separate_xyz_cc;
static bNodeType ntype;
geo_node_type_base(&ntype,
@@ -162,12 +162,12 @@ void register_node_type_geo_attribute_separate_xyz()
"Attribute Separate XYZ",
NODE_CLASS_ATTRIBUTE,
0);
ntype.declare = blender::nodes::geo_node_attribute_separate_xyz_declare;
node_type_init(&ntype, blender::nodes::geo_node_attribute_separate_xyz_init);
node_type_update(&ntype, blender::nodes::geo_node_attribute_separate_xyz_update);
ntype.declare = file_ns::node_declare;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
node_type_storage(
&ntype, "NodeAttributeSeparateXYZ", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_separate_xyz_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_separate_xyz_layout;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -29,9 +29,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_transfer_cc {
static void geo_node_attribute_transfer_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Geometry>(N_("Source Geometry"));
@@ -40,9 +40,7 @@ static void geo_node_attribute_transfer_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_transfer_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -50,7 +48,7 @@ static void geo_node_attribute_transfer_layout(uiLayout *layout,
uiItemR(layout, ptr, "mapping", 0, IFACE_("Mapping"), ICON_NONE);
}
static void geo_node_attribute_transfer_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryAttributeTransfer *data = (NodeGeometryAttributeTransfer *)MEM_callocN(
sizeof(NodeGeometryAttributeTransfer), __func__);
@@ -477,7 +475,7 @@ static void transfer_attribute(const GeoNodeExecParams &params,
}
}
static void geo_node_attribute_transfer_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet dst_geometry_set = params.extract_input<GeometrySet>("Geometry");
GeometrySet src_geometry_set = params.extract_input<GeometrySet>("Source Geometry");
@@ -510,21 +508,23 @@ static void geo_node_attribute_transfer_exec(GeoNodeExecParams params)
params.set_output("Geometry", dst_geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_transfer_cc
void register_node_type_geo_legacy_attribute_transfer()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_transfer_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_ATTRIBUTE_TRANSFER, "Attribute Transfer", NODE_CLASS_ATTRIBUTE, 0);
node_type_init(&ntype, blender::nodes::geo_node_attribute_transfer_init);
node_type_init(&ntype, file_ns::node_init);
node_type_storage(&ntype,
"NodeGeometryAttributeTransfer",
node_free_standard_storage,
node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_attribute_transfer_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_transfer_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_transfer_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -26,9 +26,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_vector_math_cc {
static void geo_node_attribute_vector_math_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("A"));
@@ -66,9 +66,7 @@ static bool operation_use_input_c(const NodeVectorMathOperation operation)
NODE_VECTOR_MATH_MULTIPLY_ADD);
}
static void geo_node_attribute_vector_math_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
bNode *node = (bNode *)ptr->data;
const NodeAttributeVectorMath &node_storage = *(NodeAttributeVectorMath *)node->storage;
@@ -103,7 +101,7 @@ static CustomDataType operation_get_read_type_c(const NodeVectorMathOperation op
return CD_PROP_FLOAT3;
}
static void geo_node_attribute_vector_math_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeVectorMath *data = (NodeAttributeVectorMath *)MEM_callocN(
sizeof(NodeAttributeVectorMath), __func__);
@@ -166,7 +164,7 @@ static void geo_node_vector_math_label(bNodeTree *UNUSED(ntree),
BLI_snprintf(label, maxlen, IFACE_("Vector %s"), IFACE_(name));
}
static void geo_node_attribute_vector_math_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
const NodeAttributeVectorMath *node_storage = (NodeAttributeVectorMath *)node->storage;
const NodeVectorMathOperation operation = (const NodeVectorMathOperation)node_storage->operation;
@@ -531,7 +529,7 @@ static void attribute_vector_math_calc(GeometryComponent &component,
attribute_result.save();
}
static void geo_node_attribute_vector_math_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -551,10 +549,12 @@ static void geo_node_attribute_vector_math_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_vector_math_cc
void register_node_type_geo_attribute_vector_math()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_vector_math_cc;
static bNodeType ntype;
geo_node_type_base(&ntype,
@@ -562,12 +562,12 @@ void register_node_type_geo_attribute_vector_math()
"Attribute Vector Math",
NODE_CLASS_ATTRIBUTE,
0);
ntype.declare = blender::nodes::geo_node_attribute_vector_math_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_vector_math_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_vector_math_layout;
node_type_label(&ntype, blender::nodes::geo_node_vector_math_label);
node_type_update(&ntype, blender::nodes::geo_node_attribute_vector_math_update);
node_type_init(&ntype, blender::nodes::geo_node_attribute_vector_math_init);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
node_type_label(&ntype, file_ns::geo_node_vector_math_label);
node_type_update(&ntype, file_ns::node_update);
node_type_init(&ntype, file_ns::node_init);
node_type_storage(
&ntype, "NodeAttributeVectorMath", node_free_standard_storage, node_copy_standard_storage);

View File

@@ -21,9 +21,9 @@
#include "UI_interface.h"
#include "UI_resources.h"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_attribute_vector_rotate_cc {
static void geo_node_attribute_vector_rotate_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Vector"));
@@ -42,9 +42,7 @@ static void geo_node_attribute_vector_rotate_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_attribute_vector_rotate_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
bNode *node = (bNode *)ptr->data;
const NodeAttributeVectorRotate &node_storage = *(NodeAttributeVectorRotate *)node->storage;
@@ -70,7 +68,7 @@ static void geo_node_attribute_vector_rotate_layout(uiLayout *layout,
}
}
static void geo_node_attribute_vector_rotate_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
const NodeAttributeVectorRotate *node_storage = (NodeAttributeVectorRotate *)node->storage;
const GeometryNodeAttributeVectorRotateMode mode = (const GeometryNodeAttributeVectorRotateMode)
@@ -112,7 +110,7 @@ static float3 vector_rotate_around_axis(const float3 vector,
return result + center;
}
static void geo_node_attribute_vector_rotate_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeAttributeVectorRotate *node_storage = (NodeAttributeVectorRotate *)MEM_callocN(
sizeof(NodeAttributeVectorRotate), __func__);
@@ -309,7 +307,7 @@ static void execute_on_component(const GeoNodeExecParams &params, GeometryCompon
attribute_result.save();
}
static void geo_node_attribute_vector_rotate_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -328,10 +326,12 @@ static void geo_node_attribute_vector_rotate_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_attribute_vector_rotate_cc
void register_node_type_geo_attribute_vector_rotate()
{
namespace file_ns = blender::nodes::node_geo_legacy_attribute_vector_rotate_cc;
static bNodeType ntype;
geo_node_type_base(&ntype,
@@ -339,13 +339,13 @@ void register_node_type_geo_attribute_vector_rotate()
"Attribute Vector Rotate",
NODE_CLASS_ATTRIBUTE,
0);
node_type_update(&ntype, blender::nodes::geo_node_attribute_vector_rotate_update);
node_type_init(&ntype, blender::nodes::geo_node_attribute_vector_rotate_init);
node_type_update(&ntype, file_ns::node_update);
node_type_init(&ntype, file_ns::node_init);
node_type_size(&ntype, 165, 100, 600);
node_type_storage(
&ntype, "NodeAttributeVectorRotate", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_vector_rotate_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_vector_rotate_layout;
ntype.declare = blender::nodes::geo_node_attribute_vector_rotate_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
ntype.declare = file_ns::node_declare;
nodeRegisterType(&ntype);
}

View File

@@ -25,9 +25,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_curve_endpoints_cc {
static void geo_node_curve_endpoints_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Start Points"));
@@ -145,7 +145,7 @@ static void copy_endpoint_attributes(Span<SplinePtr> splines,
});
}
static void geo_node_curve_endpoints_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -206,16 +206,18 @@ static void geo_node_curve_endpoints_exec(GeoNodeExecParams params)
params.set_output("End Points", std::move(end_result));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_curve_endpoints_cc
void register_node_type_geo_legacy_curve_endpoints()
{
namespace file_ns = blender::nodes::node_geo_legacy_curve_endpoints_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_CURVE_ENDPOINTS, "Curve Endpoints", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_curve_endpoints_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_endpoints_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -20,16 +20,16 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_curve_reverse_cc {
static void geo_node_curve_reverse_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve"));
b.add_input<decl::String>(N_("Selection"));
b.add_output<decl::Geometry>(N_("Curve"));
}
static void geo_node_curve_reverse_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Curve");
geometry_set = bke::geometry_set_realize_instances(geometry_set);
@@ -58,14 +58,16 @@ static void geo_node_curve_reverse_exec(GeoNodeExecParams params)
params.set_output("Curve", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_curve_reverse_cc
void register_node_type_geo_legacy_curve_reverse()
{
namespace file_ns = blender::nodes::node_geo_legacy_curve_reverse_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_CURVE_REVERSE, "Curve Reverse", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_curve_reverse_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_reverse_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -23,24 +23,22 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_curve_select_by_handle_type_cc {
static void geo_node_select_by_handle_type_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Selection"));
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_curve_select_by_handle_type_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
uiItemR(layout, ptr, "handle_type", 0, "", ICON_NONE);
}
static void geo_node_curve_select_by_handle_type_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurveSelectHandles *data = (NodeGeometryCurveSelectHandles *)MEM_callocN(
sizeof(NodeGeometryCurveSelectHandles), __func__);
@@ -94,7 +92,7 @@ static void select_curve_by_handle_type(const CurveEval &curve,
});
}
static void geo_node_select_by_handle_type_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
const NodeGeometryCurveSelectHandles *storage =
(const NodeGeometryCurveSelectHandles *)params.node().storage;
@@ -121,10 +119,12 @@ static void geo_node_select_by_handle_type_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_curve_select_by_handle_type_cc
void register_node_type_geo_legacy_select_by_handle_type()
{
namespace file_ns = blender::nodes::node_geo_legacy_curve_select_by_handle_type_cc;
static bNodeType ntype;
geo_node_type_base(&ntype,
@@ -132,14 +132,14 @@ void register_node_type_geo_legacy_select_by_handle_type()
"Select by Handle Type",
NODE_CLASS_GEOMETRY,
0);
ntype.declare = blender::nodes::geo_node_select_by_handle_type_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_select_by_handle_type_exec;
node_type_init(&ntype, blender::nodes::geo_node_curve_select_by_handle_type_init);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
node_type_init(&ntype, file_ns::node_init);
node_type_storage(&ntype,
"NodeGeometryCurveSelectHandles",
node_free_standard_storage,
node_copy_standard_storage);
ntype.draw_buttons = blender::nodes::geo_node_curve_select_by_handle_type_layout;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -21,24 +21,22 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_curve_set_handles_cc {
static void geo_node_curve_set_handles_decalre(NodeDeclarationBuilder &b)
static void node_decalre(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve"));
b.add_input<decl::String>(N_("Selection"));
b.add_output<decl::Geometry>(N_("Curve"));
}
static void geo_node_curve_set_handles_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
uiItemR(layout, ptr, "handle_type", 0, "", ICON_NONE);
}
static void geo_node_curve_set_handles_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurveSetHandles *data = (NodeGeometryCurveSetHandles *)MEM_callocN(
sizeof(NodeGeometryCurveSetHandles), __func__);
@@ -64,7 +62,7 @@ static BezierSpline::HandleType handle_type_from_input_type(GeometryNodeCurveHan
return BezierSpline::HandleType::Auto;
}
static void geo_node_curve_set_handles_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
const NodeGeometryCurveSetHandles *node_storage =
(NodeGeometryCurveSetHandles *)params.node().storage;
@@ -124,21 +122,23 @@ static void geo_node_curve_set_handles_exec(GeoNodeExecParams params)
params.set_output("Curve", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_curve_set_handles_cc
void register_node_type_geo_legacy_curve_set_handles()
{
namespace file_ns = blender::nodes::node_geo_legacy_curve_set_handles_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_CURVE_SET_HANDLES, "Set Handle Type", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_curve_set_handles_decalre;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_set_handles_exec;
node_type_init(&ntype, blender::nodes::geo_node_curve_set_handles_init);
ntype.declare = file_ns::node_decalre;
ntype.geometry_node_execute = file_ns::node_geo_exec;
node_type_init(&ntype, file_ns::node_init);
node_type_storage(&ntype,
"NodeGeometryCurveSetHandles",
node_free_standard_storage,
node_copy_standard_storage);
ntype.draw_buttons = blender::nodes::geo_node_curve_set_handles_layout;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -23,23 +23,21 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_curve_spline_type_cc {
static void geo_node_legacy_curve_spline_type_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve"));
b.add_input<decl::String>(N_("Selection"));
b.add_output<decl::Geometry>(N_("Curve"));
}
static void geo_node_legacy_curve_spline_type_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "spline_type", 0, "", ICON_NONE);
}
static void geo_node_legacy_curve_spline_type_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurveSplineType *data = (NodeGeometryCurveSplineType *)MEM_callocN(
sizeof(NodeGeometryCurveSplineType), __func__);
@@ -238,7 +236,7 @@ static SplinePtr convert_to_nurbs(const Spline &input)
return {};
}
static void geo_node_legacy_curve_spline_type_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
const NodeGeometryCurveSplineType *storage =
(const NodeGeometryCurveSplineType *)params.node().storage;
@@ -282,21 +280,23 @@ static void geo_node_legacy_curve_spline_type_exec(GeoNodeExecParams params)
params.set_output("Curve", GeometrySet::create_with_curve(new_curve.release()));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_curve_spline_type_cc
void register_node_type_geo_legacy_curve_spline_type()
{
namespace file_ns = blender::nodes::node_geo_legacy_curve_spline_type_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_CURVE_SPLINE_TYPE, "Set Spline Type", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_legacy_curve_spline_type_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_legacy_curve_spline_type_exec;
node_type_init(&ntype, blender::nodes::geo_node_legacy_curve_spline_type_init);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
node_type_init(&ntype, file_ns::node_init);
node_type_storage(&ntype,
"NodeGeometryCurveSplineType",
node_free_standard_storage,
node_copy_standard_storage);
ntype.draw_buttons = blender::nodes::geo_node_legacy_curve_spline_type_layout;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -25,9 +25,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_curve_subdivide_cc {
static void geo_node_curve_subdivide_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Cuts"));
@@ -35,14 +35,14 @@ static void geo_node_curve_subdivide_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_curve_subdivide_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "cuts_type", 0, IFACE_("Cuts"), ICON_NONE);
}
static void geo_node_curve_subdivide_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurveSubdivide *data = (NodeGeometryCurveSubdivide *)MEM_callocN(
sizeof(NodeGeometryCurveSubdivide), __func__);
@@ -51,7 +51,7 @@ static void geo_node_curve_subdivide_init(bNodeTree *UNUSED(tree), bNode *node)
node->storage = data;
}
static void geo_node_curve_subdivide_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeGeometryPointTranslate &node_storage = *(NodeGeometryPointTranslate *)node->storage;
@@ -347,7 +347,7 @@ static std::unique_ptr<CurveEval> subdivide_curve(const CurveEval &input_curve,
return output_curve;
}
static void geo_node_subdivide_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -370,22 +370,24 @@ static void geo_node_subdivide_exec(GeoNodeExecParams params)
params.set_output("Geometry", GeometrySet::create_with_curve(output_curve.release()));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_curve_subdivide_cc
void register_node_type_geo_legacy_curve_subdivide()
{
namespace file_ns = blender::nodes::node_geo_legacy_curve_subdivide_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_CURVE_SUBDIVIDE, "Curve Subdivide", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_curve_subdivide_declare;
ntype.draw_buttons = blender::nodes::geo_node_curve_subdivide_layout;
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
node_type_storage(&ntype,
"NodeGeometryCurveSubdivide",
node_free_standard_storage,
node_copy_standard_storage);
node_type_init(&ntype, blender::nodes::geo_node_curve_subdivide_init);
node_type_update(&ntype, blender::nodes::geo_node_curve_subdivide_update);
ntype.geometry_node_execute = blender::nodes::geo_node_subdivide_exec;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -28,7 +28,59 @@
namespace blender::nodes {
static void geo_node_curve_to_points_declare(NodeDeclarationBuilder &b)
static GMutableSpan create_attribute_and_retrieve_span(PointCloudComponent &points,
const AttributeIDRef &attribute_id,
const CustomDataType data_type)
{
points.attribute_try_create(attribute_id, ATTR_DOMAIN_POINT, data_type, AttributeInitDefault());
WriteAttributeLookup attribute = points.attribute_try_get_for_write(attribute_id);
BLI_assert(attribute);
return attribute.varray.get_internal_span();
}
template<typename T>
static MutableSpan<T> create_attribute_and_retrieve_span(PointCloudComponent &points,
const AttributeIDRef &attribute_id)
{
GMutableSpan attribute = create_attribute_and_retrieve_span(
points, attribute_id, bke::cpp_type_to_custom_data_type(CPPType::get<T>()));
return attribute.typed<T>();
}
CurveToPointsResults curve_to_points_create_result_attributes(PointCloudComponent &points,
const CurveEval &curve)
{
CurveToPointsResults attributes;
attributes.result_size = points.attribute_domain_size(ATTR_DOMAIN_POINT);
attributes.positions = create_attribute_and_retrieve_span<float3>(points, "position");
attributes.radii = create_attribute_and_retrieve_span<float>(points, "radius");
attributes.tilts = create_attribute_and_retrieve_span<float>(points, "tilt");
/* Because of the invariants of the curve component, we use the attributes of the
* first spline as a representative for the attribute meta data all splines. */
curve.splines().first()->attributes.foreach_attribute(
[&](const AttributeIDRef &attribute_id, const AttributeMetaData &meta_data) {
attributes.point_attributes.add_new(
attribute_id,
create_attribute_and_retrieve_span(points, attribute_id, meta_data.data_type));
return true;
},
ATTR_DOMAIN_POINT);
attributes.tangents = create_attribute_and_retrieve_span<float3>(points, "tangent");
attributes.normals = create_attribute_and_retrieve_span<float3>(points, "normal");
attributes.rotations = create_attribute_and_retrieve_span<float3>(points, "rotation");
return attributes;
}
} // namespace blender::nodes
namespace blender::nodes::node_geo_legacy_curve_to_points_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Int>(N_("Count")).default_value(10).min(2).max(100000);
@@ -36,12 +88,12 @@ static void geo_node_curve_to_points_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_curve_to_points_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", 0, "", ICON_NONE);
}
static void geo_node_curve_to_points_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurveToPoints *data = (NodeGeometryCurveToPoints *)MEM_callocN(
sizeof(NodeGeometryCurveToPoints), __func__);
@@ -50,7 +102,7 @@ static void geo_node_curve_to_points_init(bNodeTree *UNUSED(tree), bNode *node)
node->storage = data;
}
static void geo_node_curve_to_points_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeGeometryCurveToPoints &node_storage = *(NodeGeometryCurveToPoints *)node->storage;
const GeometryNodeCurveResampleMode mode = (GeometryNodeCurveResampleMode)node_storage.mode;
@@ -114,54 +166,6 @@ static Array<int> calculate_spline_point_offsets(GeoNodeExecParams &params,
return {0};
}
static GMutableSpan create_attribute_and_retrieve_span(PointCloudComponent &points,
const AttributeIDRef &attribute_id,
const CustomDataType data_type)
{
points.attribute_try_create(attribute_id, ATTR_DOMAIN_POINT, data_type, AttributeInitDefault());
WriteAttributeLookup attribute = points.attribute_try_get_for_write(attribute_id);
BLI_assert(attribute);
return attribute.varray.get_internal_span();
}
template<typename T>
static MutableSpan<T> create_attribute_and_retrieve_span(PointCloudComponent &points,
const AttributeIDRef &attribute_id)
{
GMutableSpan attribute = create_attribute_and_retrieve_span(
points, attribute_id, bke::cpp_type_to_custom_data_type(CPPType::get<T>()));
return attribute.typed<T>();
}
CurveToPointsResults curve_to_points_create_result_attributes(PointCloudComponent &points,
const CurveEval &curve)
{
CurveToPointsResults attributes;
attributes.result_size = points.attribute_domain_size(ATTR_DOMAIN_POINT);
attributes.positions = create_attribute_and_retrieve_span<float3>(points, "position");
attributes.radii = create_attribute_and_retrieve_span<float>(points, "radius");
attributes.tilts = create_attribute_and_retrieve_span<float>(points, "tilt");
/* Because of the invariants of the curve component, we use the attributes of the
* first spline as a representative for the attribute meta data all splines. */
curve.splines().first()->attributes.foreach_attribute(
[&](const AttributeIDRef &attribute_id, const AttributeMetaData &meta_data) {
attributes.point_attributes.add_new(
attribute_id,
create_attribute_and_retrieve_span(points, attribute_id, meta_data.data_type));
return true;
},
ATTR_DOMAIN_POINT);
attributes.tangents = create_attribute_and_retrieve_span<float3>(points, "tangent");
attributes.normals = create_attribute_and_retrieve_span<float3>(points, "normal");
attributes.rotations = create_attribute_and_retrieve_span<float3>(points, "rotation");
return attributes;
}
/**
* TODO: For non-poly splines, this has double copies that could be avoided as part
* of a general look at optimizing uses of #Spline::interpolate_to_evaluated.
@@ -286,7 +290,7 @@ static void copy_spline_domain_attributes(const CurveComponent &curve_component,
});
}
static void geo_node_curve_to_points_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
NodeGeometryCurveToPoints &node_storage = *(NodeGeometryCurveToPoints *)params.node().storage;
const GeometryNodeCurveResampleMode mode = (GeometryNodeCurveResampleMode)node_storage.mode;
@@ -340,21 +344,23 @@ static void geo_node_curve_to_points_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(result));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_curve_to_points_cc
void register_node_type_geo_legacy_curve_to_points()
{
namespace file_ns = blender::nodes::node_geo_legacy_curve_to_points_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_CURVE_TO_POINTS, "Curve to Points", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_curve_to_points_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_to_points_exec;
ntype.draw_buttons = blender::nodes::geo_node_curve_to_points_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
node_type_storage(
&ntype, "NodeGeometryCurveToPoints", node_free_standard_storage, node_copy_standard_storage);
node_type_init(&ntype, blender::nodes::geo_node_curve_to_points_init);
node_type_update(&ntype, blender::nodes::geo_node_curve_to_points_update);
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
nodeRegisterType(&ntype);
}

View File

@@ -43,9 +43,9 @@ void copy_masked_polys_to_new_mesh(const Mesh &src_mesh,
blender::Span<int> masked_poly_indices,
blender::Span<int> new_loop_starts);
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_delete_geometry_cc {
static void geo_node_delete_geometry_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Selection"));
@@ -627,7 +627,7 @@ static void delete_mesh_selection(MeshComponent &component,
component.replace(mesh_out);
}
static void geo_node_delete_geometry_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
geometry_set = bke::geometry_set_realize_instances(geometry_set);
@@ -662,16 +662,18 @@ static void geo_node_delete_geometry_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(out_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_delete_geometry_cc
void register_node_type_geo_legacy_delete_geometry()
{
namespace file_ns = blender::nodes::node_geo_legacy_delete_geometry_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_DELETE_GEOMETRY, "Delete Geometry", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_delete_geometry_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_delete_geometry_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -22,9 +22,9 @@ extern "C" {
Mesh *doEdgeSplit(const Mesh *mesh, EdgeSplitModifierData *emd);
}
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_edge_split_cc {
static void geo_node_edge_split_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Edge Angle")).default_value(true);
@@ -37,7 +37,7 @@ static void geo_node_edge_split_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_edge_split_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -76,14 +76,16 @@ static void geo_node_edge_split_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_edge_split_cc
void register_node_type_geo_legacy_edge_split()
{
namespace file_ns = blender::nodes::node_geo_legacy_edge_split_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_LEGACY_EDGE_SPLIT, "Edge Split", NODE_CLASS_GEOMETRY, 0);
ntype.geometry_node_execute = blender::nodes::geo_node_edge_split_exec;
ntype.declare = blender::nodes::geo_node_edge_split_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.declare = file_ns::node_declare;
nodeRegisterType(&ntype);
}

View File

@@ -24,9 +24,9 @@
#include "BKE_material.h"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_material_assign_cc {
static void geo_node_legacy_material_assign_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Material>(N_("Material")).hide_label(true);
@@ -59,7 +59,7 @@ static void assign_material_to_faces(Mesh &mesh, const VArray<bool> &face_mask,
}
}
static void geo_node_legacy_material_assign_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
Material *material = params.extract_input<Material *>("Material");
const std::string mask_name = params.extract_input<std::string>("Selection");
@@ -81,15 +81,17 @@ static void geo_node_legacy_material_assign_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_material_assign_cc
void register_node_type_geo_legacy_material_assign()
{
namespace file_ns = blender::nodes::node_geo_legacy_material_assign_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_MATERIAL_ASSIGN, "Material Assign", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_legacy_material_assign_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_legacy_material_assign_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -18,16 +18,16 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_mesh_to_curve_cc {
static void geo_node_legacy_mesh_to_curve_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh"));
b.add_input<decl::String>(N_("Selection"));
b.add_output<decl::Geometry>(N_("Curve"));
}
static void geo_node_legacy_mesh_to_curve_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Mesh");
@@ -65,15 +65,17 @@ static void geo_node_legacy_mesh_to_curve_exec(GeoNodeExecParams params)
params.set_output("Curve", GeometrySet::create_with_curve(curve.release()));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_mesh_to_curve_cc
void register_node_type_geo_legacy_mesh_to_curve()
{
namespace file_ns = blender::nodes::node_geo_legacy_mesh_to_curve_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_MESH_TO_CURVE, "Mesh to Curve", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_legacy_mesh_to_curve_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_legacy_mesh_to_curve_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -36,11 +36,11 @@
#include "node_geometry_util.hh"
namespace blender::nodes::node_geo_legacy_point_distribute_cc {
using blender::bke::GeometryInstanceGroup;
namespace blender::nodes {
static void geo_node_point_distribute_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Float>(N_("Distance Min")).min(0.0f).max(100000.0f).subtype(PROP_DISTANCE);
@@ -54,9 +54,7 @@ static void geo_node_point_distribute_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_point_distribute_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "distribute_method", 0, "", ICON_NONE);
}
@@ -541,7 +539,7 @@ static void distribute_points_poisson_disk(Span<GeometryInstanceGroup> set_group
}
}
static void geo_node_point_distribute_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -655,17 +653,19 @@ static void geo_node_point_distribute_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set_out));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_point_distribute_cc
void register_node_type_geo_point_distribute()
{
namespace file_ns = blender::nodes::node_geo_legacy_point_distribute_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_POINT_DISTRIBUTE, "Point Distribute", NODE_CLASS_GEOMETRY, 0);
node_type_update(&ntype, blender::nodes::node_point_distribute_update);
ntype.declare = blender::nodes::geo_node_point_distribute_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_point_distribute_exec;
ntype.draw_buttons = blender::nodes::geo_node_point_distribute_layout;
node_type_update(&ntype, file_ns::node_point_distribute_update);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -24,9 +24,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_point_instance_cc {
static void geo_node_point_instance_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Object>(N_("Object")).hide_label();
@@ -36,7 +36,7 @@ static void geo_node_point_instance_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_point_instance_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "instance_type", 0, "", ICON_NONE);
if (RNA_enum_get(ptr, "instance_type") == GEO_NODE_POINT_INSTANCE_TYPE_COLLECTION) {
@@ -44,7 +44,7 @@ static void geo_node_point_instance_layout(uiLayout *layout, bContext *UNUSED(C)
}
}
static void geo_node_point_instance_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryPointInstance *data = (NodeGeometryPointInstance *)MEM_callocN(
sizeof(NodeGeometryPointInstance), __func__);
@@ -53,7 +53,7 @@ static void geo_node_point_instance_init(bNodeTree *UNUSED(tree), bNode *node)
node->storage = data;
}
static void geo_node_point_instance_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
bNodeSocket *object_socket = (bNodeSocket *)BLI_findlink(&node->inputs, 1);
bNodeSocket *collection_socket = object_socket->next;
@@ -215,7 +215,7 @@ static void add_instances_from_component(InstancesComponent &instances,
}
}
static void geo_node_point_instance_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
GeometrySet geometry_set_out;
@@ -255,20 +255,22 @@ static void geo_node_point_instance_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set_out));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_point_instance_cc
void register_node_type_geo_point_instance()
{
namespace file_ns = blender::nodes::node_geo_legacy_point_instance_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_POINT_INSTANCE, "Point Instance", NODE_CLASS_GEOMETRY, 0);
node_type_init(&ntype, blender::nodes::geo_node_point_instance_init);
node_type_init(&ntype, file_ns::node_init);
node_type_storage(
&ntype, "NodeGeometryPointInstance", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_point_instance_declare;
ntype.draw_buttons = blender::nodes::geo_node_point_instance_layout;
node_type_update(&ntype, blender::nodes::geo_node_point_instance_update);
ntype.geometry_node_execute = blender::nodes::geo_node_point_instance_exec;
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
node_type_update(&ntype, file_ns::node_update);
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -21,9 +21,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_point_rotate_cc {
static void geo_node_point_rotate_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Axis"));
@@ -37,7 +37,7 @@ static void geo_node_point_rotate_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_point_rotate_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
NodeGeometryRotatePoints *storage = (NodeGeometryRotatePoints *)((bNode *)ptr->data)->storage;
@@ -57,7 +57,7 @@ static void geo_node_point_rotate_layout(uiLayout *layout, bContext *UNUSED(C),
}
}
static void geo_node_point_rotate_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeGeometryRotatePoints *node_storage = (NodeGeometryRotatePoints *)MEM_callocN(
sizeof(NodeGeometryRotatePoints), __func__);
@@ -71,7 +71,7 @@ static void geo_node_point_rotate_init(bNodeTree *UNUSED(ntree), bNode *node)
node->storage = node_storage;
}
static void geo_node_point_rotate_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeGeometryRotatePoints *node_storage = (NodeGeometryRotatePoints *)node->storage;
update_attribute_input_socket_availabilities(
@@ -199,7 +199,7 @@ static void point_rotate_on_component(GeometryComponent &component,
rotation_attribute.save();
}
static void geo_node_point_rotate_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -218,19 +218,21 @@ static void geo_node_point_rotate_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_point_rotate_cc
void register_node_type_geo_point_rotate()
{
namespace file_ns = blender::nodes::node_geo_legacy_point_rotate_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_LEGACY_POINT_ROTATE, "Point Rotate", NODE_CLASS_GEOMETRY, 0);
node_type_init(&ntype, blender::nodes::geo_node_point_rotate_init);
node_type_update(&ntype, blender::nodes::geo_node_point_rotate_update);
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
node_type_storage(
&ntype, "NodeGeometryRotatePoints", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_point_rotate_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_point_rotate_exec;
ntype.draw_buttons = blender::nodes::geo_node_point_rotate_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -21,9 +21,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_point_scale_cc {
static void geo_node_point_scale_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Factor"));
@@ -34,14 +34,14 @@ static void geo_node_point_scale_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_point_scale_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "input_type", 0, IFACE_("Type"), ICON_NONE);
}
static void geo_node_point_scale_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryPointScale *data = (NodeGeometryPointScale *)MEM_callocN(
sizeof(NodeGeometryPointScale), __func__);
@@ -50,7 +50,7 @@ static void geo_node_point_scale_init(bNodeTree *UNUSED(tree), bNode *node)
node->storage = data;
}
static void geo_node_point_scale_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeGeometryPointScale &node_storage = *(NodeGeometryPointScale *)node->storage;
@@ -101,7 +101,7 @@ static void execute_on_component(GeoNodeExecParams params, GeometryComponent &co
scale_attribute.save();
}
static void geo_node_point_scale_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -120,20 +120,22 @@ static void geo_node_point_scale_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_point_scale_cc
void register_node_type_geo_point_scale()
{
namespace file_ns = blender::nodes::node_geo_legacy_point_scale_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_LEGACY_POINT_SCALE, "Point Scale", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_point_scale_declare;
node_type_init(&ntype, blender::nodes::geo_node_point_scale_init);
node_type_update(&ntype, blender::nodes::geo_node_point_scale_update);
ntype.declare = file_ns::node_declare;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
node_type_storage(
&ntype, "NodeGeometryPointScale", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_point_scale_exec;
ntype.draw_buttons = blender::nodes::geo_node_point_scale_layout;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -25,14 +25,6 @@
namespace blender::nodes {
static void geo_node_point_instance_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Mask"));
b.add_output<decl::Geometry>(N_("Geometry 1"));
b.add_output<decl::Geometry>(N_("Geometry 2"));
}
template<typename T>
static void copy_data_based_on_mask(Span<T> data,
Span<bool> masks,
@@ -78,6 +70,18 @@ void copy_point_attributes_based_on_mask(const GeometryComponent &in_component,
}
}
} // namespace blender::nodes
namespace blender::nodes::node_geo_legacy_point_separate_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Mask"));
b.add_output<decl::Geometry>(N_("Geometry 1"));
b.add_output<decl::Geometry>(N_("Geometry 2"));
}
static void create_component_points(GeometryComponent &component, const int total)
{
switch (component.type()) {
@@ -133,7 +137,7 @@ static GeometrySet separate_geometry_set(const GeometrySet &set_in,
return set_out;
}
static void geo_node_point_separate_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
bool wait_for_inputs = false;
wait_for_inputs |= params.lazy_require_input("Geometry");
@@ -158,16 +162,18 @@ static void geo_node_point_separate_exec(GeoNodeExecParams params)
}
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_point_separate_cc
void register_node_type_geo_point_separate()
{
namespace file_ns = blender::nodes::node_geo_legacy_point_separate_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_POINT_SEPARATE, "Point Separate", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_point_instance_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_point_separate_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.geometry_node_execute_supports_laziness = true;
nodeRegisterType(&ntype);
}

View File

@@ -19,9 +19,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_point_translate_cc {
static void geo_node_point_translate_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Translation"));
@@ -29,7 +29,7 @@ static void geo_node_point_translate_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_point_translate_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -53,7 +53,7 @@ static void execute_on_component(GeoNodeExecParams params, GeometryComponent &co
position_attribute.save();
}
static void geo_node_point_translate_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -72,7 +72,7 @@ static void geo_node_point_translate_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set));
}
static void geo_node_point_translate_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryPointTranslate *data = (NodeGeometryPointTranslate *)MEM_callocN(
sizeof(NodeGeometryPointTranslate), __func__);
@@ -81,7 +81,7 @@ static void geo_node_point_translate_init(bNodeTree *UNUSED(tree), bNode *node)
node->storage = data;
}
static void geo_node_point_translate_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeGeometryPointTranslate &node_storage = *(NodeGeometryPointTranslate *)node->storage;
@@ -89,22 +89,24 @@ static void geo_node_point_translate_update(bNodeTree *ntree, bNode *node)
*ntree, *node, "Translation", (GeometryNodeAttributeInputMode)node_storage.input_type);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_point_translate_cc
void register_node_type_geo_point_translate()
{
namespace file_ns = blender::nodes::node_geo_legacy_point_translate_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_POINT_TRANSLATE, "Point Translate", NODE_CLASS_GEOMETRY, 0);
node_type_init(&ntype, blender::nodes::geo_node_point_translate_init);
node_type_update(&ntype, blender::nodes::geo_node_point_translate_update);
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
node_type_storage(&ntype,
"NodeGeometryPointTranslate",
node_free_standard_storage,
node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_point_translate_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_point_translate_exec;
ntype.draw_buttons = blender::nodes::geo_node_point_translate_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -28,9 +28,9 @@
#include "UI_interface.h"
#include "UI_resources.h"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_points_to_volume_cc {
static void geo_node_points_to_volume_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Float>(N_("Density")).default_value(1.0f).min(0.0f);
@@ -41,9 +41,7 @@ static void geo_node_points_to_volume_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_points_to_volume_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -51,7 +49,7 @@ static void geo_node_points_to_volume_layout(uiLayout *layout,
uiItemR(layout, ptr, "input_type_radius", 0, IFACE_("Radius"), ICON_NONE);
}
static void geo_node_points_to_volume_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeGeometryPointsToVolume *data = (NodeGeometryPointsToVolume *)MEM_callocN(
sizeof(NodeGeometryPointsToVolume), __func__);
@@ -65,7 +63,7 @@ static void geo_node_points_to_volume_init(bNodeTree *UNUSED(ntree), bNode *node
STRNCPY(radius_attribute_socket_value->value, "radius");
}
static void geo_node_points_to_volume_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeGeometryPointsToVolume *data = (NodeGeometryPointsToVolume *)node->storage;
bNodeSocket *voxel_size_socket = nodeFindSocket(node, SOCK_IN, "Voxel Size");
@@ -244,7 +242,7 @@ static void initialize_volume_component_from_points(const GeometrySet &geometry_
}
#endif
static void geo_node_points_to_volume_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set_in = params.extract_input<GeometrySet>("Geometry");
GeometrySet geometry_set_out;
@@ -259,10 +257,12 @@ static void geo_node_points_to_volume_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set_out));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_points_to_volume_cc
void register_node_type_geo_legacy_points_to_volume()
{
namespace file_ns = blender::nodes::node_geo_legacy_points_to_volume_cc;
static bNodeType ntype;
geo_node_type_base(
@@ -272,10 +272,10 @@ void register_node_type_geo_legacy_points_to_volume()
node_free_standard_storage,
node_copy_standard_storage);
node_type_size(&ntype, 170, 120, 700);
node_type_init(&ntype, blender::nodes::geo_node_points_to_volume_init);
node_type_update(&ntype, blender::nodes::geo_node_points_to_volume_update);
ntype.declare = blender::nodes::geo_node_points_to_volume_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_points_to_volume_exec;
ntype.draw_buttons = blender::nodes::geo_node_points_to_volume_layout;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -24,9 +24,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_raycast_cc {
static void geo_node_raycast_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Geometry>(N_("Target Geometry"));
@@ -47,7 +47,7 @@ static void geo_node_raycast_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_raycast_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -56,7 +56,7 @@ static void geo_node_raycast_layout(uiLayout *layout, bContext *UNUSED(C), Point
uiItemR(layout, ptr, "input_type_ray_length", 0, IFACE_("Ray Length"), ICON_NONE);
}
static void geo_node_raycast_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryRaycast *data = (NodeGeometryRaycast *)MEM_callocN(sizeof(NodeGeometryRaycast),
__func__);
@@ -65,7 +65,7 @@ static void geo_node_raycast_init(bNodeTree *UNUSED(tree), bNode *node)
node->storage = data;
}
static void geo_node_raycast_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeGeometryRaycast *node_storage = (NodeGeometryRaycast *)node->storage;
update_attribute_input_socket_availabilities(
@@ -272,7 +272,7 @@ static void raycast_from_points(const GeoNodeExecParams &params,
}
}
static void geo_node_raycast_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
GeometrySet target_geometry_set = params.extract_input<GeometrySet>("Target Geometry");
@@ -307,20 +307,22 @@ static void geo_node_raycast_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_raycast_cc
void register_node_type_geo_legacy_raycast()
{
namespace file_ns = blender::nodes::node_geo_legacy_raycast_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_LEGACY_RAYCAST, "Raycast", NODE_CLASS_GEOMETRY, 0);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_init(&ntype, blender::nodes::geo_node_raycast_init);
node_type_update(&ntype, blender::nodes::geo_node_raycast_update);
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
node_type_storage(
&ntype, "NodeGeometryRaycast", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_raycast_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_raycast_exec;
ntype.draw_buttons = blender::nodes::geo_node_raycast_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -26,9 +26,9 @@
#include "BKE_material.h"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_select_by_material_cc {
static void geo_node_legacy_select_by_material_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Material>(N_("Material")).hide_label();
@@ -54,7 +54,7 @@ static void select_mesh_by_material(const Mesh &mesh,
});
}
static void geo_node_legacy_select_by_material_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
Material *material = params.extract_input<Material *>("Material");
const std::string selection_name = params.extract_input<std::string>("Selection");
@@ -78,15 +78,17 @@ static void geo_node_legacy_select_by_material_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_select_by_material_cc
void register_node_type_geo_legacy_select_by_material()
{
namespace file_ns = blender::nodes::node_geo_legacy_select_by_material_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_SELECT_BY_MATERIAL, "Select by Material", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_legacy_select_by_material_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_legacy_select_by_material_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -23,9 +23,9 @@
#include "UI_resources.h"
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_subdivision_surface_cc {
static void geo_node_subdivision_surface_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Int>(N_("Level")).default_value(1).min(0).max(6);
@@ -33,9 +33,7 @@ static void geo_node_subdivision_surface_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_subdivision_surface_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
#ifdef WITH_OPENSUBDIV
uiLayoutSetPropSep(layout, true);
@@ -47,7 +45,7 @@ static void geo_node_subdivision_surface_layout(uiLayout *layout,
#endif
}
static void geo_node_subdivision_surface_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeGeometrySubdivisionSurface *data = (NodeGeometrySubdivisionSurface *)MEM_callocN(
sizeof(NodeGeometrySubdivisionSurface), __func__);
@@ -56,7 +54,7 @@ static void geo_node_subdivision_surface_init(bNodeTree *UNUSED(ntree), bNode *n
node->storage = data;
}
static void geo_node_subdivision_surface_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -126,18 +124,20 @@ static void geo_node_subdivision_surface_exec(GeoNodeExecParams params)
params.set_output("Geometry", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_subdivision_surface_cc
void register_node_type_geo_legacy_subdivision_surface()
{
namespace file_ns = blender::nodes::node_geo_legacy_subdivision_surface_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_SUBDIVISION_SURFACE, "Subdivision Surface", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_subdivision_surface_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_subdivision_surface_exec;
ntype.draw_buttons = blender::nodes::geo_node_subdivision_surface_layout;
node_type_init(&ntype, blender::nodes::geo_node_subdivision_surface_init);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
node_type_init(&ntype, file_ns::node_init);
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_storage(&ntype,
"NodeGeometrySubdivisionSurface",

View File

@@ -35,9 +35,9 @@
#include "UI_interface.h"
#include "UI_resources.h"
namespace blender::nodes {
namespace blender::nodes::node_geo_legacy_volume_to_mesh_cc {
static void geo_node_volume_to_mesh_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Density"));
@@ -48,14 +48,14 @@ static void geo_node_volume_to_mesh_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_volume_to_mesh_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "resolution_mode", 0, IFACE_("Resolution"), ICON_NONE);
}
static void geo_node_volume_to_mesh_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeGeometryVolumeToMesh *data = (NodeGeometryVolumeToMesh *)MEM_callocN(
sizeof(NodeGeometryVolumeToMesh), __func__);
@@ -68,7 +68,7 @@ static void geo_node_volume_to_mesh_init(bNodeTree *UNUSED(ntree), bNode *node)
node->storage = data;
}
static void geo_node_volume_to_mesh_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeGeometryVolumeToMesh *data = (NodeGeometryVolumeToMesh *)node->storage;
@@ -140,7 +140,7 @@ static void create_mesh_from_volume(GeometrySet &geometry_set_in,
#endif /* WITH_OPENVDB */
static void geo_node_volume_to_mesh_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set_in = params.extract_input<GeometrySet>("Geometry");
GeometrySet geometry_set_out;
@@ -155,21 +155,23 @@ static void geo_node_volume_to_mesh_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set_out);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_legacy_volume_to_mesh_cc
void register_node_type_geo_legacy_volume_to_mesh()
{
namespace file_ns = blender::nodes::node_geo_legacy_volume_to_mesh_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_LEGACY_VOLUME_TO_MESH, "Volume to Mesh", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_volume_to_mesh_declare;
ntype.declare = file_ns::node_declare;
node_type_storage(
&ntype, "NodeGeometryVolumeToMesh", node_free_standard_storage, node_copy_standard_storage);
node_type_size(&ntype, 170, 120, 700);
node_type_init(&ntype, blender::nodes::geo_node_volume_to_mesh_init);
node_type_update(&ntype, blender::nodes::geo_node_volume_to_mesh_update);
ntype.geometry_node_execute = blender::nodes::geo_node_volume_to_mesh_exec;
ntype.draw_buttons = blender::nodes::geo_node_volume_to_mesh_layout;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -21,9 +21,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_attribute_capture_cc {
static void geo_node_attribute_capture_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Vector>(N_("Value")).supports_field();
@@ -40,9 +40,7 @@ static void geo_node_attribute_capture_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Int>(N_("Attribute"), "Attribute_004").field_source();
}
static void geo_node_attribute_capture_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -50,7 +48,7 @@ static void geo_node_attribute_capture_layout(uiLayout *layout,
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
}
static void geo_node_attribute_capture_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryAttributeCapture *data = (NodeGeometryAttributeCapture *)MEM_callocN(
sizeof(NodeGeometryAttributeCapture), __func__);
@@ -60,7 +58,7 @@ static void geo_node_attribute_capture_init(bNodeTree *UNUSED(tree), bNode *node
node->storage = data;
}
static void geo_node_attribute_capture_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
const NodeGeometryAttributeCapture &storage = *(const NodeGeometryAttributeCapture *)
node->storage;
@@ -113,7 +111,7 @@ static void try_capture_field_on_geometry(GeometryComponent &component,
output_attribute.save();
}
static void geo_node_attribute_capture_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -200,10 +198,12 @@ static void geo_node_attribute_capture_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_attribute_capture_cc
void register_node_type_geo_attribute_capture()
{
namespace file_ns = blender::nodes::node_geo_attribute_capture_cc;
static bNodeType ntype;
geo_node_type_base(
@@ -212,10 +212,10 @@ void register_node_type_geo_attribute_capture()
"NodeGeometryAttributeCapture",
node_free_standard_storage,
node_copy_standard_storage);
node_type_init(&ntype, blender::nodes::geo_node_attribute_capture_init);
node_type_update(&ntype, blender::nodes::geo_node_attribute_capture_update);
ntype.declare = blender::nodes::geo_node_attribute_capture_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_capture_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_capture_layout;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -16,9 +16,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_attribute_remove_cc {
static void geo_node_attribute_remove_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Attribute")).multi_input();
@@ -42,7 +42,7 @@ static void remove_attribute(GeometryComponent &component,
}
}
static void geo_node_attribute_remove_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
Vector<std::string> attribute_names = params.extract_multi_input<std::string>("Attribute");
@@ -66,15 +66,17 @@ static void geo_node_attribute_remove_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_attribute_remove_cc
void register_node_type_geo_attribute_remove()
{
namespace file_ns = blender::nodes::node_geo_attribute_remove_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_ATTRIBUTE_REMOVE, "Attribute Remove", NODE_CLASS_ATTRIBUTE, 0);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_remove_exec;
ntype.declare = blender::nodes::geo_node_attribute_remove_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.declare = file_ns::node_declare;
nodeRegisterType(&ntype);
}

View File

@@ -24,9 +24,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_attribute_statistic_cc {
static void geo_node_attribute_statistic_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Float>(N_("Attribute")).hide_value().supports_field();
@@ -51,21 +51,19 @@ static void geo_node_attribute_statistic_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Vector>(N_("Variance"), "Variance_001");
}
static void geo_node_attribute_statistic_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
uiItemR(layout, ptr, "domain", 0, "", ICON_NONE);
}
static void geo_node_attribute_statistic_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
node->custom1 = CD_PROP_FLOAT;
node->custom2 = ATTR_DOMAIN_POINT;
}
static void geo_node_attribute_statistic_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
bNodeSocket *socket_geo = (bNodeSocket *)node->inputs.first;
bNodeSocket *socket_float_attr = socket_geo->next;
@@ -170,7 +168,7 @@ static void set_empty(CustomDataType data_type, GeoNodeExecParams &params)
}
}
static void geo_node_attribute_statistic_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.get_input<GeometrySet>("Geometry");
@@ -360,19 +358,21 @@ static void geo_node_attribute_statistic_exec(GeoNodeExecParams params)
}
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_attribute_statistic_cc
void register_node_type_geo_attribute_statistic()
{
namespace file_ns = blender::nodes::node_geo_attribute_statistic_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_ATTRIBUTE_STATISTIC, "Attribute Statistic", NODE_CLASS_ATTRIBUTE, 0);
ntype.declare = blender::nodes::geo_node_attribute_statistic_declare;
node_type_init(&ntype, blender::nodes::geo_node_attribute_statistic_init);
node_type_update(&ntype, blender::nodes::geo_node_attribute_statistic_update);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_statistic_exec;
ntype.draw_buttons = blender::nodes::geo_node_attribute_statistic_layout;
ntype.declare = file_ns::node_declare;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -23,9 +23,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_boolean_cc {
static void geo_node_boolean_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh 1"))
.only_realized_data()
@@ -36,12 +36,12 @@ static void geo_node_boolean_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Mesh"));
}
static void geo_node_boolean_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
}
static void geo_node_boolean_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
GeometryNodeBooleanOperation operation = (GeometryNodeBooleanOperation)node->custom1;
@@ -63,12 +63,12 @@ static void geo_node_boolean_update(bNodeTree *ntree, bNode *node)
}
}
static void geo_node_boolean_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
node->custom1 = GEO_NODE_BOOLEAN_DIFFERENCE;
}
static void geo_node_boolean_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometryNodeBooleanOperation operation = (GeometryNodeBooleanOperation)params.node().custom1;
const bool use_self = params.get_input<bool>("Self Intersection");
@@ -119,17 +119,19 @@ static void geo_node_boolean_exec(GeoNodeExecParams params)
params.set_output("Mesh", GeometrySet::create_with_mesh(result));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_boolean_cc
void register_node_type_geo_boolean()
{
namespace file_ns = blender::nodes::node_geo_boolean_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_MESH_BOOLEAN, "Mesh Boolean", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_boolean_declare;
ntype.draw_buttons = blender::nodes::geo_node_boolean_layout;
ntype.updatefunc = blender::nodes::geo_node_boolean_update;
node_type_init(&ntype, blender::nodes::geo_node_boolean_init);
ntype.geometry_node_execute = blender::nodes::geo_node_boolean_exec;
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
ntype.updatefunc = file_ns::node_update;
node_type_init(&ntype, file_ns::node_init);
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -16,9 +16,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_bounding_box_cc {
static void geo_node_bounding_box_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Bounding Box"));
@@ -26,7 +26,7 @@ static void geo_node_bounding_box_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Vector>(N_("Max"));
}
static void geo_node_bounding_box_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -78,14 +78,16 @@ static void geo_node_bounding_box_exec(GeoNodeExecParams params)
}
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_bounding_box_cc
void register_node_type_geo_bounding_box()
{
namespace file_ns = blender::nodes::node_geo_bounding_box_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_BOUNDING_BOX, "Bounding Box", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_bounding_box_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_bounding_box_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -27,9 +27,9 @@
#include <algorithm>
namespace blender::nodes {
namespace blender::nodes::node_geo_collection_info_cc {
static void geo_node_collection_info_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Collection>(N_("Collection")).hide_label();
b.add_input<decl::Bool>(N_("Separate Children"))
@@ -42,12 +42,12 @@ static void geo_node_collection_info_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Geometry"));
}
static void geo_node_collection_info_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "transform_space", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
}
static void geo_node_collection_info_node_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCollectionInfo *data = (NodeGeometryCollectionInfo *)MEM_callocN(
sizeof(NodeGeometryCollectionInfo), __func__);
@@ -61,7 +61,7 @@ struct InstanceListEntry {
float4x4 transform;
};
static void geo_node_collection_info_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
Collection *collection = params.get_input<Collection *>("Collection");
@@ -155,20 +155,22 @@ static void geo_node_collection_info_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set_out);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_collection_info_cc
void register_node_type_geo_collection_info()
{
namespace file_ns = blender::nodes::node_geo_collection_info_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_COLLECTION_INFO, "Collection Info", NODE_CLASS_INPUT, 0);
ntype.declare = blender::nodes::geo_node_collection_info_declare;
node_type_init(&ntype, blender::nodes::geo_node_collection_info_node_init);
ntype.declare = file_ns::node_declare;
node_type_init(&ntype, file_ns::node_node_init);
node_type_storage(&ntype,
"NodeGeometryCollectionInfo",
node_free_standard_storage,
node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_collection_info_exec;
ntype.draw_buttons = blender::nodes::geo_node_collection_info_layout;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -28,9 +28,9 @@
# include "RBI_hull_api.h"
#endif
namespace blender::nodes {
namespace blender::nodes::node_geo_convex_hull_cc {
static void geo_node_convex_hull_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Convex Hull"));
@@ -296,7 +296,7 @@ static Mesh *convex_hull_from_instances(const GeometrySet &geometry_set)
#endif /* WITH_BULLET */
static void geo_node_convex_hull_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
@@ -316,14 +316,16 @@ static void geo_node_convex_hull_exec(GeoNodeExecParams params)
#endif /* WITH_BULLET */
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_convex_hull_cc
void register_node_type_geo_convex_hull()
{
namespace file_ns = blender::nodes::node_geo_convex_hull_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_CONVEX_HULL, "Convex Hull", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_convex_hull_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_convex_hull_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -21,9 +21,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_curve_endpoint_select_cc {
static void geo_node_curve_endpoint_selection_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Int>(N_("Start Size"))
.min(0)
@@ -131,23 +131,25 @@ class EndpointFieldInput final : public fn::FieldInput {
}
};
static void geo_node_curve_endpoint_selection_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
Field<int> start_size = params.extract_input<Field<int>>("Start Size");
Field<int> end_size = params.extract_input<Field<int>>("End Size");
Field<bool> selection_field{std::make_shared<EndpointFieldInput>(start_size, end_size)};
params.set_output("Selection", std::move(selection_field));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_curve_endpoint_select_cc
void register_node_type_geo_curve_endpoint_selection()
{
namespace file_ns = blender::nodes::node_geo_curve_endpoint_select_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_CURVE_ENDPOINT_SELECTION, "Endpoint Selection", NODE_CLASS_INPUT, 0);
ntype.declare = blender::nodes::geo_node_curve_endpoint_selection_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_endpoint_selection_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -31,20 +31,20 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_curve_fill_cc {
static void geo_node_curve_fill_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_output<decl::Geometry>(N_("Mesh"));
}
static void geo_node_curve_fill_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
}
static void geo_node_curve_fill_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeGeometryCurveFill *data = (NodeGeometryCurveFill *)MEM_callocN(sizeof(NodeGeometryCurveFill),
__func__);
@@ -147,7 +147,7 @@ static void curve_fill_calculate(GeometrySet &geometry_set, const GeometryNodeCu
geometry_set.replace_curve(nullptr);
}
static void geo_node_curve_fill_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Curve");
@@ -160,19 +160,21 @@ static void geo_node_curve_fill_exec(GeoNodeExecParams params)
params.set_output("Mesh", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_curve_fill_cc
void register_node_type_geo_curve_fill()
{
namespace file_ns = blender::nodes::node_geo_curve_fill_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_FILL_CURVE, "Fill Curve", NODE_CLASS_GEOMETRY, 0);
node_type_init(&ntype, blender::nodes::geo_node_curve_fill_init);
node_type_init(&ntype, file_ns::node_init);
node_type_storage(
&ntype, "NodeGeometryCurveFill", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_curve_fill_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_fill_exec;
ntype.draw_buttons = blender::nodes::geo_node_curve_fill_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -25,9 +25,9 @@
#include "BKE_spline.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_curve_fillet_cc {
static void geo_node_curve_fillet_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Int>(N_("Count")).default_value(1).min(1).max(1000).supports_field();
@@ -41,12 +41,12 @@ static void geo_node_curve_fillet_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Curve"));
}
static void geo_node_curve_fillet_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
}
static void geo_node_curve_fillet_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurveFillet *data = (NodeGeometryCurveFillet *)MEM_callocN(
sizeof(NodeGeometryCurveFillet), __func__);
@@ -76,7 +76,7 @@ struct FilletData {
Array<int> counts;
};
static void geo_node_curve_fillet_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
NodeGeometryCurveFillet &node_storage = *(NodeGeometryCurveFillet *)node->storage;
const GeometryNodeCurveFilletMode mode = (GeometryNodeCurveFilletMode)node_storage.mode;
@@ -607,7 +607,7 @@ static void calculate_curve_fillet(GeometrySet &geometry_set,
geometry_set.replace_curve(output_curve.release());
}
static void geo_node_fillet_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Curve");
@@ -629,19 +629,21 @@ static void geo_node_fillet_exec(GeoNodeExecParams params)
params.set_output("Curve", std::move(geometry_set));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_curve_fillet_cc
void register_node_type_geo_curve_fillet()
{
namespace file_ns = blender::nodes::node_geo_curve_fillet_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_FILLET_CURVE, "Fillet Curve", NODE_CLASS_GEOMETRY, 0);
ntype.draw_buttons = blender::nodes::geo_node_curve_fillet_layout;
ntype.draw_buttons = file_ns::node_layout;
node_type_storage(
&ntype, "NodeGeometryCurveFillet", node_free_standard_storage, node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_curve_fillet_declare;
node_type_init(&ntype, blender::nodes::geo_node_curve_fillet_init);
node_type_update(&ntype, blender::nodes::geo_node_curve_fillet_update);
ntype.geometry_node_execute = blender::nodes::geo_node_fillet_exec;
ntype.declare = file_ns::node_declare;
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -21,22 +21,20 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_curve_handle_type_selection_cc {
static void geo_node_curve_handle_type_selection_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Bool>(N_("Selection")).field_source();
}
static void geo_node_curve_handle_type_selection_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
uiItemR(layout, ptr, "handle_type", 0, "", ICON_NONE);
}
static void geo_node_curve_handle_type_selection_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurveSelectHandles *data = (NodeGeometryCurveSelectHandles *)MEM_callocN(
sizeof(NodeGeometryCurveSelectHandles), __func__);
@@ -140,7 +138,7 @@ class HandleTypeFieldInput final : public fn::FieldInput {
}
};
static void geo_node_curve_handle_type_selection_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
const NodeGeometryCurveSelectHandles *storage =
(const NodeGeometryCurveSelectHandles *)params.node().storage;
@@ -152,22 +150,24 @@ static void geo_node_curve_handle_type_selection_exec(GeoNodeExecParams params)
params.set_output("Selection", std::move(selection_field));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_curve_handle_type_selection_cc
void register_node_type_geo_curve_handle_type_selection()
{
namespace file_ns = blender::nodes::node_geo_curve_handle_type_selection_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, "Handle Type Selection", NODE_CLASS_INPUT, 0);
ntype.declare = blender::nodes::geo_node_curve_handle_type_selection_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_handle_type_selection_exec;
node_type_init(&ntype, blender::nodes::geo_node_curve_handle_type_selection_init);
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
node_type_init(&ntype, file_ns::node_init);
node_type_storage(&ntype,
"NodeGeometryCurveSelectHandles",
node_free_standard_storage,
node_copy_standard_storage);
ntype.draw_buttons = blender::nodes::geo_node_curve_handle_type_selection_layout;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -17,15 +17,15 @@
#include "BKE_spline.hh"
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_curve_length_cc {
static void geo_node_curve_length_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_output<decl::Float>(N_("Length"));
}
static void geo_node_curve_length_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
GeometrySet curve_set = params.extract_input<GeometrySet>("Curve");
if (!curve_set.has_curve()) {
@@ -40,14 +40,16 @@ static void geo_node_curve_length_exec(GeoNodeExecParams params)
params.set_output("Length", length);
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_curve_length_cc
void register_node_type_geo_curve_length()
{
namespace file_ns = blender::nodes::node_geo_curve_length_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_CURVE_LENGTH, "Curve Length", NODE_CLASS_GEOMETRY, 0);
ntype.declare = blender::nodes::geo_node_curve_length_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_length_exec;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -20,9 +20,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_curve_parameter_cc {
static void geo_node_curve_parameter_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Float>(N_("Factor"))
.field_source()
@@ -261,7 +261,7 @@ class CurveLengthFieldInput final : public fn::FieldInput {
}
};
static void geo_node_curve_parameter_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
Field<float> parameter_field{std::make_shared<CurveParameterFieldInput>()};
Field<float> length_field{std::make_shared<CurveLengthFieldInput>()};
@@ -269,13 +269,15 @@ static void geo_node_curve_parameter_exec(GeoNodeExecParams params)
params.set_output("Length", std::move(length_field));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_curve_parameter_cc
void register_node_type_geo_curve_parameter()
{
namespace file_ns = blender::nodes::node_geo_curve_parameter_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_CURVE_PARAMETER, "Curve Parameter", NODE_CLASS_INPUT, 0);
ntype.geometry_node_execute = blender::nodes::geo_node_curve_parameter_exec;
ntype.declare = blender::nodes::geo_node_curve_parameter_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.declare = file_ns::node_declare;
nodeRegisterType(&ntype);
}

View File

@@ -21,9 +21,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_curve_primitive_bezier_segment_cc {
static void geo_node_curve_primitive_bezier_segment_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Int>(N_("Resolution"))
.default_value(16)
@@ -53,14 +53,12 @@ static void geo_node_curve_primitive_bezier_segment_declare(NodeDeclarationBuild
b.add_output<decl::Geometry>(N_("Curve"));
}
static void geo_node_curve_primitive_bezier_segment_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
}
static void geo_node_curve_primitive_bezier_segment_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurvePrimitiveBezierSegment *data = (NodeGeometryCurvePrimitiveBezierSegment *)
MEM_callocN(sizeof(NodeGeometryCurvePrimitiveBezierSegment), __func__);
@@ -120,7 +118,7 @@ static std::unique_ptr<CurveEval> create_bezier_segment_curve(
return curve;
}
static void geo_node_curve_primitive_bezier_segment_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
const NodeGeometryCurvePrimitiveBezierSegment *node_storage =
(NodeGeometryCurvePrimitiveBezierSegment *)params.node().storage;
@@ -137,20 +135,22 @@ static void geo_node_curve_primitive_bezier_segment_exec(GeoNodeExecParams param
params.set_output("Curve", GeometrySet::create_with_curve(curve.release()));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_curve_primitive_bezier_segment_cc
void register_node_type_geo_curve_primitive_bezier_segment()
{
namespace file_ns = blender::nodes::node_geo_curve_primitive_bezier_segment_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, "Bezier Segment", NODE_CLASS_GEOMETRY, 0);
node_type_init(&ntype, blender::nodes::geo_node_curve_primitive_bezier_segment_init);
node_type_init(&ntype, file_ns::node_init);
node_type_storage(&ntype,
"NodeGeometryCurvePrimitiveBezierSegment",
node_free_standard_storage,
node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_curve_primitive_bezier_segment_declare;
ntype.draw_buttons = blender::nodes::geo_node_curve_primitive_bezier_segment_layout;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_primitive_bezier_segment_exec;
ntype.declare = file_ns::node_declare;
ntype.draw_buttons = file_ns::node_layout;
ntype.geometry_node_execute = file_ns::node_geo_exec;
nodeRegisterType(&ntype);
}

View File

@@ -21,9 +21,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_curve_primitive_circle_cc {
static void geo_node_curve_primitive_circle_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Int>(N_("Resolution"))
.default_value(32)
@@ -57,14 +57,12 @@ static void geo_node_curve_primitive_circle_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Vector>(N_("Center"));
}
static void geo_node_curve_primitive_circle_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
}
static void geo_node_curve_primitive_circle_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurvePrimitiveCircle *data = (NodeGeometryCurvePrimitiveCircle *)MEM_callocN(
sizeof(NodeGeometryCurvePrimitiveCircle), __func__);
@@ -73,7 +71,7 @@ static void geo_node_curve_primitive_circle_init(bNodeTree *UNUSED(tree), bNode
node->storage = data;
}
static void geo_node_curve_primitive_circle_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
const NodeGeometryCurvePrimitiveCircle *node_storage = (NodeGeometryCurvePrimitiveCircle *)
node->storage;
@@ -195,7 +193,7 @@ static std::unique_ptr<CurveEval> create_radius_circle_curve(const int resolutio
return curve;
}
static void geo_node_curve_primitive_circle_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
const NodeGeometryCurvePrimitiveCircle *node_storage =
(NodeGeometryCurvePrimitiveCircle *)params.node().storage;
@@ -226,22 +224,24 @@ static void geo_node_curve_primitive_circle_exec(GeoNodeExecParams params)
}
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_curve_primitive_circle_cc
void register_node_type_geo_curve_primitive_circle()
{
namespace file_ns = blender::nodes::node_geo_curve_primitive_circle_cc;
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_CURVE_PRIMITIVE_CIRCLE, "Curve Circle", NODE_CLASS_GEOMETRY, 0);
node_type_init(&ntype, blender::nodes::geo_node_curve_primitive_circle_init);
node_type_update(&ntype, blender::nodes::geo_node_curve_primitive_circle_update);
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
node_type_storage(&ntype,
"NodeGeometryCurvePrimitiveCircle",
node_free_standard_storage,
node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_curve_primitive_circle_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_primitive_circle_exec;
ntype.draw_buttons = blender::nodes::geo_node_curve_primitive_circle_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

View File

@@ -21,9 +21,9 @@
#include "node_geometry_util.hh"
namespace blender::nodes {
namespace blender::nodes::node_geo_curve_primitive_line_cc {
static void geo_node_curve_primitive_line_declare(NodeDeclarationBuilder &b)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Vector>(N_("Start"))
.subtype(PROP_TRANSLATION)
@@ -43,14 +43,12 @@ static void geo_node_curve_primitive_line_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Geometry>(N_("Curve"));
}
static void geo_node_curve_primitive_line_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
}
static void geo_node_curve_primitive_line_init(bNodeTree *UNUSED(tree), bNode *node)
static void node_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurvePrimitiveLine *data = (NodeGeometryCurvePrimitiveLine *)MEM_callocN(
sizeof(NodeGeometryCurvePrimitiveLine), __func__);
@@ -59,7 +57,7 @@ static void geo_node_curve_primitive_line_init(bNodeTree *UNUSED(tree), bNode *n
node->storage = data;
}
static void geo_node_curve_primitive_line_update(bNodeTree *ntree, bNode *node)
static void node_update(bNodeTree *ntree, bNode *node)
{
const NodeGeometryCurvePrimitiveLine *node_storage = (NodeGeometryCurvePrimitiveLine *)
node->storage;
@@ -112,7 +110,7 @@ static std::unique_ptr<CurveEval> create_direction_line_curve(const float3 start
return curve;
}
static void geo_node_curve_primitive_line_exec(GeoNodeExecParams params)
static void node_geo_exec(GeoNodeExecParams params)
{
const NodeGeometryCurvePrimitiveLine *node_storage =
@@ -134,20 +132,22 @@ static void geo_node_curve_primitive_line_exec(GeoNodeExecParams params)
params.set_output("Curve", GeometrySet::create_with_curve(curve.release()));
}
} // namespace blender::nodes
} // namespace blender::nodes::node_geo_curve_primitive_line_cc
void register_node_type_geo_curve_primitive_line()
{
namespace file_ns = blender::nodes::node_geo_curve_primitive_line_cc;
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_CURVE_PRIMITIVE_LINE, "Curve Line", NODE_CLASS_GEOMETRY, 0);
node_type_init(&ntype, blender::nodes::geo_node_curve_primitive_line_init);
node_type_update(&ntype, blender::nodes::geo_node_curve_primitive_line_update);
node_type_init(&ntype, file_ns::node_init);
node_type_update(&ntype, file_ns::node_update);
node_type_storage(&ntype,
"NodeGeometryCurvePrimitiveLine",
node_free_standard_storage,
node_copy_standard_storage);
ntype.declare = blender::nodes::geo_node_curve_primitive_line_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_primitive_line_exec;
ntype.draw_buttons = blender::nodes::geo_node_curve_primitive_line_layout;
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
nodeRegisterType(&ntype);
}

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