Cleanup: trailing space in source/gameengine/

This commit is contained in:
2018-06-17 17:01:43 +02:00
parent 5513da65b2
commit 4be752a93c
353 changed files with 3730 additions and 3730 deletions

View File

@@ -108,7 +108,7 @@ static BlendFileData *load_game_data(const char *filename)
{
ReportList reports;
BlendFileData *bfd;
BKE_reports_init(&reports, RPT_STORE);
bfd= BLO_read_from_file(filename, &reports, BLO_READ_SKIP_USERDEF);
@@ -202,13 +202,13 @@ static int BL_KetsjiPyNextFrame(void *state0)
{
BL_KetsjiNextFrameState *state = (BL_KetsjiNextFrameState *) state0;
return BL_KetsjiNextFrame(
state->ketsjiengine,
state->C,
state->win,
state->scene,
state->ketsjiengine,
state->C,
state->win,
state->scene,
state->ar,
state->keyboarddevice,
state->mousedevice,
state->keyboarddevice,
state->mousedevice,
state->draw_letterbox);
}
#endif
@@ -246,7 +246,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
// Acquire Python's GIL (global interpreter lock)
// so we can safely run Python code and API calls
PyGILState_STATE gilstate = PyGILState_Ensure();
PyObject *pyGlobalDict = PyDict_New(); /* python utility storage, spans blend file loading */
#endif
@@ -276,14 +276,14 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
bool restrictAnimFPS = (startscene->gm.flag & GAME_RESTRICT_ANIM_UPDATES) != 0;
short drawtype = v3d->drawtype;
/* we do not support material mode in game engine, force change to texture mode */
if (drawtype == OB_MATERIAL) drawtype = OB_TEXTURE;
if (animation_record) usefixed= false; /* override since you don't want to run full-speed for sim recording */
// create the canvas and rasterizer
RAS_ICanvas* canvas = new KX_BlenderCanvas(wm, win, area_rect, ar);
// default mouse state set on render panel
if (mouse_state)
canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
@@ -316,11 +316,11 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
RAS_IRasterizer::MipmapOption mipmapval = rasterizer->GetMipmapping();
// create the inputdevices
KX_BlenderKeyboardDevice* keyboarddevice = new KX_BlenderKeyboardDevice();
KX_BlenderMouseDevice* mousedevice = new KX_BlenderMouseDevice();
// create a networkdevice
NG_NetworkDeviceInterface* networkdevice = new
NG_LoopBackNetworkDeviceInterface();
@@ -328,10 +328,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
//
// create a ketsji/blendersystem (only needed for timing and stuff)
KX_BlenderSystem* kxsystem = new KX_BlenderSystem();
// create the ketsjiengine
KX_KetsjiEngine* ketsjiengine = new KX_KetsjiEngine(kxsystem);
// set the devices
ketsjiengine->SetKeyboardDevice(keyboarddevice);
ketsjiengine->SetMouseDevice(mousedevice);
@@ -382,7 +382,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
{
exitrequested = KX_EXIT_REQUEST_NO_REQUEST;
if (bfd) BLO_blendfiledata_free(bfd);
char basedpath[FILE_MAX];
// base the actuator filename with respect
// to the original file working directory
@@ -396,18 +396,18 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
// that happened to be loaded first
BLI_path_abs(basedpath, pathname);
bfd = load_game_data(basedpath);
// if it wasn't loaded, try it forced relative
if (!bfd)
{
// just add "//" in front of it
char temppath[FILE_MAX] = "//";
BLI_strncpy(temppath + 2, basedpath, FILE_MAX - 2);
BLI_path_abs(temppath, pathname);
bfd = load_game_data(temppath);
}
// if we got a loaded blendfile, proceed
if (bfd)
{
@@ -435,7 +435,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
{
int startFrame = scene->r.cfra;
ketsjiengine->SetAnimRecordMode(animation_record, startFrame);
// Quad buffered needs a special window.
if (scene->gm.stereoflag == STEREO_ENABLED) {
if (scene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)
@@ -446,7 +446,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
rasterizer->SetBackColor(scene->gm.framing.col);
}
if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME)
{
if (rv3d->persp != RV3D_CAMOB)
@@ -458,7 +458,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far);
ketsjiengine->SetCameraOverrideLens(v3d->lens);
}
// create a scene converter, create and convert the startingscene
KX_ISceneConverter* sceneconverter = new KX_BlenderSceneConverter(blenderdata, ketsjiengine);
ketsjiengine->SetSceneConverter(sceneconverter);
@@ -471,7 +471,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
sceneconverter->SetGLSLMaterials(true);
if (scene->gm.flag & GAME_NO_MATERIAL_CACHING)
sceneconverter->SetCacheMaterials(false);
KX_Scene* startscene = new KX_Scene(keyboarddevice,
mousedevice,
networkdevice,
@@ -509,19 +509,19 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
rasterizer,
canvas);
ketsjiengine->AddScene(startscene);
// init the rasterizer
rasterizer->Init();
// start the engine
ketsjiengine->StartEngine(true);
// Set the animation playback rate for ipo's and actions
// the framerate below should patch with FPS macro defined in blendef.h
// Could be in StartEngine set the framerate, we need the scene to do this
ketsjiengine->SetAnimFrameRate(FPS);
#ifdef WITH_PYTHON
char *python_main = NULL;
pynextframestate.state = NULL;
@@ -545,7 +545,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
ketsjinextframestate.keyboarddevice = keyboarddevice;
ketsjinextframestate.mousedevice = mousedevice;
ketsjinextframestate.draw_letterbox = draw_letterbox;
pynextframestate.state = &ketsjinextframestate;
pynextframestate.func = &BL_KetsjiPyNextFrame;
printf("Yielding control to Python script '%s'...\n", python_main);
@@ -577,9 +577,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
// inside the GameLogic dictionary when the python interpreter is finalized.
// which allows the scene to safely delete them :)
// see: (space.c)->start_game
//PyDict_Clear(PyModule_GetDict(gameLogic));
// Keep original items, means python plugins will autocomplete members
PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic));
const Py_ssize_t numitems= PyList_GET_SIZE(gameLogic_keys_new);
@@ -624,7 +624,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
// set mipmap setting back to its original value
rasterizer->SetMipmapping(mipmapval);
}
// clean up some stuff
if (ketsjiengine)
{
@@ -665,9 +665,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
// stop all remaining playing sounds
AUD_Device_stopAll(BKE_sound_get_device());
} while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);
if (bfd) BLO_blendfiledata_free(bfd);
BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name));

View File

@@ -293,7 +293,7 @@ void KX_BlenderCanvas::SetMousePosition(int x,int y)
int winX = m_frame_rect.GetLeft();
int winY = m_frame_rect.GetBottom();
int winH = m_frame_rect.GetHeight();
WM_cursor_warp(m_win, winX + x, winY + (winH-y));
}

View File

@@ -48,7 +48,7 @@ struct wmWindow;
struct wmWindowManager;
/**
* 2D Blender device context abstraction.
* 2D Blender device context abstraction.
* The connection from 3d rendercontext to 2d Blender surface embedding.
*/
@@ -63,17 +63,17 @@ private:
public:
/* Construct a new canvas.
*
*
* \param area The Blender ARegion to run the game within.
*/
KX_BlenderCanvas(struct wmWindowManager *wm, struct wmWindow* win, RAS_Rect &rect, struct ARegion* ar);
~KX_BlenderCanvas();
void
void
Init(
);
void
void
SwapBuffers(
);
@@ -89,7 +89,7 @@ public:
void GetDisplayDimensions(int &width, int &height);
void
void
ResizeWindow(
int width,
int height
@@ -107,11 +107,11 @@ public:
BeginFrame(
);
void
void
EndFrame(
);
void
void
ClearColor(
float r,
float g,
@@ -119,16 +119,16 @@ public:
float a
);
void
void
ClearBuffer(
int type
);
int
int
GetWidth(
) const;
int
int
GetHeight(
) const;
@@ -180,27 +180,27 @@ public:
const int*
GetViewPort();
void
void
SetMouseState(
RAS_MouseState mousestate
);
void
void
SetMousePosition(
int x,
int y
);
void
void
MakeScreenShot(
const char* filename
);
bool
bool
BeginDraw(
);
void
void
EndDraw(
);

View File

@@ -33,7 +33,7 @@
#ifdef _MSC_VER
/* annoying warnings about truncated STL debug info */
# pragma warning (disable:4786)
#endif
#endif
#include "KX_BlenderKeyboardDevice.h"
#include "KX_KetsjiEngine.h"
@@ -55,7 +55,7 @@ KX_BlenderKeyboardDevice::~KX_BlenderKeyboardDevice()
bool KX_BlenderKeyboardDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
{
const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode];
bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
inevent.m_status == SCA_InputEvent::KX_ACTIVE);
return pressed;
}
@@ -72,7 +72,7 @@ bool KX_BlenderKeyboardDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputco
void KX_BlenderKeyboardDevice::NextFrame()
{
SCA_IInputDevice::NextFrame();
// now convert justpressed keyevents into regular (active) keyevents
int previousTable = 1-m_currentTable;
for (int keyevent= KX_BEGINKEY; keyevent<= KX_ENDKEY;keyevent++)
@@ -94,7 +94,7 @@ void KX_BlenderKeyboardDevice::NextFrame()
bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode)
{
bool result = false;
// convert event
KX_EnumInputs kxevent = this->ToNative(incode);
@@ -122,7 +122,7 @@ bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short
break;
}
case SCA_InputEvent::KX_ACTIVE:
{
m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE;
break;
@@ -137,7 +137,7 @@ bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short
m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
}
}
} else if (val == KM_RELEASE)
{
// blender eventval == 0

View File

@@ -32,7 +32,7 @@
#ifdef _MSC_VER
/* annoying warnings about truncated STL debug info */
# pragma warning (disable:4786)
#endif
#endif
#include "KX_BlenderMouseDevice.h"
@@ -52,7 +52,7 @@ KX_BlenderMouseDevice::~KX_BlenderMouseDevice()
bool KX_BlenderMouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
{
const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode];
bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
inevent.m_status == SCA_InputEvent::KX_ACTIVE);
return pressed;
}
@@ -70,7 +70,7 @@ bool KX_BlenderMouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
void KX_BlenderMouseDevice::NextFrame()
{
SCA_IInputDevice::NextFrame();
// now convert justpressed keyevents into regular (active) keyevents
int previousTable = 1-m_currentTable;
for (int mouseevent= KX_BEGINMOUSE; mouseevent< KX_ENDMOUSEBUTTONS;mouseevent++)
@@ -90,13 +90,13 @@ void KX_BlenderMouseDevice::NextFrame()
if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
oldevent.m_status == SCA_InputEvent::KX_ACTIVE )
{
m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_JUSTRELEASED;
} else
{
if (oldevent.m_status == SCA_InputEvent::KX_JUSTRELEASED)
{
m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS;
}
}
@@ -111,7 +111,7 @@ void KX_BlenderMouseDevice::NextFrame()
bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode)
{
bool result = false;
// convert event
KX_EnumInputs kxevent = this->ToNative(incode);
int previousTable = 1-m_currentTable;
@@ -125,7 +125,7 @@ bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val
switch (m_eventStatusTables[previousTable][kxevent].m_status)
{
case SCA_InputEvent::KX_ACTIVE:
case SCA_InputEvent::KX_JUSTACTIVATED:
{
@@ -142,7 +142,7 @@ bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val
m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
}
}
} else if (val == KM_RELEASE)
{
// blender eventval == 0
@@ -168,7 +168,7 @@ bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val
switch (m_eventStatusTables[previousTable][kxevent].m_status)
{
case SCA_InputEvent::KX_ACTIVE:
case SCA_InputEvent::KX_JUSTACTIVATED:
{

View File

@@ -74,9 +74,9 @@ BL_ActionActuator::BL_ActionActuator(SCA_IObject *gameobj,
float layer_weight,
short ipo_flags,
short end_reset,
float stride)
float stride)
: SCA_IActuator(gameobj, KX_ACT_ACTION),
m_lastpos(0, 0, 0),
m_blendframe(0),
m_flag(0),
@@ -112,7 +112,7 @@ void BL_ActionActuator::ProcessReplica()
m_localtime=m_startframe;
m_lastUpdate=-1;
}
void BL_ActionActuator::SetBlendTime(float newtime)
@@ -128,7 +128,7 @@ void BL_ActionActuator::SetLocalTime(float curtime)
dt = -dt;
m_localtime = m_startframe + dt;
// Handle wrap around
if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe))
{
@@ -198,7 +198,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
// We handle ping pong ourselves to increase compabitility
// with files made prior to animation changes from GSoC 2011.
playtype = BL_Action::ACT_MODE_PLAY;
if (m_flag & ACT_FLAG_REVERSE)
{
start = m_endframe;
@@ -220,8 +220,8 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
if (m_flag & ACT_FLAG_CONTINUE)
bUseContinue = true;
// Handle events
if (frame)
{
@@ -265,7 +265,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
return false;
}
}
// If a different action is playing, we've been overruled and are no longer active
if (obj->GetCurrentAction(m_layer) != m_action && !obj->IsActionDone(m_layer))
m_flag &= ~ACT_FLAG_ACTIVE;
@@ -320,7 +320,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
m_flag |= ACT_FLAG_PLAY_END;
break;
case ACT_ACTION_FLIPPER:
// Convert into a play action and play back to the beginning
float temp = end;
@@ -365,19 +365,19 @@ PyObject *BL_ActionActuator::PyGetChannel(PyObject *value)
PyErr_SetString(PyExc_NotImplementedError, "actuator.getChannel(): Only armatures support channels");
return NULL;
}
if (!string) {
PyErr_SetString(PyExc_TypeError, "expected a single string");
return NULL;
}
bPoseChannel *pchan;
if (m_userpose==NULL && m_pose==NULL) {
BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
}
// BKE_pose_channel_find_name accounts for NULL pose, run on both in case one exists but
// the channel doesnt
if ( !(pchan=BKE_pose_channel_find_name(m_userpose, string)) &&
@@ -388,19 +388,19 @@ PyObject *BL_ActionActuator::PyGetChannel(PyObject *value)
}
PyObject *ret = PyTuple_New(3);
PyObject *list = PyList_New(3);
PyObject *list = PyList_New(3);
PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->loc[0]));
PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->loc[1]));
PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->loc[2]));
PyTuple_SET_ITEM(ret, 0, list);
list = PyList_New(3);
PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->size[0]));
PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->size[1]));
PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->size[2]));
PyTuple_SET_ITEM(ret, 1, list);
list = PyList_New(4);
PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->quat[0]));
PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->quat[1]));
@@ -440,7 +440,7 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
PyErr_SetString(PyExc_NotImplementedError, "actuator.setChannel(): Only armatures support channels");
return NULL;
}
if (PyTuple_Size(args)==2) {
if (!PyArg_ParseTuple(args,"sO:setChannel", &string, &pymat)) // matrix
return NULL;
@@ -453,18 +453,18 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
PyErr_SetString(PyExc_ValueError, "Expected a string and a 4x4 matrix (2 args) or a string and loc/size/quat sequences (4 args)");
return NULL;
}
if (pymat) {
float matrix[4][4];
MT_Matrix4x4 mat;
if (!PyMatTo(pymat, mat))
return NULL;
mat.getValue((float*)matrix);
BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
if (!m_userpose) {
if (!m_pose)
obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
@@ -472,7 +472,7 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
}
// pchan= BKE_pose_channel_verify(m_userpose, string); // adds the channel if its not there.
pchan= BKE_pose_channel_find_name(m_userpose, string); // adds the channel if its not there.
if (pchan) {
copy_v3_v3(pchan->loc, matrix[3]);
mat4_to_size(pchan->size, matrix);
@@ -483,10 +483,10 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
MT_Vector3 loc;
MT_Vector3 size;
MT_Quaternion quat;
if (!PyVecTo(pyloc, loc) || !PyVecTo(pysize, size) || !PyQuatTo(pyquat, quat))
return NULL;
// same as above
if (!m_userpose) {
if (!m_pose)
@@ -495,7 +495,7 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
}
// pchan= BKE_pose_channel_verify(m_userpose, string);
pchan= BKE_pose_channel_find_name(m_userpose, string); // adds the channel if its not there.
// for some reason loc.setValue(pchan->loc) fails
if (pchan) {
pchan->loc[0] = loc[0]; pchan->loc[1] = loc[1]; pchan->loc[2] = loc[2];
@@ -503,12 +503,12 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
pchan->quat[0] = quat[3]; pchan->quat[1] = quat[0]; pchan->quat[2] = quat[1]; pchan->quat[3] = quat[2]; /* notice xyzw -> wxyz is intentional */
}
}
if (pchan==NULL) {
PyErr_SetString(PyExc_ValueError, "Channel could not be found, use the 'channelNames' attribute to get a list of valid channels");
return NULL;
}
Py_RETURN_NONE;
#endif
}
@@ -572,7 +572,7 @@ PyObject *BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUT
int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
if (!PyUnicode_Check(value))
{
PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, expected the string name of the action");
@@ -581,7 +581,7 @@ int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF
bAction *action= NULL;
STR_String val = _PyUnicode_AsString(value);
if (val != "")
{
action= (bAction*)self->GetLogicManager()->GetActionByName(val);
@@ -591,7 +591,7 @@ int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF
return PY_SET_ATTR_FAIL;
}
}
self->SetAction(action);
return PY_SET_ATTR_SUCCESS;
@@ -606,7 +606,7 @@ PyObject *BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA
BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
PyObject *ret= PyList_New(0);
PyObject *item;
if (self->GetParent()->GetGameObjectType() != SCA_IObject::OBJ_ARMATURE)
{
PyErr_SetString(PyExc_NotImplementedError, "actuator.channelNames: Only armatures support channels");
@@ -614,7 +614,7 @@ PyObject *BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA
}
bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose();
if (pose) {
bPoseChannel *pchan;
for (pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
@@ -623,7 +623,7 @@ PyObject *BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA
Py_DECREF(item);
}
}
return ret;
#endif
}
@@ -637,12 +637,12 @@ PyObject *BL_ActionActuator::pyattr_get_use_continue(void *self_v, const KX_PYAT
int BL_ActionActuator::pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
if (PyObject_IsTrue(value))
self->m_flag |= ACT_FLAG_CONTINUE;
else
self->m_flag &= ~ACT_FLAG_CONTINUE;
return PY_SET_ATTR_SUCCESS;
}
@@ -655,9 +655,9 @@ PyObject *BL_ActionActuator::pyattr_get_frame(void *self_v, const KX_PYATTRIBUTE
int BL_ActionActuator::pyattr_set_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
BL_ActionActuator* self = static_cast<BL_ActionActuator*>(self_v);
((KX_GameObject*)self->m_gameobj)->SetActionFrame(self->m_layer, PyFloat_AsDouble(value));
return PY_SET_ATTR_SUCCESS;
}

View File

@@ -37,7 +37,7 @@
#include "DNA_actuator_types.h"
#include "MT_Point3.h"
class BL_ActionActuator : public SCA_IActuator
class BL_ActionActuator : public SCA_IActuator
{
public:
Py_Header
@@ -61,11 +61,11 @@ public:
virtual bool Update(double curtime, bool frame);
virtual CValue* GetReplica();
virtual void ProcessReplica();
void SetBlendTime(float newtime);
void SetLocalTime(float curtime);
void ResetStartTime(float curtime);
bAction* GetAction() { return m_action; }
void SetAction(bAction* act) { m_action= act; }
@@ -112,7 +112,7 @@ public:
}
}
#endif /* WITH_PYTHON */
protected:
MT_Point3 m_lastpos;
float m_blendframe;
@@ -125,7 +125,7 @@ protected:
float m_starttime;
/** The current time of the action */
float m_localtime;
float m_lastUpdate;
float m_blendin;
float m_blendstart;

View File

@@ -41,8 +41,8 @@
/**
* This class is the conversion of the Pose channel constraint.
* It makes a link between the pose constraint and the KX scene.
* The main purpose is to give access to the constraint target
* to link it to a game object.
* The main purpose is to give access to the constraint target
* to link it to a game object.
* It also allows to activate/deactivate constraints during the game.
* Later it will also be possible to create constraint on the fly
*/
@@ -242,18 +242,18 @@ int BL_ArmatureActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBU
BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self);
KX_GameObject* &target = (!strcmp(attrdef->m_name, "target")) ? actuator->m_gametarget : actuator->m_gamesubtarget;
KX_GameObject *gameobj;
if (!ConvertPythonToGameObject(actuator->GetLogicManager(), value, &gameobj, true, "actuator.object = value: BL_ArmatureActuator"))
return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error
if (target != NULL)
target->UnregisterActuator(actuator);
target = gameobj;
if (target)
target->RegisterActuator(actuator);
return PY_SET_ATTR_SUCCESS;
}

View File

@@ -38,8 +38,8 @@
/**
* This class is the conversion of the Pose channel constraint.
* It makes a link between the pose constraint and the KX scene.
* The main purpose is to give access to the constraint target
* to link it to a game object.
* The main purpose is to give access to the constraint target
* to link it to a game object.
* It also allows to activate/deactivate constraints during the game.
* Later it will also be possible to create constraint on the fly
*/
@@ -69,7 +69,7 @@ public:
virtual void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map);
virtual bool Update(double curtime, bool frame);
virtual void ReParent(SCA_IObject* parent);
#ifdef WITH_PYTHON
/* These are used to get and set m_target */

View File

@@ -80,7 +80,7 @@ PyObject *BL_ArmatureChannel::NewProxy(bool py_owns)
#endif // WITH_PYTHON
BL_ArmatureChannel::BL_ArmatureChannel(
BL_ArmatureObject *armature,
BL_ArmatureObject *armature,
bPoseChannel *posechannel)
: PyObjectPlus(), m_posechannel(posechannel), m_armature(armature)
{
@@ -106,7 +106,7 @@ PyAttributeDef BL_ArmatureChannel::Attributes[] = {
// Keep these attributes in order of BCA_ defines!!! used by py_attr_getattr and py_attr_setattr
KX_PYATTRIBUTE_RO_FUNCTION("bone",BL_ArmatureChannel,py_attr_getattr),
KX_PYATTRIBUTE_RO_FUNCTION("parent",BL_ArmatureChannel,py_attr_getattr),
{ NULL } //Sentinel
};
@@ -190,7 +190,7 @@ int BL_ArmatureChannel::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUT
PyErr_SetString(PyExc_AttributeError, "channel is NULL");
return PY_SET_ATTR_FAIL;
}
switch (attr_order) {
default:
break;
@@ -396,13 +396,13 @@ PyTypeObject BL_ArmatureBone::Type = {
};
// not used since this class is never instantiated
PyObject *BL_ArmatureBone::GetProxy()
{
return NULL;
PyObject *BL_ArmatureBone::GetProxy()
{
return NULL;
}
PyObject *BL_ArmatureBone::NewProxy(bool py_owns)
{
return NULL;
PyObject *BL_ArmatureBone::NewProxy(bool py_owns)
{
return NULL;
}
PyObject *BL_ArmatureBone::py_bone_repr(PyObject *self)

View File

@@ -56,7 +56,7 @@ private:
BL_ArmatureObject* m_armature;
public:
BL_ArmatureChannel(class BL_ArmatureObject *armature,
BL_ArmatureChannel(class BL_ArmatureObject *armature,
struct bPoseChannel *posechannel);
virtual ~BL_ArmatureChannel();

View File

@@ -70,9 +70,9 @@ PyObject *BL_ArmatureConstraint::py_repr(void)
#endif // WITH_PYTHON
BL_ArmatureConstraint::BL_ArmatureConstraint(
BL_ArmatureObject *armature,
BL_ArmatureObject *armature,
bPoseChannel *posechannel,
bConstraint *constraint,
bConstraint *constraint,
KX_GameObject* target,
KX_GameObject* subtarget)
: PyObjectPlus(), m_constraint(constraint), m_posechannel(posechannel), m_armature(armature)
@@ -282,7 +282,7 @@ PyAttributeDef BL_ArmatureConstraint::Attributes[] = {
KX_PYATTRIBUTE_RO_FUNCTION("ik_flag",BL_ArmatureConstraint,py_attr_getattr),
KX_PYATTRIBUTE_RW_FUNCTION("ik_dist",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr),
KX_PYATTRIBUTE_RW_FUNCTION("ik_mode",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr),
{ NULL } //Sentinel
};
@@ -368,7 +368,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
PyErr_SetString(PyExc_AttributeError, "constraint is NULL");
return PY_SET_ATTR_FAIL;
}
switch (attr_order) {
case BCA_ENFORCE:
dval = PyFloat_AsDouble(value);

View File

@@ -46,7 +46,7 @@ struct Object;
struct bPose;
/**
* SG_DList : element of controlled constraint list
* SG_DList : element of controlled constraint list
* head = BL_ArmatureObject::m_controlledConstraints
* SG_QList : not used
*/
@@ -69,9 +69,9 @@ private:
struct bPose* m_subpose;
public:
BL_ArmatureConstraint(class BL_ArmatureObject *armature,
struct bPoseChannel *posechannel,
struct bConstraint *constraint,
BL_ArmatureConstraint(class BL_ArmatureObject *armature,
struct bPoseChannel *posechannel,
struct bConstraint *constraint,
KX_GameObject* target,
KX_GameObject* subtarget);
virtual ~BL_ArmatureConstraint();

View File

@@ -67,13 +67,13 @@ extern "C" {
#include "MT_Matrix4x4.h"
/**
/**
* Move here pose function for game engine so that we can mix with GE objects
* Principle is as follow:
* Use Blender structures so that BKE_pose_where_is can be used unchanged
* Copy the constraint so that they can be enabled/disabled/added/removed at runtime
* Don't copy the constraints for the pose used by the Action actuator, it does not need them.
* Scan the constraint structures so that the KX equivalent of target objects are identified and
* Scan the constraint structures so that the KX equivalent of target objects are identified and
* stored in separate list.
* When it is about to evaluate the pose, set the KX object position in the obmat of the corresponding
* Blender objects and restore after the evaluation.
@@ -83,7 +83,7 @@ static void game_copy_pose(bPose **dst, bPose *src, int copy_constraint)
bPose *out;
bPoseChannel *pchan, *outpchan;
GHash *ghash;
/* the game engine copies the current armature pose and then swaps
* the object pose pointer. this makes it possible to change poses
* without affecting the original blender data. */
@@ -97,7 +97,7 @@ static void game_copy_pose(bPose **dst, bPose *src, int copy_constraint)
*dst=NULL;
return;
}
out= (bPose*)MEM_dupallocN(src);
out->chanhash = NULL;
out->agroups.first= out->agroups.last= NULL;
@@ -167,14 +167,14 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode
} else {
dstweight = 1.0f;
}
schan= (bPoseChannel *)src->chanbase.first;
for (dchan = (bPoseChannel *)dst->chanbase.first; dchan; dchan=(bPoseChannel *)dchan->next, schan= (bPoseChannel *)schan->next) {
// always blend on all channels since we don't know which one has been set
/* quat interpolation done separate */
if (schan->rotmode == ROT_MODE_QUAT) {
float dquat[4], squat[4];
copy_qt_qt(dquat, dchan->quat);
copy_qt_qt(squat, schan->quat);
// Normalize quaternions so that interpolation/multiplication result is correct.
@@ -187,7 +187,7 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode
mul_fac_qt_fl(squat, srcweight);
mul_qt_qtqt(dchan->quat, dquat, squat);
}
normalize_qt(dchan->quat);
}
@@ -195,7 +195,7 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode
/* blending for loc and scale are pretty self-explanatory... */
dchan->loc[i] = (dchan->loc[i]*dstweight) + (schan->loc[i]*srcweight);
dchan->size[i] = 1.0f + ((dchan->size[i]-1.0f)*dstweight) + ((schan->size[i]-1.0f)*srcweight);
/* euler-rotation interpolation done here instead... */
// FIXME: are these results decent?
if (schan->rotmode)
@@ -209,14 +209,14 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode
dcon->enforce= dcon->enforce*(1.0f-srcweight) + scon->enforce*srcweight;
}
}
/* this pose is now in src time */
dst->ctime= src->ctime;
}
BL_ArmatureObject::BL_ArmatureObject(
void* sgReplicationInfo,
SG_Callbacks callbacks,
void* sgReplicationInfo,
SG_Callbacks callbacks,
Object *armature,
Scene *scene,
int vert_deform_type)
@@ -375,7 +375,7 @@ void BL_ArmatureObject::LoadChannels()
if (m_poseChannels.Empty()) {
bPoseChannel* pchan;
BL_ArmatureChannel* proxy;
m_channelNumber = 0;
for (pchan = (bPoseChannel *)m_pose->chanbase.first; pchan; pchan=(bPoseChannel *)pchan->next) {
proxy = new BL_ArmatureChannel(this, pchan);
@@ -389,7 +389,7 @@ BL_ArmatureChannel* BL_ArmatureObject::GetChannel(bPoseChannel* pchan)
{
LoadChannels();
SG_DList::iterator<BL_ArmatureChannel> cit(m_poseChannels);
for (cit.begin(); !cit.end(); ++cit)
for (cit.begin(); !cit.end(); ++cit)
{
BL_ArmatureChannel* channel = *cit;
if (channel->m_posechannel == pchan)
@@ -402,7 +402,7 @@ BL_ArmatureChannel* BL_ArmatureObject::GetChannel(const char* str)
{
LoadChannels();
SG_DList::iterator<BL_ArmatureChannel> cit(m_poseChannels);
for (cit.begin(); !cit.end(); ++cit)
for (cit.begin(); !cit.end(); ++cit)
{
BL_ArmatureChannel* channel = *cit;
if (!strcmp(channel->m_posechannel->name, str))
@@ -535,11 +535,11 @@ void BL_ArmatureObject::GetPose(bPose **pose)
{
/* If the caller supplies a null pose, create a new one. */
/* Otherwise, copy the armature's pose channels into the caller-supplied pose */
if (!*pose) {
/* probably not to good of an idea to
* duplicate everything, but it clears up
* a crash and memory leakage when
* duplicate everything, but it clears up
* a crash and memory leakage when
* &BL_ActionActuator::m_pose is freed
*/
game_copy_pose(pose, m_pose, 0);
@@ -674,7 +674,7 @@ PyObject *BL_ArmatureObject::pyattr_get_channels(void *self_v, const KX_PYATTRIB
NULL))->NewProxy(true);
}
KX_PYMETHODDEF_DOC_NOARGS(BL_ArmatureObject, update,
KX_PYMETHODDEF_DOC_NOARGS(BL_ArmatureObject, update,
"update()\n"
"Make sure that the armature will be updated on next graphic frame.\n"
"This is automatically done if a KX_ArmatureActuator with mode run is active\n"

View File

@@ -49,7 +49,7 @@ class MT_Matrix4x4;
struct Object;
class KX_BlenderSceneConverter;
class BL_ArmatureObject : public KX_GameObject
class BL_ArmatureObject : public KX_GameObject
{
Py_Header
public:
@@ -80,11 +80,11 @@ public:
void RestorePose();
bool UpdateTimestep(double curtime);
struct bArmature *GetArmature() { return (bArmature*)m_objArma->data; }
const struct bArmature * GetArmature() const { return (bArmature*)m_objArma->data; }
const struct Scene * GetScene() const { return m_scene; }
Object* GetArmatureObject() {return m_objArma;}
Object* GetOrigArmatureObject() {return m_origObjArma;}
@@ -106,7 +106,7 @@ public:
/// Retrieve the pose matrix for the specified bone.
/// Returns true on success.
bool GetBoneMatrix(Bone* bone, MT_Matrix4x4& matrix);
/// Returns the bone length. The end of the bone is in the local y direction.
float GetBoneLength(Bone* bone) const;
@@ -130,7 +130,7 @@ protected:
Object *m_origObjArma;
struct bPose *m_pose;
struct bPose *m_armpose;
struct Scene *m_scene; // need for BKE_pose_where_is
struct Scene *m_scene; // need for BKE_pose_where_is
double m_lastframe;
double m_timestep; // delta since last pose evaluation.
int m_vert_deform_type;

View File

@@ -185,7 +185,7 @@ static bool default_light_mode = 0;
static std::map<int, SCA_IInputDevice::KX_EnumInputs> create_translate_table()
{
std::map<int, SCA_IInputDevice::KX_EnumInputs> m;
/* The reverse table. In order to not confuse ourselves, we */
/* immediately convert all events that come in to KX codes. */
m[LEFTMOUSE ] = SCA_IInputDevice::KX_LEFTMOUSE;
@@ -195,136 +195,136 @@ static std::map<int, SCA_IInputDevice::KX_EnumInputs> create_translate_table()
m[WHEELDOWNMOUSE ] = SCA_IInputDevice::KX_WHEELDOWNMOUSE;
m[MOUSEX ] = SCA_IInputDevice::KX_MOUSEX;
m[MOUSEY ] = SCA_IInputDevice::KX_MOUSEY;
// TIMERS
m[TIMER0 ] = SCA_IInputDevice::KX_TIMER0;
m[TIMER1 ] = SCA_IInputDevice::KX_TIMER1;
m[TIMER2 ] = SCA_IInputDevice::KX_TIMER2;
// SYSTEM
// TIMERS
m[TIMER0 ] = SCA_IInputDevice::KX_TIMER0;
m[TIMER1 ] = SCA_IInputDevice::KX_TIMER1;
m[TIMER2 ] = SCA_IInputDevice::KX_TIMER2;
// SYSTEM
#if 0
/* **** XXX **** */
m[KEYBD ] = SCA_IInputDevice::KX_KEYBD;
m[RAWKEYBD ] = SCA_IInputDevice::KX_RAWKEYBD;
m[REDRAW ] = SCA_IInputDevice::KX_REDRAW;
m[INPUTCHANGE ] = SCA_IInputDevice::KX_INPUTCHANGE;
m[QFULL ] = SCA_IInputDevice::KX_QFULL;
m[WINFREEZE ] = SCA_IInputDevice::KX_WINFREEZE;
m[WINTHAW ] = SCA_IInputDevice::KX_WINTHAW;
m[WINCLOSE ] = SCA_IInputDevice::KX_WINCLOSE;
m[WINQUIT ] = SCA_IInputDevice::KX_WINQUIT;
m[Q_FIRSTTIME ] = SCA_IInputDevice::KX_Q_FIRSTTIME;
m[KEYBD ] = SCA_IInputDevice::KX_KEYBD;
m[RAWKEYBD ] = SCA_IInputDevice::KX_RAWKEYBD;
m[REDRAW ] = SCA_IInputDevice::KX_REDRAW;
m[INPUTCHANGE ] = SCA_IInputDevice::KX_INPUTCHANGE;
m[QFULL ] = SCA_IInputDevice::KX_QFULL;
m[WINFREEZE ] = SCA_IInputDevice::KX_WINFREEZE;
m[WINTHAW ] = SCA_IInputDevice::KX_WINTHAW;
m[WINCLOSE ] = SCA_IInputDevice::KX_WINCLOSE;
m[WINQUIT ] = SCA_IInputDevice::KX_WINQUIT;
m[Q_FIRSTTIME ] = SCA_IInputDevice::KX_Q_FIRSTTIME;
/* **** XXX **** */
#endif
// standard keyboard
m[AKEY ] = SCA_IInputDevice::KX_AKEY;
m[BKEY ] = SCA_IInputDevice::KX_BKEY;
m[CKEY ] = SCA_IInputDevice::KX_CKEY;
m[DKEY ] = SCA_IInputDevice::KX_DKEY;
m[EKEY ] = SCA_IInputDevice::KX_EKEY;
m[FKEY ] = SCA_IInputDevice::KX_FKEY;
m[GKEY ] = SCA_IInputDevice::KX_GKEY;
m[HKEY ] = SCA_IInputDevice::KX_HKEY;
m[IKEY ] = SCA_IInputDevice::KX_IKEY;
m[JKEY ] = SCA_IInputDevice::KX_JKEY;
m[KKEY ] = SCA_IInputDevice::KX_KKEY;
m[LKEY ] = SCA_IInputDevice::KX_LKEY;
m[MKEY ] = SCA_IInputDevice::KX_MKEY;
m[NKEY ] = SCA_IInputDevice::KX_NKEY;
m[OKEY ] = SCA_IInputDevice::KX_OKEY;
m[PKEY ] = SCA_IInputDevice::KX_PKEY;
m[QKEY ] = SCA_IInputDevice::KX_QKEY;
m[RKEY ] = SCA_IInputDevice::KX_RKEY;
m[SKEY ] = SCA_IInputDevice::KX_SKEY;
m[TKEY ] = SCA_IInputDevice::KX_TKEY;
m[UKEY ] = SCA_IInputDevice::KX_UKEY;
m[VKEY ] = SCA_IInputDevice::KX_VKEY;
m[WKEY ] = SCA_IInputDevice::KX_WKEY;
m[XKEY ] = SCA_IInputDevice::KX_XKEY;
m[YKEY ] = SCA_IInputDevice::KX_YKEY;
m[ZKEY ] = SCA_IInputDevice::KX_ZKEY;
m[ZEROKEY ] = SCA_IInputDevice::KX_ZEROKEY;
m[ONEKEY ] = SCA_IInputDevice::KX_ONEKEY;
m[TWOKEY ] = SCA_IInputDevice::KX_TWOKEY;
m[THREEKEY ] = SCA_IInputDevice::KX_THREEKEY;
m[FOURKEY ] = SCA_IInputDevice::KX_FOURKEY;
m[FIVEKEY ] = SCA_IInputDevice::KX_FIVEKEY;
m[SIXKEY ] = SCA_IInputDevice::KX_SIXKEY;
m[SEVENKEY ] = SCA_IInputDevice::KX_SEVENKEY;
m[EIGHTKEY ] = SCA_IInputDevice::KX_EIGHTKEY;
m[NINEKEY ] = SCA_IInputDevice::KX_NINEKEY;
m[CAPSLOCKKEY ] = SCA_IInputDevice::KX_CAPSLOCKKEY;
m[LEFTCTRLKEY ] = SCA_IInputDevice::KX_LEFTCTRLKEY;
m[LEFTALTKEY ] = SCA_IInputDevice::KX_LEFTALTKEY;
m[RIGHTALTKEY ] = SCA_IInputDevice::KX_RIGHTALTKEY;
m[RIGHTCTRLKEY ] = SCA_IInputDevice::KX_RIGHTCTRLKEY;
m[RIGHTSHIFTKEY ] = SCA_IInputDevice::KX_RIGHTSHIFTKEY;
m[LEFTSHIFTKEY ] = SCA_IInputDevice::KX_LEFTSHIFTKEY;
m[ESCKEY ] = SCA_IInputDevice::KX_ESCKEY;
m[TABKEY ] = SCA_IInputDevice::KX_TABKEY;
m[RETKEY ] = SCA_IInputDevice::KX_RETKEY;
m[SPACEKEY ] = SCA_IInputDevice::KX_SPACEKEY;
m[LINEFEEDKEY ] = SCA_IInputDevice::KX_LINEFEEDKEY;
m[BACKSPACEKEY ] = SCA_IInputDevice::KX_BACKSPACEKEY;
m[DELKEY ] = SCA_IInputDevice::KX_DELKEY;
m[SEMICOLONKEY ] = SCA_IInputDevice::KX_SEMICOLONKEY;
m[PERIODKEY ] = SCA_IInputDevice::KX_PERIODKEY;
m[COMMAKEY ] = SCA_IInputDevice::KX_COMMAKEY;
m[QUOTEKEY ] = SCA_IInputDevice::KX_QUOTEKEY;
m[ACCENTGRAVEKEY ] = SCA_IInputDevice::KX_ACCENTGRAVEKEY;
m[MINUSKEY ] = SCA_IInputDevice::KX_MINUSKEY;
// standard keyboard
m[AKEY ] = SCA_IInputDevice::KX_AKEY;
m[BKEY ] = SCA_IInputDevice::KX_BKEY;
m[CKEY ] = SCA_IInputDevice::KX_CKEY;
m[DKEY ] = SCA_IInputDevice::KX_DKEY;
m[EKEY ] = SCA_IInputDevice::KX_EKEY;
m[FKEY ] = SCA_IInputDevice::KX_FKEY;
m[GKEY ] = SCA_IInputDevice::KX_GKEY;
m[HKEY ] = SCA_IInputDevice::KX_HKEY;
m[IKEY ] = SCA_IInputDevice::KX_IKEY;
m[JKEY ] = SCA_IInputDevice::KX_JKEY;
m[KKEY ] = SCA_IInputDevice::KX_KKEY;
m[LKEY ] = SCA_IInputDevice::KX_LKEY;
m[MKEY ] = SCA_IInputDevice::KX_MKEY;
m[NKEY ] = SCA_IInputDevice::KX_NKEY;
m[OKEY ] = SCA_IInputDevice::KX_OKEY;
m[PKEY ] = SCA_IInputDevice::KX_PKEY;
m[QKEY ] = SCA_IInputDevice::KX_QKEY;
m[RKEY ] = SCA_IInputDevice::KX_RKEY;
m[SKEY ] = SCA_IInputDevice::KX_SKEY;
m[TKEY ] = SCA_IInputDevice::KX_TKEY;
m[UKEY ] = SCA_IInputDevice::KX_UKEY;
m[VKEY ] = SCA_IInputDevice::KX_VKEY;
m[WKEY ] = SCA_IInputDevice::KX_WKEY;
m[XKEY ] = SCA_IInputDevice::KX_XKEY;
m[YKEY ] = SCA_IInputDevice::KX_YKEY;
m[ZKEY ] = SCA_IInputDevice::KX_ZKEY;
m[ZEROKEY ] = SCA_IInputDevice::KX_ZEROKEY;
m[ONEKEY ] = SCA_IInputDevice::KX_ONEKEY;
m[TWOKEY ] = SCA_IInputDevice::KX_TWOKEY;
m[THREEKEY ] = SCA_IInputDevice::KX_THREEKEY;
m[FOURKEY ] = SCA_IInputDevice::KX_FOURKEY;
m[FIVEKEY ] = SCA_IInputDevice::KX_FIVEKEY;
m[SIXKEY ] = SCA_IInputDevice::KX_SIXKEY;
m[SEVENKEY ] = SCA_IInputDevice::KX_SEVENKEY;
m[EIGHTKEY ] = SCA_IInputDevice::KX_EIGHTKEY;
m[NINEKEY ] = SCA_IInputDevice::KX_NINEKEY;
m[CAPSLOCKKEY ] = SCA_IInputDevice::KX_CAPSLOCKKEY;
m[LEFTCTRLKEY ] = SCA_IInputDevice::KX_LEFTCTRLKEY;
m[LEFTALTKEY ] = SCA_IInputDevice::KX_LEFTALTKEY;
m[RIGHTALTKEY ] = SCA_IInputDevice::KX_RIGHTALTKEY;
m[RIGHTCTRLKEY ] = SCA_IInputDevice::KX_RIGHTCTRLKEY;
m[RIGHTSHIFTKEY ] = SCA_IInputDevice::KX_RIGHTSHIFTKEY;
m[LEFTSHIFTKEY ] = SCA_IInputDevice::KX_LEFTSHIFTKEY;
m[ESCKEY ] = SCA_IInputDevice::KX_ESCKEY;
m[TABKEY ] = SCA_IInputDevice::KX_TABKEY;
m[RETKEY ] = SCA_IInputDevice::KX_RETKEY;
m[SPACEKEY ] = SCA_IInputDevice::KX_SPACEKEY;
m[LINEFEEDKEY ] = SCA_IInputDevice::KX_LINEFEEDKEY;
m[BACKSPACEKEY ] = SCA_IInputDevice::KX_BACKSPACEKEY;
m[DELKEY ] = SCA_IInputDevice::KX_DELKEY;
m[SEMICOLONKEY ] = SCA_IInputDevice::KX_SEMICOLONKEY;
m[PERIODKEY ] = SCA_IInputDevice::KX_PERIODKEY;
m[COMMAKEY ] = SCA_IInputDevice::KX_COMMAKEY;
m[QUOTEKEY ] = SCA_IInputDevice::KX_QUOTEKEY;
m[ACCENTGRAVEKEY ] = SCA_IInputDevice::KX_ACCENTGRAVEKEY;
m[MINUSKEY ] = SCA_IInputDevice::KX_MINUSKEY;
m[PLUSKEY ] = SCA_IInputDevice::KX_PLUSKEY;
m[SLASHKEY ] = SCA_IInputDevice::KX_SLASHKEY;
m[BACKSLASHKEY ] = SCA_IInputDevice::KX_BACKSLASHKEY;
m[EQUALKEY ] = SCA_IInputDevice::KX_EQUALKEY;
m[LEFTBRACKETKEY ] = SCA_IInputDevice::KX_LEFTBRACKETKEY;
m[RIGHTBRACKETKEY ] = SCA_IInputDevice::KX_RIGHTBRACKETKEY;
m[LEFTARROWKEY ] = SCA_IInputDevice::KX_LEFTARROWKEY;
m[DOWNARROWKEY ] = SCA_IInputDevice::KX_DOWNARROWKEY;
m[RIGHTARROWKEY ] = SCA_IInputDevice::KX_RIGHTARROWKEY;
m[UPARROWKEY ] = SCA_IInputDevice::KX_UPARROWKEY;
m[PAD2 ] = SCA_IInputDevice::KX_PAD2;
m[PAD4 ] = SCA_IInputDevice::KX_PAD4;
m[PAD6 ] = SCA_IInputDevice::KX_PAD6;
m[PAD8 ] = SCA_IInputDevice::KX_PAD8;
m[PAD1 ] = SCA_IInputDevice::KX_PAD1;
m[PAD3 ] = SCA_IInputDevice::KX_PAD3;
m[PAD5 ] = SCA_IInputDevice::KX_PAD5;
m[PAD7 ] = SCA_IInputDevice::KX_PAD7;
m[PAD9 ] = SCA_IInputDevice::KX_PAD9;
m[PADPERIOD ] = SCA_IInputDevice::KX_PADPERIOD;
m[PADSLASHKEY ] = SCA_IInputDevice::KX_PADSLASHKEY;
m[PADASTERKEY ] = SCA_IInputDevice::KX_PADASTERKEY;
m[PAD0 ] = SCA_IInputDevice::KX_PAD0;
m[PADMINUS ] = SCA_IInputDevice::KX_PADMINUS;
m[PADENTER ] = SCA_IInputDevice::KX_PADENTER;
m[PADPLUSKEY ] = SCA_IInputDevice::KX_PADPLUSKEY;
m[F1KEY ] = SCA_IInputDevice::KX_F1KEY;
m[F2KEY ] = SCA_IInputDevice::KX_F2KEY;
m[F3KEY ] = SCA_IInputDevice::KX_F3KEY;
m[F4KEY ] = SCA_IInputDevice::KX_F4KEY;
m[F5KEY ] = SCA_IInputDevice::KX_F5KEY;
m[F6KEY ] = SCA_IInputDevice::KX_F6KEY;
m[F7KEY ] = SCA_IInputDevice::KX_F7KEY;
m[F8KEY ] = SCA_IInputDevice::KX_F8KEY;
m[F9KEY ] = SCA_IInputDevice::KX_F9KEY;
m[F10KEY ] = SCA_IInputDevice::KX_F10KEY;
m[F11KEY ] = SCA_IInputDevice::KX_F11KEY;
m[BACKSLASHKEY ] = SCA_IInputDevice::KX_BACKSLASHKEY;
m[EQUALKEY ] = SCA_IInputDevice::KX_EQUALKEY;
m[LEFTBRACKETKEY ] = SCA_IInputDevice::KX_LEFTBRACKETKEY;
m[RIGHTBRACKETKEY ] = SCA_IInputDevice::KX_RIGHTBRACKETKEY;
m[LEFTARROWKEY ] = SCA_IInputDevice::KX_LEFTARROWKEY;
m[DOWNARROWKEY ] = SCA_IInputDevice::KX_DOWNARROWKEY;
m[RIGHTARROWKEY ] = SCA_IInputDevice::KX_RIGHTARROWKEY;
m[UPARROWKEY ] = SCA_IInputDevice::KX_UPARROWKEY;
m[PAD2 ] = SCA_IInputDevice::KX_PAD2;
m[PAD4 ] = SCA_IInputDevice::KX_PAD4;
m[PAD6 ] = SCA_IInputDevice::KX_PAD6;
m[PAD8 ] = SCA_IInputDevice::KX_PAD8;
m[PAD1 ] = SCA_IInputDevice::KX_PAD1;
m[PAD3 ] = SCA_IInputDevice::KX_PAD3;
m[PAD5 ] = SCA_IInputDevice::KX_PAD5;
m[PAD7 ] = SCA_IInputDevice::KX_PAD7;
m[PAD9 ] = SCA_IInputDevice::KX_PAD9;
m[PADPERIOD ] = SCA_IInputDevice::KX_PADPERIOD;
m[PADSLASHKEY ] = SCA_IInputDevice::KX_PADSLASHKEY;
m[PADASTERKEY ] = SCA_IInputDevice::KX_PADASTERKEY;
m[PAD0 ] = SCA_IInputDevice::KX_PAD0;
m[PADMINUS ] = SCA_IInputDevice::KX_PADMINUS;
m[PADENTER ] = SCA_IInputDevice::KX_PADENTER;
m[PADPLUSKEY ] = SCA_IInputDevice::KX_PADPLUSKEY;
m[F1KEY ] = SCA_IInputDevice::KX_F1KEY;
m[F2KEY ] = SCA_IInputDevice::KX_F2KEY;
m[F3KEY ] = SCA_IInputDevice::KX_F3KEY;
m[F4KEY ] = SCA_IInputDevice::KX_F4KEY;
m[F5KEY ] = SCA_IInputDevice::KX_F5KEY;
m[F6KEY ] = SCA_IInputDevice::KX_F6KEY;
m[F7KEY ] = SCA_IInputDevice::KX_F7KEY;
m[F8KEY ] = SCA_IInputDevice::KX_F8KEY;
m[F9KEY ] = SCA_IInputDevice::KX_F9KEY;
m[F10KEY ] = SCA_IInputDevice::KX_F10KEY;
m[F11KEY ] = SCA_IInputDevice::KX_F11KEY;
m[F12KEY ] = SCA_IInputDevice::KX_F12KEY;
m[F13KEY ] = SCA_IInputDevice::KX_F13KEY;
m[F14KEY ] = SCA_IInputDevice::KX_F14KEY;
@@ -336,11 +336,11 @@ static std::map<int, SCA_IInputDevice::KX_EnumInputs> create_translate_table()
m[OSKEY ] = SCA_IInputDevice::KX_OSKEY;
m[PAUSEKEY ] = SCA_IInputDevice::KX_PAUSEKEY;
m[INSERTKEY ] = SCA_IInputDevice::KX_INSERTKEY;
m[HOMEKEY ] = SCA_IInputDevice::KX_HOMEKEY;
m[PAGEUPKEY ] = SCA_IInputDevice::KX_PAGEUPKEY;
m[PAGEDOWNKEY ] = SCA_IInputDevice::KX_PAGEDOWNKEY;
m[PAUSEKEY ] = SCA_IInputDevice::KX_PAUSEKEY;
m[INSERTKEY ] = SCA_IInputDevice::KX_INSERTKEY;
m[HOMEKEY ] = SCA_IInputDevice::KX_HOMEKEY;
m[PAGEUPKEY ] = SCA_IInputDevice::KX_PAGEUPKEY;
m[PAGEDOWNKEY ] = SCA_IInputDevice::KX_PAGEDOWNKEY;
m[ENDKEY ] = SCA_IInputDevice::KX_ENDKEY;
return m;
@@ -360,13 +360,13 @@ static unsigned int KX_rgbaint2uint_new(unsigned int icol)
unsigned int integer;
unsigned char cp[4];
} out_color, in_color;
in_color.integer = icol;
out_color.cp[0] = in_color.cp[3]; // red
out_color.cp[1] = in_color.cp[2]; // green
out_color.cp[2] = in_color.cp[1]; // blue
out_color.cp[3] = in_color.cp[0]; // alpha
return out_color.integer;
}
@@ -386,7 +386,7 @@ static unsigned int KX_Mcol2uint_new(MCol col)
out_color.cp[1] = in_color.cp[2]; // green
out_color.cp[2] = in_color.cp[1]; // blue
out_color.cp[3] = in_color.cp[0]; // alpha
return out_color.integer;
}
@@ -487,19 +487,19 @@ static void GetUVs(BL_Material *material, MTF_localLayer *layers, MFace *mface,
int unit = 0;
if (tface)
{
uvs[0][0].setValue(tface->uv[0]);
uvs[1][0].setValue(tface->uv[1]);
uvs[2][0].setValue(tface->uv[2]);
if (mface->v4)
if (mface->v4)
uvs[3][0].setValue(tface->uv[3]);
}
else
{
uvs[0][0] = uvs[1][0] = uvs[2][0] = uvs[3][0] = MT_Point2(0.f, 0.f);
}
vector<STR_String> found_layers;
for (int vind = 0; vind<MAXTEX; vind++)
@@ -513,12 +513,12 @@ static void GetUVs(BL_Material *material, MTF_localLayer *layers, MFace *mface,
//If no UVSet is specified, try grabbing one from the UV/Image editor
if (map.uvCoName.IsEmpty() && tface)
{
{
uvs[0][unit].setValue(tface->uv[0]);
uvs[1][unit].setValue(tface->uv[1]);
uvs[2][unit].setValue(tface->uv[2]);
if (mface->v4)
if (mface->v4)
uvs[3][unit].setValue(tface->uv[3]);
++unit;
@@ -537,7 +537,7 @@ static void GetUVs(BL_Material *material, MTF_localLayer *layers, MFace *mface,
uvs[1][unit].setValue(layer.face->uv[1]);
uvs[2][unit].setValue(layer.face->uv[2]);
if (mface->v4)
if (mface->v4)
uvs[3][unit].setValue(layer.face->uv[3]);
else
uvs[3][unit].setValue(0.0f, 0.0f);
@@ -565,7 +565,7 @@ static bool ConvertMaterial(
const bool validmat = (mat != NULL);
const bool validface = (tface != NULL);
const bool use_vcol = GetMaterialUseVColor(mat, glslmat);
material->IdMode = DEFAULT_BLENDER;
material->glslmat = (validmat) ? glslmat: false;
material->materialindex = mface->mat_nr;
@@ -685,7 +685,7 @@ static bool ConvertMaterial(
if (mat->septex & (1 << i)) {
// If this texture slot isn't in use, set it to disabled to prevent multi-uv problems
material->mapping[i].mapping = DISABLE;
}
}
else {
material->mapping[i].mapping |= (mttmp->texco & TEXCO_REFL) ? USEREFL : 0;
@@ -728,7 +728,7 @@ static bool ConvertMaterial(
material->mapping[i].projplane[2] = mttmp->projz;
}
/// --------------------------------
switch (mttmp->blendtype) {
case MTEX_BLEND:
material->blend_mode[i] = BLEND_MIX;
@@ -913,10 +913,10 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
if (ma && (ma->mode & MA_FACETEXTURE) == 0)
converter->CachePolyMaterial(scene, ma, polymat);
}
// see if a bucket was reused or a new one was created
// this way only one KX_BlenderMaterial object has to exist per bucket
bool bucketCreated;
bool bucketCreated;
RAS_MaterialBucket* bucket = scene->FindBucket(polymat, bucketCreated);
// this is needed to free up memory afterwards.
@@ -1087,7 +1087,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
/* mark face as flat, so vertices are split */
bool flat = (mface->flag & ME_SMOOTH) == 0;
int nverts = (mface->v4)? 4: 3;
RAS_Polygon *poly = meshobj->AddPolygon(bucket, nverts);
@@ -1105,7 +1105,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
meshobj->AddVertex(poly,3,pt[3],uvs[3],tan[3],rgb[3],no[3],flat,mface->v4);
}
if (tface)
if (tface)
tface++;
if (mcol)
mcol+=4;
@@ -1134,27 +1134,27 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
if (layers)
delete []layers;
dm->release(dm);
converter->RegisterGameMesh(meshobj, mesh);
return meshobj;
}
static PHY_MaterialProps *CreateMaterialFromBlenderObject(struct Object* blenderobject)
{
PHY_MaterialProps *materialProps = new PHY_MaterialProps;
MT_assert(materialProps && "Create physics material properties failed");
Material* blendermat = give_current_material(blenderobject, 1);
if (blendermat)
{
MT_assert(0.0f <= blendermat->reflect && blendermat->reflect <= 1.0f);
materialProps->m_restitution = blendermat->reflect;
materialProps->m_friction = blendermat->friction;
materialProps->m_fh_spring = blendermat->fh;
@@ -1172,38 +1172,38 @@ static PHY_MaterialProps *CreateMaterialFromBlenderObject(struct Object* blender
materialProps->m_fh_normal = false;
}
return materialProps;
}
static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blenderobject)
{
PHY_ShapeProps *shapeProps = new PHY_ShapeProps;
MT_assert(shapeProps);
shapeProps->m_mass = blenderobject->mass;
// This needs to be fixed in blender. For now, we use:
// in Blender, inertia stands for the size value which is equivalent to
// the sphere radius
shapeProps->m_inertia = blenderobject->formfactor;
MT_assert(0.0f <= blenderobject->damping && blenderobject->damping <= 1.0f);
MT_assert(0.0f <= blenderobject->rdamping && blenderobject->rdamping <= 1.0f);
shapeProps->m_lin_drag = 1.0f - blenderobject->damping;
shapeProps->m_ang_drag = 1.0f - blenderobject->rdamping;
shapeProps->m_friction_scaling[0] = blenderobject->anisotropicFriction[0];
shapeProps->m_friction_scaling[0] = blenderobject->anisotropicFriction[0];
shapeProps->m_friction_scaling[1] = blenderobject->anisotropicFriction[1];
shapeProps->m_friction_scaling[2] = blenderobject->anisotropicFriction[2];
shapeProps->m_do_anisotropic = ((blenderobject->gameflag & OB_ANISOTROPIC_FRICTION) != 0);
shapeProps->m_do_fh = (blenderobject->gameflag & OB_DO_FH) != 0;
shapeProps->m_do_fh = (blenderobject->gameflag & OB_DO_FH) != 0;
shapeProps->m_do_rot_fh = (blenderobject->gameflag & OB_ROT_FH) != 0;
// velocity clamping XXX
shapeProps->m_clamp_vel_min = blenderobject->min_vel;
shapeProps->m_clamp_vel_max = blenderobject->max_vel;
@@ -1219,12 +1219,12 @@ static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blendero
return shapeProps;
}
//////////////////////////////////////////////////////////
static float my_boundbox_mesh(Mesh *me, float *loc, float *size)
@@ -1235,36 +1235,36 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size)
float mloc[3], msize[3];
float radius_sq=0.0f, vert_radius_sq, *co;
int a;
if (me->bb==0) {
me->bb = BKE_boundbox_alloc_unit();
}
bb= me->bb;
INIT_MINMAX(min, max);
if (!loc) loc= mloc;
if (!size) size= msize;
mvert= me->mvert;
for (a = 0; a<me->totvert; a++, mvert++) {
co = mvert->co;
/* bounds */
minmax_v3v3_v3(min, max, co);
/* radius */
vert_radius_sq = len_squared_v3(co);
if (vert_radius_sq > radius_sq)
radius_sq = vert_radius_sq;
}
if (me->totvert) {
loc[0] = (min[0] + max[0]) / 2.0f;
loc[1] = (min[1] + max[1]) / 2.0f;
loc[2] = (min[2] + max[2]) / 2.0f;
size[0] = (max[0] - min[0]) / 2.0f;
size[1] = (max[1] - min[1]) / 2.0f;
size[2] = (max[2] - min[2]) / 2.0f;
@@ -1273,10 +1273,10 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size)
loc[0] = loc[1] = loc[2] = 0.0f;
size[0] = size[1] = size[2] = 0.0f;
}
bb->vec[0][0] = bb->vec[1][0] = bb->vec[2][0] = bb->vec[3][0] = loc[0]-size[0];
bb->vec[4][0] = bb->vec[5][0] = bb->vec[6][0] = bb->vec[7][0] = loc[0]+size[0];
bb->vec[0][1] = bb->vec[1][1] = bb->vec[4][1] = bb->vec[5][1] = loc[1]-size[1];
bb->vec[2][1] = bb->vec[3][1] = bb->vec[6][1] = bb->vec[7][1] = loc[1]+size[1];
@@ -1377,8 +1377,8 @@ static void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
PHY_ShapeProps* shapeprops =
CreateShapePropsFromBlenderObject(blenderobject);
PHY_MaterialProps* smmaterial =
PHY_MaterialProps* smmaterial =
CreateMaterialFromBlenderObject(blenderobject);
DerivedMesh* dm = NULL;
@@ -1415,7 +1415,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l
{
RAS_ILightObject *lightobj = rasterizer->CreateLight();
KX_LightObject *gamelight;
lightobj->m_att1 = la->att1;
lightobj->m_att2 = (la->mode & LA_QUAD) ? la->att2 : 0.0f;
lightobj->m_coeff_const = la->coeff_const;
@@ -1438,10 +1438,10 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l
lightobj->m_layer = layerflag;
lightobj->m_spotblend = la->spotblend;
lightobj->m_spotsize = la->spotsize;
lightobj->m_nodiffuse = (la->mode & LA_NO_DIFF) != 0;
lightobj->m_nospecular = (la->mode & LA_NO_SPEC) != 0;
bool glslmat = converter->GetGLSLMaterials();
// in GLSL NEGATIVE LAMP is handled inside the lamp update function
@@ -1453,7 +1453,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l
lightobj->m_color[2] = -lightobj->m_color[2];
}
}
if (la->type==LA_SUN) {
lightobj->m_type = RAS_ILightObject::LIGHT_SUN;
} else if (la->type==LA_SPOT) {
@@ -1464,7 +1464,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l
gamelight = new KX_LightObject(kxscene, KX_Scene::m_callbacks, rasterizer,
lightobj, glslmat);
return gamelight;
}
@@ -1473,29 +1473,29 @@ static KX_Camera *gamecamera_from_bcamera(Object *ob, KX_Scene *kxscene, KX_Blen
Camera* ca = static_cast<Camera*>(ob->data);
RAS_CameraData camdata(ca->lens, ca->ortho_scale, ca->sensor_x, ca->sensor_y, ca->sensor_fit, ca->shiftx, ca->shifty, ca->clipsta, ca->clipend, ca->type == CAM_PERSP, ca->YF_dofdist);
KX_Camera *gamecamera;
gamecamera= new KX_Camera(kxscene, KX_Scene::m_callbacks, camdata);
gamecamera->SetName(ca->id.name + 2);
return gamecamera;
}
static KX_GameObject *gameobject_from_blenderobject(
Object *ob,
KX_Scene *kxscene,
Object *ob,
KX_Scene *kxscene,
RAS_IRasterizer *rendertools,
KX_BlenderSceneConverter *converter,
bool libloading)
bool libloading)
{
KX_GameObject *gameobj = NULL;
Scene *blenderscene = kxscene->GetBlenderScene();
switch (ob->type) {
case OB_LAMP:
{
KX_LightObject* gamelight = gamelight_from_blamp(ob, static_cast<Lamp*>(ob->data), ob->lay, kxscene, rendertools, converter);
gameobj = gamelight;
if (blenderscene->lay & ob->lay)
{
gamelight->AddRef();
@@ -1504,26 +1504,26 @@ static KX_GameObject *gameobject_from_blenderobject(
break;
}
case OB_CAMERA:
{
KX_Camera* gamecamera = gamecamera_from_bcamera(ob, kxscene, converter);
gameobj = gamecamera;
//don't add a reference: the camera list in kxscene->m_cameras is not released at the end
//gamecamera->AddRef();
kxscene->AddCamera(gamecamera);
break;
}
case OB_MESH:
{
Mesh* mesh = static_cast<Mesh*>(ob->data);
float center[3], extents[3];
float radius = my_boundbox_mesh((Mesh*) ob->data, center, extents);
RAS_MeshObject* meshobj = BL_ConvertMesh(mesh,ob,kxscene,converter, libloading);
// needed for python scripting
kxscene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj);
@@ -1535,7 +1535,7 @@ static KX_GameObject *gameobject_from_blenderobject(
}
gameobj = new BL_DeformableGameObject(ob,kxscene,KX_Scene::m_callbacks);
// set transformation
gameobj->AddMesh(meshobj);
@@ -1560,10 +1560,10 @@ static KX_GameObject *gameobject_from_blenderobject(
kxscene->SetLodHysteresisValue(blenderscene->gm.scehysteresis);
}
}
// for all objects: check whether they want to
// respond to updates
bool ignoreActivityCulling =
bool ignoreActivityCulling =
((ob->gameflag2 & OB_NEVER_DO_ACTIVITY_CULLING)!=0);
gameobj->SetIgnoreActivityCulling(ignoreActivityCulling);
gameobj->SetOccluder((ob->gameflag & OB_OCCLUDER) != 0, false);
@@ -1572,7 +1572,7 @@ static KX_GameObject *gameobject_from_blenderobject(
// that requires it
Material *mat= NULL;
bool bUseObjectColor=false;
for (int i=0;i<mesh->totcol;i++) {
mat=mesh->mat[i];
if (!mat) break;
@@ -1583,7 +1583,7 @@ static KX_GameObject *gameobject_from_blenderobject(
}
if (bUseObjectColor)
gameobj->SetObjectColor(ob->col);
// two options exists for deform: shape keys and armature
// only support relative shape key
bool bHasShapeKey = mesh->key != NULL && mesh->key->type==KEY_RELATIVE;
@@ -1598,8 +1598,8 @@ static KX_GameObject *gameobject_from_blenderobject(
kxscene->GetBlenderScene(), ob, meshobj);
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
} else if (bHasShapeKey) {
// not that we can have shape keys without dvert!
BL_ShapeDeformer *dcont = new BL_ShapeDeformer((BL_DeformableGameObject*)gameobj,
// not that we can have shape keys without dvert!
BL_ShapeDeformer *dcont = new BL_ShapeDeformer((BL_DeformableGameObject*)gameobj,
ob, meshobj);
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
} else if (bHasArmature) {
@@ -1619,16 +1619,16 @@ static KX_GameObject *gameobject_from_blenderobject(
((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont);
#endif
}
MT_Point3 min = MT_Point3(center) - MT_Vector3(extents);
MT_Point3 max = MT_Point3(center) + MT_Vector3(extents);
SG_BBox bbox = SG_BBox(min, max);
gameobj->GetSGNode()->SetBBox(bbox);
gameobj->GetSGNode()->SetRadius(radius);
break;
}
case OB_ARMATURE:
{
bArmature *arm = (bArmature*)ob->data;
@@ -1642,7 +1642,7 @@ static KX_GameObject *gameobject_from_blenderobject(
/* Get the current pose from the armature object and apply it as the rest pose */
break;
}
case OB_EMPTY:
{
gameobj = new KX_EmptyObject(kxscene,KX_Scene::m_callbacks);
@@ -1672,7 +1672,7 @@ static KX_GameObject *gameobject_from_blenderobject(
#endif
}
if (gameobj)
if (gameobj)
{
gameobj->SetLayer(ob->lay);
gameobj->SetBlenderObject(ob);
@@ -1691,13 +1691,13 @@ static bPoseChannel *get_active_posechannel2(Object *ob)
{
bArmature *arm= (bArmature*)ob->data;
bPoseChannel *pchan;
/* find active */
for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if (pchan->bone && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer))
return pchan;
}
return NULL;
}
@@ -1707,14 +1707,14 @@ static ListBase *get_active_constraints2(Object *ob)
return NULL;
// XXX - shouldnt we care about the pose data and not the mode???
if (ob->mode & OB_MODE_POSE) {
if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
pchan = get_active_posechannel2(ob);
if (pchan)
return &pchan->constraints;
}
else
else
return &ob->constraints;
return NULL;
@@ -1753,7 +1753,7 @@ static KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist)
if (gameobje->GetName()==busc)
return gameobje;
}
return 0;
}
@@ -1945,11 +1945,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
} else {
frame_type = RAS_FrameSettings::e_frame_scale;
}
aspect_width = (int)(blenderscene->r.xsch * blenderscene->r.xasp);
aspect_height = (int)(blenderscene->r.ysch * blenderscene->r.yasp);
}
RAS_FrameSettings frame_settings(
frame_type,
blenderscene->gm.framing.col[0],
@@ -1961,33 +1961,33 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
kxscene->SetFramingType(frame_settings);
kxscene->SetGravity(MT_Vector3(0,0, -blenderscene->gm.gravity));
/* set activity culling parameters */
kxscene->SetActivityCulling( (blenderscene->gm.mode & WO_ACTIVITY_CULLING) != 0);
kxscene->SetActivityCullingRadius(blenderscene->gm.activityBoxRadius);
kxscene->SetDbvtCulling((blenderscene->gm.mode & WO_DBVT_CULLING) != 0);
// no occlusion culling by default
kxscene->SetDbvtOcclusionRes(0);
int activeLayerBitInfo = blenderscene->lay;
// list of all object converted, active and inactive
CListValue* sumolist = new CListValue();
vector<parentChildLink> vec_parent_child;
CListValue* objectlist = kxscene->GetObjectList();
CListValue* inactivelist = kxscene->GetInactiveList();
CListValue* parentlist = kxscene->GetRootParentList();
SCA_LogicManager* logicmgr = kxscene->GetLogicManager();
SCA_TimeEventManager* timemgr = kxscene->GetTimeEventManager();
CListValue* logicbrick_conversionlist = new CListValue();
//SG_TreeFactory tf;
// Convert actions to actionmap
bAction *curAct;
for (curAct = (bAction*)maggie->action.first; curAct; curAct=(bAction*)curAct->id.next)
@@ -2009,9 +2009,9 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
allblobj.insert(blenderobject);
KX_GameObject* gameobj = gameobject_from_blenderobject(
base->object,
kxscene,
rendertools,
base->object,
kxscene,
rendertools,
converter,
libloading);
@@ -2061,9 +2061,9 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
allblobj.insert(blenderobject);
groupobj.insert(blenderobject);
KX_GameObject* gameobj = gameobject_from_blenderobject(
blenderobject,
kxscene,
rendertools,
blenderobject,
kxscene,
rendertools,
converter,
libloading);
@@ -2097,7 +2097,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
// non-camera objects not supported as camera currently
if (blenderscene->camera && blenderscene->camera->type == OB_CAMERA) {
KX_Camera *gamecamera= (KX_Camera*) converter->FindGameObject(blenderscene->camera);
if (gamecamera)
kxscene->SetActiveCamera(gamecamera);
}
@@ -2109,7 +2109,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
Object* blenderobj = *oit;
if (blenderobj->type==OB_MESH) {
Mesh *me = (Mesh*)blenderobj->data;
if (me->dvert) {
BL_DeformableGameObject *obj = (BL_DeformableGameObject*)converter->FindGameObject(blenderobj);
@@ -2121,14 +2121,14 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
}
}
}
// create hierarchy information
int i;
vector<parentChildLink>::iterator pcit;
for (pcit = vec_parent_child.begin();!(pcit==vec_parent_child.end());++pcit)
{
struct Object* blenderchild = pcit->m_blenderchild;
struct Object* blenderparent = blenderchild->parent;
KX_GameObject* parentobj = converter->FindGameObject(blenderparent);
@@ -2138,7 +2138,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
if (!parentobj || objectlist->SearchValue(childobj) != objectlist->SearchValue(parentobj))
{
// special case: the parent and child object are not in the same layer.
// special case: the parent and child object are not in the same layer.
// This weird situation is used in Apricot for test purposes.
// Resolve it by not converting the child
childobj->GetSGNode()->DisconnectFromParent();
@@ -2158,11 +2158,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
obj->Release();
}
childrenlist->Release();
// now destroy recursively
converter->UnregisterGameObject(childobj); // removing objects during conversion make sure this runs too
kxscene->RemoveObject(childobj);
continue;
}
@@ -2192,7 +2192,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
KX_BoneParentRelation *bone_parent_relation = KX_BoneParentRelation::New(parent_bone);
pcit->m_gamechildnode->SetParentRelation(bone_parent_relation);
}
break;
}
case PARSKEL: // skinned - ignore
@@ -2203,11 +2203,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
// unhandled
break;
}
parentobj-> GetSGNode()->AddChild(pcit->m_gamechildnode);
}
vec_parent_child.clear();
// find 'root' parents (object that has not parents in SceneGraph)
for (i=0;i<sumolist->GetCount();++i)
{
@@ -2226,7 +2226,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
for (i=0; i<sumolist->GetCount();i++)
{
KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i);
if (gameobj->GetMeshCount() > 0)
if (gameobj->GetMeshCount() > 0)
{
MT_Point3 box[2];
gameobj->GetSGNode()->BBox().getmm(box, MT_Transform::Identity());
@@ -2322,7 +2322,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
continue;
bRigidBodyJointConstraint *dat = (bRigidBodyJointConstraint *)curcon->data;
/* Skip if no target or a child object is selected or constraints are deactivated */
if (!dat->tar || dat->child || (curcon->flag & CONSTRAINT_OFF))
continue;
@@ -2336,7 +2336,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
if (libloading)
continue;
/* Skipped already converted constraints.
/* Skipped already converted constraints.
* This will happen when a group instance is made from a linked group instance
* and both are on the active layer. */
if (bl_isConstraintInList(gameobj, convertedlist))
@@ -2356,7 +2356,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
set<KX_GameObject*>::iterator gobit;
for (gobit = convertedlist.begin(); gobit != convertedlist.end(); gobit++)
(*gobit)->Release();
convertedlist.clear();
sumolist->Release();
@@ -2440,7 +2440,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
}
logicbrick_conversionlist->Release();
// Calculate the scene btree -
// too slow - commented out.
//kxscene->SetNodeTree(tf.MakeTree());

View File

@@ -45,8 +45,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
class KX_KetsjiEngine* ketsjiEngine,
e_PhysicsEngine physics_engine,
class RAS_IRasterizer* rendertools,
class RAS_ICanvas* canvas,
class KX_BlenderSceneConverter* sceneconverter,
class RAS_ICanvas* canvas,
class KX_BlenderSceneConverter* sceneconverter,
bool alwaysUseExpandFraming,
bool libloading=false
);

View File

@@ -73,7 +73,7 @@ bool BL_DeformableGameObject::SetActiveAction(BL_ShapeActionActuator *act, short
m_activeAct = act;
m_activePriority = priority;
m_lastframe = curtime;
return true;
}
else {
@@ -91,7 +91,7 @@ bool BL_DeformableGameObject::GetShape(vector<float> &shape)
// this check is normally superfluous: a shape deformer can only be created if the mesh
// has relative keys
Key* key = shape_deformer->GetKey();
if (key && key->type==KEY_RELATIVE)
if (key && key->type==KEY_RELATIVE)
{
KeyBlock *kb;
for (kb = (KeyBlock *)key->block.first; kb; kb = (KeyBlock *)kb->next)

View File

@@ -45,7 +45,7 @@
class BL_ShapeActionActuator;
struct Key;
class BL_DeformableGameObject : public KX_GameObject
class BL_DeformableGameObject : public KX_GameObject
{
public:
CValue* GetReplica();
@@ -80,7 +80,7 @@ public:
bool SetActiveAction(class BL_ShapeActionActuator *act, short priority, double curtime);
bool GetShape(vector<float> &shape);
virtual void SetDeformer(class RAS_Deformer* deformer);
virtual class RAS_Deformer* GetDeformer()
{
@@ -88,9 +88,9 @@ public:
}
public:
protected:
RAS_Deformer *m_pDeformer;
class BL_ShapeActionActuator *m_activeAct;

View File

@@ -89,7 +89,7 @@ BL_MeshDeformer::~BL_MeshDeformer()
if (m_transnors)
delete [] m_transnors;
}
void BL_MeshDeformer::ProcessReplica()
{
m_transverts = NULL;
@@ -146,7 +146,7 @@ void BL_MeshDeformer::RecalcNormals()
const float *co2 = m_transverts[v2.getOrigIndex()];
const float *co3 = m_transverts[v3.getOrigIndex()];
const float *co4 = NULL;
/* compute face normal */
float fnor[3], n1[3], n2[3];
@@ -230,7 +230,7 @@ void BL_MeshDeformer::VerifyStorage()
delete [] m_transverts;
if (m_transnors)
delete [] m_transnors;
m_transverts=new float[m_bmesh->totvert][3];
m_transnors=new float[m_bmesh->totvert][3];
m_tvtot = m_bmesh->totvert;

View File

@@ -77,12 +77,12 @@ public:
protected:
class RAS_MeshObject* m_pMeshObject;
struct Mesh* m_bmesh;
// this is so m_transverts doesn't need to be converted
// before deformation
float (*m_transverts)[3];
float (*m_transnors)[3];
struct Object* m_objMesh;
struct Object* m_objMesh;
// --
int m_tvtot;
BL_DeformableGameObject* m_gameobj;

View File

@@ -136,7 +136,7 @@ struct DerivedMesh* BL_ModifierDeformer::GetPhysicsMesh()
/* we need to compute the deformed mesh taking into account the current
* shape and skin deformers, we cannot just call mesh_create_derived_physics()
* because that would use the m_transvers already deformed previously by BL_ModifierDeformer::Update(),
* so restart from scratch by forcing a full update the shape/skin deformers
* so restart from scratch by forcing a full update the shape/skin deformers
* (will do nothing if there is no such deformer) */
BL_ShapeDeformer::ForceUpdate();
BL_ShapeDeformer::Update();

View File

@@ -43,7 +43,7 @@
struct DerivedMesh;
struct Object;
class BL_ModifierDeformer : public BL_ShapeDeformer
class BL_ModifierDeformer : public BL_ShapeDeformer
{
public:
static bool HasCompatibleDeformer(Object *ob);

View File

@@ -66,9 +66,9 @@ BL_ShapeActionActuator::BL_ShapeActionActuator(SCA_IObject* gameobj,
short playtype,
short blendin,
short priority,
float stride)
float stride)
: SCA_IActuator(gameobj, KX_ACT_SHAPEACTION),
m_lastpos(0, 0, 0),
m_blendframe(0),
m_flag(0),
@@ -110,7 +110,7 @@ void BL_ShapeActionActuator::SetBlendTime(float newtime)
m_blendframe = newtime;
}
CValue* BL_ShapeActionActuator::GetReplica()
CValue* BL_ShapeActionActuator::GetReplica()
{
BL_ShapeActionActuator* replica = new BL_ShapeActionActuator(*this);//m_float,GetName());
replica->ProcessReplica();
@@ -124,7 +124,7 @@ bool BL_ShapeActionActuator::ClampLocalTime()
{
m_localtime = m_startframe;
return true;
}
}
else if (m_localtime > m_endframe)
{
m_localtime = m_endframe;
@@ -148,7 +148,7 @@ bool BL_ShapeActionActuator::ClampLocalTime()
void BL_ShapeActionActuator::SetStartTime(float curtime)
{
float direction = m_startframe < m_endframe ? 1.0 : -1.0;
if (!(m_flag & ACT_FLAG_REVERSE))
m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate();
else
@@ -158,7 +158,7 @@ void BL_ShapeActionActuator::SetStartTime(float curtime)
void BL_ShapeActionActuator::SetLocalTime(float curtime)
{
float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate();
if (m_endframe < m_startframe)
delta_time = -delta_time;
@@ -173,10 +173,10 @@ void BL_ShapeActionActuator::BlendShape(Key* key, float srcweight)
vector<float>::const_iterator it;
float dstweight;
KeyBlock *kb;
dstweight = 1.0F - srcweight;
for (it=m_blendshape.begin(), kb = (KeyBlock *)key->block.first;
for (it=m_blendshape.begin(), kb = (KeyBlock *)key->block.first;
kb && it != m_blendshape.end();
kb = (KeyBlock *)kb->next, it++)
{
@@ -195,7 +195,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
float newweight;
curtime -= KX_KetsjiEngine::GetSuspendedDelta();
// result = true if animation has to be continued, false if animation stops
// maybe there are events for us in the queue !
if (frame)
@@ -203,10 +203,10 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
bNegativeEvent = m_negevent;
bPositiveEvent = m_posevent;
RemoveAllEvents();
if (bPositiveEvent)
m_flag |= ACT_FLAG_ACTIVE;
if (bNegativeEvent)
{
if (!(m_flag & ACT_FLAG_ACTIVE))
@@ -214,13 +214,13 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
m_flag &= ~ACT_FLAG_ACTIVE;
}
}
/* This action can only be attached to a deform object */
BL_DeformableGameObject *obj = (BL_DeformableGameObject*)GetParent();
float length = m_endframe - m_startframe;
priority = m_priority;
/* Determine pre-incrementation behavior and set appropriate flags */
switch (m_playtype) {
case ACT_ACTION_MOTION:
@@ -302,15 +302,15 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
default:
break;
}
/* Perform increment */
if (keepgoing) {
if (m_playtype == ACT_ACTION_MOTION) {
MT_Point3 newpos;
MT_Point3 deltapos;
newpos = obj->NodeGetWorldPosition();
/* Find displacement */
deltapos = newpos-m_lastpos;
m_localtime += (length/m_stridelength) * deltapos.length();
@@ -320,7 +320,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
SetLocalTime(curtime);
}
}
/* Check if a wrapping response is needed */
if (length) {
if (m_localtime < m_startframe || m_localtime > m_endframe)
@@ -331,7 +331,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
}
else
m_localtime = m_startframe;
/* Perform post-increment tasks */
switch (m_playtype) {
case ACT_ACTION_FROM_PROP:
@@ -339,7 +339,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
CValue* propval = GetParent()->GetProperty(m_propname);
if (propval)
m_localtime = propval->GetNumber();
if (bNegativeEvent) {
keepgoing=false;
}
@@ -353,7 +353,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
if (wrap) {
if (!(m_flag & ACT_FLAG_REVERSE))
m_localtime = m_endframe;
else
else
m_localtime = m_startframe;
m_flag &= ~ACT_FLAG_LOCKINPUT;
@@ -394,7 +394,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
keepgoing = false;
break;
}
/* Set the property if its defined */
if (m_framepropname[0] != '\0') {
CValue* propowner = GetParent();
@@ -407,10 +407,10 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
}
newval->Release();
}
if (bNegativeEvent)
m_blendframe=0.0f;
/* Apply the pose if necessary*/
if (apply) {
@@ -429,7 +429,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
}
else {
ListBase tchanbase= {NULL, NULL};
if (m_blendin && m_blendframe==0.0f) {
// this is the start of the blending, remember the startup shape
obj->GetShape(m_blendshape);
@@ -448,7 +448,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
if (0) { // XXX !execute_ipochannels(&tchanbase)) {
// no update, this is possible if action does not match the keys, stop the action
keepgoing = false;
}
}
else {
// the key have changed, apply blending if needed
if (m_blendin && (m_blendframe<m_blendin)) {
@@ -470,7 +470,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
m_blendframe = 0.0f;
}
}
if (!keepgoing) {
m_blendframe = 0.0f;
}
@@ -544,7 +544,7 @@ int BL_ShapeActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE
bAction *action= NULL;
STR_String val = _PyUnicode_AsString(value);
if (val != "")
{
action= (bAction*)self->GetLogicManager()->GetActionByName(val);
@@ -554,7 +554,7 @@ int BL_ShapeActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE
return PY_SET_ATTR_FAIL;
}
}
self->SetAction(action);
return PY_SET_ATTR_SUCCESS;

View File

@@ -39,7 +39,7 @@
#include <vector>
struct Key;
class BL_ShapeActionActuator : public SCA_IActuator
class BL_ShapeActionActuator : public SCA_IActuator
{
public:
Py_Header
@@ -57,10 +57,10 @@ public:
virtual bool Update(double curtime, bool frame);
virtual CValue* GetReplica();
virtual void ProcessReplica();
void SetBlendTime (float newtime);
void BlendShape(struct Key* key, float weight);
bAction* GetAction() { return m_action; }
void SetAction(bAction* act) { m_action= act; }
@@ -127,7 +127,7 @@ protected:
float m_starttime;
/** The current time of the action */
float m_localtime;
float m_lastUpdate;
float m_blendin;
float m_blendstart;

View File

@@ -181,7 +181,7 @@ bool BL_ShapeDeformer::Update(void)
if (m_lastShapeUpdate != m_gameobj->GetLastFrame()) {
/* the key coefficient have been set already, we just need to blend the keys */
Object* blendobj = m_gameobj->GetBlendObject();
/* we will blend the key directly in m_transverts array: it is used by armature as the start position */
/* m_key can be NULL in case of Modifier deformer */
if (m_key) {
@@ -199,9 +199,9 @@ bool BL_ShapeDeformer::Update(void)
m_bDynamic = true;
}
// Don't release the weight array as in Blender, it will most likely be reusable on next frame
// Don't release the weight array as in Blender, it will most likely be reusable on next frame
// The weight array are ultimately deleted when the skin mesh is destroyed
/* Update the current frame */
m_lastShapeUpdate=m_gameobj->GetLastFrame();
@@ -215,7 +215,7 @@ bool BL_ShapeDeformer::Update(void)
// non dynamic deformer = Modifer without armature and shape keys, no need to create storage
if (!bSkinUpdate && bShapeUpdate && m_bDynamic) {
// this means that there is no armature, we still need to
// this means that there is no armature, we still need to
// update the normal (was not done after shape key calculation)
#ifdef __NLA_DEFNORMALS

View File

@@ -40,7 +40,7 @@
#include "BL_DeformableGameObject.h"
#include <vector>
class BL_ShapeDeformer : public BL_SkinDeformer
class BL_ShapeDeformer : public BL_SkinDeformer
{
public:
BL_ShapeDeformer(BL_DeformableGameObject *gameobj,

View File

@@ -58,7 +58,7 @@ extern "C"{
#include "BKE_lattice.h"
#include "BKE_deform.h"
}
#include "BLI_blenlib.h"
#include "BLI_math.h"
@@ -188,8 +188,8 @@ void BL_SkinDeformer::BlenderDeformVerts()
copy_m4_m4(m_objMesh->obmat, m_obmat);
armature_deform_verts( par_arma, m_objMesh, NULL, m_transverts, NULL, m_bmesh->totvert, m_deformflags, NULL, NULL );
// restore matrix
// restore matrix
copy_m4_m4(m_objMesh->obmat, obmat);
#ifdef __NLA_DEFNORMALS
@@ -276,7 +276,7 @@ void BL_SkinDeformer::BGEDeformVerts()
}
}
}
// Update Vertex Normal
norm = norm_chan_mat.topLeftCorner<3, 3>()*norm;

View File

@@ -48,7 +48,7 @@
#include "RAS_Deformer.h"
class BL_SkinDeformer : public BL_MeshDeformer
class BL_SkinDeformer : public BL_MeshDeformer
{
public:
// void SetArmatureController (BL_ArmatureController *cont);
@@ -76,13 +76,13 @@ public:
bool Update (void);
bool UpdateInternal (bool shape_applied);
bool Apply (class RAS_IPolyMaterial *polymat);
bool UpdateBuckets(void)
bool UpdateBuckets(void)
{
// update the deformer and all the mesh slots; Apply() does it well, so just call it.
return Apply(NULL);
}
bool PoseUpdated(void)
{
{
if (m_armobj && m_lastArmaUpdate!=m_armobj->GetLastFrame()) {
return true;
}

View File

@@ -50,10 +50,10 @@ BL_InterpolatorList::BL_InterpolatorList(bAction *action)
{
if (action==NULL)
return;
for (FCurve *fcu = (FCurve *)action->curves.first; fcu; fcu = fcu->next) {
if (fcu->rna_path) {
BL_ScalarInterpolator *new_ipo = new BL_ScalarInterpolator(fcu);
BL_ScalarInterpolator *new_ipo = new BL_ScalarInterpolator(fcu);
//assert(new_ipo);
push_back(new_ipo);
}

View File

@@ -46,7 +46,7 @@ public:
{}
virtual ~BL_ScalarInterpolator() {}
virtual float GetValue(float currentTime) const;
struct FCurve *GetFCurve() { return m_fcu; }

View File

@@ -307,7 +307,7 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene)
*worldit = m_worldinfos.back();
m_worldinfos.pop_back();
size--;
}
}
else {
i++;
worldit++;
@@ -323,7 +323,7 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene)
*polymit = m_polymaterials.back();
m_polymaterials.pop_back();
size--;
}
}
else {
i++;
polymit++;
@@ -341,7 +341,7 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene)
*matit = m_materials.back();
m_materials.pop_back();
size--;
}
}
else {
i++;
matit++;
@@ -358,7 +358,7 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene)
*meshit = m_meshobjects.back();
m_meshobjects.pop_back();
size--;
}
}
else {
i++;
meshit++;
@@ -415,7 +415,7 @@ void KX_BlenderSceneConverter::SetAlwaysUseExpandFraming(bool to_what)
m_alwaysUseExpandFraming= to_what;
}
void KX_BlenderSceneConverter::RegisterGameObject(KX_GameObject *gameobject, Object *for_blenderobject)
void KX_BlenderSceneConverter::RegisterGameObject(KX_GameObject *gameobject, Object *for_blenderobject)
{
/* only maintained while converting, freed during game runtime */
m_map_blender_to_gameobject.insert(CHashedPtr(for_blenderobject), gameobject);
@@ -423,7 +423,7 @@ void KX_BlenderSceneConverter::RegisterGameObject(KX_GameObject *gameobject, Obj
/* only need to run this during conversion since
* m_map_blender_to_gameobject is freed after conversion */
void KX_BlenderSceneConverter::UnregisterGameObject(KX_GameObject *gameobject)
void KX_BlenderSceneConverter::UnregisterGameObject(KX_GameObject *gameobject)
{
Object *bobp = gameobject->GetBlenderObject();
if (bobp) {
@@ -437,7 +437,7 @@ void KX_BlenderSceneConverter::UnregisterGameObject(KX_GameObject *gameobject)
}
}
KX_GameObject *KX_BlenderSceneConverter::FindGameObject(Object *for_blenderobject)
KX_GameObject *KX_BlenderSceneConverter::FindGameObject(Object *for_blenderobject)
{
KX_GameObject **obp = m_map_blender_to_gameobject[CHashedPtr(for_blenderobject)];
@@ -458,7 +458,7 @@ RAS_MeshObject *KX_BlenderSceneConverter::FindGameMesh(Mesh *for_blendermesh)
if (meshp) {
return *meshp;
}
}
else {
return NULL;
}
@@ -580,7 +580,7 @@ void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo)
localDel_ipoCurve( tmpicu );
}
}
}
}
else {
ipo = NULL; // XXX add_ipo(blenderObject->id.name+2, ID_OB);
blenderObject->ipo = ipo;
@@ -637,11 +637,11 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
const MT_Point3& position = gameObj->NodeGetWorldPosition();
//const MT_Vector3& scale = gameObj->NodeGetWorldScaling();
const MT_Matrix3x3& orn = gameObj->NodeGetWorldOrientation();
float eulerAngles[3];
float eulerAnglesOld[3] = {0.0f, 0.0f, 0.0f};
float tmat[3][3];
// XXX animato
Ipo* ipo = blenderObject->ipo;
@@ -677,23 +677,23 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
icu_rz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z, 1);
if (icu_rz) icu_rz->ipo = IPO_LIN;
}
if (icu_rx) eulerAnglesOld[0] = eval_icu( icu_rx, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
if (icu_ry) eulerAnglesOld[1] = eval_icu( icu_ry, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
if (icu_rz) eulerAnglesOld[2] = eval_icu( icu_rz, frameNumber - 1 ) / ((180 / 3.14159265f) / 10);
// orn.getValue((float *)tmat); // uses the wrong ordering, cant use this
for (int r = 0; r < 3; r++)
for (int c = 0; c < 3; c++)
tmat[r][c] = orn[c][r];
// mat3_to_eul( eulerAngles,tmat); // better to use Mat3ToCompatibleEul
mat3_to_compatible_eul( eulerAngles, eulerAnglesOld,tmat);
//eval_icu
for (int x = 0; x < 3; x++)
eulerAngles[x] *= (float) ((180 / 3.14159265f) / 10.0);
//fill the curves with data
if (icu_lx) insert_vert_icu(icu_lx, frameNumber, position.x(), 1);
if (icu_ly) insert_vert_icu(icu_ly, frameNumber, position.y(), 1);
@@ -701,7 +701,7 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
if (icu_rx) insert_vert_icu(icu_rx, frameNumber, eulerAngles[0], 1);
if (icu_ry) insert_vert_icu(icu_ry, frameNumber, eulerAngles[1], 1);
if (icu_rz) insert_vert_icu(icu_rz, frameNumber, eulerAngles[2], 1);
// Handles are corrected at the end, testhandles_ipocurve isn't needed yet
#endif
}
@@ -775,7 +775,7 @@ Main *KX_BlenderSceneConverter::GetMainDynamicPath(const char *path)
for (vector<Main *>::iterator it = m_DynamicMaggie.begin(); !(it == m_DynamicMaggie.end()); it++)
if (BLI_path_cmp((*it)->name, path) == 0)
return *it;
return NULL;
}
@@ -868,7 +868,7 @@ static void load_datablocks(Main *main_tmp, BlendHandle *bpy_openlib, const char
int totnames_dummy;
names = BLO_blendhandle_get_datablock_names(bpy_openlib, idcode, &totnames_dummy);
int i = 0;
LinkNode *n = names;
while (n) {
@@ -897,7 +897,7 @@ KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openl
BLO_blendhandle_close(bpy_openlib);
return NULL;
}
if (GetMainDynamicPath(path)) {
snprintf(err_local, sizeof(err_local), "blend file already open \"%s\"\n", path);
*err_str = err_local;
@@ -935,18 +935,18 @@ KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openl
BKE_reports_clear(&reports);
/* done linking */
/* needed for lookups*/
GetMainDynamic().push_back(main_newlib);
BLI_strncpy(main_newlib->name, path, sizeof(main_newlib->name));
status = new KX_LibLoadStatus(this, m_ketsjiEngine, scene_merge, path);
if (idcode == ID_ME) {
/* Convert all new meshes into BGE meshes */
ID *mesh;
for (mesh = (ID *)main_newlib->mesh.first; mesh; mesh = (ID *)mesh->next ) {
if (options & LIB_LOAD_VERBOSE)
printf("MeshName: %s\n", mesh->name + 2);
@@ -973,15 +973,15 @@ KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openl
for (scene = (ID *)main_newlib->scene.first; scene; scene = (ID *)scene->next ) {
if (options & LIB_LOAD_VERBOSE)
printf("SceneName: %s\n", scene->name + 2);
if (options & LIB_LOAD_ASYNC) {
scenes->push_back((Scene *)scene);
}
}
else {
/* merge into the base scene */
KX_Scene* other = m_ketsjiEngine->CreateScene((Scene *)scene, true);
scene_merge->MergeScene(other);
// RemoveScene(other); // Don't run this, it frees the entire scene converter data, just delete the scene
delete other;
}
@@ -1077,7 +1077,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie)
/* in case the mesh might be refered to later */
{
CTR_Map<STR_HashedString, void *> &mapStringToMeshes = scene->GetLogicManager()->GetMeshMap();
for (int i = 0; i < mapStringToMeshes.size(); i++) {
RAS_MeshObject *meshobj = (RAS_MeshObject *) *mapStringToMeshes.at(i);
if (meshobj && IS_TAGGED(meshobj->GetMesh())) {
@@ -1104,7 +1104,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie)
}
}
}
//scene->FreeTagged(); /* removed tagged objects and meshes*/
CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL};
@@ -1201,7 +1201,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie)
*worldit = m_worldinfos.back();
m_worldinfos.pop_back();
size--;
}
}
else {
i++;
worldit++;
@@ -1260,7 +1260,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie)
*matit = m_materials.back();
m_materials.pop_back();
size--;
}
}
else {
i++;
matit++;
@@ -1308,7 +1308,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie)
*meshit = m_meshobjects.back();
m_meshobjects.pop_back();
size--;
}
}
else {
i++;
meshit++;

View File

@@ -76,16 +76,16 @@ class KX_BlenderSceneConverter : public KX_ISceneConverter
// Saved KX_LibLoadStatus objects
map<char *, class KX_LibLoadStatus*> m_status_map;
// Should also have a list of collision shapes.
// Should also have a list of collision shapes.
// For the time being this is held in KX_Scene::m_shapes
CTR_Map<CHashedPtr,KX_GameObject*> m_map_blender_to_gameobject; /* cleared after conversion */
CTR_Map<CHashedPtr,RAS_MeshObject*> m_map_mesh_to_gamemesh; /* cleared after conversion */
CTR_Map<CHashedPtr,SCA_IActuator*> m_map_blender_to_gameactuator; /* cleared after conversion */
CTR_Map<CHashedPtr,SCA_IController*>m_map_blender_to_gamecontroller; /* cleared after conversion */
CTR_Map<CHashedPtr,BL_InterpolatorList*> m_map_blender_to_gameAdtList;
Main* m_maggie;
vector<struct Main*> m_DynamicMaggie;
@@ -121,7 +121,7 @@ public:
bool TryAndLoadNewFile();
void SetAlwaysUseExpandFraming(bool to_what);
void RegisterGameObject(KX_GameObject *gameobject, struct Object *for_blenderobject);
void UnregisterGameObject(KX_GameObject *gameobject);
KX_GameObject *FindGameObject(struct Object *for_blenderobject);
@@ -136,7 +136,7 @@ public:
void RegisterBlenderMaterial(BL_Material *mat);
void CacheBlenderMaterial(KX_Scene *scene, Material *mat, BL_Material *blmat);
BL_Material *FindCachedBlenderMaterial(KX_Scene *scene, Material *mat);
void RegisterInterpolatorList(BL_InterpolatorList *actList, struct bAction *for_act);
BL_InterpolatorList *FindInterpolatorList(struct bAction *for_act);
@@ -152,7 +152,7 @@ public:
///this is for reseting the position,rotation and scale of the gameobjet that is not dynamic
virtual void resetNoneDynamicObjectToIpo();
///this generates ipo curves for position, rotation, allowing to use game physics in animation
virtual void WritePhysicsObjectToAnimationIpo(int frameNumber);
virtual void TestHandlesPhysicsObjectToAnimationIpo();
@@ -174,7 +174,7 @@ public:
// struct Main* GetMain() { return m_maggie; }
struct Main* GetMainDynamicPath(const char *path);
vector<struct Main*> &GetMainDynamic();
class KX_LibLoadStatus *LinkBlendFileMemory(void *data, int length, const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options);
class KX_LibLoadStatus *LinkBlendFilePath(const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options);
class KX_LibLoadStatus *LinkBlendFile(struct BlendHandle *bpy_openlib, const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options);
@@ -186,7 +186,7 @@ public:
virtual void MergeAsyncLoads();
virtual void FinalizeAsyncLoads();
void AddScenesToMergeQueue(class KX_LibLoadStatus *status);
void PrintStats() {
printf("BGE STATS!\n");
@@ -208,9 +208,9 @@ public:
#endif
// /printf("\t m_ketsjiEngine->m_scenes: %d\n", m_ketsjiEngine->CurrentScenes()->size());
}
/* LibLoad Options */
enum
enum
{
LIB_LOAD_LOAD_ACTIONS = 1,
LIB_LOAD_VERBOSE = 2,
@@ -223,7 +223,7 @@ public:
#ifdef WITH_PYTHON
PyObject *GetPyNamespace();
#endif
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BlenderSceneConverter")
#endif

View File

@@ -102,7 +102,7 @@
#include "BL_BlenderDataConversion.h"
/**
/**
* KX_flt_trunc needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set
*/
@@ -122,7 +122,7 @@ void BL_ConvertActuators(const char* maggiename,
KX_BlenderSceneConverter* converter
)
{
int uniqueint = 0;
int actcount = 0;
int executePriority = 0;
@@ -138,7 +138,7 @@ void BL_ConvertActuators(const char* maggiename,
{
STR_String uniquename = bact->name;
STR_String& objectname = gameobj->GetName();
SCA_IActuator* baseact = NULL;
switch (bact->type)
{
@@ -168,9 +168,9 @@ void BL_ConvertActuators(const char* maggiename,
/* Blender uses a bit vector internally for the local-flags. In */
/* KX, we have four bools. The compiler should be smart enough */
/* to do the right thing. We need to explicitly convert here! */
KX_LocalFlags bitLocalFlag;
bitLocalFlag.Force = bool((obact->flag & ACT_FORCE_LOCAL)!=0);
bitLocalFlag.Torque = bool((obact->flag & ACT_TORQUE_LOCAL) !=0);//rlocal;
bitLocalFlag.DLoc = bool((obact->flag & ACT_DLOC_LOCAL)!=0);
@@ -186,7 +186,7 @@ void BL_ConvertActuators(const char* maggiename,
{
obref = converter->FindGameObject(obact->reference);
}
KX_ObjectActuator* tmpbaseact = new KX_ObjectActuator(
gameobj,
obref,
@@ -214,7 +214,7 @@ void BL_ConvertActuators(const char* maggiename,
if (actact->flag & ACT_IPOLOCAL) ipo_flags |= BL_Action::ACT_IPOFLAG_LOCAL;
if (actact->flag & ACT_IPOADD) ipo_flags |= BL_Action::ACT_IPOFLAG_ADD;
if (actact->flag & ACT_IPOCHILD) ipo_flags |= BL_Action::ACT_IPOFLAG_CHILD;
BL_ActionActuator* tmpbaseact = new BL_ActionActuator(
gameobj,
propname,
@@ -242,7 +242,7 @@ void BL_ConvertActuators(const char* maggiename,
bActionActuator* actact = (bActionActuator*) bact->data;
STR_String propname = actact->name;
STR_String propframe = actact->frameProp;
BL_ShapeActionActuator* tmpbaseact = new BL_ShapeActionActuator(
gameobj,
propname,
@@ -270,8 +270,8 @@ void BL_ConvertActuators(const char* maggiename,
bCameraActuator *camact = (bCameraActuator *) bact->data;
if (camact->ob) {
KX_GameObject *tmpgob = converter->FindGameObject(camact->ob);
/* visifac, fac and axis are not copied from the struct... */
/* visifac, fac and axis are not copied from the struct... */
/* that's some internal state... */
KX_CameraActuator *tmpcamact = new KX_CameraActuator(
gameobj,
@@ -288,16 +288,16 @@ void BL_ConvertActuators(const char* maggiename,
case ACT_MESSAGE:
{
bMessageActuator *msgAct = (bMessageActuator *) bact->data;
/* Get the name of the properties that objects must own that
* we're sending to, if present
*/
STR_String toPropName = msgAct->toPropName;
/* Get the Message Subject to send.
*/
STR_String subject = msgAct->subject;
/* Get the bodyType
*/
int bodyType = msgAct->bodyType;
@@ -306,7 +306,7 @@ void BL_ConvertActuators(const char* maggiename,
* we'll be sending, might be empty
*/
const STR_String body = msgAct->body;
KX_NetworkMessageActuator *tmpmsgact = new KX_NetworkMessageActuator(
gameobj, // actuator controlling object
scene->GetNetworkScene(), // needed for replication
@@ -327,7 +327,7 @@ void BL_ConvertActuators(const char* maggiename,
/* get type, and possibly a start and end frame */
KX_SoundActuator::KX_SOUNDACT_TYPE
soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF;
switch (soundact->type) {
case ACT_SND_PLAY_STOP_SOUND:
soundActuatorType = KX_SoundActuator::KX_SOUNDACT_PLAYSTOP;
@@ -347,13 +347,13 @@ void BL_ConvertActuators(const char* maggiename,
case ACT_SND_LOOP_BIDIRECTIONAL_STOP_SOUND:
soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP;
break;
default:
/* This is an error!!! */
soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF;
}
if (soundActuatorType != KX_SoundActuator::KX_SOUNDACT_NODEF)
if (soundActuatorType != KX_SoundActuator::KX_SOUNDACT_NODEF)
{
bSound* sound = soundact->sound;
bool is3d = soundact->flag & ACT_SND_3D_SOUND ? true : false;
@@ -407,7 +407,7 @@ void BL_ConvertActuators(const char* maggiename,
{
bPropertyActuator* propact = (bPropertyActuator*) bact->data;
SCA_IObject* destinationObj = NULL;
/*
* here the destinationobject is searched. problem with multiple scenes: other scenes
* have not been converted yet, so the destobj will not be found, so the prop will
@@ -418,7 +418,7 @@ void BL_ConvertActuators(const char* maggiename,
*/
if (propact->ob)
destinationObj = converter->FindGameObject(propact->ob);
SCA_PropertyActuator* tmppropact = new SCA_PropertyActuator(
gameobj,
destinationObj,
@@ -431,16 +431,16 @@ void BL_ConvertActuators(const char* maggiename,
}
case ACT_EDIT_OBJECT:
{
bEditObjectActuator *editobact
bEditObjectActuator *editobact
= (bEditObjectActuator *) bact->data;
/* There are four different kinds of 'edit object' thingies */
/* The alternative to this lengthy conversion is packing */
/* several actuators in one, which is not very nice design.. */
switch (editobact->type) {
case ACT_EDOB_ADD_OBJECT:
case ACT_EDOB_ADD_OBJECT:
{
// does the 'original' for replication exists, and
// does the 'original' for replication exists, and
// is it in a non-active layer ?
SCA_IObject* originalval = NULL;
if (editobact->ob)
@@ -453,7 +453,7 @@ void BL_ConvertActuators(const char* maggiename,
originalval = converter->FindGameObject(editobact->ob);
}
}
KX_SCA_AddObjectActuator* tmpaddact = new KX_SCA_AddObjectActuator(
gameobj,
originalval,
@@ -470,7 +470,7 @@ void BL_ConvertActuators(const char* maggiename,
break;
case ACT_EDOB_END_OBJECT:
{
KX_SCA_EndObjectActuator* tmpendact
KX_SCA_EndObjectActuator* tmpendact
= new KX_SCA_EndObjectActuator(gameobj,scene);
baseact = tmpendact;
}
@@ -501,7 +501,7 @@ void BL_ConvertActuators(const char* maggiename,
SCA_IObject* originalval = NULL;
if (editobact->ob)
originalval = converter->FindGameObject(editobact->ob);
KX_TrackToActuator* tmptrackact = new KX_TrackToActuator(
gameobj,
originalval,
@@ -528,10 +528,10 @@ void BL_ConvertActuators(const char* maggiename,
float min = 0.0, max = 0.0;
char *prop = NULL;
KX_ConstraintActuator::KX_CONSTRAINTTYPE locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_NODEF;
bConstraintActuator *conact
bConstraintActuator *conact
= (bConstraintActuator*) bact->data;
/* convert settings... degrees in the ui become radians */
/* internally */
/* convert settings... degrees in the ui become radians */
/* internally */
if (conact->type == ACT_CONST_TYPE_ORI) {
min = conact->minloc[0];
max = conact->maxloc[0];
@@ -617,12 +617,12 @@ void BL_ConvertActuators(const char* maggiename,
} else {
switch (conact->flag) {
case ACT_CONST_LOCX:
locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCX;
locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCX;
min = conact->minloc[0];
max = conact->maxloc[0];
break;
case ACT_CONST_LOCY:
locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCY;
locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCY;
min = conact->minloc[1];
max = conact->maxloc[1];
break;
@@ -647,7 +647,7 @@ void BL_ConvertActuators(const char* maggiename,
max = conact->maxrot[2] * (float)MT_RADS_PER_DEG;
break;
default:
; /* error */
; /* error */
}
}
KX_ConstraintActuator *tmpconact = new KX_ConstraintActuator(
@@ -673,7 +673,7 @@ void BL_ConvertActuators(const char* maggiename,
{
bSceneActuator *sceneact = (bSceneActuator *) bact->data;
STR_String nextSceneName("");
KX_SceneActuator* tmpsceneact;
int mode = KX_SceneActuator::KX_SCENE_NODEF;
KX_Camera *cam = NULL;
@@ -709,11 +709,11 @@ void BL_ConvertActuators(const char* maggiename,
mode = KX_SceneActuator::KX_SCENE_SET_SCENE;
break;
};
if (sceneact->scene) {
nextSceneName = sceneact->scene->id.name + 2;
}
break;
}
case ACT_SCENE_CAMERA:
@@ -727,7 +727,7 @@ void BL_ConvertActuators(const char* maggiename,
break;
case ACT_SCENE_RESTART:
{
mode = KX_SceneActuator::KX_SCENE_RESTART;
break;
}
@@ -809,21 +809,21 @@ void BL_ConvertActuators(const char* maggiename,
}
case ACT_RANDOM:
{
bRandomActuator *randAct
bRandomActuator *randAct
= (bRandomActuator *) bact->data;
unsigned long seedArg = randAct->seed;
if (seedArg == 0)
{
seedArg = (int)(ketsjiEngine->GetRealTime()*100000.0);
seedArg ^= (intptr_t)randAct;
}
SCA_RandomActuator::KX_RANDOMACT_MODE modeArg
SCA_RandomActuator::KX_RANDOMACT_MODE modeArg
= SCA_RandomActuator::KX_RANDOMACT_NODEF;
SCA_RandomActuator *tmprandomact;
float paraArg1 = 0.0;
float paraArg2 = 0.0;
switch (randAct->distribution) {
case ACT_RANDOM_BOOL_CONST:
modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_CONST;
@@ -890,7 +890,7 @@ void BL_ConvertActuators(const char* maggiename,
bool recursive = ((vis_act->flag & ACT_VISIBILITY_RECURSIVE) != 0);
tmp_vis_act = new KX_VisibilityActuator(gameobj, !v, o, recursive);
baseact = tmp_vis_act;
}
break;
@@ -900,9 +900,9 @@ void BL_ConvertActuators(const char* maggiename,
bStateActuator *sta_act = (bStateActuator *) bact->data;
KX_StateActuator * tmp_sta_act = NULL;
tmp_sta_act =
tmp_sta_act =
new KX_StateActuator(gameobj, sta_act->type, sta_act->mask);
baseact = tmp_sta_act;
}
break;
@@ -1004,7 +1004,7 @@ void BL_ConvertActuators(const char* maggiename,
tmpgob = NULL;
break;
}
KX_ParentActuator *tmpparact
= new KX_ParentActuator(gameobj,
mode,
@@ -1014,7 +1014,7 @@ void BL_ConvertActuators(const char* maggiename,
baseact = tmpparact;
break;
}
case ACT_ARMATURE:
{
bArmatureActuator* armAct = (bArmatureActuator*) bact->data;
@@ -1064,8 +1064,8 @@ void BL_ConvertActuators(const char* maggiename,
bool normalup = (stAct->flag & ACT_STEERING_NORMALUP) !=0;
bool lockzvel = (stAct->flag & ACT_STEERING_LOCKZVEL) !=0;
KX_SteeringActuator *tmpstact
= new KX_SteeringActuator(gameobj, mode, targetob, navmeshob,stAct->dist,
stAct->velocity, stAct->acceleration, stAct->turnspeed,
= new KX_SteeringActuator(gameobj, mode, targetob, navmeshob,stAct->dist,
stAct->velocity, stAct->acceleration, stAct->turnspeed,
selfTerminated, stAct->updateTime,
scene->GetObstacleSimulation(), facingMode, normalup, enableVisualization, lockzvel);
baseact = tmpstact;
@@ -1118,7 +1118,7 @@ void BL_ConvertActuators(const char* maggiename,
default:
; /* generate some error */
}
if (baseact && !(bact->flag & ACT_DEACTIVATE))
{
baseact->SetExecutePriority(executePriority++);
@@ -1131,14 +1131,14 @@ void BL_ConvertActuators(const char* maggiename,
baseact->SetLogicManager(logicmgr);
//gameobj->SetProperty(uniquename,baseact);
gameobj->AddActuator(baseact);
converter->RegisterGameActuator(baseact, bact);
// done with baseact, release it
baseact->Release();
}
else if (baseact)
baseact->Release();
bact = bact->next;
}
}

View File

@@ -161,7 +161,7 @@ void BL_ConvertControllers(
// When libloading, this is delayed to KX_Scene::MergeScene_LogicBrick to avoid GIL issues
if (!libloading)
pyctrl->SetNamespace(converter->GetPyNamespace());
if (pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) {
if (pycont->text)
{
@@ -174,12 +174,12 @@ void BL_ConvertControllers(
pyctrl->SetScriptName(pycont->text->id.name+2);
MEM_freeN(buf);
}
}
}
else {
/* let the controller print any warnings here when importing */
pyctrl->SetScriptText(STR_String(pycont->module));
pyctrl->SetScriptText(STR_String(pycont->module));
pyctrl->SetScriptName(pycont->module); /* will be something like module.func so using it as the name is OK */
if (pycont->flag & CONT_PY_DEBUG) {
@@ -193,7 +193,7 @@ void BL_ConvertControllers(
}
default:
{
}
}
@@ -216,7 +216,7 @@ void BL_ConvertControllers(
gamecontroller->SetName(bcontr->name);
gamecontroller->SetLogicManager(logicmgr);
gameobj->AddController(gamecontroller);
converter->RegisterGameController(gamecontroller, bcontr);
#ifdef WITH_PYTHON
@@ -231,7 +231,7 @@ void BL_ConvertControllers(
/* We cant do this because importing runs the script which could end up accessing
* internal BGE functions, this is unstable while we're converting the scene.
* This is a pity because its useful to see errors at startup but cant help it */
// pyctrl->Import();
}
}
@@ -243,7 +243,7 @@ void BL_ConvertControllers(
}
else if (gamecontroller)
gamecontroller->Release();
bcontr = bcontr->next;
}

View File

@@ -39,7 +39,7 @@ void BL_ConvertControllers(
class KX_GameObject* gameobj,
class SCA_LogicManager* logicmgr,
int activeLayerBitInfo,
bool isInActiveLayer,
bool isInActiveLayer,
class KX_BlenderSceneConverter* converter,
bool libloading
);

View File

@@ -65,7 +65,7 @@ void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEvent
void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventManager* timemgr,SCA_IScene* scene, bool isInActiveLayer)
{
bProperty* prop = (bProperty*)object->prop.first;
CValue* propval;
bool show_debug_info;
@@ -108,8 +108,8 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
float floatprop = *((float*)&prop->data);
CValue* timeval = new CFloatValue(floatprop);
// set a subproperty called 'timer' so that
// we can register the replica of this property
// set a subproperty called 'timer' so that
// we can register the replica of this property
// at the time a game object is replicated (AddObjectActuator triggers this)
CValue *bval = new CBoolValue(true);
timeval->SetProperty("timer",bval);
@@ -118,7 +118,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
{
timemgr->AddTimeProperty(timeval);
}
propval = timeval;
gameobj->SetProperty(prop->name,timeval);
@@ -128,7 +128,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
// todo make an assert etc.
}
}
if (propval)
{
if (show_debug_info && isInActiveLayer)
@@ -138,7 +138,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
// done with propval, release it
propval->Release();
}
#ifdef WITH_PYTHON
/* Warn if we double up on attributes, this isn't quite right since it wont find inherited attributes however there arnt many */
for (PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) {

View File

@@ -109,7 +109,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
bool invert = false;
bool level = false;
bool tap = false;
while (sens)
{
sens = sens->next;

View File

@@ -39,7 +39,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
class KX_KetsjiEngine* kxengine,
int activeLayerBitInfo,
bool isInActiveLayer,
class RAS_ICanvas* canvas,
class RAS_ICanvas* canvas,
class KX_BlenderSceneConverter* converter);
#endif /* __KX_CONVERTSENSORS_H__ */

View File

@@ -148,7 +148,7 @@ void KX_LibLoadStatus::AddProgress(float progress)
#ifdef WITH_PYTHON
PyMethodDef KX_LibLoadStatus::Methods[] =
PyMethodDef KX_LibLoadStatus::Methods[] =
{
{NULL} //Sentinel
};
@@ -189,7 +189,7 @@ PyTypeObject KX_LibLoadStatus::Type = {
PyObject* KX_LibLoadStatus::pyattr_get_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_LibLoadStatus* self = static_cast<KX_LibLoadStatus*>(self_v);
if (self->m_finish_cb) {
Py_INCREF(self->m_finish_cb);
return self->m_finish_cb;
@@ -219,7 +219,7 @@ int KX_LibLoadStatus::pyattr_set_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF
PyObject* KX_LibLoadStatus::pyattr_get_onprogress(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_LibLoadStatus* self = static_cast<KX_LibLoadStatus*>(self_v);
if (self->m_progress_cb) {
Py_INCREF(self->m_progress_cb);
return self->m_progress_cb;

View File

@@ -92,7 +92,7 @@ bool KX_SoftBodyDeformer::Apply(class RAS_IPolyMaterial *polymat)
slot = *mmat->m_slots[(void*)m_gameobj];
// for each array
for (slot->begin(it); !slot->end(it); slot->next(it))
for (slot->begin(it); !slot->end(it); slot->next(it))
{
btSoftBody::tNodeArray& nodes(softBody->m_nodes);

View File

@@ -68,7 +68,7 @@ public:
}
virtual bool UpdateBuckets(void)
{
// this is to update the mesh slots outside the rasterizer,
// this is to update the mesh slots outside the rasterizer,
// no need to do it for this deformer, it's done in any case in Apply()
return false;
}

View File

@@ -26,7 +26,7 @@
* Is used by parser when an expression tree is build containing booleans.
*/
class CBoolValue : public CPropValue
class CBoolValue : public CPropValue
{
//PLUGIN_DECLARE_SERIAL(CBoolValue,CValue)
@@ -44,10 +44,10 @@ public:
virtual int GetValueType();
bool GetBool();
virtual void SetValue(CValue* newval);
virtual CValue* Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
void Configure(CValue* menuvalue);
virtual CValue* GetReplica();
#ifdef WITH_PYTHON

View File

@@ -22,12 +22,12 @@
#include "EXP_Expression.h"
#include "EXP_Value.h" // Added by ClassView
class CConstExpr : public CExpression
class CConstExpr : public CExpression
{
//PLUGIN_DECLARE_SERIAL_EXPRESSION (CConstExpr,CExpression)
public:
virtual bool MergeExpression(CExpression* otherexpr);
void BroadcastOperators(VALUE_OPERATOR op);
virtual unsigned char GetExpressionID();
@@ -40,7 +40,7 @@ public:
CConstExpr(CValue* constval);
CConstExpr();
virtual ~CConstExpr();
private:
CValue* m_value;

View File

@@ -23,7 +23,7 @@
class CListValue;
class CEmptyValue : public CPropValue
class CEmptyValue : public CPropValue
{
//PLUGIN_DECLARE_SERIAL (CEmptyValue,CValue)
public:

View File

@@ -21,7 +21,7 @@
#include "EXP_Value.h"
class CErrorValue : public CPropValue
class CErrorValue : public CPropValue
{
public:

View File

@@ -56,7 +56,7 @@ class CBrokenLinkInfo
CBrokenLinkInfo(CExpression** pmemexpr,CExpression* expr)
:m_pmemExpr(pmemexpr),
m_pExpr(expr)
{
{
assertd(pmemexpr);
m_bRestored=false;
};
@@ -64,15 +64,15 @@ class CBrokenLinkInfo
virtual ~CBrokenLinkInfo();
void RestoreLink();
void BreakLink();
// members vars
private:
CExpression** m_pmemExpr;
CExpression* m_pExpr;
bool m_bRestored;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CBrokenLinkInfo")
#endif
@@ -85,7 +85,7 @@ class CBrokenLinkInfo
class CExpression
class CExpression
{
public:
enum {
@@ -104,7 +104,7 @@ public:
virtual bool MergeExpression(CExpression* otherexpr) = 0;
CExpression();
virtual CValue* Calculate() = 0; //pure virtual
virtual unsigned char GetExpressionID() = 0;
//virtual bool IsInside(float x,float y,float z,bool bBorderInclude=true) = 0; //pure virtual
@@ -120,21 +120,21 @@ public:
//gRefCountExpr++;
assertd(m_refcount < 255);
#endif
m_refcount++;
m_refcount++;
return this;
};
virtual CExpression* Release(CExpression* complicatedtrick=NULL) {
virtual CExpression* Release(CExpression* complicatedtrick=NULL) {
#ifdef DEBUG
//gRefCountExpr--;
#endif
if (--m_refcount < 1)
if (--m_refcount < 1)
{
delete this;
} //else
// return this;
return complicatedtrick;
};
protected:

View File

@@ -21,7 +21,7 @@
#include "EXP_Value.h"
class CFloatValue : public CPropValue
class CFloatValue : public CPropValue
{
//PLUGIN_DECLARE_SERIAL (CFloatValue,CValue)
public:

View File

@@ -49,8 +49,8 @@ public:
{
return rhs.m_valptr == lhs.m_valptr;
}
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CHashedPtr")
#endif

View File

@@ -21,7 +21,7 @@
#include "EXP_Expression.h"
class CIfExpr : public CExpression
class CIfExpr : public CExpression
{
//PLUGIN_DECLARE_SERIAL_EXPRESSION (CIfExpr,CExpression)
@@ -32,11 +32,11 @@ public:
virtual bool MergeExpression(CExpression* otherexpr);
CIfExpr(CExpression *guard, CExpression *e1, CExpression *e2);
CIfExpr();
virtual unsigned char GetExpressionID();
virtual ~CIfExpr();
virtual CValue* Calculate();
virtual bool IsInside(float x,float y,float z,bool bBorderInclude=true);
virtual bool NeedsRecalculated();

View File

@@ -75,21 +75,21 @@ private:
floattype,
stringtype
}; // all kinds of constants
int sym, // current symbol
opkind, // kind of operator, if symbol is an operator
constkind; // kind of operator, if symbol is a constant
char ch; // current character
int chcount; // index to character in input string
CExpression *errmsg; // contains a errormessage, if scanner error
STR_String text, // contains a copy of the original text
const_as_string; // string representation of the symbol, if symbol is a constant
bool boolvalue; // value of the boolean, if symbol is a constant of type boolean
CValue* m_identifierContext;// context in which identifiers are looked up
void ScanError(const char *str);
CExpression* Error(const char *str);
void NextCh();
@@ -107,8 +107,8 @@ private:
int Priority(int optor);
CExpression *Ex(int i);
CExpression *Expr();
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CParser")
#endif

View File

@@ -22,9 +22,9 @@
#include "EXP_Value.h"
typedef long long cInt;
typedef long long cInt;
class CIntValue : public CPropValue
class CIntValue : public CPropValue
{
//PLUGIN_DECLARE_SERIAL (CIntValue,CValue)
@@ -32,14 +32,14 @@ public:
virtual const STR_String& GetText();
virtual double GetNumber();
virtual int GetValueType();
cInt GetInt();
CIntValue();
CIntValue(cInt innie);
CIntValue(cInt innie,
const char *name,
AllocationTYPE alloctype=CValue::HEAPVALUE);
virtual CValue* Calc(VALUE_OPERATOR op,
CValue *val);

View File

@@ -21,7 +21,7 @@
#include "EXP_Value.h"
class CListValue : public CPropValue
class CListValue : public CPropValue
{
Py_Header
//PLUGIN_DECLARE_SERIAL (CListValue,CValue)
@@ -48,7 +48,7 @@ public:
bool RemoveValue(CValue* val);
void SetReleaseOnDestruct(bool bReleaseContents);
bool SearchValue(CValue* val);
CValue* FindValue(const STR_String & name);
CValue* FindValue(const char *name);
@@ -81,7 +81,7 @@ public:
KX_PYMETHOD_VARARGS(CListValue,get);
KX_PYMETHOD_O(CListValue,from_id);
#endif
private:
std::vector<CValue*> m_pValueArray;

View File

@@ -31,7 +31,7 @@
#include "EXP_Value.h"
class CListWrapper : public CValue
class CListWrapper : public CValue
{
Py_Header
private:

View File

@@ -21,7 +21,7 @@
#include "EXP_Expression.h"
class COperator1Expr : public CExpression
class COperator1Expr : public CExpression
{
//PLUGIN_DECLARE_SERIAL_EXPRESSION (COperator1Expr,CExpression)
@@ -43,9 +43,9 @@ public:
COperator1Expr(VALUE_OPERATOR op, CExpression *lhs);
COperator1Expr();
virtual ~COperator1Expr();
private:
VALUE_OPERATOR m_op;
CExpression * m_lhs;

View File

@@ -23,7 +23,7 @@
#include "EXP_Expression.h"
#include "EXP_Value.h" // Added by ClassView
class COperator2Expr : public CExpression
class COperator2Expr : public CExpression
{
//PLUGIN_DECLARE_SERIAL_EXPRESSION (COperator2Expr,CExpression)
@@ -36,7 +36,7 @@ public:
//virtual bool IsLeftInside(float x,float y,float z,bool bBorderInclude);
//virtual bool IsRightInside(float x,float y,float z,bool bBorderInclude);
bool NeedsRecalculated();
void ClearModified() {
void ClearModified() {
if (m_lhs)
m_lhs->ClearModified();
if (m_rhs)
@@ -47,12 +47,12 @@ public:
COperator2Expr();
virtual ~COperator2Expr();
protected:
CExpression * m_rhs;
CExpression * m_lhs;
CValue* m_cached_calculate; // cached result
private:
VALUE_OPERATOR m_op;

View File

@@ -115,9 +115,9 @@ typedef struct PyObjectPlus_Proxy {
#define BGE_PROXY_FROM_REF_BORROW(_self) _bge_proxy_from_ref_borrow((void *)_self)
// This must be the first line of each
// This must be the first line of each
// PyC++ class
// AttributesPtr correspond to attributes of proxy generic pointer
// AttributesPtr correspond to attributes of proxy generic pointer
// each PyC++ class must be registered in KX_PythonInitTypes.cpp
#define __Py_Header \
public: \
@@ -362,9 +362,9 @@ typedef struct KX_PYATTRIBUTE_DEF {
const char *m_name; // name of the python attribute
KX_PYATTRIBUTE_TYPE m_type; // type of value
KX_PYATTRIBUTE_ACCESS m_access; // read/write access or read-only
int m_imin; // minimum value in case of integer attributes
int m_imin; // minimum value in case of integer attributes
// (for string: minimum string length, for flag: mask value, for float: matrix row size)
int m_imax; // maximum value in case of integer attributes
int m_imax; // maximum value in case of integer attributes
// (for string: maximum string length, for flag: 1 if flag is negative, float: vector/matrix col size)
float m_fmin; // minimum value in case of float attributes
float m_fmax; // maximum value in case of float attributes
@@ -500,7 +500,7 @@ typedef struct KX_PYATTRIBUTE_DEF {
#define KX_PYATTRIBUTE_STRING_RO(name, object, field) \
{ name, KX_PYATTRIBUTE_TYPE_STRING, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object, field), 0, 1 , NULL, NULL, NULL, {NULL, NULL, NULL, NULL, &((object *)0)->field, NULL, NULL} }
// only for char [] array
// only for char [] array
#define KX_PYATTRIBUTE_CHAR_RW(name, object, field) \
{ name, KX_PYATTRIBUTE_TYPE_CHAR, KX_PYATTRIBUTE_RW, 0, 0, 0.f, 0.f, true, false, offsetof(object, field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, ((object *)0)->field} }
#define KX_PYATTRIBUTE_CHAR_RW_CHECK(name, object, field, function) \
@@ -558,7 +558,7 @@ public: \
// By making SG_QList the ultimate parent for PyObjectPlus objects, it
// allows to put them in 2 different dynamic lists at the same time
// The use of these links is interesting because they free of memory allocation
// but it's very important not to mess up with them. If you decide that
// but it's very important not to mess up with them. If you decide that
// the SG_QList or SG_DList component is used for something for a certain class,
// they cannot can be used for anything else at a parent level!
// What these lists are and what they are used for must be carefully documented
@@ -569,12 +569,12 @@ public: \
class PyObjectPlus : public SG_QList
{ // The PyObjectPlus abstract class
Py_Header // Always start with Py_Header
public:
PyObjectPlus();
virtual ~PyObjectPlus(); // destructor
#ifdef WITH_PYTHON
PyObject *m_proxy; /* actually a PyObjectPlus_Proxy */
@@ -595,7 +595,7 @@ public:
static PyObject* py_get_attrdef(PyObject *self_py, const PyAttributeDef *attrdef);
static int py_set_attrdef(PyObject *self_py, PyObject *value, const PyAttributeDef *attrdef);
/* Kindof dumb, always returns True, the false case is checked for, before this function gets accessed */
static PyObject* pyattr_get_invalid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
@@ -612,13 +612,13 @@ public:
static void SetDeprecationWarningFirst(WarnLink* wlink);
static void SetDeprecationWarningLinkLast(WarnLink* wlink);
static void NullDeprecationWarning();
/** enable/disable display of deprecation warnings */
static void SetDeprecationWarnings(bool ignoreDeprecationWarnings);
/** Shows a deprecation warning */
static void ShowDeprecationWarning_func(const char *method, const char *prop);
static void ClearDeprecationWarning();
#endif
void InvalidateProxy();

View File

@@ -21,10 +21,10 @@
#include "EXP_Value.h"
class CStringValue : public CPropValue
class CStringValue : public CPropValue
{
//PLUGIN_DECLARE_SERIAL(CStringValue,CValue)
public:
/// Construction / destruction
@@ -37,7 +37,7 @@ public:
virtual const STR_String & GetText();
virtual double GetNumber();
virtual int GetValueType();
virtual CValue* Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
virtual void SetValue(CValue* newval) { m_strString = newval->GetText(); SetModified(true); }

View File

@@ -54,7 +54,7 @@ using namespace std;
#endif
enum VALUE_OPERATOR {
VALUE_MOD_OPERATOR, // %
VALUE_ADD_OPERATOR, // +
VALUE_SUB_OPERATOR, // -
@@ -94,14 +94,14 @@ enum VALUE_DATA_TYPE {
//extern int gRefCountValue; // debugonly variable to check if all CValue Refences are Dereferenced at programexit
#endif
struct HashableInt
struct HashableInt
{
HashableInt(int id) : mData(id) { }
unsigned long Hash() const { return 0;} ////}gHash(&mData, sizeof(int));}
bool operator==(HashableInt rhs) { return mData == rhs.mData; }
int mData;
};
@@ -137,7 +137,7 @@ struct ValueFlags {
unsigned short CustomFlag1 : 1;
unsigned short CustomFlag2 : 1;
};
/**
@@ -151,8 +151,8 @@ public:
virtual ~CAction() {
};
virtual void Execute() const =0;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CAction")
#endif
@@ -169,11 +169,11 @@ public:
*
* Together with CExpression, CValue and it's derived classes can be used to
* parse expressions into a parsetree with error detecting/correcting capabilities
* also expandable by a CFactory pluginsystem
* also expandable by a CFactory pluginsystem
*
* Base class for all editor functionality, flexible object type that allows
* calculations and uses reference counting for memory management.
*
*
* Features:
* - Reference Counting (AddRef() / Release())
* - Calculations (Calc() / CalcFinal())
@@ -182,10 +182,10 @@ public:
* - Property system (SetProperty() / GetProperty() / FindIdentifier())
* - Replication (GetReplica())
* - Flags (IsSelected() / IsModified() / SetSelected()...)
*
*
* - Some small editor-specific things added
* - A helperclass CompressorArchive handles the serialization
*
*
*/
class CValue : public PyObjectPlus
@@ -196,7 +196,7 @@ public:
STACKVALUE = 0,
HEAPVALUE = 1
};
enum DrawTYPE {
STARTFRAME = 0,
ENDFRAME = 1,
@@ -219,20 +219,20 @@ public:
}
virtual CValue *ConvertPythonToValue(PyObject *pyobj, const bool do_type_exception, const char *error_prefix);
static PyObject *pyattr_get_name(void *self, const KX_PYATTRIBUTE_DEF *attrdef);
virtual PyObject *ConvertKeysToPython( void );
#endif /* WITH_PYTHON */
// Expression Calculation
virtual CValue* Calc(VALUE_OPERATOR op, CValue *val) = 0;
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) = 0;
virtual void SetOwnerExpression(class CExpression* expr);
void Execute(const CAction& a)
{
@@ -241,8 +241,8 @@ public:
/// Reference Counting
int GetRefCount()
{
return m_refcount;
{
return m_refcount;
}
// Add a reference to this value
@@ -254,7 +254,7 @@ public:
#ifdef DEBUG
//gRefCountValue++;
#endif
m_refcount++;
m_refcount++;
return this;
}
@@ -277,7 +277,7 @@ public:
{
// Reference count reached 0, delete ourselves and return 0
// MT_assert(m_refcount==0, "Reference count reached sub-zero, object released too much");
delete this;
return 0;
}
@@ -321,9 +321,9 @@ public:
virtual CValue* GetReplica() =0;
virtual void ProcessReplica();
//virtual CValue* Copy() = 0;
STR_String op2str(VALUE_OPERATOR op);
// setting / getting flags
inline void SetSelected(bool bSelected) { m_ValFlags.Selected = bSelected; }
virtual void SetModified(bool bModified) { m_ValFlags.Modified = bModified; }
@@ -331,7 +331,7 @@ public:
inline void SetReleaseRequested(bool bReleaseRequested) { m_ValFlags.ReleaseRequested=bReleaseRequested; }
inline void SetError(bool err) { m_ValFlags.Error=err; }
inline void SetVisible (bool vis) { m_ValFlags.Visible=vis; }
virtual bool IsModified() { return m_ValFlags.Modified; }
inline bool IsError() { return m_ValFlags.Error; }
virtual bool IsAffected() { return m_ValFlags.Affected || m_ValFlags.Modified; }
@@ -392,7 +392,7 @@ public: \
////////////////////////////////////////////////////////////////////////////////
// CPropValue is a CValue derived class, that implements the identification (String name)
// SetName() / GetName(),
// SetName() / GetName(),
// normal classes should derive from CPropValue, real lightweight classes straight from CValue
@@ -405,22 +405,22 @@ public:
{
}
virtual ~CPropValue()
{
}
virtual void SetName(const char *name) {
m_strNewName = name;
}
virtual STR_String& GetName() {
//STR_String namefromprop = GetPropertyText("Name");
//if (namefromprop.Length() > 0)
// return namefromprop;
return m_strNewName;
} // name of Value
protected:
STR_String m_strNewName; // Identification

View File

@@ -26,7 +26,7 @@
#define KX_Z 2
class CVectorValue : public CPropValue
class CVectorValue : public CPropValue
{
//PLUGIN_DECLARE_SERIAL(CVectorValue,CValue)
@@ -38,14 +38,14 @@ public:
virtual double* GetVector3(bool bGetTransformedVec=false);
virtual double GetNumber();
virtual int GetValueType();
CValue* Calc(VALUE_OPERATOR op, CValue *val) {
return val->CalcFinal(VALUE_VECTOR_TYPE, op, this);
}
CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
CVectorValue(double vec[3], const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE);
CVectorValue() {};
@@ -54,7 +54,7 @@ public:
virtual ~CVectorValue();
//virtual bool ExportT3D(File *txtfile,bool bNoName=false);
void AddConfigurationData(CValue* menuvalue);
virtual CValue* GetReplica();
@@ -70,14 +70,14 @@ public:
void SnapPosition(const double snapvec[])
{
if (snapvec[KX_X] >= 1)
SnapPoint(m_vec[KX_X],snapvec[KX_X]);
if (snapvec[KX_Y] >= 1)
SnapPoint(m_vec[KX_Y],snapvec[KX_Y]);
if (snapvec[KX_Z] >= 1)
SnapPoint(m_vec[KX_Z],snapvec[KX_Z]);
}
#endif

View File

@@ -39,7 +39,7 @@
//
// Void value, used to transport *any* type of data
//
class CVoidValue : public CPropValue
class CVoidValue : public CPropValue
{
//PLUGIN_DECLARE_SERIAL (CVoidValue,CValue)
@@ -67,12 +67,12 @@ public:
/// Value replication
virtual CValue* GetReplica();
/// Data members
bool m_bDeleteOnDestruct;
void* m_pAnything;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:CVoidValue")
#endif

View File

@@ -103,7 +103,7 @@ this object
*/
{
CValue *ret;
switch (dtype) {
case VALUE_EMPTY_TYPE:
case VALUE_BOOL_TYPE:
@@ -204,7 +204,7 @@ CValue* CBoolValue::GetReplica()
{
CBoolValue* replica = new CBoolValue(*this);
replica->ProcessReplica();
return replica;
}

View File

@@ -30,7 +30,7 @@ CConstExpr::CConstExpr()
CConstExpr::CConstExpr(CValue* constval)
CConstExpr::CConstExpr(CValue* constval)
/*
pre:
effect: constructs a CConstExpr cointing the value constval
@@ -73,7 +73,7 @@ ret: a new object containing the value of the stored CValue
void CConstExpr::ClearModified()
{
{
if (m_value)
{
m_value->SetModified(false);

View File

@@ -58,7 +58,7 @@ CValue *CEmptyValue::Calc(VALUE_OPERATOR op, CValue *val)
*/
{
return val->CalcFinal(VALUE_EMPTY_TYPE, op, this);
}
@@ -107,7 +107,7 @@ bool CEmptyValue::IsInside(CValue* testpoint,bool bBorderInclude)
double* CEmptyValue::GetVector3(bool bGetTransformedVec)
{
{
assertd(false); // don't get vector from me
return ZeroVector();
}
@@ -125,7 +125,7 @@ const STR_String & CEmptyValue::GetText()
CValue* CEmptyValue::GetReplica()
{
{
CEmptyValue* replica = new CEmptyValue(*this);
replica->ProcessReplica();
return replica;

View File

@@ -82,7 +82,7 @@ ret: a new object containing the result of applying operator op to this
break;
}
}
return errorval;
}
@@ -122,7 +122,7 @@ const STR_String & CErrorValue::GetText()
CValue* CErrorValue::GetReplica()
{
{
// who would want a copy of an error ?
trace ("Error: ErrorValue::GetReplica() not implemented yet");
assertd(false);

View File

@@ -50,21 +50,21 @@ CBrokenLinkInfo::~CBrokenLinkInfo()
void CBrokenLinkInfo::RestoreLink()
{
assertd(m_pExpr);
if (m_pExpr)
{
if (!m_bRestored) {
m_bRestored=true;
}
if (*m_pmemExpr)
{
(*m_pmemExpr)->Release();
}
*m_pmemExpr = m_pExpr;
// m_pExpr=NULL;
}
}

View File

@@ -55,7 +55,7 @@ pre:
effect: constructs a new CFloatValue containing value fl
*/
{
m_float = fl;
SetName(name);
if (alloctype==CValue::STACKVALUE)
@@ -119,7 +119,7 @@ ret: a new object containing the result of applying operator op to val and
*/
{
CValue *ret;
switch (dtype) {
case VALUE_INT_TYPE:
{
@@ -293,8 +293,8 @@ int CFloatValue::GetValueType()
void CFloatValue::SetValue(CValue* newval)
{
m_float = (float)newval->GetNumber();
{
m_float = (float)newval->GetNumber();
SetModified(true);
}
@@ -312,7 +312,7 @@ const STR_String & CFloatValue::GetText()
CValue* CFloatValue::GetReplica()
{
{
CFloatValue* replica = new CFloatValue(*this);
replica->m_pstrRep = NULL; /* should be in CFloatValue::ProcessReplica() but its not defined, no matter */
replica->ProcessReplica();

View File

@@ -90,7 +90,7 @@ CExpression* CIdentifierExpr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlin
void CIdentifierExpr::ClearModified()
void CIdentifierExpr::ClearModified()
{
assertd(false); // not implemented yet
}

View File

@@ -104,10 +104,10 @@ bool CIfExpr::IsInside(float x,float y,float z,bool bBorderInclude)
assertd(false);
return false;
}
bool CIfExpr::NeedsRecalculated()
bool CIfExpr::NeedsRecalculated()
{
return (m_guard->NeedsRecalculated() ||
m_e1->NeedsRecalculated() ||

View File

@@ -33,7 +33,7 @@
#include "EXP_IdentifierExpr.h"
// this is disable at the moment, I expected a memleak from it, but the error-cleanup was the reason
// well, looks we don't need it anyway, until maybe the Curved Surfaces are integrated into CSG
// well, looks we don't need it anyway, until maybe the Curved Surfaces are integrated into CSG
// cool things like (IF(LOD==1,CCurvedValue,IF(LOD==2,CCurvedValue2)) etc...
#include "EXP_IfExpr.h"
@@ -185,7 +185,7 @@ void CParser::NextSym()
// sets the global variable constkind to the kind of operator
// if it is a reference to a cell
// sets the global variable cellcoord to the kind of operator
errmsg = NULL;
while (ch == ' ' || ch == 0x9)
NextCh();
@@ -303,7 +303,7 @@ void CParser::NextSym()
} else if (((ch >= 'a') && (ch <= 'z'))
|| ((ch >= 'A') && (ch <= 'Z')))
{ // reserved word?
start = chcount;
CharRep();
GrabString(start);
@@ -421,7 +421,7 @@ CExpression *CParser::Ex(int i)
// returns an CExpression, containing the parsed input
CExpression *e1 = NULL, *e2 = NULL;
int opkind2;
if (i < NUM_PRIORITY) {
e1 = Ex(i + 1);
while ((sym == opsym) && (Priority(opkind) == i)) {
@@ -522,7 +522,7 @@ CExpression *CParser::Ex(int i)
{
e1 = new CIdentifierExpr(const_as_string,m_identifierContext);
NextSym();
break;
}
case errorsym:
@@ -536,7 +536,7 @@ CExpression *CParser::Ex(int i)
errmsgval->Release();
//e1 = Error(errmsg->Calculate()->GetText());//new CConstExpr(errmsg->Calculate());
if ( !(errmsg->Release()) )
{
errmsg=NULL;
@@ -569,19 +569,19 @@ CExpression *CParser::Expr()
CExpression* CParser::ProcessText
(const char *intext) {
// and parses the string in intext and returns it.
CExpression* expr;
text = intext;
chcount = 0;
if (text.Length() == 0) {
return NULL;
}
ch = text[0];
/* if (ch != '=') {
* expr = new CConstExpr(new CStringValue(text));
@@ -599,7 +599,7 @@ CExpression* CParser::ProcessText
}
if (errmsg)
errmsg->Release();
return expr;
}
@@ -609,7 +609,7 @@ float CParser::GetFloat(STR_String& txt)
{
// returns parsed text into a float
// empty string returns -1
// AfxMessageBox("parsed string="+txt);
CValue* val=NULL;
float result=-1;
@@ -619,9 +619,9 @@ float CParser::GetFloat(STR_String& txt)
if (expr) {
val = expr->Calculate();
result=(float)val->GetNumber();
val->Release();
expr->Release();
}
@@ -632,10 +632,10 @@ float CParser::GetFloat(STR_String& txt)
CValue* CParser::GetValue(STR_String& txt, bool bFallbackToText)
{
// returns parsed text into a value,
// returns parsed text into a value,
// empty string returns NULL value !
// if bFallbackToText then unparsed stuff is put into text
CValue* result=NULL;
CExpression* expr = ProcessText(txt);
if (expr) {

View File

@@ -34,7 +34,7 @@ pre: false
effect: constructs a new CIntValue
*/
{
#ifdef DEBUG_
m_textval = "Int illegal constructor";
#endif
@@ -59,13 +59,13 @@ CIntValue::CIntValue(cInt innie,const char *name,AllocationTYPE alloctype)
{
m_int = innie;
SetName(name);
if (alloctype==CValue::STACKVALUE)
{
CValue::DisableRefCount();
}
m_pstrRep=NULL;
}
@@ -118,7 +118,7 @@ object and val
CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val)
{
CValue *ret;
switch (dtype) {
case VALUE_EMPTY_TYPE:
case VALUE_INT_TYPE:
@@ -312,7 +312,7 @@ const STR_String & CIntValue::GetText()
if (!m_pstrRep)
m_pstrRep=new STR_String();
m_pstrRep->Format("%lld",m_int);
return *m_pstrRep;
}
@@ -323,15 +323,15 @@ CValue* CIntValue::GetReplica()
CIntValue* replica = new CIntValue(*this);
replica->ProcessReplica();
replica->m_pstrRep = NULL;
return replica;
}
void CIntValue::SetValue(CValue* newval)
{
m_int = (cInt)newval->GetNumber();
{
m_int = (cInt)newval->GetNumber();
SetModified(true);
}

View File

@@ -290,7 +290,7 @@ static Py_ssize_t listvalue_bufferlen(PyObject *self)
CListValue *list= static_cast<CListValue *>(BGE_PROXY_REF(self));
if (list==NULL)
return 0;
return (Py_ssize_t)list->GetCount();
}
@@ -298,24 +298,24 @@ static PyObject *listvalue_buffer_item(PyObject *self, Py_ssize_t index)
{
CListValue *list= static_cast<CListValue *>(BGE_PROXY_REF(self));
CValue *cval;
if (list==NULL) {
PyErr_SetString(PyExc_SystemError, "val = CList[i], " BGE_PROXY_ERROR_MSG);
return NULL;
}
int count = list->GetCount();
if (index < 0)
index = count+index;
if (index < 0 || index >= count) {
PyErr_SetString(PyExc_IndexError, "CList[i]: Python ListIndex out of range in CValueList");
return NULL;
}
cval= list->GetValue(index);
PyObject *pyobj = cval->ConvertValueToPython();
if (pyobj)
return pyobj;
@@ -360,7 +360,7 @@ static PyObject *listvalue_mapping_subscript(PyObject *self, PyObject *key)
PyErr_SetString(PyExc_SystemError, "value = CList[i], " BGE_PROXY_ERROR_MSG);
return NULL;
}
if (PyUnicode_Check(key)) {
CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(key));
if (item) {
@@ -403,37 +403,37 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other)
{
CListValue *listval= static_cast<CListValue *>(BGE_PROXY_REF(self));
Py_ssize_t i, numitems, numitems_orig;
if (listval==NULL) {
PyErr_SetString(PyExc_SystemError, "CList+other, " BGE_PROXY_ERROR_MSG);
return NULL;
}
numitems_orig= listval->GetCount();
// for now, we support CListValue concatenated with items
// and CListValue concatenated to Python Lists
// and CListValue concatenated with another CListValue
/* Shallow copy, don't use listval->GetReplica(), it will screw up with KX_GameObjects */
CListValue* listval_new = new CListValue();
if (PyList_Check(other))
{
CValue* listitemval;
bool error = false;
numitems = PyList_GET_SIZE(other);
/* copy the first part of the list */
listval_new->Resize(numitems_orig + numitems);
for (i=0;i<numitems_orig;i++)
listval_new->SetValue(i, listval->GetValue(i)->AddRef());
for (i=0;i<numitems;i++)
{
listitemval = listval->ConvertPythonToValue(PyList_GET_ITEM(other, i), true, "cList + pyList: CListValue, ");
if (listitemval) {
listval_new->SetValue(i+numitems_orig, listitemval);
} else {
@@ -441,13 +441,13 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other)
break;
}
}
if (error) {
listval_new->Resize(numitems_orig+i); /* resize so we don't try release NULL pointers */
listval_new->Release();
return NULL; /* ConvertPythonToValue above sets the error */
return NULL; /* ConvertPythonToValue above sets the error */
}
}
else if (PyObject_TypeCheck(other, &CListValue::Type)) {
// add items from otherlist to this list
@@ -457,18 +457,18 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other)
PyErr_SetString(PyExc_SystemError, "CList+other, " BGE_PROXY_ERROR_MSG);
return NULL;
}
numitems = otherval->GetCount();
/* copy the first part of the list */
listval_new->Resize(numitems_orig + numitems); /* resize so we don't try release NULL pointers */
for (i=0;i<numitems_orig;i++)
listval_new->SetValue(i, listval->GetValue(i)->AddRef());
/* now copy the other part of the list */
for (i=0;i<numitems;i++)
listval_new->SetValue(i+numitems_orig, otherval->GetValue(i)->AddRef());
}
return listval_new->NewProxy(true); /* python owns this list */
}
@@ -476,12 +476,12 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other)
static int listvalue_buffer_contains(PyObject *self_v, PyObject *value)
{
CListValue *self = static_cast<CListValue *>(BGE_PROXY_REF(self_v));
if (self == NULL) {
PyErr_SetString(PyExc_SystemError, "val in CList, " BGE_PROXY_ERROR_MSG);
return -1;
}
if (PyUnicode_Check(value)) {
if (self->FindValue((const char *)_PyUnicode_AsString(value))) {
return 1;
@@ -492,9 +492,9 @@ static int listvalue_buffer_contains(PyObject *self_v, PyObject *value)
for (int i=0; i < self->GetCount(); i++)
if (self->GetValue(i) == item) // Com
return 1;
} // not using CheckEqual
return 0;
}

View File

@@ -63,7 +63,7 @@ ret: a new object containing the result of applying the operator m_op to the
ret = empty->Calc(m_op, temp);
empty->Release();
temp->Release();
return ret;
}
@@ -74,10 +74,10 @@ bool COperator1Expr::IsInside(float x, float y, float z,bool bBorderInclude)
bool result = true;
switch (m_op)
{
case VALUE_ADD_OPERATOR:
{
if (m_lhs)
{
result = result || m_lhs->IsInside(x,y,z,bBorderInclude);
@@ -116,7 +116,7 @@ CExpression* COperator1Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlink
// changed
//numchanges++;
newlhs->AddRef();
//m_lhs->Release();
brokenlinks.push_back(new CBrokenLinkInfo(&m_lhs,m_lhs));
@@ -129,7 +129,7 @@ CExpression* COperator1Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlink
return Release();
}
}
void COperator1Expr::BroadcastOperators(VALUE_OPERATOR op)
@@ -145,7 +145,7 @@ bool COperator1Expr::MergeExpression(CExpression *otherexpr)
{
if (m_lhs)
return m_lhs->MergeExpression(otherexpr);
assertd(false); // should not get here, expression is not compatible for merge
return false;
}

View File

@@ -28,7 +28,7 @@
//////////////////////////////////////////////////////////////////////
COperator2Expr::COperator2Expr(VALUE_OPERATOR op, CExpression *lhs, CExpression *rhs)
:
:
m_rhs(rhs),
m_lhs(lhs),
m_cached_calculate(NULL),
@@ -51,7 +51,7 @@ pre:
effect: constucts an empty COperator2Expr
*/
{
}
COperator2Expr::~COperator2Expr()
@@ -66,7 +66,7 @@ effect: deletes the object
m_rhs->Release();
if (m_cached_calculate)
m_cached_calculate->Release();
}
CValue* COperator2Expr::Calculate()
/*
@@ -75,11 +75,11 @@ ret: a new object containing the result of applying operator m_op to m_lhs
and m_rhs
*/
{
bool leftmodified,rightmodified;
leftmodified = m_lhs->NeedsRecalculated();
rightmodified = m_rhs->NeedsRecalculated();
// if no modifications on both left and right subtree, and result is already calculated
// then just return cached result...
if (!leftmodified && !rightmodified && (m_cached_calculate))
@@ -87,30 +87,30 @@ and m_rhs
// not modified, just return m_cached_calculate
} else {
// if not yet calculated, or modified...
if (m_cached_calculate) {
m_cached_calculate->Release();
m_cached_calculate=NULL;
}
CValue* ffleft = m_lhs->Calculate();
CValue* ffright = m_rhs->Calculate();
ffleft->SetOwnerExpression(this);//->m_pOwnerExpression=this;
ffright->SetOwnerExpression(this);//->m_pOwnerExpression=this;
m_cached_calculate = ffleft->Calc(m_op,ffright);
//if (m_cached_calculate)
// m_cached_calculate->Action(CValue::SETOWNEREXPR,&CVoidValue(this,false,CValue::STACKVALUE));
ffleft->Release();
ffright->Release();
}
return m_cached_calculate->AddRef();
}
#if 0
@@ -118,7 +118,7 @@ bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude)
{
bool inside;
inside = false;
switch (m_op) {
case VALUE_ADD_OPERATOR:
{
@@ -164,7 +164,7 @@ bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude)
// not yet implemented, only add or sub csg operations
}
}
return inside;
}
@@ -193,7 +193,7 @@ bool COperator2Expr::NeedsRecalculated()
return m_lhs->NeedsRecalculated();
//modleft = m_lhs->NeedsRecalculated();
//return (modleft || modright);
}
@@ -213,7 +213,7 @@ CExpression* COperator2Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlink
/*
if (m_cached_calculate)
m_cached_calculate->Action(CValue::REFRESH_CACHE);
CExpression* newlhs = m_lhs->CheckLink(brokenlinks);
CExpression* newrhs = m_rhs->CheckLink(brokenlinks);
@@ -235,11 +235,11 @@ CExpression* COperator2Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlink
if (m_lhs && m_rhs) {
return this;
}
AddRef();
if (m_lhs)
if (m_lhs)
return Release(m_lhs->AddRef());
if (m_rhs)
return Release(m_rhs->AddRef());
/

View File

@@ -38,9 +38,9 @@
* Derived from work by
* David Redish
* graduate student
* Computer Science Department
* Computer Science Department
* Carnegie Mellon University (CMU)
* Center for the Neural Basis of Cognition (CNBC)
* Center for the Neural Basis of Cognition (CNBC)
* http://www.python.org/doc/PyCPP.html
*
* ----------------------------- */
@@ -141,7 +141,7 @@ PyObject *PyObjectPlus::py_base_repr(PyObject *self) // This should be the ent
PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
return NULL;
}
return self_plus->py_repr();
return self_plus->py_repr();
}
@@ -420,7 +420,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
return PyFloat_FromDouble(*val);
} else {
// vector, verify size
if (attrdef->m_size != attrdef->m_imax*sizeof(float))
if (attrdef->m_size != attrdef->m_imax*sizeof(float))
{
return NULL;
}
@@ -437,7 +437,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
}
} else {
// matrix case
if (attrdef->m_size != attrdef->m_imax*attrdef->m_imin*sizeof(float))
if (attrdef->m_size != attrdef->m_imax*attrdef->m_imin*sizeof(float))
{
return NULL;
}
@@ -530,11 +530,11 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
size_t bufferSize = 0;
PyObject *item = NULL; // to store object that must be dereferenced in case of error
PyObject *list = NULL; // to store object that must be dereferenced in case of error
ptr += attrdef->m_offset;
if (attrdef->m_length > 1)
{
if (!PySequence_Check(value))
if (!PySequence_Check(value))
{
PyErr_Format(PyExc_TypeError, "expected a sequence for attribute \"%s\"", attrdef->m_name);
return PY_SET_ATTR_FAIL;
@@ -544,10 +544,10 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
PyErr_Format(PyExc_TypeError, "incorrect number of elements in sequence for attribute \"%s\"", attrdef->m_name);
return PY_SET_ATTR_FAIL;
}
switch (attrdef->m_type)
switch (attrdef->m_type)
{
case KX_PYATTRIBUTE_TYPE_FUNCTION:
if (attrdef->m_setFunction == NULL)
if (attrdef->m_setFunction == NULL)
{
PyErr_Format(PyExc_AttributeError, "function attribute without function for attribute \"%s\", report to blender.org", attrdef->m_name);
return PY_SET_ATTR_FAIL;
@@ -582,16 +582,16 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
for (int i=0; i<attrdef->m_length; i++)
{
item = PySequence_GetItem(value, i); /* new ref */
switch (attrdef->m_type)
switch (attrdef->m_type)
{
case KX_PYATTRIBUTE_TYPE_BOOL:
{
bool *var = reinterpret_cast<bool*>(ptr);
ptr += sizeof(bool);
if (PyLong_Check(item))
if (PyLong_Check(item))
{
*var = (PyLong_AsLong(item) != 0);
}
}
else if (PyBool_Check(item))
{
*var = (item == Py_True);
@@ -607,7 +607,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
{
short int *var = reinterpret_cast<short int*>(ptr);
ptr += sizeof(short int);
if (PyLong_Check(item))
if (PyLong_Check(item))
{
int val = PyLong_AsLong(item);
if (attrdef->m_clamp)
@@ -643,7 +643,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
{
int *var = reinterpret_cast<int*>(ptr);
ptr += sizeof(int);
if (PyLong_Check(item))
if (PyLong_Check(item))
{
int val = PyLong_AsLong(item);
if (attrdef->m_clamp)
@@ -709,7 +709,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
// if the checing function didnt set an error then set a generic one here so we don't set an error with no exception
if (PyErr_Occurred()==0)
PyErr_Format(PyExc_AttributeError, "type check error for attribute \"%s\", reasion unknown", attrdef->m_name);
// post check returned an error, restore values
UNDO_AND_ERROR:
if (undoBuffer)
@@ -741,7 +741,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
{
// post check function is provided, prepare undo buffer
sourceBuffer = ptr;
switch (attrdef->m_type)
switch (attrdef->m_type)
{
case KX_PYATTRIBUTE_TYPE_BOOL:
bufferSize = sizeof(bool);
@@ -785,16 +785,16 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
}
}
}
switch (attrdef->m_type)
switch (attrdef->m_type)
{
case KX_PYATTRIBUTE_TYPE_BOOL:
{
bool *var = reinterpret_cast<bool*>(ptr);
if (PyLong_Check(value))
if (PyLong_Check(value))
{
*var = (PyLong_AsLong(value) != 0);
}
}
else if (PyBool_Check(value))
{
*var = (value == Py_True);
@@ -809,10 +809,10 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_FLAG:
{
bool bval;
if (PyLong_Check(value))
if (PyLong_Check(value))
{
bval = (PyLong_AsLong(value) != 0);
}
}
else if (PyBool_Check(value))
{
bval = (value == Py_True);
@@ -852,7 +852,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_SHORT:
{
short int *var = reinterpret_cast<short int*>(ptr);
if (PyLong_Check(value))
if (PyLong_Check(value))
{
int val = PyLong_AsLong(value);
if (attrdef->m_clamp)
@@ -887,7 +887,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_INT:
{
int *var = reinterpret_cast<int*>(ptr);
if (PyLong_Check(value))
if (PyLong_Check(value))
{
int val = PyLong_AsLong(value);
if (attrdef->m_clamp)
@@ -914,14 +914,14 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_FLOAT:
{
float *var = reinterpret_cast<float*>(ptr);
if (attrdef->m_imin != 0)
if (attrdef->m_imin != 0)
{
if (attrdef->m_size != attrdef->m_imin*attrdef->m_imax*sizeof(float))
if (attrdef->m_size != attrdef->m_imin*attrdef->m_imax*sizeof(float))
{
PyErr_Format(PyExc_TypeError, "internal error: incorrect field size for attribute \"%s\"", attrdef->m_name);
goto FREE_AND_ERROR;
}
if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imin)
if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imin)
{
PyErr_Format(PyExc_TypeError, "expected a sequence of [%d][%d] floats for attribute \"%s\"", attrdef->m_imin, attrdef->m_imax, attrdef->m_name);
goto FREE_AND_ERROR;
@@ -929,7 +929,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
for (int i=0; i<attrdef->m_imin; i++)
{
PyObject *list = PySequence_GetItem(value, i); /* new ref */
if (!PySequence_Check(list) || PySequence_Size(list) != attrdef->m_imax)
if (!PySequence_Check(list) || PySequence_Size(list) != attrdef->m_imax)
{
PyErr_Format(PyExc_TypeError, "expected a sequence of [%d][%d] floats for attribute \"%s\"", attrdef->m_imin, attrdef->m_imax, attrdef->m_name);
goto RESTORE_AND_ERROR;
@@ -949,15 +949,15 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
Py_DECREF(list);
list = NULL;
}
}
else if (attrdef->m_imax != 0)
}
else if (attrdef->m_imax != 0)
{
if (attrdef->m_size != attrdef->m_imax*sizeof(float))
if (attrdef->m_size != attrdef->m_imax*sizeof(float))
{
PyErr_Format(PyExc_TypeError, "internal error: incorrect field size for attribute \"%s\"", attrdef->m_name);
goto FREE_AND_ERROR;
}
if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imax)
if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imax)
{
PyErr_Format(PyExc_TypeError, "expected a sequence of [%d] floats for attribute \"%s\"", attrdef->m_imax, attrdef->m_name);
goto FREE_AND_ERROR;
@@ -973,7 +973,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
item = NULL;
++var;
}
}
}
else
{
if (!py_check_attr_float(var, value, attrdef))
@@ -983,7 +983,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
}
case KX_PYATTRIBUTE_TYPE_VECTOR:
{
if (!PySequence_Check(value) || PySequence_Size(value) != 3)
if (!PySequence_Check(value) || PySequence_Size(value) != 3)
{
PyErr_Format(PyExc_TypeError, "expected a sequence of 3 floats for attribute \"%s\"", attrdef->m_name);
goto FREE_AND_ERROR;
@@ -1018,7 +1018,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
}
case KX_PYATTRIBUTE_TYPE_CHAR:
{
if (PyUnicode_Check(value))
if (PyUnicode_Check(value))
{
Py_ssize_t val_size;
const char *val = _PyUnicode_AsStringAndSize(value, &val_size);
@@ -1035,7 +1035,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_STRING:
{
STR_String *var = reinterpret_cast<STR_String*>(ptr);
if (PyUnicode_Check(value))
if (PyUnicode_Check(value))
{
Py_ssize_t val_len;
const char *val = _PyUnicode_AsStringAndSize(value, &val_len); /* XXX, should be 'const' but we do a silly trick to have a shorter string */
@@ -1134,7 +1134,7 @@ PyObject *PyObjectPlus::GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
}
//PyObject_Print(self->m_proxy, stdout, 0);
//printf("ref %d\n", self->m_proxy->ob_refcnt);
BGE_PROXY_REF(self->m_proxy) = self; /* Its possible this was set to NULL, so set it back here */
BGE_PROXY_PTR(self->m_proxy) = ptr;
Py_INCREF(self->m_proxy); /* we own one, thos ones fore the return */
@@ -1143,13 +1143,13 @@ PyObject *PyObjectPlus::GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr, bool py_owns)
{
if (!self)
if (!self)
{
// in case of proxy without reference to game object
PyObject *proxy = reinterpret_cast<PyObject *>PyObject_NEW( PyObjectPlus_Proxy, tp);
BGE_PROXY_PYREF(proxy) = false;
BGE_PROXY_PYOWNS(proxy) = py_owns;
BGE_PROXY_REF(proxy) = NULL;
BGE_PROXY_REF(proxy) = NULL;
BGE_PROXY_PTR(proxy) = ptr;
#ifdef USE_WEAKREFS
BGE_PROXY_WKREF(proxy) = NULL;
@@ -1168,9 +1168,9 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
Py_INCREF(self->m_proxy);
return self->m_proxy;
}
}
GetProxyPlus_Ext(self, tp, ptr);
if (py_owns) {
BGE_PROXY_PYOWNS(self->m_proxy) = py_owns;
@@ -1204,7 +1204,7 @@ void PyObjectPlus::ClearDeprecationWarning()
{
WarnLink *wlink_next;
WarnLink *wlink = GetDeprecationWarningLinkFirst();
while (wlink) {
wlink->warn_done= false; /* no need to NULL the link, its cleared before adding to the list next time round */
wlink_next= reinterpret_cast<WarnLink *>(wlink->link);

View File

@@ -41,14 +41,14 @@ CStringValue::CStringValue(const char *txt,const char *name,AllocationTYPE alloc
{
m_strString = txt;
SetName(name);
if (alloctype==CValue::STACKVALUE)
{
CValue::DisableRefCount();
}
}
@@ -71,7 +71,7 @@ CValue* CStringValue::Calc(VALUE_OPERATOR op, CValue *val)
CValue* CStringValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val)
{
CValue *ret;
if (op == VALUE_ADD_OPERATOR) {
if (dtype == VALUE_ERROR_TYPE)
ret = new CErrorValue(val->GetText() + op2str(op) + GetText());
@@ -138,7 +138,7 @@ bool CStringValue::IsEqual(const STR_String & other)
}
CValue* CStringValue::GetReplica()
{
{
CStringValue* replica = new CStringValue(*this);
replica->ProcessReplica();
return replica;

View File

@@ -70,7 +70,7 @@ PyMethodDef CValue::Methods[] = {
/*#define CVALUE_DEBUG*/
#ifdef CVALUE_DEBUG
int gRefCount;
struct SmartCValueRef
struct SmartCValueRef
{
CValue *m_ref;
int m_count;
@@ -92,7 +92,7 @@ std::vector<SmartCValueRef> gRefList;
CValue::CValue()
: PyObjectPlus(),
m_pNamedPropertyArray(NULL),
m_refcount(1)
/*
@@ -148,7 +148,7 @@ STR_String CValue::op2str(VALUE_OPERATOR op)
{
//pre:
//ret: the stringrepresentation of operator op
STR_String opmsg;
switch (op) {
case VALUE_MOD_OPERATOR:
@@ -225,7 +225,7 @@ void CValue::SetProperty(const STR_String & name,CValue* ioProperty)
else { // Make sure we have a property array
m_pNamedPropertyArray = new std::map<STR_String,CValue *>;
}
// Add property at end of array
(*m_pNamedPropertyArray)[name] = ioProperty->AddRef();//->Add(ioProperty);
}
@@ -247,7 +247,7 @@ void CValue::SetProperty(const char* name,CValue* ioProperty)
else { // Make sure we have a property array
m_pNamedPropertyArray = new std::map<STR_String,CValue *>;
}
// Add property at end of array
(*m_pNamedPropertyArray)[name] = ioProperty->AddRef();//->Add(ioProperty);
}
@@ -293,7 +293,7 @@ float CValue::GetPropertyNumber(const STR_String& inName,float defnumber)
{
CValue *property = GetProperty(inName);
if (property)
return property->GetNumber();
return property->GetNumber();
else
return defnumber;
}
@@ -316,7 +316,7 @@ bool CValue::RemoveProperty(const char *inName)
return true;
}
}
return false;
}
@@ -328,7 +328,7 @@ vector<STR_String> CValue::GetPropertyNames()
vector<STR_String> result;
if (!m_pNamedPropertyArray) return result;
result.reserve(m_pNamedPropertyArray->size());
std::map<STR_String,CValue*>::iterator it;
for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++)
{
@@ -369,7 +369,7 @@ void CValue::SetPropertiesModified(bool inModified)
{
if (!m_pNamedPropertyArray) return;
std::map<STR_String,CValue*>::iterator it;
for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++)
((*it).second)->SetModified(inModified);
}
@@ -383,11 +383,11 @@ bool CValue::IsAnyPropertyModified()
{
if (!m_pNamedPropertyArray) return false;
std::map<STR_String,CValue*>::iterator it;
for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++)
if (((*it).second)->IsModified())
return true;
return false;
}
@@ -471,7 +471,7 @@ void CValue::DisableRefCount()
void CValue::ProcessReplica() /* was AddDataToReplica in 2.48 */
{
m_refcount = 1;
#ifdef DEBUG
//gRefCountValue++;
#endif
@@ -518,7 +518,7 @@ CValue* CValue::FindIdentifier(const STR_String& identifiername)
if (tempresult)
{
result=tempresult->FindIdentifier(rightstring);
}
}
} else
{
result = GetProperty(identifiername);
@@ -666,7 +666,7 @@ void CValue::SetColorOperator(VALUE_OPERATOR op)
/* intentionally empty */
}
void CValue::SetValue(CValue* newval)
{
{
// no one should get here
assertd(newval->GetNumber() == 10121969);
}

View File

@@ -36,51 +36,51 @@
CVectorValue::CVectorValue(float x,float y,float z, AllocationTYPE alloctype)
{
SetCustomFlag1(false);//FancyOutput=false;
if (alloctype == STACKVALUE)
{
CValue::DisableRefCount();
};
m_vec[KX_X] = m_transformedvec[KX_X] = x;
m_vec[KX_Y] = m_transformedvec[KX_Y] = y;
m_vec[KX_Z] = m_transformedvec[KX_Z] = z;
}
CVectorValue::CVectorValue(double vec[3], const char *name,AllocationTYPE alloctype)
{
SetCustomFlag1(false);//FancyOutput=false;
m_vec[KX_X] = m_transformedvec[KX_X] = vec[KX_X];
m_vec[KX_Y] = m_transformedvec[KX_Y] = vec[KX_Y];
m_vec[KX_Z] = m_transformedvec[KX_Z] = vec[KX_Z];
if (alloctype == STACKVALUE)
{
CValue::DisableRefCount();
}
SetName(name);
}
CVectorValue::CVectorValue(double vec[3], AllocationTYPE alloctype)
{
SetCustomFlag1(false);//FancyOutput=false;
m_vec[KX_X] = m_transformedvec[KX_X] = vec[KX_X];
m_vec[KX_Y] = m_transformedvec[KX_Y] = vec[KX_Y];
m_vec[KX_Z] = m_transformedvec[KX_Z] = vec[KX_Z];
if (alloctype == STACKVALUE)
{
CValue::DisableRefCount();
}
}
CVectorValue::~CVectorValue()
{
@@ -95,7 +95,7 @@ CVectorValue::~CVectorValue()
CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val)
{
CValue *ret = NULL;
switch (op) {
case VALUE_ADD_OPERATOR:
{
@@ -122,7 +122,7 @@ CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue
{
switch (dtype)
{
case VALUE_EMPTY_TYPE:
case VALUE_VECTOR_TYPE:
{
@@ -152,7 +152,7 @@ CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue
ret = new CErrorValue(val->GetText() + op2str(op) + GetText());
}
return ret;
}
@@ -174,7 +174,7 @@ double* CVectorValue::GetVector3(bool bGetTransformedVec)
{
if (bGetTransformedVec)
return m_transformedvec;
// else
// else
return m_vec;
}
@@ -187,19 +187,19 @@ void CVectorValue::SetVector(double newvec[])
m_vec[KX_X] = m_transformedvec[KX_X] = newvec[KX_X];
m_vec[KX_Y] = m_transformedvec[KX_Y] = newvec[KX_Y];
m_vec[KX_Z] = m_transformedvec[KX_Z] = newvec[KX_Z];
SetModified(true);
}
void CVectorValue::SetValue(CValue *newval)
{
double* newvec = ((CVectorValue*)newval)->GetVector3();
m_vec[KX_X] = m_transformedvec[KX_X] = newvec[KX_X];
m_vec[KX_Y] = m_transformedvec[KX_Y] = newvec[KX_Y];
m_vec[KX_Z] = m_transformedvec[KX_Z] = newvec[KX_Z];
SetModified(true);
}

View File

@@ -59,10 +59,10 @@ SCA_Joystick::SCA_Joystick(short int index)
{
for (int i=0; i < JOYAXIS_MAX; i++)
m_axis_array[i] = 0;
for (int i=0; i < JOYHAT_MAX; i++)
m_hat_array[i] = 0;
#ifdef WITH_SDL
m_private = new PrivateData();
#endif
@@ -94,7 +94,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
return NULL;
}
if (m_refCount == 0)
if (m_refCount == 0)
{
int i;
@@ -124,9 +124,9 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
JOYSTICK_ECHO("Error-Initializing-SDL: " << SDL_GetError());
return NULL;
}
m_joynum = SDL_NumJoysticks();
for (i = 0; i < m_joynum; i++) {
m_instance[i] = new SCA_Joystick(i);
m_instance[i]->CreateJoystickDevice();
@@ -189,7 +189,7 @@ bool SCA_Joystick::aAxisPairDirectionIsPositive(int axis, int dir)
res = pGetAxis(axis, 1);
else /* JOYAXIS_LEFT || JOYAXIS_RIGHT */
res = pGetAxis(axis, 0);
if (dir==JOYAXIS_DOWN || dir==JOYAXIS_RIGHT)
return (res > m_prec) ? true : false;
else /* JOYAXIS_UP || JOYAXIS_LEFT */
@@ -273,7 +273,7 @@ bool SCA_Joystick::CreateJoystickDevice(void)
if (m_joyindex>=m_joynum) {
/* don't print a message, because this is done anyway */
//JOYSTICK_ECHO("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)");
/* Need this so python args can return empty lists */
m_axismax = m_buttonmax = m_hatmax = 0;
return false;
@@ -282,9 +282,9 @@ bool SCA_Joystick::CreateJoystickDevice(void)
m_private->m_joystick = SDL_JoystickOpen(m_joyindex);
SDL_JoystickEventState(SDL_ENABLE);
m_isinit = true;
JOYSTICK_ECHO("Joystick " << m_joyindex << " initialized");
/* must run after being initialized */
m_axismax = SDL_JoystickNumAxes(m_private->m_joystick);
m_buttonmax = SDL_JoystickNumButtons(m_private->m_joystick);
@@ -292,12 +292,12 @@ bool SCA_Joystick::CreateJoystickDevice(void)
if (m_axismax > JOYAXIS_MAX) m_axismax = JOYAXIS_MAX; /* very unlikely */
else if (m_axismax < 0) m_axismax = 0;
if (m_hatmax > JOYHAT_MAX) m_hatmax = JOYHAT_MAX; /* very unlikely */
else if (m_hatmax < 0) m_hatmax = 0;
if (m_buttonmax < 0) m_buttonmax = 0;
}
return true;
#endif /* WITH_SDL */
@@ -355,7 +355,7 @@ int SCA_Joystick::pAxisTest(int axisnum)
* than what a short can hold. In other words, abs(MIN_SHORT) > MAX_SHRT. */
int i1 = m_axis_array[(axisnum * 2)];
int i2 = m_axis_array[(axisnum * 2) + 1];
/* long winded way to do:
* return max_ff(absf(i1), absf(i2))
* ...avoid abs from math.h */

View File

@@ -68,16 +68,16 @@ class SCA_Joystick
#endif
int m_joyindex;
/**
/**
*support for JOYAXIS_MAX axes (in pairs)
*/
int m_axis_array[JOYAXIS_MAX];
/**
/**
*support for JOYHAT_MAX hats (each is a direction)
*/
int m_hat_array[JOYHAT_MAX];
/**
* Precision or range of the axes
*/
@@ -86,15 +86,15 @@ class SCA_Joystick
/**
* max # of buttons avail
*/
int m_axismax;
int m_buttonmax;
int m_hatmax;
/** is the joystick initialized ?*/
bool m_isinit;
/** is triggered for each event type */
bool m_istrig_axis;
bool m_istrig_button;
@@ -112,7 +112,7 @@ class SCA_Joystick
#if 0 /* not used yet */
void OnBallMotion(SDL_Event *sdl_event) {}
#endif
#endif /* WITH_SDL */
/**
* Open the joystick
@@ -142,13 +142,13 @@ class SCA_Joystick
SCA_Joystick(short int index);
~SCA_Joystick();
public:
static SCA_Joystick *GetInstance(short int joyindex);
static void HandleEvents(void);
void ReleaseInstance();
/*
*/
@@ -182,11 +182,11 @@ public:
bool IsTrigAxis(void) {
return m_istrig_axis;
}
bool IsTrigButton(void) {
return m_istrig_button;
}
bool IsTrigHat(void) {
return m_istrig_hat;
}
@@ -198,7 +198,7 @@ public:
int GetNumberOfAxes(void);
int GetNumberOfButtons(void);
int GetNumberOfHats(void);
/**
* Test if the joystick is connected
*/

View File

@@ -41,7 +41,7 @@ void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event)
{
if (sdl_event->jaxis.axis >= JOYAXIS_MAX)
return;
m_axis_array[sdl_event->jaxis.axis] = sdl_event->jaxis.value;
m_istrig_axis = 1;
}
@@ -68,7 +68,7 @@ void SCA_Joystick::OnButtonDown(SDL_Event* sdl_event)
//if (sdl_event->jbutton.button > m_buttonmax) /* unsigned int so always above 0 */
// return;
// sdl_event->jbutton.button;
m_istrig_button = 1;
}
@@ -93,17 +93,17 @@ void SCA_Joystick::HandleEvents(void)
if (SCA_Joystick::m_instance[i])
SCA_Joystick::m_instance[i]->OnNothing(&sdl_event);
}
while (SDL_PollEvent(&sdl_event)) {
/* Note! m_instance[sdl_event.jaxis.which]
* will segfault if over JOYINDEX_MAX, not too nice but what are the chances? */
/* Note!, with buttons, this wont care which button is pressed,
* only to set 'm_istrig_button', actual pressed buttons are detected by SDL_JoystickGetButton */
/* Note!, if you manage to press and release a button within 1 logic tick
* it wont work as it should */
switch (sdl_event.type) {
case SDL_JOYAXISMOTION:
SCA_Joystick::m_instance[sdl_event.jaxis.which]->OnAxisMotion(&sdl_event);

View File

@@ -24,7 +24,7 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file SCA_JoystickPrivate.h
* \ingroup gamelogic
*/

View File

@@ -71,7 +71,7 @@ void SCA_ANDController::Trigger(SCA_LogicManager* logicmgr)
break;
}
}
for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
!(i==m_linkedactuators.end());i++)
{

View File

@@ -96,7 +96,7 @@ bool SCA_ActuatorSensor::Evaluate()
{
bool result = m_actuator->IsActive();
bool reset = m_reset && m_level;
m_reset = false;
if (m_lastresult != result || m_midresult != result)
{

View File

@@ -47,7 +47,7 @@ public:
SCA_ActuatorSensor(class SCA_EventManager* eventmgr,
SCA_IObject* gameobj,
const STR_String& actname);
virtual ~SCA_ActuatorSensor();
virtual CValue* GetReplica();
virtual void Init();
@@ -63,7 +63,7 @@ public:
/* --------------------------------------------------------------------- */
static int CheckActuator(void *self, const PyAttributeDef*);
#endif /* WITH_PYTHON */
};

View File

@@ -78,7 +78,7 @@ CValue* SCA_AlwaysSensor::GetReplica()
bool SCA_AlwaysSensor::IsPositiveTrigger()
{
{
return (m_invert ? false : true);
}
@@ -90,7 +90,7 @@ bool SCA_AlwaysSensor::Evaluate()
//return true;
/* even nicer ;) */
//return false;
/* nicest ! */
bool result = m_alwaysresult;
m_alwaysresult = false;

View File

@@ -85,7 +85,7 @@ CValue* SCA_DelaySensor::GetReplica()
bool SCA_DelaySensor::IsPositiveTrigger()
{
{
return (m_invert ? !m_lastResult : m_lastResult);
}

View File

@@ -41,7 +41,7 @@ class SCA_DelaySensor : public SCA_ISensor
Py_Header
bool m_lastResult;
bool m_repeat;
int m_delay;
int m_delay;
int m_duration;
int m_frameCount;

View File

@@ -51,8 +51,8 @@ public:
enum EVENT_MANAGER_TYPE {
KEYBOARD_EVENTMGR = 0,
MOUSE_EVENTMGR,
ALWAYS_EVENTMGR,
TOUCH_EVENTMGR,
ALWAYS_EVENTMGR,
TOUCH_EVENTMGR,
PROPERTY_EVENTMGR,
TIME_EVENTMGR,
RANDOM_EVENTMGR,
@@ -65,7 +65,7 @@ public:
SCA_EventManager(SCA_LogicManager* logicmgr, EVENT_MANAGER_TYPE mgrtype);
virtual ~SCA_EventManager();
virtual void RemoveSensor(class SCA_ISensor* sensor);
virtual void NextFrame(double curtime, double fixedtime);
virtual void NextFrame();

View File

@@ -51,7 +51,7 @@ public:
virtual CValue* GetReplica();
virtual void Trigger(SCA_LogicManager* logicmgr);
virtual CValue* FindIdentifier(const STR_String& identifiername);
/**
/**
* used to release the expression cache
* so that self references are removed before the controller itself is released
*/

View File

@@ -49,7 +49,7 @@ bool SCA_IActuator::Update(double curtime, bool frame)
{
if (frame)
return Update();
return true;
}
@@ -99,7 +99,7 @@ SCA_IActuator::~SCA_IActuator()
void SCA_IActuator::DecLink()
{
m_links--;
if (m_links < 0)
if (m_links < 0)
{
printf("Warning: actuator %s has negative m_links: %d\n", m_name.Ptr(), m_links);
m_links = 0;
@@ -123,8 +123,8 @@ void SCA_IActuator::UnlinkController(SCA_IController* controller)
return;
}
}
printf("Missing link from actuator %s:%s to controller %s:%s\n",
m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(),
printf("Missing link from actuator %s:%s to controller %s:%s\n",
m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(),
controller->GetParent()->GetName().ReadPtr(), controller->GetName().ReadPtr());
}

View File

@@ -92,7 +92,7 @@ public:
KX_ACT_MOUSE,
};
SCA_IActuator(SCA_IObject* gameobj, KX_ACTUATOR_TYPE type);
SCA_IActuator(SCA_IObject* gameobj, KX_ACTUATOR_TYPE type);
/**
* UnlinkObject(...)
@@ -105,11 +105,11 @@ public:
/**
* Update(...)
* Update the actuator based upon the events received since
* Update the actuator based upon the events received since
* the last call to Update, the current time and deltatime the
* time elapsed in this frame ?
* It is the responsibility of concrete Actuators to clear
* their event's. This is usually done in the Update() method via
* their event's. This is usually done in the Update() method via
* a call to RemoveAllEvents()
*/
@@ -117,9 +117,9 @@ public:
virtual bool Update(double curtime, bool frame);
virtual bool Update();
/**
/**
* Add an event to an actuator.
*/
*/
//void AddEvent(CValue* event)
void AddEvent(bool event)
{
@@ -131,7 +131,7 @@ public:
virtual void ProcessReplica();
/**
/**
* Return true if all the current events
* are negative. The definition of negative event is
* not immediately clear. But usually refers to key-up events
@@ -159,7 +159,7 @@ public:
virtual void DecLink();
bool IsNoLink() const { return !m_links; }
bool IsType(KX_ACTUATOR_TYPE type) { return m_type == type; }
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_IActuator")
#endif

View File

@@ -48,9 +48,9 @@ SCA_IController::SCA_IController(SCA_IObject* gameobj)
m_justActivated(false)
{
}
SCA_IController::~SCA_IController()
{
//UnlinkAllActuators();
@@ -77,7 +77,7 @@ void SCA_IController::UnlinkAllSensors()
std::vector<class SCA_ISensor*>::iterator sensit;
for (sensit = m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit)
{
if (IsActive())
if (IsActive())
{
(*sensit)->DecLink();
}
@@ -93,7 +93,7 @@ void SCA_IController::UnlinkAllActuators()
std::vector<class SCA_IActuator*>::iterator actit;
for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit)
{
if (IsActive())
if (IsActive())
{
(*actit)->DecLink();
}
@@ -127,8 +127,8 @@ void SCA_IController::UnlinkActuator(class SCA_IActuator* actua)
return;
}
}
printf("Missing link from controller %s:%s to actuator %s:%s\n",
m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(),
printf("Missing link from controller %s:%s to actuator %s:%s\n",
m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(),
actua->GetParent()->GetName().ReadPtr(), actua->GetName().ReadPtr());
}
@@ -157,8 +157,8 @@ void SCA_IController::UnlinkSensor(class SCA_ISensor* sensor)
return;
}
}
printf("Missing link from controller %s:%s to sensor %s:%s\n",
m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(),
printf("Missing link from controller %s:%s to sensor %s:%s\n",
m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(),
sensor->GetParent()->GetName().ReadPtr(), sensor->GetName().ReadPtr());
}
@@ -168,9 +168,9 @@ void SCA_IController::ApplyState(unsigned int state)
std::vector<class SCA_IActuator*>::iterator actit;
std::vector<class SCA_ISensor*>::iterator sensit;
if (m_statemask & state)
if (m_statemask & state)
{
if (!IsActive())
if (!IsActive())
{
// reactive the controller, all the links to actuator are valid again
for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit)

View File

@@ -100,7 +100,7 @@ public:
}
}
}
#ifdef WITH_PYTHON
static PyObject* pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);

View File

@@ -111,7 +111,7 @@ void SCA_IInputDevice::NextFrame()
m_currentTable = 1 - m_currentTable;
// cerr << "SCA_IInputDevice::NextFrame " << GetNumActiveEvents() << endl;
for (int i=0;i<SCA_IInputDevice::KX_MAX_KEYS;i++)
{
switch (m_eventStatusTables[1 - m_currentTable][i].m_status)

View File

@@ -39,12 +39,12 @@
#include "MEM_guardedalloc.h"
#endif
class SCA_InputEvent
class SCA_InputEvent
{
public:
enum SCA_EnumInputs {
KX_NO_INPUTSTATUS = 0,
KX_JUSTACTIVATED,
KX_ACTIVE,
@@ -68,25 +68,25 @@ public:
#define MOUSEX MOUSEMOVE
#define MOUSEY ACTIONMOUSE
class SCA_IInputDevice
class SCA_IInputDevice
{
public:
SCA_IInputDevice();
virtual ~SCA_IInputDevice();
enum KX_EnumInputs {
KX_NOKEY = 0,
// TIMERS
// TIMERS
KX_TIMER0,
KX_TIMER1,
KX_TIMER2,
// SYSTEM
/* Moved to avoid clashes with KX_RETKEY */
@@ -104,8 +104,8 @@ public:
KX_WINQUIT,
KX_Q_FIRSTTIME,
/* sequence ends on 16 */
// standard keyboard
// standard keyboard
/* Because of the above preamble, KX_BEGINKEY is 15 ! This
* means that KX_RETKEY on 13d (0Dh)) will double up with
@@ -131,7 +131,7 @@ public:
KX_PERIODKEY = 46,
KX_PLUSKEY = 47,
KX_ZEROKEY = 48,
KX_ONEKEY, // =49
KX_TWOKEY,
KX_THREEKEY,
@@ -168,64 +168,64 @@ public:
KX_XKEY, // =120
KX_YKEY,
KX_ZKEY, // =122
KX_CAPSLOCKKEY, // 123
KX_LEFTCTRLKEY, // 124
KX_LEFTALTKEY,
KX_RIGHTALTKEY,
KX_RIGHTCTRLKEY,
KX_RIGHTSHIFTKEY,
KX_LEFTSHIFTKEY,// 129
KX_ESCKEY, // 130
KX_TABKEY, //131
KX_LINEFEEDKEY, // 132
KX_BACKSPACEKEY,
KX_DELKEY,
KX_SEMICOLONKEY, // 135
KX_QUOTEKEY, //136
KX_ACCENTGRAVEKEY, //137
KX_SLASHKEY, //138
KX_BACKSLASHKEY,
KX_EQUALKEY,
KX_LEFTBRACKETKEY,
KX_RIGHTBRACKETKEY, // 142
KX_LEFTARROWKEY, // 145
KX_DOWNARROWKEY,
KX_RIGHTARROWKEY,
KX_UPARROWKEY, // 148
KX_PAD2 ,
KX_PAD4 ,
KX_PAD6 ,
KX_PAD8 ,
KX_PAD1 ,
KX_PAD3 ,
KX_PAD5 ,
KX_PAD7 ,
KX_PAD9 ,
KX_PADPERIOD,
KX_PADSLASHKEY,
KX_PAD0 ,
KX_PADMINUS,
KX_PADENTER,
KX_PADPLUSKEY,
KX_F1KEY ,
KX_F2KEY ,
KX_F3KEY ,
@@ -247,7 +247,7 @@ public:
KX_F19KEY,
KX_OSKEY,
KX_PAUSEKEY,
KX_INSERTKEY,
KX_HOMEKEY ,
@@ -257,41 +257,41 @@ public:
// MOUSE
KX_BEGINMOUSE,
KX_BEGINMOUSEBUTTONS,
KX_LEFTMOUSE,
KX_MIDDLEMOUSE,
KX_RIGHTMOUSE,
KX_ENDMOUSEBUTTONS,
KX_WHEELUPMOUSE,
KX_WHEELDOWNMOUSE,
KX_MOUSEX,
KX_MOUSEY,
KX_ENDMOUSE,
KX_MAX_KEYS
}; // enum
protected:
/**
/**
* m_eventStatusTables are two tables that contain current and previous
* status of all events
*/
SCA_InputEvent m_eventStatusTables[2][SCA_IInputDevice::KX_MAX_KEYS];
/**
/**
* m_currentTable is index for m_keyStatusTable that toggle between 0 or 1
*/
int m_currentTable;
int m_currentTable;
void ClearStatusTable(int tableid);
public:
@@ -307,9 +307,9 @@ public:
* Get the number of remapping events (just_activated, just_released)
*/
virtual int GetNumJustEvents();
virtual void HookEscape();
/**
* Next frame: we calculate the new key states. This goes as follows:
*

View File

@@ -88,7 +88,7 @@ CValue* SCA_ILogicBrick::Calc(VALUE_OPERATOR op, CValue *val)
temp->Release();
return result;
}
}
@@ -107,7 +107,7 @@ CValue* SCA_ILogicBrick::CalcFinal(VALUE_DATA_TYPE dtype,
const STR_String& SCA_ILogicBrick::GetText()
{
{
if (m_name.Length())
return m_name;
@@ -137,8 +137,8 @@ void SCA_ILogicBrick::SetName(const char *name)
bool SCA_ILogicBrick::LessComparedTo(SCA_ILogicBrick* other)
{
return (this->m_Execute_Ueber_Priority < other->m_Execute_Ueber_Priority)
|| ((this->m_Execute_Ueber_Priority == other->m_Execute_Ueber_Priority) &&
return (this->m_Execute_Ueber_Priority < other->m_Execute_Ueber_Priority)
|| ((this->m_Execute_Ueber_Priority == other->m_Execute_Ueber_Priority) &&
(this->m_Execute_Priority < other->m_Execute_Priority));
}
@@ -178,7 +178,7 @@ CValue* SCA_ILogicBrick::GetEvent()
{
return m_eventval->AddRef();
}
return NULL;
}
@@ -244,10 +244,10 @@ PyObject *SCA_ILogicBrick::pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_D
{
SCA_ILogicBrick* self = static_cast<SCA_ILogicBrick*>(self_v);
CValue* parent = self->GetParent();
if (parent)
return parent->GetProxy();
Py_RETURN_NONE;
}

View File

@@ -81,7 +81,7 @@ public:
virtual double GetNumber();
virtual STR_String& GetName();
virtual void SetName(const char *);
bool IsActive()
{
return m_bActive;
@@ -101,7 +101,7 @@ public:
}
// insert in a QList at position corresponding to m_Execute_Priority
// inside a longer list that contains elements of other objects.
// inside a longer list that contains elements of other objects.
// Sorting is done only between the elements of the same object.
// head is the head of the combined list
// current points to the first element of the object in the list, NULL if none yet
@@ -138,7 +138,7 @@ public:
#ifdef WITH_PYTHON
// python methods
static PyObject* pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
// check that attribute is a property
@@ -152,14 +152,14 @@ public:
};
protected:
protected:
/* Some conversions to go with the bool type. */
/** Convert a KX_TRUE, KX_FALSE in Python to a c++ value. */
bool PyArgToBool(int boolArg);
/** Convert a a c++ value to KX_TRUE, KX_FALSE in Python. */
PyObject *BoolToPyArg(bool);
#endif /* WITH_PYTHON */
};

View File

@@ -60,7 +60,7 @@ SCA_IObject::~SCA_IObject()
(*its)->Delete();
//((CValue*)(*its))->Release();
}
SCA_ControllerList::iterator itc;
SCA_ControllerList::iterator itc;
for (itc = m_controllers.begin(); !(itc == m_controllers.end()); ++itc)
{
//Use Delete for controller to ensure proper cleaning (expression controller)
@@ -250,7 +250,7 @@ SCA_IActuator* SCA_IObject::FindActuator(const STR_String& actuatorname)
void SCA_IObject::Suspend()
{
if ((!m_ignore_activity_culling)
if ((!m_ignore_activity_culling)
&& (!m_suspended)) {
m_suspended = true;
/* flag suspend for all sensors */
@@ -286,8 +286,8 @@ void SCA_IObject::SetState(unsigned int state)
// 1) set the new state bits that are 1
// 2) clr the new state bits that are 0
// This to ensure continuity if a sensor is attached to two states
// that are switching state: no need to deactive and reactive the sensor
// that are switching state: no need to deactive and reactive the sensor
tmpstate = m_state | state;
if (tmpstate != m_state)
{

View File

@@ -53,9 +53,9 @@ typedef std::vector<SCA_IObject *> SCA_ObjectList;
class SCA_IObject : public CValue
{
Py_Header
protected:
friend class KX_StateActuator;
friend class SCA_IActuator;
@@ -110,7 +110,7 @@ protected:
SG_QList* m_firstState;
public:
SCA_IObject();
virtual ~SCA_IObject();
@@ -148,7 +148,7 @@ public:
}
void RegisterActuator(SCA_IActuator* act);
void UnregisterActuator(SCA_IActuator* act);
void RegisterObject(SCA_IObject* objs);
void UnregisterObject(SCA_IObject* objs);
/**
@@ -165,7 +165,7 @@ public:
void SetCurrentTime(float currentTime) {}
virtual void ReParentLogic();
/**
* Set whether or not to ignore activity culling requests
*/
@@ -187,7 +187,7 @@ public:
* Suspend all progress.
*/
void Suspend(void);
/**
* Resume progress
*/
@@ -216,7 +216,7 @@ public:
// const class MT_Point3& ConvertPythonPylist(PyObject *pylist);
virtual int GetGameObjectType() {return -1;}
typedef enum ObjectTypes {
OBJ_ARMATURE=0,
OBJ_CAMERA=1,

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