Merge branch 'master' into sculpt-dev

This commit is contained in:
Pablo Dobarro 2021-01-20 18:56:37 +01:00
commit c10b19e453
157 changed files with 1542 additions and 1175 deletions

View File

@ -20,6 +20,8 @@
# <pep8 compliant>
# Note: this code should be cleaned up / refactored.
import sys
if sys.version_info.major < 3:
print("\nPython3.x needed, found %s.\nAborting!\n" %
@ -37,12 +39,23 @@ from cmake_consistency_check_config import (
import os
from os.path import join, dirname, normpath, splitext
from os.path import (
dirname,
join,
normpath,
splitext,
)
global_h = set()
global_c = set()
global_refs = {}
# Flatten `IGNORE_SOURCE_MISSING` to avoid nested looping.
IGNORE_SOURCE_MISSING = [
(k, ignore_path) for k, ig_list in IGNORE_SOURCE_MISSING
for ignore_path in ig_list
]
# Ignore cmake file, path pairs.
global_ignore_source_missing = {}
for k, v in IGNORE_SOURCE_MISSING:
@ -178,6 +191,8 @@ def cmake_get_src(f):
if not l:
pass
elif l in local_ignore_source_missing:
local_ignore_source_missing.remove(l)
elif l.startswith("$"):
if context_name == "SRC":
# assume if it ends with context_name we know about it
@ -227,10 +242,7 @@ def cmake_get_src(f):
# replace_line(f, i - 1, new_path_rel)
else:
if l in local_ignore_source_missing:
local_ignore_source_missing.remove(l)
else:
raise Exception("non existent include %s:%d -> %s" % (f, i, new_file))
raise Exception("non existent include %s:%d -> %s" % (f, i, new_file))
# print(new_file)
@ -258,16 +270,16 @@ def cmake_get_src(f):
def is_ignore_source(f, ignore_used):
for index, ig in enumerate(IGNORE_SOURCE):
if ig in f:
for index, ignore_path in enumerate(IGNORE_SOURCE):
if ignore_path in f:
ignore_used[index] = True
return True
return False
def is_ignore_cmake(f, ignore_used):
for index, ig in enumerate(IGNORE_CMAKE):
if ig in f:
for index, ignore_path in enumerate(IGNORE_CMAKE):
if ignore_path in f:
ignore_used[index] = True
return True
return False
@ -298,7 +310,7 @@ def main():
for cf, i in refs:
errs.append((cf, i))
else:
raise Exception("CMake referenecs missing, internal error, aborting!")
raise Exception("CMake references missing, internal error, aborting!")
is_err = True
errs.sort()
@ -309,7 +321,7 @@ def main():
# print("sed '%dd' '%s' > '%s.tmp' ; mv '%s.tmp' '%s'" % (i, cf, cf, cf, cf))
if is_err:
raise Exception("CMake referenecs missing files, aborting!")
raise Exception("CMake references missing files, aborting!")
del is_err
del errs
@ -320,7 +332,7 @@ def main():
if cf not in global_c:
print("missing_c: ", cf)
# check if automake builds a corrasponding .o file.
# Check if automake builds a corresponding .o file.
'''
if cf in global_c:
out1 = os.path.splitext(cf)[0] + ".o"
@ -356,21 +368,21 @@ def main():
# Check ignores aren't stale
print("\nCheck for unused 'IGNORE_SOURCE' paths...")
for index, ig in enumerate(IGNORE_SOURCE):
for index, ignore_path in enumerate(IGNORE_SOURCE):
if not ignore_used_source[index]:
print("unused ignore: %r" % ig)
print("unused ignore: %r" % ignore_path)
# Check ignores aren't stale
print("\nCheck for unused 'IGNORE_SOURCE_MISSING' paths...")
for k, v in sorted(global_ignore_source_missing.items()):
for ig in v:
print("unused ignore: %r -> %r" % (ig, k))
for ignore_path in v:
print("unused ignore: %r -> %r" % (ignore_path, k))
# Check ignores aren't stale
print("\nCheck for unused 'IGNORE_CMAKE' paths...")
for index, ig in enumerate(IGNORE_CMAKE):
for index, ignore_path in enumerate(IGNORE_CMAKE):
if not ignore_used_cmake[index]:
print("unused ignore: %r" % ig)
print("unused ignore: %r" % ignore_path)
if __name__ == "__main__":

View File

@ -34,8 +34,18 @@ IGNORE_SOURCE = (
# Ignore cmake file, path pairs.
IGNORE_SOURCE_MISSING = (
# Use for cycles stand-alone.
("intern/cycles/util/CMakeLists.txt", "../../third_party/numaapi/include"),
( # Use for cycles stand-alone.
"intern/cycles/util/CMakeLists.txt", (
"../../third_party/numaapi/include",
)),
( # Use for `WITH_NANOVDB`.
"intern/cycles/kernel/CMakeLists.txt", (
"nanovdb/util/CSampleFromVoxels.h",
"nanovdb/util/SampleFromVoxels.h",
"nanovdb/NanoVDB.h",
"nanovdb/CNanoVDB.h",
),
),
)
IGNORE_CMAKE = (

View File

@ -853,7 +853,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
preview_samples = preview_samples * preview_samples;
}
if (get_enum(cscene, "progressive") == 0 && (params.device.type != DEVICE_OPTIX)) {
if (get_enum(cscene, "progressive") == 0 && params.device.has_branched_path) {
if (background) {
params.samples = aa_samples;
}

View File

@ -620,6 +620,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
info.has_half_images = true;
info.has_volume_decoupled = true;
info.has_branched_path = true;
info.has_adaptive_stop_per_sample = true;
info.has_osl = true;
info.has_profiling = true;
@ -665,6 +666,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
/* Accumulate device info. */
info.has_half_images &= device.has_half_images;
info.has_volume_decoupled &= device.has_volume_decoupled;
info.has_branched_path &= device.has_branched_path;
info.has_adaptive_stop_per_sample &= device.has_adaptive_stop_per_sample;
info.has_osl &= device.has_osl;
info.has_profiling &= device.has_profiling;

View File

@ -79,6 +79,7 @@ class DeviceInfo {
bool display_device; /* GPU is used as a display device. */
bool has_half_images; /* Support half-float textures. */
bool has_volume_decoupled; /* Decoupled volume shading. */
bool has_branched_path; /* Supports branched path tracing. */
bool has_adaptive_stop_per_sample; /* Per-sample adaptive sampling stopping. */
bool has_osl; /* Support Open Shading Language. */
bool use_split_kernel; /* Use split or mega kernel. */
@ -99,6 +100,7 @@ class DeviceInfo {
display_device = false;
has_half_images = false;
has_volume_decoupled = false;
has_branched_path = true;
has_adaptive_stop_per_sample = false;
has_osl = false;
use_split_kernel = false;

View File

@ -1857,6 +1857,7 @@ void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo
info.type = DEVICE_OPTIX;
info.id += "_OptiX";
info.denoisers |= DENOISER_OPTIX;
info.has_branched_path = false;
devices.push_back(info);
}

View File

@ -43,7 +43,7 @@ class ColorSpaceProcessor;
*
* Data needed by OSL render services, that is global to a rendering session.
* This includes all OSL shaders, name to attribute mapping and texture handles.
* */
*/
struct OSLGlobals {
OSLGlobals()

View File

@ -168,7 +168,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
FLT_MAX :
sample_clamp_indirect * 3.0f;
kintegrator->branched = (method == BRANCHED_PATH);
kintegrator->branched = (method == BRANCHED_PATH) && device->info.has_branched_path;
kintegrator->volume_decoupled = device->info.has_volume_decoupled;
kintegrator->diffuse_samples = diffuse_samples;
kintegrator->glossy_samples = glossy_samples;
@ -179,7 +179,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
kintegrator->volume_samples = volume_samples;
kintegrator->start_sample = start_sample;
if (method == BRANCHED_PATH) {
if (kintegrator->branched) {
kintegrator->sample_all_lights_direct = sample_all_lights_direct;
kintegrator->sample_all_lights_indirect = sample_all_lights_indirect;
}
@ -224,7 +224,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
/* sobol directions table */
int max_samples = 1;
if (method == BRANCHED_PATH) {
if (kintegrator->branched) {
foreach (Light *light, scene->lights)
max_samples = max(max_samples, light->get_samples());

View File

@ -540,6 +540,10 @@ bool Session::acquire_tile(RenderTile &rtile, Device *tile_device, uint tile_typ
tile->buffers = new RenderBuffers(tile_device);
tile->buffers->reset(buffer_params);
}
else if (tile->buffers->buffer.device != tile_device) {
/* Move buffer to current tile device again in case it was stolen before. */
tile->buffers->buffer.move_device(tile_device);
}
tile->buffers->map_neighbor_copied = false;

View File

@ -103,10 +103,10 @@ class SessionParams {
bool modified(const SessionParams &params)
{
/* Modified means we have to recreate the session, any parameter changes
* that can be handled by an existing Session are omitted. */
return !(device == params.device && background == params.background &&
progressive_refine == params.progressive_refine &&
/* samples == params.samples && denoising_start_sample ==
params.denoising_start_sample && */
progressive == params.progressive && experimental == params.experimental &&
tile_size == params.tile_size && start_resolution == params.start_resolution &&
pixel_size == params.pixel_size && threads == params.threads &&
@ -117,7 +117,8 @@ class SessionParams {
text_timeout == params.text_timeout &&
progressive_update_timeout == params.progressive_update_timeout &&
tile_order == params.tile_order && shadingsystem == params.shadingsystem &&
denoising.type == params.denoising.type);
denoising.type == params.denoising.type &&
(denoising.use == params.denoising.use || (device.denoisers & denoising.type)));
}
};

View File

@ -55,11 +55,15 @@ set(SRC
)
if(CXX_HAS_AVX)
list(APPEND SRC util_avxf_avx_test.cpp)
list(APPEND SRC
util_avxf_avx_test.cpp
)
set_source_files_properties(util_avxf_avx_test.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX_KERNEL_FLAGS}")
endif()
if(CXX_HAS_AVX2)
list(APPEND SRC util_avxf_avx2_test.cpp)
list(APPEND SRC
util_avxf_avx2_test.cpp
)
set_source_files_properties(util_avxf_avx2_test.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
endif()

View File

@ -122,7 +122,7 @@ extern void *(*MEM_calloc_arrayN)(size_t len,
/**
* Allocate a block of memory of size len, with tag name str. The
* name must be a static, because only a pointer to it is stored !
* */
*/
extern void *(*MEM_mallocN)(size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT
ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2);
@ -130,7 +130,7 @@ extern void *(*MEM_mallocN)(size_t len, const char *str) /* ATTR_MALLOC */ ATTR_
* Allocate a block of memory of size (len * size), with tag name str,
* aborting in case of integer overflow to prevent vulnerabilities. The
* name must be a static, because only a pointer to it is stored !
* */
*/
extern void *(*MEM_malloc_arrayN)(size_t len,
size_t size,
const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT
@ -139,7 +139,7 @@ extern void *(*MEM_malloc_arrayN)(size_t len,
/**
* Allocate an aligned block of memory of size len, with tag name str. The
* name must be a static, because only a pointer to it is stored !
* */
*/
extern void *(*MEM_mallocN_aligned)(size_t len,
size_t alignment,
const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT

View File

@ -290,11 +290,16 @@ def _template_items_uv_select_mode(params):
]
def _template_items_proportional_editing(*, connected=False):
def _template_items_proportional_editing(params, *, connected, toggle_data_path):
return [
op_menu_pie("VIEW3D_MT_proportional_editing_falloff_pie", {"type": 'O', "value": 'PRESS', "shift": True}),
(
op_menu_pie("VIEW3D_MT_proportional_editing_falloff_pie", {"type": 'O', "value": 'PRESS', "shift": True})
if not params.legacy else
("wm.context_cycle_enum", {"type": 'O', "value": 'PRESS', "shift": True},
{"properties": [("data_path", 'tool_settings.proportional_edit_falloff'), ("wrap", True)]})
),
("wm.context_toggle", {"type": 'O', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.use_proportional_edit')]}),
{"properties": [("data_path", toggle_data_path)]}),
*(() if not connected else (
("wm.context_toggle", {"type": 'O', "value": 'PRESS', "alt": True},
{"properties": [("data_path", 'tool_settings.use_proportional_connected')]}),
@ -918,9 +923,14 @@ def km_uv_editor(params):
("uv.hide", {"type": 'H', "value": 'PRESS', "shift": True},
{"properties": [("unselected", True)]}),
("uv.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None),
op_menu_pie("IMAGE_MT_uvs_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True}),
(
op_menu_pie("IMAGE_MT_uvs_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True})
if not params.legacy else
op_menu("IMAGE_MT_uvs_snap", {"type": 'S', "value": 'PRESS', "shift": True})
),
op_menu("IMAGE_MT_uvs_select_mode", {"type": 'TAB', "value": 'PRESS', "ctrl": True}),
*_template_items_proportional_editing(connected=False),
*_template_items_proportional_editing(
params, connected=False, toggle_data_path='tool_settings.use_proportional_edit'),
("transform.translate", {"type": 'G', "value": 'PRESS'}, None),
("transform.translate", {"type": params.select_tweak, "value": 'ANY'}, None),
("transform.rotate", {"type": 'R', "value": 'PRESS'}, None),
@ -1218,17 +1228,22 @@ def km_view3d(params):
("transform.tosphere", {"type": 'S', "value": 'PRESS', "shift": True, "alt": True}, None),
("transform.shear", {"type": 'S', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None),
("transform.mirror", {"type": 'M', "value": 'PRESS', "ctrl": True}, None),
("object.transform_axis_target", {"type": 'T', "value": 'PRESS', "shift": True}, None),
("transform.skin_resize", {"type": 'A', "value": 'PRESS', "ctrl": True}, None),
# Snapping.
("wm.context_toggle", {"type": 'TAB', "value": 'PRESS', "shift": True},
{"properties": [("data_path", 'tool_settings.use_snap')]}),
op_panel("VIEW3D_PT_snapping", {"type": 'TAB', "value": 'PRESS', "shift": True, "ctrl": True}, [("keep_open", True)]),
("object.transform_axis_target", {"type": 'T', "value": 'PRESS', "shift": True}, None),
("transform.skin_resize", {"type": 'A', "value": 'PRESS', "ctrl": True}, None),
(
op_menu_pie("VIEW3D_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True})
if not params.legacy else
op_menu("VIEW3D_MT_snap", {"type": 'S', "value": 'PRESS', "shift": True})
),
])
if not params.legacy:
# New pie menus.
items.extend([
op_menu_pie("VIEW3D_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True}),
("wm.context_toggle", {"type": 'ACCENT_GRAVE', "value": 'PRESS', "ctrl": True},
{"properties": [("data_path", 'space_data.show_gizmo')]}),
op_menu_pie("VIEW3D_MT_pivot_pie", {"type": 'PERIOD', "value": 'PRESS'}),
@ -1249,7 +1264,6 @@ def km_view3d(params):
else:
items.extend([
# Old navigation.
op_menu("VIEW3D_MT_snap", {"type": 'S', "value": 'PRESS', "shift": True}),
("view3d.view_lock_to_active", {"type": 'NUMPAD_PERIOD', "value": 'PRESS', "shift": True}, None),
("view3d.view_lock_clear", {"type": 'NUMPAD_PERIOD', "value": 'PRESS', "alt": True}, None),
("view3d.navigate", {"type": 'F', "value": 'PRESS', "shift": True}, None),
@ -1338,9 +1352,8 @@ def km_mask_editing(params):
items.extend([
("mask.new", {"type": 'N', "value": 'PRESS', "alt": True}, None),
op_menu("MASK_MT_add", {"type": 'A', "value": 'PRESS', "shift": True}),
op_menu_pie("VIEW3D_MT_proportional_editing_falloff_pie", {"type": 'O', "value": 'PRESS', "shift": True}),
("wm.context_toggle", {"type": 'O', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.use_proportional_edit_mask')]}),
*_template_items_proportional_editing(
params, connected=False, toggle_data_path='tool_settings.use_proportional_edit_mask'),
("mask.add_vertex_slide", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
("mask.add_feather_vertex_slide", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True}, None),
("mask.delete", {"type": 'X', "value": 'PRESS'}, None),
@ -1557,7 +1570,11 @@ def km_graph_editor(params):
("graph.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None),
("graph.select_linked", {"type": 'L', "value": 'PRESS'}, None),
("graph.frame_jump", {"type": 'G', "value": 'PRESS', "ctrl": True}, None),
op_menu_pie("GRAPH_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True}),
(
op_menu_pie("GRAPH_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True})
if not params.legacy else
("graph.snap", {"type": 'S', "value": 'PRESS', "shift": True}, None)
),
("graph.mirror", {"type": 'M', "value": 'PRESS', "ctrl": True}, None),
("graph.handle_type", {"type": 'V', "value": 'PRESS'}, None),
("graph.interpolation_type", {"type": 'T', "value": 'PRESS'}, None),
@ -1591,9 +1608,8 @@ def km_graph_editor(params):
{"properties": [("mode", 'TIME_EXTEND')]}),
("transform.rotate", {"type": 'R', "value": 'PRESS'}, None),
("transform.resize", {"type": 'S', "value": 'PRESS'}, None),
("wm.context_toggle", {"type": 'O', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.use_proportional_fcurve')]}),
op_menu_pie("VIEW3D_MT_proportional_editing_falloff_pie", {"type": 'O', "value": 'PRESS', "shift": True}),
*_template_items_proportional_editing(
params, connected=False, toggle_data_path='tool_settings.use_proportional_fcurve'),
("marker.add", {"type": 'M', "value": 'PRESS'}, None),
("marker.rename", {"type": 'M', "value": 'PRESS', "ctrl": True}, None),
*_template_items_context_menu("GRAPH_MT_context_menu", params.context_menu_event),
@ -1626,7 +1642,7 @@ def km_graph_editor(params):
return keymap
def km_image_generic(_params):
def km_image_generic(params):
items = []
keymap = (
"Image Generic",
@ -1644,12 +1660,20 @@ def km_image_generic(_params):
("image.reload", {"type": 'R', "value": 'PRESS', "alt": True}, None),
("image.read_viewlayers", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
("image.save", {"type": 'S', "value": 'PRESS', "alt": True}, None),
("image.save_as", {"type": 'S', "value": 'PRESS', "shift": True, "alt": True}, None),
("image.cycle_render_slot", {"type": 'J', "value": 'PRESS', "repeat": True}, None),
("image.cycle_render_slot", {"type": 'J', "value": 'PRESS', "alt": True, "repeat": True},
{"properties": [("reverse", True)]}),
])
if not params.legacy:
items.extend([
("image.save_as", {"type": 'S', "value": 'PRESS', "shift": True, "alt": True}, None),
])
else:
items.extend([
("image.save_as", {"type": 'F3', "value": 'PRESS'}, None),
])
return keymap
@ -1786,11 +1810,20 @@ def km_node_editor(params):
]
# Allow node selection with both for RMB select
if params.select_mouse == 'RIGHTMOUSE':
items.extend(node_select_ops('LEFTMOUSE'))
items.extend(node_select_ops('RIGHTMOUSE'))
if not params.legacy:
if params.select_mouse == 'RIGHTMOUSE':
items.extend(node_select_ops('LEFTMOUSE'))
items.extend(node_select_ops('RIGHTMOUSE'))
else:
items.extend(node_select_ops('LEFTMOUSE'))
else:
items.extend(node_select_ops('LEFTMOUSE'))
items.extend(node_select_ops('RIGHTMOUSE'))
items.extend([
("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS'},
{"properties": [("extend", False), ("deselect_all", False)]}),
("node.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
{"properties": [("extend", True)]}),
])
items.extend([
("node.select_box", {"type": params.select_tweak, "value": 'ANY'},
@ -1805,8 +1838,8 @@ def km_node_editor(params):
("node.link", {"type": 'EVT_TWEAK_L', "value": 'ANY', "ctrl": True},
{"properties": [("detach", True)]}),
("node.resize", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None),
("node.add_reroute", {"type": 'EVT_TWEAK_R', "value": 'ANY', "shift": True}, None),
("node.links_cut", {"type": 'EVT_TWEAK_R', "value": 'ANY', "ctrl": True}, None),
("node.add_reroute", {"type": 'EVT_TWEAK_L' if params.legacy else 'EVT_TWEAK_R', "value": 'ANY', "shift": True}, None),
("node.links_cut", {"type": 'EVT_TWEAK_L' if params.legacy else 'EVT_TWEAK_R', "value": 'ANY', "ctrl": True}, None),
("node.select_link_viewer", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True}, None),
("node.backimage_move", {"type": 'MIDDLEMOUSE', "value": 'PRESS', "alt": True}, None),
("node.backimage_zoom", {"type": 'V', "value": 'PRESS', "repeat": True},
@ -2132,7 +2165,11 @@ def km_dopesheet(params):
("action.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None),
("action.select_linked", {"type": 'L', "value": 'PRESS'}, None),
("action.frame_jump", {"type": 'G', "value": 'PRESS', "ctrl": True}, None),
op_menu_pie("DOPESHEET_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True}),
(
op_menu_pie("DOPESHEET_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True})
if not params.legacy else
("action.snap", {"type": 'S', "value": 'PRESS', "shift": True}, None)
),
("action.mirror", {"type": 'M', "value": 'PRESS', "ctrl": True}, None),
("action.handle_type", {"type": 'V', "value": 'PRESS'}, None),
("action.interpolation_type", {"type": 'T', "value": 'PRESS'}, None),
@ -2165,9 +2202,8 @@ def km_dopesheet(params):
{"properties": [("mode", 'TIME_SCALE')]}),
("transform.transform", {"type": 'T', "value": 'PRESS', "shift": True},
{"properties": [("mode", 'TIME_SLIDE')]}),
("wm.context_toggle", {"type": 'O', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.use_proportional_action')]}),
op_menu_pie("VIEW3D_MT_proportional_editing_falloff_pie", {"type": 'O', "value": 'PRESS', "shift": True}),
*_template_items_proportional_editing(
params, connected=False, toggle_data_path='tool_settings.use_proportional_action'),
("marker.add", {"type": 'M', "value": 'PRESS'}, None),
("marker.rename", {"type": 'M', "value": 'PRESS', "ctrl": True}, None),
("marker.camera_bind", {"type": 'B', "value": 'PRESS', "ctrl": True}, None),
@ -2285,7 +2321,11 @@ def km_nla_editor(params):
("nla.move_down", {"type": 'PAGE_DOWN', "value": 'PRESS', "repeat": True}, None),
("nla.apply_scale", {"type": 'A', "value": 'PRESS', "ctrl": True}, None),
("nla.clear_scale", {"type": 'S', "value": 'PRESS', "alt": True}, None),
op_menu_pie("NLA_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True}),
(
op_menu_pie("NLA_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True})
if not params.legacy else
("nla.snap", {"type": 'S', "value": 'PRESS', "shift": True}, None)
),
("nla.fmodifier_add", {"type": 'M', "value": 'PRESS', "shift": True, "ctrl": True}, None),
("transform.transform", {"type": 'G', "value": 'PRESS'},
{"properties": [("mode", 'TRANSLATION')]}),
@ -3240,7 +3280,11 @@ def km_grease_pencil_stroke_edit_mode(params):
("gpencil.copy", {"type": 'C', "value": 'PRESS', "ctrl": True}, None),
("gpencil.paste", {"type": 'V', "value": 'PRESS', "ctrl": True}, None),
# Snap
op_menu_pie("GPENCIL_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True}),
(
op_menu_pie("GPENCIL_MT_snap_pie", {"type": 'S', "value": 'PRESS', "shift": True})
if not params.legacy else
op_menu("GPENCIL_MT_snap", {"type": 'S', "value": 'PRESS', "shift": True})
),
# Show/hide
("gpencil.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None),
("gpencil.hide", {"type": 'H', "value": 'PRESS'},
@ -3268,7 +3312,8 @@ def km_grease_pencil_stroke_edit_mode(params):
("transform.transform", {"type": 'F', "value": 'PRESS', "shift": True},
{"properties": [("mode", 'GPENCIL_OPACITY')]}),
# Proportional editing.
*_template_items_proportional_editing(connected=True),
*_template_items_proportional_editing(
params, connected=True, toggle_data_path='tool_settings.use_proportional_edit'),
# Curve edit mode toggle.
("wm.context_toggle", {"type": 'U', "value": 'PRESS'},
{"properties": [("data_path", 'gpencil_data.use_curve_edit')]}),
@ -4033,9 +4078,8 @@ def km_object_mode(params):
)
items.extend([
op_menu_pie("VIEW3D_MT_proportional_editing_falloff_pie", {"type": 'O', "value": 'PRESS', "shift": True}),
("wm.context_toggle", {"type": 'O', "value": 'PRESS'},
{"properties": [("data_path", 'tool_settings.use_proportional_edit_objects')]}),
*_template_items_proportional_editing(
params, connected=False, toggle_data_path='tool_settings.use_proportional_edit_objects'),
*_template_items_select_actions(params, "object.select_all"),
("object.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None),
("object.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None),
@ -4199,7 +4243,8 @@ def km_curve(params):
("curve.normals_make_consistent", {"type": 'N', "value": 'PRESS', "ctrl" if params.legacy else "shift": True}, None),
("object.vertex_parent_set", {"type": 'P', "value": 'PRESS', "ctrl": True}, None),
op_menu("VIEW3D_MT_hook", {"type": 'H', "value": 'PRESS', "ctrl": True}),
*_template_items_proportional_editing(connected=True),
*_template_items_proportional_editing(
params, connected=True, toggle_data_path='tool_settings.use_proportional_edit'),
*_template_items_context_menu("VIEW3D_MT_edit_curve_context_menu", params.context_menu_event),
])
@ -4635,7 +4680,8 @@ def km_mesh(params):
op_menu("VIEW3D_MT_vertex_group", {"type": 'G', "value": 'PRESS', "ctrl": True}),
op_menu("VIEW3D_MT_edit_mesh_normals", {"type": 'N', "value": 'PRESS', "alt": True}),
("object.vertex_group_remove_from", {"type": 'G', "value": 'PRESS', "ctrl": True, "alt": True}, None),
*_template_items_proportional_editing(connected=True),
*_template_items_proportional_editing(
params, connected=True, toggle_data_path='tool_settings.use_proportional_edit'),
*_template_items_context_menu("VIEW3D_MT_edit_mesh_context_menu", params.context_menu_event),
])
@ -4767,7 +4813,8 @@ def km_metaball(params):
("mball.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),
*_template_items_select_actions(params, "mball.select_all"),
("mball.select_similar", {"type": 'G', "value": 'PRESS', "shift": True}, None),
*_template_items_proportional_editing(connected=True),
*_template_items_proportional_editing(
params, connected=True, toggle_data_path='tool_settings.use_proportional_edit'),
*_template_items_context_menu("VIEW3D_MT_edit_metaball_context_menu", params.context_menu_event),
])
@ -4790,7 +4837,8 @@ def km_lattice(params):
("object.vertex_parent_set", {"type": 'P', "value": 'PRESS', "ctrl": True}, None),
("lattice.flip", {"type": 'F', "value": 'PRESS', "alt": True}, None),
op_menu("VIEW3D_MT_hook", {"type": 'H', "value": 'PRESS', "ctrl": True}),
*_template_items_proportional_editing(connected=False),
*_template_items_proportional_editing(
params, connected=False, toggle_data_path='tool_settings.use_proportional_edit'),
*_template_items_context_menu("VIEW3D_MT_edit_lattice_context_menu", params.context_menu_event),
])
@ -4836,7 +4884,8 @@ def km_particle(params):
for i, value in enumerate(('PATH', 'POINT', 'TIP'))
)
),
*_template_items_proportional_editing(connected=False),
*_template_items_proportional_editing(
params, connected=False, toggle_data_path='tool_settings.use_proportional_edit'),
*_template_items_context_menu("VIEW3D_MT_particle_context_menu", params.context_menu_event),
])

View File

@ -1420,7 +1420,7 @@ class CLIP_MT_track_refine(Menu):
props = layout.operator("clip.refine_markers", text="Backwards")
props.backwards = True
props = layout.operator("clip.refine_markers", text="Fowards")
props = layout.operator("clip.refine_markers", text="Forwards")
props.backwards = False

View File

@ -2236,11 +2236,6 @@ class VIEW3D_MT_object_relations(Menu):
layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
layout.menu("VIEW3D_MT_make_single_user")
layout.separator()
layout.operator("object.data_transfer")
layout.operator("object.datalayout_transfer")
class VIEW3D_MT_object(Menu):
bl_context = "objectmode"
@ -2274,7 +2269,7 @@ class VIEW3D_MT_object(Menu):
layout.menu("VIEW3D_MT_object_relations")
layout.menu("VIEW3D_MT_object_constraints")
layout.menu("VIEW3D_MT_object_track")
layout.menu("VIEW3D_MT_make_links", text="Make Links")
layout.menu("VIEW3D_MT_make_links")
layout.separator()
@ -2787,7 +2782,7 @@ class VIEW3D_MT_make_single_user(Menu):
class VIEW3D_MT_make_links(Menu):
bl_label = "Make Links"
bl_label = "Link/Transfer Data"
def draw(self, _context):
layout = self.layout
@ -2795,10 +2790,10 @@ class VIEW3D_MT_make_links(Menu):
if len(bpy.data.scenes) > 10:
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
layout.operator("object.make_links_scene", text="Link Objects to Scene...", icon='OUTLINER_OB_EMPTY')
else:
layout.operator_context = 'EXEC_REGION_WIN'
layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene")
layout.operator_menu_enum("object.make_links_scene", "scene", text="Link Objects to Scene")
layout.separator()
@ -2806,7 +2801,12 @@ class VIEW3D_MT_make_links(Menu):
layout.operator_enum("object.make_links_data", "type") # inline
layout.operator("object.join_uvs") # stupid place to add this!
layout.operator("object.join_uvs", text="Copy UV Maps")
layout.separator()
layout.operator("object.data_transfer")
layout.operator("object.datalayout_transfer")
class VIEW3D_MT_brush_paint_modes(Menu):

View File

@ -456,6 +456,8 @@ class InstancesComponent : public GeometryComponent {
blender::Span<blender::float3> scales() const;
blender::Span<int> ids() const;
blender::MutableSpan<blender::float3> positions();
blender::MutableSpan<blender::float3> rotations();
blender::MutableSpan<blender::float3> scales();
int instances_amount() const;
bool is_empty() const final;

View File

@ -82,10 +82,16 @@ bool BKE_object_support_modifier_type_check(const struct Object *ob, int modifie
void BKE_object_modifier_set_active(struct Object *ob, struct ModifierData *md);
struct ModifierData *BKE_object_active_modifier(const struct Object *ob);
bool BKE_object_copy_modifier(struct Object *ob_dst,
bool BKE_object_copy_modifier(struct Main *bmain,
struct Scene *scene,
struct Object *ob_dst,
const struct Object *ob_src,
struct ModifierData *md);
bool BKE_object_copy_gpencil_modifier(struct Object *ob_dst, struct GpencilModifierData *md);
bool BKE_object_modifier_stack_copy(struct Object *ob_dst,
const struct Object *ob_src,
const bool do_copy_all,
const int flag_subdata);
void BKE_object_link_modifiers(struct Object *ob_dst, const struct Object *ob_src);
void BKE_object_free_modifiers(struct Object *ob, const int flag);
void BKE_object_free_shaderfx(struct Object *ob, const int flag);

View File

@ -67,6 +67,13 @@ struct wmWindowManager;
#define BKE_ST_MAXNAME 64
typedef struct wmSpaceTypeListenerParams {
struct wmWindow *window;
struct ScrArea *area;
struct wmNotifier *notifier;
const struct Scene *scene;
} wmSpaceTypeListenerParams;
typedef struct SpaceType {
struct SpaceType *next, *prev;
@ -85,10 +92,7 @@ typedef struct SpaceType {
/* exit is called when the area is hidden or removed */
void (*exit)(struct wmWindowManager *wm, struct ScrArea *area);
/* Listeners can react to bContext changes */
void (*listener)(struct wmWindow *win,
struct ScrArea *area,
struct wmNotifier *wmn,
struct Scene *scene);
void (*listener)(const wmSpaceTypeListenerParams *params);
/* called when the mouse moves out of the area */
void (*deactivate)(struct ScrArea *area);
@ -134,6 +138,23 @@ typedef struct SpaceType {
/* region types are also defined using spacetypes_init, via a callback */
typedef struct wmRegionListenerParams {
struct ScrArea *area; /* Can be NULL when the region is not part of an area. */
struct ARegion *region;
struct wmNotifier *notifier;
const struct Scene *scene;
} wmRegionListenerParams;
typedef struct wmRegionMessageSubscribeParams {
const struct bContext *context;
struct wmMsgBus *message_bus;
struct WorkSpace *workspace;
struct Scene *scene;
struct bScreen *screen;
struct ScrArea *area;
struct ARegion *region;
} wmRegionMessageSubscribeParams;
typedef struct ARegionType {
struct ARegionType *next, *prev;
@ -158,19 +179,9 @@ typedef struct ARegionType {
/* snap the size of the region (can be NULL for no snapping). */
int (*snap_size)(const struct ARegion *region, int size, int axis);
/* contextual changes should be handled here */
void (*listener)(struct wmWindow *win,
struct ScrArea *area,
struct ARegion *region,
struct wmNotifier *wmn,
const struct Scene *scene);
void (*listener)(const wmRegionListenerParams *params);
/* Optional callback to generate subscriptions. */
void (*message_subscribe)(const struct bContext *C,
struct WorkSpace *workspace,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *area,
struct ARegion *region,
struct wmMsgBus *mbus);
void (*message_subscribe)(const wmRegionMessageSubscribeParams *params);
void (*free)(struct ARegion *);

View File

@ -300,6 +300,8 @@ set(SRC
BKE_constraint.h
BKE_context.h
BKE_crazyspace.h
BKE_cryptomatte.h
BKE_cryptomatte.hh
BKE_curve.h
BKE_curveprofile.h
BKE_customdata.h
@ -363,6 +365,7 @@ set(SRC
BKE_mesh_remesh_voxel.h
BKE_mesh_runtime.h
BKE_mesh_tangent.h
BKE_mesh_types.h
BKE_mesh_wrapper.h
BKE_modifier.h
BKE_movieclip.h

View File

@ -2357,9 +2357,10 @@ static bool is_action_track_evaluated_without_nla(const AnimData *adt,
return true;
}
/** XXX Wayde Moss: BKE_nlatrack_find_tweaked() exists within nla.c, but it doesn't appear to
* work as expected. From animsys_evaluate_nla_for_flush(), it returns NULL in tweak mode. I'm not
* sure why. Preferably, it would be as simple as checking for (adt->act_Track == nlt) but that
/**
* XXX(Wayde Moss): #BKE_nlatrack_find_tweaked() exists within nla.c, but it doesn't appear to
* work as expected. From #animsys_evaluate_nla_for_flush(), it returns NULL in tweak mode. I'm not
* sure why. Preferably, it would be as simple as checking for `(adt->act_Track == nlt)` but that
* doesn't work either, neither does comparing indices.
*
* This function is a temporary work around. The first disabled track is always the tweaked track.

View File

@ -23,7 +23,7 @@
* - passing output paths to the visitor?, like render out.
* - passing sequence strips with many images.
* - passing directory paths - visitors don't know which path is a dir or a file.
* */
*/
#include <sys/stat.h>

View File

@ -318,7 +318,7 @@ static eContextResult ctx_data_get(bContext *C, const char *member, bContextData
*
* Values in order of importance
* (0, -1, 1) - Where 1 is highest priority
* */
*/
if (done != 1 && recursion < 1 && C->wm.store) {
C->data.recursion = 1;

View File

@ -2373,7 +2373,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
* 0,1,2,3,4 --> 1,2,3,4,0
*
* this is why we compare last with second last
* */
*/
float vec_1[3] = {0, 1, 0}, vec_2[3] = {0, 1, 0}, angle, ang_fac, cross_tmp[3];
BevPoint *bevp_first;

View File

@ -233,7 +233,7 @@ static bool calc_curve_deform(
* Now for Neg Up XYZ, the colors are all dark, and ordered clockwise - Campbell
*
* note: moved functions into quat_apply_track/vec_apply_track
* */
*/
copy_qt_qt(quat, new_quat);
copy_v3_v3(cent, co);

View File

@ -458,6 +458,7 @@ static void curve_to_displist(Curve *cu,
/**
* \param normal_proj: Optional normal that's used to project the scanfill verts into 2d coords.
* Pass this along if known since it saves time calculating the normal.
* This is also used to initialize #DispList.nors (one normal per display list).
* \param flipnormal: Flip the normal (same as passing \a normal_proj negated)
*/
void BKE_displist_fill(ListBase *dispbase,
@ -487,6 +488,7 @@ void BKE_displist_fill(ListBase *dispbase,
while (cont) {
int dl_flag_accum = 0;
int dl_rt_accum = 0;
cont = 0;
totvert = 0;
nextcol = 0;
@ -534,6 +536,7 @@ void BKE_displist_fill(ListBase *dispbase,
}
}
dl_flag_accum |= dl->flag;
dl_rt_accum |= dl->rt;
}
}
@ -543,6 +546,7 @@ void BKE_displist_fill(ListBase *dispbase,
dlnew = MEM_callocN(sizeof(DispList), "filldisplist");
dlnew->type = DL_INDEX3;
dlnew->flag = (dl_flag_accum & (DL_BACK_CURVE | DL_FRONT_CURVE));
dlnew->rt = (dl_rt_accum & CU_SMOOTH);
dlnew->col = colnr;
dlnew->nr = totvert;
dlnew->parts = tot;
@ -550,6 +554,18 @@ void BKE_displist_fill(ListBase *dispbase,
dlnew->index = MEM_mallocN(sizeof(int[3]) * tot, "dlindex");
dlnew->verts = MEM_mallocN(sizeof(float[3]) * totvert, "dlverts");
if (normal_proj != NULL) {
/* Use a single normal for #DL_INDEX3.
* Counter intuitively, the normal must always be the flipped projection vector. */
dlnew->nors = MEM_mallocN(sizeof(float[3]), "dlnors");
if (flipnormal) {
copy_v3_v3(dlnew->nors, normal_proj);
}
else {
negate_v3_v3(dlnew->nors, normal_proj);
}
}
/* vert data */
f1 = dlnew->verts;
totvert = 0;
@ -1116,7 +1132,7 @@ static void curve_calc_modifiers_post(Depsgraph *depsgraph,
*
* The right solution would be to COW the Curve data block at the input of the modifier
* stack just like what the mesh modifier does.
* */
*/
modified = BKE_mesh_new_nomain_from_curve_displist(ob, dispbase);
}

View File

@ -1316,6 +1316,10 @@ void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd,
t_brush->particle_radius = brush->particle_radius;
t_brush->particle_smooth = brush->particle_smooth;
t_brush->paint_distance = brush->paint_distance;
/* NOTE: This is dangerous, as it will generate invalid data in case we are copying between
* different objects. Extra external code has to be called then to ensure proper remapping of
* that pointer. See e.g. `BKE_object_copy_particlesystems` or `BKE_object_copy_modifier`. */
t_brush->psys = brush->psys;
if (brush->paint_ramp) {

View File

@ -5136,6 +5136,9 @@ void BKE_fluid_modifier_copy(const struct FluidModifierData *fmd,
FluidFlowSettings *tffs = tfmd->flow;
FluidFlowSettings *ffs = fmd->flow;
/* NOTE: This is dangerous, as it will generate invalid data in case we are copying between
* different objects. Extra external code has to be called then to ensure proper remapping of
* that pointer. See e.g. `BKE_object_copy_particlesystems` or `BKE_object_copy_modifier`. */
tffs->psys = ffs->psys;
tffs->noise_texture = ffs->noise_texture;

View File

@ -540,6 +540,16 @@ MutableSpan<float3> InstancesComponent::positions()
return positions_;
}
MutableSpan<float3> InstancesComponent::rotations()
{
return rotations_;
}
MutableSpan<float3> InstancesComponent::scales()
{
return scales_;
}
int InstancesComponent::instances_amount() const
{
const int size = instanced_data_.size();

View File

@ -218,26 +218,7 @@ static void object_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const in
ob_dst->runtime.bb = MEM_dupallocN(ob_src->runtime.bb);
}
BLI_listbase_clear(&ob_dst->modifiers);
LISTBASE_FOREACH (ModifierData *, md, &ob_src->modifiers) {
ModifierData *nmd = BKE_modifier_new(md->type);
BLI_strncpy(nmd->name, md->name, sizeof(nmd->name));
BKE_modifier_copydata_ex(md, nmd, flag_subdata);
BLI_addtail(&ob_dst->modifiers, nmd);
}
BLI_listbase_clear(&ob_dst->greasepencil_modifiers);
LISTBASE_FOREACH (GpencilModifierData *, gmd, &ob_src->greasepencil_modifiers) {
GpencilModifierData *nmd = BKE_gpencil_modifier_new(gmd->type);
BLI_strncpy(nmd->name, gmd->name, sizeof(nmd->name));
BKE_gpencil_modifier_copydata_ex(gmd, nmd, flag_subdata);
BLI_addtail(&ob_dst->greasepencil_modifiers, nmd);
}
BLI_listbase_clear(&ob_dst->shader_fx);
LISTBASE_FOREACH (ShaderFxData *, fx, &ob_src->shader_fx) {
ShaderFxData *nfx = BKE_shaderfx_new(fx->type);
BLI_strncpy(nfx->name, fx->name, sizeof(nfx->name));
@ -266,10 +247,12 @@ static void object_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const in
ob_dst->pd->rng = MEM_dupallocN(ob_src->pd->rng);
}
}
BKE_object_copy_softbody(ob_dst, ob_src, flag_subdata);
BKE_rigidbody_object_copy(bmain, ob_dst, ob_src, flag_subdata);
BKE_object_copy_particlesystems(ob_dst, ob_src, flag_subdata);
BLI_listbase_clear(&ob_dst->modifiers);
BLI_listbase_clear(&ob_dst->greasepencil_modifiers);
/* Note: Also takes care of softbody and particle systems copying. */
BKE_object_modifier_stack_copy(ob_dst, ob_src, true, flag_subdata);
BLI_listbase_clear((ListBase *)&ob_dst->drawdata);
BLI_listbase_clear(&ob_dst->pc_ids);
@ -1354,17 +1337,76 @@ bool BKE_object_support_modifier_type_check(const Object *ob, int modifier_type)
return false;
}
bool BKE_object_copy_modifier(struct Object *ob_dst, const struct Object *ob_src, ModifierData *md)
static bool object_modifier_type_copy_check(ModifierType md_type)
{
if (ELEM(md->type, eModifierType_Hook, eModifierType_Collision)) {
return false;
return !ELEM(md_type, eModifierType_Hook, eModifierType_Collision);
}
/** Find a `psys` matching given `psys_src` in `ob_dst` (i.e. sharing the same ParticleSettings
* ID), or add one, and return valid `psys` from `ob_dst`.
*
* \note Order handling is fairly weak here. This code assumes that it is called **before** the
* modifier using the psys is actually copied, and that this copied modifier will be added at the
* end of the stack. That way we can be sure that the particle modifier will be before the one
* using its particle system in the stack.
*/
static ParticleSystem *object_copy_modifier_particle_system_ensure(Main *bmain,
Scene *scene,
Object *ob_dst,
ParticleSystem *psys_src)
{
ParticleSystem *psys_dst = NULL;
/* Check if a particle system with the same particle settings
* already exists on the destination object. */
LISTBASE_FOREACH (ParticleSystem *, psys, &ob_dst->particlesystem) {
if (psys->part == psys_src->part) {
psys_dst = psys;
break;
}
}
if (!BKE_object_support_modifier_type_check(ob_dst, md->type)) {
return false;
/* If it does not exist, copy the particle system to the destination object. */
if (psys_dst == NULL) {
ModifierData *md = object_copy_particle_system(bmain, scene, ob_dst, psys_src);
psys_dst = ((ParticleSystemModifierData *)md)->psys;
}
switch (md->type) {
return psys_dst;
}
/** Copy a single modifier.
*
* \note **Do not** use this function to copy a whole modifier stack (see note below too). Use
* `BKE_object_modifier_stack_copy` instead.
*
* \note Complex modifiers relaying on other data (like e.g. dynamic paint or fluid using particle
* systems) are not always 100% 'correctly' copied here, since we have to use heuristics to decide
* which particle system to use or add in `ob_dst`, and it's placement in the stack, etc. If used
* more than once, this function should preferably be called in stack order. */
bool BKE_object_copy_modifier(
Main *bmain, Scene *scene, Object *ob_dst, const Object *ob_src, ModifierData *md_src)
{
BLI_assert(ob_dst->type != OB_GPENCIL);
const ModifierTypeInfo *mti = BKE_modifier_get_info(md_src->type);
if (!object_modifier_type_copy_check(md_src->type)) {
/* We never allow copying those modifiers here. */
return false;
}
if (!BKE_object_support_modifier_type_check(ob_dst, md_src->type)) {
return false;
}
if (mti->flags & eModifierTypeFlag_Single) {
if (BKE_modifiers_findby_type(ob_dst, md_src->type) != NULL) {
return false;
}
}
ParticleSystem *psys_src = NULL;
ParticleSystem *psys_dst = NULL;
switch (md_src->type) {
case eModifierType_Softbody:
BKE_object_copy_softbody(ob_dst, ob_src, 0);
break;
@ -1372,66 +1414,158 @@ bool BKE_object_copy_modifier(struct Object *ob_dst, const struct Object *ob_src
/* ensure skin-node customdata exists */
BKE_mesh_ensure_skin_customdata(ob_dst->data);
break;
case eModifierType_Fluid: {
FluidModifierData *fmd = (FluidModifierData *)md_src;
if (fmd->type == MOD_FLUID_TYPE_FLOW) {
if (fmd->flow != NULL && fmd->flow->psys != NULL) {
psys_src = fmd->flow->psys;
psys_dst = object_copy_modifier_particle_system_ensure(bmain, scene, ob_dst, psys_src);
}
}
break;
}
case eModifierType_DynamicPaint: {
DynamicPaintModifierData *dpmd = (DynamicPaintModifierData *)md_src;
if (dpmd->brush != NULL && dpmd->brush->psys != NULL) {
psys_src = dpmd->brush->psys;
psys_dst = object_copy_modifier_particle_system_ensure(bmain, scene, ob_dst, psys_src);
}
break;
}
default:
break;
}
ModifierData *nmd = BKE_modifier_new(md->type);
BLI_strncpy(nmd->name, md->name, sizeof(nmd->name));
ModifierData *md_dst;
if (md_src->type == eModifierType_ParticleSystem) {
md_dst = object_copy_particle_system(
bmain, scene, ob_dst, ((ParticleSystemModifierData *)md_src)->psys);
}
else {
md_dst = BKE_modifier_new(md_src->type);
if (md->type == eModifierType_Multires) {
/* Has to be done after mod creation, but *before* we actually copy its settings! */
multiresModifier_sync_levels_ex(
ob_dst, (MultiresModifierData *)md, (MultiresModifierData *)nmd);
BLI_strncpy(md_dst->name, md_src->name, sizeof(md_dst->name));
if (md_src->type == eModifierType_Multires) {
/* Has to be done after mod creation, but *before* we actually copy its settings! */
multiresModifier_sync_levels_ex(
ob_dst, (MultiresModifierData *)md_src, (MultiresModifierData *)md_dst);
}
BKE_modifier_copydata(md_src, md_dst);
switch (md_dst->type) {
case eModifierType_Fluid:
if (psys_dst != NULL) {
FluidModifierData *fmd_dst = (FluidModifierData *)md_dst;
BLI_assert(fmd_dst->type == MOD_FLUID_TYPE_FLOW && fmd_dst->flow != NULL &&
fmd_dst->flow->psys != NULL);
fmd_dst->flow->psys = psys_dst;
}
break;
case eModifierType_DynamicPaint:
if (psys_dst != NULL) {
DynamicPaintModifierData *dpmd_dst = (DynamicPaintModifierData *)md_dst;
BLI_assert(dpmd_dst->brush != NULL && dpmd_dst->brush->psys != NULL);
dpmd_dst->brush->psys = psys_dst;
}
break;
default:
break;
}
BLI_addtail(&ob_dst->modifiers, md_dst);
BKE_modifier_unique_name(&ob_dst->modifiers, md_dst);
}
BKE_modifier_copydata(md, nmd);
BLI_addtail(&ob_dst->modifiers, nmd);
BKE_modifier_unique_name(&ob_dst->modifiers, nmd);
BKE_object_modifier_set_active(ob_dst, nmd);
BKE_object_modifier_set_active(ob_dst, md_dst);
return true;
}
bool BKE_object_copy_gpencil_modifier(struct Object *ob_dst, GpencilModifierData *md)
/** Copy a single GPencil modifier.
*
* \note **Do not** use this function to copy a whole modifier stack. Use
* `BKE_object_modifier_stack_copy` instead. */
bool BKE_object_copy_gpencil_modifier(struct Object *ob_dst, GpencilModifierData *gmd_src)
{
GpencilModifierData *nmd = BKE_gpencil_modifier_new(md->type);
BLI_strncpy(nmd->name, md->name, sizeof(nmd->name));
BLI_assert(ob_dst->type == OB_GPENCIL);
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
mti->copyData(md, nmd);
GpencilModifierData *gmd_dst = BKE_gpencil_modifier_new(gmd_src->type);
BLI_strncpy(gmd_dst->name, gmd_src->name, sizeof(gmd_dst->name));
BLI_addtail(&ob_dst->greasepencil_modifiers, nmd);
BKE_gpencil_modifier_unique_name(&ob_dst->greasepencil_modifiers, nmd);
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(gmd_src->type);
mti->copyData(gmd_src, gmd_dst);
BLI_addtail(&ob_dst->greasepencil_modifiers, gmd_dst);
BKE_gpencil_modifier_unique_name(&ob_dst->greasepencil_modifiers, gmd_dst);
return true;
}
void BKE_object_link_modifiers(struct Object *ob_dst, const struct Object *ob_src)
/**
* Copy the whole stack of modifiers from one object into another.
*
* \warning **Does not** clear modifier stack and related data (particle systems, softbody,
* etc.) in `ob_dst`, if needed calling code must do it.
*
* @param do_copy_all If true, even modifiers that should not suport copying (like Hook one) will
* be duplicated.
*/
bool BKE_object_modifier_stack_copy(Object *ob_dst,
const Object *ob_src,
const bool do_copy_all,
const int flag_subdata)
{
if ((ob_dst->type == OB_GPENCIL) != (ob_src->type == OB_GPENCIL)) {
BLI_assert(!"Trying to copy a modifier stack between a GPencil object and another type.");
return false;
}
if (!BLI_listbase_is_empty(&ob_dst->modifiers) ||
!BLI_listbase_is_empty(&ob_dst->greasepencil_modifiers)) {
BLI_assert(
!"Trying to copy a modifier stack into an object having a non-empty modifier stack.");
return false;
}
LISTBASE_FOREACH (ModifierData *, md_src, &ob_src->modifiers) {
if (!do_copy_all && !object_modifier_type_copy_check(md_src->type)) {
continue;
}
if (!BKE_object_support_modifier_type_check(ob_dst, md_src->type)) {
continue;
}
ModifierData *md_dst = BKE_modifier_new(md_src->type);
BLI_strncpy(md_dst->name, md_src->name, sizeof(md_dst->name));
BKE_modifier_copydata_ex(md_src, md_dst, flag_subdata);
BLI_addtail(&ob_dst->modifiers, md_dst);
}
LISTBASE_FOREACH (GpencilModifierData *, gmd_src, &ob_src->greasepencil_modifiers) {
GpencilModifierData *gmd_dst = BKE_gpencil_modifier_new(gmd_src->type);
BLI_strncpy(gmd_dst->name, gmd_src->name, sizeof(gmd_dst->name));
BKE_gpencil_modifier_copydata_ex(gmd_src, gmd_dst, flag_subdata);
BLI_addtail(&ob_dst->greasepencil_modifiers, gmd_dst);
}
/* This could be copied from anywhere, since no other modifier actually use this data. But for
* consistency do it together with particle systems. */
BKE_object_copy_softbody(ob_dst, ob_src, flag_subdata);
/* It is mandatory that this happens after copying modifiers, as it will update their `psys`
* pointers accordingly. */
BKE_object_copy_particlesystems(ob_dst, ob_src, flag_subdata);
return true;
}
void BKE_object_link_modifiers(Object *ob_dst, const Object *ob_src)
{
BKE_object_free_modifiers(ob_dst, 0);
if (!ELEM(ob_dst->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE, OB_GPENCIL)) {
/* only objects listed above can have modifiers and linking them to objects
* which doesn't have modifiers stack is quite silly */
return;
}
/* No grease pencil modifiers. */
if ((ob_src->type != OB_GPENCIL) && (ob_dst->type != OB_GPENCIL)) {
LISTBASE_FOREACH (ModifierData *, md, &ob_src->modifiers) {
BKE_object_copy_modifier(ob_dst, ob_src, md);
}
}
/* Copy grease pencil modifiers. */
if ((ob_src->type == OB_GPENCIL) && (ob_dst->type == OB_GPENCIL)) {
LISTBASE_FOREACH (GpencilModifierData *, md, &ob_src->greasepencil_modifiers) {
BKE_object_copy_gpencil_modifier(ob_dst, md);
}
}
BKE_object_copy_particlesystems(ob_dst, ob_src, 0);
/* TODO: smoke?, cloth? */
BKE_object_modifier_stack_copy(ob_dst, ob_src, false, 0);
}
/**
@ -2109,7 +2243,7 @@ Object *BKE_object_add_for_data(
return ob;
}
void BKE_object_copy_softbody(struct Object *ob_dst, const struct Object *ob_src, const int flag)
void BKE_object_copy_softbody(Object *ob_dst, const Object *ob_src, const int flag)
{
SoftBody *sb = ob_src->soft;
bool tagged_no_main = ob_dst->id.tag & LIB_TAG_NO_MAIN;
@ -2153,7 +2287,7 @@ void BKE_object_copy_softbody(struct Object *ob_dst, const struct Object *ob_src
sbn->scratch = NULL;
if (tagged_no_main == 0) {
if (!tagged_no_main) {
sbn->shared = MEM_dupallocN(sb->shared);
sbn->shared->pointcache = BKE_ptcache_copy_list(
&sbn->shared->ptcaches, &sb->shared->ptcaches, flag);

View File

@ -140,7 +140,7 @@ static void compute_eigenstuff(struct OceanResult *ocr, float jxx, float jzz, fl
* instead of Complex.h
* in fftw.h "fftw_complex" typedefed as double[2]
* below you can see functions are needed to work with such complex numbers.
* */
*/
static void init_complex(fftw_complex cmpl, float real, float image)
{
cmpl[0] = real;

View File

@ -1599,8 +1599,7 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area)
BLO_read_list(reader, &snode->treepath);
snode->edittree = NULL;
snode->iofsd = NULL;
BLI_listbase_clear(&snode->linkdrag);
snode->runtime = NULL;
}
else if (sl->spacetype == SPACE_TEXT) {
SpaceText *st = (SpaceText *)sl;

View File

@ -1033,9 +1033,11 @@ static void multiply_marker(MovieTrackingMarker *marker, const float multiplier)
mul_v2_fl(marker->search_max, multiplier);
}
void BKE_tracking_tracks_average(MovieTrackingTrack *dst_track,
/*const*/ MovieTrackingTrack **src_tracks,
const int num_src_tracks)
/* Helper function for BKE_tracking_tracks_average which takes care of averaging fields of
* markers (position, patterns, ...). */
static void tracking_average_markers(MovieTrackingTrack *dst_track,
/*const*/ MovieTrackingTrack **src_tracks,
const int num_src_tracks)
{
/* Get global range of frames within which averaging would happen. */
int first_frame, last_frame;
@ -1088,6 +1090,32 @@ void BKE_tracking_tracks_average(MovieTrackingTrack *dst_track,
MEM_freeN(counters);
}
/* Helper function for BKE_tracking_tracks_average which takes care of averaging fields of
* tracks (track for example, offset). */
static void tracking_average_tracks(MovieTrackingTrack *dst_track,
/*const*/ MovieTrackingTrack **src_tracks,
const int num_src_tracks)
{
/* TODO(sergey): Consider averaging weight, stabilization weight, maybe even bundle position. */
zero_v2(dst_track->offset);
for (int track_index = 0; track_index < num_src_tracks; track_index++) {
add_v2_v2(dst_track->offset, src_tracks[track_index]->offset);
}
mul_v2_fl(dst_track->offset, 1.0f / num_src_tracks);
}
void BKE_tracking_tracks_average(MovieTrackingTrack *dst_track,
/*const*/ MovieTrackingTrack **src_tracks,
const int num_src_tracks)
{
if (num_src_tracks == 0) {
return;
}
tracking_average_markers(dst_track, src_tracks, num_src_tracks);
tracking_average_tracks(dst_track, src_tracks, num_src_tracks);
}
MovieTrackingTrack *BKE_tracking_track_get_named(MovieTracking *tracking,
MovieTrackingObject *object,
const char *name)
@ -1482,14 +1510,16 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker *marker, int event)
}
}
/* Get marker closest to the given frame number.
/**
* Get marker closest to the given frame number.
*
* If there is maker with exact frame number it returned.
* Otherwise, marker with higherst frame number but lower than the requested
* Otherwise, marker with highest frame number but lower than the requested
* frame is returned if such marker exists. Otherwise, the marker with lowest
* frame number greater than the requested frame number is returned.
*
* This function has complexity of O(log number_of_markers). */
* This function has complexity of `O(log number_of_markers)`.
*/
MovieTrackingMarker *BKE_tracking_marker_get(MovieTrackingTrack *track, int framenr)
{
const int num_markers = track->markersnr;

View File

@ -1167,8 +1167,7 @@ bool BKE_unit_replace_string(
/* Replace # with add sign when there is no operator between it and the next number.
*
* "1*1# 3*100# * 3" -> "1*1+ 3*100 * 3"
*
* */
*/
{
char *str_found = str;
const char *ch = str;

View File

@ -783,21 +783,22 @@ bool BKE_volume_load(Volume *volume, Main *bmain)
/* Get absolute file path at current frame. */
const char *volume_name = volume->id.name + 2;
volume_filepath_get(bmain, volume, grids.filepath);
char filepath[FILE_MAX];
volume_filepath_get(bmain, volume, filepath);
CLOG_INFO(&LOG, 1, "Volume %s: load %s", volume_name, grids.filepath);
CLOG_INFO(&LOG, 1, "Volume %s: load %s", volume_name, filepath);
/* Test if file exists. */
if (!BLI_exists(grids.filepath)) {
if (!BLI_exists(filepath)) {
char filename[FILE_MAX];
BLI_split_file_part(grids.filepath, filename, sizeof(filename));
BLI_split_file_part(filepath, filename, sizeof(filename));
grids.error_msg = filename + std::string(" not found");
CLOG_INFO(&LOG, 1, "Volume %s: %s", volume_name, grids.error_msg.c_str());
return false;
}
/* Open OpenVDB file. */
openvdb::io::File file(grids.filepath);
openvdb::io::File file(filepath);
openvdb::GridPtrVec vdb_grids;
try {
@ -814,11 +815,13 @@ bool BKE_volume_load(Volume *volume, Main *bmain)
/* Add grids read from file to own vector, filtering out any NULL pointers. */
for (const openvdb::GridBase::Ptr &vdb_grid : vdb_grids) {
if (vdb_grid) {
VolumeFileCache::Entry template_entry(grids.filepath, vdb_grid);
VolumeFileCache::Entry template_entry(filepath, vdb_grid);
grids.emplace_back(template_entry, volume->runtime.default_simplify_level);
}
}
BLI_strncpy(grids.filepath, filepath, FILE_MAX);
return grids.error_msg.empty();
#else
UNUSED_VARS(bmain, volume);

View File

@ -20,7 +20,7 @@
/** \file
* \ingroup bli
* \brief File and directory operations.
* */
*/
#pragma once

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
#pragma once

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
#pragma once

View File

@ -12,8 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* */
*/
#pragma once

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
#pragma once

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
#pragma once

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
#pragma once

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
#pragma once

View File

@ -17,7 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
* */
*/
#pragma once

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
#pragma once

View File

@ -15,7 +15,7 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation
* All rights reserved.
* */
*/
#pragma once

View File

@ -15,7 +15,7 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation
* All rights reserved.
* */
*/
#pragma once

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
#pragma once

View File

@ -278,6 +278,7 @@ set(SRC
BLI_sys_types.h
BLI_system.h
BLI_task.h
BLI_task.hh
BLI_threads.h
BLI_timecode.h
BLI_timeit.hh

View File

@ -29,8 +29,8 @@
#include <string.h>
#ifndef WIN32
# include <stdlib.h>
# include <signal.h>
# include <stdlib.h>
# include <sys/mman.h> // for mmap
# include <unistd.h> // for read close
#else

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
/** \file
* \ingroup bli

View File

@ -414,8 +414,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r
/* This vert has a free quadrant
* Test if we can place the box here
* vert->free & quad_flags[j] - Checks
* */
* `vert->free & quad_flags[j]` - Checks. */
for (j = 0; (j < 4) && isect; j++) {
if (vert->free & quad_flag(j)) {

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
/** \file
* \ingroup bli

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
/** \file
* \ingroup bli

View File

@ -12,8 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* */
*/
/** \file
* \ingroup bli

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
/** \file
* \ingroup bli

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
/** \file
* \ingroup bli

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
/** \file
* \ingroup bli

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
/** \file
* \ingroup bli
@ -3887,7 +3886,7 @@ void interp_weights_quad_v3(float w[4],
* - 0 if the point is outside of triangle.
* - 1 if the point is inside triangle.
* - 2 if it's on the edge.
* */
*/
int barycentric_inside_triangle_v2(const float w[3])
{
if (IN_RANGE(w[0], 0.0f, 1.0f) && IN_RANGE(w[1], 0.0f, 1.0f) && IN_RANGE(w[2], 0.0f, 1.0f)) {

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
/** \file
* \ingroup bli

View File

@ -15,7 +15,7 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation.
* All rights reserved.
* */
*/
/** \file
* \ingroup bli

View File

@ -15,7 +15,7 @@
*
* The Original Code is Copyright (C) 2015 by Blender Foundation.
* All rights reserved.
* */
*/
/** \file
* \ingroup bli

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
/** \file
* \ingroup bli

View File

@ -17,8 +17,7 @@
* All rights reserved.
*
* The Original Code is: some of this file.
*
* */
*/
/** \file
* \ingroup bli

View File

@ -1650,7 +1650,7 @@ bool BLI_path_filename_ensure(char *filepath, size_t maxlen, const char *filenam
* - Wont create any directories.
* - Doesn't use CWD, or deal with relative paths.
* - Only fill's in \a dir and \a file when they are non NULL.
* */
*/
void BLI_split_dirfile(
const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen)
{

View File

@ -289,9 +289,8 @@ void BLI_threadpool_clear(ListBase *threadbase)
void BLI_threadpool_end(ListBase *threadbase)
{
/* only needed if there's actually some stuff to end
* this way we don't end up decrementing thread_levels on an empty threadbase
* */
/* Only needed if there's actually some stuff to end
* this way we don't end up decrementing thread_levels on an empty `threadbase`. */
if (threadbase == nullptr || BLI_listbase_is_empty(threadbase)) {
return;
}

View File

@ -54,12 +54,14 @@ BLI_INLINE int FLOORI(float x)
return ((x >= 0.0f) || (float)r == x) ? r : (r - 1);
}
/* clamp function, cannot use the CLAMPIS macro,
/**
* clamp function, cannot use the CLAMPIS macro,
* it sometimes returns unwanted results apparently related to
* gcc optimization flag -fstrict-overflow which is enabled at -O2
* gcc optimization flag `-fstrict-overflow` which is enabled at `-O2`
*
* this causes the test (x + 2) < 0 with int x == 2147483647 to return false (x being an integer,
* x + 2 should wrap around to -2147483647 so the test < 0 should return true, which it doesn't) */
* x + 2 should wrap around to -2147483647 so the test < 0 should return true, which it doesn't).
*/
BLI_INLINE int64_t _clamp(int a, int b, int c)
{
return (a < b) ? b : ((a > c) ? c : a);

View File

@ -500,7 +500,7 @@ void do_versions_after_linking_290(Main *bmain, ReportList *UNUSED(reports))
/**
* Make sure Emission Alpha fcurve and drivers is properly mapped after the Emission Strength
* got introduced.
* */
*/
/**
* Effectively we are replacing the (animation of) node socket input 18 with 19.
@ -511,7 +511,7 @@ void do_versions_after_linking_290(Main *bmain, ReportList *UNUSED(reports))
*
* The for loop for the input ids is at the top level otherwise we lose the animation
* keyframe data.
* */
*/
for (int input_id = 21; input_id >= 18; input_id--) {
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type == NTREE_SHADER) {
@ -1573,23 +1573,25 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
/**
* Versioning code until next subversion bump goes here.
*
* \note Be sure to check when bumping the version:
* - "versioning_userdef.c", #blo_do_versions_userdef
* - "versioning_userdef.c", #do_versions_theme
*
* \note Keep this message at the bottom of the function.
*/
{
/* Keep this block, even when empty. */
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "CurveMapping", "*pressure_size_curve")) {
LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
BKE_brush_default_input_curves_set(br);
if ((!MAIN_VERSION_ATLEAST(bmain, 292, 14)) ||
((bmain->versionfile == 293) && (!MAIN_VERSION_ATLEAST(bmain, 293, 1)))) {
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type != NTREE_GEOMETRY) {
continue;
}
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->type == GEO_NODE_OBJECT_INFO && node->storage == NULL) {
NodeGeometryObjectInfo *data = (NodeGeometryObjectInfo *)MEM_callocN(
sizeof(NodeGeometryObjectInfo), __func__);
data->transform_space = GEO_NODE_TRANSFORM_SPACE_RELATIVE;
node->storage = data;
}
}
}
FOREACH_NODETREE_END;
}
if (!MAIN_VERSION_ATLEAST(bmain, 293, 1)) {
/* Grease pencil layer transform matrix. */
if (!DNA_struct_elem_find(fd->filesdna, "bGPDlayer", "float", "location[0]")) {
LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
@ -1608,5 +1610,24 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
brush->gpencil_settings->fill_factor = 1.0f;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "CurveMapping", "*pressure_size_curve")) {
LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
BKE_brush_default_input_curves_set(br);
}
}
}
/**
* Versioning code until next subversion bump goes here.
*
* \note Be sure to check when bumping the version:
* - "versioning_userdef.c", #blo_do_versions_userdef
* - "versioning_userdef.c", #do_versions_theme
*
* \note Keep this message at the bottom of the function.
*/
{
/* Keep this block, even when empty. */
}
}

View File

@ -203,3 +203,22 @@ bool BM_edge_uv_share_vert_check(BMEdge *e, BMLoop *l_a, BMLoop *l_b, const int
return true;
}
/**
* Check if the point is inside the UV face.
*/
bool BM_face_uv_point_inside_test(const BMFace *f, const float co[2], const int cd_loop_uv_offset)
{
float(*projverts)[2] = BLI_array_alloca(projverts, f->len);
BMLoop *l_iter;
int i;
BLI_assert(BM_face_is_normal_valid(f));
for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f); i < f->len; i++, l_iter = l_iter->next) {
copy_v2_v2(projverts[i], BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset));
}
return isect_point_poly_v2(co, projverts, f->len, false);
}

View File

@ -58,3 +58,8 @@ bool BM_loop_uv_share_vert_check(BMLoop *l_a,
BMLoop *l_b,
const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();
bool BM_face_uv_point_inside_test(const BMFace *f,
const float co[2],
const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();

View File

@ -294,8 +294,7 @@ static void bm_decim_build_edge_cost_single(BMEdge *e,
/* subtract existing cost to further differentiate edges from one another
*
* keep topology cost below 0.0 so their values don't interfere with quadric cost,
* (and they get handled first).
* */
* (and they get handled first). */
if (vweights == NULL) {
cost = bm_decim_build_edge_cost_single_squared__topology(e) - cost;
}

View File

@ -341,6 +341,10 @@ StampData *OutputOpenExrMultiLayerOperation::createStampData() const
render_result.stamp_data = stamp_data;
for (int i = 0; i < this->m_layers.size(); i++) {
const OutputOpenExrLayer *layer = &this->m_layers[i];
/* Skip unconnected sockets. */
if (layer->imageInput == nullptr) {
continue;
}
std::unique_ptr<MetaData> meta_data = layer->imageInput->getMetaData();
if (meta_data) {
blender::StringRef layer_name = blender::BKE_cryptomatte_extract_layer_name(

View File

@ -88,7 +88,7 @@ struct IDNode : public Node {
* which could be "stale" pointer. */
uint id_orig_session_uuid;
/* Evaluated datablock.
/* Evaluated data-block.
* Will be covered by the copy-on-write system if the ID Type needs it. */
ID *id_cow;
@ -107,7 +107,7 @@ struct IDNode : public Node {
eDepsNode_LinkedState_Type linked_state;
/* Indicates the datablock is visible in the evaluated scene. */
/* Indicates the data-block is visible in the evaluated scene. */
bool is_directly_visible;
/* For the collection type of ID, denotes whether collection was fully

View File

@ -22,6 +22,7 @@
*/
#include "BKE_context.h"
#include "BKE_scene.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
@ -91,7 +92,6 @@ static void draw_current_frame(const Scene *scene,
const View2D *v2d,
const rcti *scrub_region_rect,
int current_frame,
float sub_frame,
bool draw_line)
{
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
@ -109,7 +109,7 @@ static void draw_current_frame(const Scene *scene,
if (draw_line) {
/* Draw vertical line to from the bottom of the current frame box to the bottom of the screen.
*/
const float subframe_x = UI_view2d_view_to_region_x(v2d, current_frame + sub_frame);
const float subframe_x = UI_view2d_view_to_region_x(v2d, BKE_scene_frame_get(scene));
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@ -163,13 +163,7 @@ void ED_time_scrub_draw_current_frame(const ARegion *region,
rcti scrub_region_rect;
get_time_scrub_region_rect(region, &scrub_region_rect);
draw_current_frame(scene,
display_seconds,
v2d,
&scrub_region_rect,
scene->r.cfra,
scene->r.subframe,
draw_line);
draw_current_frame(scene, display_seconds, v2d, &scrub_region_rect, scene->r.cfra, draw_line);
GPU_matrix_pop_projection();
}

View File

@ -306,8 +306,7 @@ static EditBone *get_named_editbone(ListBase *edbo, const char *name)
return NULL;
}
/* Call this before doing any duplications
* */
/* Call this before doing any duplications. */
void preEditBoneDuplicate(ListBase *editbones)
{
/* clear temp */

View File

@ -1022,7 +1022,7 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
tpt->uv_fac = 0.0f;
}
tpt->uv_rot = p2d->uv_rot;
tpt->uv_rot = 0.0f;
gpd->runtime.sbuffer_used++;
@ -1044,6 +1044,7 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
pt->time = 0.0f;
pt->flag = 0;
pt->uv_fac = tpt->uv_fac;
pt->uv_rot = 0.0f;
ED_gpencil_point_vertex_color_set(ts, brush, pt, tpt);
if (gps->dvert != NULL) {

View File

@ -51,6 +51,10 @@ typedef enum {
#define NODE_GRID_STEPS 5
/* space_node.c */
void ED_node_cursor_location_get(const struct SpaceNode *snode, float value[2]);
void ED_node_cursor_location_set(struct SpaceNode *snode, const float value[2]);
int ED_node_tree_path_length(struct SpaceNode *snode);
void ED_node_tree_path_get(struct SpaceNode *snode, char *value);
void ED_node_tree_path_get_fixedbuf(struct SpaceNode *snode, char *value, int max_length);

View File

@ -57,15 +57,14 @@ struct wmMsgSubscribeKey;
struct wmMsgSubscribeValue;
struct wmNotifier;
struct wmOperatorType;
struct wmRegionListenerParams;
struct wmRegionMessageSubscribeParams;
struct wmSpaceTypeListenerParams;
struct wmWindow;
struct wmWindowManager;
/* regions */
void ED_region_do_listen(struct wmWindow *win,
struct ScrArea *area,
struct ARegion *region,
struct wmNotifier *note,
const Scene *scene);
void ED_region_do_listen(struct wmRegionListenerParams *params);
void ED_region_do_layout(struct bContext *C, struct ARegion *region);
void ED_region_do_draw(struct bContext *C, struct ARegion *region);
void ED_region_exit(struct bContext *C, struct ARegion *region);
@ -144,29 +143,11 @@ void ED_area_do_msg_notify_tag_refresh(struct bContext *C,
struct wmMsgSubscribeKey *msg_key,
struct wmMsgSubscribeValue *msg_val);
void ED_area_do_mgs_subscribe_for_tool_header(const struct bContext *C,
struct WorkSpace *workspace,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *area,
struct ARegion *region,
struct wmMsgBus *mbus);
void ED_area_do_mgs_subscribe_for_tool_ui(const struct bContext *C,
struct WorkSpace *workspace,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *area,
struct ARegion *region,
struct wmMsgBus *mbus);
void ED_area_do_mgs_subscribe_for_tool_header(const struct wmRegionMessageSubscribeParams *params);
void ED_area_do_mgs_subscribe_for_tool_ui(const struct wmRegionMessageSubscribeParams *params);
/* message bus */
void ED_region_message_subscribe(struct bContext *C,
struct WorkSpace *workspace,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *area,
struct ARegion *region,
struct wmMsgBus *mbus);
void ED_region_message_subscribe(struct wmRegionMessageSubscribeParams *params);
/* spaces */
void ED_spacetypes_keymap(struct wmKeyConfig *keyconf);
@ -178,7 +159,7 @@ void ED_area_exit(struct bContext *C, struct ScrArea *area);
int ED_screen_area_active(const struct bContext *C);
void ED_screen_global_areas_refresh(struct wmWindow *win);
void ED_screen_global_areas_sync(struct wmWindow *win);
void ED_area_do_listen(struct wmWindow *win, ScrArea *area, struct wmNotifier *note, Scene *scene);
void ED_area_do_listen(struct wmSpaceTypeListenerParams *params);
void ED_area_tag_redraw(ScrArea *area);
void ED_area_tag_redraw_no_rebuild(ScrArea *area);
void ED_area_tag_redraw_regiontype(ScrArea *area, int type);
@ -427,13 +408,8 @@ void ED_region_cache_draw_cached_segments(struct ARegion *region,
const int efra);
/* area_utils.c */
void ED_region_generic_tools_region_message_subscribe(const struct bContext *C,
struct WorkSpace *workspace,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *area,
struct ARegion *region,
struct wmMsgBus *mbus);
void ED_region_generic_tools_region_message_subscribe(
const struct wmRegionMessageSubscribeParams *params);
int ED_region_generic_tools_region_snap_size(const struct ARegion *region, int size, int axis);
/* area_query.c */

View File

@ -98,8 +98,7 @@ enum TfmMode {
/* Standalone call to get the transformation center corresponding to the current situation
* returns 1 if successful, 0 otherwise (usually means there's no selection)
* (if 0 is returns, *vec is unmodified)
* */
* (if false is returns, `cent3d` is unmodified). */
bool calculateTransformCenter(struct bContext *C,
int centerMode,
float cent3d[3],

View File

@ -664,8 +664,7 @@ bool UI_popup_block_name_exists(const struct bScreen *screen, const char *name);
* Begin/Define Buttons/End/Draw is the typical order in which these
* function should be called, though for popup blocks Draw is left out.
* Freeing blocks is done by the screen/ module automatically.
*
* */
*/
uiBlock *UI_block_begin(const struct bContext *C,
struct ARegion *region,

View File

@ -1279,12 +1279,10 @@ static bool ui_but_event_property_operator_string(const bContext *C,
char *buf,
const size_t buf_len)
{
/* context toggle operator names to check... */
/* Context toggle operator names to check. */
/* This function could use a refactor to generalize button type to operator relationship
* as well as which operators use properties.
* - Campbell
* */
* as well as which operators use properties. - Campbell */
const char *ctx_toggle_opnames[] = {
"WM_OT_context_toggle",
"WM_OT_context_toggle_enum",

View File

@ -413,12 +413,11 @@ static void ui_block_region_draw(const bContext *C, ARegion *region)
/**
* Use to refresh centered popups on screen resizing (for splash).
*/
static void ui_block_region_popup_window_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void ui_block_region_popup_window_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
switch (wmn->category) {
case NC_WINDOW: {
switch (wmn->action) {

View File

@ -1106,11 +1106,6 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
float dx = RNA_float_get(op->ptr, "deltax") / U.dpi_fac;
float dy = RNA_float_get(op->ptr, "deltay") / U.dpi_fac;
if (U.uiflag & USER_ZOOM_INVERT) {
dx *= -1;
dy *= -1;
}
/* Check if the 'timer' is initialized, as zooming with the trackpad
* never uses the "Continuous" zoom method, and the 'timer' is not initialized. */
if ((U.viewzoom == USER_ZOOM_CONT) && vzd->timer) { /* XXX store this setting as RNA prop? */
@ -1232,26 +1227,53 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
vzd->lastx = event->prevx;
vzd->lasty = event->prevy;
/* As we have only 1D information (magnify value), feed both axes
* with magnify information that is stored in x axis
*/
float fac = 0.01f * (event->prevx - event->x);
float dx = fac * BLI_rctf_size_x(&v2d->cur) / 10.0f;
if (event->type == MOUSEPAN) {
fac = 0.01f * (event->prevy - event->y);
float facx, facy;
float zoomfac = 0.01f;
/* Some view2d's (graph) don't have min/max zoom, or extreme ones. */
if (v2d->maxzoom > 0.0f) {
zoomfac = clamp_f(0.001f * v2d->maxzoom, 0.001f, 0.01f);
}
if (event->type == MOUSEPAN) {
facx = zoomfac * WM_event_absolute_delta_x(event);
facy = zoomfac * WM_event_absolute_delta_y(event);
if (U.uiflag & USER_ZOOM_INVERT) {
facx *= -1.0f;
facy *= -1.0f;
}
}
else { /* MOUSEZOOM */
facx = facy = zoomfac * WM_event_absolute_delta_x(event);
}
/* Only respect user setting zoom axis if the view does not have any zoom restrictions
* any will be scaled uniformly. */
if (((v2d->keepzoom & (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y)) == 0) &&
(v2d->keepzoom & V2D_KEEPASPECT)) {
if (U.uiflag & USER_ZOOM_HORIZ) {
facy = 0.0f;
}
else {
facx = 0.0f;
}
}
float dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f;
/* support trackpad zoom to always zoom entirely - the v2d code uses portrait or
* landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy)) {
dy = dx;
if (fabsf(facx) > fabsf(facy)) {
facy = facx;
}
else {
dx = dy;
facx = facy;
}
}
const float dx = facx * BLI_rctf_size_x(&v2d->cur);
const float dy = facy * BLI_rctf_size_y(&v2d->cur);
RNA_float_set(op->ptr, "deltax", dx);
RNA_float_set(op->ptr, "deltay", dy);
@ -1320,19 +1342,13 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
/* x-axis transform */
dist = BLI_rcti_size_x(&v2d->mask) / 2.0f;
len_old[0] = fabsf(vzd->lastx - vzd->region->winrct.xmin - dist);
len_new[0] = fabsf(event->x - vzd->region->winrct.xmin - dist);
len_old[0] *= zoomfac * BLI_rctf_size_x(&v2d->cur);
len_new[0] *= zoomfac * BLI_rctf_size_x(&v2d->cur);
len_old[0] = zoomfac * fabsf(vzd->lastx - vzd->region->winrct.xmin - dist);
len_new[0] = zoomfac * fabsf(event->x - vzd->region->winrct.xmin - dist);
/* y-axis transform */
dist = BLI_rcti_size_y(&v2d->mask) / 2.0f;
len_old[1] = fabsf(vzd->lasty - vzd->region->winrct.ymin - dist);
len_new[1] = fabsf(event->y - vzd->region->winrct.ymin - dist);
len_old[1] *= zoomfac * BLI_rctf_size_y(&v2d->cur);
len_new[1] *= zoomfac * BLI_rctf_size_y(&v2d->cur);
len_old[1] = zoomfac * fabsf(vzd->lasty - vzd->region->winrct.ymin - dist);
len_new[1] = zoomfac * fabsf(event->y - vzd->region->winrct.ymin - dist);
/* Calculate distance */
if (v2d->keepzoom & V2D_KEEPASPECT) {
@ -1343,40 +1359,44 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
dx = len_new[0] - len_old[0];
dy = len_new[1] - len_old[1];
}
}
else {
/* 'continuous' or 'dolly' */
float fac;
/* x-axis transform */
fac = zoomfac * (event->x - vzd->lastx);
dx = fac * BLI_rctf_size_x(&v2d->cur);
/* y-axis transform */
fac = zoomfac * (event->y - vzd->lasty);
dy = fac * BLI_rctf_size_y(&v2d->cur);
dx *= BLI_rctf_size_x(&v2d->cur);
dy *= BLI_rctf_size_y(&v2d->cur);
}
else { /* USER_ZOOM_CONT or USER_ZOOM_DOLLY */
float facx = zoomfac * (event->x - vzd->lastx);
float facy = zoomfac * (event->y - vzd->lasty);
/* Only respect user setting zoom axis if the view does not have any zoom restrictions
* any will be scaled uniformly */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 &&
(v2d->keepzoom & V2D_KEEPASPECT)) {
if (U.uiflag & USER_ZOOM_HORIZ) {
dy = 0;
facy = 0.0f;
}
else {
dx = 0;
facx = 0.0f;
}
}
/* support zoom to always zoom entirely - the v2d code uses portrait or
* landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(facx) > fabsf(facy)) {
facy = facx;
}
else {
facx = facy;
}
}
dx = facx * BLI_rctf_size_x(&v2d->cur);
dy = facy * BLI_rctf_size_y(&v2d->cur);
}
/* support zoom to always zoom entirely - the v2d code uses portrait or
* landscape exceptions */
if (v2d->keepzoom & V2D_KEEPASPECT) {
if (fabsf(dx) > fabsf(dy)) {
dy = dx;
}
else {
dx = dy;
}
if (U.uiflag & USER_ZOOM_INVERT) {
dx *= -1.0f;
dy *= -1.0f;
}
/* set transform amount, and add current deltas to stored total delta (for redo) */

View File

@ -606,7 +606,14 @@ void ED_mask_point_pos__reverse(
bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2])
{
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
Mask *mask = CTX_data_edit_mask(C);
/* Use evaluated mask to take animation into account.
* The animation of splies is not "flushed" back to original, so need to explicitly
* sue evaluated datablock here. */
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask->id);
bool ok = false;
if (mask == NULL) {
@ -614,7 +621,7 @@ bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2])
}
INIT_MINMAX2(min, max);
for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL;
for (MaskLayer *mask_layer = mask_eval->masklayers.first; mask_layer != NULL;
mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;

View File

@ -3364,6 +3364,9 @@ static int object_add_named_exec(bContext *C, wmOperator *op)
ED_view3d_cursor3d_position(C, mval, false, basen->object->loc);
}
/* object_add_duplicate_internal() doesn't deselect other objects, unlike object_add_common() or
* BKE_view_layer_base_deselect_all(). */
ED_object_base_deselect_all(view_layer, NULL, BA_DESELECT);
ED_object_base_select(basen, BA_SELECT);
ED_object_base_activate(C, basen);

View File

@ -441,6 +441,12 @@ static bool bake_object_check(ViewLayer *view_layer,
}
Mesh *me = (Mesh *)ob->data;
if (me->totpoly == 0) {
BKE_reportf(reports, RPT_ERROR, "No faces found in the object \"%s\"", ob->id.name + 2);
return false;
}
if (target == R_BAKE_TARGET_VERTEX_COLORS) {
MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_MLOOPCOL);

View File

@ -535,7 +535,7 @@ void ED_object_modifier_copy_to_object(bContext *C,
Object *ob_src,
ModifierData *md)
{
BKE_object_copy_modifier(ob_dst, ob_src, md);
BKE_object_copy_modifier(CTX_data_main(C), CTX_data_scene(C), ob_dst, ob_src, md);
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob_dst);
DEG_id_tag_update(&ob_dst->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
@ -1684,74 +1684,6 @@ void OBJECT_OT_modifier_set_active(wmOperatorType *ot)
/** \name Copy Modifier To Selected Operator
* \{ */
/* If the modifier uses particles, copy particle system to destination object
* or reuse existing if it has the same ParticleSettings */
static void copy_or_reuse_particle_system(bContext *C, Object *ob, ModifierData *md)
{
ParticleSystem *psys_on_modifier = NULL;
if (md->type == eModifierType_DynamicPaint) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
if (pmd->brush && pmd->brush->psys) {
psys_on_modifier = pmd->brush->psys;
}
}
else if (md->type == eModifierType_Fluid) {
FluidModifierData *fmd = (FluidModifierData *)md;
if (fmd->type == MOD_FLUID_TYPE_FLOW) {
if (fmd->flow && fmd->flow->psys) {
psys_on_modifier = fmd->flow->psys;
}
}
}
if (!psys_on_modifier) {
return;
}
ParticleSystem *psys_on_new_modifier = NULL;
/* Check if a particle system with the same particle settings
* already exists on the destination object. */
LISTBASE_FOREACH (ParticleSystem *, psys, &ob->particlesystem) {
if (psys_on_modifier->part == psys->part) {
psys_on_new_modifier = psys;
break;
}
}
/* If it does not exist, copy the particle system to the destination object. */
if (!psys_on_new_modifier) {
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
object_copy_particle_system(bmain, scene, ob, psys_on_modifier);
LISTBASE_FOREACH (ParticleSystem *, psys, &ob->particlesystem) {
if (psys_on_modifier->part == psys->part) {
psys_on_new_modifier = psys;
}
}
}
/* Update the modifier to point to the new/existing particle system. */
LISTBASE_FOREACH (ModifierData *, new_md, &ob->modifiers) {
if (new_md->type == eModifierType_DynamicPaint) {
DynamicPaintModifierData *new_pmd = (DynamicPaintModifierData *)new_md;
if (psys_on_modifier == new_pmd->brush->psys) {
new_pmd->brush->psys = psys_on_new_modifier;
}
}
else if (new_md->type == eModifierType_Fluid) {
FluidModifierData *new_fmd = (FluidModifierData *)new_md;
if (psys_on_modifier == new_fmd->flow->psys) {
new_fmd->flow->psys = psys_on_new_modifier;
}
}
}
}
static int modifier_copy_to_selected_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
@ -1791,22 +1723,12 @@ static int modifier_copy_to_selected_exec(bContext *C, wmOperator *op)
}
}
if (md->type == eModifierType_ParticleSystem) {
ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
object_copy_particle_system(bmain, scene, ob, psmd->psys);
}
else {
if (!BKE_object_copy_modifier(ob, obact, md)) {
BKE_reportf(op->reports,
RPT_ERROR,
"Copying modifier '%s' to object '%s' failed",
md->name,
ob->id.name + 2);
}
}
if (ELEM(md->type, eModifierType_DynamicPaint, eModifierType_Fluid)) {
copy_or_reuse_particle_system(C, ob, md);
if (!BKE_object_copy_modifier(bmain, scene, ob, obact, md)) {
BKE_reportf(op->reports,
RPT_ERROR,
"Copying modifier '%s' to object '%s' failed",
md->name,
ob->id.name + 2);
}
num_copied++;

View File

@ -1790,20 +1790,33 @@ void OBJECT_OT_make_links_scene(wmOperatorType *ot)
void OBJECT_OT_make_links_data(wmOperatorType *ot)
{
static const EnumPropertyItem make_links_items[] = {
{MAKE_LINKS_OBDATA, "OBDATA", 0, "Object Data", ""},
{MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""},
{MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""},
{MAKE_LINKS_GROUP, "GROUPS", 0, "Collection", ""},
{MAKE_LINKS_DUPLICOLLECTION, "DUPLICOLLECTION", 0, "Instance Collection", ""},
{MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Modifiers", ""},
{MAKE_LINKS_FONTS, "FONTS", 0, "Fonts", ""},
{MAKE_LINKS_SHADERFX, "EFFECTS", 0, "Effects", ""},
{MAKE_LINKS_OBDATA, "OBDATA", 0, "Link Object Data", "Replace assigned Object Data"},
{MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Link Materials", "Replace assigned Materials"},
{MAKE_LINKS_ANIMDATA,
"ANIMATION",
0,
"Link Animation Data",
"Replace assigned Animation Data"},
{MAKE_LINKS_GROUP, "GROUPS", 0, "Link Collections", "Replace assigned Collections"},
{MAKE_LINKS_DUPLICOLLECTION,
"DUPLICOLLECTION",
0,
"Link Instance Collection",
"Replace assigned Collection Instance"},
{MAKE_LINKS_FONTS, "FONTS", 0, "Link Fonts to Text", "Replace Text object Fonts"},
{0, "", 0, NULL, NULL},
{MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Copy Modifiers", "Replace Modifiers"},
{MAKE_LINKS_SHADERFX,
"EFFECTS",
0,
"Copy Grease Pencil Effects",
"Replace Grease Pencil Effects"},
{0, NULL, 0, NULL, NULL},
};
/* identifiers */
ot->name = "Link Data";
ot->description = "Apply active object links to other selected objects";
ot->name = "Link/Transfer Data";
ot->description = "Transfer data from active object to selected objects";
ot->idname = "OBJECT_OT_make_links_data";
/* api callbacks */

View File

@ -3750,8 +3750,7 @@ static void brush_puff(PEData *data, int point_index, float mouse_distance)
}
}
else {
/* compute position as if hair was standing up straight.
* */
/* Compute position as if hair was standing up straight. */
float length;
copy_v3_v3(co_prev, co);
copy_v3_v3(co, key->co);

View File

@ -141,13 +141,15 @@ void ED_region_pixelspace(ARegion *region)
}
/* only exported for WM */
void ED_region_do_listen(
wmWindow *win, ScrArea *area, ARegion *region, wmNotifier *note, const Scene *scene)
void ED_region_do_listen(wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *notifier = params->notifier;
/* generic notes first */
switch (note->category) {
switch (notifier->category) {
case NC_WM:
if (note->data == ND_FILEREAD) {
if (notifier->data == ND_FILEREAD) {
ED_region_tag_redraw(region);
}
break;
@ -157,16 +159,16 @@ void ED_region_do_listen(
}
if (region->type && region->type->listener) {
region->type->listener(win, area, region, note, scene);
region->type->listener(params);
}
}
/* only exported for WM */
void ED_area_do_listen(wmWindow *win, ScrArea *area, wmNotifier *note, Scene *scene)
void ED_area_do_listen(wmSpaceTypeListenerParams *params)
{
/* no generic notes? */
if (area->type && area->type->listener) {
area->type->listener(win, area, note, scene);
if (params->area->type && params->area->type->listener) {
params->area->type->listener(params);
}
}
@ -418,16 +420,13 @@ void ED_area_do_msg_notify_tag_refresh(
ED_area_tag_refresh(area);
}
void ED_area_do_mgs_subscribe_for_tool_header(
/* Follow ARegionType.message_subscribe */
const struct bContext *UNUSED(C),
struct WorkSpace *workspace,
struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen),
struct ScrArea *UNUSED(area),
struct ARegion *region,
struct wmMsgBus *mbus)
/* Follow ARegionType.message_subscribe */
void ED_area_do_mgs_subscribe_for_tool_header(const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
WorkSpace *workspace = params->workspace;
ARegion *region = params->region;
BLI_assert(region->regiontype == RGN_TYPE_TOOL_HEADER);
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = region,
@ -438,16 +437,12 @@ void ED_area_do_mgs_subscribe_for_tool_header(
mbus, &workspace->id, workspace, WorkSpace, tools, &msg_sub_value_region_tag_redraw);
}
void ED_area_do_mgs_subscribe_for_tool_ui(
/* Follow ARegionType.message_subscribe */
const struct bContext *UNUSED(C),
struct WorkSpace *workspace,
struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen),
struct ScrArea *UNUSED(area),
struct ARegion *region,
struct wmMsgBus *mbus)
void ED_area_do_mgs_subscribe_for_tool_ui(const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
WorkSpace *workspace = params->workspace;
ARegion *region = params->region;
BLI_assert(region->regiontype == RGN_TYPE_UI);
const char *panel_category_tool = "Tool";
const char *category = UI_panel_category_active_get(region, false);
@ -634,7 +629,16 @@ void ED_region_do_draw(bContext *C, ARegion *region)
WM_msg_subscribe_rna(mbus, &ptr, NULL, &msg_sub_value_region_tag_redraw, __func__);
}
ED_region_message_subscribe(C, workspace, scene, screen, area, region, mbus);
wmRegionMessageSubscribeParams message_subscribe_params = {
.context = C,
.message_bus = mbus,
.workspace = workspace,
.scene = scene,
.screen = screen,
.area = area,
.region = region,
};
ED_region_message_subscribe(&message_subscribe_params);
}
}
@ -4027,14 +4031,12 @@ void ED_region_cache_draw_cached_segments(
/**
* Generate subscriptions for this region.
*/
void ED_region_message_subscribe(bContext *C,
struct WorkSpace *workspace,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *area,
struct ARegion *region,
struct wmMsgBus *mbus)
void ED_region_message_subscribe(wmRegionMessageSubscribeParams *params)
{
ARegion *region = params->region;
const bContext *C = params->context;
struct wmMsgBus *mbus = params->message_bus;
if (region->gizmo_map != NULL) {
WM_gizmomap_message_subscribe(C, region->gizmo_map, region, mbus);
}
@ -4044,7 +4046,7 @@ void ED_region_message_subscribe(bContext *C,
}
if (region->type->message_subscribe != NULL) {
region->type->message_subscribe(C, workspace, scene, screen, area, region, mbus);
region->type->message_subscribe(params);
}
}

View File

@ -22,6 +22,8 @@
#include "DNA_userdef_types.h"
#include "BKE_screen.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@ -42,14 +44,11 @@
/**
* Callback for #ARegionType.message_subscribe
*/
void ED_region_generic_tools_region_message_subscribe(const struct bContext *UNUSED(C),
struct WorkSpace *UNUSED(workspace),
struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen),
struct ScrArea *UNUSED(area),
struct ARegion *region,
struct wmMsgBus *mbus)
void ED_region_generic_tools_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
ARegion *region = params->region;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = region,
.user_data = region,

View File

@ -57,11 +57,12 @@ static void immDrawPixelsTexSetupAttributes(IMMDrawPixelsTexState *state)
vert_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
}
/* To be used before calling immDrawPixelsTex
* Default shader is GPU_SHADER_2D_IMAGE_COLOR
* You can still set uniforms with :
* GPU_shader_uniform_int(shader, GPU_shader_get_uniform(shader, "name"), 0);
* */
/**
* To be used before calling #immDrawPixelsTex
* Default shader is #GPU_SHADER_2D_IMAGE_COLOR
* You can still set uniforms with:
* `GPU_shader_uniform_int(shader, GPU_shader_get_uniform(shader, "name"), 0);`
*/
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
{
IMMDrawPixelsTexState state;
@ -77,10 +78,11 @@ IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
return state;
}
/* Use the currently bound shader.
/**
* Use the currently bound shader.
*
* Use immDrawPixelsTexSetup to bind the shader you
* want before calling immDrawPixelsTex.
* Use #immDrawPixelsTexSetup to bind the shader you
* want before calling #immDrawPixelsTex.
*
* If using a special shader double check it uses the same
* attributes "pos" "texCoord" and uniform "image".
@ -89,7 +91,7 @@ IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
*
* Be also aware that this function unbinds the shader when
* it's finished.
* */
*/
void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
float x,
float y,

View File

@ -2415,9 +2415,10 @@ static bool IsectPT2Df_limit(
(area_tri_v2(v1, v2, v3))) < limit;
}
/* Clip the face by a bucket and set the uv-space bucket_bounds_uv
/**
* Clip the face by a bucket and set the uv-space bucket_bounds_uv
* so we have the clipped UV's to do pixel intersection tests with
* */
*/
static int float_z_sort_flip(const void *p1, const void *p2)
{
return (((float *)p1)[2] < ((float *)p2)[2] ? 1 : -1);

View File

@ -305,12 +305,11 @@ static void action_header_region_draw(const bContext *C, ARegion *region)
ED_region_header(C, region);
}
static void action_channel_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void action_channel_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
@ -356,14 +355,13 @@ static void action_channel_region_listener(wmWindow *UNUSED(win),
}
}
static void saction_channel_region_message_subscribe(const struct bContext *UNUSED(C),
struct WorkSpace *UNUSED(workspace),
struct Scene *UNUSED(scene),
struct bScreen *screen,
struct ScrArea *area,
struct ARegion *region,
struct wmMsgBus *mbus)
static void saction_channel_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
bScreen *screen = params->screen;
ScrArea *area = params->area;
ARegion *region = params->region;
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceDopeSheetEditor, area->spacedata.first, &ptr);
@ -401,12 +399,11 @@ static void saction_channel_region_message_subscribe(const struct bContext *UNUS
}
}
static void action_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void action_main_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
@ -460,14 +457,14 @@ static void action_main_region_listener(wmWindow *UNUSED(win),
}
}
static void saction_main_region_message_subscribe(const struct bContext *C,
struct WorkSpace *workspace,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *area,
struct ARegion *region,
struct wmMsgBus *mbus)
static void saction_main_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
Scene *scene = params->scene;
bScreen *screen = params->screen;
ScrArea *area = params->area;
ARegion *region = params->region;
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceDopeSheetEditor, area->spacedata.first, &ptr);
@ -502,15 +499,14 @@ static void saction_main_region_message_subscribe(const struct bContext *C,
}
/* Now run the general "channels region" one - since channels and main should be in sync */
saction_channel_region_message_subscribe(C, workspace, scene, screen, area, region, mbus);
saction_channel_region_message_subscribe(params);
}
/* editor level listener */
static void action_listener(wmWindow *UNUSED(win),
ScrArea *area,
wmNotifier *wmn,
Scene *UNUSED(scene))
static void action_listener(const wmSpaceTypeListenerParams *params)
{
ScrArea *area = params->area;
wmNotifier *wmn = params->notifier;
SpaceAction *saction = (SpaceAction *)area->spacedata.first;
/* context changes */
@ -660,12 +656,11 @@ static void action_listener(wmWindow *UNUSED(win),
}
}
static void action_header_region_listener(wmWindow *UNUSED(win),
ScrArea *area,
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void action_header_region_listener(const wmRegionListenerParams *params)
{
ScrArea *area = params->area;
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
SpaceAction *saction = (SpaceAction *)area->spacedata.first;
/* context changes */
@ -737,12 +732,11 @@ static void action_buttons_area_draw(const bContext *C, ARegion *region)
ED_region_panels(C, region);
}
static void action_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void action_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:

View File

@ -514,12 +514,11 @@ static void buttons_main_region_layout(const bContext *C, ARegion *region)
sbuts->mainbo = sbuts->mainb;
}
static void buttons_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void buttons_main_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_SCREEN:
@ -567,15 +566,13 @@ static void buttons_header_region_draw(const bContext *C, ARegion *region)
ED_region_header(C, region);
}
static void buttons_header_region_message_subscribe(const bContext *UNUSED(C),
WorkSpace *UNUSED(workspace),
Scene *UNUSED(scene),
bScreen *UNUSED(screen),
ScrArea *area,
ARegion *region,
struct wmMsgBus *mbus)
static void buttons_header_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
ScrArea *area = params->area;
ARegion *region = params->region;
SpaceProperties *sbuts = area->spacedata.first;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = region,
.user_data = region,
@ -621,14 +618,12 @@ static void buttons_navigation_bar_region_draw(const bContext *C, ARegion *regio
ED_region_panels_draw(C, region);
}
static void buttons_navigation_bar_region_message_subscribe(const bContext *UNUSED(C),
WorkSpace *UNUSED(workspace),
Scene *UNUSED(scene),
bScreen *UNUSED(screen),
ScrArea *UNUSED(area),
ARegion *region,
struct wmMsgBus *mbus)
static void buttons_navigation_bar_region_message_subscribe(
const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
ARegion *region = params->region;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = region,
.user_data = region,
@ -657,11 +652,10 @@ static void buttons_area_redraw(ScrArea *area, short buttons)
* \{ */
/* reused! */
static void buttons_area_listener(wmWindow *UNUSED(win),
ScrArea *area,
wmNotifier *wmn,
Scene *UNUSED(scene))
static void buttons_area_listener(const wmSpaceTypeListenerParams *params)
{
ScrArea *area = params->area;
wmNotifier *wmn = params->notifier;
SpaceProperties *sbuts = area->spacedata.first;
/* context changes */

View File

@ -229,7 +229,7 @@ static void clip_scopes_check_gpencil_change(ScrArea *area)
}
}
static void clip_area_sync_frame_from_scene(ScrArea *area, Scene *scene)
static void clip_area_sync_frame_from_scene(ScrArea *area, const Scene *scene)
{
SpaceClip *space_clip = (SpaceClip *)area->spacedata.first;
BKE_movieclip_user_set_frame(&space_clip->user, scene->r.cfra);
@ -334,8 +334,12 @@ static SpaceLink *clip_duplicate(SpaceLink *sl)
return (SpaceLink *)scn;
}
static void clip_listener(wmWindow *UNUSED(win), ScrArea *area, wmNotifier *wmn, Scene *scene)
static void clip_listener(const wmSpaceTypeListenerParams *params)
{
ScrArea *area = params->area;
wmNotifier *wmn = params->notifier;
const Scene *scene = params->scene;
/* context changes */
switch (wmn->category) {
case NC_SCENE:
@ -881,7 +885,8 @@ static void clip_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_STANDARD, region->winx, region->winy);
/* NOTE: don't use `UI_view2d_region_reinit(&region->v2d, ...)`
* since the space clip manages own v2d in #movieclip_main_area_set_view2d */
/* mask polls mode */
keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0);
@ -1004,12 +1009,11 @@ static void clip_main_region_draw(const bContext *C, ARegion *region)
WM_gizmomap_draw(region->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
}
static void clip_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void clip_main_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_GPENCIL:
@ -1140,11 +1144,7 @@ static void clip_preview_region_draw(const bContext *C, ARegion *region)
}
}
static void clip_preview_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
static void clip_preview_region_listener(const wmRegionListenerParams *UNUSED(params))
{
}
@ -1185,11 +1185,7 @@ static void clip_channels_region_draw(const bContext *C, ARegion *region)
UI_view2d_view_restore(C);
}
static void clip_channels_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
static void clip_channels_region_listener(const wmRegionListenerParams *UNUSED(params))
{
}
@ -1206,12 +1202,11 @@ static void clip_header_region_draw(const bContext *C, ARegion *region)
ED_region_header(C, region);
}
static void clip_header_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void clip_header_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_SCENE:
@ -1249,12 +1244,11 @@ static void clip_tools_region_draw(const bContext *C, ARegion *region)
/****************** tool properties region ******************/
static void clip_props_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void clip_props_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_WM:
@ -1302,12 +1296,11 @@ static void clip_properties_region_draw(const bContext *C, ARegion *region)
ED_region_panels(C, region);
}
static void clip_properties_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void clip_properties_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_GPENCIL:

View File

@ -273,13 +273,11 @@ static void console_header_region_draw(const bContext *C, ARegion *region)
ED_region_header(C, region);
}
static void console_main_region_listener(wmWindow *UNUSED(win),
ScrArea *area,
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void console_main_region_listener(const wmRegionListenerParams *params)
{
// SpaceInfo *sinfo = area->spacedata.first;
ScrArea *area = params->area;
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {

View File

@ -392,11 +392,10 @@ static void file_refresh(const bContext *C, ScrArea *area)
ED_area_tag_redraw(area);
}
static void file_listener(wmWindow *UNUSED(win),
ScrArea *area,
wmNotifier *wmn,
Scene *UNUSED(scene))
static void file_listener(const wmSpaceTypeListenerParams *params)
{
ScrArea *area = params->area;
wmNotifier *wmn = params->notifier;
SpaceFile *sfile = (SpaceFile *)area->spacedata.first;
/* context changes */
@ -447,12 +446,11 @@ static void file_main_region_init(wmWindowManager *wm, ARegion *region)
WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
static void file_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void file_main_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_SPACE:
@ -468,16 +466,15 @@ static void file_main_region_listener(wmWindow *UNUSED(win),
}
}
static void file_main_region_message_subscribe(const struct bContext *UNUSED(C),
struct WorkSpace *UNUSED(workspace),
struct Scene *UNUSED(scene),
struct bScreen *screen,
struct ScrArea *area,
struct ARegion *region,
struct wmMsgBus *mbus)
static void file_main_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
bScreen *screen = params->screen;
ScrArea *area = params->area;
ARegion *region = params->region;
SpaceFile *sfile = area->spacedata.first;
FileSelectParams *params = ED_fileselect_ensure_active_params(sfile);
FileSelectParams *file_params = ED_fileselect_ensure_active_params(sfile);
/* This is a bit odd that a region owns the subscriber for an area,
* keep for now since all subscribers for WM are regions.
* May be worth re-visiting later. */
@ -499,7 +496,7 @@ static void file_main_region_message_subscribe(const struct bContext *UNUSED(C),
/* FileSelectParams */
{
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_FileSelectParams, params, &ptr);
RNA_pointer_create(&screen->id, &RNA_FileSelectParams, file_params, &ptr);
/* All properties for this space type. */
WM_msg_subscribe_rna(mbus, &ptr, NULL, &msg_sub_value_area_tag_refresh, __func__);
@ -649,18 +646,8 @@ static void file_tools_region_draw(const bContext *C, ARegion *region)
ED_region_panels(C, region);
}
static void file_tools_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
static void file_tools_region_listener(const wmRegionListenerParams *UNUSED(params))
{
#if 0
/* context changes */
switch (wmn->category) {
/* pass */
}
#endif
}
/* add handlers, stuff you only do once or on area/region changes */
@ -717,12 +704,11 @@ static void file_execution_region_draw(const bContext *C, ARegion *region)
ED_region_panels(C, region);
}
static void file_ui_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void file_ui_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_SPACE:

View File

@ -403,12 +403,11 @@ static void graph_buttons_region_draw(const bContext *C, ARegion *region)
ED_region_panels(C, region);
}
static void graph_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void graph_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
@ -470,14 +469,14 @@ static void graph_region_listener(wmWindow *UNUSED(win),
}
}
static void graph_region_message_subscribe(const struct bContext *UNUSED(C),
struct WorkSpace *UNUSED(workspace),
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *area,
struct ARegion *region,
struct wmMsgBus *mbus)
static void graph_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
Scene *scene = params->scene;
bScreen *screen = params->screen;
ScrArea *area = params->area;
ARegion *region = params->region;
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceGraphEditor, area->spacedata.first, &ptr);
@ -546,11 +545,10 @@ static void graph_region_message_subscribe(const struct bContext *UNUSED(C),
}
/* editor level listener */
static void graph_listener(wmWindow *UNUSED(win),
ScrArea *area,
wmNotifier *wmn,
Scene *UNUSED(scene))
static void graph_listener(const wmSpaceTypeListenerParams *params)
{
ScrArea *area = params->area;
wmNotifier *wmn = params->notifier;
SpaceGraph *sipo = (SpaceGraph *)area->spacedata.first;
/* context changes */

View File

@ -320,8 +320,11 @@ static void image_refresh(const bContext *C, ScrArea *area)
}
}
static void image_listener(wmWindow *win, ScrArea *area, wmNotifier *wmn, Scene *UNUSED(scene))
static void image_listener(const wmSpaceTypeListenerParams *params)
{
wmWindow *win = params->window;
ScrArea *area = params->area;
wmNotifier *wmn = params->notifier;
SpaceImage *sima = (SpaceImage *)area->spacedata.first;
/* context changes */
@ -603,8 +606,8 @@ static void image_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
/* Image space manages own v2d. */
// UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_STANDARD, region->winx, region->winy);
/* NOTE: don't use `UI_view2d_region_reinit(&region->v2d, ...)`
* since the space clip manages own v2d in #image_main_region_set_view2d */
/* mask polls mode */
keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0);
@ -723,12 +726,12 @@ static void image_main_region_draw(const bContext *C, ARegion *region)
draw_image_cache(C, region);
}
static void image_main_region_listener(wmWindow *UNUSED(win),
ScrArea *area,
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void image_main_region_listener(const wmRegionListenerParams *params)
{
ScrArea *area = params->area;
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_GEOM:
@ -838,12 +841,11 @@ static void image_buttons_region_draw(const bContext *C, ARegion *region)
ED_region_panels_draw(C, region);
}
static void image_buttons_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void image_buttons_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_TEXTURE:
@ -901,12 +903,11 @@ static void image_tools_region_draw(const bContext *C, ARegion *region)
ED_region_panels(C, region);
}
static void image_tools_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void image_tools_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_GPENCIL:
@ -958,12 +959,11 @@ static void image_header_region_draw(const bContext *C, ARegion *region)
ED_region_header(C, region);
}
static void image_header_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void image_header_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_SCENE:

View File

@ -204,13 +204,10 @@ static void info_header_region_draw(const bContext *C, ARegion *region)
ED_region_header(C, region);
}
static void info_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void info_main_region_listener(const wmRegionListenerParams *params)
{
// SpaceInfo *sinfo = area->spacedata.first;
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
@ -223,12 +220,11 @@ static void info_main_region_listener(wmWindow *UNUSED(win),
}
}
static void info_header_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(area),
ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
static void info_header_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
wmNotifier *wmn = params->notifier;
/* context changes */
switch (wmn->category) {
case NC_SCREEN:
@ -259,14 +255,11 @@ static void info_header_listener(wmWindow *UNUSED(win),
}
}
static void info_header_region_message_subscribe(const bContext *UNUSED(C),
WorkSpace *UNUSED(workspace),
Scene *UNUSED(scene),
bScreen *UNUSED(screen),
ScrArea *UNUSED(area),
ARegion *region,
struct wmMsgBus *mbus)
static void info_header_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
ARegion *region = params->region;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = region,
.user_data = region,

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