Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416 Issues: * GHOST/X11 had conflicting changes. Some code was added in 2.5, which was later added in trunk also, but reverted partially, specifically revision 16683. I have left out this reversion in the 2.5 branch since I think it is needed there. http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683 * Scons had various conflicting changes, I decided to go with trunk version for everything except priorities and some library renaming. * In creator.c, there were various fixes and fixes for fixes related to the -w -W and -p options. In 2.5 -w and -W is not coded yet, and -p is done differently. Since this is changed so much, and I don't think those fixes would be needed in 2.5, I've left them out. * Also in creator.c: there was code for a python bugfix where the screen was not initialized when running with -P. The code that initializes the screen there I had to disable, that can't work in 2.5 anymore but left it commented as a reminder. Further I had to disable some new function calls. using src/ and python/, as was done already in this branch, disabled function calls: * bpath.c: error reporting * BME_conversions.c: editmesh conversion functions. * SHD_dynamic: disabled almost completely, there is no python/. * KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled. * text.c: clipboard copy call. * object.c: OB_SUPPORT_MATERIAL. * DerivedMesh.c and subsurf_ccg, stipple_quarttone. Still to be done: * Go over files and functions that were moved to a different location but could still use changes that were done in trunk.
This commit is contained in:
@@ -65,6 +65,8 @@ probably misplaced */
|
||||
#include "KX_MouseFocusSensor.h"
|
||||
#include "SCA_JoystickSensor.h"
|
||||
#include "KX_NetworkMessageSensor.h"
|
||||
#include "SCA_ActuatorSensor.h"
|
||||
#include "SCA_DelaySensor.h"
|
||||
|
||||
|
||||
#include "SCA_PropertySensor.h"
|
||||
@@ -91,6 +93,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
class KX_GameObject* gameobj,
|
||||
SCA_LogicManager* logicmgr,
|
||||
KX_Scene* kxscene,
|
||||
KX_KetsjiEngine* kxengine,
|
||||
SCA_IInputDevice* keydev,
|
||||
int & executePriority,
|
||||
int activeLayerBitInfo,
|
||||
@@ -260,6 +263,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
bool neg_pulsemode = false;
|
||||
int frequency = 0;
|
||||
bool invert = false;
|
||||
bool level = false;
|
||||
|
||||
while(sens)
|
||||
{
|
||||
@@ -272,7 +276,8 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
|
||||
frequency = sens->freq;
|
||||
invert = !(sens->invert == 0);
|
||||
|
||||
level = !(sens->level == 0);
|
||||
|
||||
switch (sens->type)
|
||||
{
|
||||
case SENS_ALWAYS:
|
||||
@@ -287,6 +292,22 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
break;
|
||||
}
|
||||
|
||||
case SENS_DELAY:
|
||||
{
|
||||
// we can reuse the Always event manager for the delay sensor
|
||||
SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::ALWAYS_EVENTMGR);
|
||||
if (eventmgr)
|
||||
{
|
||||
bDelaySensor* delaysensor = (bDelaySensor*)sens->data;
|
||||
gamesensor = new SCA_DelaySensor(eventmgr,
|
||||
gameobj,
|
||||
delaysensor->delay,
|
||||
delaysensor->duration,
|
||||
(delaysensor->flag & SENS_DELAY_REPEAT) != 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SENS_COLLISION:
|
||||
{
|
||||
SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::TOUCH_EVENTMGR);
|
||||
@@ -392,8 +413,9 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
bool bFindMaterial = false;
|
||||
PHY_IPhysicsController* physCtrl = kxscene->GetPhysicsEnvironment()->CreateSphereController(radius,pos);
|
||||
|
||||
if (isInActiveLayer)
|
||||
kxscene->GetPhysicsEnvironment()->addSensor(physCtrl);
|
||||
//will be done in KX_TouchEventManager::RegisterSensor()
|
||||
//if (isInActiveLayer)
|
||||
// kxscene->GetPhysicsEnvironment()->addSensor(physCtrl);
|
||||
|
||||
|
||||
|
||||
@@ -420,8 +442,8 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
{
|
||||
gamesensor = new SCA_KeyboardSensor(eventmgr,
|
||||
gReverseKeyTranslateTable[blenderkeybdsensor->key],
|
||||
blenderkeybdsensor->qual,
|
||||
blenderkeybdsensor->qual2,
|
||||
gReverseKeyTranslateTable[blenderkeybdsensor->qual],
|
||||
gReverseKeyTranslateTable[blenderkeybdsensor->qual2],
|
||||
(blenderkeybdsensor->type == SENS_ALL_KEYS),
|
||||
blenderkeybdsensor->targetName,
|
||||
blenderkeybdsensor->toggleName,
|
||||
@@ -496,6 +518,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
trackfocus,
|
||||
canvas,
|
||||
kxscene,
|
||||
kxengine,
|
||||
gameobj);
|
||||
}
|
||||
} else {
|
||||
@@ -544,6 +567,19 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
|
||||
break;
|
||||
}
|
||||
case SENS_ACTUATOR:
|
||||
{
|
||||
bActuatorSensor* blenderactsensor = (bActuatorSensor*) sens->data;
|
||||
// we will reuse the property event manager, there is nothing special with this sensor
|
||||
SCA_EventManager* eventmgr
|
||||
= logicmgr->FindEventManager(SCA_EventManager::ACTUATOR_EVENTMGR);
|
||||
if (eventmgr)
|
||||
{
|
||||
STR_String propname=blenderactsensor->name;
|
||||
gamesensor = new SCA_ActuatorSensor(eventmgr,gameobj,propname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SENS_RADAR:
|
||||
{
|
||||
@@ -608,6 +644,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
if (eventmgr)
|
||||
{
|
||||
bool bFindMaterial = (blenderraysensor->mode & SENS_COLLISION_MATERIAL);
|
||||
bool bXRay = (blenderraysensor->mode & SENS_RAY_XRAY);
|
||||
|
||||
STR_String checkname = (bFindMaterial? blenderraysensor->matname : blenderraysensor->propname);
|
||||
|
||||
@@ -620,6 +657,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
gameobj,
|
||||
checkname,
|
||||
bFindMaterial,
|
||||
bXRay,
|
||||
distance,
|
||||
axis,
|
||||
kxscene);
|
||||
@@ -656,7 +694,6 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
int axis =0;
|
||||
int axisf =0;
|
||||
int button =0;
|
||||
int buttonf =0;
|
||||
int hat =0;
|
||||
int hatf =0;
|
||||
int prec =0;
|
||||
@@ -671,7 +708,6 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
break;
|
||||
case SENS_JOY_BUTTON:
|
||||
button = bjoy->button;
|
||||
buttonf = bjoy->buttonf;
|
||||
joysticktype = SCA_JoystickSensor::KX_JOYSENSORMODE_BUTTON;
|
||||
break;
|
||||
case SENS_JOY_HAT:
|
||||
@@ -686,11 +722,13 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
gamesensor = new SCA_JoystickSensor(
|
||||
eventmgr,
|
||||
gameobj,
|
||||
bjoy->joyindex,
|
||||
joysticktype,
|
||||
axis,axisf,
|
||||
prec,
|
||||
button,buttonf,
|
||||
hat,hatf);
|
||||
button,
|
||||
hat,hatf,
|
||||
(bjoy->flag & SENS_JOY_ANY_EVENT));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -719,25 +757,49 @@ void BL_ConvertSensors(struct Object* blenderobject,
|
||||
neg_pulsemode,
|
||||
frequency);
|
||||
gamesensor->SetInvert(invert);
|
||||
gamesensor->SetLevel(level);
|
||||
gamesensor->SetName(STR_String(sens->name));
|
||||
|
||||
gameobj->AddSensor(gamesensor);
|
||||
|
||||
// only register to manager if it's in an active layer
|
||||
|
||||
if (isInActiveLayer)
|
||||
gamesensor->RegisterToManager();
|
||||
// Make registration dynamic: only when sensor is activated
|
||||
//if (isInActiveLayer)
|
||||
// gamesensor->RegisterToManager();
|
||||
|
||||
|
||||
for (int i=0;i<sens->totlinks;i++)
|
||||
{
|
||||
bController* linkedcont = (bController*) sens->links[i];
|
||||
SCA_IController* gamecont = converter->FindGameController(linkedcont);
|
||||
if (linkedcont) {
|
||||
SCA_IController* gamecont = converter->FindGameController(linkedcont);
|
||||
|
||||
if (gamecont) {
|
||||
logicmgr->RegisterToSensor(gamecont,gamesensor);
|
||||
if (gamecont) {
|
||||
logicmgr->RegisterToSensor(gamecont,gamesensor);
|
||||
} else {
|
||||
printf(
|
||||
"Warning, sensor \"%s\" could not find its controller "
|
||||
"(link %d of %d) from object \"%s\"\n"
|
||||
"\tthere has been an error converting the blender controller for the game engine,"
|
||||
"logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2);
|
||||
}
|
||||
} else {
|
||||
printf(
|
||||
"Warning, sensor \"%s\" has lost a link to a controller "
|
||||
"(link %d of %d) from object \"%s\"\n"
|
||||
"\tpossible causes are partially appended objects or an error reading the file,"
|
||||
"logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2);
|
||||
}
|
||||
}
|
||||
// special case: Keyboard sensor with no link
|
||||
// this combination is usually used for key logging.
|
||||
if (sens->type == SENS_KEYBOARD && sens->totlinks == 0) {
|
||||
// Force the registration so that the sensor runs
|
||||
gamesensor->IncLink();
|
||||
}
|
||||
|
||||
// done with gamesensor
|
||||
gamesensor->Release();
|
||||
|
||||
}
|
||||
sens=sens->next;
|
||||
|
||||
Reference in New Issue
Block a user