KX_MouseFocusSensor - bug reported by Micro27 on blenderartist
vertical bounds checking for multiple viewports was inverted. quiet some compiler warnings and minor corrections
This commit is contained in:
@@ -36,8 +36,6 @@
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_scene_types.h" // N_T
|
||||
|
||||
#include "PIL_time.h" // for PIL_sleep_ms
|
||||
|
||||
#include "BLI_arithb.h"
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
|
||||
@@ -4094,7 +4094,7 @@ void lib_link_screen_restore(Main *newmain, Scene *curscene)
|
||||
|
||||
sipo->ipo= restore_pointer_by_name(newmain, (ID *)sipo->ipo, 0);
|
||||
if(sipo->blocktype==ID_SEQ)
|
||||
sipo->from= find_sequence_from_ipo_helper(newmain, sipo->ipo);
|
||||
sipo->from= (ID *)find_sequence_from_ipo_helper(newmain, sipo->ipo);
|
||||
else
|
||||
sipo->from= restore_pointer_by_name(newmain, (ID *)sipo->from, 0);
|
||||
|
||||
|
||||
@@ -663,7 +663,7 @@ static PyObject *RenderData_Play( BPy_RenderData * self )
|
||||
#endif
|
||||
system( str );
|
||||
} else
|
||||
sprintf( "Can't find image: %s", file );
|
||||
printf("Can't find image: %s\n", file);
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
||||
@@ -89,6 +89,8 @@
|
||||
#include "blendef.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "PIL_time.h" // for PIL_sleep_ms
|
||||
|
||||
#ifdef WIN32 /* Windos */
|
||||
//#include "BLI_winstuff.h"
|
||||
#ifndef snprintf
|
||||
|
||||
@@ -1036,8 +1036,8 @@ static void do_gammacross_effect(Sequence * seq,int cfra,
|
||||
} else {
|
||||
do_gammacross_effect_byte(
|
||||
facf0, facf1, x, y,
|
||||
(char*) ibuf1->rect, (char*) ibuf2->rect,
|
||||
(char*) out->rect);
|
||||
(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
|
||||
(unsigned char*) out->rect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -197,13 +197,15 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam)
|
||||
* division by 0.0...*/
|
||||
|
||||
RAS_Rect area, viewport;
|
||||
short m_y_inv = m_kxengine->GetCanvas()->GetHeight()-m_y;
|
||||
|
||||
m_kxengine->GetSceneViewport(m_kxscene, cam, area, viewport);
|
||||
|
||||
/* Check if the mouse is in the viewport */
|
||||
if (( m_x < viewport.m_x2 && // less then right
|
||||
m_x > viewport.m_x1 && // more then then left
|
||||
m_y < viewport.m_y2 && // below top
|
||||
m_y > viewport.m_y1) == 0) // above bottom
|
||||
m_y_inv < viewport.m_y2 && // below top
|
||||
m_y_inv > viewport.m_y1) == 0) // above bottom
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -217,6 +219,10 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam)
|
||||
MT_Vector4 frompoint;
|
||||
MT_Vector4 topoint;
|
||||
|
||||
/* m_y_inv - inverting for a bounds check is only part of it, now make relative to view bounds */
|
||||
m_y_inv = (viewport.m_y2 - m_y_inv) + viewport.m_y1;
|
||||
|
||||
|
||||
/* There's some strangeness I don't fully get here... These values
|
||||
* _should_ be wrong! - see from point Z values */
|
||||
|
||||
@@ -229,13 +235,13 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam)
|
||||
* behind of the near and far clip planes.
|
||||
*/
|
||||
frompoint.setValue( (2 * (m_x-x_lb) / width) - 1.0,
|
||||
1.0 - (2 * (m_y - y_lb) / height),
|
||||
1.0 - (2 * (m_y_inv - y_lb) / height),
|
||||
/*cam->GetCameraData()->m_perspective ? 0.0:cdata->m_clipstart,*/ /* real clipstart is scaled in ortho for some reason, zero is ok */
|
||||
0.0, /* nearclip, see above comments */
|
||||
1.0 );
|
||||
|
||||
topoint.setValue( (2 * (m_x-x_lb) / width) - 1.0,
|
||||
1.0 - (2 * (m_y-y_lb) / height),
|
||||
1.0 - (2 * (m_y_inv-y_lb) / height),
|
||||
cam->GetCameraData()->m_perspective ? 1.0:cam->GetCameraData()->m_clipend, /* farclip, see above comments */
|
||||
1.0 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user