Beispiel #1
0
//************************************
// Method:    PBPhysicalize
// FullName:  PBPhysicalize
// Access:    public 
// Returns:   int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int PBPhysicalize(const CKBehaviorContext& behcontext)
{
	
	using namespace vtTools::BehaviorTools;
	using namespace vtTools;
	using namespace vtTools::AttributeTools;

	//////////////////////////////////////////////////////////////////////////
	//basic parameters
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;
	PhysicManager *pm = GetPMan();
	pFactory *pf = pFactory::Instance();

	

	//////////////////////////////////////////////////////////////////////////
	//settings
	int useDWorld;	beh->GetLocalParameterValue(bbS_USE_DEFAULT_WORLD,&useDWorld);
//	int useWorldSS;	beh->GetLocalParameterValue(bbS_USE_WORLD_SLEEP_SETTINGS,&useWorldSS);
//	int useWorldDS;	beh->GetLocalParameterValue(bbS_USE_WORLD_DAMPING_SETTINGS,&useWorldDS);
	int useWorldM;	beh->GetLocalParameterValue(bbS_USE_WORLD_MATERIAL,&useWorldM);
	int addAttributes;	beh->GetLocalParameterValue(bbS_ADD_ATTRIBUTES,&addAttributes);


	
	
	//////////////////////////////////////////////////////////////////////////
	//the object : 
	CK3dEntity *referenceObject = (CK3dEntity *) beh->GetTarget();
	if( !referenceObject ) return CKBR_OWNERERROR;

	

	//////////////////////////////////////////////////////////////////////////
	//the world  :  
	CK3dEntity*worldRef = NULL;
	if (!useDWorld)
	{
		worldRef = (CK3dEntity *) beh->GetInputParameterObject(bbI_TargetWorld);
	}

	// the world :  
	pWorld *world=GetPMan()->getWorld(worldRef,referenceObject); 
	if (!world)
	{
		beh->ActivateOutput(0);
		return 0;

	}

	pRigidBody*result = world->getBody(referenceObject);
	if (result)
	{
		beh->ActivateOutput(0);
		return 0;
	}


	//////////////////////////////////////////////////////////////////////////
	//pick up some parameters :  
	int flags  = GetInputParameterValue<int>(beh,bbI_Flags);
	int hType = GetInputParameterValue<int>(beh,bbI_HullType);
	float density  = GetInputParameterValue<float>(beh,bbI_Density);
	float skinWidth = GetInputParameterValue<float>(beh,bbI_SkinWidth);
	int hierarchy  = GetInputParameterValue<int>(beh,bbI_Hierachy);
	float newDensity = GetInputParameterValue<float>(beh,bbI_NewDensity);
	float totalMass = GetInputParameterValue<float>(beh,bbI_TotalMass);




	VxVector massOffset  = GetInputParameterValue<VxVector>(beh,bbI_MassShift);
	VxVector shapeOffset  = GetInputParameterValue<VxVector>(beh,bbI_ShapeShift);


	//////////////////////////////////////////////////////////////////////////
	// we remove the old physic attribute : 
	if (referenceObject->HasAttribute(GetPMan()->GetPAttribute()))
	{
		referenceObject->RemoveAttribute(GetPMan()->GetPAttribute());
	}
	referenceObject->SetAttribute(GetPMan()->GetPAttribute());
	
	SetAttributeValue<int>(referenceObject,GetPMan()->GetPAttribute(),E_PPS_HIRARCHY,&hierarchy);
	SetAttributeValue<int>(referenceObject,GetPMan()->GetPAttribute(),E_PPS_HULLTYPE,&hType);
	SetAttributeValue<int>(referenceObject,GetPMan()->GetPAttribute(),E_PPS_BODY_FLAGS,&flags);
	SetAttributeValue<float>(referenceObject,GetPMan()->GetPAttribute(),E_PPS_DENSITY,&density);
	SetAttributeValue<float>(referenceObject,GetPMan()->GetPAttribute(),E_PPS_NEW_DENSITY,&newDensity);
	SetAttributeValue<float>(referenceObject,GetPMan()->GetPAttribute(),E_PPS_TOTAL_MASS,&totalMass);
	SetAttributeValue<VxVector>(referenceObject,GetPMan()->GetPAttribute(),E_PPS_MASS_OFFSET,&massOffset);
	//SetAttributeValue<VxVector>(referenceObject,GetPMan()->GetPAttribute(),E_PPS_MASS_OFFSET,&massOffset);

	CK_ID wID  = world->getReference()->GetID();
	AttributeTools::SetAttributeValue<CK_ID>(referenceObject,GetPMan()->GetPAttribute(),E_PPS_WORLD,&wID);
	


	//////////////////////////////////////////////////////////////////////////
	//Material : 
	if (!useWorldM)
	{
		if (referenceObject->HasAttribute(GetPMan()->att_surface_props))
		{
			referenceObject->RemoveAttribute(GetPMan()->att_surface_props);
		}
		
		referenceObject->SetAttribute(GetPMan()->att_surface_props);

		CKParameterIn *pMatIn = beh->GetInputParameter(bbI_Material);
		CKParameter *pMat  = pMatIn->GetRealSource();
		CKParameterOut* pout = referenceObject->GetAttributeParameter(GetPMan()->att_surface_props);
		int error  = pout->CopyValue(pMat);
		pout->Update();
	}

	pRigidBody *body = pFactory::Instance()->createRigidBodyFull(referenceObject,worldRef);
	if (body)
	{
		body->translateLocalShapePosition(shapeOffset);
	}
	//GetPMan()->checkWorlds();

	if (!addAttributes)
	{
		referenceObject->RemoveAttribute(GetPMan()->GetPAttribute());
		referenceObject->RemoveAttribute(GetPMan()->att_surface_props);
	}

	beh->ActivateOutput(0);

	return 0;
}
/*
 *******************************************************************
 * Function: int BehaviourFunction() 
 *
 * Description : Returns the number of plugins in this DLL
 *		
 * Paramters :
 *    CKBehaviorContext& r The virtools behaviour context
 *
 * Returns : One of the many virtools return values
 *
 *******************************************************************
 */
int CGBLLOGetMOStatus::BehaviourFunction(const CKBehaviorContext& behContext)
{
	CKBehavior* beh = behContext.Behavior; 
	CKBOOL localError = false;
	CGBLCOError retVal(CGBLCOError::EGBLCOErrorType::GBLCO_OK);

	MeasuredObjectiveControllerMgr* MOMngr = 
        static_cast<MeasuredObjectiveControllerMgr*>(behContext.Context->GetManagerByGuid(MeasuredObjectiveControllerMgrGUID));

	// Check to see if we got the manager ok
	if (!MOMngr) 
	{
		assert(NULL);
		return CKBR_OK;
	} 

	if (beh->IsInputActive(eBehInputStart)) 
	{
		// Get the details of the MO P-In
		CKParameterIn *pIn = beh->GetInputParameter(eParamInputMO);
		CKParameter *moParam = pIn->GetRealSource();
		// Ensure we read the P-In ok
		if (!moParam)
		{
			// Report the error
			CKParameterOut *pOut = beh->GetOutputParameter(eParamOutputGetError);
			TGBLError::SetTGBLError(pOut, CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,
					GBLLO_ERROR_NO_PARAM_FROM_BB,GBLLO_ERROR_NO_DATA_FROM_BB_DESC);
			beh->ActivateOutput(eBehOutputError, TRUE);
			localError = true;
		}
		if (!localError)
		{
			// Get the data from the P-In
			CGBLMOData *moData = static_cast<CGBLMOData*>(moParam->GetAppData());
			if (moData)
			{
				// Get the name from the MO and use this to get the
				// runtime MO from the controller
				XString moName = moData->GetName();
				CGBLLOMeasuredObjective *mo=NULL;
				retVal=MOMngr->GetRunTimeMO(moName,mo);
				// See if the controller gave us the MO
				if((retVal==CGBLCOError::EGBLCOErrorType::GBLCO_OK)&&(mo))
				{
					// Get the status of the MO
					bool moStatus=mo->GetMOStatus();
					// return the status of the MO back to Virtools Dev
					beh->SetOutputParameterValue(eParamOutputGetStatus, &moStatus);
				}
			}
			else
			{
				// Report the fact that we couldnt create a runtime MO from the param
				CKParameterOut *pOut = beh->GetOutputParameter(eParamOutputGetError);
				TGBLError::SetTGBLError(pOut, CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,
						GBLLO_ERROR_NO_DATA_FROM_BB,GBLLO_ERROR_NO_DATA_FROM_BB_DESC);
				beh->ActivateOutput(eBehOutputError, TRUE);
				localError = true;
			}
		}
	}

	if (localError)
	{
		// error allready dealt with
	}
	else if (retVal!=CGBLCOError::EGBLCOErrorType::GBLCO_OK)
	{	
		// Report the error back to Virtools dev
		CKParameterOut *pOut = beh->GetOutputParameter(eParamOutputGetError);
		const char* errorString = retVal;
        TGBLError::SetTGBLError(pOut, retVal,retVal,(CKSTRING)errorString);
		beh->ActivateOutput(eBehOutputError, TRUE);
	}
	else
	{
		// We are ok
		beh->ActivateOutput(eBehOutputDone, TRUE);
	}

	return CKBR_OK;
}
Beispiel #3
0
//************************************
// Method:    PVWSet
// FullName:  PVWSet
// Access:    public
// Returns:   int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int PVWSet(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;
	PhysicManager *pm = GetPMan();

	pFactory *pf = pFactory::Instance();

	using namespace vtTools::BehaviorTools;

	if( beh->IsInputActive(0) )
	{
		beh->ActivateInput(0,FALSE);



		//////////////////////////////////////////////////////////////////////////
		//the object :
		CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
		if( !target ) 	bbErrorME("No Reference Object specified");

		pRigidBody *body = NULL;


		body = GetPMan()->getBody(target);
		if (!body)	bbErrorME("No Reference Object specified");


		pWheel *wheel = body->getWheel(target);
		if (!wheel)bbErrorME("pWheel object doesnt exist!");

		pWheel2 *wheel2  = wheel->castWheel2();
		if (!wheel2)bbErrorME("Couldnt cast a pWheel2 object");



		BB_DECLARE_PIMAP;


		/************************************************************************/
		/* engel 
		kuehne un partner 
		*/
		/************************************************************************/

		/************************************************************************/
		/* retrieve settings state  */
		/************************************************************************/
		BBSParameter(bbI_XML);
		BBSParameter(bbI_AxleSpeed);
		BBSParameter(bbI_Steer);
		BBSParameter(bbI_MotorTorque);
		BBSParameter(bbI_BrakeTorque);
		BBSParameter(bbI_SuspensionSpring);
		BBSParameter(bbI_SuspensionTravel);
		BBSParameter(bbI_Radius);

		BBSParameter(bbI_WFlags);
		BBSParameter(bbI_WSFlags);

		BBSParameter(bbI_LatFunc);
		BBSParameter(bbI_LongFunc);


		/************************************************************************/
		/* retrieve values                                                                     */
		/************************************************************************/

		int xmlValue = GetInputParameterValue<int>(beh,BB_IP_INDEX(bbI_XML));
		float axleVel = GetInputParameterValue<float>(beh,BB_IP_INDEX(bbI_AxleSpeed));
		float steer = GetInputParameterValue<float>(beh,BB_IP_INDEX(bbI_Steer));
		float mTorque = GetInputParameterValue<float>(beh,BB_IP_INDEX(bbI_MotorTorque));
		float bTorque = GetInputParameterValue<float>(beh,BB_IP_INDEX(bbI_BrakeTorque));
		float suspensionTravel = GetInputParameterValue<float>(beh,BB_IP_INDEX(bbI_SuspensionTravel));

		int wFlags = GetInputParameterValue<int>(beh,BB_IP_INDEX(bbI_WFlags));
		int wSFlags = GetInputParameterValue<int>(beh,BB_IP_INDEX(bbI_WSFlags));

		pSpring sSpring;
		if (sbbI_SuspensionSpring)
		{
			CKParameterIn *par = beh->GetInputParameter(bbI_SuspensionSpring);
			if (par)
			{
				CKParameter *rPar = par->GetRealSource();
				if (rPar)
				{
					sSpring  = pFactory::Instance()->createSpringFromParameter(rPar);
					NxSpringDesc xsp;
					xsp.damper = sSpring.damper;
					xsp.spring = sSpring.spring;
					xsp.targetValue = sSpring.targetValue;
					if (xsp.isValid())
					{
						wheel2->setSuspensionSpring(sSpring);
					}else
						bbErrorME("Invalid Spring Setings!");

				}
			}
		}

		/************************************************************************/
		/* Update Object !                                                                     */
		/************************************************************************/

		//////////////////////////////////////////////////////////////////////////
		//	load some settings from XML
		if(sbbI_XML)
		{
		}

		if (sbbI_Steer)wheel2->setAngle(steer);
		if (sbbI_AxleSpeed)wheel2->setAxleSpeed(axleVel);
		if (sbbI_MotorTorque)wheel2->setMotorTorque(mTorque);
		if (sbbI_BrakeTorque)wheel2->setBreakTorque(bTorque);
		if (sbbI_SuspensionSpring)wheel2->setSuspensionSpring(sSpring);
		if (sbbI_SuspensionTravel)wheel2->setSuspensionTravel(suspensionTravel);
		if (sbbI_WFlags)
		{

			//////////////////////////////////////////////////////////////////////////
			//
			//
			wheel2->setFlags(wFlags);

		}


		if (sbbI_WSFlags)
		{
			wheel2->getWheelShape()->setWheelFlags(wSFlags);
		}


		if (sbbI_LatFunc)
		{

			CKParameterIn *par = beh->GetInputParameter(BB_IP_INDEX(bbI_LatFunc));
			if (par)
			{
				CKParameter *rPar = par->GetRealSource();
				if (rPar)
				{
					pTireFunction func  = pFactory::Instance()->createTireFuncFromParameter(rPar);
					if (func.isValid())
					{
						NxTireFunctionDesc xFn;
						xFn.asymptoteSlip = func.asymptoteSlip;
						xFn.asymptoteValue = func.asymptoteValue;
						xFn.extremumSlip= func.extremumSlip;
						xFn.extremumValue= func.extremumValue;
						xFn.stiffnessFactor= func.stiffnessFactor;
						wheel2->getWheelShape()->setLongitudalTireForceFunction(xFn);
					}else
						bbErrorME("Invalid Tire Function Settings!");
				}
			}
		}

		if (sbbI_LongFunc)
		{

			CKParameterIn *par = beh->GetInputParameter(BB_IP_INDEX(bbI_LongFunc));
			if (par)
			{
				CKParameter *rPar = par->GetRealSource();
				if (rPar)
				{
					pTireFunction func  = pFactory::Instance()->createTireFuncFromParameter(rPar);
					if (func.isValid())
					{
						NxTireFunctionDesc xFn;
						xFn.asymptoteSlip = func.asymptoteSlip;
						xFn.asymptoteValue = func.asymptoteValue;
						xFn.extremumSlip= func.extremumSlip;
						xFn.extremumValue= func.extremumValue;
						xFn.stiffnessFactor= func.stiffnessFactor;
						wheel2->getWheelShape()->setLongitudalTireForceFunction(xFn);
					}else
						bbErrorME("Invalid Tire Function Settings!");
				}
			}
		}
	}
	beh->ActivateOutput(0);
	return 0;
}
Beispiel #4
0
//************************************
// Method:    PJRevolute
// FullName:  PJRevolute
// Access:    public
// Returns:   int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int PJRevolute(const CKBehaviorContext& behcontext)
{
    CKBehavior* beh = behcontext.Behavior;
    CKContext* ctx = behcontext.Context;
    PhysicManager *pm = GetPMan();

    pFactory *pf = pFactory::Instance();

    using namespace vtTools::BehaviorTools;

    if( beh->IsInputActive(0) )
    {



        beh->ActivateInput(0,FALSE);

        //////////////////////////////////////////////////////////////////////////
        //the object A:
        CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
        CK3dEntity *targetB = (CK3dEntity *) beh->GetInputParameterObject(bI_ObjectB);

        if (!pFactory::Instance()->jointCheckPreRequisites(target,targetB,JT_Revolute))
        {

            return CK_OK;
        }

        // the world :
        pWorld *worldA=GetPMan()->getWorldByBody(target);
        pWorld *worldB=GetPMan()->getWorldByBody(targetB);
        if (!worldA && ! worldB )
        {
            return 0;
        }
        if (!worldA)
        {
            worldA = worldB;
        }

        if (!worldA)
        {
            beh->ActivateOutput(0);
            return 0;
        }

        // the physic object A :
        pRigidBody*bodyA= worldA->getBody(target);
        pRigidBody*bodyB= worldA->getBody(targetB);



        //anchor :
        VxVector anchor  = GetInputParameterValue<VxVector>(beh,bI_Anchor);
        VxVector anchorOut  = anchor;
        CK3dEntity*anchorReference  =  (CK3dEntity *) beh->GetInputParameterObject(bI_AnchorRef);
        if (anchorReference)
        {
            anchorReference->Transform(&anchorOut,&anchor);
        }

        //swing axis
        VxVector Axis  = GetInputParameterValue<VxVector>(beh,bI_Axis);
        VxVector axisOut  = Axis;
        CK3dEntity*axisReference  =  (CK3dEntity *) beh->GetInputParameterObject(bI_AxisRef);

        if (axisReference)
        {
            VxVector dir,up,right;
            axisReference->GetOrientation(&dir,&up,&right);
            axisReference->TransformVector(&axisOut,&up);
        }

        //////////////////////////////////////////////////////////////////////////
        //limit high :
        pJointLimit limitH;
        pJointLimit limitL;
        DWORD limit;
        beh->GetLocalParameterValue(1,&limit);
        if (limit)
        {
            CKParameterIn *par = beh->GetInputParameter(bbI_HighLimit);
            if (par)
            {
                CKParameter *rPar = par->GetRealSource();
                if (rPar)
                {
                    limitH  = pFactory::Instance()->createLimitFromParameter(rPar);
                }
            }
        }

        if (limit)
        {
            CKParameterIn *par = beh->GetInputParameter(bbI_LowLimit);
            if (par)
            {
                CKParameter *rPar = par->GetRealSource();
                if (rPar)
                {
                    limitL  = pFactory::Instance()->createLimitFromParameter(rPar);
                }
            }
        }

        //////////////////////////////////////////////////////////////////////////
        DWORD spring;
        pSpring sSpring;
        beh->GetLocalParameterValue(0,&spring);
        if (spring)
        {
            CKParameterIn *par = beh->GetInputParameter(bbI_Spring);
            if (par)
            {
                CKParameter *rPar = par->GetRealSource();
                if (rPar)
                {
                    sSpring  = pFactory::Instance()->createSpringFromParameter(rPar);
                }
            }
        }

        pMotor motor;

        DWORD hasMotor;
        beh->GetLocalParameterValue(2,&hasMotor);
        if (hasMotor)
        {
            CKParameterIn *par = beh->GetInputParameter(bbI_Motor);
            if (par)
            {
                CKParameter *rPar = par->GetRealSource();
                if (rPar)
                {
                    motor  = pFactory::Instance()->createMotorFromParameter(rPar);
                }
            }
        }


        int col  = GetInputParameterValue<int>(beh,bbI_Collision);
        ProjectionMode mode =GetInputParameterValue<ProjectionMode>(beh,bbI_PMode);
        float distance = GetInputParameterValue<float>(beh,bbI_PDistance);
        float angle= GetInputParameterValue<float>(beh,bbI_PAngle);

        //////////////////////////////////////////////////////////////////////////
        //
        pJointRevolute *joint = static_cast<pJointRevolute*>(worldA->getJoint(target,targetB,JT_Revolute));
        if(bodyA || bodyB)
        {
            //////////////////////////////////////////////////////////////////////////
            //joint create ?
            if (!joint)
            {
                joint   = static_cast<pJointRevolute*>(pFactory::Instance()->createRevoluteJoint(target,targetB,anchorOut,axisOut));
            }
            ////////////////////////////////////////////////////////////////////////// Modification :
            if (joint)
            {

                joint->setGlobalAxis(axisOut);
                joint->setGlobalAnchor(anchorOut);

                if (mode!=0)
                {
                    joint->setProjectionMode(mode);
                    joint->setProjectionDistance(distance);
                    joint->setProjectionAngle(angle);
                }

                //////////////////////////////////////////////////////////////////////////
                if(limit)
                {
                    joint->setHighLimit(limitH);
                    joint->setLowLimit(limitL);
                }

                //////////////////////////////////////////////////////////////////////////
                if (spring)
                {
                    joint->setSpring(sSpring);
                }

                if (hasMotor)
                {
                    joint->setMotor(motor);
                }

                joint->enableCollision(col);
            }
        }

        beh->ActivateOutput(0);
    }
    return 0;
}
/*
 *******************************************************************
 * Function: int BehaviourFunction() 
 *
 * Description : Returns the number of plugins in this DLL
 *		
 * Paramters :
 *    CKBehaviorContext& r The virtools behaviour context
 *
 * Returns : One of the many virtools return values
 *
 *******************************************************************
 */
int CGBLLOStopTimer::BehaviourFunction(const CKBehaviorContext& behContext)
{
	CKBehavior* beh = behContext.Behavior; 
	CKBOOL localError = false;
	CGBLCOError retVal(CGBLCOError::EGBLCOErrorType::GBLCO_OK);

	MeasuredObjectiveControllerMgr* MOMngr = 
        static_cast<MeasuredObjectiveControllerMgr*>(behContext.Context->GetManagerByGuid(MeasuredObjectiveControllerMgrGUID));

	// Check to see if we got the manager ok
	if (!MOMngr) 
	{
		assert(NULL);
		return CKBR_OK;
	} 

	if (beh->IsInputActive(eBehInputStart)) 
	{
		// Get the details of the MO P-In
		CKParameterIn *pInMO = beh->GetInputParameter(eParamInputMO);
		CKParameter *moParam = pInMO->GetRealSource();

		// Get the details of the Measurement P-In
		CKParameterIn *pInMeas= beh->GetInputParameter(eParamInputMeasurement);
		CKParameter *measParam = pInMeas->GetRealSource();

		// Ensure we read the P-In ok
		if (!moParam)
		{
			// Report the error
			CKParameterOut *pOut = beh->GetOutputParameter(eParamOutputGetError);
			TGBLError::SetTGBLError(pOut, CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,
					GBLLO_ERROR_NO_PARAM_FROM_BB,GBLLO_ERROR_NO_DATA_FROM_BB_DESC);
			beh->ActivateOutput(eBehOutputError, TRUE);
			localError = true;
		}
		if (!localError)
		{
			// Get the data from the P-In
			CGBLMOData *moData = static_cast<CGBLMOData*>(moParam->GetAppData());
			if (moData)
			{
				// Get the name from the MO and use this to get the
				// runtime MO from the controller
				XString moName = moData->GetName();
				CGBLLOMeasuredObjective *mo=NULL;
				retVal=MOMngr->GetRunTimeMO(moName,mo);
	
				// See if the controller gave us the MO
				if((retVal==CGBLCOError::EGBLCOErrorType::GBLCO_OK)&&(mo))
				{
					// Get the data from the P-In
					CGBLMeasurementData *measData = static_cast<CGBLMeasurementData*>(measParam->GetAppData());
					if (measData)
					{
						// Get the measurement
						XString measName = measData->GetName();
						EGBLLOMeasurementType measType=measData->GetType();
						CGBLMeasurement *meas=NULL;
						retVal=mo->GetMeasurement(measName,meas);
										
						// See if the MO gave us the measurement
						if((retVal==CGBLCOError::EGBLCOErrorType::GBLCO_OK)&&(meas))
						{
							// Based on the measurement type, get the value from the P-Im
							// and pass the value to the measurement.
							switch (measType)
							{
								case eTimer:
								{
									CGBLLOMeasurementTimer *timeMeas=NULL;
									timeMeas=static_cast<CGBLLOMeasurementTimer*>(meas);
									retVal=timeMeas->StopTimer();
								}
								break;
								default:
								{
									CKParameterOut *pOut = beh->GetOutputParameter(eParamOutputGetError);
									TGBLError::SetTGBLError(pOut, CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,
											GBLLO_ERROR_TRIED_START_TIMER_NOT,GBLLO_ERROR_TRIED_START_TIMER_NOT_DESC);
									beh->ActivateOutput(eBehOutputError, TRUE);
									localError = true;
								}
								break;
							}
						}
					}
				}
			}
			else
			{
				// Report the fact that we couldnt create a runtime MO from the param
				CKParameterOut *pOut = beh->GetOutputParameter(eParamOutputGetError);
				TGBLError::SetTGBLError(pOut, CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,
						GBLLO_ERROR_NO_DATA_FROM_BB,GBLLO_ERROR_NO_DATA_FROM_BB_DESC);
				beh->ActivateOutput(eBehOutputError, TRUE);
				localError = true;
			}
		}
	}

	if (localError)
	{
		// error allready dealt with
	}
	else if (retVal!=CGBLCOError::EGBLCOErrorType::GBLCO_OK)
	{	
		// Report the error back to Virtools dev
		CKParameterOut *pOut = beh->GetOutputParameter(eParamOutputGetError);
		const char* errorString = retVal;
        TGBLError::SetTGBLError(pOut, retVal,retVal,(CKSTRING)errorString);
		beh->ActivateOutput(eBehOutputError, TRUE);
	}
	else
	{
		// We are ok
		beh->ActivateOutput(eBehOutputDone, TRUE);
	}

	return CKBR_OK;
}