Merge branch 'master' into refactor-mesh-selection-generic
This commit is contained in:
commit
9ef229ca41
|
@ -35,6 +35,7 @@ set(WITH_IMAGE_OPENEXR OFF CACHE BOOL "" FORCE)
|
|||
set(WITH_IMAGE_OPENJPEG OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_TIFF OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_WEBP OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_INPUT_IME OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IO_STL OFF CACHE BOOL "" FORCE)
|
||||
|
|
|
@ -114,13 +114,12 @@ float noise_musgrave_hybrid_multi_fractal_1d(
|
|||
{
|
||||
float p = co;
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = safe_snoise(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0;
|
||||
float value = 0.0;
|
||||
float weight = 1.0;
|
||||
|
||||
for (int i = 1; (weight > 0.001) && (i < (int)octaves); i++) {
|
||||
for (int i = 0; (weight > 0.001) && (i < (int)octaves); i++) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
|
@ -133,8 +132,12 @@ float noise_musgrave_hybrid_multi_fractal_1d(
|
|||
}
|
||||
|
||||
float rmd = octaves - floor(octaves);
|
||||
if (rmd != 0.0) {
|
||||
value += rmd * ((safe_snoise(p) + offset) * pwr);
|
||||
if ((rmd != 0.0) && (weight > 0.001)) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
float signal = (safe_snoise(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -279,13 +282,12 @@ float noise_musgrave_hybrid_multi_fractal_2d(
|
|||
{
|
||||
vector2 p = co;
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = safe_snoise(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0;
|
||||
float value = 0.0;
|
||||
float weight = 1.0;
|
||||
|
||||
for (int i = 1; (weight > 0.001) && (i < (int)octaves); i++) {
|
||||
for (int i = 0; (weight > 0.001) && (i < (int)octaves); i++) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
|
@ -298,8 +300,12 @@ float noise_musgrave_hybrid_multi_fractal_2d(
|
|||
}
|
||||
|
||||
float rmd = octaves - floor(octaves);
|
||||
if (rmd != 0.0) {
|
||||
value += rmd * ((safe_snoise(p) + offset) * pwr);
|
||||
if ((rmd != 0.0) && (weight > 0.001)) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
float signal = (safe_snoise(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -444,13 +450,12 @@ float noise_musgrave_hybrid_multi_fractal_3d(
|
|||
{
|
||||
vector3 p = co;
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = safe_snoise(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0;
|
||||
float value = 0.0;
|
||||
float weight = 1.0;
|
||||
|
||||
for (int i = 1; (weight > 0.001) && (i < (int)octaves); i++) {
|
||||
for (int i = 0; (weight > 0.001) && (i < (int)octaves); i++) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
|
@ -463,8 +468,12 @@ float noise_musgrave_hybrid_multi_fractal_3d(
|
|||
}
|
||||
|
||||
float rmd = octaves - floor(octaves);
|
||||
if (rmd != 0.0) {
|
||||
value += rmd * ((safe_snoise(p) + offset) * pwr);
|
||||
if ((rmd != 0.0) && (weight > 0.001)) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
float signal = (safe_snoise(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -609,13 +618,12 @@ float noise_musgrave_hybrid_multi_fractal_4d(
|
|||
{
|
||||
vector4 p = co;
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = safe_snoise(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0;
|
||||
float value = 0.0;
|
||||
float weight = 1.0;
|
||||
|
||||
for (int i = 1; (weight > 0.001) && (i < (int)octaves); i++) {
|
||||
for (int i = 0; (weight > 0.001) && (i < (int)octaves); i++) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
|
@ -628,8 +636,12 @@ float noise_musgrave_hybrid_multi_fractal_4d(
|
|||
}
|
||||
|
||||
float rmd = octaves - floor(octaves);
|
||||
if (rmd != 0.0) {
|
||||
value += rmd * ((safe_snoise(p) + offset) * pwr);
|
||||
if ((rmd != 0.0) && (weight > 0.001)) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
float signal = (safe_snoise(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
|
@ -119,13 +119,12 @@ ccl_device_noinline_cpu float noise_musgrave_hybrid_multi_fractal_1d(
|
|||
{
|
||||
float p = co;
|
||||
float pwHL = powf(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = snoise_1d(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0f;
|
||||
float value = 0.0f;
|
||||
float weight = 1.0f;
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < float_to_int(octaves)); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < float_to_int(octaves)); i++) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
|
@ -138,8 +137,12 @@ ccl_device_noinline_cpu float noise_musgrave_hybrid_multi_fractal_1d(
|
|||
}
|
||||
|
||||
float rmd = octaves - floorf(octaves);
|
||||
if (rmd != 0.0f) {
|
||||
value += rmd * ((snoise_1d(p) + offset) * pwr);
|
||||
if ((rmd != 0.0f) && (weight > 0.001f)) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
float signal = (snoise_1d(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -290,13 +293,12 @@ ccl_device_noinline_cpu float noise_musgrave_hybrid_multi_fractal_2d(
|
|||
{
|
||||
float2 p = co;
|
||||
float pwHL = powf(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = snoise_2d(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0f;
|
||||
float value = 0.0f;
|
||||
float weight = 1.0f;
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < float_to_int(octaves)); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < float_to_int(octaves)); i++) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
|
@ -309,8 +311,12 @@ ccl_device_noinline_cpu float noise_musgrave_hybrid_multi_fractal_2d(
|
|||
}
|
||||
|
||||
float rmd = octaves - floorf(octaves);
|
||||
if (rmd != 0.0f) {
|
||||
value += rmd * ((snoise_2d(p) + offset) * pwr);
|
||||
if ((rmd != 0.0f) && (weight > 0.001f)) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
float signal = (snoise_2d(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -461,13 +467,13 @@ ccl_device_noinline_cpu float noise_musgrave_hybrid_multi_fractal_3d(
|
|||
{
|
||||
float3 p = co;
|
||||
float pwHL = powf(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = snoise_3d(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0f;
|
||||
float value = 0.0f;
|
||||
float weight = 1.0f;
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < float_to_int(octaves)); i++) {
|
||||
|
||||
for (int i = 0; (weight > 0.001f) && (i < float_to_int(octaves)); i++) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
|
@ -480,8 +486,12 @@ ccl_device_noinline_cpu float noise_musgrave_hybrid_multi_fractal_3d(
|
|||
}
|
||||
|
||||
float rmd = octaves - floorf(octaves);
|
||||
if (rmd != 0.0f) {
|
||||
value += rmd * ((snoise_3d(p) + offset) * pwr);
|
||||
if ((rmd != 0.0f) && (weight > 0.001f)){
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
float signal = (snoise_3d(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -632,13 +642,12 @@ ccl_device_noinline_cpu float noise_musgrave_hybrid_multi_fractal_4d(
|
|||
{
|
||||
float4 p = co;
|
||||
float pwHL = powf(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = snoise_4d(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0f;
|
||||
float value = 0.0f;
|
||||
float weight = 1.0f;
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < float_to_int(octaves)); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < float_to_int(octaves)); i++) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
|
@ -651,8 +660,12 @@ ccl_device_noinline_cpu float noise_musgrave_hybrid_multi_fractal_4d(
|
|||
}
|
||||
|
||||
float rmd = octaves - floorf(octaves);
|
||||
if (rmd != 0.0f) {
|
||||
value += rmd * ((snoise_4d(p) + offset) * pwr);
|
||||
if ((rmd != 0.0f) && (weight > 0.001f)) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
float signal = (snoise_4d(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
|
@ -378,7 +378,7 @@ ccl_device_inline avxi hash_avxi4(avxi kx, avxi ky, avxi kz, avxi kw)
|
|||
|
||||
/* ***** Hash Prospector Hash Functions *****
|
||||
*
|
||||
* These are based on the high-quality 32-bit hash/mixings functions from
|
||||
* These are based on the high-quality 32-bit hash/mixing functions from
|
||||
* https://github.com/skeeto/hash-prospector
|
||||
*/
|
||||
|
||||
|
|
|
@ -2727,8 +2727,6 @@ static void output_handle_scale(void *data, struct wl_output * /*wl_output*/, co
|
|||
for (GHOST_IWindow *iwin : window_manager->getWindows()) {
|
||||
GHOST_WindowWayland *win = static_cast<GHOST_WindowWayland *>(iwin);
|
||||
win->outputs_changed_update_scale();
|
||||
/* TODO(@campbellbarton): support refreshing the UI when the DPI changes.
|
||||
* There are glitches when resizing the monitor which would be nice to solve. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -534,16 +534,9 @@ GHOST_TSuccess GHOST_SystemWin32::exit()
|
|||
return GHOST_System::exit();
|
||||
}
|
||||
|
||||
GHOST_TKey GHOST_SystemWin32::hardKey(RAWINPUT const &raw,
|
||||
bool *r_keyDown,
|
||||
bool *r_is_repeated_modifier)
|
||||
GHOST_TKey GHOST_SystemWin32::hardKey(RAWINPUT const &raw, bool *r_keyDown)
|
||||
{
|
||||
bool is_repeated_modifier = false;
|
||||
|
||||
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
|
||||
GHOST_TKey key = GHOST_kKeyUnknown;
|
||||
GHOST_ModifierKeys modifiers;
|
||||
system->retrieveModifierKeys(modifiers);
|
||||
|
||||
// RI_KEY_BREAK doesn't work for sticky keys release, so we also
|
||||
// check for the up message
|
||||
|
@ -553,56 +546,6 @@ GHOST_TKey GHOST_SystemWin32::hardKey(RAWINPUT const &raw,
|
|||
key = this->convertKey(raw.data.keyboard.VKey,
|
||||
raw.data.keyboard.MakeCode,
|
||||
(raw.data.keyboard.Flags & (RI_KEY_E1 | RI_KEY_E0)));
|
||||
|
||||
// extra handling of modifier keys: don't send repeats out from GHOST
|
||||
if (key >= GHOST_kKeyLeftShift && key <= GHOST_kKeyRightAlt) {
|
||||
bool changed = false;
|
||||
GHOST_TModifierKey modifier;
|
||||
switch (key) {
|
||||
case GHOST_kKeyLeftShift: {
|
||||
changed = (modifiers.get(GHOST_kModifierKeyLeftShift) != *r_keyDown);
|
||||
modifier = GHOST_kModifierKeyLeftShift;
|
||||
break;
|
||||
}
|
||||
case GHOST_kKeyRightShift: {
|
||||
changed = (modifiers.get(GHOST_kModifierKeyRightShift) != *r_keyDown);
|
||||
modifier = GHOST_kModifierKeyRightShift;
|
||||
break;
|
||||
}
|
||||
case GHOST_kKeyLeftControl: {
|
||||
changed = (modifiers.get(GHOST_kModifierKeyLeftControl) != *r_keyDown);
|
||||
modifier = GHOST_kModifierKeyLeftControl;
|
||||
break;
|
||||
}
|
||||
case GHOST_kKeyRightControl: {
|
||||
changed = (modifiers.get(GHOST_kModifierKeyRightControl) != *r_keyDown);
|
||||
modifier = GHOST_kModifierKeyRightControl;
|
||||
break;
|
||||
}
|
||||
case GHOST_kKeyLeftAlt: {
|
||||
changed = (modifiers.get(GHOST_kModifierKeyLeftAlt) != *r_keyDown);
|
||||
modifier = GHOST_kModifierKeyLeftAlt;
|
||||
break;
|
||||
}
|
||||
case GHOST_kKeyRightAlt: {
|
||||
changed = (modifiers.get(GHOST_kModifierKeyRightAlt) != *r_keyDown);
|
||||
modifier = GHOST_kModifierKeyRightAlt;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
modifiers.set(modifier, *r_keyDown);
|
||||
system->storeModifierKeys(modifiers);
|
||||
}
|
||||
else {
|
||||
is_repeated_modifier = true;
|
||||
}
|
||||
}
|
||||
|
||||
*r_is_repeated_modifier = is_repeated_modifier;
|
||||
return key;
|
||||
}
|
||||
|
||||
|
@ -1101,7 +1044,7 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
|
|||
if (window->getCursorGrabModeIsWarp()) {
|
||||
/* WORKAROUND:
|
||||
* Sometimes Windows ignores `SetCursorPos()` or `SendInput()` calls or the mouse event is
|
||||
* outdate. Identify these cases by checking if the cursor is not yet within bounds. */
|
||||
* outdated. Identify these cases by checking if the cursor is not yet within bounds. */
|
||||
static bool is_warping_x = false;
|
||||
static bool is_warping_y = false;
|
||||
|
||||
|
@ -1182,34 +1125,33 @@ void GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wPar
|
|||
|
||||
GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RAWINPUT const &raw)
|
||||
{
|
||||
const char vk = raw.data.keyboard.VKey;
|
||||
bool keyDown = false;
|
||||
bool is_repeated_modifier = false;
|
||||
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
|
||||
GHOST_TKey key = system->hardKey(raw, &keyDown, &is_repeated_modifier);
|
||||
GHOST_TKey key = system->hardKey(raw, &keyDown);
|
||||
GHOST_EventKey *event;
|
||||
|
||||
bool is_repeat = false;
|
||||
bool is_repeated_modifier = false;
|
||||
if (keyDown) {
|
||||
if (system->m_keycode_last_repeat_key == vk) {
|
||||
is_repeat = true;
|
||||
is_repeated_modifier = (key >= GHOST_kKeyLeftShift && key <= GHOST_kKeyRightAlt);
|
||||
}
|
||||
system->m_keycode_last_repeat_key = vk;
|
||||
}
|
||||
else {
|
||||
if (system->m_keycode_last_repeat_key == vk) {
|
||||
system->m_keycode_last_repeat_key = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* We used to check `if (key != GHOST_kKeyUnknown)`, but since the message
|
||||
* values `WM_SYSKEYUP`, `WM_KEYUP` and `WM_CHAR` are ignored, we capture
|
||||
* those events here as well. */
|
||||
if (!is_repeated_modifier) {
|
||||
char vk = raw.data.keyboard.VKey;
|
||||
char utf8_char[6] = {0};
|
||||
char ascii = 0;
|
||||
bool is_repeat = false;
|
||||
|
||||
/* Unlike on Linux, not all keys can send repeat events. E.g. modifier keys don't. */
|
||||
if (keyDown) {
|
||||
if (system->m_keycode_last_repeat_key == vk) {
|
||||
is_repeat = true;
|
||||
}
|
||||
system->m_keycode_last_repeat_key = vk;
|
||||
}
|
||||
else {
|
||||
if (system->m_keycode_last_repeat_key == vk) {
|
||||
system->m_keycode_last_repeat_key = 0;
|
||||
}
|
||||
}
|
||||
|
||||
wchar_t utf16[3] = {0};
|
||||
BYTE state[256] = {0};
|
||||
int r;
|
||||
|
@ -1907,9 +1849,6 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||
* If the windows use different input queues, the message is sent asynchronously,
|
||||
* so the window is activated immediately. */
|
||||
{
|
||||
GHOST_ModifierKeys modifiers;
|
||||
modifiers.clear();
|
||||
system->storeModifierKeys(modifiers);
|
||||
system->m_wheelDeltaAccum = 0;
|
||||
system->m_keycode_last_repeat_key = 0;
|
||||
event = processWindowEvent(LOWORD(wParam) ? GHOST_kEventWindowActivate :
|
||||
|
|
|
@ -299,7 +299,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
|||
* \param vk: Pointer to virtual key.
|
||||
* \return The GHOST key (GHOST_kKeyUnknown if no match).
|
||||
*/
|
||||
GHOST_TKey hardKey(RAWINPUT const &raw, bool *r_keyDown, bool *r_is_repeated_modifier);
|
||||
GHOST_TKey hardKey(RAWINPUT const &raw, bool *r_keyDown);
|
||||
|
||||
/**
|
||||
* Creates mouse button event.
|
||||
|
@ -416,19 +416,6 @@ class GHOST_SystemWin32 : public GHOST_System {
|
|||
*/
|
||||
void processTrackpad();
|
||||
|
||||
/**
|
||||
* Returns the local state of the modifier keys (from the message queue).
|
||||
* \param keys: The state of the keys.
|
||||
*/
|
||||
inline void retrieveModifierKeys(GHOST_ModifierKeys &keys) const;
|
||||
|
||||
/**
|
||||
* Stores the state of the modifier keys locally.
|
||||
* For internal use only!
|
||||
* param keys The new state of the modifier keys.
|
||||
*/
|
||||
inline void storeModifierKeys(const GHOST_ModifierKeys &keys);
|
||||
|
||||
/**
|
||||
* Check current key layout for AltGr
|
||||
*/
|
||||
|
@ -446,8 +433,6 @@ class GHOST_SystemWin32 : public GHOST_System {
|
|||
*/
|
||||
int setConsoleWindowState(GHOST_TConsoleWindowState action);
|
||||
|
||||
/** The current state of the modifier keys. */
|
||||
GHOST_ModifierKeys m_modifierKeys;
|
||||
/** The virtual-key code (VKey) of the last press event. Used to detect repeat events. */
|
||||
unsigned short m_keycode_last_repeat_key;
|
||||
/** State variable set at initialization. */
|
||||
|
@ -472,16 +457,6 @@ class GHOST_SystemWin32 : public GHOST_System {
|
|||
int m_wheelDeltaAccum;
|
||||
};
|
||||
|
||||
inline void GHOST_SystemWin32::retrieveModifierKeys(GHOST_ModifierKeys &keys) const
|
||||
{
|
||||
keys = m_modifierKeys;
|
||||
}
|
||||
|
||||
inline void GHOST_SystemWin32::storeModifierKeys(const GHOST_ModifierKeys &keys)
|
||||
{
|
||||
m_modifierKeys = keys;
|
||||
}
|
||||
|
||||
inline void GHOST_SystemWin32::handleKeyboardChange(void)
|
||||
{
|
||||
m_keylayout = GetKeyboardLayout(0); // get keylayout for current thread
|
||||
|
|
|
@ -935,6 +935,9 @@ GHOST_TSuccess GHOST_WindowWayland::notify_size()
|
|||
* Functionality only used for the WAYLAND implementation.
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Return true when the windows scale or DPI changes.
|
||||
*/
|
||||
bool GHOST_WindowWayland::outputs_changed_update_scale()
|
||||
{
|
||||
uint32_t dpi_next;
|
||||
|
@ -963,6 +966,12 @@ bool GHOST_WindowWayland::outputs_changed_update_scale()
|
|||
* use a multiplier for the default DPI as workaround. */
|
||||
win->dpi = dpi_next;
|
||||
changed = true;
|
||||
|
||||
/* As this is a low-level function, we might want adding this event to be optional,
|
||||
* always add the event unless it causes issues. */
|
||||
GHOST_System *system = (GHOST_System *)GHOST_ISystem::getSystem();
|
||||
system->pushEvent(
|
||||
new GHOST_Event(system->getMilliSeconds(), GHOST_kEventWindowDPIHintChanged, this));
|
||||
}
|
||||
|
||||
return changed;
|
||||
|
|
|
@ -36,8 +36,8 @@ def get_random_transform(transform_params, entropy):
|
|||
angle = 0
|
||||
|
||||
if scale:
|
||||
scale_u *= scale[0]
|
||||
scale_v *= scale[1]
|
||||
scale_u = scale_u * (2 * scale[0] - 2.0) + 2.0 - scale[0]
|
||||
scale_v = scale_v * (2 * scale[1] - 2.0) + 2.0 - scale[1]
|
||||
else:
|
||||
scale_u = 1
|
||||
scale_v = 1
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include FT_CACHE_H /* FreeType Cache. */
|
||||
#include FT_GLYPH_H
|
||||
#include FT_MULTIPLE_MASTERS_H /* Variable font support. */
|
||||
#include FT_TRUETYPE_IDS_H /* Codepoint coverage constants. */
|
||||
#include FT_TRUETYPE_IDS_H /* Code-point coverage constants. */
|
||||
#include FT_TRUETYPE_TABLES_H /* For TT_OS2 */
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
|
|
@ -572,8 +572,8 @@ struct Insertion {
|
|||
* Compute the insertion of a control point and handles in a Bezier segment without changing its
|
||||
* shape.
|
||||
* \param parameter: Factor in from 0 to 1 defining the insertion point within the segment.
|
||||
* \return Inserted point paramaters including position, and both new and updated handles for
|
||||
* neighbouring control points.
|
||||
* \return Inserted point parameters including position, and both new and updated handles for
|
||||
* neighboring control points.
|
||||
*
|
||||
* <pre>
|
||||
* handle_prev handle_next
|
||||
|
|
|
@ -417,7 +417,7 @@ void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int typ
|
|||
*/
|
||||
void *CustomData_bmesh_get_layer_n(const struct CustomData *data, void *block, int n);
|
||||
|
||||
bool CustomData_set_layer_name(const struct CustomData *data, int type, int n, const char *name);
|
||||
bool CustomData_set_layer_name(struct CustomData *data, int type, int n, const char *name);
|
||||
const char *CustomData_get_layer_name(const struct CustomData *data, int type, int n);
|
||||
|
||||
/**
|
||||
|
@ -450,6 +450,12 @@ int CustomData_get_stencil_layer(const struct CustomData *data, int type);
|
|||
*/
|
||||
const char *CustomData_get_active_layer_name(const struct CustomData *data, int type);
|
||||
|
||||
/**
|
||||
* Returns name of the default layer of the given type or NULL
|
||||
* if no such active layer is defined.
|
||||
*/
|
||||
const char *CustomData_get_render_layer_name(const struct CustomData *data, int type);
|
||||
|
||||
/**
|
||||
* Copies the data from source to the data element at index in the first layer of type
|
||||
* no effect if there is no layer of type.
|
||||
|
|
|
@ -60,10 +60,10 @@ struct bContext;
|
|||
struct bToolRef;
|
||||
struct tPaletteColorHSV;
|
||||
|
||||
extern const char PAINT_CURSOR_SCULPT[3];
|
||||
extern const char PAINT_CURSOR_VERTEX_PAINT[3];
|
||||
extern const char PAINT_CURSOR_WEIGHT_PAINT[3];
|
||||
extern const char PAINT_CURSOR_TEXTURE_PAINT[3];
|
||||
extern const uchar PAINT_CURSOR_SCULPT[3];
|
||||
extern const uchar PAINT_CURSOR_VERTEX_PAINT[3];
|
||||
extern const uchar PAINT_CURSOR_WEIGHT_PAINT[3];
|
||||
extern const uchar PAINT_CURSOR_TEXTURE_PAINT[3];
|
||||
|
||||
typedef enum ePaintMode {
|
||||
PAINT_MODE_SCULPT = 0,
|
||||
|
@ -158,7 +158,7 @@ struct PaintCurve *BKE_paint_curve_add(struct Main *bmain, const char *name);
|
|||
* Call when entering each respective paint mode.
|
||||
*/
|
||||
bool BKE_paint_ensure(struct ToolSettings *ts, struct Paint **r_paint);
|
||||
void BKE_paint_init(struct Main *bmain, struct Scene *sce, ePaintMode mode, const char col[3]);
|
||||
void BKE_paint_init(struct Main *bmain, struct Scene *sce, ePaintMode mode, const uchar col[3]);
|
||||
void BKE_paint_free(struct Paint *p);
|
||||
/**
|
||||
* Called when copying scene settings, so even if 'src' and 'tar' are the same still do a
|
||||
|
|
|
@ -134,7 +134,7 @@ void *BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *s
|
|||
|
||||
void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle);
|
||||
|
||||
void BKE_sound_mute_scene_sound(void *handle, char mute);
|
||||
void BKE_sound_mute_scene_sound(void *handle, bool mute);
|
||||
|
||||
void BKE_sound_move_scene_sound(const struct Scene *scene,
|
||||
void *handle,
|
||||
|
|
|
@ -2633,6 +2633,12 @@ const char *CustomData_get_active_layer_name(const CustomData *data, const int t
|
|||
return layer_index < 0 ? nullptr : data->layers[layer_index].name;
|
||||
}
|
||||
|
||||
const char *CustomData_get_render_layer_name(const CustomData *data, const int type)
|
||||
{
|
||||
const int layer_index = CustomData_get_render_layer_index(data, type);
|
||||
return layer_index < 0 ? nullptr : data->layers[layer_index].name;
|
||||
}
|
||||
|
||||
void CustomData_set_layer_active(CustomData *data, const int type, const int n)
|
||||
{
|
||||
for (int i = 0; i < data->totlayer; i++) {
|
||||
|
@ -3543,10 +3549,7 @@ int CustomData_get_offset_named(const CustomData *data, int type, const char *na
|
|||
return data->layers[layer_index].offset;
|
||||
}
|
||||
|
||||
bool CustomData_set_layer_name(const CustomData *data,
|
||||
const int type,
|
||||
const int n,
|
||||
const char *name)
|
||||
bool CustomData_set_layer_name(CustomData *data, const int type, const int n, const char *name)
|
||||
{
|
||||
/* get the layer index of the first layer of type */
|
||||
const int layer_index = CustomData_get_layer_index_n(data, type, n);
|
||||
|
|
|
@ -55,6 +55,7 @@ TEST(lib_id_remapper, unassigned)
|
|||
{
|
||||
ID id1;
|
||||
ID *idp = &id1;
|
||||
BLI_strncpy(id1.name, "OB2", sizeof(id1.name));
|
||||
|
||||
IDRemapper *remapper = BKE_id_remapper_create();
|
||||
BKE_id_remapper_add(remapper, &id1, nullptr);
|
||||
|
|
|
@ -216,10 +216,10 @@ IDTypeInfo IDType_ID_PC = {
|
|||
/* lib_override_apply_post */ nullptr,
|
||||
};
|
||||
|
||||
const char PAINT_CURSOR_SCULPT[3] = {255, 100, 100};
|
||||
const char PAINT_CURSOR_VERTEX_PAINT[3] = {255, 255, 255};
|
||||
const char PAINT_CURSOR_WEIGHT_PAINT[3] = {200, 200, 255};
|
||||
const char PAINT_CURSOR_TEXTURE_PAINT[3] = {255, 255, 255};
|
||||
const uchar PAINT_CURSOR_SCULPT[3] = {255, 100, 100};
|
||||
const uchar PAINT_CURSOR_VERTEX_PAINT[3] = {255, 255, 255};
|
||||
const uchar PAINT_CURSOR_WEIGHT_PAINT[3] = {200, 200, 255};
|
||||
const uchar PAINT_CURSOR_TEXTURE_PAINT[3] = {255, 255, 255};
|
||||
|
||||
static ePaintOverlayControlFlags overlay_flags = (ePaintOverlayControlFlags)0;
|
||||
|
||||
|
@ -1128,7 +1128,7 @@ bool BKE_paint_ensure(ToolSettings *ts, Paint **r_paint)
|
|||
return false;
|
||||
}
|
||||
|
||||
void BKE_paint_init(Main *bmain, Scene *sce, ePaintMode mode, const char col[3])
|
||||
void BKE_paint_init(Main *bmain, Scene *sce, ePaintMode mode, const uchar col[3])
|
||||
{
|
||||
UnifiedPaintSettings *ups = &sce->toolsettings->unified_paint_settings;
|
||||
Paint *paint = BKE_paint_get_active_from_paintmode(sce, mode);
|
||||
|
@ -1149,7 +1149,7 @@ void BKE_paint_init(Main *bmain, Scene *sce, ePaintMode mode, const char col[3])
|
|||
}
|
||||
}
|
||||
|
||||
memcpy(paint->paint_cursor_col, col, 3);
|
||||
copy_v3_v3_uchar(paint->paint_cursor_col, col);
|
||||
paint->paint_cursor_col[3] = 128;
|
||||
ups->last_stroke_valid = false;
|
||||
zero_v3(ups->average_stroke_accum);
|
||||
|
|
|
@ -403,7 +403,7 @@ void do_kink(ParticleKey *state,
|
|||
float obmat[4][4],
|
||||
int smooth_start)
|
||||
{
|
||||
float kink[3] = {1.0f, 0.0f, 0.0f}, par_vec[3], q1[4] = {1.0f, 0.0f, 0.0f, 0.0f};
|
||||
float kink[3] = {1.0f, 0.0f, 0.0f}, par_vec[3];
|
||||
float t, dt = 1.0f, result[3];
|
||||
|
||||
if (ELEM(type, PART_KINK_NO, PART_KINK_SPIRAL)) {
|
||||
|
@ -453,6 +453,7 @@ void do_kink(ParticleKey *state,
|
|||
switch (type) {
|
||||
case PART_KINK_CURL: {
|
||||
float curl_offset[3];
|
||||
float q1[4] = {1.0f, 0.0f, 0.0f, 0.0f};
|
||||
|
||||
/* rotate kink vector around strand tangent */
|
||||
mul_v3_v3fl(curl_offset, kink, amplitude);
|
||||
|
|
|
@ -756,7 +756,7 @@ void BKE_sound_remove_scene_sound(Scene *scene, void *handle)
|
|||
AUD_Sequence_remove(scene->sound_scene, handle);
|
||||
}
|
||||
|
||||
void BKE_sound_mute_scene_sound(void *handle, char mute)
|
||||
void BKE_sound_mute_scene_sound(void *handle, bool mute)
|
||||
{
|
||||
AUD_SequenceEntry_setMuted(handle, mute);
|
||||
}
|
||||
|
@ -1346,7 +1346,7 @@ void *BKE_sound_add_scene_sound_defaults(Scene *UNUSED(scene), Sequence *UNUSED(
|
|||
void BKE_sound_remove_scene_sound(Scene *UNUSED(scene), void *UNUSED(handle))
|
||||
{
|
||||
}
|
||||
void BKE_sound_mute_scene_sound(void *UNUSED(handle), char UNUSED(mute))
|
||||
void BKE_sound_mute_scene_sound(void *UNUSED(handle), bool UNUSED(mute))
|
||||
{
|
||||
}
|
||||
void BKE_sound_move_scene_sound(const Scene *UNUSED(scene),
|
||||
|
|
|
@ -81,7 +81,6 @@ static void detect_retrieve_libmv_features(MovieTracking *tracking,
|
|||
|
||||
a = libmv_countFeatures(features);
|
||||
while (a--) {
|
||||
MovieTrackingTrack *track;
|
||||
double x, y, size, score;
|
||||
bool ok = true;
|
||||
float xu, yu;
|
||||
|
@ -99,7 +98,8 @@ static void detect_retrieve_libmv_features(MovieTracking *tracking,
|
|||
}
|
||||
|
||||
if (ok) {
|
||||
track = BKE_tracking_track_add(tracking, tracksbase, xu, yu, framenr, width, height);
|
||||
MovieTrackingTrack *track = BKE_tracking_track_add(
|
||||
tracking, tracksbase, xu, yu, framenr, width, height);
|
||||
track->flag |= SELECT;
|
||||
track->pat_flag |= SELECT;
|
||||
track->search_flag |= SELECT;
|
||||
|
|
|
@ -808,15 +808,14 @@ float musgrave_hybrid_multi_fractal(const float co,
|
|||
{
|
||||
float p = co;
|
||||
const float pwHL = std::pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = perlin_signed(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0f;
|
||||
float value = 0.0f;
|
||||
float weight = 1.0f;
|
||||
|
||||
const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < (int)octaves); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < (int)octaves); i++) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
|
@ -829,8 +828,12 @@ float musgrave_hybrid_multi_fractal(const float co,
|
|||
}
|
||||
|
||||
const float rmd = octaves - floorf(octaves);
|
||||
if (rmd != 0.0f) {
|
||||
value += rmd * ((perlin_signed(p) + offset) * pwr);
|
||||
if ((rmd != 0.0f) && (weight > 0.001f)) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
float signal = (perlin_signed(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -960,15 +963,14 @@ float musgrave_hybrid_multi_fractal(const float2 co,
|
|||
{
|
||||
float2 p = co;
|
||||
const float pwHL = std::pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = perlin_signed(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0f;
|
||||
float value = 0.0f;
|
||||
float weight = 1.0f;
|
||||
|
||||
const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < (int)octaves); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < (int)octaves); i++) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
|
@ -981,8 +983,12 @@ float musgrave_hybrid_multi_fractal(const float2 co,
|
|||
}
|
||||
|
||||
const float rmd = octaves - floorf(octaves);
|
||||
if (rmd != 0.0f) {
|
||||
value += rmd * ((perlin_signed(p) + offset) * pwr);
|
||||
if ((rmd != 0.0f) && (weight > 0.001f)) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
float signal = (perlin_signed(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -1114,15 +1120,14 @@ float musgrave_hybrid_multi_fractal(const float3 co,
|
|||
{
|
||||
float3 p = co;
|
||||
const float pwHL = std::pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = perlin_signed(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0f;
|
||||
float value = 0.0f;
|
||||
float weight = 1.0f;
|
||||
|
||||
const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < (int)octaves); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < (int)octaves); i++) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
|
@ -1135,8 +1140,12 @@ float musgrave_hybrid_multi_fractal(const float3 co,
|
|||
}
|
||||
|
||||
const float rmd = octaves - floorf(octaves);
|
||||
if (rmd != 0.0f) {
|
||||
value += rmd * ((perlin_signed(p) + offset) * pwr);
|
||||
if ((rmd != 0.0f) && (weight > 0.001f)) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
float signal = (perlin_signed(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -1268,15 +1277,14 @@ float musgrave_hybrid_multi_fractal(const float4 co,
|
|||
{
|
||||
float4 p = co;
|
||||
const float pwHL = std::pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = perlin_signed(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0f;
|
||||
float value = 0.0f;
|
||||
float weight = 1.0f;
|
||||
|
||||
const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < (int)octaves); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < (int)octaves); i++) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
|
@ -1289,8 +1297,12 @@ float musgrave_hybrid_multi_fractal(const float4 co,
|
|||
}
|
||||
|
||||
const float rmd = octaves - floorf(octaves);
|
||||
if (rmd != 0.0f) {
|
||||
value += rmd * ((perlin_signed(p) + offset) * pwr);
|
||||
if ((rmd != 0.0f) && (weight > 0.001f)) {
|
||||
if (weight > 1.0f) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
float signal = (perlin_signed(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
|
@ -786,9 +786,9 @@ int BLI_str_utf8_offset_to_column(const char *str, int offset)
|
|||
|
||||
int BLI_str_utf8_offset_from_column(const char *str, int column)
|
||||
{
|
||||
int offset = 0, pos = 0, col;
|
||||
int offset = 0, pos = 0;
|
||||
while (*(str + offset) && pos < column) {
|
||||
col = BLI_str_utf8_char_width_safe(str + offset);
|
||||
const int col = BLI_str_utf8_char_width_safe(str + offset);
|
||||
if (pos + col > column) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ set(SRC
|
|||
intern/bmesh_query.c
|
||||
intern/bmesh_query.h
|
||||
intern/bmesh_query_inline.h
|
||||
intern/bmesh_query_uv.c
|
||||
intern/bmesh_query_uv.cc
|
||||
intern/bmesh_query_uv.h
|
||||
intern/bmesh_structure.c
|
||||
intern/bmesh_structure.h
|
||||
|
|
|
@ -86,7 +86,6 @@ void BMO_mesh_delete_oflag_tagged(BMesh *bm, const short oflag, const char htype
|
|||
void BMO_mesh_delete_oflag_context(BMesh *bm, const short oflag, const int type)
|
||||
{
|
||||
BMEdge *e;
|
||||
BMFace *f;
|
||||
|
||||
BMIter eiter;
|
||||
BMIter fiter;
|
||||
|
@ -128,6 +127,7 @@ void BMO_mesh_delete_oflag_context(BMesh *bm, const short oflag, const int type)
|
|||
case DEL_FACES:
|
||||
case DEL_FACES_KEEP_BOUNDARY: {
|
||||
/* go through and mark all edges and all verts of all faces for delete */
|
||||
BMFace *f;
|
||||
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
|
||||
if (BMO_face_flag_test(bm, f, oflag)) {
|
||||
BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
|
||||
|
@ -257,8 +257,6 @@ void BM_mesh_delete_hflag_tagged(BMesh *bm, const char hflag, const char htype)
|
|||
|
||||
void BM_mesh_delete_hflag_context(BMesh *bm, const char hflag, const int type)
|
||||
{
|
||||
BMEdge *e;
|
||||
BMFace *f;
|
||||
|
||||
BMIter eiter;
|
||||
BMIter fiter;
|
||||
|
@ -271,6 +269,7 @@ void BM_mesh_delete_hflag_context(BMesh *bm, const char hflag, const int type)
|
|||
}
|
||||
case DEL_EDGES: {
|
||||
/* flush down to vert */
|
||||
BMEdge *e;
|
||||
BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
|
||||
if (BM_elem_flag_test(e, hflag)) {
|
||||
BM_elem_flag_enable(e->v1, hflag);
|
||||
|
@ -299,6 +298,8 @@ void BM_mesh_delete_hflag_context(BMesh *bm, const char hflag, const int type)
|
|||
}
|
||||
case DEL_FACES: {
|
||||
/* go through and mark all edges and all verts of all faces for delete */
|
||||
BMFace *f;
|
||||
BMEdge *e;
|
||||
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
|
||||
if (BM_elem_flag_test(f, hflag)) {
|
||||
BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_alloca.h"
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_linklist.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_math_vec_types.hh"
|
||||
#include "BLI_utildefines_stack.h"
|
||||
|
||||
#include "BKE_customdata.h"
|
||||
|
@ -80,7 +81,7 @@ void BM_face_uv_calc_center_median(const BMFace *f, const int cd_loop_uv_offset,
|
|||
zero_v2(r_cent);
|
||||
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
|
||||
do {
|
||||
const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
|
||||
const MLoopUV *luv = (const MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
|
||||
add_v2_v2(r_cent, luv->uv);
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
|
||||
|
@ -89,16 +90,16 @@ void BM_face_uv_calc_center_median(const BMFace *f, const int cd_loop_uv_offset,
|
|||
|
||||
float BM_face_uv_calc_cross(const BMFace *f, const int cd_loop_uv_offset)
|
||||
{
|
||||
float(*uvs)[2] = BLI_array_alloca(uvs, f->len);
|
||||
blender::Array<blender::float2, BM_DEFAULT_NGON_STACK_SIZE> uvs(f->len);
|
||||
const BMLoop *l_iter;
|
||||
const BMLoop *l_first;
|
||||
int i = 0;
|
||||
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
|
||||
do {
|
||||
const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
|
||||
copy_v2_v2(uvs[i++], luv->uv);
|
||||
const MLoopUV *luv = (const MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
|
||||
uvs[i++] = luv->uv;
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
return cross_poly_v2(uvs, f->len);
|
||||
return cross_poly_v2(reinterpret_cast<const float(*)[2]>(uvs.data()), f->len);
|
||||
}
|
||||
|
||||
void BM_face_uv_minmax(const BMFace *f, float min[2], float max[2], const int cd_loop_uv_offset)
|
||||
|
@ -107,7 +108,7 @@ void BM_face_uv_minmax(const BMFace *f, float min[2], float max[2], const int cd
|
|||
const BMLoop *l_first;
|
||||
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
|
||||
do {
|
||||
const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
|
||||
const MLoopUV *luv = (const MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
|
||||
minmax_v2v2_v2(min, max, luv->uv);
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
}
|
||||
|
@ -118,7 +119,7 @@ void BM_face_uv_transform(BMFace *f, const float matrix[2][2], const int cd_loop
|
|||
BMLoop *l_first;
|
||||
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
|
||||
do {
|
||||
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
|
||||
MLoopUV *luv = (MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
|
||||
mul_m2_v2(matrix, luv->uv);
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
}
|
||||
|
@ -126,12 +127,12 @@ void BM_face_uv_transform(BMFace *f, const float matrix[2][2], const int cd_loop
|
|||
bool BM_loop_uv_share_edge_check(BMLoop *l_a, BMLoop *l_b, const int cd_loop_uv_offset)
|
||||
{
|
||||
BLI_assert(l_a->e == l_b->e);
|
||||
MLoopUV *luv_a_curr = BM_ELEM_CD_GET_VOID_P(l_a, cd_loop_uv_offset);
|
||||
MLoopUV *luv_a_next = BM_ELEM_CD_GET_VOID_P(l_a->next, cd_loop_uv_offset);
|
||||
MLoopUV *luv_b_curr = BM_ELEM_CD_GET_VOID_P(l_b, cd_loop_uv_offset);
|
||||
MLoopUV *luv_b_next = BM_ELEM_CD_GET_VOID_P(l_b->next, cd_loop_uv_offset);
|
||||
MLoopUV *luv_a_curr = (MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_a, cd_loop_uv_offset);
|
||||
MLoopUV *luv_a_next = (MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_a->next, cd_loop_uv_offset);
|
||||
MLoopUV *luv_b_curr = (MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_b, cd_loop_uv_offset);
|
||||
MLoopUV *luv_b_next = (MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_b->next, cd_loop_uv_offset);
|
||||
if (l_a->v != l_b->v) {
|
||||
SWAP(MLoopUV *, luv_b_curr, luv_b_next);
|
||||
std::swap(luv_b_curr, luv_b_next);
|
||||
}
|
||||
return (equals_v2v2(luv_a_curr->uv, luv_b_curr->uv) &&
|
||||
equals_v2v2(luv_a_next->uv, luv_b_next->uv));
|
||||
|
@ -140,8 +141,8 @@ bool BM_loop_uv_share_edge_check(BMLoop *l_a, BMLoop *l_b, const int cd_loop_uv_
|
|||
bool BM_loop_uv_share_vert_check(BMLoop *l_a, BMLoop *l_b, const int cd_loop_uv_offset)
|
||||
{
|
||||
BLI_assert(l_a->v == l_b->v);
|
||||
const MLoopUV *luv_a = BM_ELEM_CD_GET_VOID_P(l_a, cd_loop_uv_offset);
|
||||
const MLoopUV *luv_b = BM_ELEM_CD_GET_VOID_P(l_b, cd_loop_uv_offset);
|
||||
const MLoopUV *luv_a = (const MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_a, cd_loop_uv_offset);
|
||||
const MLoopUV *luv_b = (const MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_b, cd_loop_uv_offset);
|
||||
if (!equals_v2v2(luv_a->uv, luv_b->uv)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -160,8 +161,10 @@ bool BM_edge_uv_share_vert_check(BMEdge *e, BMLoop *l_a, BMLoop *l_b, const int
|
|||
const BMLoop *l_other_b = BM_loop_other_vert_loop_by_edge(l_b, e);
|
||||
|
||||
{
|
||||
const MLoopUV *luv_other_a = BM_ELEM_CD_GET_VOID_P(l_other_a, cd_loop_uv_offset);
|
||||
const MLoopUV *luv_other_b = BM_ELEM_CD_GET_VOID_P(l_other_b, cd_loop_uv_offset);
|
||||
const MLoopUV *luv_other_a = (const MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_other_a,
|
||||
cd_loop_uv_offset);
|
||||
const MLoopUV *luv_other_b = (const MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_other_b,
|
||||
cd_loop_uv_offset);
|
||||
if (!equals_v2v2(luv_other_a->uv, luv_other_b->uv)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -172,7 +175,7 @@ bool BM_edge_uv_share_vert_check(BMEdge *e, BMLoop *l_a, BMLoop *l_b, const int
|
|||
|
||||
bool BM_face_uv_point_inside_test(const BMFace *f, const float co[2], const int cd_loop_uv_offset)
|
||||
{
|
||||
float(*projverts)[2] = BLI_array_alloca(projverts, f->len);
|
||||
blender::Array<blender::float2, BM_DEFAULT_NGON_STACK_SIZE> projverts(f->len);
|
||||
|
||||
BMLoop *l_iter;
|
||||
int i;
|
||||
|
@ -180,8 +183,9 @@ bool BM_face_uv_point_inside_test(const BMFace *f, const float co[2], const int
|
|||
BLI_assert(BM_face_is_normal_valid(f));
|
||||
|
||||
for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f); i < f->len; i++, l_iter = l_iter->next) {
|
||||
copy_v2_v2(projverts[i], BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset));
|
||||
projverts[i] = ((const MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset))->uv;
|
||||
}
|
||||
|
||||
return isect_point_poly_v2(co, projverts, f->len, false);
|
||||
return isect_point_poly_v2(
|
||||
co, reinterpret_cast<const float(*)[2]>(projverts.data()), f->len, false);
|
||||
}
|
|
@ -182,9 +182,8 @@ void bmesh_disk_edge_remove(BMEdge *e, BMVert *v)
|
|||
|
||||
BMEdge *bmesh_disk_edge_exists(const BMVert *v1, const BMVert *v2)
|
||||
{
|
||||
BMEdge *e_iter, *e_first;
|
||||
|
||||
if (v1->e) {
|
||||
BMEdge *e_iter, *e_first;
|
||||
e_first = e_iter = v1->e;
|
||||
|
||||
do {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
static float bm_face_subset_calc_planar(BMLoop *l_first, BMLoop *l_last, const float no[3])
|
||||
{
|
||||
float axis_mat[3][3];
|
||||
float z_prev, z_curr;
|
||||
float z_prev;
|
||||
float delta_z = 0.0f;
|
||||
|
||||
/* Newell's Method */
|
||||
|
@ -35,7 +35,7 @@ static float bm_face_subset_calc_planar(BMLoop *l_first, BMLoop *l_last, const f
|
|||
|
||||
z_prev = dot_m3_v3_row_z(axis_mat, l_last->v->co);
|
||||
do {
|
||||
z_curr = dot_m3_v3_row_z(axis_mat, l_iter->v->co);
|
||||
const float z_curr = dot_m3_v3_row_z(axis_mat, l_iter->v->co);
|
||||
delta_z += fabsf(z_curr - z_prev);
|
||||
z_prev = z_curr;
|
||||
} while ((l_iter = l_iter->next) != l_term);
|
||||
|
|
|
@ -52,7 +52,6 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op)
|
|||
}
|
||||
|
||||
BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
|
||||
BMFace *f_new;
|
||||
float f_center[3];
|
||||
BMVert *v_center = NULL;
|
||||
BMLoop *l_iter, *l_first;
|
||||
|
@ -83,8 +82,7 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op)
|
|||
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
|
||||
do {
|
||||
BMLoop *l_new;
|
||||
|
||||
f_new = BM_face_create_quad_tri(
|
||||
BMFace *f_new = BM_face_create_quad_tri(
|
||||
bm, l_iter->v, l_iter->next->v, v_center, NULL, f, BM_CREATE_NOP);
|
||||
l_new = BM_FACE_FIRST_LOOP(f_new);
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ GlobalData init_globals(void)
|
|||
GlobalData surf;
|
||||
|
||||
# if defined(WORLD_BACKGROUND) || defined(PROBE_CAPTURE)
|
||||
surf.P = transform_direction(ViewMatrixInverse, viewCameraVec(viewPosition));
|
||||
surf.P = transform_direction(ViewMatrixInverse, -viewCameraVec(viewPosition));
|
||||
surf.N = surf.Ng = -surf.P;
|
||||
surf.ray_length = 0.0;
|
||||
# else
|
||||
|
|
|
@ -409,7 +409,7 @@ void DRW_shgroup_call_ex(DRWShadingGroup *shgroup,
|
|||
void *user_data);
|
||||
|
||||
/**
|
||||
* If ob is NULL, unit modelmatrix is assumed and culling is bypassed.
|
||||
* If ob is NULL, unit model-matrix is assumed and culling is bypassed.
|
||||
*/
|
||||
#define DRW_shgroup_call(shgroup, geom, ob) \
|
||||
DRW_shgroup_call_ex(shgroup, ob, NULL, geom, false, NULL)
|
||||
|
@ -420,8 +420,8 @@ void DRW_shgroup_call_ex(DRWShadingGroup *shgroup,
|
|||
#define DRW_shgroup_call_obmat(shgroup, geom, obmat) \
|
||||
DRW_shgroup_call_ex(shgroup, NULL, obmat, geom, false, NULL)
|
||||
|
||||
/* TODO(fclem): remove this when we have DRWView */
|
||||
/* user_data is used by DRWCallVisibilityFn defined in DRWView. */
|
||||
/* TODO(fclem): remove this when we have #DRWView */
|
||||
/* user_data is used by #DRWCallVisibilityFn defined in #DRWView. */
|
||||
#define DRW_shgroup_call_with_callback(shgroup, geom, ob, user_data) \
|
||||
DRW_shgroup_call_ex(shgroup, ob, NULL, geom, false, user_data)
|
||||
|
||||
|
|
|
@ -1545,10 +1545,10 @@ uiButViewItem *ui_block_view_find_matching_view_item_but_in_old_block(
|
|||
struct uiListType *UI_UL_cache_file_layers(void);
|
||||
|
||||
struct ID *ui_template_id_liboverride_hierarchy_make(struct bContext *C,
|
||||
struct Main *bmain,
|
||||
struct ID *owner_id,
|
||||
struct ID *id,
|
||||
const char **r_undo_push_label);
|
||||
struct Main *bmain,
|
||||
struct ID *owner_id,
|
||||
struct ID *id,
|
||||
const char **r_undo_push_label);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1327,14 +1327,15 @@ static void getVerticalAndHorizontalChange(const float norm[3],
|
|||
changes[index][1] = len_v3v3(projA, projB);
|
||||
}
|
||||
|
||||
/* by changing nonzero weights, try to move a vertex in me->mverts with index 'index' to
|
||||
* distToBe distance away from the provided plane strength can change distToBe so that it moves
|
||||
* towards distToBe by that percentage cp changes how much the weights are adjusted
|
||||
/**
|
||||
* By changing nonzero weights, try to move a vertex in `me->mverts` with index 'index' to
|
||||
* `distToBe` distance away from the provided plane strength can change `distToBe` so that it moves
|
||||
* towards `distToBe` by that percentage `cp` changes how much the weights are adjusted
|
||||
* to check the distance
|
||||
*
|
||||
* index is the index of the vertex being moved
|
||||
* norm and d are the plane's properties for the equation: ax + by + cz + d = 0
|
||||
* coord is a point on the plane
|
||||
* `index` is the index of the vertex being moved.
|
||||
* `norm` and `d` are the plane's properties for the equation: `ax + by + cz + d = 0`.
|
||||
* `coord` is a point on the plane.
|
||||
*/
|
||||
static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
|
||||
Scene *UNUSED(scene),
|
||||
|
|
|
@ -2637,12 +2637,12 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
|
|||
Sequence *seq_other;
|
||||
const char *error_msg;
|
||||
|
||||
if (SEQ_select_active_get_pair(scene, &seq_act, &seq_other) == 0) {
|
||||
if (SEQ_select_active_get_pair(scene, &seq_act, &seq_other) == false) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Please select two strips");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
if (SEQ_edit_sequence_swap(scene, seq_act, seq_other, &error_msg) == 0) {
|
||||
if (SEQ_edit_sequence_swap(scene, seq_act, seq_other, &error_msg) == false) {
|
||||
BKE_report(op->reports, RPT_ERROR, error_msg);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
|
|
@ -355,10 +355,12 @@ typedef struct MouseInput {
|
|||
|
||||
/** Initial mouse position. */
|
||||
int imval[2];
|
||||
bool precision;
|
||||
float precision_factor;
|
||||
float imval_unproj[3];
|
||||
float center[2];
|
||||
float factor;
|
||||
float precision_factor;
|
||||
bool precision;
|
||||
|
||||
/** Additional data, if needed by the particular function. */
|
||||
void *data;
|
||||
|
||||
|
@ -758,6 +760,7 @@ void applyMouseInput(struct TransInfo *t,
|
|||
struct MouseInput *mi,
|
||||
const int mval[2],
|
||||
float output[3]);
|
||||
void transform_input_update(TransInfo *t, const float fac);
|
||||
|
||||
void setCustomPoints(TransInfo *t, MouseInput *mi, const int start[2], const int end[2]);
|
||||
void setCustomPointsFromDirection(TransInfo *t, MouseInput *mi, const float dir[2]);
|
||||
|
@ -806,6 +809,7 @@ void calculateCenter2D(TransInfo *t);
|
|||
void calculateCenterLocal(TransInfo *t, const float center_global[3]);
|
||||
|
||||
void calculateCenter(TransInfo *t);
|
||||
void tranformViewUpdate(TransInfo *t);
|
||||
|
||||
/* API functions for getting center points */
|
||||
void calculateCenterBound(TransInfo *t, float r_center[3]);
|
||||
|
|
|
@ -177,7 +177,7 @@ static void axisProjection(const TransInfo *t,
|
|||
const float in[3],
|
||||
float out[3])
|
||||
{
|
||||
float norm[3], vec[3], factor, angle;
|
||||
float vec[3], factor, angle;
|
||||
float t_con_center[3];
|
||||
|
||||
if (is_zero_v3(in)) {
|
||||
|
@ -214,7 +214,7 @@ static void axisProjection(const TransInfo *t,
|
|||
}
|
||||
else {
|
||||
float v[3];
|
||||
float norm_center[3];
|
||||
float norm[3], norm_center[3];
|
||||
float plane[3];
|
||||
|
||||
view_vector_calc(t, t_con_center, norm_center);
|
||||
|
|
|
@ -27,6 +27,13 @@
|
|||
#include "transform_convert.h"
|
||||
#include "transform_snap.h"
|
||||
|
||||
struct TransCustomDataNode {
|
||||
View2DEdgePanData edgepan_data;
|
||||
|
||||
/* Compare if the view has changed so we can update with `transformViewUpdate`. */
|
||||
rctf viewrect_prev;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Node Transform Creation
|
||||
* \{ */
|
||||
|
@ -95,15 +102,17 @@ static void createTransNodeData(bContext *UNUSED(C), TransInfo *t)
|
|||
SpaceNode *snode = t->area->spacedata.first;
|
||||
|
||||
/* Custom data to enable edge panning during the node transform */
|
||||
View2DEdgePanData *customdata = MEM_callocN(sizeof(*customdata), __func__);
|
||||
struct TransCustomDataNode *customdata = MEM_callocN(sizeof(*customdata), __func__);
|
||||
UI_view2d_edge_pan_init(t->context,
|
||||
customdata,
|
||||
&customdata->edgepan_data,
|
||||
NODE_EDGE_PAN_INSIDE_PAD,
|
||||
NODE_EDGE_PAN_OUTSIDE_PAD,
|
||||
NODE_EDGE_PAN_SPEED_RAMP,
|
||||
NODE_EDGE_PAN_MAX_SPEED,
|
||||
NODE_EDGE_PAN_DELAY,
|
||||
NODE_EDGE_PAN_ZOOM_INFLUENCE);
|
||||
customdata->viewrect_prev = customdata->edgepan_data.initial_rect;
|
||||
|
||||
t->custom.type.data = customdata;
|
||||
t->custom.type.use_free = true;
|
||||
|
||||
|
@ -154,11 +163,11 @@ static void flushTransNodes(TransInfo *t)
|
|||
{
|
||||
const float dpi_fac = UI_DPI_FAC;
|
||||
|
||||
View2DEdgePanData *customdata = (View2DEdgePanData *)t->custom.type.data;
|
||||
struct TransCustomDataNode *customdata = (struct TransCustomDataNode *)t->custom.type.data;
|
||||
|
||||
if (t->options & CTX_VIEW2D_EDGE_PAN) {
|
||||
if (t->state == TRANS_CANCEL) {
|
||||
UI_view2d_edge_pan_cancel(t->context, customdata);
|
||||
UI_view2d_edge_pan_cancel(t->context, &customdata->edgepan_data);
|
||||
}
|
||||
else {
|
||||
/* Edge panning functions expect window coordinates, mval is relative to region */
|
||||
|
@ -166,13 +175,19 @@ static void flushTransNodes(TransInfo *t)
|
|||
t->region->winrct.xmin + t->mval[0],
|
||||
t->region->winrct.ymin + t->mval[1],
|
||||
};
|
||||
UI_view2d_edge_pan_apply(t->context, customdata, xy);
|
||||
UI_view2d_edge_pan_apply(t->context, &customdata->edgepan_data, xy);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initial and current view2D rects for additional transform due to view panning and zooming */
|
||||
const rctf *rect_src = &customdata->initial_rect;
|
||||
const rctf *rect_dst = &t->region->v2d.cur;
|
||||
float offset[2] = {0.0f, 0.0f};
|
||||
if (t->state != TRANS_CANCEL) {
|
||||
if (!BLI_rctf_compare(&customdata->viewrect_prev, &t->region->v2d.cur, FLT_EPSILON)) {
|
||||
/* Additional offset due to change in view2D rect. */
|
||||
BLI_rctf_transform_pt_v(&t->region->v2d.cur, &customdata->viewrect_prev, offset, offset);
|
||||
tranformViewUpdate(t);
|
||||
customdata->viewrect_prev = t->region->v2d.cur;
|
||||
}
|
||||
}
|
||||
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
applyGridAbsolute(t);
|
||||
|
@ -184,10 +199,7 @@ static void flushTransNodes(TransInfo *t)
|
|||
bNode *node = td->extra;
|
||||
|
||||
float loc[2];
|
||||
copy_v2_v2(loc, td2d->loc);
|
||||
|
||||
/* additional offset due to change in view2D rect */
|
||||
BLI_rctf_transform_pt_v(rect_dst, rect_src, loc, loc);
|
||||
add_v2_v2v2(loc, td2d->loc, offset);
|
||||
|
||||
#ifdef USE_NODE_CENTER
|
||||
loc[0] -= 0.5f * BLI_rctf_size_x(&node->totr);
|
||||
|
|
|
@ -1132,6 +1132,33 @@ static void calculateCenter_FromAround(TransInfo *t, int around, float r_center[
|
|||
}
|
||||
}
|
||||
|
||||
static void calculateZfac(TransInfo *t)
|
||||
{
|
||||
/* ED_view3d_calc_zfac() defines a factor for perspective depth correction,
|
||||
* used in ED_view3d_win_to_delta() */
|
||||
|
||||
/* zfac is only used convertViewVec only in cases operator was invoked in RGN_TYPE_WINDOW
|
||||
* and never used in other cases.
|
||||
*
|
||||
* We need special case here as well, since ED_view3d_calc_zfac will crash when called
|
||||
* for a region different from RGN_TYPE_WINDOW.
|
||||
*/
|
||||
if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
|
||||
t->zfac = ED_view3d_calc_zfac(t->region->regiondata, t->center_global);
|
||||
}
|
||||
else if (t->spacetype == SPACE_IMAGE) {
|
||||
SpaceImage *sima = t->area->spacedata.first;
|
||||
t->zfac = 1.0f / sima->zoom;
|
||||
}
|
||||
else {
|
||||
View2D *v2d = &t->region->v2d;
|
||||
/* Get zoom fac the same way as in
|
||||
* `ui_view2d_curRect_validate_resize` - better keep in sync! */
|
||||
const float zoomx = (float)(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur);
|
||||
t->zfac = 1.0f / zoomx;
|
||||
}
|
||||
}
|
||||
|
||||
void calculateCenter(TransInfo *t)
|
||||
{
|
||||
if ((t->flag & T_OVERRIDE_CENTER) == 0) {
|
||||
|
@ -1166,22 +1193,46 @@ void calculateCenter(TransInfo *t)
|
|||
}
|
||||
}
|
||||
|
||||
if (t->spacetype == SPACE_VIEW3D) {
|
||||
/* #ED_view3d_calc_zfac() defines a factor for perspective depth correction,
|
||||
* used in #ED_view3d_win_to_delta(). */
|
||||
calculateZfac(t);
|
||||
}
|
||||
|
||||
/* NOTE: `t->zfac` is only used #convertViewVec only in cases operator was invoked in
|
||||
* #RGN_TYPE_WINDOW and never used in other cases.
|
||||
*
|
||||
* We need special case here as well, since #ED_view3d_calc_zfac will crash when called
|
||||
* for a region different from #RGN_TYPE_WINDOW. */
|
||||
if (t->region->regiontype == RGN_TYPE_WINDOW) {
|
||||
t->zfac = ED_view3d_calc_zfac(t->region->regiondata, t->center_global);
|
||||
/* Called every time the view changes due to navigation.
|
||||
* Adjusts the mouse position relative to the object. */
|
||||
void tranformViewUpdate(TransInfo *t)
|
||||
{
|
||||
float zoom_prev = t->zfac;
|
||||
float zoom_new;
|
||||
if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
|
||||
if (!t->persp) {
|
||||
zoom_prev *= len_v3(t->persinv[0]);
|
||||
}
|
||||
else {
|
||||
t->zfac = 0.0f;
|
||||
|
||||
setTransformViewMatrices(t);
|
||||
calculateZfac(t);
|
||||
|
||||
zoom_new = t->zfac;
|
||||
if (!t->persp) {
|
||||
zoom_new *= len_v3(t->persinv[0]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(t->orient); i++) {
|
||||
if (t->orient[i].type == V3D_ORIENT_VIEW) {
|
||||
copy_m3_m4(t->orient[i].matrix, t->viewinv);
|
||||
normalize_m3(t->orient[i].matrix);
|
||||
if (t->orient_curr == i) {
|
||||
copy_m3_m3(t->spacemtx, t->orient[i].matrix);
|
||||
invert_m3_m3_safe_ortho(t->spacemtx_inv, t->spacemtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
calculateZfac(t);
|
||||
zoom_new = t->zfac;
|
||||
}
|
||||
|
||||
calculateCenter2D(t);
|
||||
transform_input_update(t, zoom_prev / zoom_new);
|
||||
}
|
||||
|
||||
void calculatePropRatio(TransInfo *t)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
||||
|
@ -18,6 +19,7 @@
|
|||
#include "WM_types.h"
|
||||
|
||||
#include "transform.h"
|
||||
#include "transform_mode.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
|
@ -251,11 +253,8 @@ void setCustomPointsFromDirection(TransInfo *t, MouseInput *mi, const float dir[
|
|||
/** \name Setup & Handle Mouse Input
|
||||
* \{ */
|
||||
|
||||
void initMouseInput(TransInfo *UNUSED(t),
|
||||
MouseInput *mi,
|
||||
const float center[2],
|
||||
const int mval[2],
|
||||
const bool precision)
|
||||
void initMouseInput(
|
||||
TransInfo *t, MouseInput *mi, const float center[2], const int mval[2], const bool precision)
|
||||
{
|
||||
mi->factor = 0;
|
||||
mi->precision = precision;
|
||||
|
@ -266,14 +265,20 @@ void initMouseInput(TransInfo *UNUSED(t),
|
|||
mi->imval[0] = mval[0];
|
||||
mi->imval[1] = mval[1];
|
||||
|
||||
if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
|
||||
float delta[3] = {mval[0] - center[0], mval[1] - center[1]};
|
||||
ED_view3d_win_to_delta(t->region, delta, t->zfac, delta);
|
||||
add_v3_v3v3(mi->imval_unproj, t->center_global, delta);
|
||||
}
|
||||
|
||||
mi->post = NULL;
|
||||
}
|
||||
|
||||
static void calcSpringFactor(MouseInput *mi)
|
||||
{
|
||||
mi->factor = sqrtf(
|
||||
((float)(mi->center[1] - mi->imval[1])) * ((float)(mi->center[1] - mi->imval[1])) +
|
||||
((float)(mi->center[0] - mi->imval[0])) * ((float)(mi->center[0] - mi->imval[0])));
|
||||
float mdir[2] = {(float)(mi->center[1] - mi->imval[1]), (float)(mi->center[0] - mi->imval[0])};
|
||||
|
||||
mi->factor = len_v2(mdir);
|
||||
|
||||
if (mi->factor == 0.0f) {
|
||||
mi->factor = 1.0f; /* prevent Inf */
|
||||
|
@ -441,4 +446,52 @@ void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float outp
|
|||
}
|
||||
}
|
||||
|
||||
void transform_input_update(TransInfo *t, const float fac)
|
||||
{
|
||||
MouseInput *mi = &t->mouse;
|
||||
t->mouse.factor *= fac;
|
||||
if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
|
||||
projectIntView(t, mi->imval_unproj, mi->imval);
|
||||
}
|
||||
else {
|
||||
int offset[2], center_2d_int[2] = {mi->center[0], mi->center[1]};
|
||||
sub_v2_v2v2_int(offset, mi->imval, center_2d_int);
|
||||
offset[0] *= fac;
|
||||
offset[1] *= fac;
|
||||
|
||||
center_2d_int[0] = t->center2d[0];
|
||||
center_2d_int[1] = t->center2d[1];
|
||||
add_v2_v2v2_int(mi->imval, center_2d_int, offset);
|
||||
}
|
||||
|
||||
float center_old[2];
|
||||
copy_v2_v2(center_old, mi->center);
|
||||
copy_v2_v2(mi->center, t->center2d);
|
||||
|
||||
if (mi->use_virtual_mval) {
|
||||
/* Update accumulator. */
|
||||
double mval_delta[2];
|
||||
sub_v2_v2v2_db(mval_delta, mi->virtual_mval.accum, mi->virtual_mval.prev);
|
||||
mval_delta[0] *= fac;
|
||||
mval_delta[1] *= fac;
|
||||
copy_v2_v2_db(mi->virtual_mval.accum, mi->virtual_mval.prev);
|
||||
add_v2_v2_db(mi->virtual_mval.accum, mval_delta);
|
||||
}
|
||||
|
||||
if (ELEM(mi->apply, InputAngle, InputAngleSpring)) {
|
||||
float offset_center[2];
|
||||
sub_v2_v2v2(offset_center, mi->center, center_old);
|
||||
struct InputAngle_Data *data = mi->data;
|
||||
data->mval_prev[0] += offset_center[0];
|
||||
data->mval_prev[1] += offset_center[1];
|
||||
}
|
||||
|
||||
if (t->mode == TFM_EDGE_SLIDE) {
|
||||
transform_mode_edge_slide_reproject_input(t);
|
||||
}
|
||||
else if (t->mode == TFM_VERT_SLIDE) {
|
||||
transform_mode_vert_slide_reproject_input(t);
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -117,6 +117,7 @@ void drawEdgeSlide(TransInfo *t);
|
|||
void initEdgeSlide_ex(
|
||||
TransInfo *t, bool use_double_side, bool use_even, bool flipped, bool use_clamp);
|
||||
void initEdgeSlide(TransInfo *t);
|
||||
void transform_mode_edge_slide_reproject_input(TransInfo *t);
|
||||
|
||||
/* transform_mode_gpopacity.c */
|
||||
|
||||
|
@ -191,3 +192,4 @@ void initTranslation(TransInfo *t);
|
|||
void drawVertSlide(TransInfo *t);
|
||||
void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp);
|
||||
void initVertSlide(TransInfo *t);
|
||||
void transform_mode_vert_slide_reproject_input(TransInfo *t);
|
||||
|
|
|
@ -292,6 +292,73 @@ static BMLoop *get_next_loop(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void edge_slide_projmat_get(TransInfo *t, TransDataContainer *tc, float r_projectMat[4][4])
|
||||
{
|
||||
RegionView3D *rv3d = NULL;
|
||||
|
||||
if (t->spacetype == SPACE_VIEW3D) {
|
||||
/* Background mode support. */
|
||||
rv3d = t->region ? t->region->regiondata : NULL;
|
||||
}
|
||||
|
||||
if (!rv3d) {
|
||||
/* Ok, let's try to survive this. */
|
||||
unit_m4(r_projectMat);
|
||||
}
|
||||
else {
|
||||
ED_view3d_ob_project_mat_get(rv3d, tc->obedit, r_projectMat);
|
||||
}
|
||||
}
|
||||
|
||||
static void edge_slide_pair_project(TransDataEdgeSlideVert *sv,
|
||||
ARegion *region,
|
||||
float projectMat[4][4],
|
||||
float r_sco_a[3],
|
||||
float r_sco_b[3])
|
||||
{
|
||||
BMVert *v = sv->v;
|
||||
|
||||
if (sv->v_side[1]) {
|
||||
ED_view3d_project_float_v3_m4(region, sv->v_side[1]->co, r_sco_b, projectMat);
|
||||
}
|
||||
else {
|
||||
add_v3_v3v3(r_sco_b, v->co, sv->dir_side[1]);
|
||||
ED_view3d_project_float_v3_m4(region, r_sco_b, r_sco_b, projectMat);
|
||||
}
|
||||
|
||||
if (sv->v_side[0]) {
|
||||
ED_view3d_project_float_v3_m4(region, sv->v_side[0]->co, r_sco_a, projectMat);
|
||||
}
|
||||
else {
|
||||
add_v3_v3v3(r_sco_a, v->co, sv->dir_side[0]);
|
||||
ED_view3d_project_float_v3_m4(region, r_sco_a, r_sco_a, projectMat);
|
||||
}
|
||||
}
|
||||
|
||||
static void edge_slide_data_init_mval(MouseInput *mi, EdgeSlideData *sld, float *mval_dir)
|
||||
{
|
||||
/* Possible all of the edge loops are pointing directly at the view. */
|
||||
if (UNLIKELY(len_squared_v2(mval_dir) < 0.1f)) {
|
||||
mval_dir[0] = 0.0f;
|
||||
mval_dir[1] = 100.0f;
|
||||
}
|
||||
|
||||
float mval_start[2], mval_end[2];
|
||||
|
||||
/* Zero out Start. */
|
||||
zero_v2(mval_start);
|
||||
|
||||
/* dir holds a vector along edge loop */
|
||||
copy_v2_v2(mval_end, mval_dir);
|
||||
mul_v2_fl(mval_end, 0.5f);
|
||||
|
||||
sld->mval_start[0] = mi->imval[0] + mval_start[0];
|
||||
sld->mval_start[1] = mi->imval[1] + mval_start[1];
|
||||
|
||||
sld->mval_end[0] = mi->imval[0] + mval_end[0];
|
||||
sld->mval_end[1] = mi->imval[1] + mval_end[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate screenspace `mval_start` / `mval_end`, optionally slide direction.
|
||||
*/
|
||||
|
@ -308,29 +375,20 @@ static void calcEdgeSlide_mval_range(TransInfo *t,
|
|||
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
||||
ARegion *region = t->region;
|
||||
View3D *v3d = NULL;
|
||||
RegionView3D *rv3d = NULL;
|
||||
float projectMat[4][4];
|
||||
BMBVHTree *bmbvh;
|
||||
|
||||
/* only for use_calc_direction */
|
||||
float(*loop_dir)[3] = NULL, *loop_maxdist = NULL;
|
||||
|
||||
float mval_start[2], mval_end[2];
|
||||
float mval_dir[3], dist_best_sq;
|
||||
|
||||
if (t->spacetype == SPACE_VIEW3D) {
|
||||
/* background mode support */
|
||||
v3d = t->area ? t->area->spacedata.first : NULL;
|
||||
rv3d = t->region ? t->region->regiondata : NULL;
|
||||
}
|
||||
|
||||
if (!rv3d) {
|
||||
/* ok, let's try to survive this */
|
||||
unit_m4(projectMat);
|
||||
}
|
||||
else {
|
||||
ED_view3d_ob_project_mat_get(rv3d, tc->obedit, projectMat);
|
||||
}
|
||||
edge_slide_projmat_get(t, tc, projectMat);
|
||||
|
||||
if (use_occlude_geometry) {
|
||||
bmbvh = BKE_bmbvh_new_from_editmesh(em, BMBVH_RESPECT_HIDDEN, NULL, false);
|
||||
|
@ -379,21 +437,7 @@ static void calcEdgeSlide_mval_range(TransInfo *t,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (sv->v_side[1]) {
|
||||
ED_view3d_project_float_v3_m4(region, sv->v_side[1]->co, sco_b, projectMat);
|
||||
}
|
||||
else {
|
||||
add_v3_v3v3(sco_b, v->co, sv->dir_side[1]);
|
||||
ED_view3d_project_float_v3_m4(region, sco_b, sco_b, projectMat);
|
||||
}
|
||||
|
||||
if (sv->v_side[0]) {
|
||||
ED_view3d_project_float_v3_m4(region, sv->v_side[0]->co, sco_a, projectMat);
|
||||
}
|
||||
else {
|
||||
add_v3_v3v3(sco_a, v->co, sv->dir_side[0]);
|
||||
ED_view3d_project_float_v3_m4(region, sco_a, sco_a, projectMat);
|
||||
}
|
||||
edge_slide_pair_project(sv, region, projectMat, sco_a, sco_b);
|
||||
|
||||
/* global direction */
|
||||
dist_sq = dist_squared_to_line_segment_v2(mval, sco_b, sco_a);
|
||||
|
@ -433,24 +477,7 @@ static void calcEdgeSlide_mval_range(TransInfo *t,
|
|||
MEM_freeN(loop_maxdist);
|
||||
}
|
||||
|
||||
/* possible all of the edge loops are pointing directly at the view */
|
||||
if (UNLIKELY(len_squared_v2(mval_dir) < 0.1f)) {
|
||||
mval_dir[0] = 0.0f;
|
||||
mval_dir[1] = 100.0f;
|
||||
}
|
||||
|
||||
/* zero out start */
|
||||
zero_v2(mval_start);
|
||||
|
||||
/* dir holds a vector along edge loop */
|
||||
copy_v2_v2(mval_end, mval_dir);
|
||||
mul_v2_fl(mval_end, 0.5f);
|
||||
|
||||
sld->mval_start[0] = t->mval[0] + mval_start[0];
|
||||
sld->mval_start[1] = t->mval[1] + mval_start[1];
|
||||
|
||||
sld->mval_end[0] = t->mval[0] + mval_end[0];
|
||||
sld->mval_end[1] = t->mval[1] + mval_end[1];
|
||||
edge_slide_data_init_mval(&t->mouse, sld, mval_dir);
|
||||
|
||||
if (bmbvh) {
|
||||
BKE_bmbvh_free(bmbvh);
|
||||
|
@ -466,7 +493,6 @@ static void calcEdgeSlide_even(TransInfo *t,
|
|||
|
||||
if (sld->totsv > 0) {
|
||||
ARegion *region = t->region;
|
||||
RegionView3D *rv3d = NULL;
|
||||
float projectMat[4][4];
|
||||
|
||||
int i = 0;
|
||||
|
@ -475,18 +501,7 @@ static void calcEdgeSlide_even(TransInfo *t,
|
|||
float dist_sq = 0;
|
||||
float dist_min_sq = FLT_MAX;
|
||||
|
||||
if (t->spacetype == SPACE_VIEW3D) {
|
||||
/* background mode support */
|
||||
rv3d = t->region ? t->region->regiondata : NULL;
|
||||
}
|
||||
|
||||
if (!rv3d) {
|
||||
/* ok, let's try to survive this */
|
||||
unit_m4(projectMat);
|
||||
}
|
||||
else {
|
||||
ED_view3d_ob_project_mat_get(rv3d, tc->obedit, projectMat);
|
||||
}
|
||||
edge_slide_projmat_get(t, tc, projectMat);
|
||||
|
||||
for (i = 0; i < sld->totsv; i++, sv++) {
|
||||
/* Set length */
|
||||
|
@ -1553,3 +1568,32 @@ void initEdgeSlide(TransInfo *t)
|
|||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Mouse Input Utilities
|
||||
* \{ */
|
||||
|
||||
void transform_mode_edge_slide_reproject_input(TransInfo *t)
|
||||
{
|
||||
ARegion *region = t->region;
|
||||
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
EdgeSlideData *sld = tc->custom.mode.data;
|
||||
if (sld) {
|
||||
float projectMat[4][4];
|
||||
edge_slide_projmat_get(t, tc, projectMat);
|
||||
|
||||
TransDataEdgeSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
|
||||
|
||||
float mval_dir[3], sco_a[3], sco_b[3];
|
||||
edge_slide_pair_project(curr_sv, region, projectMat, sco_a, sco_b);
|
||||
sub_v3_v3v3(mval_dir, sco_b, sco_a);
|
||||
edge_slide_data_init_mval(&t->mouse, sld, mval_dir);
|
||||
}
|
||||
}
|
||||
|
||||
EdgeSlideData *sld = edgeSlideFirstGet(t);
|
||||
setCustomPoints(t, &t->mouse, sld->mval_end, sld->mval_start);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -68,7 +68,7 @@ typedef struct VertSlideParams {
|
|||
bool flipped;
|
||||
} VertSlideParams;
|
||||
|
||||
static void calcVertSlideCustomPoints(struct TransInfo *t)
|
||||
static void vert_slide_update_input(TransInfo *t)
|
||||
{
|
||||
VertSlideParams *slp = t->custom.mode.data;
|
||||
VertSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data;
|
||||
|
@ -94,6 +94,11 @@ static void calcVertSlideCustomPoints(struct TransInfo *t)
|
|||
else {
|
||||
setCustomPoints(t, &t->mouse, mval_end, mval_start);
|
||||
}
|
||||
}
|
||||
|
||||
static void calcVertSlideCustomPoints(struct TransInfo *t)
|
||||
{
|
||||
vert_slide_update_input(t);
|
||||
|
||||
/* setCustomPoints isn't normally changing as the mouse moves,
|
||||
* in this case apply mouse input immediately so we don't refresh
|
||||
|
@ -673,3 +678,22 @@ void initVertSlide(TransInfo *t)
|
|||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Mouse Input Utilities
|
||||
* \{ */
|
||||
|
||||
void transform_mode_vert_slide_reproject_input(TransInfo *t)
|
||||
{
|
||||
if (t->spacetype == SPACE_VIEW3D) {
|
||||
RegionView3D *rv3d = t->region->regiondata;
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
VertSlideData *sld = tc->custom.mode.data;
|
||||
ED_view3d_ob_project_mat_get(rv3d, tc->obedit, sld->proj_mat);
|
||||
}
|
||||
}
|
||||
|
||||
vert_slide_update_input(t);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -195,156 +195,152 @@ static bool doForceIncrementSnap(const TransInfo *t)
|
|||
void drawSnapping(const struct bContext *C, TransInfo *t)
|
||||
{
|
||||
uchar col[4], selectedCol[4], activeCol[4];
|
||||
|
||||
if (!activeSnap(t)) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool draw_target = (t->spacetype == SPACE_VIEW3D) && (t->tsnap.status & TARGET_INIT) &&
|
||||
(t->tsnap.mode & SCE_SNAP_MODE_EDGE_PERPENDICULAR);
|
||||
|
||||
if (!(draw_target || validSnap(t))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (t->spacetype == SPACE_SEQ) {
|
||||
UI_GetThemeColor3ubv(TH_SEQ_ACTIVE, col);
|
||||
col[3] = 128;
|
||||
}
|
||||
else if (t->spacetype != SPACE_IMAGE) {
|
||||
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
|
||||
col[3] = 128;
|
||||
|
||||
UI_GetThemeColor3ubv(TH_SELECT, selectedCol);
|
||||
selectedCol[3] = 128;
|
||||
|
||||
UI_GetThemeColor3ubv(TH_ACTIVE, activeCol);
|
||||
activeCol[3] = 192;
|
||||
}
|
||||
|
||||
if (t->spacetype == SPACE_VIEW3D) {
|
||||
bool draw_target = (t->tsnap.status & TARGET_INIT) &&
|
||||
(t->tsnap.mode & SCE_SNAP_MODE_EDGE_PERPENDICULAR);
|
||||
const float *loc_cur = NULL;
|
||||
const float *loc_prev = NULL;
|
||||
const float *normal = NULL;
|
||||
|
||||
if (draw_target || validSnap(t)) {
|
||||
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
|
||||
col[3] = 128;
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
UI_GetThemeColor3ubv(TH_SELECT, selectedCol);
|
||||
selectedCol[3] = 128;
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
if (!BLI_listbase_is_empty(&t->tsnap.points)) {
|
||||
/* Draw snap points. */
|
||||
|
||||
UI_GetThemeColor3ubv(TH_ACTIVE, activeCol);
|
||||
activeCol[3] = 192;
|
||||
|
||||
const float *loc_cur = NULL;
|
||||
const float *loc_prev = NULL;
|
||||
const float *normal = NULL;
|
||||
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
if (!BLI_listbase_is_empty(&t->tsnap.points)) {
|
||||
/* Draw snap points. */
|
||||
|
||||
float size = 2.0f * UI_GetThemeValuef(TH_VERTEX_SIZE);
|
||||
float view_inv[4][4];
|
||||
copy_m4_m4(view_inv, rv3d->viewinv);
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
LISTBASE_FOREACH (TransSnapPoint *, p, &t->tsnap.points) {
|
||||
if (p == t->tsnap.selectedPoint) {
|
||||
immUniformColor4ubv(selectedCol);
|
||||
}
|
||||
else {
|
||||
immUniformColor4ubv(col);
|
||||
}
|
||||
imm_drawcircball(p->co, ED_view3d_pixel_size(rv3d, p->co) * size, view_inv, pos);
|
||||
}
|
||||
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
/* draw normal if needed */
|
||||
if (usingSnappingNormal(t) && validSnappingNormal(t)) {
|
||||
normal = t->tsnap.snapNormal;
|
||||
}
|
||||
|
||||
if (draw_target) {
|
||||
loc_prev = t->tsnap.snapTarget;
|
||||
}
|
||||
|
||||
if (validSnap(t)) {
|
||||
loc_cur = t->tsnap.snapPoint;
|
||||
}
|
||||
|
||||
ED_view3d_cursor_snap_draw_util(
|
||||
rv3d, loc_prev, loc_cur, normal, col, activeCol, t->tsnap.snapElem);
|
||||
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
}
|
||||
else if (t->spacetype == SPACE_IMAGE) {
|
||||
if (validSnap(t)) {
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
float x, y;
|
||||
const float snap_point[2] = {
|
||||
t->tsnap.snapPoint[0] / t->aspect[0],
|
||||
t->tsnap.snapPoint[1] / t->aspect[1],
|
||||
};
|
||||
UI_view2d_view_to_region_fl(&t->region->v2d, UNPACK2(snap_point), &x, &y);
|
||||
float radius = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE) * U.pixelsize;
|
||||
|
||||
GPU_matrix_push_projection();
|
||||
wmOrtho2_region_pixelspace(t->region);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
immUniformColor3ub(255, 255, 255);
|
||||
imm_draw_circle_wire_2d(pos, x, y, radius, 8);
|
||||
immUnbindProgram();
|
||||
|
||||
GPU_matrix_pop_projection();
|
||||
}
|
||||
}
|
||||
else if (t->spacetype == SPACE_NODE) {
|
||||
if (validSnap(t)) {
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
TransSnapPoint *p;
|
||||
float size;
|
||||
|
||||
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
float size = 2.0f * UI_GetThemeValuef(TH_VERTEX_SIZE);
|
||||
float view_inv[4][4];
|
||||
copy_m4_m4(view_inv, rv3d->viewinv);
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
for (p = t->tsnap.points.first; p; p = p->next) {
|
||||
LISTBASE_FOREACH (TransSnapPoint *, p, &t->tsnap.points) {
|
||||
if (p == t->tsnap.selectedPoint) {
|
||||
immUniformColor4ubv(selectedCol);
|
||||
}
|
||||
else {
|
||||
immUniformColor4ubv(col);
|
||||
}
|
||||
|
||||
ED_node_draw_snap(®ion->v2d, p->co, size, 0, pos);
|
||||
}
|
||||
|
||||
if (t->tsnap.status & POINT_INIT) {
|
||||
immUniformColor4ubv(activeCol);
|
||||
|
||||
ED_node_draw_snap(®ion->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder, pos);
|
||||
imm_drawcircball(p->co, ED_view3d_pixel_size(rv3d, p->co) * size, view_inv, pos);
|
||||
}
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
|
||||
/* draw normal if needed */
|
||||
if (usingSnappingNormal(t) && validSnappingNormal(t)) {
|
||||
normal = t->tsnap.snapNormal;
|
||||
}
|
||||
|
||||
if (draw_target) {
|
||||
loc_prev = t->tsnap.snapTarget;
|
||||
}
|
||||
|
||||
if (validSnap(t)) {
|
||||
loc_cur = t->tsnap.snapPoint;
|
||||
}
|
||||
|
||||
ED_view3d_cursor_snap_draw_util(
|
||||
rv3d, loc_prev, loc_cur, normal, col, activeCol, t->tsnap.snapElem);
|
||||
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
else if (t->spacetype == SPACE_IMAGE) {
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
float x, y;
|
||||
const float snap_point[2] = {
|
||||
t->tsnap.snapPoint[0] / t->aspect[0],
|
||||
t->tsnap.snapPoint[1] / t->aspect[1],
|
||||
};
|
||||
UI_view2d_view_to_region_fl(&t->region->v2d, UNPACK2(snap_point), &x, &y);
|
||||
float radius = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE) * U.pixelsize;
|
||||
|
||||
GPU_matrix_push_projection();
|
||||
wmOrtho2_region_pixelspace(t->region);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
immUniformColor3ub(255, 255, 255);
|
||||
imm_draw_circle_wire_2d(pos, x, y, radius, 8);
|
||||
immUnbindProgram();
|
||||
|
||||
GPU_matrix_pop_projection();
|
||||
}
|
||||
else if (t->spacetype == SPACE_NODE) {
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
TransSnapPoint *p;
|
||||
float size;
|
||||
|
||||
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
|
||||
for (p = t->tsnap.points.first; p; p = p->next) {
|
||||
if (p == t->tsnap.selectedPoint) {
|
||||
immUniformColor4ubv(selectedCol);
|
||||
}
|
||||
else {
|
||||
immUniformColor4ubv(col);
|
||||
}
|
||||
|
||||
ED_node_draw_snap(®ion->v2d, p->co, size, 0, pos);
|
||||
}
|
||||
|
||||
if (t->tsnap.status & POINT_INIT) {
|
||||
immUniformColor4ubv(activeCol);
|
||||
|
||||
ED_node_draw_snap(®ion->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder, pos);
|
||||
}
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
else if (t->spacetype == SPACE_SEQ) {
|
||||
if (validSnap(t)) {
|
||||
const ARegion *region = CTX_wm_region(C);
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
UI_GetThemeColor3ubv(TH_SEQ_ACTIVE, col);
|
||||
col[3] = 128;
|
||||
immUniformColor4ubv(col);
|
||||
float pixelx = BLI_rctf_size_x(®ion->v2d.cur) / BLI_rcti_size_x(®ion->v2d.mask);
|
||||
immRectf(pos,
|
||||
t->tsnap.snapPoint[0] - pixelx,
|
||||
region->v2d.cur.ymax,
|
||||
t->tsnap.snapPoint[0] + pixelx,
|
||||
region->v2d.cur.ymin);
|
||||
immUnbindProgram();
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
const ARegion *region = CTX_wm_region(C);
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
immUniformColor4ubv(col);
|
||||
float pixelx = BLI_rctf_size_x(®ion->v2d.cur) / BLI_rcti_size_x(®ion->v2d.mask);
|
||||
immRectf(pos,
|
||||
t->tsnap.snapPoint[0] - pixelx,
|
||||
region->v2d.cur.ymax,
|
||||
t->tsnap.snapPoint[0] + pixelx,
|
||||
region->v2d.cur.ymin);
|
||||
immUnbindProgram();
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3712,9 +3712,9 @@ void UV_OT_select_box(wmOperatorType *ot)
|
|||
/** \name Circle Select Operator
|
||||
* \{ */
|
||||
|
||||
static int uv_circle_select_is_point_inside(const float uv[2],
|
||||
const float offset[2],
|
||||
const float ellipse[2])
|
||||
static bool uv_circle_select_is_point_inside(const float uv[2],
|
||||
const float offset[2],
|
||||
const float ellipse[2])
|
||||
{
|
||||
/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
|
||||
const float co[2] = {
|
||||
|
@ -3724,10 +3724,10 @@ static int uv_circle_select_is_point_inside(const float uv[2],
|
|||
return len_squared_v2(co) < 1.0f;
|
||||
}
|
||||
|
||||
static int uv_circle_select_is_edge_inside(const float uv_a[2],
|
||||
const float uv_b[2],
|
||||
const float offset[2],
|
||||
const float ellipse[2])
|
||||
static bool uv_circle_select_is_edge_inside(const float uv_a[2],
|
||||
const float uv_b[2],
|
||||
const float offset[2],
|
||||
const float ellipse[2])
|
||||
{
|
||||
/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
|
||||
const float co_a[2] = {
|
||||
|
|
|
@ -153,13 +153,12 @@ void node_tex_musgrave_hybrid_multi_fractal_1d(vec3 co,
|
|||
float lacunarity = max(lac, 1e-5);
|
||||
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = snoise(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0;
|
||||
float value = 0.0;
|
||||
float weight = 1.0;
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < int(octaves)); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < int(octaves)); i++) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
|
@ -172,8 +171,12 @@ void node_tex_musgrave_hybrid_multi_fractal_1d(vec3 co,
|
|||
}
|
||||
|
||||
float rmd = octaves - floor(octaves);
|
||||
if (rmd != 0.0) {
|
||||
value += rmd * ((snoise(p) + offset) * pwr);
|
||||
if ((rmd != 0.0) && (weight > 0.001f)) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
float signal = (snoise(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
fac = value;
|
||||
|
@ -375,13 +378,12 @@ void node_tex_musgrave_hybrid_multi_fractal_2d(vec3 co,
|
|||
float lacunarity = max(lac, 1e-5);
|
||||
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = snoise(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0;
|
||||
float value = 0.0;
|
||||
float weight = 1.0;
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < int(octaves)); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < int(octaves)); i++) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
|
@ -394,8 +396,12 @@ void node_tex_musgrave_hybrid_multi_fractal_2d(vec3 co,
|
|||
}
|
||||
|
||||
float rmd = octaves - floor(octaves);
|
||||
if (rmd != 0.0) {
|
||||
value += rmd * ((snoise(p) + offset) * pwr);
|
||||
if ((rmd != 0.0) && (weight > 0.001f)) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
float signal = (snoise(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
fac = value;
|
||||
|
@ -597,13 +603,12 @@ void node_tex_musgrave_hybrid_multi_fractal_3d(vec3 co,
|
|||
float lacunarity = max(lac, 1e-5);
|
||||
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = snoise(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0;
|
||||
float value = 0.0;
|
||||
float weight = 1.0;
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < int(octaves)); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < int(octaves)); i++) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
|
@ -616,8 +621,12 @@ void node_tex_musgrave_hybrid_multi_fractal_3d(vec3 co,
|
|||
}
|
||||
|
||||
float rmd = octaves - floor(octaves);
|
||||
if (rmd != 0.0) {
|
||||
value += rmd * ((snoise(p) + offset) * pwr);
|
||||
if ((rmd != 0.0) && (weight > 0.001f)) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
float signal = (snoise(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
fac = value;
|
||||
|
@ -819,13 +828,12 @@ void node_tex_musgrave_hybrid_multi_fractal_4d(vec3 co,
|
|||
float lacunarity = max(lac, 1e-5);
|
||||
|
||||
float pwHL = pow(lacunarity, -H);
|
||||
float pwr = pwHL;
|
||||
|
||||
float value = snoise(p) + offset;
|
||||
float weight = gain * value;
|
||||
p *= lacunarity;
|
||||
float pwr = 1.0;
|
||||
float value = 0.0;
|
||||
float weight = 1.0;
|
||||
|
||||
for (int i = 1; (weight > 0.001f) && (i < int(octaves)); i++) {
|
||||
for (int i = 0; (weight > 0.001f) && (i < int(octaves)); i++) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
|
@ -838,8 +846,12 @@ void node_tex_musgrave_hybrid_multi_fractal_4d(vec3 co,
|
|||
}
|
||||
|
||||
float rmd = octaves - floor(octaves);
|
||||
if (rmd != 0.0) {
|
||||
value += rmd * ((snoise(p) + offset) * pwr);
|
||||
if ((rmd != 0.0) && (weight > 0.001f)) {
|
||||
if (weight > 1.0) {
|
||||
weight = 1.0;
|
||||
}
|
||||
float signal = (snoise(p) + offset) * pwr;
|
||||
value += rmd * weight * signal;
|
||||
}
|
||||
|
||||
fac = value;
|
||||
|
|
|
@ -178,7 +178,6 @@ ImBuf *imb_bmp_decode(const uchar *mem, size_t size, int flags, char colorspace[
|
|||
const char(*palette)[4] = (const char(*)[4])(mem + palette_offset);
|
||||
const int startmask = ((1 << depth) - 1) << 8;
|
||||
for (size_t i = y; i > 0; i--) {
|
||||
int index;
|
||||
int bitoffs = 8;
|
||||
int bitmask = startmask;
|
||||
int nbytes = 0;
|
||||
|
@ -189,7 +188,7 @@ ImBuf *imb_bmp_decode(const uchar *mem, size_t size, int flags, char colorspace[
|
|||
for (size_t j = x; j > 0; j--) {
|
||||
bitoffs -= depth;
|
||||
bitmask >>= depth;
|
||||
index = (bmp[0] & bitmask) >> bitoffs;
|
||||
const int index = (bmp[0] & bitmask) >> bitoffs;
|
||||
pcol = palette[index];
|
||||
/* intentionally BGR -> RGB */
|
||||
rect[0] = pcol[2];
|
||||
|
|
|
@ -2008,7 +2008,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
|
|||
printf("Error: can't process EXR multilayer file\n");
|
||||
}
|
||||
else {
|
||||
const int is_alpha = exr_has_alpha(*file);
|
||||
const bool is_alpha = exr_has_alpha(*file);
|
||||
|
||||
ibuf = IMB_allocImBuf(width, height, is_alpha ? 32 : 24, 0);
|
||||
ibuf->flags |= exr_is_half_float(*file) ? IB_halffloat : 0;
|
||||
|
|
|
@ -209,7 +209,7 @@ static void imb_cache_filename(char *filepath, const char *name, int flags)
|
|||
ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
|
||||
{
|
||||
ImBuf *ibuf;
|
||||
int file, a;
|
||||
int file;
|
||||
char filepath_tx[IMB_FILENAME_SIZE];
|
||||
|
||||
BLI_assert(!BLI_path_is_rel(filepath));
|
||||
|
@ -226,7 +226,7 @@ ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_S
|
|||
if (ibuf) {
|
||||
BLI_strncpy(ibuf->name, filepath, sizeof(ibuf->name));
|
||||
BLI_strncpy(ibuf->cachename, filepath_tx, sizeof(ibuf->cachename));
|
||||
for (a = 1; a < ibuf->miptot; a++) {
|
||||
for (int a = 1; a < ibuf->miptot; a++) {
|
||||
BLI_strncpy(ibuf->mipmap[a - 1]->cachename, filepath_tx, sizeof(ibuf->cachename));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -549,10 +549,8 @@ ImBuf *imb_loadtiff(const unsigned char *mem,
|
|||
ImbTIFFMemFile memFile;
|
||||
uint32_t width, height;
|
||||
char *format = NULL;
|
||||
int level;
|
||||
short spp;
|
||||
int ib_depth;
|
||||
int found;
|
||||
|
||||
/* Check whether or not we have a TIFF file. */
|
||||
if (imb_is_a_tiff(mem, size) == 0) {
|
||||
|
@ -592,8 +590,7 @@ ImBuf *imb_loadtiff(const unsigned char *mem,
|
|||
if (flags & IB_alphamode_detect) {
|
||||
if (spp == 4) {
|
||||
unsigned short extra, *extraSampleTypes;
|
||||
|
||||
found = TIFFGetField(image, TIFFTAG_EXTRASAMPLES, &extra, &extraSampleTypes);
|
||||
const int found = TIFFGetField(image, TIFFTAG_EXTRASAMPLES, &extra, &extraSampleTypes);
|
||||
|
||||
if (found && (extraSampleTypes[0] == EXTRASAMPLE_ASSOCALPHA)) {
|
||||
ibuf->flags |= IB_alphamode_premul;
|
||||
|
@ -617,7 +614,7 @@ ImBuf *imb_loadtiff(const unsigned char *mem,
|
|||
int numlevel = TIFFNumberOfDirectories(image);
|
||||
|
||||
/* create empty mipmap levels in advance */
|
||||
for (level = 0; level < numlevel; level++) {
|
||||
for (int level = 0; level < numlevel; level++) {
|
||||
if (!TIFFSetDirectory(image, level)) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -826,7 +826,23 @@ static char *rna_def_property_get_func(
|
|||
fprintf(f, "{\n");
|
||||
|
||||
if (manualfunc) {
|
||||
fprintf(f, " %s(ptr, values);\n", manualfunc);
|
||||
/* Assign `fn` to ensure function signatures match. */
|
||||
if (prop->type == PROP_BOOLEAN) {
|
||||
fprintf(f, " PropBooleanArrayGetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " fn(ptr, values);\n");
|
||||
}
|
||||
else if (prop->type == PROP_INT) {
|
||||
fprintf(f, " PropIntArrayGetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " fn(ptr, values);\n");
|
||||
}
|
||||
else if (prop->type == PROP_FLOAT) {
|
||||
fprintf(f, " PropFloatArrayGetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " fn(ptr, values);\n");
|
||||
}
|
||||
else {
|
||||
BLI_assert_unreachable(); /* Valid but should be handled by type checks. */
|
||||
fprintf(f, " %s(ptr, values);\n", manualfunc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rna_print_data_get(f, dp);
|
||||
|
@ -902,7 +918,27 @@ static char *rna_def_property_get_func(
|
|||
fprintf(f, "{\n");
|
||||
|
||||
if (manualfunc) {
|
||||
fprintf(f, " return %s(ptr);\n", manualfunc);
|
||||
/* Assign `fn` to ensure function signatures match. */
|
||||
if (prop->type == PROP_BOOLEAN) {
|
||||
fprintf(f, " PropBooleanGetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " return fn(ptr);\n");
|
||||
}
|
||||
else if (prop->type == PROP_INT) {
|
||||
fprintf(f, " PropIntGetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " return fn(ptr);\n");
|
||||
}
|
||||
else if (prop->type == PROP_FLOAT) {
|
||||
fprintf(f, " PropFloatGetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " return fn(ptr);\n");
|
||||
}
|
||||
else if (prop->type == PROP_ENUM) {
|
||||
fprintf(f, " PropEnumGetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " return fn(ptr);\n");
|
||||
}
|
||||
else {
|
||||
BLI_assert_unreachable(); /* Valid but should be handled by type checks. */
|
||||
fprintf(f, " return %s(ptr);\n", manualfunc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rna_print_data_get(f, dp);
|
||||
|
@ -1197,7 +1233,23 @@ static char *rna_def_property_set_func(
|
|||
fprintf(f, "{\n");
|
||||
|
||||
if (manualfunc) {
|
||||
fprintf(f, " %s(ptr, values);\n", manualfunc);
|
||||
/* Assign `fn` to ensure function signatures match. */
|
||||
if (prop->type == PROP_BOOLEAN) {
|
||||
fprintf(f, " PropBooleanArraySetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " fn(ptr, values);\n");
|
||||
}
|
||||
else if (prop->type == PROP_INT) {
|
||||
fprintf(f, " PropIntArraySetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " fn(ptr, values);\n");
|
||||
}
|
||||
else if (prop->type == PROP_FLOAT) {
|
||||
fprintf(f, " PropFloatArraySetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " fn(ptr, values);\n");
|
||||
}
|
||||
else {
|
||||
BLI_assert_unreachable(); /* Valid but should be handled by type checks. */
|
||||
fprintf(f, " %s(ptr, values);\n", manualfunc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rna_print_data_get(f, dp);
|
||||
|
@ -1289,7 +1341,27 @@ static char *rna_def_property_set_func(
|
|||
fprintf(f, "{\n");
|
||||
|
||||
if (manualfunc) {
|
||||
fprintf(f, " %s(ptr, value);\n", manualfunc);
|
||||
/* Assign `fn` to ensure function signatures match. */
|
||||
if (prop->type == PROP_BOOLEAN) {
|
||||
fprintf(f, " PropBooleanSetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " fn(ptr, value);\n");
|
||||
}
|
||||
else if (prop->type == PROP_INT) {
|
||||
fprintf(f, " PropIntSetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " fn(ptr, value);\n");
|
||||
}
|
||||
else if (prop->type == PROP_FLOAT) {
|
||||
fprintf(f, " PropFloatSetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " fn(ptr, value);\n");
|
||||
}
|
||||
else if (prop->type == PROP_ENUM) {
|
||||
fprintf(f, " PropEnumSetFunc fn = %s;\n", manualfunc);
|
||||
fprintf(f, " fn(ptr, value);\n");
|
||||
}
|
||||
else {
|
||||
BLI_assert_unreachable(); /* Valid but should be handled by type checks. */
|
||||
fprintf(f, " %s(ptr, value);\n", manualfunc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rna_print_data_get(f, dp);
|
||||
|
|
|
@ -322,7 +322,7 @@ int rna_ID_name_full_length(PointerRNA *ptr)
|
|||
return strlen(name);
|
||||
}
|
||||
|
||||
static int rna_ID_is_evaluated_get(PointerRNA *ptr)
|
||||
static bool rna_ID_is_evaluated_get(PointerRNA *ptr)
|
||||
{
|
||||
ID *id = (ID *)ptr->data;
|
||||
|
||||
|
|
|
@ -765,11 +765,11 @@ static void rna_Brush_set_size(PointerRNA *ptr, int value)
|
|||
brush->size = value;
|
||||
}
|
||||
|
||||
static void rna_Brush_use_gradient_set(PointerRNA *ptr, bool value)
|
||||
static void rna_Brush_use_gradient_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Brush *br = (Brush *)ptr->data;
|
||||
|
||||
if (value) {
|
||||
if (value & BRUSH_USE_GRADIENT) {
|
||||
br->flag |= BRUSH_USE_GRADIENT;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -67,7 +67,7 @@ static PointerRNA rna_DepsgraphObjectInstance_object_get(PointerRNA *ptr)
|
|||
return rna_pointer_inherit_refine(ptr, &RNA_Object, di->iter.current);
|
||||
}
|
||||
|
||||
static int rna_DepsgraphObjectInstance_is_instance_get(PointerRNA *ptr)
|
||||
static bool rna_DepsgraphObjectInstance_is_instance_get(PointerRNA *ptr)
|
||||
{
|
||||
RNA_DepsgraphIterator *di = ptr->data;
|
||||
DEGObjectIterData *deg_iter = (DEGObjectIterData *)di->iter.data;
|
||||
|
@ -137,12 +137,12 @@ static void rna_DepsgraphObjectInstance_persistent_id_get(PointerRNA *ptr, int *
|
|||
}
|
||||
}
|
||||
|
||||
static unsigned int rna_DepsgraphObjectInstance_random_id_get(PointerRNA *ptr)
|
||||
static int rna_DepsgraphObjectInstance_random_id_get(PointerRNA *ptr)
|
||||
{
|
||||
RNA_DepsgraphIterator *di = ptr->data;
|
||||
DEGObjectIterData *deg_iter = (DEGObjectIterData *)di->iter.data;
|
||||
if (deg_iter->dupli_object_current != NULL) {
|
||||
return deg_iter->dupli_object_current->random_id;
|
||||
return (int)deg_iter->dupli_object_current->random_id;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
|
|
|
@ -169,7 +169,6 @@ void RNA_def_main(BlenderRNA *brna)
|
|||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
CollectionDefFunc *func;
|
||||
|
||||
/* plural must match idtypes in readblenentry.c */
|
||||
MainCollectionDef lists[] = {
|
||||
|
@ -467,7 +466,7 @@ void RNA_def_main(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, lists[i].name, lists[i].description);
|
||||
|
||||
/* collection functions */
|
||||
func = lists[i].func;
|
||||
CollectionDefFunc *func = lists[i].func;
|
||||
if (func) {
|
||||
func(brna, prop);
|
||||
}
|
||||
|
|
|
@ -367,13 +367,13 @@ static char *rna_GpencilColorData_path(const PointerRNA *UNUSED(ptr))
|
|||
return BLI_strdup("grease_pencil");
|
||||
}
|
||||
|
||||
static int rna_GpencilColorData_is_stroke_visible_get(PointerRNA *ptr)
|
||||
static bool rna_GpencilColorData_is_stroke_visible_get(PointerRNA *ptr)
|
||||
{
|
||||
MaterialGPencilStyle *pcolor = ptr->data;
|
||||
return (pcolor->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH);
|
||||
}
|
||||
|
||||
static int rna_GpencilColorData_is_fill_visible_get(PointerRNA *ptr)
|
||||
static bool rna_GpencilColorData_is_fill_visible_get(PointerRNA *ptr)
|
||||
{
|
||||
MaterialGPencilStyle *pcolor = (MaterialGPencilStyle *)ptr->data;
|
||||
return ((pcolor->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (pcolor->fill_style > 0));
|
||||
|
|
|
@ -853,7 +853,7 @@ static bool rna_MPoly_freestyle_face_mark_get(PointerRNA *ptr)
|
|||
return ffa && (ffa->flag & FREESTYLE_FACE_MARK) != 0;
|
||||
}
|
||||
|
||||
static void rna_MPoly_freestyle_face_mark_set(PointerRNA *ptr, int value)
|
||||
static void rna_MPoly_freestyle_face_mark_set(PointerRNA *ptr, bool value)
|
||||
{
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
const int index = rna_MeshPolygon_index_get(ptr);
|
||||
|
|
|
@ -2229,7 +2229,7 @@ bool rna_GPencil_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
|
|||
return ((Object *)value.owner_id)->type == OB_GPENCIL;
|
||||
}
|
||||
|
||||
int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr)
|
||||
bool rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr)
|
||||
{
|
||||
SculptSession *ss = ((Object *)ptr->owner_id)->sculpt;
|
||||
return (ss && ss->bm);
|
||||
|
|
|
@ -1044,7 +1044,7 @@ static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
|
|||
return settings->draw_line[1];
|
||||
}
|
||||
|
||||
static int rna_PartSettings_is_fluid_get(PointerRNA *ptr)
|
||||
static bool rna_PartSettings_is_fluid_get(PointerRNA *ptr)
|
||||
{
|
||||
ParticleSettings *part = ptr->data;
|
||||
return (ELEM(part->type,
|
||||
|
|
|
@ -1145,7 +1145,7 @@ static bool rna_Function_no_self_get(PointerRNA *ptr)
|
|||
return !(func->flag & FUNC_NO_SELF);
|
||||
}
|
||||
|
||||
static int rna_Function_use_self_type_get(PointerRNA *ptr)
|
||||
static bool rna_Function_use_self_type_get(PointerRNA *ptr)
|
||||
{
|
||||
FunctionRNA *func = (FunctionRNA *)ptr->data;
|
||||
return 0 != (func->flag & FUNC_USE_SELF_TYPE);
|
||||
|
|
|
@ -324,7 +324,7 @@ static int rna_Sequence_frame_final_end_get(PointerRNA *ptr)
|
|||
return SEQ_time_right_handle_frame_get(scene, (Sequence *)ptr->data);
|
||||
}
|
||||
|
||||
static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, float value)
|
||||
static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Sequence *seq = (Sequence *)ptr->data;
|
||||
Scene *scene = (Scene *)ptr->owner_id;
|
||||
|
@ -346,7 +346,7 @@ static void rna_Sequence_end_frame_final_set(PointerRNA *ptr, int value)
|
|||
SEQ_relations_invalidate_cache_composite(scene, seq);
|
||||
}
|
||||
|
||||
static void rna_Sequence_start_frame_set(PointerRNA *ptr, int value)
|
||||
static void rna_Sequence_start_frame_set(PointerRNA *ptr, float value)
|
||||
{
|
||||
Sequence *seq = (Sequence *)ptr->data;
|
||||
Scene *scene = (Scene *)ptr->owner_id;
|
||||
|
|
|
@ -63,7 +63,7 @@ static void rna_Sequence_swap_internal(ID *id,
|
|||
const char *error_msg;
|
||||
Scene *scene = (Scene *)id;
|
||||
|
||||
if (SEQ_edit_sequence_swap(scene, seq_self, seq_other, &error_msg) == 0) {
|
||||
if (SEQ_edit_sequence_swap(scene, seq_self, seq_other, &error_msg) == false) {
|
||||
BKE_report(reports, RPT_ERROR, error_msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1100,7 +1100,7 @@ static bool rna_RegionView3D_is_orthographic_side_view_get(PointerRNA *ptr)
|
|||
return RV3D_VIEW_IS_AXIS(rv3d->view);
|
||||
}
|
||||
|
||||
static void rna_RegionView3D_is_orthographic_side_view_set(PointerRNA *ptr, int value)
|
||||
static void rna_RegionView3D_is_orthographic_side_view_set(PointerRNA *ptr, bool value)
|
||||
{
|
||||
RegionView3D *rv3d = (RegionView3D *)(ptr->data);
|
||||
const bool was_axis_view = RV3D_VIEW_IS_AXIS(rv3d->view);
|
||||
|
@ -1609,7 +1609,7 @@ static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerR
|
|||
}
|
||||
}
|
||||
|
||||
static void rna_SpaceImageEditor_show_stereo_set(PointerRNA *ptr, int value)
|
||||
static void rna_SpaceImageEditor_show_stereo_set(PointerRNA *ptr, bool value)
|
||||
{
|
||||
SpaceImage *sima = (SpaceImage *)(ptr->data);
|
||||
|
||||
|
|
|
@ -440,7 +440,7 @@ static PointerRNA rna_Panel_custom_data_get(PointerRNA *ptr)
|
|||
}
|
||||
|
||||
/* UIList */
|
||||
static unsigned int rna_UIList_filter_const_FILTER_ITEM_get(PointerRNA *UNUSED(ptr))
|
||||
static int rna_UIList_filter_const_FILTER_ITEM_get(PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
return UILST_FLT_ITEM;
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ static PointerRNA rna_Gizmo_properties_get(PointerRNA *ptr)
|
|||
}
|
||||
|
||||
# define RNA_GIZMO_FLAG_RO_DEF(func_id, member_id, flag_value) \
|
||||
static int rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
|
||||
static bool rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
|
||||
{ \
|
||||
wmGizmo *gz = ptr->data; \
|
||||
return (gz->member_id & flag_value) != 0; \
|
||||
|
|
|
@ -193,7 +193,7 @@ static int rna_WorkSpaceTool_index_get(PointerRNA *ptr)
|
|||
return (tref->runtime) ? tref->runtime->index : 0;
|
||||
}
|
||||
|
||||
static int rna_WorkSpaceTool_has_datablock_get(PointerRNA *ptr)
|
||||
static bool rna_WorkSpaceTool_has_datablock_get(PointerRNA *ptr)
|
||||
{
|
||||
bToolRef *tref = ptr->data;
|
||||
return (tref->runtime) ? (tref->runtime->data_block[0] != '\0') : false;
|
||||
|
|
|
@ -49,11 +49,11 @@ static void deformMatrices(ModifierData *md,
|
|||
{
|
||||
Key *key = BKE_key_from_object(ctx->object);
|
||||
KeyBlock *kb = BKE_keyblock_from_object(ctx->object);
|
||||
float scale[3][3];
|
||||
|
||||
(void)vertexCos; /* unused */
|
||||
|
||||
if (kb && kb->totelem == verts_num && kb != key->refkey) {
|
||||
float scale[3][3];
|
||||
int a;
|
||||
|
||||
if (ctx->object->shapeflag & OB_SHAPE_LOCK) {
|
||||
|
@ -95,15 +95,14 @@ static void deformMatricesEM(ModifierData *UNUSED(md),
|
|||
{
|
||||
Key *key = BKE_key_from_object(ctx->object);
|
||||
KeyBlock *kb = BKE_keyblock_from_object(ctx->object);
|
||||
float scale[3][3];
|
||||
|
||||
(void)vertexCos; /* unused */
|
||||
|
||||
if (kb && kb->totelem == verts_num && kb != key->refkey) {
|
||||
int a;
|
||||
float scale[3][3];
|
||||
scale_m3_fl(scale, kb->curval);
|
||||
|
||||
for (a = 0; a < verts_num; a++) {
|
||||
for (int a = 0; a < verts_num; a++) {
|
||||
copy_m3_m3(defMats[a], scale);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ void BPY_pyconstraint_exec(struct bPythonConstraint *con,
|
|||
// void BPY_pyconstraint_settings(void *arg1, void *arg2);
|
||||
void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTarget *ct);
|
||||
void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con);
|
||||
int BPY_is_pyconstraint(struct Text *text);
|
||||
bool BPY_is_pyconstraint(struct Text *text);
|
||||
// void BPY_free_pyconstraint_links(struct Text *text);
|
||||
|
||||
/* global interpreter lock */
|
||||
|
|
|
@ -25,7 +25,7 @@ void BPY_pyconstraint_exec(struct bPythonConstraint *con,
|
|||
void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTarget *ct)
|
||||
{
|
||||
}
|
||||
int BPY_is_pyconstraint(struct Text *text)
|
||||
bool BPY_is_pyconstraint(struct Text *text)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -16,10 +16,10 @@ struct Main;
|
|||
struct Scene;
|
||||
struct Sequence;
|
||||
|
||||
int SEQ_edit_sequence_swap(struct Scene *scene,
|
||||
struct Sequence *seq_a,
|
||||
struct Sequence *seq_b,
|
||||
const char **error_str);
|
||||
bool SEQ_edit_sequence_swap(struct Scene *scene,
|
||||
struct Sequence *seq_a,
|
||||
struct Sequence *seq_b,
|
||||
const char **error_str);
|
||||
/**
|
||||
* Move sequence to seqbase.
|
||||
*
|
||||
|
|
|
@ -15,9 +15,9 @@ struct Scene;
|
|||
struct Sequence;
|
||||
|
||||
struct Sequence *SEQ_select_active_get(struct Scene *scene);
|
||||
int SEQ_select_active_get_pair(struct Scene *scene,
|
||||
struct Sequence **r_seq_act,
|
||||
struct Sequence **r_seq_other);
|
||||
bool SEQ_select_active_get_pair(struct Scene *scene,
|
||||
struct Sequence **r_seq_act,
|
||||
struct Sequence **r_seq_other);
|
||||
void SEQ_select_active_set(struct Scene *scene, struct Sequence *seq);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -37,32 +37,32 @@
|
|||
#include "SEQ_transform.h"
|
||||
#include "SEQ_utils.h"
|
||||
|
||||
int SEQ_edit_sequence_swap(Scene *scene, Sequence *seq_a, Sequence *seq_b, const char **error_str)
|
||||
bool SEQ_edit_sequence_swap(Scene *scene, Sequence *seq_a, Sequence *seq_b, const char **error_str)
|
||||
{
|
||||
char name[sizeof(seq_a->name)];
|
||||
|
||||
if (SEQ_time_strip_length_get(scene, seq_a) != SEQ_time_strip_length_get(scene, seq_b)) {
|
||||
*error_str = N_("Strips must be the same length");
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* type checking, could be more advanced but disallow sound vs non-sound copy */
|
||||
if (seq_a->type != seq_b->type) {
|
||||
if (seq_a->type == SEQ_TYPE_SOUND_RAM || seq_b->type == SEQ_TYPE_SOUND_RAM) {
|
||||
*error_str = N_("Strips were not compatible");
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* disallow effects to swap with non-effects strips */
|
||||
if ((seq_a->type & SEQ_TYPE_EFFECT) != (seq_b->type & SEQ_TYPE_EFFECT)) {
|
||||
*error_str = N_("Strips were not compatible");
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((seq_a->type & SEQ_TYPE_EFFECT) && (seq_b->type & SEQ_TYPE_EFFECT)) {
|
||||
if (SEQ_effect_get_num_inputs(seq_a->type) != SEQ_effect_get_num_inputs(seq_b->type)) {
|
||||
*error_str = N_("Strips must have the same number of inputs");
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,27 +87,26 @@ int SEQ_edit_sequence_swap(Scene *scene, Sequence *seq_a, Sequence *seq_b, const
|
|||
seq_time_effect_range_set(scene, seq_a);
|
||||
seq_time_effect_range_set(scene, seq_b);
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void seq_update_muting_recursive(ListBase *channels,
|
||||
ListBase *seqbasep,
|
||||
Sequence *metaseq,
|
||||
int mute)
|
||||
const bool mute)
|
||||
{
|
||||
Sequence *seq;
|
||||
int seqmute;
|
||||
|
||||
/* For sound we go over full meta tree to update muted state,
|
||||
* since sound is played outside of evaluating the imbufs. */
|
||||
for (seq = seqbasep->first; seq; seq = seq->next) {
|
||||
seqmute = (mute || SEQ_render_is_muted(channels, seq));
|
||||
bool seqmute = (mute || SEQ_render_is_muted(channels, seq));
|
||||
|
||||
if (seq->type == SEQ_TYPE_META) {
|
||||
/* if this is the current meta sequence, unmute because
|
||||
* all sequences above this were set to mute */
|
||||
if (seq == metaseq) {
|
||||
seqmute = 0;
|
||||
seqmute = false;
|
||||
}
|
||||
|
||||
seq_update_muting_recursive(&seq->channels, &seq->seqbase, metaseq, seqmute);
|
||||
|
@ -127,10 +126,10 @@ void SEQ_edit_update_muting(Editing *ed)
|
|||
MetaStack *ms = ed->metastack.last;
|
||||
|
||||
if (ms) {
|
||||
seq_update_muting_recursive(&ed->channels, &ed->seqbase, ms->parseq, 1);
|
||||
seq_update_muting_recursive(&ed->channels, &ed->seqbase, ms->parseq, true);
|
||||
}
|
||||
else {
|
||||
seq_update_muting_recursive(&ed->channels, &ed->seqbase, NULL, 0);
|
||||
seq_update_muting_recursive(&ed->channels, &ed->seqbase, NULL, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,14 +37,14 @@ void SEQ_select_active_set(Scene *scene, Sequence *seq)
|
|||
ed->act_seq = seq;
|
||||
}
|
||||
|
||||
int SEQ_select_active_get_pair(Scene *scene, Sequence **r_seq_act, Sequence **r_seq_other)
|
||||
bool SEQ_select_active_get_pair(Scene *scene, Sequence **r_seq_act, Sequence **r_seq_other)
|
||||
{
|
||||
Editing *ed = SEQ_editing_get(scene);
|
||||
|
||||
*r_seq_act = SEQ_select_active_get(scene);
|
||||
|
||||
if (*r_seq_act == NULL) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
Sequence *seq;
|
||||
|
@ -54,7 +54,7 @@ int SEQ_select_active_get_pair(Scene *scene, Sequence **r_seq_act, Sequence **r_
|
|||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
if (seq->flag & SELECT && (seq != (*r_seq_act))) {
|
||||
if (*r_seq_other) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
*r_seq_other = seq;
|
||||
|
|
|
@ -84,7 +84,7 @@ bool SEQ_transform_seqbase_isolated_sel_check(ListBase *seqbase)
|
|||
|
||||
void SEQ_transform_fix_single_image_seq_offsets(const Scene *scene, Sequence *seq)
|
||||
{
|
||||
int left, start, offset;
|
||||
int left, start;
|
||||
if (!SEQ_transform_single_image_check(seq)) {
|
||||
return;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ void SEQ_transform_fix_single_image_seq_offsets(const Scene *scene, Sequence *se
|
|||
left = SEQ_time_left_handle_frame_get(scene, seq);
|
||||
start = seq->start;
|
||||
if (start != left) {
|
||||
offset = left - start;
|
||||
const int offset = left - start;
|
||||
SEQ_time_left_handle_frame_set(
|
||||
scene, seq, SEQ_time_left_handle_frame_get(scene, seq) - offset);
|
||||
SEQ_time_right_handle_frame_set(
|
||||
|
|
|
@ -671,7 +671,7 @@ void wm_event_do_notifiers(bContext *C)
|
|||
wm_test_autorun_warning(C);
|
||||
}
|
||||
|
||||
static int wm_event_always_pass(const wmEvent *event)
|
||||
static bool wm_event_always_pass(const wmEvent *event)
|
||||
{
|
||||
/* Some events we always pass on, to ensure proper communication. */
|
||||
return ISTIMER(event->type) || (event->type == WINDEACTIVATE);
|
||||
|
@ -2754,7 +2754,7 @@ static int wm_handler_fileselect_call(bContext *C,
|
|||
return wm_handler_fileselect_do(C, handlers, handler, event->val);
|
||||
}
|
||||
|
||||
static int wm_action_not_handled(int action)
|
||||
static bool wm_action_not_handled(int action)
|
||||
{
|
||||
return action == WM_HANDLER_CONTINUE || action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL);
|
||||
}
|
||||
|
|
|
@ -296,6 +296,12 @@ static void wm_window_match_keep_current_wm(const bContext *C,
|
|||
}
|
||||
}
|
||||
|
||||
/* we'll be using the current wm list directly; make sure
|
||||
* the names are validated and in the name map. */
|
||||
LISTBASE_FOREACH (wmWindowManager *, wm_item, current_wm_list) {
|
||||
BKE_main_namemap_get_name(bmain, &wm_item->id, wm_item->id.name + 2);
|
||||
}
|
||||
|
||||
*r_new_wm_list = *current_wm_list;
|
||||
}
|
||||
|
||||
|
|
|
@ -970,8 +970,8 @@ typedef enum {
|
|||
OS = 'C',
|
||||
} modifierKeyType;
|
||||
|
||||
/* check if specified modifier key type is pressed */
|
||||
static int query_qual(modifierKeyType qual)
|
||||
/** Check if specified modifier key type is pressed. */
|
||||
static bool query_qual(modifierKeyType qual)
|
||||
{
|
||||
GHOST_TModifierKey left, right;
|
||||
switch (qual) {
|
||||
|
|
|
@ -69,11 +69,10 @@ static void sig_handle_fpe(int UNUSED(sig))
|
|||
# if !defined(WITH_HEADLESS)
|
||||
static void sig_handle_blender_esc(int sig)
|
||||
{
|
||||
static int count = 0;
|
||||
|
||||
G.is_break = true; /* forces render loop to read queue, not sure if its needed */
|
||||
|
||||
if (sig == 2) {
|
||||
static int count = 0;
|
||||
if (count) {
|
||||
printf("\nBlender killed\n");
|
||||
exit(2);
|
||||
|
|
Loading…
Reference in New Issue