Refactoring: Geometry Node: Avoid copy last buffer in result for Blur Attribute node #106860

Merged
Jacques Lucke merged 7 commits from mod_moder/blender:blur_avoid_extra_copy into main 2023-04-17 08:09:15 +02:00
217 changed files with 1494 additions and 746 deletions
Showing only changes of commit 4fdb234932 - Show all commits

View File

@ -152,10 +152,12 @@ LightTreeBucket operator+(const LightTreeBucket &a, const LightTreeBucket &b);
struct LightTreeNode {
LightTreeMeasure measure;
uint bit_trail;
int num_emitters = -1; /* The number of emitters a leaf node stores. A negative number indicates
it is an inner node. */
int first_emitter_index; /* Leaf nodes contain an index to first emitter. */
unique_ptr<LightTreeNode> children[2]; /* Inner node has two children. */
/* The number of emitters a leaf node stores. A negative number indicates it is an inner node. */
int num_emitters = -1;
/* Leaf nodes contain an index to first emitter. */
int first_emitter_index;
/* Inner node has two children. */
unique_ptr<LightTreeNode> children[2];
LightTreeNode() = default;

View File

@ -703,8 +703,11 @@ string OSLCompiler::id(ShaderNode *node)
{
/* assign layer unique name based on pointer address + bump mode */
stringstream stream;
stream.imbue(std::locale("C")); /* Ensure that no grouping characters (e.g. commas with en_US
locale) are added to the pointer string */
/* Ensure that no grouping characters (e.g. commas with en_US locale)
* are added to the pointer string. */
stream.imbue(std::locale("C"));
stream << "node_" << node->type->name << "_" << node;
return stream.str();

View File

@ -214,8 +214,8 @@ void deinterlace_line_inplace(
}
/* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The
top field is copied as is, but the bottom field is deinterlaced
against the top field. */
* top field is copied as is, but the bottom field is deinterlaced
* against the top field. */
FFMPEG_INLINE
void deinterlace_bottom_field(
uint8_t *dst, int dst_wrap, const uint8_t *src1, int src_wrap, int width, int height)

View File

@ -911,6 +911,27 @@ extern char *GHOST_getClipboard(bool selection);
*/
extern void GHOST_putClipboard(const char *buffer, bool selection);
/**
* Returns GHOST_kSuccess if the clipboard contains an image.
*/
extern GHOST_TSuccess GHOST_hasClipboardImage(void);
/**
* Get image data from the Clipboard
* \param r_width: the returned image width in pixels.
* \param r_height: the returned image height in pixels.
* \return pointer uint array in RGBA byte order. Caller must free.
*/
extern uint *GHOST_getClipboardImage(int *r_width, int *r_height);
/**
* Put image data to the Clipboard
* \param rgba: uint array in RGBA byte order.
* \param width: the image width in pixels.
* \param height: the image height in pixels.
*/
extern GHOST_TSuccess GHOST_putClipboardImage(uint *rgba, int width, int height);
/**
* Set the Console State
* \param action: console state

View File

@ -471,6 +471,27 @@ class GHOST_ISystem {
*/
virtual void putClipboard(const char *buffer, bool selection) const = 0;
/**
* Returns GHOST_kSuccess if the clipboard contains an image.
*/
virtual GHOST_TSuccess hasClipboardImage(void) const = 0;
/**
* Get image data from the Clipboard
* \param r_width: the returned image width in pixels.
* \param r_height: the returned image height in pixels.
* \return pointer uint array in RGBA byte order. Caller must free.
*/
virtual uint *getClipboardImage(int *r_width, int *r_height) const = 0;
/**
* Put image data to the Clipboard
* \param rgba: uint array in RGBA byte order.
* \param width: the image width in pixels.
* \param height: the image height in pixels.
*/
virtual GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const = 0;
/***************************************************************************************
* System Message Box.
***************************************************************************************/

View File

@ -883,6 +883,24 @@ void GHOST_putClipboard(const char *buffer, bool selection)
system->putClipboard(buffer, selection);
}
GHOST_TSuccess GHOST_hasClipboardImage(void)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->hasClipboardImage();
}
uint *GHOST_getClipboardImage(int *r_width, int *r_height)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->getClipboardImage(r_width, r_height);
}
GHOST_TSuccess GHOST_putClipboardImage(uint *rgba, int width, int height)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->putClipboardImage(rgba, width, height);
}
bool GHOST_setConsoleWindowState(GHOST_TConsoleWindowState action)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();

View File

@ -42,6 +42,23 @@ GHOST_System::~GHOST_System()
exit();
}
GHOST_TSuccess GHOST_System::hasClipboardImage(void) const
{
return GHOST_kFailure;
}
uint *GHOST_System::getClipboardImage(int * /*r_width*/, int * /*r_height*/) const
{
return nullptr;
}
GHOST_TSuccess GHOST_System::putClipboardImage(uint * /*rgba*/,
int /*width*/,
int /*height*/) const
{
return GHOST_kFailure;
}
uint64_t GHOST_System::getMilliSeconds() const
{
return std::chrono::duration_cast<std::chrono::milliseconds>(

View File

@ -330,6 +330,27 @@ class GHOST_System : public GHOST_ISystem {
*/
virtual void putClipboard(const char *buffer, bool selection) const = 0;
/**
* Returns GHOST_kSuccess if the clipboard contains an image.
*/
GHOST_TSuccess hasClipboardImage(void) const;
/**
* Get image data from the Clipboard
* \param r_width: the returned image width in pixels.
* \param r_height: the returned image height in pixels.
* \return pointer uint array in RGBA byte order. Caller must free.
*/
uint *getClipboardImage(int *r_width, int *r_height) const;
/**
* Put image data to the Clipboard
* \param rgba: uint array in RGBA byte order.
* \param width: the image width in pixels.
* \param height: the image height in pixels.
*/
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const;
/**
* Show a system message box
* \param title: The title of the message box.

View File

@ -26,6 +26,9 @@
#include "utf_winfunc.h"
#include "utfconv.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "GHOST_DisplayManagerWin32.hh"
#include "GHOST_EventButton.hh"
#include "GHOST_EventCursor.hh"
@ -2305,6 +2308,257 @@ void GHOST_SystemWin32::putClipboard(const char *buffer, bool selection) const
}
}
GHOST_TSuccess GHOST_SystemWin32::hasClipboardImage(void) const
{
if (IsClipboardFormatAvailable(CF_DIBV5) ||
IsClipboardFormatAvailable(RegisterClipboardFormat("PNG"))) {
return GHOST_kSuccess;
}
return GHOST_kFailure;
}
static uint *getClipboardImageDibV5(int *r_width, int *r_height)
{
HANDLE hGlobal = GetClipboardData(CF_DIBV5);
if (hGlobal == nullptr) {
return nullptr;
}
BITMAPV5HEADER *bitmapV5Header = (BITMAPV5HEADER *)GlobalLock(hGlobal);
if (bitmapV5Header == nullptr) {
return nullptr;
}
int offset = bitmapV5Header->bV5Size + bitmapV5Header->bV5ClrUsed * sizeof(RGBQUAD);
if (bitmapV5Header->bV5Compression == BI_BITFIELDS) {
offset += 12;
}
BYTE *buffer = (BYTE *)bitmapV5Header + offset;
int bitcount = bitmapV5Header->bV5BitCount;
int width = bitmapV5Header->bV5Width;
int height = bitmapV5Header->bV5Height;
*r_width = width;
*r_height = height;
DWORD ColorMasks[4];
ColorMasks[0] = bitmapV5Header->bV5RedMask ? bitmapV5Header->bV5RedMask : 0xff;
ColorMasks[1] = bitmapV5Header->bV5GreenMask ? bitmapV5Header->bV5GreenMask : 0xff00;
ColorMasks[2] = bitmapV5Header->bV5BlueMask ? bitmapV5Header->bV5BlueMask : 0xff0000;
ColorMasks[3] = bitmapV5Header->bV5AlphaMask ? bitmapV5Header->bV5AlphaMask : 0xff000000;
/* Bit shifts needed for the ColorMasks. */
DWORD ColorShifts[4];
for (int i = 0; i < 4; i++) {
_BitScanForward(&ColorShifts[i], ColorMasks[i]);
}
uchar *source = (uchar *)buffer;
uint *rgba = (uint *)malloc(width * height * 4);
uint8_t *target = (uint8_t *)rgba;
if (bitmapV5Header->bV5Compression == BI_BITFIELDS && bitcount == 32) {
for (int h = 0; h < height; h++) {
for (int w = 0; w < width; w++, target += 4, source += 4) {
DWORD *pix = (DWORD *)source;
target[0] = uint8_t((*pix & ColorMasks[0]) >> ColorShifts[0]);
target[1] = uint8_t((*pix & ColorMasks[1]) >> ColorShifts[1]);
target[2] = uint8_t((*pix & ColorMasks[2]) >> ColorShifts[2]);
target[3] = uint8_t((*pix & ColorMasks[3]) >> ColorShifts[3]);
}
}
}
else if (bitmapV5Header->bV5Compression == BI_RGB && bitcount == 32) {
for (int h = 0; h < height; h++) {
for (int w = 0; w < width; w++, target += 4, source += 4) {
RGBQUAD *quad = (RGBQUAD *)source;
target[0] = uint8_t(quad->rgbRed);
target[1] = uint8_t(quad->rgbGreen);
target[2] = uint8_t(quad->rgbBlue);
target[3] = (bitmapV5Header->bV5AlphaMask) ? uint8_t(quad->rgbReserved) : 255;
}
}
}
else if (bitmapV5Header->bV5Compression == BI_RGB && bitcount == 24) {
int bytes_per_row = ((((width * bitcount) + 31) & ~31) >> 3);
int slack = bytes_per_row - (width * 3);
for (int h = 0; h < height; h++, source += slack) {
for (int w = 0; w < width; w++, target += 4, source += 3) {
RGBTRIPLE *triple = (RGBTRIPLE *)source;
target[0] = uint8_t(triple->rgbtRed);
target[1] = uint8_t(triple->rgbtGreen);
target[2] = uint8_t(triple->rgbtBlue);
target[3] = 255;
}
}
}
GlobalUnlock(hGlobal);
return rgba;
}
/* Works with any image format that ImBuf can load. */
static uint *getClipboardImageImBuf(int *r_width, int *r_height, UINT format)
{
HANDLE hGlobal = GetClipboardData(format);
if (hGlobal == nullptr) {
return nullptr;
}
LPVOID pMem = GlobalLock(hGlobal);
if (!pMem) {
return nullptr;
}
uint *rgba = nullptr;
ImBuf *ibuf = IMB_ibImageFromMemory(
(uchar *)pMem, GlobalSize(hGlobal), IB_rect, nullptr, "<clipboard>");
if (ibuf) {
*r_width = ibuf->x;
*r_height = ibuf->y;
rgba = (uint *)malloc(4 * ibuf->x * ibuf->y);
memcpy(rgba, ibuf->rect, 4 * ibuf->x * ibuf->y);
IMB_freeImBuf(ibuf);
}
GlobalUnlock(hGlobal);
return rgba;
}
uint *GHOST_SystemWin32::getClipboardImage(int *r_width, int *r_height) const
{
if (!OpenClipboard(nullptr)) {
return nullptr;
}
/* Synthesized formats are placed after posted formats. */
UINT cfPNG = RegisterClipboardFormat("PNG");
UINT format = 0;
for (int cf = EnumClipboardFormats(0); cf; cf = EnumClipboardFormats(cf)) {
if (ELEM(cf, CF_DIBV5, cfPNG)) {
format = cf;
}
if (cf == CF_DIBV5 || (cf == CF_BITMAP && format == cfPNG)) {
break; /* Favor CF_DIBV5, but not if synthesized. */
}
}
uint *rgba = nullptr;
if (format == CF_DIBV5) {
rgba = getClipboardImageDibV5(r_width, r_height);
}
else if (format == cfPNG) {
rgba = getClipboardImageImBuf(r_width, r_height, cfPNG);
}
else {
*r_width = 0;
*r_height = 0;
}
CloseClipboard();
return rgba;
}
static bool putClipboardImageDibV5(uint *rgba, int width, int height)
{
DWORD size_pixels = width * height * 4;
/* Pixel data is 12 bytes after the header. */
HGLOBAL hMem = GlobalAlloc(GHND, sizeof(BITMAPV5HEADER) + 12 + size_pixels);
if (!hMem) {
return false;
}
BITMAPV5HEADER *hdr = (BITMAPV5HEADER *)GlobalLock(hMem);
if (!hdr) {
GlobalFree(hMem);
return false;
}
hdr->bV5Size = sizeof(BITMAPV5HEADER);
hdr->bV5Width = width;
hdr->bV5Height = height;
hdr->bV5Planes = 1;
hdr->bV5BitCount = 32;
hdr->bV5SizeImage = size_pixels;
hdr->bV5Compression = BI_BITFIELDS;
hdr->bV5RedMask = 0x000000ff;
hdr->bV5GreenMask = 0x0000ff00;
hdr->bV5BlueMask = 0x00ff0000;
hdr->bV5AlphaMask = 0xff000000;
hdr->bV5CSType = LCS_sRGB;
hdr->bV5Intent = LCS_GM_IMAGES;
hdr->bV5ClrUsed = 0;
memcpy((char *)hdr + sizeof(BITMAPV5HEADER) + 12, rgba, size_pixels);
GlobalUnlock(hMem);
if (!SetClipboardData(CF_DIBV5, hMem)) {
GlobalFree(hMem);
return false;
}
return true;
}
static bool putClipboardImagePNG(uint *rgba, int width, int height)
{
UINT cf = RegisterClipboardFormat("PNG");
/* Load buffer into ImBuf, convert to PNG. */
ImBuf *ibuf = IMB_allocFromBuffer(rgba, nullptr, width, height, 32);
ibuf->ftype = IMB_FTYPE_PNG;
ibuf->foptions.quality = 15;
if (!IMB_saveiff(ibuf, "<memory>", IB_rect | IB_mem)) {
IMB_freeImBuf(ibuf);
return false;
}
HGLOBAL hMem = GlobalAlloc(GHND, ibuf->encodedbuffersize);
if (!hMem) {
IMB_freeImBuf(ibuf);
return false;
}
LPVOID pMem = GlobalLock(hMem);
if (!pMem) {
IMB_freeImBuf(ibuf);
GlobalFree(hMem);
return false;
}
memcpy(pMem, ibuf->encodedbuffer, ibuf->encodedbuffersize);
GlobalUnlock(hMem);
IMB_freeImBuf(ibuf);
if (!SetClipboardData(cf, hMem)) {
GlobalFree(hMem);
return false;
}
return true;
}
GHOST_TSuccess GHOST_SystemWin32::putClipboardImage(uint *rgba, int width, int height) const
{
if (!OpenClipboard(nullptr) || !EmptyClipboard()) {
return GHOST_kFailure;
}
bool ok = putClipboardImageDibV5(rgba, width, height) &&
putClipboardImagePNG(rgba, width, height);
CloseClipboard();
return (ok) ? GHOST_kSuccess : GHOST_kFailure;
}
/* -------------------------------------------------------------------- */
/** \name Message Box
* \{ */

View File

@ -215,6 +215,27 @@ class GHOST_SystemWin32 : public GHOST_System {
*/
void putClipboard(const char *buffer, bool selection) const;
/**
* Returns GHOST_kSuccess if the clipboard contains an image.
*/
GHOST_TSuccess hasClipboardImage(void) const;
/**
* Get image data from the Clipboard
* \param r_width: the returned image width in pixels.
* \param r_height: the returned image height in pixels.
* \return pointer uint array in RGBA byte order. Caller must free.
*/
uint *getClipboardImage(int *r_width, int *r_height) const;
/**
* Put image data to the Clipboard
* \param rgba: uint array in RGBA byte order.
* \param width: the image width in pixels.
* \param height: the image height in pixels.
*/
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const;
/**
* Show a system message box
* \param title: The title of the message box.

View File

@ -93,7 +93,7 @@ def write_sysinfo(filepath):
output.write("\t%r\n" % p)
output.write("datafiles: %r\n" % (bpy.utils.user_resource('DATAFILES')))
output.write("config: %r\n" % (bpy.utils.user_resource('CONFIG')))
output.write("scripts : %r\n" % (bpy.utils.user_resource('SCRIPTS')))
output.write("scripts: %r\n" % (bpy.utils.user_resource('SCRIPTS')))
output.write("autosave: %r\n" % (bpy.utils.user_resource('AUTOSAVE')))
output.write("tempdir: %r\n" % (bpy.app.tempdir))
@ -123,7 +123,7 @@ def write_sysinfo(filepath):
output.write("OpenColorIO: ")
if ocio.supported:
if ocio.version_string == "fallback":
output.write("Blender was built with OpenColorIO, " +
output.write("Blender was built with OpenColorIO, "
"but it currently uses fallback color management.\n")
else:
output.write("%s\n" % (ocio.version_string))

View File

@ -184,6 +184,8 @@ class IMAGE_MT_image(Menu):
bl_label = "Image"
def draw(self, context):
import sys
layout = self.layout
sima = context.space_data
@ -207,6 +209,11 @@ class IMAGE_MT_image(Menu):
layout.separator()
if sys.platform[:3] == "win":
layout.operator("image.clipboard_copy", text="Copy")
layout.operator("image.clipboard_paste", text="Paste")
layout.separator()
if ima:
layout.operator("image.save", text="Save", icon='FILE_TICK')
layout.operator("image.save_as", text="Save As...")

View File

@ -31,21 +31,44 @@ def generate_from_enum_ex(
type,
attr,
cursor='DEFAULT',
tooldef_keywords={},
exclude_filter={},
tooldef_keywords=None,
icon_map=None,
use_separators=True,
):
if tooldef_keywords is None:
tooldef_keywords = {}
tool_defs = []
for enum in type.bl_rna.properties[attr].enum_items_static:
name = enum.name
idname = enum.identifier
if idname in exclude_filter:
continue
enum_items = getattr(
type.bl_rna.properties[attr],
"enum_items_static_ui" if use_separators else
"enum_items_static",
)
for enum in enum_items:
if use_separators:
if not (name := enum.name):
# Empty string for a UI Separator.
tool_defs.append(None)
continue
if not (idname := enum.identifier):
# This is a heading, there is no purpose in showing headings here.
continue
else:
name = enum.name
idname = enum.identifier
icon = icon_prefix + idname.lower()
if icon_map is not None:
icon = icon_map.get(icon, icon)
tool_defs.append(
ToolDef.from_dict(
dict(
idname=idname_prefix + name,
label=name,
icon=icon_prefix + idname.lower(),
icon=icon,
cursor=cursor,
data_block=idname,
**tooldef_keywords,
@ -1316,6 +1339,9 @@ class _defs_sculpt:
icon_prefix="brush.sculpt.",
type=bpy.types.Brush,
attr="sculpt_tool",
# TODO(@ideasman42): we may want to enable this,
# it causes awkward grouping with 2x column button layout.
use_separators=False,
)
@ToolDef.from_fn
@ -2326,103 +2352,18 @@ class _defs_gpencil_weight:
class _defs_curves_sculpt:
@ToolDef.from_fn
def selection_paint():
return dict(
idname="builtin_brush.selection_paint",
label="Selection Paint",
icon="ops.generic.select_paint",
data_block="SELECTION_PAINT",
)
@ToolDef.from_fn
def comb():
return dict(
idname="builtin_brush.comb",
label="Comb",
icon="ops.curves.sculpt_comb",
data_block='COMB',
)
@ToolDef.from_fn
def add():
return dict(
idname="builtin_brush.add",
label="Add",
icon="ops.curves.sculpt_add",
data_block='ADD',
)
@ToolDef.from_fn
def delete():
return dict(
idname="builtin_brush.delete",
label="Delete",
icon="ops.curves.sculpt_delete",
data_block='DELETE',
)
@ToolDef.from_fn
def snake_hook():
return dict(
idname="builtin_brush.snake_hook",
label="Snake Hook",
icon="ops.curves.sculpt_snake_hook",
data_block='SNAKE_HOOK',
)
@ToolDef.from_fn
def grow_shrink():
return dict(
idname="builtin_brush.grow_shrink",
label="Grow/Shrink",
icon="ops.curves.sculpt_grow_shrink",
data_block='GROW_SHRINK',
)
@ToolDef.from_fn
def pinch():
return dict(
idname="builtin_brush.pinch",
label="Pinch",
icon="ops.curves.sculpt_pinch",
data_block='PINCH',
)
@ToolDef.from_fn
def smooth():
return dict(
idname="builtin_brush.smooth",
label="Smooth",
icon="ops.curves.sculpt_smooth",
data_block='SMOOTH',
)
@ToolDef.from_fn
def puff():
return dict(
idname="builtin_brush.puff",
label="Puff",
icon="ops.curves.sculpt_puff",
data_block='PUFF',
)
@ToolDef.from_fn
def density():
return dict(
idname="builtin_brush.density",
label="Density",
icon="ops.curves.sculpt_density",
data_block="DENSITY",
)
@ToolDef.from_fn
def slide():
return dict(
idname="builtin_brush.slide",
label="Slide",
icon="ops.curves.sculpt_slide",
data_block="SLIDE",
@staticmethod
def generate_from_brushes(context):
return generate_from_enum_ex(
context,
idname_prefix="builtin_brush.",
icon_prefix="ops.curves.sculpt_",
type=bpy.types.Brush,
attr="curves_sculpt_tool",
icon_map={
# Use the generic icon for selection painting.
"ops.curves.sculpt_selection_paint": "ops.generic.select_paint",
},
)
@ -3193,19 +3134,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
),
],
'SCULPT_CURVES': [
_defs_curves_sculpt.selection_paint,
None,
_defs_curves_sculpt.add,
_defs_curves_sculpt.delete,
_defs_curves_sculpt.density,
None,
_defs_curves_sculpt.comb,
_defs_curves_sculpt.snake_hook,
_defs_curves_sculpt.grow_shrink,
_defs_curves_sculpt.pinch,
_defs_curves_sculpt.puff,
_defs_curves_sculpt.smooth,
_defs_curves_sculpt.slide,
_defs_curves_sculpt.generate_from_brushes,
None,
*_tools_annotate,
],

View File

@ -147,7 +147,7 @@ add_subdirectory(imbuf)
add_subdirectory(imbuf/intern/oiio)
add_subdirectory(nodes)
add_subdirectory(modifiers)
add_subdirectory(gpencil_modifiers)
add_subdirectory(gpencil_modifiers_legacy)
add_subdirectory(sequencer)
add_subdirectory(shader_fx)
add_subdirectory(io)

View File

@ -54,37 +54,45 @@ enum {
* This means callback shall not *do* anything, only use this as informative data if it needs it.
*/
IDWALK_CB_EMBEDDED = (1 << 4),
/**
* That ID pointer points to an embedded ID, but does not own it.
*
* E.g the `collection` pointer of the first ViewLayerCollection of a ViewLayer should always
* point to the scene's master collection, which is an embedded ID 'owned' by
* `Scene.master_collection`.
*/
IDWALK_CB_EMBEDDED_NOT_OWNING = (1 << 5),
/**
* That ID is not really used by its owner, it's just an internal hint/helper.
* This marks the 'from' pointers issue, like Key->from.
* How to handle that kind of cases totally depends on what caller code is doing... */
IDWALK_CB_LOOPBACK = (1 << 5),
IDWALK_CB_LOOPBACK = (1 << 6),
/** That ID is used as library override's reference by its owner. */
IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE = (1 << 6),
IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE = (1 << 7),
/** That ID pointer is not overridable. */
IDWALK_CB_OVERRIDE_LIBRARY_NOT_OVERRIDABLE = (1 << 7),
IDWALK_CB_OVERRIDE_LIBRARY_NOT_OVERRIDABLE = (1 << 8),
/**
* Indicates that this is an internal runtime ID pointer, like e.g. `ID.newid` or `ID.original`.
* \note Those should be ignored in most cases, and won't be processed/generated anyway unless
* `IDWALK_DO_INTERNAL_RUNTIME_POINTERS` option is enabled.
*/
IDWALK_CB_INTERNAL = (1 << 8),
IDWALK_CB_INTERNAL = (1 << 9),
/**
* This ID usage is fully refcounted.
* Callback is responsible to deal accordingly with #ID.us if needed.
*/
IDWALK_CB_USER = (1 << 9),
IDWALK_CB_USER = (1 << 10),
/**
* This ID usage is not refcounted, but at least one user should be generated by it (to avoid
* e.g. losing the used ID on save/reload).
* Callback is responsible to deal accordingly with #ID.us if needed.
*/
IDWALK_CB_USER_ONE = (1 << 10),
IDWALK_CB_USER_ONE = (1 << 11),
};
enum {
@ -123,7 +131,9 @@ typedef int (*LibraryIDLinkCallback)(LibraryIDLinkCallbackData *cb_data);
/* Flags for the foreach function itself. */
enum {
IDWALK_NOP = 0,
/** The callback will never modify the ID pointers it processes. */
/** The callback will never modify the ID pointers it processes.
* WARNING: It is very important to pass this flag when valid, as it can lead to important
* optimizations and debug/assert code. */
IDWALK_READONLY = (1 << 0),
/** Recurse into 'descendant' IDs.
* Each ID is only processed once. Order of ID processing is not guaranteed.

View File

@ -562,8 +562,6 @@ void BKE_pbvh_update_hide_attributes_from_mesh(PBVH *pbvh);
void BKE_pbvh_face_sets_color_set(PBVH *pbvh, int seed, int color_default);
void BKE_pbvh_respect_hide_set(PBVH *pbvh, bool respect_hide);
/* Vertex Deformer. */
float (*BKE_pbvh_vert_coords_alloc(struct PBVH *pbvh))[3];
@ -591,7 +589,6 @@ typedef struct PBVHVertexIter {
int i;
int index;
PBVHVertRef vertex;
bool respect_hide;
/* grid */
struct CCGKey key;
@ -664,14 +661,9 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
} \
} \
else if (vi.vert_positions) { \
if (vi.respect_hide) { \
vi.visible = !(vi.hide_vert && vi.hide_vert[vi.vert_indices[vi.gx]]); \
if (mode == PBVH_ITER_UNIQUE && !vi.visible) { \
continue; \
} \
} \
else { \
BLI_assert(vi.visible); \
vi.visible = !(vi.hide_vert && vi.hide_vert[vi.vert_indices[vi.gx]]); \
if (mode == PBVH_ITER_UNIQUE && !vi.visible) { \
continue; \
} \
vi.co = vi.vert_positions[vi.vert_indices[vi.gx]]; \
vi.no = vi.vert_normals[vi.vert_indices[vi.gx]]; \

View File

@ -12,7 +12,7 @@ set(INC
../depsgraph
../draw
../functions
../gpencil_modifiers
../gpencil_modifiers_legacy
../gpu
../ikplugin
../imbuf
@ -525,7 +525,7 @@ set(LIB
bf_depsgraph
bf_draw
bf_functions
bf_gpencil_modifiers
bf_gpencil_modifiers_legacy
bf_gpu
bf_ikplugin
bf_imbuf

View File

@ -923,8 +923,8 @@ static int foreach_libblock_link_append_callback(LibraryIDLinkCallbackData *cb_d
{
/* NOTE: It is important to also skip liboverride references here, as those should never be made
* local. */
if (cb_data->cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_INTERNAL | IDWALK_CB_LOOPBACK |
IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
if (cb_data->cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_EMBEDDED_NOT_OWNING | IDWALK_CB_INTERNAL |
IDWALK_CB_LOOPBACK | IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
return IDWALK_RET_NOP;
}

View File

@ -649,7 +649,7 @@ bool BKE_gpencil_stroke_stretch(bGPDstroke *gps,
if (!isfinite(used_percent_length)) {
/* #used_percent_length must always be finite, otherwise a segfault occurs.
* Since this function should never segfault, set #used_percent_length to a safe fallback. */
/* NOTE: This fallback is used if gps->totpoints == 2, see MOD_gpencillength.c */
/* NOTE: This fallback is used if gps->totpoints == 2, see MOD_gpencil_legacy_length.c */
used_percent_length = 0.1f;
}

View File

@ -43,8 +43,8 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "MOD_gpencil_lineart.h"
#include "MOD_gpencil_modifiertypes.h"
#include "MOD_gpencil_legacy_lineart.h"
#include "MOD_gpencil_legacy_modifiertypes.h"
#include "BLO_read_write.h"
@ -329,7 +329,7 @@ void BKE_gpencil_frame_active_set(Depsgraph *depsgraph, bGPdata *gpd)
void BKE_gpencil_modifier_init(void)
{
/* Initialize modifier types */
gpencil_modifier_type_init(modifier_gpencil_types); /* MOD_gpencil_util.c */
gpencil_modifier_type_init(modifier_gpencil_types); /* MOD_gpencil_legacy_util.c */
#if 0
/* Note that GPencil actually does not support these at the moment,

View File

@ -404,7 +404,7 @@ static int lib_id_expand_local_cb(LibraryIDLinkCallbackData *cb_data)
return IDWALK_RET_NOP;
}
if (cb_flag & IDWALK_CB_EMBEDDED) {
if (cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_EMBEDDED_NOT_OWNING)) {
/* Embedded data-blocks need to be made fully local as well.
* Note however that in some cases (when owner ID had to be duplicated instead of being made
* local directly), its embedded IDs should also have already been duplicated, and hence be

View File

@ -696,7 +696,8 @@ static void lib_query_unused_ids_tag_recurse(Main *bmain,
/* An ID user is 'valid' (i.e. may affect the 'used'/'not used' status of the ID it uses) if it
* does not match `ignored_usages`, and does match `required_usages`. */
const int ignored_usages = (IDWALK_CB_LOOPBACK | IDWALK_CB_EMBEDDED);
const int ignored_usages = (IDWALK_CB_LOOPBACK | IDWALK_CB_EMBEDDED |
IDWALK_CB_EMBEDDED_NOT_OWNING);
const int required_usages = (IDWALK_CB_USER | IDWALK_CB_USER_ONE);
/* This ID may be tagged as unused if none of its users are 'valid', as defined above.

View File

@ -157,7 +157,7 @@ static int foreach_libblock_remap_callback(LibraryIDLinkCallbackData *cb_data)
{
const int cb_flag = cb_data->cb_flag;
if (cb_flag & IDWALK_CB_EMBEDDED) {
if (cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_EMBEDDED_NOT_OWNING)) {
return IDWALK_RET_NOP;
}
@ -857,7 +857,8 @@ static void libblock_relink_to_newid_prepare_data(Main *bmain,
static int id_relink_to_newid_looper(LibraryIDLinkCallbackData *cb_data)
{
const int cb_flag = cb_data->cb_flag;
if (cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
if (cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_EMBEDDED_NOT_OWNING |
IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
return IDWALK_RET_NOP;
}

View File

@ -241,6 +241,7 @@ void BKE_mesh_tag_edges_split(struct Mesh *mesh)
mesh->runtime->subsurf_optimal_display_edges.clear_and_shrink();
if (mesh->runtime->shrinkwrap_data) {
BKE_shrinkwrap_boundary_data_free(mesh->runtime->shrinkwrap_data);
mesh->runtime->shrinkwrap_data = nullptr;
}
}

View File

@ -1952,9 +1952,11 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls)
}
}
/* Ensure every transition's start/end properly set.
/**
* Ensure every transition's start/end properly set.
* Strip will be removed / freed if it doesn't fit (invalid).
* Return value indicates if passed strip is valid/fixed or invalid/removed. */
* Return value indicates if passed strip is valid/fixed or invalid/removed.
*/
static bool nlastrip_validate_transition_start_end(NlaStrip *strip)
{

View File

@ -132,7 +132,8 @@ struct DupliContext {
};
struct DupliGenerator {
short type; /* Dupli Type, see members of #OB_DUPLI. */
/** Duplicator Type, see members of #OB_DUPLI. */
short type;
void (*make_duplis)(const DupliContext *ctx);
};
@ -1325,8 +1326,10 @@ static void make_duplis_faces(const DupliContext *ctx)
}
}
static const DupliGenerator gen_dupli_faces = {/*type*/ OB_DUPLIFACES,
/*make_duplis*/ make_duplis_faces};
static const DupliGenerator gen_dupli_faces = {
/*type*/ OB_DUPLIFACES,
/*make_duplis*/ make_duplis_faces,
};
/** \} */
@ -1673,8 +1676,10 @@ static void make_duplis_particles(const DupliContext *ctx)
}
}
static const DupliGenerator gen_dupli_particles = {/*type*/ OB_DUPLIPARTS,
/*make_duplis*/ make_duplis_particles};
static const DupliGenerator gen_dupli_particles = {
/*type*/ OB_DUPLIPARTS,
/*make_duplis*/ make_duplis_particles,
};
/** \} */

View File

@ -2171,11 +2171,10 @@ static PBVH *build_pbvh_for_dynamic_topology(Object *ob)
return pbvh;
}
static PBVH *build_pbvh_from_regular_mesh(Object *ob, Mesh *me_eval_deform, bool respect_hide)
static PBVH *build_pbvh_from_regular_mesh(Object *ob, Mesh *me_eval_deform)
{
Mesh *me = BKE_object_get_original_mesh(ob);
PBVH *pbvh = BKE_pbvh_new(PBVH_FACES);
BKE_pbvh_respect_hide_set(pbvh, respect_hide);
BKE_pbvh_build_mesh(pbvh, me);
@ -2188,12 +2187,11 @@ static PBVH *build_pbvh_from_regular_mesh(Object *ob, Mesh *me_eval_deform, bool
return pbvh;
}
static PBVH *build_pbvh_from_ccg(Object *ob, SubdivCCG *subdiv_ccg, bool respect_hide)
static PBVH *build_pbvh_from_ccg(Object *ob, SubdivCCG *subdiv_ccg)
{
CCGKey key;
BKE_subdiv_ccg_key_top_level(&key, subdiv_ccg);
PBVH *pbvh = BKE_pbvh_new(PBVH_GRIDS);
BKE_pbvh_respect_hide_set(pbvh, respect_hide);
Mesh *base_mesh = BKE_mesh_from_object(ob);
BKE_sculpt_sync_face_visibility_to_grids(base_mesh, subdiv_ccg);
@ -2216,8 +2214,6 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
return nullptr;
}
const bool respect_hide = true;
PBVH *pbvh = ob->sculpt->pbvh;
if (pbvh != nullptr) {
/* NOTE: It is possible that pointers to grids or other geometry data changed. Need to update
@ -2258,11 +2254,11 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
Mesh *mesh_eval = static_cast<Mesh *>(object_eval->data);
if (mesh_eval->runtime->subdiv_ccg != nullptr) {
pbvh = build_pbvh_from_ccg(ob, mesh_eval->runtime->subdiv_ccg, respect_hide);
pbvh = build_pbvh_from_ccg(ob, mesh_eval->runtime->subdiv_ccg);
}
else if (ob->type == OB_MESH) {
Mesh *me_eval_deform = object_eval->runtime.mesh_deform_eval;
pbvh = build_pbvh_from_regular_mesh(ob, me_eval_deform, respect_hide);
pbvh = build_pbvh_from_regular_mesh(ob, me_eval_deform);
}
}

View File

@ -335,10 +335,6 @@ static void build_mesh_leaf_node(PBVH *pbvh, PBVHNode *node)
node->face_vert_indices = (const int(*)[3])face_vert_indices;
if (pbvh->respect_hide == false) {
has_visible = true;
}
for (int i = 0; i < totface; i++) {
const MLoopTri *lt = &pbvh->looptri[node->prim_indices[i]];
for (int j = 0; j < 3; j++) {
@ -1042,7 +1038,6 @@ void BKE_pbvh_build_grids(PBVH *pbvh,
PBVH *BKE_pbvh_new(PBVHType type)
{
PBVH *pbvh = MEM_new<PBVH>(__func__);
pbvh->respect_hide = true;
pbvh->draw_cache_invalid = true;
pbvh->header.type = type;
@ -2600,7 +2595,7 @@ static bool pbvh_faces_node_raycast(PBVH *pbvh,
const MLoopTri *lt = &pbvh->looptri[faces[i]];
const int *face_verts = node->face_vert_indices[i];
if (pbvh->respect_hide && paint_is_face_hidden(lt, pbvh->hide_poly)) {
if (paint_is_face_hidden(lt, pbvh->hide_poly)) {
continue;
}
@ -2909,7 +2904,7 @@ static bool pbvh_faces_node_nearest_to_ray(PBVH *pbvh,
const MLoopTri *lt = &pbvh->looptri[faces[i]];
const int *face_verts = node->face_vert_indices[i];
if (pbvh->respect_hide && paint_is_face_hidden(lt, pbvh->hide_poly)) {
if (paint_is_face_hidden(lt, pbvh->hide_poly)) {
continue;
}
@ -3425,12 +3420,6 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
vi->vert_positions = nullptr;
vi->vertex.i = 0LL;
vi->respect_hide = pbvh->respect_hide;
if (pbvh->respect_hide == false) {
/* The same value for all vertices. */
vi->visible = true;
}
BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid, nullptr, &gridsize, &grids);
BKE_pbvh_node_num_verts(pbvh, node, &uniq_verts, &totvert);
const int *vert_indices = BKE_pbvh_node_get_vert_indices(node);
@ -3586,11 +3575,6 @@ void BKE_pbvh_update_hide_attributes_from_mesh(PBVH *pbvh)
}
}
void BKE_pbvh_respect_hide_set(PBVH *pbvh, bool respect_hide)
{
pbvh->respect_hide = respect_hide;
}
bool BKE_pbvh_is_drawing(const PBVH *pbvh)
{
return pbvh->is_drawing;

View File

@ -187,7 +187,6 @@ struct PBVH {
/* flag are verts/faces deformed */
bool deformed;
bool respect_hide;
/* Dynamic topology */
float bm_max_edge_len;

View File

@ -763,7 +763,7 @@ static void scene_foreach_layer_collection(LibraryForeachIDData *data, ListBase
* anyway... */
const int cb_flag = (lc->collection != nullptr &&
(lc->collection->id.flag & LIB_EMBEDDED_DATA) != 0) ?
IDWALK_CB_EMBEDDED :
IDWALK_CB_EMBEDDED_NOT_OWNING :
IDWALK_CB_NOP;
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, lc->collection, cb_flag | IDWALK_CB_DIRECT_WEAK_LINK);
scene_foreach_layer_collection(data, &lc->layer_collections);

View File

@ -168,15 +168,17 @@ void BKE_screen_foreach_id_screen_area(LibraryForeachIDData *data, ScrArea *area
BKE_LIB_FOREACHID_PROCESS_ID(data, snode->id, IDWALK_CB_NOP);
BKE_LIB_FOREACHID_PROCESS_ID(data, snode->from, IDWALK_CB_NOP);
BKE_LIB_FOREACHID_PROCESS_IDSUPER(
data, snode->nodetree, is_private_nodetree ? IDWALK_CB_EMBEDDED : IDWALK_CB_USER_ONE);
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data,
snode->nodetree,
is_private_nodetree ? IDWALK_CB_EMBEDDED_NOT_OWNING :
IDWALK_CB_USER_ONE);
LISTBASE_FOREACH (bNodeTreePath *, path, &snode->treepath) {
if (path == snode->treepath.first) {
/* first nodetree in path is same as snode->nodetree */
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data,
path->nodetree,
is_private_nodetree ? IDWALK_CB_EMBEDDED :
is_private_nodetree ? IDWALK_CB_EMBEDDED_NOT_OWNING :
IDWALK_CB_USER_ONE);
}
else {

View File

@ -104,6 +104,8 @@
} \
(void)0
#define TIMEIT_BLOCK_VALUE(id) (float)(_timeit_var_##id)
#define TIMEIT_BLOCK_STATS(id) \
{ \
printf("%s time (in seconds): %f\n", #id, _timeit_var_##id); \

View File

@ -2241,7 +2241,7 @@ static int lib_link_main_data_restore_cb(LibraryIDLinkCallbackData *cb_data)
{
const int cb_flag = cb_data->cb_flag;
ID **id_pointer = cb_data->id_pointer;
if (cb_flag & IDWALK_CB_EMBEDDED || *id_pointer == nullptr) {
if (cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_EMBEDDED_NOT_OWNING) || *id_pointer == nullptr) {
return IDWALK_RET_NOP;
}

View File

@ -20,7 +20,7 @@
#include "bmesh.h"
#include "intern/bmesh_private.h"
BMUVOffsets BM_uv_map_get_offsets_n(const BMesh *bm, const int layer)
BMUVOffsets BM_uv_map_get_offsets_from_layer(const BMesh *bm, const int layer)
{
using namespace blender;
using namespace blender::bke;
@ -46,7 +46,8 @@ BMUVOffsets BM_uv_map_get_offsets_n(const BMesh *bm, const int layer)
BMUVOffsets BM_uv_map_get_offsets(const BMesh *bm)
{
return BM_uv_map_get_offsets_n(bm, CustomData_get_active_layer(&bm->ldata, CD_PROP_FLOAT2));
const int layer = CustomData_get_active_layer(&bm->ldata, CD_PROP_FLOAT2);
return BM_uv_map_get_offsets_from_layer(bm, layer);
}
static void uv_aspect(const BMLoop *l,

View File

@ -11,11 +11,17 @@ extern "C" {
#endif
/**
* Retrieve the custom data offsets for layers used for user interaction with a UV map, returns the
* active uv map if layer is -1.
* Retrieve the custom data offsets for the UV map.
* \param layer: The layer index (where 0 is the first UV map).
* \return The layer offsets or -1 when not found.
*/
BMUVOffsets BM_uv_map_get_offsets_from_layer(const BMesh *bm, int layer);
/**
* Retrieve the custom data offsets for layers used for user interaction with the active UV map.
* \return The layer offsets or -1 when not found.
*/
BMUVOffsets BM_uv_map_get_offsets(const BMesh *bm);
BMUVOffsets BM_uv_map_get_offsets_n(const BMesh *bm, int layer);
float BM_loop_uv_calc_edge_length_squared(const BMLoop *l,
int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT

View File

@ -8,7 +8,7 @@
#include "DRW_engine.h"
#include "DRW_render.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_view3d.h"
#include "DNA_gpencil_legacy_types.h"

View File

@ -77,8 +77,8 @@ GPU_SHADER_CREATE_INFO(workbench_next_resolve_curvature)
GPU_SHADER_CREATE_INFO(workbench_next_resolve_cavity)
.define("WORKBENCH_CAVITY")
/* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect, it doesn't work
here? */
/* TODO(@pragma37): GPU_SAMPLER_EXTEND_MODE_REPEAT is set in CavityEffect,
* it doesn't work here? */
.sampler(8, ImageType::FLOAT_2D, "jitter_tx")
.uniform_buf(5, "vec4", "cavity_samples[512]");

View File

@ -17,7 +17,7 @@
#include "DRW_engine.h"
#include "DRW_render.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "GPU_batch.h"
#include "DEG_depsgraph_query.h"

View File

@ -48,7 +48,7 @@
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "ED_space_api.h"
#include "ED_view3d.h"

View File

@ -12,7 +12,7 @@ if(WITH_BLENDER)
add_subdirectory(curves)
add_subdirectory(geometry)
add_subdirectory(gizmo_library)
add_subdirectory(gpencil)
add_subdirectory(gpencil_legacy)
add_subdirectory(interface)
add_subdirectory(io)
add_subdirectory(lattice)

View File

@ -741,7 +741,7 @@ bool ANIM_driver_vars_paste(ReportList *reports, FCurve *fcu, bool replace)
/* sanity checks */
if (BLI_listbase_is_empty(&driver_vars_copybuf)) {
BKE_report(reports, RPT_ERROR, "No driver variables in clipboard to paste");
BKE_report(reports, RPT_ERROR, "No driver variables in the internal clipboard to paste");
return false;
}
@ -1257,7 +1257,7 @@ void ANIM_OT_paste_driver_button(wmOperatorType *ot)
/* identifiers */
ot->name = "Paste Driver";
ot->idname = "ANIM_OT_paste_driver_button";
ot->description = "Paste the driver in the clipboard to the highlighted button";
ot->description = "Paste the driver in the internal clipboard to the highlighted button";
/* callbacks */
ot->exec = paste_driver_button_exec;

View File

@ -798,7 +798,7 @@ static int pose_copy_exec(bContext *C, wmOperator *op)
BLI_listbase_clear(&temp_bmain->armatures);
BKE_main_free(temp_bmain);
/* We are all done! */
BKE_report(op->reports, RPT_INFO, "Copied pose to buffer");
BKE_report(op->reports, RPT_INFO, "Copied pose to internal clipboard");
return OPERATOR_FINISHED;
}
@ -807,7 +807,7 @@ void POSE_OT_copy(wmOperatorType *ot)
/* identifiers */
ot->name = "Copy Pose";
ot->idname = "POSE_OT_copy";
ot->description = "Copies the current pose of the selected bones to copy/paste buffer";
ot->description = "Copy the current pose of the selected bones to the internal clipboard";
/* api callbacks */
ot->exec = pose_copy_exec;
@ -846,13 +846,13 @@ static int pose_paste_exec(bContext *C, wmOperator *op)
BLI_path_join(str, sizeof(str), BKE_tempdir_base(), "copybuffer_pose.blend");
if (!BKE_copybuffer_read(tmp_bmain, str, op->reports, FILTER_ID_OB)) {
BKE_report(op->reports, RPT_ERROR, "Copy buffer is empty");
BKE_report(op->reports, RPT_ERROR, "Internal clipboard is empty");
BKE_main_free(tmp_bmain);
return OPERATOR_CANCELLED;
}
/* Make sure data from this file is usable for pose paste. */
if (BLI_listbase_count_at_most(&tmp_bmain->objects, 2) != 1) {
BKE_report(op->reports, RPT_ERROR, "Copy buffer is not from pose mode");
BKE_report(op->reports, RPT_ERROR, "Internal clipboard is not from pose mode");
BKE_main_free(tmp_bmain);
return OPERATOR_CANCELLED;
}
@ -860,7 +860,7 @@ static int pose_paste_exec(bContext *C, wmOperator *op)
Object *object_from = tmp_bmain->objects.first;
bPose *pose_from = object_from->pose;
if (pose_from == NULL) {
BKE_report(op->reports, RPT_ERROR, "Copy buffer has no pose");
BKE_report(op->reports, RPT_ERROR, "Internal clipboard has no pose");
BKE_main_free(tmp_bmain);
return OPERATOR_CANCELLED;
}

View File

@ -79,8 +79,6 @@ typedef struct MoveInteraction {
} MoveInteraction;
#define DIAL_RESOLUTION 32
/* -------------------------------------------------------------------- */
static void move_geom_draw(const wmGizmo *gz,

View File

@ -77,7 +77,7 @@ if(WITH_POTRACE)
endif()
blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
blender_add_lib(bf_editor_gpencil_legacy "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# RNA_prototypes.h
add_dependencies(bf_editor_gpencil bf_rna)
add_dependencies(bf_editor_gpencil_legacy bf_rna)

View File

@ -41,7 +41,7 @@
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "ED_space_api.h"
#include "ED_view3d.h"

View File

@ -39,7 +39,7 @@
#include "UI_view2d.h"
#include "ED_clip.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "ED_view3d.h"

View File

@ -52,7 +52,7 @@
#include "GPU_state.h"
#include "GPU_uniform_buffer.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "ED_space_api.h"
#include "ED_view3d.h"

View File

@ -24,7 +24,7 @@
#include "BKE_report.h"
#include "ED_anim_api.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframes_edit.h"
#include "ED_markers.h"

View File

@ -23,7 +23,7 @@
#include "DEG_depsgraph.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
/* Definition of the most important info from a color */
typedef struct ColorTemplate {

View File

@ -26,7 +26,7 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
/* Definition of the most important info from a color */
typedef struct ColorTemplate {

View File

@ -23,7 +23,7 @@
#include "DEG_depsgraph.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
void ED_gpencil_stroke_init_data(bGPDstroke *gps,
const float *array,

View File

@ -23,7 +23,7 @@
#include "DEG_depsgraph.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
/* Definition of the most important info from a color */
typedef struct ColorTemplate {

View File

@ -41,7 +41,7 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_mesh.h"
#include "ED_object.h"

View File

@ -39,7 +39,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_transform_snap_object_context.h"
#include "gpencil_intern.h"

View File

@ -65,7 +65,7 @@
#include "UI_view2d.h"
#include "ED_clip.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframing.h"
#include "ED_object.h"
#include "ED_view3d.h"

View File

@ -62,7 +62,7 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_object.h"
#include "DEG_depsgraph.h"

View File

@ -66,7 +66,7 @@
#include "UI_view2d.h"
#include "ED_armature.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframing.h"
#include "ED_object.h"
#include "ED_outliner.h"

View File

@ -29,7 +29,7 @@
#include "WM_api.h"
#include "WM_types.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "DEG_depsgraph.h"

View File

@ -38,7 +38,7 @@
#include "BKE_report.h"
#include "BKE_screen.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframing.h"
#include "ED_screen.h"
#include "ED_space_api.h"

View File

@ -47,7 +47,7 @@
#include "RNA_define.h"
#include "RNA_prototypes.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "DEG_depsgraph.h"

View File

@ -31,7 +31,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "DEG_depsgraph.h"

View File

@ -37,7 +37,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_transform_snap_object_context.h"
#include "gpencil_intern.h"

View File

@ -26,7 +26,7 @@
#include "RNA_access.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "gpencil_intern.h"

View File

@ -32,7 +32,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"

View File

@ -52,7 +52,7 @@
#include "UI_view2d.h"
#include "ED_clip.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframing.h"
#include "ED_object.h"
#include "ED_screen.h"

View File

@ -54,7 +54,7 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframing.h"
#include "ED_object.h"
#include "ED_screen.h"

View File

@ -58,7 +58,7 @@
#include "UI_view2d.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframing.h"
#include "ED_screen.h"
#include "ED_view3d.h"

View File

@ -45,7 +45,7 @@
#include "UI_view2d.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_select_utils.h"
#include "ED_view3d.h"

View File

@ -36,7 +36,7 @@
#include "IMB_imbuf_types.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_object.h"
#include "gpencil_intern.h"

View File

@ -22,7 +22,7 @@
#include "BKE_gpencil_legacy.h"
#include "BKE_undo_system.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "WM_api.h"
#include "WM_types.h"

View File

@ -63,7 +63,7 @@
#include "UI_view2d.h"
#include "ED_clip.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_select_utils.h"

View File

@ -26,7 +26,7 @@
#include "UI_interface.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_numinput.h"
#include "ED_screen.h"
#include "ED_space_api.h"

View File

@ -28,7 +28,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "DEG_depsgraph.h"

View File

@ -33,7 +33,7 @@
#include "UI_view2d.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "ED_view3d.h"

View File

@ -38,7 +38,7 @@
#include "UI_view2d.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "ED_view3d.h"

View File

@ -39,7 +39,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "ED_undo.h"

View File

@ -245,8 +245,8 @@ static void UI_OT_copy_as_driver_button(wmOperatorType *ot)
ot->idname = "UI_OT_copy_as_driver_button";
ot->description =
"Create a new driver with this property as input, and copy it to the "
"clipboard. Use Paste Driver to add it to the target property, or Paste "
"Driver Variables to extend an existing driver";
"internal clipboard. Use Paste Driver to add it to the target property, "
"or Paste Driver Variables to extend an existing driver";
/* callbacks */
ot->exec = copy_as_driver_button_exec;

View File

@ -155,10 +155,16 @@ bool UI_but_is_tool(const uiBut *but)
bool UI_but_has_tooltip_label(const uiBut *but)
{
if ((but->drawstr[0] == '\0') && !ui_block_is_popover(but->block)) {
return UI_but_is_tool(but);
/* No tooltip label if the button itself shows a label already. */
if (but->drawstr[0] != '\0') {
return false;
}
return false;
if (UI_but_is_tool(but)) {
return !ui_block_is_popover(but->block);
}
return ELEM(but->type, UI_BTYPE_TAB);
}
int ui_but_icon(const uiBut *but)

View File

@ -742,7 +742,8 @@ static uiTooltipData *ui_tooltip_data_from_tool(bContext *C, uiBut *but, bool is
static uiTooltipData *ui_tooltip_data_from_button_or_extra_icon(bContext *C,
uiBut *but,
uiButExtraOpIcon *extra_icon)
uiButExtraOpIcon *extra_icon,
const bool is_label)
{
uiStringInfo but_label = {BUT_GET_LABEL, nullptr};
uiStringInfo but_tip = {BUT_GET_TIP, nullptr};
@ -763,20 +764,30 @@ static uiTooltipData *ui_tooltip_data_from_button_or_extra_icon(bContext *C,
uiTooltipData *data = MEM_cnew<uiTooltipData>(__func__);
if (extra_icon) {
UI_but_extra_icon_string_info_get(C, extra_icon, &but_label, &but_tip, &op_keymap, nullptr);
if (is_label) {
UI_but_extra_icon_string_info_get(C, extra_icon, &but_label, &enum_label, nullptr);
}
else {
UI_but_extra_icon_string_info_get(C, extra_icon, &but_label, &but_tip, &op_keymap, nullptr);
}
}
else {
UI_but_string_info_get(C,
but,
&but_label,
&but_tip,
&enum_label,
&enum_tip,
&op_keymap,
&prop_keymap,
&rna_struct,
&rna_prop,
nullptr);
if (is_label) {
UI_but_string_info_get(C, but, &but_label, &enum_label, nullptr);
}
else {
UI_but_string_info_get(C,
but,
&but_label,
&but_tip,
&enum_label,
&enum_tip,
&op_keymap,
&prop_keymap,
&rna_struct,
&rna_prop,
nullptr);
}
}
/* Tip Label (only for buttons not already showing the label).
@ -811,6 +822,13 @@ static uiTooltipData *ui_tooltip_data_from_button_or_extra_icon(bContext *C,
field->text = BLI_strdup(TIP_("(Shift-Click/Drag to select multiple)"));
}
}
/* When there is only an enum label (no button label or tip), draw that as header. */
else if (enum_label.strinfo && !(but_label.strinfo && but_label.strinfo[0])) {
uiTooltipField *field = text_field_add(
data, uiTooltipFormat::Style::Header, uiTooltipFormat::ColorID::Normal);
field->text = BLI_strdup(enum_label.strinfo);
}
/* Enum field label & tip. */
if (enum_tip.strinfo) {
uiTooltipField *field = text_field_add(
@ -1346,11 +1364,11 @@ ARegion *UI_tooltip_create_from_button_or_extra_icon(
}
if (data == nullptr) {
data = ui_tooltip_data_from_button_or_extra_icon(C, but, extra_icon);
data = ui_tooltip_data_from_button_or_extra_icon(C, but, extra_icon, is_label);
}
if (data == nullptr) {
data = ui_tooltip_data_from_button_or_extra_icon(C, but, nullptr);
data = ui_tooltip_data_from_button_or_extra_icon(C, but, nullptr, is_label);
}
if (data == nullptr) {

View File

@ -32,7 +32,7 @@
# include "DEG_depsgraph.h"
# include "DEG_depsgraph_query.h"
# include "ED_gpencil.h"
# include "ED_gpencil_legacy.h"
# include "io_gpencil.h"

View File

@ -326,7 +326,7 @@ void WM_OT_usd_export(struct wmOperatorType *ot)
"overwrite_textures",
false,
"Overwrite Textures",
"Allow overwriting existing texture files when exporting textures");
"Overwrite existing files when exporting textures");
RNA_def_boolean(ot->srna,
"relative_paths",
@ -612,7 +612,7 @@ void WM_OT_usd_import(struct wmOperatorType *ot)
RNA_def_boolean(ot->srna, "read_mesh_uvs", true, "UV Coordinates", "Read mesh UV coordinates");
RNA_def_boolean(
ot->srna, "read_mesh_colors", false, "Color Attributes", "Read mesh color attributes");
ot->srna, "read_mesh_colors", true, "Color Attributes", "Read mesh color attributes");
RNA_def_string(ot->srna,
"prim_path_mask",

View File

@ -2069,7 +2069,7 @@ void MASK_OT_copy_splines(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Splines";
ot->description = "Copy selected splines to clipboard";
ot->description = "Copy the selected splines to the internal clipboard";
ot->idname = "MASK_OT_copy_splines";
/* api callbacks */
@ -2113,7 +2113,7 @@ void MASK_OT_paste_splines(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste Splines";
ot->description = "Paste splines from clipboard";
ot->description = "Paste splines from the internal clipboard";
ot->idname = "MASK_OT_paste_splines";
/* api callbacks */

View File

@ -9370,8 +9370,12 @@ enum {
};
static EnumPropertyItem normal_vector_tool_items[] = {
{EDBM_CLNOR_TOOLS_COPY, "COPY", 0, "Copy Normal", "Copy normal to buffer"},
{EDBM_CLNOR_TOOLS_PASTE, "PASTE", 0, "Paste Normal", "Paste normal from buffer"},
{EDBM_CLNOR_TOOLS_COPY, "COPY", 0, "Copy Normal", "Copy normal to the internal clipboard"},
{EDBM_CLNOR_TOOLS_PASTE,
"PASTE",
0,
"Paste Normal",
"Paste normal from the internal clipboard"},
{EDBM_CLNOR_TOOLS_ADD, "ADD", 0, "Add Normal", "Add normal vector with selection"},
{EDBM_CLNOR_TOOLS_MULTIPLY,
"MULTIPLY",
@ -9382,7 +9386,7 @@ static EnumPropertyItem normal_vector_tool_items[] = {
"RESET",
0,
"Reset Normal",
"Reset buffer and/or normal of selected element"},
"Reset the internal clipboard and/or normal of selected element"},
{0, nullptr, 0, nullptr, nullptr},
};

View File

@ -9,7 +9,7 @@ set(INC
../../bmesh
../../depsgraph
../../functions
../../gpencil_modifiers
../../gpencil_modifiers_legacy
../../gpu
../../ikplugin
../../imbuf

View File

@ -100,7 +100,7 @@
#include "ED_armature.h"
#include "ED_curve.h"
#include "ED_curves.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_mball.h"
#include "ED_mesh.h"
#include "ED_node.h"

View File

@ -73,7 +73,7 @@
#include "ED_anim_api.h"
#include "ED_armature.h"
#include "ED_curve.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_image.h"
#include "ED_keyframes_keylist.h"
#include "ED_lattice.h"

View File

@ -41,7 +41,7 @@
#include "DEG_depsgraph_query.h"
#include "ED_armature.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "ED_transform_snap_object_context.h"
#include "ED_undo.h"

View File

@ -21,7 +21,7 @@
#include "object_intern.h"
#include "MOD_gpencil_lineart.h"
#include "MOD_gpencil_legacy_lineart.h"
/* ************************** registration **********************************/

View File

@ -92,7 +92,7 @@
#include "ED_armature.h"
#include "ED_curve.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframing.h"
#include "ED_mesh.h"
#include "ED_object.h"

View File

@ -61,7 +61,7 @@
#include "WM_types.h"
#include "ED_armature.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframing.h"
#include "ED_mesh.h"
#include "ED_object.h"

View File

@ -51,7 +51,7 @@
#include "WM_api.h"
#include "WM_types.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "ED_view3d_offscreen.h"

View File

@ -1829,7 +1829,7 @@ void SCENE_OT_freestyle_lineset_copy(wmOperatorType *ot)
/* identifiers */
ot->name = "Copy Line Set";
ot->idname = "SCENE_OT_freestyle_lineset_copy";
ot->description = "Copy the active line set to a buffer";
ot->description = "Copy the active line set to the internal clipboard";
/* api callbacks */
ot->exec = freestyle_lineset_copy_exec;
@ -1863,7 +1863,7 @@ void SCENE_OT_freestyle_lineset_paste(wmOperatorType *ot)
/* identifiers */
ot->name = "Paste Line Set";
ot->idname = "SCENE_OT_freestyle_lineset_paste";
ot->description = "Paste the buffer content to the active line set";
ot->description = "Paste the internal clipboard content to the active line set";
/* api callbacks */
ot->exec = freestyle_lineset_paste_exec;

View File

@ -41,7 +41,7 @@
#include "ED_anim_api.h"
#include "ED_armature.h"
#include "ED_clip.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "SEQ_channels.h"
#include "SEQ_select.h"

View File

@ -38,7 +38,7 @@
#include "UI_view2d.h"
#include "ED_anim_api.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframes_edit.h"
#include "ED_keyframing.h"
#include "ED_markers.h"

View File

@ -40,7 +40,7 @@
#include "UI_view2d.h"
#include "ED_anim_api.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframes_edit.h"
#include "ED_keyframing.h"
#include "ED_markers.h"
@ -576,7 +576,7 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op)
if (ac.datatype == ANIMCONT_GPENCIL) {
if (ED_gpencil_anim_copybuf_copy(&ac) == false) {
/* check if anything ended up in the buffer */
BKE_report(op->reports, RPT_ERROR, "No keyframes copied to keyframes copy/paste buffer");
BKE_report(op->reports, RPT_ERROR, "No keyframes copied to the internal clipboard");
return OPERATOR_CANCELLED;
}
}
@ -591,7 +591,7 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op)
const bool gpf_ok = ED_gpencil_anim_copybuf_copy(&ac);
if (kf_empty && !gpf_ok) {
BKE_report(op->reports, RPT_ERROR, "No keyframes copied to keyframes copy/paste buffer");
BKE_report(op->reports, RPT_ERROR, "No keyframes copied to the internal clipboard");
return OPERATOR_CANCELLED;
}
}
@ -604,7 +604,7 @@ void ACTION_OT_copy(wmOperatorType *ot)
/* identifiers */
ot->name = "Copy Keyframes";
ot->idname = "ACTION_OT_copy";
ot->description = "Copy selected keyframes to the copy/paste buffer";
ot->description = "Copy selected keyframes to the internal clipboard";
/* api callbacks */
ot->exec = actkeys_copy_exec;
@ -635,7 +635,7 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
/* paste keyframes */
if (ac.datatype == ANIMCONT_GPENCIL) {
if (ED_gpencil_anim_copybuf_paste(&ac, offset_mode) == false) {
BKE_report(op->reports, RPT_ERROR, "No data in buffer to paste");
BKE_report(op->reports, RPT_ERROR, "No data in the internal clipboard to paste");
return OPERATOR_CANCELLED;
}
}
@ -664,7 +664,7 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
case KEYFRAME_PASTE_NOTHING_TO_PASTE:
BKE_report(op->reports, RPT_ERROR, "No data in buffer to paste");
BKE_report(op->reports, RPT_ERROR, "No data in the internal clipboard to paste");
return OPERATOR_CANCELLED;
}
}
@ -698,7 +698,8 @@ void ACTION_OT_paste(wmOperatorType *ot)
ot->name = "Paste Keyframes";
ot->idname = "ACTION_OT_paste";
ot->description =
"Paste keyframes from copy/paste buffer for the selected channels, starting on the current "
"Paste keyframes from the internal clipboard for the selected channels, starting on the "
"current "
"frame";
/* api callbacks */

View File

@ -35,7 +35,7 @@
#include "UI_view2d.h"
#include "ED_anim_api.h"
#include "ED_gpencil.h"
#include "ED_gpencil_legacy.h"
#include "ED_keyframes_edit.h"
#include "ED_keyframes_keylist.h"
#include "ED_markers.h"

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