当前位置: 首页>>代码示例>>C++>>正文


C++ CKContext::GetAttributeManager方法代码示例

本文整理汇总了C++中CKContext::GetAttributeManager方法的典型用法代码示例。如果您正苦于以下问题:C++ CKContext::GetAttributeManager方法的具体用法?C++ CKContext::GetAttributeManager怎么用?C++ CKContext::GetAttributeManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CKContext的用法示例。


在下文中一共展示了CKContext::GetAttributeManager方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RegisterAttributeType

//************************************
// Method:    RegisterAttributeType
// FullName:  RegisterAttributeType
// Access:    public
// Returns:   int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int RegisterAttributeType(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;
	PhysicManager *pm = GetPMan();

	CKAttributeManager* attman = ctx->GetAttributeManager();
	CKParameterManager *pMan  = ctx->GetParameterManager();

	using namespace vtTools::BehaviorTools;

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

		
		CKSTRING name = GetInputParameterValue<CKSTRING>(beh,bbI_Name);
		CKSTRING category = GetInputParameterValue<CKSTRING>(beh,bbI_Category);
		CKSTRING defValue = GetInputParameterValue<CKSTRING>(beh,bbI_DefValue);
		int pType = GetInputParameterValue<int>(beh,bbI_PType);
		CK_CLASSID classId = GetInputParameterValue<CK_CLASSID>(beh,bbI_Class);

		int attFlags = 0 ;
		int user = GetInputParameterValue<int>(beh,bbI_User);
		int save = GetInputParameterValue<int>(beh,bbI_Save);

		if(user)
			attFlags|=CK_ATTRIBUT_USER;

		if(save)
			attFlags|=CK_ATTRIBUT_TOSAVE;

		attFlags|=CK_ATTRIBUT_CAN_DELETE;

		CKAttributeType aIType = attman->GetAttributeTypeByName(name);
		if (aIType!=-1)
		{
			beh->ActivateOutput(1);
		}

		int att =  attman->RegisterNewAttributeType(name,pMan->ParameterTypeToGuid(pType),classId,(CK_ATTRIBUT_FLAGS)attFlags);

		if (strlen(category))
		{
			attman->AddCategory(category);
			attman->SetAttributeCategory(att,category);
		}
		if (strlen(defValue))
		{
			attman->SetAttributeDefaultValue(att,defValue);
		}

	}
	pm->populateAttributeFunctions();
	pm->_RegisterAttributeCallbacks();

	beh->ActivateOutput(0);
	return 0;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:67,代码来源:xRegisterAttributeType.cpp

示例2: SetCIConnectionDetails

int SetCIConnectionDetails(const CKBehaviorContext& behcontext)
{
	/************************************************************************/
	/*  collecting data : 													*/
	/*  																	*/
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;


	GBLConfigurationManager* cman=(GBLConfigurationManager*)ctx->GetManagerByGuid(CONFIGURATION_MAN_GUID);
	CGBLSyncInterface *CINetworkInterface = cman->GetSynInterface();

    
	
	/************************************************************************/
	/*  check interface :													*/
	/*  																	*/
	if (!CINetworkInterface->isValidInterface())
	{
		//try to init the network interface : 
		if (!CINetworkInterface->Init(ctx))
		{
			return CKBR_BEHAVIORERROR;
		}
	}

	/************************************************************************/
	/*  process building block events	:						*/
	/*  																	*/
	if( beh->IsInputActive(0) )
	{
		beh->ActivateInput(0,FALSE);
		XString message((CKSTRING) beh->GetInputParameterReadDataPtr(0));
		int connectionID = -1; 
		beh->GetInputParameterValue(1,&CINetworkInterface->connectionID);
		CKAttributeManager *aMan = static_cast<CKAttributeManager*>(ctx->GetAttributeManager());
		
		//////////////////////////////////////////////////////////////////////////
		//store connection details in the scipt dummies attribute :
		CKAttributeType gblNetworkAtt = aMan->GetAttributeTypeByName( GBL_API_ENTRY("NetworkDetails"));
		if (!CINetworkInterface->messageDummy->HasAttribute(gblNetworkAtt) )
		{		
			CINetworkInterface->messageDummy->SetAttribute(gblNetworkAtt);
		}
		GBLCommon::ParameterTools::SetParameterStructureValue<int>(CINetworkInterface->messageDummy->GetAttributeParameter(gblNetworkAtt),0,CINetworkInterface->connectionID);
		GBLCommon::ParameterTools::SetParameterStructureValue<CKSTRING>(CINetworkInterface->messageDummy->GetAttributeParameter(gblNetworkAtt),1,CINetworkInterface->messageName.Str());
		
		//////////////////////////////////////////////////////////////////////////
		//activate and execute the script :
		behcontext.CurrentScene->Activate(CINetworkInterface->synchronizeScript,true);
		behcontext.CurrentScene->Activate(CINetworkInterface->messageDummy,FALSE);
		CINetworkInterface->synchronizeScript->Execute(1);
		
		beh->ActivateOutput(0);
	}
	return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:57,代码来源:HIDDEN_SetConnectionDetails.cpp

示例3: BehaviourFunction

int GBLCOSetID::BehaviourFunction( const CKBehaviorContext& behContext )
{
    CKBehavior	*behaviour = behContext.Behavior;
    CKContext	*context = behContext.Context;

    behaviour->ActivateInput(ECGBLCOSetLAIDBehInputs::InSetIdentity, FALSE);

    CKAttributeManager*attributeManager = context->GetAttributeManager();
    if (attributeManager != NULL)
    {
        CKLevel *level = context->GetCurrentLevel();
        if ( level != NULL )
        {
            int attributeType = attributeManager->GetAttributeTypeByName("GBLCOLAID");
            if (attributeType == -1)
                attributeType = attributeManager->RegisterNewAttributeType("GBLCOLAID", GUID_TGBLLAID, CKCID_BEOBJECT);
            else if ( level->HasAttribute(attributeType) )
                level->RemoveAttribute(attributeType);

            attributeManager->SetAttributeCategory(attributeType,"GBL");
            level->SetAttribute(attributeType);

            CKParameter*attribute = level->GetAttributeParameter(attributeType);
            if ( attribute != NULL )
            {
                CKParameterIn*pin = behaviour->GetInputParameter(ECGBLCOSetLAIDBehInputs::InSetIdentity);
                CKParameter*laid = pin->GetDirectSource();
                if ( laid != NULL )
                {
                    CKERROR err = attribute->CopyValue(laid);
                    if ( err == CK_OK )
                    {
                        behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutIdentitySet, TRUE);
                        behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutError, FALSE);
                        return CKBR_OK;
                    }
                }
            }
        }
    }

    CKParameterOut *parameterOutError = behaviour->GetOutputParameter(ECGBLCOSetLAIDParamOutputs::GetError);
    TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLCO_ERROR_SETID_ATTRIBUTE,GBLCO_ERROR_SETID_ATTRIBUTE_DESC);

    behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutIdentitySet, FALSE);
    behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutError, TRUE);
    return CKBR_GENERICERROR;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:48,代码来源:GBLCOSetID.cpp

示例4: SetCIConnectionDetails

int SetCIConnectionDetails(const CKBehaviorContext& behcontext)
{
	/************************************************************************/
	/*  collecting data : 													*/
	/*  																	*/
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;


	MeasuredObjectiveControllerMgr* mman=(MeasuredObjectiveControllerMgr*)ctx->GetManagerByGuid(MeasuredObjectiveControllerMgrGUID);
	
	CGBLSyncInterface * syninterface = CGBLLOArrayHandler::Instance()->GetSynInterface();

    
	/************************************************************************/
	/*  check interface :													*/
	/* 
	*/

	if (!syninterface->isValidInterface())
	{
		Logger::ShowDebugMessage(ctx,Logger::ELOGERROR,"interface wrong");
		//try to init the network interface : 
		if (!syninterface->Init(ctx))
		{
			Logger::ShowDebugMessage(ctx,Logger::ELOGERROR,"not loaded");
			return CKBR_BEHAVIORERROR;
		}
	}				  

	/************************************************************************/
	/*  process building block events	:						*/
	/*  																	*/
	
	if( beh->IsInputActive(0) )
	{
		beh->ActivateInput(0,FALSE);
		XString message((CKSTRING) beh->GetInputParameterReadDataPtr(0));
		int connectionID = -1; 
		beh->GetInputParameterValue(1,&syninterface->connectionID);
		CKAttributeManager *aMan = static_cast<CKAttributeManager*>(ctx->GetAttributeManager());
		
		//////////////////////////////////////////////////////////////////////////
		//store connection details in the scipt dummies attribute :
		CKAttributeType gblNetworkAtt = aMan->GetAttributeTypeByName( GBL_API_ENTRY("NetworkDetails"));
		if (!syninterface->messageDummy->HasAttribute(gblNetworkAtt) )
		{		
			syninterface->messageDummy->SetAttribute(gblNetworkAtt);
		}
		GBLCommon::ParameterTools::SetParameterStructureValue<int>(syninterface->messageDummy->GetAttributeParameter(gblNetworkAtt),0,syninterface->connectionID);
		GBLCommon::ParameterTools::SetParameterStructureValue<CKSTRING>(syninterface->messageDummy->GetAttributeParameter(gblNetworkAtt),1,syninterface->messageName.Str());
		
		//////////////////////////////////////////////////////////////////////////
		//activate and execute the script :
		behcontext.CurrentScene->Activate(syninterface->synchronizeScript,true);
		behcontext.CurrentScene->Activate(syninterface->messageDummy,FALSE);
		syninterface->synchronizeScript->Execute(1);
																		   
		beh->ActivateOutput(0);
	}
	return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:62,代码来源:HIDDEN_SetConnectionDetails.cpp


注:本文中的CKContext::GetAttributeManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。