Merge branch 'master' into temp_bmesh_multires

This commit is contained in:
Joseph Eagar 2021-06-30 21:38:18 -07:00
commit d0759840a0
168 changed files with 5563 additions and 3402 deletions

View File

@ -85,7 +85,9 @@ ccl_device_inline float3 smooth_surface_offset(KernelGlobals *kg, ShaderData *sd
const float w = 1 - u - v;
float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */
float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without normalization */
n = transform_direction(&(sd->ob_tfm), n); /* Normal x scale, world space */
n = normalize(
transform_direction_transposed_auto(&sd->ob_itfm, n)); /* Normal x scale, world space */
/* Parabolic approximation */
float a = dot(N[2] - N[0], V[0] - V[2]);

View File

@ -689,12 +689,11 @@ typedef enum PrimitiveType {
PRIMITIVE_MOTION_CURVE_THICK = (1 << 3),
PRIMITIVE_CURVE_RIBBON = (1 << 4),
PRIMITIVE_MOTION_CURVE_RIBBON = (1 << 5),
PRIMITIVE_VOLUME = (1 << 6),
/* Lamp primitive is not included below on purpose,
* since it is no real traceable primitive.
*/
PRIMITIVE_LAMP = (1 << 6),
PRIMITIVE_VOLUME = (1 << 7),
PRIMITIVE_LAMP = (1 << 7),
PRIMITIVE_ALL_TRIANGLE = (PRIMITIVE_TRIANGLE | PRIMITIVE_MOTION_TRIANGLE),
PRIMITIVE_ALL_CURVE = (PRIMITIVE_CURVE_THICK | PRIMITIVE_MOTION_CURVE_THICK |

View File

@ -48,6 +48,7 @@ void ConstantFolder::make_constant(float value) const
foreach (ShaderInput *sock, output->links) {
sock->set(value);
sock->constant_folded_in = true;
}
graph->disconnect(output);
@ -59,6 +60,7 @@ void ConstantFolder::make_constant(float3 value) const
foreach (ShaderInput *sock, output->links) {
sock->set(value);
sock->constant_folded_in = true;
}
graph->disconnect(output);

View File

@ -79,7 +79,11 @@ enum ShaderNodeSpecialType {
class ShaderInput {
public:
ShaderInput(const SocketType &socket_type_, ShaderNode *parent_)
: socket_type(socket_type_), parent(parent_), link(NULL), stack_offset(SVM_STACK_INVALID)
: socket_type(socket_type_),
parent(parent_),
link(NULL),
stack_offset(SVM_STACK_INVALID),
constant_folded_in(false)
{
}
@ -111,6 +115,10 @@ class ShaderInput {
ShaderNode *parent;
ShaderOutput *link;
int stack_offset; /* for SVM compiler */
/* Keeps track of whether a constant was folded in this socket, to avoid over-optimizing when the
* link is null. */
bool constant_folded_in;
};
/* Output

View File

@ -304,7 +304,7 @@ int SVMCompiler::stack_assign(ShaderOutput *output)
int SVMCompiler::stack_assign_if_linked(ShaderInput *input)
{
if (input->link)
if (input->link || input->constant_folded_in)
return stack_assign(input);
return SVM_STACK_INVALID;

View File

@ -1044,33 +1044,30 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
GHOST_TKey gkey;
#ifdef USE_NON_LATIN_KB_WORKAROUND
/* XXX Code below is kinda awfully convoluted... Issues are:
*
* - In keyboards like latin ones, numbers need a 'Shift' to be accessed but key_sym
* is unmodified (or anyone swapping the keys with xmodmap).
*
* - XLookupKeysym seems to always use first defined keymap (see T47228), which generates
* keycodes unusable by ghost_key_from_keysym for non-Latin-compatible keymaps.
/* XXX: Code below is kinda awfully convoluted... Issues are:
* - In keyboards like latin ones, numbers need a 'Shift' to be accessed but key_sym
* is unmodified (or anyone swapping the keys with `xmodmap`).
* - #XLookupKeysym seems to always use first defined key-map (see T47228), which generates
* key-codes unusable by ghost_key_from_keysym for non-Latin-compatible key-maps.
*
* To address this, we:
*
* - Try to get a 'number' key_sym using XLookupKeysym (with virtual shift modifier),
* in a very restrictive set of cases.
* - Fallback to XLookupString to get a key_sym from active user-defined keymap.
* - Try to get a 'number' key_sym using #XLookupKeysym (with virtual shift modifier),
* in a very restrictive set of cases.
* - Fallback to #XLookupString to get a key_sym from active user-defined key-map.
*
* Note that:
* - This effectively 'lock' main number keys to always output number events
* (except when using alt-gr).
* - This enforces users to use an ASCII-compatible keymap with Blender -
* but at least it gives predictable and consistent results.
* - This effectively 'lock' main number keys to always output number events
* (except when using alt-gr).
* - This enforces users to use an ASCII-compatible key-map with Blender -
* but at least it gives predictable and consistent results.
*
* Also, note that nothing in XLib sources [1] makes it obvious why those two functions give
* different key_sym results...
* different key_sym results.
*
* [1] http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/KeyBind.c
*/
KeySym key_sym_str;
/* Mode_switch 'modifier' is AltGr - when this one or Shift are enabled,
/* Mode_switch 'modifier' is `AltGr` - when this one or Shift are enabled,
* we do not want to apply that 'forced number' hack. */
const unsigned int mode_switch_mask = XkbKeysymToModifiers(xke->display, XK_Mode_switch);
const unsigned int number_hack_forbidden_kmods_mask = mode_switch_mask | ShiftMask;

View File

@ -38,6 +38,7 @@
#include <assert.h>
#include <math.h>
#include <shellscalingapi.h>
#include <string.h>
#include <windowsx.h>
@ -80,13 +81,10 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
m_wintab(NULL),
m_lastPointerTabletData(GHOST_TABLET_DATA_NONE),
m_normal_state(GHOST_kWindowStateNormal),
m_user32(NULL),
m_user32(::LoadLibrary("user32.dll")),
m_parentWindowHwnd(parentwindow ? parentwindow->m_hWnd : HWND_DESKTOP),
m_debug_context(is_debug)
{
wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
RECT win_rect = {left, top, (long)(left + width), (long)(top + height)};
DWORD style = parentwindow ?
WS_POPUPWINDOW | WS_CAPTION | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SIZEBOX :
WS_OVERLAPPEDWINDOW;
@ -105,27 +103,10 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
*/
}
/* Monitor details. */
MONITORINFOEX monitor;
monitor.cbSize = sizeof(MONITORINFOEX);
monitor.dwFlags = 0;
GetMonitorInfo(MonitorFromRect(&win_rect, MONITOR_DEFAULTTONEAREST), &monitor);
/* Constrain requested size and position to fit within this monitor. */
width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect.right - win_rect.left);
height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect.bottom - win_rect.top);
win_rect.left = min(max(monitor.rcWork.left, win_rect.left), monitor.rcWork.right - width);
win_rect.right = win_rect.left + width;
win_rect.top = min(max(monitor.rcWork.top, win_rect.top), monitor.rcWork.bottom - height);
win_rect.bottom = win_rect.top + height;
/* Adjust to allow for caption, borders, shadows, scaling, etc. Resulting values can be
* correctly outside of monitor bounds. Note: You cannot specify WS_OVERLAPPED when calling. */
AdjustWindowRectEx(&win_rect, style & ~WS_OVERLAPPED, FALSE, extended_style);
/* But never allow a top position that can hide part of the title bar. */
win_rect.top = max(monitor.rcWork.top, win_rect.top);
RECT win_rect = {left, top, (long)(left + width), (long)(top + height)};
adjustWindowRectForClosestMonitor(&win_rect, style, extended_style);
wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
m_hWnd = ::CreateWindowExW(extended_style, // window extended style
s_windowClassName, // pointer to registered class name
title_16, // pointer to window name
@ -140,81 +121,78 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
0); // pointer to window-creation data
free(title_16);
m_user32 = ::LoadLibrary("user32.dll");
if (m_hWnd) {
RegisterTouchWindow(m_hWnd, 0);
// Register this window as a droptarget. Requires m_hWnd to be valid.
// Note that OleInitialize(0) has to be called prior to this. Done in GHOST_SystemWin32.
m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
if (m_dropTarget) {
::RegisterDragDrop(m_hWnd, m_dropTarget);
}
// Store a pointer to this class in the window structure
::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
if (!m_system->m_windowFocus) {
// Lower to bottom and don't activate if we don't want focus
::SetWindowPos(m_hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
// Store the device context
m_hDC = ::GetDC(m_hWnd);
GHOST_TSuccess success = setDrawingContextType(type);
if (success) {
// Show the window
int nCmdShow;
switch (state) {
case GHOST_kWindowStateMaximized:
nCmdShow = SW_SHOWMAXIMIZED;
break;
case GHOST_kWindowStateMinimized:
nCmdShow = (m_system->m_windowFocus) ? SW_SHOWMINIMIZED : SW_SHOWMINNOACTIVE;
break;
case GHOST_kWindowStateNormal:
default:
nCmdShow = (m_system->m_windowFocus) ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE;
break;
}
::ShowWindow(m_hWnd, nCmdShow);
#ifdef WIN32_COMPOSITING
if (alphaBackground && parentwindowhwnd == 0) {
HRESULT hr = S_OK;
// Create and populate the Blur Behind structure
DWM_BLURBEHIND bb = {0};
// Enable Blur Behind and apply to the entire client area
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
bb.fEnable = true;
bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
// Apply Blur Behind
hr = DwmEnableBlurBehindWindow(m_hWnd, &bb);
DeleteObject(bb.hRgnBlur);
}
#endif
// Force an initial paint of the window
::UpdateWindow(m_hWnd);
}
else {
// invalidate the window
::DestroyWindow(m_hWnd);
m_hWnd = NULL;
}
if (m_hWnd == NULL) {
return;
}
// Initialize Wintab
/* Store the device context. */
m_hDC = ::GetDC(m_hWnd);
if (!setDrawingContextType(type)) {
::DestroyWindow(m_hWnd);
m_hWnd = NULL;
return;
}
RegisterTouchWindow(m_hWnd, 0);
/* Register as drop-target. #OleInitialize(0) required first, done in GHOST_SystemWin32. */
m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
::RegisterDragDrop(m_hWnd, m_dropTarget);
/* Store a pointer to this class in the window structure. */
::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
if (!m_system->m_windowFocus) {
/* If we don't want focus then lower to bottom. */
::SetWindowPos(m_hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
/* Show the window. */
int nCmdShow;
switch (state) {
case GHOST_kWindowStateMaximized:
nCmdShow = SW_SHOWMAXIMIZED;
break;
case GHOST_kWindowStateMinimized:
nCmdShow = (m_system->m_windowFocus) ? SW_SHOWMINIMIZED : SW_SHOWMINNOACTIVE;
break;
case GHOST_kWindowStateNormal:
default:
nCmdShow = (m_system->m_windowFocus) ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE;
break;
}
::ShowWindow(m_hWnd, nCmdShow);
#ifdef WIN32_COMPOSITING
if (alphaBackground && parentwindowhwnd == 0) {
HRESULT hr = S_OK;
/* Create and populate the Blur Behind structure. */
DWM_BLURBEHIND bb = {0};
/* Enable Blur Behind and apply to the entire client area. */
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
bb.fEnable = true;
bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
/* Apply Blur Behind. */
hr = DwmEnableBlurBehindWindow(m_hWnd, &bb);
DeleteObject(bb.hRgnBlur);
}
#endif
/* Force an initial paint of the window. */
::UpdateWindow(m_hWnd);
/* Initialize Wintab. */
if (system->getTabletAPI() != GHOST_kTabletWinPointer) {
loadWintab(GHOST_kWindowStateMinimized != state);
}
/* Allow the showing of a progress bar on the taskbar. */
CoCreateInstance(
CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (LPVOID *)&m_Bar);
}
@ -268,6 +246,47 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
}
}
void GHOST_WindowWin32::adjustWindowRectForClosestMonitor(LPRECT win_rect,
DWORD dwStyle,
DWORD dwExStyle)
{
/* Get Details of the closest monitor. */
HMONITOR hmonitor = MonitorFromRect(win_rect, MONITOR_DEFAULTTONEAREST);
MONITORINFOEX monitor;
monitor.cbSize = sizeof(MONITORINFOEX);
monitor.dwFlags = 0;
GetMonitorInfo(hmonitor, &monitor);
/* Constrain requested size and position to fit within this monitor. */
LONG width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect->right - win_rect->left);
LONG height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect->bottom - win_rect->top);
win_rect->left = min(max(monitor.rcWork.left, win_rect->left), monitor.rcWork.right - width);
win_rect->right = win_rect->left + width;
win_rect->top = min(max(monitor.rcWork.top, win_rect->top), monitor.rcWork.bottom - height);
win_rect->bottom = win_rect->top + height;
/* With Windows 10 and newer we can adjust for chrome that differs with DPI and scale. */
GHOST_WIN32_AdjustWindowRectExForDpi fpAdjustWindowRectExForDpi = nullptr;
if (m_user32) {
fpAdjustWindowRectExForDpi = (GHOST_WIN32_AdjustWindowRectExForDpi)::GetProcAddress(
m_user32, "AdjustWindowRectExForDpi");
}
/* Adjust to allow for caption, borders, shadows, scaling, etc. Resulting values can be
* correctly outside of monitor bounds. Note: You cannot specify WS_OVERLAPPED when calling. */
if (fpAdjustWindowRectExForDpi) {
UINT dpiX, dpiY;
GetDpiForMonitor(hmonitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY);
fpAdjustWindowRectExForDpi(win_rect, dwStyle & ~WS_OVERLAPPED, FALSE, dwExStyle, dpiX);
}
else {
AdjustWindowRectEx(win_rect, dwStyle & ~WS_OVERLAPPED, FALSE, dwExStyle);
}
/* But never allow a top position that can hide part of the title bar. */
win_rect->top = max(monitor.rcWork.top, win_rect->top);
}
bool GHOST_WindowWin32::getValid() const
{
return GHOST_Window::getValid() && m_hWnd != 0 && m_hDC != 0;

View File

@ -43,6 +43,9 @@ class GHOST_DropTargetWin32;
// typedefs for user32 functions to allow dynamic loading of Windows 10 DPI scaling functions
typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND);
typedef BOOL(API *GHOST_WIN32_AdjustWindowRectExForDpi)(
LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi);
struct GHOST_PointerInfoWin32 {
GHOST_TInt32 pointerId;
GHOST_TInt32 isPrimary;
@ -98,6 +101,14 @@ class GHOST_WindowWin32 : public GHOST_Window {
*/
~GHOST_WindowWin32();
/**
* Adjusts a requested window rect to fit and position correctly in monitor.
* \param win_rect: pointer to rectangle that will be modified.
* \param dwStyle: The Window Style of the window whose required size is to be calculated.
* \param dwExStyle: The Extended Window Style of the window.
*/
void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle);
/**
* Returns indication as to whether the window is valid.
* \return The validity of the window.

View File

@ -60,7 +60,7 @@
#include "GPU_init_exit.h"
extern int datatoc_bfont_ttf_size;
extern char datatoc_bfont_ttf[];
extern char const datatoc_bfont_ttf[];
typedef struct _LoggerWindow LoggerWindow;
typedef struct _MultiTestApp MultiTestApp;

View File

@ -86,6 +86,13 @@ class COLLECTION_PT_lineart_collection(CollectionButtonsPanel, Panel):
row = layout.row()
row.prop(collection, "lineart_usage")
layout.prop(collection, "lineart_use_intersection_mask")
row = layout.row(align=True, heading="Masks")
row.active = collection.lineart_use_intersection_mask
for i in range(0,8):
row.prop(collection, "lineart_intersection_mask", index=i, text=str(i), toggle=True)
classes = (
COLLECTION_PT_collection_flags,

View File

@ -162,6 +162,14 @@ class SEQUENCER_HT_header(Header):
if tool_settings.use_proportional_edit:
row.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
tool_settings = context.tool_settings
row = layout.row(align=True)
row.prop(tool_settings, "use_snap_sequencer", text="")
sub = row.row(align=True)
sub.popover(panel="SEQUENCER_PT_snapping")
layout.separator_spacer()
row = layout.row(align=True)
row.prop(st, "show_strip_overlay", text="", icon='OVERLAY')
sub = row.row(align=True)
@ -2264,6 +2272,30 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel):
bl_category = "Strip"
class SEQUENCER_PT_snapping(Panel):
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'HEADER'
bl_label = ""
def draw(self, context):
tool_settings = context.tool_settings
sequencer_tool_settings = tool_settings.sequencer_tool_settings
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
col = layout.column(heading="Snap to", align=True)
col.prop(sequencer_tool_settings, "snap_seq_element", expand=True)
col = layout.column(heading="Ignore", align=True)
col.prop(sequencer_tool_settings, "snap_ignore_muted", text="Muted Strips")
col.prop(sequencer_tool_settings, "snap_ignore_sound",text="Sound Strips")
col = layout.column()
col.prop(sequencer_tool_settings, "snap_distance", slider=True, text="Distance")
classes = (
SEQUENCER_MT_change,
SEQUENCER_HT_tool_header,
@ -2333,6 +2365,8 @@ classes = (
SEQUENCER_PT_annotation,
SEQUENCER_PT_annotation_onion,
SEQUENCER_PT_snapping,
)
if __name__ == "__main__": # only for live edit.

View File

@ -509,6 +509,13 @@ geometry_node_categories = [
NodeItem("GeometryNodeCurveLength"),
NodeItem("GeometryNodeCurveReverse"),
]),
GeometryNodeCategory("GEO_PRIMITIVES_CURVE", "Curve Primitives", items=[
NodeItem("GeometryNodeCurvePrimitiveCircle"),
NodeItem("GeometryNodeCurveStar"),
NodeItem("GeometryNodeCurveSpiral"),
NodeItem("GeometryNodeCurveQuadraticBezier"),
NodeItem("GeometryNodeCurvePrimitiveBezierSegment"),
]),
GeometryNodeCategory("GEO_GEOMETRY", "Geometry", items=[
NodeItem("GeometryNodeBoundBox"),
NodeItem("GeometryNodeConvexHull"),
@ -540,7 +547,7 @@ geometry_node_categories = [
NodeItem("GeometryNodeSubdivisionSurface"),
NodeItem("GeometryNodeSubdivide"),
]),
GeometryNodeCategory("GEO_PRIMITIVES", "Mesh Primitives", items=[
GeometryNodeCategory("GEO_PRIMITIVES_MESH", "Mesh Primitives", items=[
NodeItem("GeometryNodeMeshCircle"),
NodeItem("GeometryNodeMeshCone"),
NodeItem("GeometryNodeMeshCube"),

View File

@ -151,7 +151,7 @@ typedef struct PoseTree {
struct bArmature *BKE_armature_add(struct Main *bmain, const char *name);
struct bArmature *BKE_armature_from_object(struct Object *ob);
int BKE_armature_bonelist_count(struct ListBase *lb);
int BKE_armature_bonelist_count(const struct ListBase *lb);
void BKE_armature_bonelist_free(struct ListBase *lb, const bool do_id_user);
void BKE_armature_editbonelist_free(struct ListBase *lb, const bool do_id_user);

View File

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

View File

@ -164,7 +164,8 @@ bool BKE_collection_move(struct Main *bmain,
bool BKE_collection_cycle_find(struct Collection *new_ancestor, struct Collection *collection);
bool BKE_collection_cycles_fix(struct Main *bmain, struct Collection *collection);
bool BKE_collection_has_collection(struct Collection *parent, struct Collection *collection);
bool BKE_collection_has_collection(const struct Collection *parent,
const struct Collection *collection);
void BKE_collection_parent_relations_rebuild(struct Collection *collection);
void BKE_main_collections_parent_relations_rebuild(struct Main *bmain);

View File

@ -227,9 +227,9 @@ struct FCurve *BKE_fcurve_find_by_rna_context_ui(struct bContext *C,
/* Binary search algorithm for finding where to 'insert' BezTriple with given frame number.
* Returns the index to insert at (data already at that index will be offset if replace is 0)
*/
int BKE_fcurve_bezt_binarysearch_index(struct BezTriple array[],
float frame,
int arraylen,
int BKE_fcurve_bezt_binarysearch_index(const struct BezTriple array[],
const float frame,
const int arraylen,
bool *r_replace);
/* fcurve_cache.c */

View File

@ -66,8 +66,8 @@ typedef struct EditFont {
} EditFont;
bool BKE_vfont_is_builtin(struct VFont *vfont);
void BKE_vfont_builtin_register(void *mem, int size);
bool BKE_vfont_is_builtin(const struct VFont *vfont);
void BKE_vfont_builtin_register(const void *mem, int size);
void BKE_vfont_free_data(struct VFont *vfont);
struct VFont *BKE_vfont_builtin_get(void);

View File

@ -90,7 +90,7 @@ typedef struct GPencilPointCoordinates {
float pressure;
} GPencilPointCoordinates;
int BKE_gpencil_stroke_point_count(struct bGPdata *gpd);
int BKE_gpencil_stroke_point_count(const struct bGPdata *gpd);
void BKE_gpencil_point_coords_get(struct bGPdata *gpd, GPencilPointCoordinates *elem_data);
void BKE_gpencil_point_coords_apply(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data);
void BKE_gpencil_point_coords_apply_with_mat4(struct bGPdata *gpd,

View File

@ -76,7 +76,7 @@ void BKE_keyblock_update_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
void BKE_keyblock_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
void BKE_keyblock_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt);
int BKE_keyblock_curve_element_count(struct ListBase *nurb);
int BKE_keyblock_curve_element_count(const struct ListBase *nurb);
void BKE_keyblock_curve_data_transform(const struct ListBase *nurb,
const float mat[4][4],
const void *src,

View File

@ -92,7 +92,7 @@ bool BKE_layer_collection_activate(struct ViewLayer *view_layer, struct LayerCol
struct LayerCollection *BKE_layer_collection_activate_parent(struct ViewLayer *view_layer,
struct LayerCollection *lc);
int BKE_layer_collection_count(struct ViewLayer *view_layer);
int BKE_layer_collection_count(const struct ViewLayer *view_layer);
struct LayerCollection *BKE_layer_collection_from_index(struct ViewLayer *view_layer,
const int index);
@ -107,8 +107,8 @@ void BKE_layer_collection_local_sync_all(const struct Main *bmain);
void BKE_main_collection_sync_remap(const struct Main *bmain);
struct LayerCollection *BKE_layer_collection_first_from_scene_collection(
struct ViewLayer *view_layer, const struct Collection *collection);
bool BKE_view_layer_has_collection(struct ViewLayer *view_layer,
const struct ViewLayer *view_layer, const struct Collection *collection);
bool BKE_view_layer_has_collection(const struct ViewLayer *view_layer,
const struct Collection *collection);
bool BKE_scene_has_object(struct Scene *scene, struct Object *ob);
@ -367,7 +367,7 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter);
struct ObjectsInViewLayerParams {
uint no_dup_data : 1;
bool (*filter_fn)(struct Object *ob, void *user_data);
bool (*filter_fn)(const struct Object *ob, void *user_data);
void *filter_userdata;
};
@ -388,7 +388,7 @@ struct ObjectsInModeParams {
int object_mode;
uint no_dup_data : 1;
bool (*filter_fn)(struct Object *ob, void *user_data);
bool (*filter_fn)(const struct Object *ob, void *user_data);
void *filter_userdata;
};
@ -412,8 +412,8 @@ struct Object **BKE_view_layer_array_from_objects_in_mode_params(
BKE_view_layer_array_from_bases_in_mode_params( \
view_layer, v3d, r_len, &(const struct ObjectsInModeParams)__VA_ARGS__)
bool BKE_view_layer_filter_edit_mesh_has_uvs(struct Object *ob, void *user_data);
bool BKE_view_layer_filter_edit_mesh_has_edges(struct Object *ob, void *user_data);
bool BKE_view_layer_filter_edit_mesh_has_uvs(const struct Object *ob, void *user_data);
bool BKE_view_layer_filter_edit_mesh_has_edges(const struct Object *ob, void *user_data);
/* Utility macros that wrap common args (add more as needed). */

View File

@ -300,7 +300,7 @@ void BKE_mesh_recalc_looptri_with_normals(const struct MLoop *mloop,
struct MLoopTri *mlooptri,
const float (*poly_normals)[3]);
/* *** mesh_evaluate.c *** */
/* *** mesh_normals.c *** */
void BKE_mesh_calc_normals_mapping_simple(struct Mesh *me);
void BKE_mesh_calc_normals_mapping(struct MVert *mverts,
@ -495,6 +495,8 @@ void BKE_mesh_calc_normals_split_ex(struct Mesh *mesh,
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loopnors)[3]);
void BKE_mesh_set_custom_normals_from_vertices(struct Mesh *mesh, float (*r_custom_vertnors)[3]);
/* *** mesh_evaluate.c *** */
void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly,
const struct MLoop *loopstart,
const struct MVert *mvarray,

View File

@ -1439,6 +1439,11 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
#define GEO_NODE_SEPARATE_COMPONENTS 1059
#define GEO_NODE_CURVE_SUBDIVIDE 1060
#define GEO_NODE_RAYCAST 1061
#define GEO_NODE_CURVE_PRIMITIVE_STAR 1062
#define GEO_NODE_CURVE_PRIMITIVE_SPIRAL 1063
#define GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER 1064
#define GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT 1065
#define GEO_NODE_CURVE_PRIMITIVE_CIRCLE 1066
/** \} */

View File

@ -674,7 +674,7 @@ bool BKE_pbvh_node_vert_update_check_any(PBVH *pbvh, PBVHNode *node);
// void BKE_pbvh_node_BB_reset(PBVHNode *node);
// void BKE_pbvh_node_BB_expand(PBVHNode *node, float co[3]);
bool pbvh_has_mask(PBVH *pbvh);
bool pbvh_has_mask(const PBVH *pbvh);
void pbvh_show_mask_set(PBVH *pbvh, bool show_mask);
bool pbvh_has_face_sets(PBVH *pbvh);

View File

@ -172,7 +172,7 @@ void BKE_shaderfx_copydata_ex(struct ShaderFxData *fx,
void BKE_shaderfx_copy(struct ListBase *dst, const struct ListBase *src);
void BKE_shaderfx_foreach_ID_link(struct Object *ob, ShaderFxIDWalkFunc walk, void *userData);
bool BKE_shaderfx_has_gpencil(struct Object *ob);
bool BKE_shaderfx_has_gpencil(const struct Object *ob);
void BKE_shaderfx_blend_write(struct BlendWriter *writer, struct ListBase *fxbase);
void BKE_shaderfx_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb);

View File

@ -48,7 +48,7 @@ char *txt_to_buf(struct Text *text, int *r_buf_strlen);
void txt_clean_text(struct Text *text);
void txt_order_cursors(struct Text *text, const bool reverse);
int txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case);
bool txt_has_sel(struct Text *text);
bool txt_has_sel(const struct Text *text);
int txt_get_span(struct TextLine *from, struct TextLine *to);
void txt_move_up(struct Text *text, const bool sel);
void txt_move_down(struct Text *text, const bool sel);
@ -85,8 +85,8 @@ bool txt_uncomment(struct Text *text);
void txt_move_lines(struct Text *text, const int direction);
void txt_duplicate_line(struct Text *text);
int txt_setcurr_tab_spaces(struct Text *text, int space);
bool txt_cursor_is_line_start(struct Text *text);
bool txt_cursor_is_line_end(struct Text *text);
bool txt_cursor_is_line_start(const struct Text *text);
bool txt_cursor_is_line_end(const struct Text *text);
int txt_calc_tab_left(struct TextLine *tl, int ch);
int txt_calc_tab_right(struct TextLine *tl, int ch);

View File

@ -178,7 +178,7 @@ UndoStack *BKE_undosys_stack_create(void);
void BKE_undosys_stack_destroy(UndoStack *ustack);
void BKE_undosys_stack_clear(UndoStack *ustack);
void BKE_undosys_stack_clear_active(UndoStack *ustack);
bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name);
bool BKE_undosys_stack_has_undo(const UndoStack *ustack, const char *name);
void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain);
void BKE_undosys_stack_init_from_context(UndoStack *ustack, struct bContext *C);
UndoStep *BKE_undosys_stack_active_with_type(UndoStack *ustack, const UndoType *ut);

View File

@ -190,6 +190,7 @@ set(SRC
intern/mesh_mapping.c
intern/mesh_merge.c
intern/mesh_mirror.c
intern/mesh_normals.c
intern/mesh_remap.c
intern/mesh_remesh_voxel.c
intern/mesh_runtime.c

View File

@ -973,7 +973,7 @@ static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md,
static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
Scene *scene,
Object *ob,
int useDeform,
const bool use_deform,
const bool need_mapping,
const CustomData_MeshMasks *dataMask,
const int index,
@ -1068,7 +1068,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
BKE_modifiers_clear_errors(ob);
/* Apply all leading deform modifiers. */
if (useDeform) {
if (use_deform) {
for (; md; md = md->next, md_datamask = md_datamask->next) {
const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type);
@ -1076,7 +1076,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
continue;
}
if (useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) {
if (mti->dependsOnTime && mti->dependsOnTime(md)) {
continue;
}
@ -1128,7 +1128,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
continue;
}
if (mti->type == eModifierTypeType_OnlyDeform && !useDeform) {
if (mti->type == eModifierTypeType_OnlyDeform && !use_deform) {
continue;
}
@ -1173,7 +1173,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
continue;
}
if (useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) {
if (mti->dependsOnTime && mti->dependsOnTime(md)) {
continue;
}
@ -1937,7 +1937,7 @@ static void mesh_build_data(struct Depsgraph *depsgraph,
mesh_calc_modifiers(depsgraph,
scene,
ob,
1,
true,
need_mapping,
dataMask,
-1,
@ -2162,7 +2162,7 @@ Mesh *mesh_create_eval_final(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 1, false, dataMask, -1, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, true, false, dataMask, -1, false, false, nullptr, &final, nullptr);
return final;
}
@ -2176,7 +2176,7 @@ Mesh *mesh_create_eval_final_index_render(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 1, false, dataMask, index, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, true, false, dataMask, index, false, false, nullptr, &final, nullptr);
return final;
}
@ -2189,7 +2189,7 @@ Mesh *mesh_create_eval_no_deform(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 0, false, dataMask, -1, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, false, false, dataMask, -1, false, false, nullptr, &final, nullptr);
return final;
}
@ -2202,7 +2202,7 @@ Mesh *mesh_create_eval_no_deform_render(Depsgraph *depsgraph,
Mesh *final;
mesh_calc_modifiers(
depsgraph, scene, ob, 0, false, dataMask, -1, false, false, nullptr, &final, nullptr);
depsgraph, scene, ob, false, false, dataMask, -1, false, false, nullptr, &final, nullptr);
return final;
}

View File

@ -358,7 +358,7 @@ bArmature *BKE_armature_from_object(Object *ob)
return NULL;
}
int BKE_armature_bonelist_count(ListBase *lb)
int BKE_armature_bonelist_count(const ListBase *lb)
{
int i = 0;
LISTBASE_FOREACH (Bone *, bone, lb) {

View File

@ -79,7 +79,8 @@ static bool collection_object_remove(Main *bmain,
static CollectionChild *collection_find_child(Collection *parent, Collection *collection);
static CollectionParent *collection_find_parent(Collection *child, Collection *collection);
static bool collection_find_child_recursive(Collection *parent, Collection *collection);
static bool collection_find_child_recursive(const Collection *parent,
const Collection *collection);
/** \} */
@ -1522,9 +1523,9 @@ static CollectionChild *collection_find_child(Collection *parent, Collection *co
return BLI_findptr(&parent->children, collection, offsetof(CollectionChild, collection));
}
static bool collection_find_child_recursive(Collection *parent, Collection *collection)
static bool collection_find_child_recursive(const Collection *parent, const Collection *collection)
{
LISTBASE_FOREACH (CollectionChild *, child, &parent->children) {
LISTBASE_FOREACH (const CollectionChild *, child, &parent->children) {
if (child->collection == collection) {
return true;
}
@ -1537,7 +1538,7 @@ static bool collection_find_child_recursive(Collection *parent, Collection *coll
return false;
}
bool BKE_collection_has_collection(Collection *parent, Collection *collection)
bool BKE_collection_has_collection(const Collection *parent, const Collection *collection)
{
return collection_find_child_recursive(parent, collection);
}

View File

@ -490,7 +490,7 @@ bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
}
if (ELEM(ipotype, COLBAND_INTERP_B_SPLINE, COLBAND_INTERP_CARDINAL)) {
/* ipo from right to left: 3 2 1 0 */
/* Interpolate from right to left: `3 2 1 0`. */
float t[4];
if (a >= coba->tot - 1) {

View File

@ -638,7 +638,7 @@ static void curvemap_make_table(const CurveMapping *cumap, CurveMap *cuma)
cuma->mintable = clipr->xmin;
cuma->maxtable = clipr->xmax;
/* hrmf... we now rely on blender ipo beziers, these are more advanced */
/* Rely on Blender interpolation for bezier curves, support extra functionality here as well. */
bezt = MEM_callocN(cuma->totpoint * sizeof(BezTriple), "beztarr");
for (int a = 0; a < cuma->totpoint; a++) {

View File

@ -1476,7 +1476,10 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
* to get a time factor. */
curvetime /= cu->pathlen;
if (cu->flag & CU_PATH_CLAMP) {
Nurb *nu = cu->nurb.first;
if (!(nu && nu->flagu & CU_NURB_CYCLIC) && cu->flag & CU_PATH_CLAMP) {
/* If curve is not cyclic, clamp to the begin/end points if the curve clamp option is on.
*/
CLAMP(curvetime, 0.0f, 1.0f);
}
}

View File

@ -510,8 +510,11 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *C,
* with optional argument for precision required.
* Returns the index to insert at (data already at that index will be offset if replace is 0)
*/
static int BKE_fcurve_bezt_binarysearch_index_ex(
BezTriple array[], float frame, int arraylen, float threshold, bool *r_replace)
static int BKE_fcurve_bezt_binarysearch_index_ex(const BezTriple array[],
const float frame,
const int arraylen,
const float threshold,
bool *r_replace)
{
int start = 0, end = arraylen;
int loopbreaker = 0, maxloop = arraylen * 2;
@ -597,9 +600,9 @@ static int BKE_fcurve_bezt_binarysearch_index_ex(
/* Binary search algorithm for finding where to insert BezTriple. (for use by insert_bezt_fcurve)
* Returns the index to insert at (data already at that index will be offset if replace is 0)
*/
int BKE_fcurve_bezt_binarysearch_index(BezTriple array[],
float frame,
int arraylen,
int BKE_fcurve_bezt_binarysearch_index(const BezTriple array[],
const float frame,
const int arraylen,
bool *r_replace)
{
/* This is just a wrapper which uses the default threshold. */

View File

@ -216,15 +216,15 @@ void BKE_vfont_free_data(struct VFont *vfont)
}
}
static void *builtin_font_data = NULL;
static const void *builtin_font_data = NULL;
static int builtin_font_size = 0;
bool BKE_vfont_is_builtin(struct VFont *vfont)
bool BKE_vfont_is_builtin(const struct VFont *vfont)
{
return STREQ(vfont->filepath, FO_BUILTIN_NAME);
}
void BKE_vfont_builtin_register(void *mem, int size)
void BKE_vfont_builtin_register(const void *mem, int size)
{
builtin_font_data = mem;
builtin_font_size = size;

View File

@ -2616,7 +2616,7 @@ void BKE_gpencil_transform(bGPdata *gpd, const float mat[4][4])
}
/* Used for "move only origins" in object_data_transform.c */
int BKE_gpencil_stroke_point_count(bGPdata *gpd)
int BKE_gpencil_stroke_point_count(const bGPdata *gpd)
{
int total_points = 0;
@ -2624,7 +2624,7 @@ int BKE_gpencil_stroke_point_count(bGPdata *gpd)
return 0;
}
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (const bGPDlayer *, gpl, &gpd->layers) {
/* FIXME: For now, we just skip parented layers.
* Otherwise, we have to update each frame to find
* the current parent position/effects.
@ -2633,7 +2633,7 @@ int BKE_gpencil_stroke_point_count(bGPdata *gpd)
continue;
}
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (const bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
total_points += gps->totpoints;
}

View File

@ -315,11 +315,11 @@ Key *BKE_key_add(Main *bmain, ID *id) /* common function */
return key;
}
/* Sort shape keys and Ipo curves after a change. This assumes that at most
* one key was moved, which is a valid assumption for the places it's
* currently being called.
/**
* Sort shape keys after a change.
* This assumes that at most one key was moved,
* which is a valid assumption for the places it's currently being called.
*/
void BKE_key_sort(Key *key)
{
KeyBlock *kb;
@ -2048,9 +2048,9 @@ void BKE_keyblock_convert_to_lattice(KeyBlock *kb, Lattice *lt)
/************************* Curve ************************/
int BKE_keyblock_curve_element_count(ListBase *nurb)
int BKE_keyblock_curve_element_count(const ListBase *nurb)
{
Nurb *nu;
const Nurb *nu;
int tot = 0;
nu = nurb->first;

View File

@ -676,10 +676,10 @@ LayerCollection *BKE_layer_collection_activate_parent(ViewLayer *view_layer, Lay
/**
* Recursively get the count of collections
*/
static int collection_count(ListBase *lb)
static int collection_count(const ListBase *lb)
{
int i = 0;
LISTBASE_FOREACH (LayerCollection *, lc, lb) {
LISTBASE_FOREACH (const LayerCollection *, lc, lb) {
i += collection_count(&lc->layer_collections) + 1;
}
return i;
@ -689,7 +689,7 @@ static int collection_count(ListBase *lb)
* Get the total number of collections
* (including all the nested collections)
*/
int BKE_layer_collection_count(ViewLayer *view_layer)
int BKE_layer_collection_count(const ViewLayer *view_layer)
{
return collection_count(&view_layer->layer_collections);
}
@ -1504,7 +1504,7 @@ static LayerCollection *find_layer_collection_by_scene_collection(LayerCollectio
/**
* Return the first matching LayerCollection in the ViewLayer for the Collection.
*/
LayerCollection *BKE_layer_collection_first_from_scene_collection(ViewLayer *view_layer,
LayerCollection *BKE_layer_collection_first_from_scene_collection(const ViewLayer *view_layer,
const Collection *collection)
{
LISTBASE_FOREACH (LayerCollection *, layer_collection, &view_layer->layer_collections) {
@ -1520,7 +1520,7 @@ LayerCollection *BKE_layer_collection_first_from_scene_collection(ViewLayer *vie
/**
* See if view layer has the scene collection linked directly, or indirectly (nested)
*/
bool BKE_view_layer_has_collection(ViewLayer *view_layer, const Collection *collection)
bool BKE_view_layer_has_collection(const ViewLayer *view_layer, const Collection *collection)
{
return BKE_layer_collection_first_from_scene_collection(view_layer, collection) != NULL;
}

View File

@ -164,11 +164,11 @@ Object **BKE_view_layer_array_from_objects_in_mode_params(ViewLayer *view_layer,
/** \name Filter Functions
* \{ */
bool BKE_view_layer_filter_edit_mesh_has_uvs(Object *ob, void *UNUSED(user_data))
bool BKE_view_layer_filter_edit_mesh_has_uvs(const Object *ob, void *UNUSED(user_data))
{
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
BMEditMesh *em = me->edit_mesh;
const Mesh *me = ob->data;
const BMEditMesh *em = me->edit_mesh;
if (em != NULL) {
if (CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV) != -1) {
return true;
@ -178,11 +178,11 @@ bool BKE_view_layer_filter_edit_mesh_has_uvs(Object *ob, void *UNUSED(user_data)
return false;
}
bool BKE_view_layer_filter_edit_mesh_has_edges(Object *ob, void *UNUSED(user_data))
bool BKE_view_layer_filter_edit_mesh_has_edges(const Object *ob, void *UNUSED(user_data))
{
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
BMEditMesh *em = me->edit_mesh;
const Mesh *me = ob->data;
const BMEditMesh *em = me->edit_mesh;
if (em != NULL) {
if (em->bm->totedge != 0) {
return true;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5054,6 +5054,11 @@ static void registerGeometryNodes()
register_node_type_geo_collection_info();
register_node_type_geo_convex_hull();
register_node_type_geo_curve_length();
register_node_type_geo_curve_primitive_bezier_segment();
register_node_type_geo_curve_primitive_circle();
register_node_type_geo_curve_primitive_quadratic_bezier();
register_node_type_geo_curve_primitive_spiral();
register_node_type_geo_curve_primitive_star();
register_node_type_geo_curve_to_mesh();
register_node_type_geo_curve_to_points();
register_node_type_geo_curve_resample();

View File

@ -3168,7 +3168,7 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
}
}
bool pbvh_has_mask(PBVH *pbvh)
bool pbvh_has_mask(const PBVH *pbvh)
{
switch (pbvh->type) {
case PBVH_GRIDS:

View File

@ -228,7 +228,10 @@ static void scene_init_data(ID *id)
/* Curve Profile */
scene->toolsettings->custom_bevel_profile_preset = BKE_curveprofile_add(PROF_PRESET_LINE);
/* Sequencer */
scene->toolsettings->sequencer_tool_settings = SEQ_tool_settings_init();
scene->toolsettings->snap_flag |= SCE_SNAP_SEQ;
for (size_t i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
scene->orientation_slots[i].index_custom = -1;

View File

@ -58,9 +58,9 @@ static ShaderFxTypeInfo *shader_fx_types[NUM_SHADER_FX_TYPES] = {NULL};
/* Methods - Evaluation Loops, etc. */
/* check if exist grease pencil effects */
bool BKE_shaderfx_has_gpencil(Object *ob)
bool BKE_shaderfx_has_gpencil(const Object *ob)
{
ShaderFxData *fx;
const ShaderFxData *fx;
for (fx = ob->shader_fx.first; fx; fx = fx->next) {
const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(fx->type);
if (fxi->type == eShaderFxType_GpencilType) {

View File

@ -3205,7 +3205,7 @@ void sbObjectToSoftbody(Object *ob)
free_softbody_intern(ob->soft);
}
static bool object_has_edges(Object *ob)
static bool object_has_edges(const Object *ob)
{
if (ob->type == OB_MESH) {
return ((Mesh *)ob->data)->totedge;

View File

@ -781,12 +781,12 @@ static void txt_curs_sel(Text *text, TextLine ***linep, int **charp)
*charp = &text->selc;
}
bool txt_cursor_is_line_start(Text *text)
bool txt_cursor_is_line_start(const Text *text)
{
return (text->selc == 0);
}
bool txt_cursor_is_line_end(Text *text)
bool txt_cursor_is_line_end(const Text *text)
{
return (text->selc == text->sell->len);
}
@ -1239,7 +1239,7 @@ void txt_order_cursors(Text *text, const bool reverse)
}
}
bool txt_has_sel(Text *text)
bool txt_has_sel(const Text *text)
{
return ((text->curl != text->sell) || (text->curc != text->selc));
}

View File

@ -368,10 +368,10 @@ void BKE_undosys_stack_init_from_context(UndoStack *ustack, bContext *C)
}
/* name optional */
bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name)
bool BKE_undosys_stack_has_undo(const UndoStack *ustack, const char *name)
{
if (name) {
UndoStep *us = BLI_rfindstring(&ustack->steps, name, offsetof(UndoStep, name));
const UndoStep *us = BLI_rfindstring(&ustack->steps, name, offsetof(UndoStep, name));
return us && us->prev;
}

View File

@ -53,9 +53,9 @@ void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format, ..
void BLI_dynstr_vappendf(DynStr *__restrict ds, const char *__restrict format, va_list args)
ATTR_PRINTF_FORMAT(2, 0) ATTR_NONNULL(1, 2);
int BLI_dynstr_get_len(DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
char *BLI_dynstr_get_cstring(DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BLI_dynstr_get_cstring_ex(DynStr *__restrict ds, char *__restrict rets) ATTR_NONNULL();
int BLI_dynstr_get_len(const DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
char *BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BLI_dynstr_get_cstring_ex(const DynStr *__restrict ds, char *__restrict rets) ATTR_NONNULL();
void BLI_dynstr_clear(DynStr *ds) ATTR_NONNULL();
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL();

View File

@ -57,8 +57,10 @@ void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP free_value);
void BLI_edgehash_print(EdgeHash *eh);
void BLI_edgehash_insert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val);
bool BLI_edgehash_reinsert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val);
void *BLI_edgehash_lookup(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
void *BLI_edgehash_lookup_default(EdgeHash *eh,
void *BLI_edgehash_lookup(const EdgeHash *eh,
unsigned int v0,
unsigned int v1) ATTR_WARN_UNUSED_RESULT;
void *BLI_edgehash_lookup_default(const EdgeHash *eh,
unsigned int v0,
unsigned int v1,
void *default_value) ATTR_WARN_UNUSED_RESULT;
@ -73,8 +75,10 @@ bool BLI_edgehash_remove(EdgeHash *eh,
EdgeHashFreeFP free_value);
void *BLI_edgehash_popkey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
bool BLI_edgehash_haskey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
int BLI_edgehash_len(EdgeHash *eh) ATTR_WARN_UNUSED_RESULT;
bool BLI_edgehash_haskey(const EdgeHash *eh,
unsigned int v0,
unsigned int v1) ATTR_WARN_UNUSED_RESULT;
int BLI_edgehash_len(const EdgeHash *eh) ATTR_WARN_UNUSED_RESULT;
void BLI_edgehash_clear_ex(EdgeHash *eh, EdgeHashFreeFP free_value, const uint reserve);
void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP free_value);
@ -86,7 +90,7 @@ BLI_INLINE void BLI_edgehashIterator_step(EdgeHashIterator *ehi)
{
ehi->index++;
}
BLI_INLINE bool BLI_edgehashIterator_isDone(EdgeHashIterator *ehi)
BLI_INLINE bool BLI_edgehashIterator_isDone(const EdgeHashIterator *ehi)
{
return ehi->index >= ehi->length;
}
@ -128,10 +132,12 @@ typedef struct EdgeSetIterator {
EdgeSet *BLI_edgeset_new_ex(const char *info, const unsigned int nentries_reserve)
ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
EdgeSet *BLI_edgeset_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
int BLI_edgeset_len(EdgeSet *es) ATTR_WARN_UNUSED_RESULT;
int BLI_edgeset_len(const EdgeSet *es) ATTR_WARN_UNUSED_RESULT;
bool BLI_edgeset_add(EdgeSet *es, unsigned int v0, unsigned int v1);
void BLI_edgeset_insert(EdgeSet *es, unsigned int v0, unsigned int v1);
bool BLI_edgeset_haskey(EdgeSet *es, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
bool BLI_edgeset_haskey(const EdgeSet *es,
unsigned int v0,
unsigned int v1) ATTR_WARN_UNUSED_RESULT;
void BLI_edgeset_free(EdgeSet *es);
/* rely on inline api for now */
@ -150,7 +156,7 @@ BLI_INLINE void BLI_edgesetIterator_step(EdgeSetIterator *esi)
{
esi->index++;
}
BLI_INLINE bool BLI_edgesetIterator_isDone(EdgeSetIterator *esi)
BLI_INLINE bool BLI_edgesetIterator_isDone(const EdgeSetIterator *esi)
{
return esi->index >= esi->length;
}

View File

@ -87,7 +87,7 @@ GHash *BLI_ghash_new_ex(GHashHashFP hashfp,
GHash *BLI_ghash_new(GHashHashFP hashfp,
GHashCmpFP cmpfp,
const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
GHash *BLI_ghash_copy(GHash *gh,
GHash *BLI_ghash_copy(const GHash *gh,
GHashKeyCopyFP keycopyfp,
GHashValCopyFP valcopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
@ -96,8 +96,8 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val);
bool BLI_ghash_reinsert(
GHash *gh, void *key, void *val, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
void *BLI_ghash_replace_key(GHash *gh, void *key);
void *BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
void *BLI_ghash_lookup_default(GHash *gh,
void *BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
void *BLI_ghash_lookup_default(const GHash *gh,
const void *key,
void *val_default) ATTR_WARN_UNUSED_RESULT;
void **BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
@ -116,10 +116,10 @@ void BLI_ghash_clear_ex(GHash *gh,
void *BLI_ghash_popkey(GHash *gh,
const void *key,
GHashKeyFreeFP keyfreefp) ATTR_WARN_UNUSED_RESULT;
bool BLI_ghash_haskey(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
bool BLI_ghash_pop(GHash *gh, GHashIterState *state, void **r_key, void **r_val)
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
unsigned int BLI_ghash_len(GHash *gh) ATTR_WARN_UNUSED_RESULT;
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT;
void BLI_ghash_flag_set(GHash *gh, unsigned int flag);
void BLI_ghash_flag_clear(GHash *gh, unsigned int flag);
@ -138,7 +138,7 @@ void BLI_ghashIterator_step(GHashIterator *ghi);
BLI_INLINE void *BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
BLI_INLINE void *BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
BLI_INLINE void **BLI_ghashIterator_getValue_p(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
BLI_INLINE bool BLI_ghashIterator_done(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
BLI_INLINE bool BLI_ghashIterator_done(const GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
struct _gh_Entry {
void *next, *key, *val;
@ -155,7 +155,7 @@ BLI_INLINE void **BLI_ghashIterator_getValue_p(GHashIterator *ghi)
{
return &((struct _gh_Entry *)ghi->curEntry)->val;
}
BLI_INLINE bool BLI_ghashIterator_done(GHashIterator *ghi)
BLI_INLINE bool BLI_ghashIterator_done(const GHashIterator *ghi)
{
return !ghi->curEntry;
}
@ -245,8 +245,8 @@ GSet *BLI_gset_new_ex(GSetHashFP hashfp,
GSet *BLI_gset_new(GSetHashFP hashfp,
GSetCmpFP cmpfp,
const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
GSet *BLI_gset_copy(GSet *gs, GSetKeyCopyFP keycopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
unsigned int BLI_gset_len(GSet *gs) ATTR_WARN_UNUSED_RESULT;
GSet *BLI_gset_copy(const GSet *gs, GSetKeyCopyFP keycopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
unsigned int BLI_gset_len(const GSet *gs) ATTR_WARN_UNUSED_RESULT;
void BLI_gset_flag_set(GSet *gs, unsigned int flag);
void BLI_gset_flag_clear(GSet *gs, unsigned int flag);
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp);
@ -255,7 +255,7 @@ bool BLI_gset_add(GSet *gs, void *key);
bool BLI_gset_ensure_p_ex(GSet *gs, const void *key, void ***r_key);
bool BLI_gset_reinsert(GSet *gh, void *key, GSetKeyFreeFP keyfreefp);
void *BLI_gset_replace_key(GSet *gs, void *key);
bool BLI_gset_haskey(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
bool BLI_gset_haskey(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
bool BLI_gset_pop(GSet *gs, GSetIterState *state, void **r_key) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();
bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp);
@ -263,7 +263,7 @@ void BLI_gset_clear_ex(GSet *gs, GSetKeyFreeFP keyfreefp, const unsigned int nen
void BLI_gset_clear(GSet *gs, GSetKeyFreeFP keyfreefp);
/* When set's are used for key & value. */
void *BLI_gset_lookup(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
void *BLI_gset_lookup(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
void *BLI_gset_pop_key(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
/** \} */
@ -303,9 +303,9 @@ BLI_INLINE void BLI_gsetIterator_step(GSetIterator *gsi)
{
BLI_ghashIterator_step((GHashIterator *)gsi);
}
BLI_INLINE bool BLI_gsetIterator_done(GSetIterator *gsi)
BLI_INLINE bool BLI_gsetIterator_done(const GSetIterator *gsi)
{
return BLI_ghashIterator_done((GHashIterator *)gsi);
return BLI_ghashIterator_done((const GHashIterator *)gsi);
}
#define GSET_ITER(gs_iter_, gset_) \
@ -325,8 +325,8 @@ BLI_INLINE bool BLI_gsetIterator_done(GSetIterator *gsi)
/* For testing, debugging only */
#ifdef GHASH_INTERNAL_API
int BLI_ghash_buckets_len(GHash *gh);
int BLI_gset_buckets_len(GSet *gs);
int BLI_ghash_buckets_len(const GHash *gh);
int BLI_gset_buckets_len(const GSet *gs);
double BLI_ghash_calc_quality_ex(GHash *gh,
double *r_load,

View File

@ -119,7 +119,7 @@
_##var##_free = _##var##_free->next; \
} \
else { \
_##var##_temp = alloca(sizeof(LinkNode)); \
_##var##_temp = (LinkNode *)alloca(sizeof(LinkNode)); \
} \
_##var##_temp->next = _##var##_stack; \
_##var##_temp->link = data; \

View File

@ -48,7 +48,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1, 2);
void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve) ATTR_NONNULL(1);
void BLI_mempool_clear(BLI_mempool *pool) ATTR_NONNULL(1);
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1);
int BLI_mempool_len(BLI_mempool *pool) ATTR_NONNULL(1);
int BLI_mempool_len(const BLI_mempool *pool) ATTR_NONNULL(1);
void *BLI_mempool_findelem(BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL(1);

View File

@ -283,7 +283,7 @@ void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format, ..
* \param ds: The DynStr of interest.
* \return The length of \a ds.
*/
int BLI_dynstr_get_len(DynStr *ds)
int BLI_dynstr_get_len(const DynStr *ds)
{
return ds->curlen;
}
@ -296,10 +296,10 @@ int BLI_dynstr_get_len(DynStr *ds)
* \param ds: The DynStr of interest.
* \param rets: The string to fill.
*/
void BLI_dynstr_get_cstring_ex(DynStr *__restrict ds, char *__restrict rets)
void BLI_dynstr_get_cstring_ex(const DynStr *__restrict ds, char *__restrict rets)
{
char *s;
DynStrElem *dse;
const DynStrElem *dse;
for (s = rets, dse = ds->elems; dse; dse = dse->next) {
int slen = strlen(dse->str);
@ -320,7 +320,7 @@ void BLI_dynstr_get_cstring_ex(DynStr *__restrict ds, char *__restrict rets)
* \param ds: The DynStr of interest.
* \return The contents of \a ds as a c-string.
*/
char *BLI_dynstr_get_cstring(DynStr *ds)
char *BLI_dynstr_get_cstring(const DynStr *ds)
{
char *rets = MEM_mallocN(ds->curlen + 1, "dynstr_cstring");
BLI_dynstr_get_cstring_ex(ds, rets);

View File

@ -122,8 +122,8 @@ struct GHash {
BLI_INLINE void ghash_entry_copy(GHash *gh_dst,
Entry *dst,
GHash *gh_src,
Entry *src,
const GHash *gh_src,
const Entry *src,
GHashKeyCopyFP keycopyfp,
GHashValCopyFP valcopyfp)
{
@ -143,7 +143,7 @@ BLI_INLINE void ghash_entry_copy(GHash *gh_dst,
/**
* Get the full hash for a key.
*/
BLI_INLINE uint ghash_keyhash(GHash *gh, const void *key)
BLI_INLINE uint ghash_keyhash(const GHash *gh, const void *key)
{
return gh->hashfp(key);
}
@ -151,7 +151,7 @@ BLI_INLINE uint ghash_keyhash(GHash *gh, const void *key)
/**
* Get the full hash for an entry.
*/
BLI_INLINE uint ghash_entryhash(GHash *gh, const Entry *e)
BLI_INLINE uint ghash_entryhash(const GHash *gh, const Entry *e)
{
return gh->hashfp(e->key);
}
@ -159,7 +159,7 @@ BLI_INLINE uint ghash_entryhash(GHash *gh, const Entry *e)
/**
* Get the bucket-index for an already-computed full hash.
*/
BLI_INLINE uint ghash_bucket_index(GHash *gh, const uint hash)
BLI_INLINE uint ghash_bucket_index(const GHash *gh, const uint hash)
{
#ifdef GHASH_USE_MODULO_BUCKETS
return hash % gh->nbuckets;
@ -171,7 +171,7 @@ BLI_INLINE uint ghash_bucket_index(GHash *gh, const uint hash)
/**
* Find the index of next used bucket, starting from \a curr_bucket (\a gh is assumed non-empty).
*/
BLI_INLINE uint ghash_find_next_bucket_index(GHash *gh, uint curr_bucket)
BLI_INLINE uint ghash_find_next_bucket_index(const GHash *gh, uint curr_bucket)
{
if (curr_bucket >= gh->nbuckets) {
curr_bucket = 0;
@ -381,7 +381,7 @@ BLI_INLINE void ghash_buckets_reset(GHash *gh, const uint nentries)
* Takes hash and bucket_index arguments to avoid calling #ghash_keyhash and #ghash_bucket_index
* multiple times.
*/
BLI_INLINE Entry *ghash_lookup_entry_ex(GHash *gh, const void *key, const uint bucket_index)
BLI_INLINE Entry *ghash_lookup_entry_ex(const GHash *gh, const void *key, const uint bucket_index)
{
Entry *e;
/* If we do not store GHash, not worth computing it for each entry here!
@ -422,7 +422,7 @@ BLI_INLINE Entry *ghash_lookup_entry_prev_ex(GHash *gh,
/**
* Internal lookup function. Only wraps #ghash_lookup_entry_ex
*/
BLI_INLINE Entry *ghash_lookup_entry(GHash *gh, const void *key)
BLI_INLINE Entry *ghash_lookup_entry(const GHash *gh, const void *key)
{
const uint hash = ghash_keyhash(gh, key);
const uint bucket_index = ghash_bucket_index(gh, hash);
@ -652,7 +652,7 @@ static void ghash_free_cb(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP va
/**
* Copy the GHash.
*/
static GHash *ghash_copy(GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp)
static GHash *ghash_copy(const GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp)
{
GHash *gh_new;
uint i;
@ -724,7 +724,7 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info)
* Copy given GHash. Keys and values are also copied if relevant callback is provided,
* else pointers remain the same.
*/
GHash *BLI_ghash_copy(GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp)
GHash *BLI_ghash_copy(const GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp)
{
return ghash_copy(gh, keycopyfp, valcopyfp);
}
@ -741,7 +741,7 @@ void BLI_ghash_reserve(GHash *gh, const uint nentries_reserve)
/**
* \return size of the GHash.
*/
uint BLI_ghash_len(GHash *gh)
uint BLI_ghash_len(const GHash *gh)
{
return gh->nentries;
}
@ -800,7 +800,7 @@ void *BLI_ghash_replace_key(GHash *gh, void *key)
* \note When NULL is a valid value, use #BLI_ghash_lookup_p to differentiate a missing key
* from a key with a NULL value. (Avoids calling #BLI_ghash_haskey before #BLI_ghash_lookup)
*/
void *BLI_ghash_lookup(GHash *gh, const void *key)
void *BLI_ghash_lookup(const GHash *gh, const void *key)
{
GHashEntry *e = (GHashEntry *)ghash_lookup_entry(gh, key);
BLI_assert(!(gh->flag & GHASH_FLAG_IS_GSET));
@ -810,7 +810,7 @@ void *BLI_ghash_lookup(GHash *gh, const void *key)
/**
* A version of #BLI_ghash_lookup which accepts a fallback argument.
*/
void *BLI_ghash_lookup_default(GHash *gh, const void *key, void *val_default)
void *BLI_ghash_lookup_default(const GHash *gh, const void *key, void *val_default)
{
GHashEntry *e = (GHashEntry *)ghash_lookup_entry(gh, key);
BLI_assert(!(gh->flag & GHASH_FLAG_IS_GSET));
@ -938,7 +938,7 @@ void *BLI_ghash_popkey(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp)
/**
* \return true if the \a key is in \a gh.
*/
bool BLI_ghash_haskey(GHash *gh, const void *key)
bool BLI_ghash_haskey(const GHash *gh, const void *key)
{
return (ghash_lookup_entry(gh, key) != NULL);
}
@ -1130,12 +1130,12 @@ GSet *BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info)
/**
* Copy given GSet. Keys are also copied if callback is provided, else pointers remain the same.
*/
GSet *BLI_gset_copy(GSet *gs, GHashKeyCopyFP keycopyfp)
GSet *BLI_gset_copy(const GSet *gs, GHashKeyCopyFP keycopyfp)
{
return (GSet *)ghash_copy((GHash *)gs, keycopyfp, NULL);
return (GSet *)ghash_copy((const GHash *)gs, keycopyfp, NULL);
}
uint BLI_gset_len(GSet *gs)
uint BLI_gset_len(const GSet *gs)
{
return ((GHash *)gs)->nentries;
}
@ -1172,7 +1172,7 @@ bool BLI_gset_ensure_p_ex(GSet *gs, const void *key, void ***r_key)
{
const uint hash = ghash_keyhash((GHash *)gs, key);
const uint bucket_index = ghash_bucket_index((GHash *)gs, hash);
GSetEntry *e = (GSetEntry *)ghash_lookup_entry_ex((GHash *)gs, key, bucket_index);
GSetEntry *e = (GSetEntry *)ghash_lookup_entry_ex((const GHash *)gs, key, bucket_index);
const bool haskey = (e != NULL);
if (!haskey) {
@ -1213,9 +1213,9 @@ bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp)
return BLI_ghash_remove((GHash *)gs, key, keyfreefp, NULL);
}
bool BLI_gset_haskey(GSet *gs, const void *key)
bool BLI_gset_haskey(const GSet *gs, const void *key)
{
return (ghash_lookup_entry((GHash *)gs, key) != NULL);
return (ghash_lookup_entry((const GHash *)gs, key) != NULL);
}
/**
@ -1277,9 +1277,9 @@ void BLI_gset_flag_clear(GSet *gs, uint flag)
/**
* Returns the pointer to the key if it's found.
*/
void *BLI_gset_lookup(GSet *gs, const void *key)
void *BLI_gset_lookup(const GSet *gs, const void *key)
{
Entry *e = ghash_lookup_entry((GHash *)gs, key);
Entry *e = ghash_lookup_entry((const GHash *)gs, key);
return e ? e->key : NULL;
}
@ -1311,13 +1311,13 @@ void *BLI_gset_pop_key(GSet *gs, const void *key)
/**
* \return number of buckets in the GHash.
*/
int BLI_ghash_buckets_len(GHash *gh)
int BLI_ghash_buckets_len(const GHash *gh)
{
return (int)gh->nbuckets;
}
int BLI_gset_buckets_len(GSet *gs)
int BLI_gset_buckets_len(const GSet *gs)
{
return BLI_ghash_buckets_len((GHash *)gs);
return BLI_ghash_buckets_len((const GHash *)gs);
}
/**

View File

@ -591,7 +591,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
}
}
int BLI_mempool_len(BLI_mempool *pool)
int BLI_mempool_len(const BLI_mempool *pool)
{
return (int)pool->totused;
}

View File

@ -193,7 +193,7 @@ BLI_INLINE EdgeHashEntry *edgehash_insert(EdgeHash *eh, Edge edge, void *value)
}
}
BLI_INLINE EdgeHashEntry *edgehash_lookup_entry(EdgeHash *eh, uint v0, uint v1)
BLI_INLINE EdgeHashEntry *edgehash_lookup_entry(const EdgeHash *eh, uint v0, uint v1)
{
Edge edge = init_edge(v0, v1);
@ -310,7 +310,7 @@ bool BLI_edgehash_reinsert(EdgeHash *eh, uint v0, uint v1, void *value)
/**
* A version of #BLI_edgehash_lookup which accepts a fallback argument.
*/
void *BLI_edgehash_lookup_default(EdgeHash *eh, uint v0, uint v1, void *default_value)
void *BLI_edgehash_lookup_default(const EdgeHash *eh, uint v0, uint v1, void *default_value)
{
EdgeHashEntry *entry = edgehash_lookup_entry(eh, v0, v1);
return entry ? entry->value : default_value;
@ -322,7 +322,7 @@ void *BLI_edgehash_lookup_default(EdgeHash *eh, uint v0, uint v1, void *default_
* to differentiate between key-value being NULL and
* lack of key then see #BLI_edgehash_lookup_p().
*/
void *BLI_edgehash_lookup(EdgeHash *eh, uint v0, uint v1)
void *BLI_edgehash_lookup(const EdgeHash *eh, uint v0, uint v1)
{
EdgeHashEntry *entry = edgehash_lookup_entry(eh, v0, v1);
return entry ? entry->value : NULL;
@ -423,7 +423,7 @@ void *BLI_edgehash_popkey(EdgeHash *eh, uint v0, uint v1)
/**
* Return boolean true/false if edge (v0,v1) in hash.
*/
bool BLI_edgehash_haskey(EdgeHash *eh, uint v0, uint v1)
bool BLI_edgehash_haskey(const EdgeHash *eh, uint v0, uint v1)
{
return edgehash_lookup_entry(eh, v0, v1) != NULL;
}
@ -431,7 +431,7 @@ bool BLI_edgehash_haskey(EdgeHash *eh, uint v0, uint v1)
/**
* Return number of keys in hash.
*/
int BLI_edgehash_len(EdgeHash *eh)
int BLI_edgehash_len(const EdgeHash *eh)
{
return (int)eh->length;
}
@ -533,7 +533,7 @@ void BLI_edgeset_free(EdgeSet *es)
MEM_freeN(es);
}
int BLI_edgeset_len(EdgeSet *es)
int BLI_edgeset_len(const EdgeSet *es)
{
return (int)es->length;
}
@ -608,7 +608,7 @@ void BLI_edgeset_insert(EdgeSet *es, uint v0, uint v1)
}
}
bool BLI_edgeset_haskey(EdgeSet *es, uint v0, uint v1)
bool BLI_edgeset_haskey(const EdgeSet *es, uint v0, uint v1)
{
Edge edge = init_edge(v0, v1);

View File

@ -2411,8 +2411,8 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
/* 'Increment' mode disabled for nodes, use true grid snapping instead */
if (scene->toolsettings->snap_node_mode == SCE_SNAP_MODE_INCREMENT) {
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
if (scene->toolsettings->snap_node_mode == 0) { /* SCE_SNAP_MODE_INCREMENT */
scene->toolsettings->snap_node_mode = 8; /* SCE_SNAP_MODE_GRID */
}
#ifdef WITH_FFMPEG

View File

@ -2436,41 +2436,42 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
switch (scene->toolsettings->snap_mode) {
case 0:
scene->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT;
scene->toolsettings->snap_mode = (1 << 4); /* SCE_SNAP_MODE_INCREMENT */
break;
case 1:
scene->toolsettings->snap_mode = SCE_SNAP_MODE_VERTEX;
scene->toolsettings->snap_mode = (1 << 0); /* SCE_SNAP_MODE_VERTEX */
break;
case 2:
scene->toolsettings->snap_mode = SCE_SNAP_MODE_EDGE;
scene->toolsettings->snap_mode = (1 << 1); /* SCE_SNAP_MODE_EDGE */
break;
case 3:
scene->toolsettings->snap_mode = SCE_SNAP_MODE_FACE;
scene->toolsettings->snap_mode = (1 << 2); /* SCE_SNAP_MODE_FACE */
break;
case 4:
scene->toolsettings->snap_mode = SCE_SNAP_MODE_VOLUME;
scene->toolsettings->snap_mode = (1 << 3); /* SCE_SNAP_MODE_VOLUME */
break;
}
switch (scene->toolsettings->snap_node_mode) {
case 5:
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X;
scene->toolsettings->snap_node_mode = (1 << 5); /* SCE_SNAP_MODE_NODE_X */
break;
case 6:
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_Y;
scene->toolsettings->snap_node_mode = (1 << 6); /* SCE_SNAP_MODE_NODE_Y */
break;
case 7:
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y;
scene->toolsettings->snap_node_mode =
(1 << 5) | (1 << 6); /* SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y */
break;
case 8:
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
scene->toolsettings->snap_node_mode = (1 << 7); /* SCE_SNAP_MODE_GRID */
break;
}
switch (scene->toolsettings->snap_uv_mode) {
case 0:
scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT;
scene->toolsettings->snap_uv_mode = (1 << 4); /* SCE_SNAP_MODE_INCREMENT */
break;
case 1:
scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_VERTEX;
scene->toolsettings->snap_uv_mode = (1 << 0); /* SCE_SNAP_MODE_VERTEX */
break;
}
}

View File

@ -44,6 +44,8 @@
#include "readfile.h"
#include "versioning_common.h"
#include "SEQ_sequencer.h"
#include "MEM_guardedalloc.h"
#include "versioning_common.h"
@ -430,6 +432,42 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 300, 7)) {
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
ToolSettings *tool_settings = scene->toolsettings;
tool_settings->snap_flag |= SCE_SNAP_SEQ;
short snap_mode = tool_settings->snap_mode;
short snap_node_mode = tool_settings->snap_node_mode;
short snap_uv_mode = tool_settings->snap_uv_mode;
tool_settings->snap_mode &= ~((1 << 4) | (1 << 5) | (1 << 6));
tool_settings->snap_node_mode &= ~((1 << 5) | (1 << 6));
tool_settings->snap_uv_mode &= ~(1 << 4);
if (snap_mode & (1 << 4)) {
tool_settings->snap_mode |= (1 << 6); /* SCE_SNAP_MODE_INCREMENT */
}
if (snap_mode & (1 << 5)) {
tool_settings->snap_mode |= (1 << 4); /* SCE_SNAP_MODE_EDGE_MIDPOINT */
}
if (snap_mode & (1 << 6)) {
tool_settings->snap_mode |= (1 << 5); /* SCE_SNAP_MODE_EDGE_PERPENDICULAR */
}
if (snap_node_mode & (1 << 5)) {
tool_settings->snap_node_mode |= (1 << 0); /* SCE_SNAP_MODE_NODE_X */
}
if (snap_node_mode & (1 << 6)) {
tool_settings->snap_node_mode |= (1 << 1); /* SCE_SNAP_MODE_NODE_Y */
}
if (snap_uv_mode & (1 << 4)) {
tool_settings->snap_uv_mode |= (1 << 6); /* SCE_SNAP_MODE_INCREMENT */
}
SequencerToolSettings *sequencer_tool_settings = SEQ_tool_settings_ensure(scene);
sequencer_tool_settings->snap_mode = SEQ_SNAP_TO_STRIPS | SEQ_SNAP_TO_CURRENT_FRAME |
SEQ_SNAP_TO_STRIP_HOLD;
sequencer_tool_settings->snap_distance = 15;
}
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@ -182,7 +182,7 @@ static void displacement_principled_nodes(bNode *node)
}
}
static bool node_has_roughness(bNode *node)
static bool node_has_roughness(const bNode *node)
{
return ELEM(node->type,
SH_NODE_BSDF_ANISOTROPIC,

View File

@ -18,6 +18,8 @@
* \ingroup bmesh
*
* BM mesh normal calculation functions.
*
* \see mesh_normals.c for the equivalent #Mesh functionality.
*/
#include "MEM_guardedalloc.h"

View File

@ -2434,6 +2434,7 @@ static int animchannels_clean_empty_exec(bContext *C, wmOperator *UNUSED(op))
/* send notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL);
return OPERATOR_FINISHED;
}

View File

@ -1217,7 +1217,7 @@ static bool skip_fcurve_with_name(
*
* \return true if F-Curve has errors/is disabled
*/
static bool fcurve_has_errors(FCurve *fcu)
static bool fcurve_has_errors(const FCurve *fcu)
{
/* F-Curve disabled - path eval error */
if (fcu->flag & FCURVE_DISABLED) {
@ -1226,7 +1226,7 @@ static bool fcurve_has_errors(FCurve *fcu)
/* driver? */
if (fcu->driver) {
ChannelDriver *driver = fcu->driver;
const ChannelDriver *driver = fcu->driver;
DriverVar *dvar;
/* error flag on driver usually means that there is an error

View File

@ -2810,7 +2810,7 @@ bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
/* --------------- API/Per-Datablock Handling ------------------- */
/* Checks if some F-Curve has a keyframe for a given frame */
bool fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
bool fcurve_frame_has_keyframe(const FCurve *fcu, float frame, short filter)
{
/* quick sanity check */
if (ELEM(NULL, fcu, fcu->bezt)) {

View File

@ -111,10 +111,10 @@ static bool swap_selection_bpoint(BPoint *bp)
return select_bpoint(bp, SELECT, SELECT, VISIBLE);
}
bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu)
bool ED_curve_nurb_select_check(const View3D *v3d, const Nurb *nu)
{
if (nu->type == CU_BEZIER) {
BezTriple *bezt;
const BezTriple *bezt;
int i;
for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) {
@ -124,7 +124,7 @@ bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu)
}
}
else {
BPoint *bp;
const BPoint *bp;
int i;
for (i = nu->pntsu * nu->pntsv, bp = nu->bp; i--; bp++) {
@ -136,12 +136,12 @@ bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu)
return false;
}
int ED_curve_nurb_select_count(View3D *v3d, Nurb *nu)
int ED_curve_nurb_select_count(const View3D *v3d, const Nurb *nu)
{
int sel = 0;
if (nu->type == CU_BEZIER) {
BezTriple *bezt;
const BezTriple *bezt;
int i;
for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) {
@ -151,7 +151,7 @@ int ED_curve_nurb_select_count(View3D *v3d, Nurb *nu)
}
}
else {
BPoint *bp;
const BPoint *bp;
int i;
for (i = nu->pntsu * nu->pntsv, bp = nu->bp; i--; bp++) {
@ -227,7 +227,7 @@ bool ED_curve_nurb_deselect_all(const Nurb *nu)
return changed;
}
int ED_curve_select_count(View3D *v3d, struct EditNurb *editnurb)
int ED_curve_select_count(const View3D *v3d, const EditNurb *editnurb)
{
int sel = 0;
Nurb *nu;
@ -239,9 +239,9 @@ int ED_curve_select_count(View3D *v3d, struct EditNurb *editnurb)
return sel;
}
bool ED_curve_select_check(View3D *v3d, struct EditNurb *editnurb)
bool ED_curve_select_check(const View3D *v3d, const EditNurb *editnurb)
{
LISTBASE_FOREACH (Nurb *, nu, &editnurb->nurbs) {
LISTBASE_FOREACH (const Nurb *, nu, &editnurb->nurbs) {
if (ED_curve_nurb_select_check(v3d, nu)) {
return true;
}

View File

@ -319,9 +319,9 @@ bool ED_gizmotypes_snap_3d_invert_snap_get(struct wmGizmo *gz)
#endif
}
bool ED_gizmotypes_snap_3d_is_enabled(wmGizmo *gz)
bool ED_gizmotypes_snap_3d_is_enabled(const wmGizmo *gz)
{
SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)gz;
const SnapGizmo3D *snap_gizmo = (const SnapGizmo3D *)gz;
return snap_gizmo->is_enabled;
}

View File

@ -107,7 +107,7 @@ void ED_gpencil_layer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, bool onlys
/* Selection Tools */
/* check if one of the frames in this layer is selected */
bool ED_gpencil_layer_frame_select_check(bGPDlayer *gpl)
bool ED_gpencil_layer_frame_select_check(const bGPDlayer *gpl)
{
/* error checking */
if (gpl == NULL) {
@ -115,7 +115,7 @@ bool ED_gpencil_layer_frame_select_check(bGPDlayer *gpl)
}
/* stop at the first one found */
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (const bGPDframe *, gpf, &gpl->frames) {
if (gpf->flag & GP_FRAME_SELECT) {
return true;
}

View File

@ -871,20 +871,20 @@ void GPENCIL_OT_frame_clean_loose(wmOperatorType *ot)
}
/* ********************* Clean Duplicated Frames ************************** */
static bool gpencil_frame_is_equal(bGPDframe *gpf_a, bGPDframe *gpf_b)
static bool gpencil_frame_is_equal(const bGPDframe *gpf_a, const bGPDframe *gpf_b)
{
if ((gpf_a == NULL) || (gpf_b == NULL)) {
return false;
}
/* If the number of strokes is different, cannot be equal. */
int totstrokes_a = BLI_listbase_count(&gpf_a->strokes);
int totstrokes_b = BLI_listbase_count(&gpf_b->strokes);
const int totstrokes_a = BLI_listbase_count(&gpf_a->strokes);
const int totstrokes_b = BLI_listbase_count(&gpf_b->strokes);
if ((totstrokes_a == 0) || (totstrokes_b == 0) || (totstrokes_a != totstrokes_b)) {
return false;
}
/* Loop all strokes and check. */
bGPDstroke *gps_a = gpf_a->strokes.first;
bGPDstroke *gps_b = gpf_b->strokes.first;
const bGPDstroke *gps_a = gpf_a->strokes.first;
const bGPDstroke *gps_b = gpf_b->strokes.first;
for (int i = 0; i < totstrokes_a; i++) {
/* If the number of points is different, cannot be equal. */
if (gps_a->totpoints != gps_b->totpoints) {
@ -924,8 +924,8 @@ static bool gpencil_frame_is_equal(bGPDframe *gpf_a, bGPDframe *gpf_b)
/* Loop points and check if equals or not. */
for (int p = 0; p < gps_a->totpoints; p++) {
bGPDspoint *pt_a = &gps_a->points[p];
bGPDspoint *pt_b = &gps_b->points[p];
const bGPDspoint *pt_a = &gps_a->points[p];
const bGPDspoint *pt_b = &gps_b->points[p];
if (!equals_v3v3(&pt_a->x, &pt_b->x)) {
return false;
}

View File

@ -548,51 +548,6 @@ void GPENCIL_OT_convert_old_files(struct wmOperatorType *ot);
/* armatures */
void GPENCIL_OT_generate_weights(struct wmOperatorType *ot);
/* ****************************************************** */
/* FILTERED ACTION DATA - TYPES ---> XXX DEPRECATED OLD ANIM SYSTEM CODE! */
/* XXX - TODO: replace this with the modern bAnimListElem... */
/* This struct defines a structure used for quick access */
typedef struct bActListElem {
struct bActListElem *next, *prev;
void *data; /* source data this elem represents */
int type; /* one of the ACTTYPE_* values */
int flag; /* copy of elem's flags for quick access */
int index; /* copy of adrcode where applicable */
void *key_data; /* motion data - ipo or ipo-curve */
short datatype; /* type of motion data to expect */
struct bActionGroup *grp; /* action group that owns the channel */
void *owner; /* will either be an action channel or fake IPO-channel (for keys) */
short ownertype; /* type of owner */
} bActListElem;
/* ****************************************************** */
/* FILTER ACTION DATA - METHODS/TYPES */
/* filtering flags - under what circumstances should a channel be added */
typedef enum ACTFILTER_FLAGS {
ACTFILTER_VISIBLE = (1 << 0), /* should channels be visible */
ACTFILTER_SEL = (1 << 1), /* should channels be selected */
ACTFILTER_FOREDIT = (1 << 2), /* does editable status matter */
ACTFILTER_CHANNELS = (1 << 3), /* do we only care that it is a channel */
ACTFILTER_IPOKEYS = (1 << 4), /* only channels referencing IPO's */
ACTFILTER_ONLYICU = (1 << 5), /* only reference ipo-curves */
ACTFILTER_FORDRAWING = (1 << 6), /* make list for interface drawing */
ACTFILTER_ACTGROUPED = (1 << 7), /* belongs to the active group */
} ACTFILTER_FLAGS;
/* Action Editor - Main Data types */
typedef enum ACTCONT_TYPES {
ACTCONT_NONE = 0,
ACTCONT_ACTION,
ACTCONT_SHAPEKEY,
ACTCONT_GPENCIL,
} ACTCONT_TYPES;
/* ****************************************************** */
/* Stroke Iteration Utilities */

View File

@ -1381,7 +1381,7 @@ static float gpencil_sculpt_rotation_eval_get(tGP_BrushEditData *gso,
return 0.0f;
}
GP_SpaceConversion *gsc = &gso->gsc;
const GP_SpaceConversion *gsc = &gso->gsc;
bGPDstroke *gps_orig = (gps_eval->runtime.gps_orig) ? gps_eval->runtime.gps_orig : gps_eval;
bGPDspoint *pt_orig = &gps_orig->points[pt_eval->runtime.idx_orig];
bGPDspoint *pt_prev_eval = NULL;

View File

@ -3106,8 +3106,8 @@ void ED_gpencil_sbuffer_vertex_color_set(Depsgraph *depsgraph,
}
/* Get the bigger 2D bound box points. */
void ED_gpencil_projected_2d_bound_box(GP_SpaceConversion *gsc,
bGPDstroke *gps,
void ED_gpencil_projected_2d_bound_box(const GP_SpaceConversion *gsc,
const bGPDstroke *gps,
const float diff_mat[4][4],
float r_min[2],
float r_max[2])
@ -3140,7 +3140,7 @@ void ED_gpencil_projected_2d_bound_box(GP_SpaceConversion *gsc,
}
/* Check if the stroke collides with brush. */
bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc,
bool ED_gpencil_stroke_check_collision(const GP_SpaceConversion *gsc,
bGPDstroke *gps,
const float mouse[2],
const int radius,
@ -3175,9 +3175,9 @@ bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc,
* \param diff_mat: View matrix.
* \return True if the point is inside.
*/
bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps,
GP_SpaceConversion *gsc,
int mouse[2],
bool ED_gpencil_stroke_point_is_inside(const bGPDstroke *gps,
const GP_SpaceConversion *gsc,
const int mouse[2],
const float diff_mat[4][4])
{
bool hit = false;
@ -3190,7 +3190,7 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps,
mcoords = MEM_mallocN(sizeof(int[2]) * len, __func__);
/* Convert stroke to 2D array of points. */
bGPDspoint *pt;
const bGPDspoint *pt;
int i;
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
bGPDspoint pt2;
@ -3214,7 +3214,7 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps,
}
bGPDstroke *ED_gpencil_stroke_nearest_to_ends(bContext *C,
GP_SpaceConversion *gsc,
const GP_SpaceConversion *gsc,
bGPDlayer *gpl,
bGPDframe *gpf,
bGPDstroke *gps,

View File

@ -60,21 +60,21 @@ bool ED_curve_editnurb_select_pick(
struct Nurb *ED_curve_add_nurbs_primitive(
struct bContext *C, struct Object *obedit, float mat[4][4], int type, int newob);
bool ED_curve_nurb_select_check(struct View3D *v3d, struct Nurb *nu);
int ED_curve_nurb_select_count(struct View3D *v3d, struct Nurb *nu);
bool ED_curve_nurb_select_check(const struct View3D *v3d, const struct Nurb *nu);
int ED_curve_nurb_select_count(const struct View3D *v3d, const struct Nurb *nu);
bool ED_curve_nurb_select_all(const struct Nurb *nu);
bool ED_curve_nurb_deselect_all(const struct Nurb *nu);
int ED_curve_join_objects_exec(struct bContext *C, struct wmOperator *op);
/* editcurve_select.c */
bool ED_curve_select_check(struct View3D *v3d, struct EditNurb *editnurb);
bool ED_curve_select_check(const struct View3D *v3d, const struct EditNurb *editnurb);
bool ED_curve_deselect_all(struct EditNurb *editnurb);
bool ED_curve_deselect_all_multi_ex(struct Base **bases, int bases_len);
bool ED_curve_deselect_all_multi(struct bContext *C);
bool ED_curve_select_all(struct EditNurb *editnurb);
bool ED_curve_select_swap(struct EditNurb *editnurb, bool hide_handles);
int ED_curve_select_count(struct View3D *v3d, struct EditNurb *editnurb);
int ED_curve_select_count(const struct View3D *v3d, const struct EditNurb *editnurb);
/* editcurve_undo.c */
void ED_curve_undosys_type(struct UndoType *ut);

View File

@ -30,275 +30,275 @@ extern "C" {
/* Datafiles embedded in Blender */
extern int datatoc_startup_blend_size;
extern char datatoc_startup_blend[];
extern const char datatoc_startup_blend[];
extern int datatoc_preview_blend_size;
extern char datatoc_preview_blend[];
extern const char datatoc_preview_blend[];
extern int datatoc_preview_grease_pencil_blend_size;
extern char datatoc_preview_grease_pencil_blend[];
extern const char datatoc_preview_grease_pencil_blend[];
extern int datatoc_blender_icons16_png_size;
extern char datatoc_blender_icons16_png[];
extern const char datatoc_blender_icons16_png[];
extern int datatoc_blender_icons32_png_size;
extern char datatoc_blender_icons32_png[];
extern const char datatoc_blender_icons32_png[];
extern int datatoc_prvicons_png_size;
extern char datatoc_prvicons_png[];
extern const char datatoc_prvicons_png[];
extern int datatoc_alert_icons_png_size;
extern char datatoc_alert_icons_png[];
extern const char datatoc_alert_icons_png[];
extern int datatoc_blender_logo_png_size;
extern char datatoc_blender_logo_png[];
extern const char datatoc_blender_logo_png[];
extern int datatoc_splash_png_size;
extern char datatoc_splash_png[];
extern const char datatoc_splash_png[];
extern int datatoc_bfont_pfb_size;
extern char datatoc_bfont_pfb[];
extern const char datatoc_bfont_pfb[];
/* Brush icon datafiles */
/* TODO: this could be simplified by putting all
* the brush icons in one file */
extern int datatoc_add_png_size;
extern char datatoc_add_png[];
extern const char datatoc_add_png[];
extern int datatoc_blob_png_size;
extern char datatoc_blob_png[];
extern const char datatoc_blob_png[];
extern int datatoc_blur_png_size;
extern char datatoc_blur_png[];
extern const char datatoc_blur_png[];
extern int datatoc_clay_png_size;
extern char datatoc_clay_png[];
extern const char datatoc_clay_png[];
extern int datatoc_claystrips_png_size;
extern char datatoc_claystrips_png[];
extern const char datatoc_claystrips_png[];
extern int datatoc_clone_png_size;
extern char datatoc_clone_png[];
extern const char datatoc_clone_png[];
extern int datatoc_crease_png_size;
extern char datatoc_crease_png[];
extern const char datatoc_crease_png[];
extern int datatoc_darken_png_size;
extern char datatoc_darken_png[];
extern const char datatoc_darken_png[];
extern int datatoc_draw_png_size;
extern char datatoc_draw_png[];
extern const char datatoc_draw_png[];
extern int datatoc_fill_png_size;
extern char datatoc_fill_png[];
extern const char datatoc_fill_png[];
extern int datatoc_flatten_png_size;
extern char datatoc_flatten_png[];
extern const char datatoc_flatten_png[];
extern int datatoc_grab_png_size;
extern char datatoc_grab_png[];
extern const char datatoc_grab_png[];
extern int datatoc_inflate_png_size;
extern char datatoc_inflate_png[];
extern const char datatoc_inflate_png[];
extern int datatoc_layer_png_size;
extern char datatoc_layer_png[];
extern const char datatoc_layer_png[];
extern int datatoc_lighten_png_size;
extern char datatoc_lighten_png[];
extern const char datatoc_lighten_png[];
extern int datatoc_mask_png_size;
extern char datatoc_mask_png[];
extern const char datatoc_mask_png[];
extern int datatoc_mix_png_size;
extern char datatoc_mix_png[];
extern const char datatoc_mix_png[];
extern int datatoc_multiply_png_size;
extern char datatoc_multiply_png[];
extern const char datatoc_multiply_png[];
extern int datatoc_nudge_png_size;
extern char datatoc_nudge_png[];
extern const char datatoc_nudge_png[];
extern int datatoc_pinch_png_size;
extern char datatoc_pinch_png[];
extern const char datatoc_pinch_png[];
extern int datatoc_scrape_png_size;
extern char datatoc_scrape_png[];
extern const char datatoc_scrape_png[];
extern int datatoc_smear_png_size;
extern char datatoc_smear_png[];
extern const char datatoc_smear_png[];
extern int datatoc_smooth_png_size;
extern char datatoc_smooth_png[];
extern const char datatoc_smooth_png[];
extern int datatoc_snake_hook_png_size;
extern char datatoc_snake_hook_png[];
extern const char datatoc_snake_hook_png[];
extern int datatoc_soften_png_size;
extern char datatoc_soften_png[];
extern const char datatoc_soften_png[];
extern int datatoc_subtract_png_size;
extern char datatoc_subtract_png[];
extern const char datatoc_subtract_png[];
extern int datatoc_texdraw_png_size;
extern char datatoc_texdraw_png[];
extern const char datatoc_texdraw_png[];
extern int datatoc_texfill_png_size;
extern char datatoc_texfill_png[];
extern const char datatoc_texfill_png[];
extern int datatoc_texmask_png_size;
extern char datatoc_texmask_png[];
extern const char datatoc_texmask_png[];
extern int datatoc_thumb_png_size;
extern char datatoc_thumb_png[];
extern const char datatoc_thumb_png[];
extern int datatoc_twist_png_size;
extern char datatoc_twist_png[];
extern const char datatoc_twist_png[];
extern int datatoc_vertexdraw_png_size;
extern char datatoc_vertexdraw_png[];
extern const char datatoc_vertexdraw_png[];
/* Matcap files */
extern int datatoc_mc01_jpg_size;
extern char datatoc_mc01_jpg[];
extern const char datatoc_mc01_jpg[];
extern int datatoc_mc02_jpg_size;
extern char datatoc_mc02_jpg[];
extern const char datatoc_mc02_jpg[];
extern int datatoc_mc03_jpg_size;
extern char datatoc_mc03_jpg[];
extern const char datatoc_mc03_jpg[];
extern int datatoc_mc04_jpg_size;
extern char datatoc_mc04_jpg[];
extern const char datatoc_mc04_jpg[];
extern int datatoc_mc05_jpg_size;
extern char datatoc_mc05_jpg[];
extern const char datatoc_mc05_jpg[];
extern int datatoc_mc06_jpg_size;
extern char datatoc_mc06_jpg[];
extern const char datatoc_mc06_jpg[];
extern int datatoc_mc07_jpg_size;
extern char datatoc_mc07_jpg[];
extern const char datatoc_mc07_jpg[];
extern int datatoc_mc08_jpg_size;
extern char datatoc_mc08_jpg[];
extern const char datatoc_mc08_jpg[];
extern int datatoc_mc09_jpg_size;
extern char datatoc_mc09_jpg[];
extern const char datatoc_mc09_jpg[];
extern int datatoc_mc10_jpg_size;
extern char datatoc_mc10_jpg[];
extern const char datatoc_mc10_jpg[];
extern int datatoc_mc11_jpg_size;
extern char datatoc_mc11_jpg[];
extern const char datatoc_mc11_jpg[];
extern int datatoc_mc12_jpg_size;
extern char datatoc_mc12_jpg[];
extern const char datatoc_mc12_jpg[];
extern int datatoc_mc13_jpg_size;
extern char datatoc_mc13_jpg[];
extern const char datatoc_mc13_jpg[];
extern int datatoc_mc14_jpg_size;
extern char datatoc_mc14_jpg[];
extern const char datatoc_mc14_jpg[];
extern int datatoc_mc15_jpg_size;
extern char datatoc_mc15_jpg[];
extern const char datatoc_mc15_jpg[];
extern int datatoc_mc16_jpg_size;
extern char datatoc_mc16_jpg[];
extern const char datatoc_mc16_jpg[];
extern int datatoc_mc17_jpg_size;
extern char datatoc_mc17_jpg[];
extern const char datatoc_mc17_jpg[];
extern int datatoc_mc18_jpg_size;
extern char datatoc_mc18_jpg[];
extern const char datatoc_mc18_jpg[];
extern int datatoc_mc19_jpg_size;
extern char datatoc_mc19_jpg[];
extern const char datatoc_mc19_jpg[];
extern int datatoc_mc20_jpg_size;
extern char datatoc_mc20_jpg[];
extern const char datatoc_mc20_jpg[];
extern int datatoc_mc21_jpg_size;
extern char datatoc_mc21_jpg[];
extern const char datatoc_mc21_jpg[];
extern int datatoc_mc22_jpg_size;
extern char datatoc_mc22_jpg[];
extern const char datatoc_mc22_jpg[];
extern int datatoc_mc23_jpg_size;
extern char datatoc_mc23_jpg[];
extern const char datatoc_mc23_jpg[];
extern int datatoc_mc24_jpg_size;
extern char datatoc_mc24_jpg[];
extern const char datatoc_mc24_jpg[];
/* grease pencil sculpt brushes files */
extern int datatoc_gp_brush_smooth_png_size;
extern char datatoc_gp_brush_smooth_png[];
extern const char datatoc_gp_brush_smooth_png[];
extern int datatoc_gp_brush_thickness_png_size;
extern char datatoc_gp_brush_thickness_png[];
extern const char datatoc_gp_brush_thickness_png[];
extern int datatoc_gp_brush_strength_png_size;
extern char datatoc_gp_brush_strength_png[];
extern const char datatoc_gp_brush_strength_png[];
extern int datatoc_gp_brush_grab_png_size;
extern char datatoc_gp_brush_grab_png[];
extern const char datatoc_gp_brush_grab_png[];
extern int datatoc_gp_brush_push_png_size;
extern char datatoc_gp_brush_push_png[];
extern const char datatoc_gp_brush_push_png[];
extern int datatoc_gp_brush_twist_png_size;
extern char datatoc_gp_brush_twist_png[];
extern const char datatoc_gp_brush_twist_png[];
extern int datatoc_gp_brush_pinch_png_size;
extern char datatoc_gp_brush_pinch_png[];
extern const char datatoc_gp_brush_pinch_png[];
extern int datatoc_gp_brush_randomize_png_size;
extern char datatoc_gp_brush_randomize_png[];
extern const char datatoc_gp_brush_randomize_png[];
extern int datatoc_gp_brush_clone_png_size;
extern char datatoc_gp_brush_clone_png[];
extern const char datatoc_gp_brush_clone_png[];
extern int datatoc_gp_brush_weight_png_size;
extern char datatoc_gp_brush_weight_png[];
extern const char datatoc_gp_brush_weight_png[];
extern int datatoc_gp_brush_pencil_png_size;
extern char datatoc_gp_brush_pencil_png[];
extern const char datatoc_gp_brush_pencil_png[];
extern int datatoc_gp_brush_pen_png_size;
extern char datatoc_gp_brush_pen_png[];
extern const char datatoc_gp_brush_pen_png[];
extern int datatoc_gp_brush_ink_png_size;
extern char datatoc_gp_brush_ink_png[];
extern const char datatoc_gp_brush_ink_png[];
extern int datatoc_gp_brush_inknoise_png_size;
extern char datatoc_gp_brush_inknoise_png[];
extern const char datatoc_gp_brush_inknoise_png[];
extern int datatoc_gp_brush_block_png_size;
extern char datatoc_gp_brush_block_png[];
extern const char datatoc_gp_brush_block_png[];
extern int datatoc_gp_brush_marker_png_size;
extern char datatoc_gp_brush_marker_png[];
extern const char datatoc_gp_brush_marker_png[];
extern int datatoc_gp_brush_fill_png_size;
extern char datatoc_gp_brush_fill_png[];
extern const char datatoc_gp_brush_fill_png[];
extern int datatoc_gp_brush_airbrush_png_size;
extern char datatoc_gp_brush_airbrush_png[];
extern const char datatoc_gp_brush_airbrush_png[];
extern int datatoc_gp_brush_chisel_png_size;
extern char datatoc_gp_brush_chisel_png[];
extern const char datatoc_gp_brush_chisel_png[];
extern int datatoc_gp_brush_erase_soft_png_size;
extern char datatoc_gp_brush_erase_soft_png[];
extern const char datatoc_gp_brush_erase_soft_png[];
extern int datatoc_gp_brush_erase_hard_png_size;
extern char datatoc_gp_brush_erase_hard_png[];
extern const char datatoc_gp_brush_erase_hard_png[];
extern int datatoc_gp_brush_erase_stroke_png_size;
extern char datatoc_gp_brush_erase_stroke_png[];
extern const char datatoc_gp_brush_erase_stroke_png[];
#ifdef __cplusplus
}

View File

@ -275,7 +275,7 @@ void ED_gizmotypes_snap_3d_flag_clear(struct wmGizmo *gz, eSnapGizmo flag);
bool ED_gizmotypes_snap_3d_flag_test(struct wmGizmo *gz, eSnapGizmo flag);
bool ED_gizmotypes_snap_3d_invert_snap_get(struct wmGizmo *gz);
bool ED_gizmotypes_snap_3d_is_enabled(struct wmGizmo *gz);
bool ED_gizmotypes_snap_3d_is_enabled(const struct wmGizmo *gz);
short ED_gizmotypes_snap_3d_update(struct wmGizmo *gz,
struct Depsgraph *depsgraph,

View File

@ -189,7 +189,7 @@ bool ED_gpencil_layer_frames_looper(struct bGPDlayer *gpl,
bool (*gpf_cb)(struct bGPDframe *, struct Scene *));
void ED_gpencil_layer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, bool onlysel);
bool ED_gpencil_layer_frame_select_check(struct bGPDlayer *gpl);
bool ED_gpencil_layer_frame_select_check(const struct bGPDlayer *gpl);
void ED_gpencil_layer_frame_select_set(struct bGPDlayer *gpl, short mode);
void ED_gpencil_layer_frames_select_box(struct bGPDlayer *gpl,
float min,
@ -364,23 +364,23 @@ void ED_gpencil_init_random_settings(struct Brush *brush,
const int mval[2],
struct GpRandomSettings *random_settings);
bool ED_gpencil_stroke_check_collision(struct GP_SpaceConversion *gsc,
bool ED_gpencil_stroke_check_collision(const struct GP_SpaceConversion *gsc,
struct bGPDstroke *gps,
const float mouse[2],
const int radius,
const float diff_mat[4][4]);
bool ED_gpencil_stroke_point_is_inside(struct bGPDstroke *gps,
struct GP_SpaceConversion *gsc,
int mouse[2],
bool ED_gpencil_stroke_point_is_inside(const struct bGPDstroke *gps,
const struct GP_SpaceConversion *gsc,
const int mouse[2],
const float diff_mat[4][4]);
void ED_gpencil_projected_2d_bound_box(struct GP_SpaceConversion *gsc,
struct bGPDstroke *gps,
void ED_gpencil_projected_2d_bound_box(const struct GP_SpaceConversion *gsc,
const struct bGPDstroke *gps,
const float diff_mat[4][4],
float r_min[2],
float r_max[2]);
struct bGPDstroke *ED_gpencil_stroke_nearest_to_ends(struct bContext *C,
struct GP_SpaceConversion *gsc,
const struct GP_SpaceConversion *gsc,
struct bGPDlayer *gpl,
struct bGPDframe *gpf,
struct bGPDstroke *gps,

View File

@ -452,7 +452,7 @@ bool autokeyframe_cfra_can_key(const struct Scene *scene, struct ID *id);
/* Lesser Keyframe Checking API call:
* - Used for the buttons to check for keyframes...
*/
bool fcurve_frame_has_keyframe(struct FCurve *fcu, float frame, short filter);
bool fcurve_frame_has_keyframe(const struct FCurve *fcu, float frame, short filter);
/* Lesser Keyframe Checking API call:
* - Returns whether the current value of a given property differs from the interpolated value.

View File

@ -100,7 +100,7 @@ bool ED_masklayer_frames_looper(struct MaskLayer *mask_layer,
struct Scene *));
void ED_masklayer_make_cfra_list(struct MaskLayer *mask_layer, ListBase *elems, bool onlysel);
bool ED_masklayer_frame_select_check(struct MaskLayer *mask_layer);
bool ED_masklayer_frame_select_check(const struct MaskLayer *mask_layer);
void ED_masklayer_frame_select_set(struct MaskLayer *mask_layer, short mode);
void ED_masklayer_frames_select_box(struct MaskLayer *mask_layer,
float min,

View File

@ -110,7 +110,7 @@ bool ED_node_is_geometry(struct SpaceNode *snode);
void ED_node_shader_default(const struct bContext *C, struct ID *id);
void ED_node_composit_default(const struct bContext *C, struct Scene *scene);
void ED_node_texture_default(const struct bContext *C, struct Tex *tex);
bool ED_node_select_check(ListBase *lb);
bool ED_node_select_check(const ListBase *lb);
void ED_node_select_all(ListBase *lb, int action);
void ED_node_post_apply_transform(struct bContext *C, struct bNodeTree *ntree);
void ED_node_set_active(struct Main *bmain,

View File

@ -62,7 +62,8 @@ struct Object *ED_object_active_context(const struct bContext *C);
void ED_collection_hide_menu_draw(const struct bContext *C, struct uiLayout *layout);
Object **ED_object_array_in_mode_or_selected(struct bContext *C,
bool (*filter_fn)(struct Object *ob, void *user_data),
bool (*filter_fn)(const struct Object *ob,
void *user_data),
void *filter_user_data,
uint *r_objects_len);
@ -387,7 +388,7 @@ void ED_object_mode_generic_exit(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob);
bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, struct Object *ob);
bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, const struct Object *ob);
void ED_object_posemode_set_for_weight_paint(struct bContext *C,
struct Main *bmain,

View File

@ -504,7 +504,6 @@ typedef void (*uiButSearchUpdateFn)(const struct bContext *C,
const char *str,
uiSearchItems *items,
const bool is_first);
typedef void (*uiButSearchArgFreeFn)(void *arg);
typedef bool (*uiButSearchContextMenuFn)(struct bContext *C,
void *arg,
void *active,
@ -533,6 +532,8 @@ typedef void (*uiMenuHandleFunc)(struct bContext *C, void *arg, int event);
*/
typedef bool (*uiMenuStepFunc)(struct bContext *C, int direction, void *arg1);
typedef void (*uiFreeArgFunc)(void *arg);
/* interface_query.c */
bool UI_but_has_tooltip_label(const uiBut *but);
bool UI_but_is_tool(const uiBut *but);
@ -619,11 +620,11 @@ typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1);
void UI_popup_block_invoke(struct bContext *C,
uiBlockCreateFunc func,
void *arg,
void (*arg_free)(void *arg));
uiFreeArgFunc arg_free);
void UI_popup_block_invoke_ex(struct bContext *C,
uiBlockCreateFunc func,
void *arg,
void (*arg_free)(void *arg),
uiFreeArgFunc arg_free,
bool can_refresh);
void UI_popup_block_ex(struct bContext *C,
uiBlockCreateFunc func,
@ -1599,7 +1600,7 @@ void UI_but_func_search_set(uiBut *but,
uiButSearchUpdateFn search_update_fn,
void *arg,
const bool free_arg,
uiButSearchArgFreeFn search_arg_free_fn,
uiFreeArgFunc search_arg_free_fn,
uiButHandleFunc search_exec_fn,
void *active);
void UI_but_func_search_set_context_menu(uiBut *but, uiButSearchContextMenuFn context_menu_fn);
@ -1644,7 +1645,7 @@ void UI_but_func_drawextra_set(
void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func);
void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN);
void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *arg, uiFreeArgFunc free_arg);
void UI_but_tooltip_refresh(struct bContext *C, uiBut *but);
void UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but);
@ -2425,12 +2426,20 @@ void uiItemPopoverPanelFromGroup(uiLayout *layout,
void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg);
void uiItemMenuFN(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *argN);
void uiItemMenuEnumO_ptr(uiLayout *layout,
void uiItemMenuEnumFullO_ptr(uiLayout *layout,
struct bContext *C,
struct wmOperatorType *ot,
const char *propname,
const char *name,
int icon,
struct PointerRNA *r_opptr);
void uiItemMenuEnumFullO(uiLayout *layout,
struct bContext *C,
struct wmOperatorType *ot,
const char *opname,
const char *propname,
const char *name,
int icon);
int icon,
struct PointerRNA *r_opptr);
void uiItemMenuEnumO(uiLayout *layout,
struct bContext *C,
const char *opname,

View File

@ -811,7 +811,8 @@ static void ui_but_update_old_active_from_new(uiBut *oldbut, uiBut *but)
/* Move tooltip from new to old. */
SWAP(uiButToolTipFunc, oldbut->tip_func, but->tip_func);
SWAP(void *, oldbut->tip_argN, but->tip_argN);
SWAP(void *, oldbut->tip_arg, but->tip_arg);
SWAP(uiFreeArgFunc, oldbut->tip_arg_free, but->tip_arg_free);
oldbut->flag = (oldbut->flag & ~flag_copy) | (but->flag & flag_copy);
oldbut->drawflag = (oldbut->drawflag & ~drawflag_copy) | (but->drawflag & drawflag_copy);
@ -822,7 +823,7 @@ static void ui_but_update_old_active_from_new(uiBut *oldbut, uiBut *but)
if (oldbut->type == UI_BTYPE_SEARCH_MENU) {
uiButSearch *search_oldbut = (uiButSearch *)oldbut, *search_but = (uiButSearch *)but;
SWAP(uiButSearchArgFreeFn, search_oldbut->arg_free_fn, search_but->arg_free_fn);
SWAP(uiFreeArgFunc, search_oldbut->arg_free_fn, search_but->arg_free_fn);
SWAP(void *, search_oldbut->arg, search_but->arg);
}
@ -3358,8 +3359,8 @@ static void ui_but_free(const bContext *C, uiBut *but)
MEM_freeN(but->func_argN);
}
if (but->tip_argN) {
MEM_freeN(but->tip_argN);
if (but->tip_arg_free) {
but->tip_arg_free(but->tip_arg);
}
if (but->hold_argN) {
@ -6334,13 +6335,14 @@ void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func)
but->menu_step_func = func;
}
void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN)
void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *arg, uiFreeArgFunc free_arg)
{
but->tip_func = func;
if (but->tip_argN) {
MEM_freeN(but->tip_argN);
if (but->tip_arg_free) {
but->tip_arg_free(but->tip_arg);
}
but->tip_argN = argN;
but->tip_arg = arg;
but->tip_arg_free = free_arg;
}
void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, const void *arg)
@ -6630,7 +6632,7 @@ void UI_but_func_search_set(uiBut *but,
uiButSearchUpdateFn search_update_fn,
void *arg,
const bool free_arg,
uiButSearchArgFreeFn search_arg_free_fn,
uiFreeArgFunc search_arg_free_fn,
uiButHandleFunc search_exec_fn,
void *active)
{
@ -6965,7 +6967,7 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
}
else if (type == BUT_GET_TIP) {
if (but->tip_func) {
tmp = but->tip_func(C, but->tip_argN, but->tip);
tmp = but->tip_func(C, but->tip_arg, but->tip);
}
else if (but->tip && but->tip[0]) {
tmp = BLI_strdup(but->tip);

View File

@ -469,7 +469,7 @@ typedef struct uiAfterFunc {
PropertyRNA *rnaprop;
void *search_arg;
uiButSearchArgFreeFn search_arg_free_fn;
uiFreeArgFunc search_arg_free_fn;
bContextStore *context;

View File

@ -221,7 +221,8 @@ struct uiBut {
const char *tip;
uiButToolTipFunc tip_func;
void *tip_argN;
void *tip_arg;
uiFreeArgFunc tip_arg_free;
/** info on why button is disabled, displayed in tooltip */
const char *disabled_info;
@ -316,7 +317,7 @@ typedef struct uiButSearch {
void *item_active;
void *arg;
uiButSearchArgFreeFn arg_free_fn;
uiFreeArgFunc arg_free_fn;
uiButSearchContextMenuFn item_context_menu_fn;
uiButSearchTooltipFn item_tooltip_fn;
@ -704,7 +705,7 @@ struct uiPopupBlockCreate {
uiBlockCreateFunc create_func;
uiBlockHandleCreateFunc handle_create_func;
void *arg;
void (*arg_free)(void *arg);
uiFreeArgFunc arg_free;
int event_xy[2];
@ -828,7 +829,7 @@ uiPopupBlockHandle *ui_popup_block_create(struct bContext *C,
uiBlockCreateFunc create_func,
uiBlockHandleCreateFunc handle_create_func,
void *arg,
void (*arg_free)(void *arg));
uiFreeArgFunc arg_free);
uiPopupBlockHandle *ui_popup_menu_create(struct bContext *C,
struct ARegion *butregion,
uiBut *but,

View File

@ -3381,10 +3381,13 @@ typedef struct MenuItemLevel {
static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, void *arg)
{
MenuItemLevel *lvl = (MenuItemLevel *)(((uiBut *)arg)->func_argN);
uiBut *but = arg;
MenuItemLevel *lvl = but->func_argN;
/* Use the operator properties from the button owning the menu. */
IDProperty *op_props = but->opptr ? but->opptr->data : NULL;
uiLayoutSetOperatorContext(layout, lvl->opcontext);
uiItemsEnumO(layout, lvl->opname, lvl->propname);
uiItemsFullEnumO(layout, lvl->opname, lvl->propname, op_props, lvl->opcontext, 0);
layout->root->block->flag |= UI_BLOCK_IS_FLIP;
@ -3392,12 +3395,13 @@ static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, vo
UI_block_direction_set(layout->root->block, UI_DIR_DOWN);
}
void uiItemMenuEnumO_ptr(uiLayout *layout,
bContext *C,
wmOperatorType *ot,
const char *propname,
const char *name,
int icon)
void uiItemMenuEnumFullO_ptr(uiLayout *layout,
bContext *C,
wmOperatorType *ot,
const char *propname,
const char *name,
int icon,
PointerRNA *r_opptr)
{
/* Caller must check */
BLI_assert(ot->srna != NULL);
@ -3416,6 +3420,15 @@ void uiItemMenuEnumO_ptr(uiLayout *layout,
lvl->opcontext = layout->root->opcontext;
uiBut *but = ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl, NULL, true);
/* Use the menu button as owner for the operator properties, which will then be passed to the
* individual menu items. */
if (r_opptr) {
but->opptr = MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
WM_operator_properties_create_ptr(but->opptr, ot);
BLI_assert(but->opptr->data == NULL);
WM_operator_properties_alloc(&but->opptr, (IDProperty **)&but->opptr->data, ot->idname);
*r_opptr = *but->opptr;
}
/* add hotkey here, lower UI code can't detect it */
if ((layout->root->block->flag & UI_BLOCK_LOOP) && (ot->prop && ot->invoke)) {
@ -3427,12 +3440,13 @@ void uiItemMenuEnumO_ptr(uiLayout *layout,
}
}
void uiItemMenuEnumO(uiLayout *layout,
bContext *C,
const char *opname,
const char *propname,
const char *name,
int icon)
void uiItemMenuEnumFullO(uiLayout *layout,
bContext *C,
const char *opname,
const char *propname,
const char *name,
int icon,
PointerRNA *r_opptr)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
@ -3444,7 +3458,17 @@ void uiItemMenuEnumO(uiLayout *layout,
return;
}
uiItemMenuEnumO_ptr(layout, C, ot, propname, name, icon);
uiItemMenuEnumFullO_ptr(layout, C, ot, propname, name, icon, r_opptr);
}
void uiItemMenuEnumO(uiLayout *layout,
bContext *C,
const char *opname,
const char *propname,
const char *name,
int icon)
{
uiItemMenuEnumFullO(layout, C, opname, propname, name, icon, NULL);
}
static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg)

View File

@ -591,7 +591,7 @@ int UI_popup_menu_invoke(bContext *C, const char *idname, ReportList *reports)
* \{ */
void UI_popup_block_invoke_ex(
bContext *C, uiBlockCreateFunc func, void *arg, void (*arg_free)(void *arg), bool can_refresh)
bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free, bool can_refresh)
{
wmWindow *window = CTX_wm_window(C);
uiPopupBlockHandle *handle;
@ -608,10 +608,7 @@ void UI_popup_block_invoke_ex(
WM_event_add_mousemove(window);
}
void UI_popup_block_invoke(bContext *C,
uiBlockCreateFunc func,
void *arg,
void (*arg_free)(void *arg))
void UI_popup_block_invoke(bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free)
{
UI_popup_block_invoke_ex(C, func, arg, arg_free, true);
}

View File

@ -773,7 +773,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C,
uiBlockCreateFunc create_func,
uiBlockHandleCreateFunc handle_create_func,
void *arg,
void (*arg_free)(void *arg))
uiFreeArgFunc arg_free)
{
wmWindow *window = CTX_wm_window(C);
uiBut *activebut = UI_context_active_but_get(C);

View File

@ -6205,7 +6205,7 @@ void uiTemplateList(uiLayout *layout,
0,
TIP_("Double click to rename"));
if ((dyntip_data = uilist_item_use_dynamic_tooltip(itemptr, item_dyntip_propname))) {
UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data);
UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data, MEM_freeN);
}
sub = uiLayoutRow(overlap, false);
@ -6762,7 +6762,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
NULL);
but_progress->progress = progress;
UI_but_func_tooltip_set(&but_progress->but, progress_tooltip_func, tip_arg);
UI_but_func_tooltip_set(&but_progress->but, progress_tooltip_func, tip_arg, MEM_freeN);
}
if (!wm->is_interface_locked) {

View File

@ -3489,7 +3489,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
/**
* Draw menu buttons still with triangles when field is not embossed
*/
static void widget_menubut_embossn(uiBut *UNUSED(but),
static void widget_menubut_embossn(const uiBut *UNUSED(but),
uiWidgetColors *wcol,
rcti *rect,
int UNUSED(state),
@ -3512,7 +3512,7 @@ static void widget_menubut_embossn(uiBut *UNUSED(but),
* Draw number buttons still with triangles when field is not embossed
*/
static void widget_numbut_embossn(
uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
const uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
widget_numbut_draw(wcol, rect, state, roundboxalign, true);
}

View File

@ -109,7 +109,7 @@ void ED_masklayer_make_cfra_list(MaskLayer *mask_layer, ListBase *elems, bool on
/* Selection Tools */
/* check if one of the frames in this layer is selected */
bool ED_masklayer_frame_select_check(MaskLayer *mask_layer)
bool ED_masklayer_frame_select_check(const MaskLayer *mask_layer)
{
MaskLayerShape *mask_layer_shape;

View File

@ -157,7 +157,7 @@ Object *ED_object_active_context(const bContext *C)
* (assuming they need to be modified).
*/
Object **ED_object_array_in_mode_or_selected(bContext *C,
bool (*filter_fn)(Object *ob, void *user_data),
bool (*filter_fn)(const Object *ob, void *user_data),
void *filter_user_data,
uint *r_objects_len)
{

View File

@ -401,9 +401,9 @@ void ED_object_mode_generic_exit(struct Main *bmain,
ed_object_mode_generic_exit_ex(bmain, depsgraph, scene, ob, false);
}
bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, struct Object *ob)
bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, const struct Object *ob)
{
return ed_object_mode_generic_exit_ex(NULL, depsgraph, NULL, ob, true);
return ed_object_mode_generic_exit_ex(NULL, depsgraph, NULL, (Object *)ob, true);
}
/** \} */

View File

@ -83,7 +83,7 @@ static bool vertex_group_supported_poll_ex(bContext *C, const Object *ob);
/** \name Local Utility Functions
* \{ */
static bool object_array_for_wpaint_filter(Object *ob, void *user_data)
static bool object_array_for_wpaint_filter(const Object *ob, void *user_data)
{
bContext *C = user_data;
if (vertex_group_supported_poll_ex(C, ob)) {

View File

@ -103,7 +103,7 @@ static bool object_materials_supported_poll_ex(bContext *C, const Object *ob);
/** \name Local Utilities
* \{ */
static bool object_array_for_shading_edit_mode_enabled_filter(Object *ob, void *user_data)
static bool object_array_for_shading_edit_mode_enabled_filter(const Object *ob, void *user_data)
{
bContext *C = user_data;
if (object_materials_supported_poll_ex(C, ob)) {
@ -120,7 +120,7 @@ static Object **object_array_for_shading_edit_mode_enabled(bContext *C, uint *r_
C, object_array_for_shading_edit_mode_enabled_filter, C, r_objects_len);
}
static bool object_array_for_shading_edit_mode_disabled_filter(Object *ob, void *user_data)
static bool object_array_for_shading_edit_mode_disabled_filter(const Object *ob, void *user_data)
{
bContext *C = user_data;
if (object_materials_supported_poll_ex(C, ob)) {

View File

@ -25,6 +25,8 @@
#include <math.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_blenlib.h"
#include "BLI_fileops_types.h"
@ -165,7 +167,7 @@ static void file_draw_icon(const SpaceFile *sfile,
const float a2 = dimmed ? 0.3f : 0.0f;
but = uiDefIconBut(
block, UI_BTYPE_LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, a1, a2, NULL);
UI_but_func_tooltip_set(but, file_draw_tooltip_func, BLI_strdup(path));
UI_but_func_tooltip_set(but, file_draw_tooltip_func, BLI_strdup(path), MEM_freeN);
if (drag) {
/* TODO duplicated from file_draw_preview(). */
@ -489,7 +491,8 @@ static void file_draw_preview(const SpaceFile *sfile,
UI_but_drag_set_id(but, id);
}
/* path is no more static, cannot give it directly to but... */
else if (file->typeflag & FILE_TYPE_ASSET) {
else if (sfile->browse_mode == FILE_BROWSE_MODE_ASSETS &&
(file->typeflag & FILE_TYPE_ASSET) != 0) {
char blend_path[FILE_MAX_LIBEXTRA];
if (BLO_library_path_explode(path, blend_path, NULL, NULL)) {

View File

@ -1285,7 +1285,7 @@ static void node_add_error_message_button(
0,
0,
nullptr);
UI_but_func_tooltip_set(but, node_errors_tooltip_fn, storage_pointer_alloc);
UI_but_func_tooltip_set(but, node_errors_tooltip_fn, storage_pointer_alloc, MEM_freeN);
UI_block_emboss_set(node.block, UI_EMBOSS);
}

View File

@ -1357,9 +1357,9 @@ void NODE_OT_duplicate(wmOperatorType *ot)
ot->srna, "keep_inputs", false, "Keep Inputs", "Keep the input links to duplicated nodes");
}
bool ED_node_select_check(ListBase *lb)
bool ED_node_select_check(const ListBase *lb)
{
LISTBASE_FOREACH (bNode *, node, lb) {
LISTBASE_FOREACH (const bNode *, node, lb) {
if (node->flag & NODE_SELECT) {
return true;
}

View File

@ -1816,8 +1816,8 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* Remove seq so overlap tests don't conflict,
* see seq_free_sequence below for the real freeing. */
BLI_remlink(ed->seqbasep, seq);
/* if (seq->ipo) id_us_min(&seq->ipo->id); */
/* XXX, remove fcurve and assign to split image strips */
/* TODO: remove f-curve and assign to split image strips.
* The old animation system would remove the user of `seq->ipo`. */
start_ofs = timeline_frame = SEQ_transform_get_left_handle_frame(seq);
frame_end = SEQ_transform_get_right_handle_frame(seq);

View File

@ -808,10 +808,10 @@ static int flyApply(bContext *C, FlyInfo *fly, bool is_confirm)
moffset[1] = 0;
}
/* scale the mouse movement by this value - scales mouse movement to the view size
* moffset[0] / (region->winx-xmargin * 2) - window size minus margin (same for y)
/* Scale the mouse movement by this value - scales mouse movement to the view size
* `moffset[0] / (region->winx-xmargin * 2)` - window size minus margin (same for y)
*
* the mouse moves isn't linear */
* the mouse moves isn't linear. */
if (moffset[0]) {
moffset[0] /= fly->width - (xmargin * 2);

View File

@ -102,6 +102,7 @@ set(SRC
transform_orientations.c
transform_snap.c
transform_snap_object.c
transform_snap_sequencer.c
transform.h
transform_constraints.h

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