Esempio n. 1
0
AVSINLINE const CStringW Encoding::string2wstring(const CStringA &sLine, const unsigned int unCodePage)
{
	const int nSize = MultiByteToWideChar( unCodePage, 0, sLine.GetString(), sLine.GetLength(), NULL, 0 );

	wchar_t *sTemp = new wchar_t[nSize];
	if ( !sTemp )
		return _T("");

	MultiByteToWideChar( unCodePage, 0, sLine.GetString(), sLine.GetLength(), sTemp, nSize );

	CStringW sResult( sTemp );
	delete []sTemp;

	return sResult;
}
Esempio n. 2
0
bool CModDoc::CopyEnvelope(INSTRUMENTINDEX nIns, EnvelopeType nEnv)
//-----------------------------------------------------------------
{
	CMainFrame *pMainFrm = CMainFrame::GetMainFrame();
	HANDLE hCpy;
	DWORD dwMemSize;

	if ((nIns < 1) || (nIns > m_SndFile.m_nInstruments) || (!m_SndFile.Instruments[nIns]) || (!pMainFrm)) return false;
	BeginWaitCursor();
	const ModInstrument *pIns = m_SndFile.Instruments[nIns];
	if(pIns == nullptr) return false;
	
	CStringA s;
	EnvelopeToString(s, pIns->GetEnvelope(nEnv));

	dwMemSize = s.GetLength() + 1;
	if ((pMainFrm->OpenClipboard()) && ((hCpy = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, dwMemSize))!=NULL))
	{
		EmptyClipboard();
		LPBYTE p = (LPBYTE)GlobalLock(hCpy);
		if(p != nullptr)
		{
			memcpy(p, s.GetString(), dwMemSize);
		}
		GlobalUnlock(hCpy);
		SetClipboardData (CF_TEXT, (HANDLE)hCpy);
		CloseClipboard();
	}
	EndWaitCursor();
	return true;
}
Esempio n. 3
0
void KEditDialogImpl::OnPalette()
{
    SetFocus();
    if (m_uSelItemID != 0)
    {
        IComponent* pCompTmp = _CompFactory();

        if (pCompTmp != NULL)
        {
            m_vecComp.push_back(pCompTmp);

            SetItemCheck(m_uSelItemID, FALSE);
            m_uSelItemID = 0;
            m_pNowComp   = pCompTmp;

            CStringA strPos;
            CPoint   cPoint;

            _TransfromPoint(m_nowPoint, cPoint);
            strPos.Format("%d,%d", cPoint.x, cPoint.y);
            m_pNowComp->SetCompAttrute("pos", strPos.GetString());
        }
    }
    else if (m_nSelItem == -1)
    {
        m_pNowComp = NULL;
    }
    _Redraw();
}
Esempio n. 4
0
BOOL file_put_contents(LPCTSTR lpszFilename, LPCTSTR lpszBuffer)
{
	CStringA strA;
	USES_CONVERSION;
	strA = CT2CA( lpszBuffer );
	return file_put_contents(lpszFilename, (BYTE*)strA.GetString(), strA.GetLength());
}
Esempio n. 5
0
LPCSTR StringWCharToChar(LPCWSTR sWChar, CStringA &sChar, int iChars/* = -1*/, char chDef/* = '?'*/, UINT codepage/* = CP_ACP*/)
{
	if (!sWChar)
		return NULL;

	sChar.Empty();
	int iLen = WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, sWChar, iChars, NULL, 0, &chDef, NULL);
	if (iLen > 0) {
		LPSTR sBuf = sChar.GetBufferSetLength(iLen);
		WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, sWChar, iChars, sBuf, iLen, &chDef, NULL);
		sChar.ReleaseBufferSetLength(sBuf[iLen - 1] ? iLen : iLen - 1);
		return (iLen > 0) ? sChar.GetString() : NULL;
	}

	return (*sWChar != 0) ? sChar.GetString() : NULL;
}
Esempio n. 6
0
LPCSTR StringWCharToUTF8(LPCWSTR sWChar, CStringA &sUTF8, int iChars/* = -1*/)
{
	if (!sWChar)
		return NULL;

	sUTF8.Empty();
	int iLen = WideCharToMultiByte(CP_UTF8, 0, sWChar, iChars, NULL, 0, NULL, NULL);
	if (iLen > 0) {
		LPSTR sBuf = sUTF8.GetBufferSetLength(iLen);
		WideCharToMultiByte(CP_UTF8, 0, sWChar, iChars, sBuf, iLen, NULL, NULL);
		sUTF8.ReleaseBufferSetLength(sBuf[iLen - 1] ? iLen : iLen - 1);
		return (iLen > 0) ? sUTF8.GetString() : NULL;
	}

	return (*sWChar != 0) ? sUTF8.GetString() : NULL;
}
std::string LoadLocalizedString(UINT stringID)
{
  // TODO: The returned string needs to be UTF-8. Do the conversion.
  CStringA retString;
  retString.LoadString(stringID);
  return retString.GetString();
}
Esempio n. 8
0
//INT CRZXRealName::CheckOutTempUser(LPCTSTR lpCardNum)
//{
//	INT nRet = 0;
//
//	if (m_pfnRzxCheckOut != NULL)
//	{	
//		CString strTmp(lpCardNum);
//
//		if (strTmp.GetLength() > 10) //任子行只支持10位
//		{
//			strTmp = strTmp.Right(10);
//		}
//
//		CStringA strCardNum = CT2CA(strTmp);
//		nRet = m_pfnRzxCheckOut(strCardNum);
//
//		CIBALog::GetInstance()->WriteFormat(_T("m_pfnRzxCheckOut: CardNum = %s, Ret = %d"), strTmp, nRet);
//
//		//返回0成功,1失败
//		if (1 == nRet)
//		{
//			//AfxMessageBox(_T("任子行注销卡资料失败!"));
//			CIBALog::GetInstance()->Write(_T("任子行注销卡资料失败!"));
//		}
//	}
//	else
//	{		
//		CIBALog::GetInstance()->WriteFormat(_T("Can't get address 0f RzxCheckOut!"));
//	}
//	
//	return nRet;
//} 

INT CRZXRealName::CheckOutTempUser(LPCTSTR lpCardNum)
{
	#define UM_ID_TEMPCARD_RZX  WM_USER + 1010

	CString strTmp(lpCardNum);

	if (strTmp.GetLength() > 10) //任子行只支持10位
	{
		strTmp = strTmp.Right(10);
	}

	CStringA strCardNum = CT2CA(strTmp);

	COPYDATASTRUCT cds = {0};

	cds.dwData = UM_ID_TEMPCARD_RZX;
	cds.cbData = strCardNum.GetLength();
	cds.lpData = (PVOID)strCardNum.GetString();

	HWND hSureName = ::FindWindow(NULL, _T("任子行实名登记管理系统"));

	if (hSureName == NULL)
	{
		//AfxMessageBox(_T("找不到任子行实名登记管理系统!"));

		CIBALog::GetInstance()->Write(_T("找不到任子行实名登记管理系统!"));

		return FALSE;
	}

	::SendMessage(hSureName, WM_COPYDATA, (WPARAM)hSureName, (LPARAM)&cds);
	
bool CDVSAboutPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg) {
    case WM_INITDIALOG: {
        CStringA version_sha1_short = XY_VSFILTER_VERSION_COMMIT_SHA1;
        version_sha1_short = version_sha1_short.Left(7);
        CStringA version = XY_ABOUT_VERSION_STR;
        version.Format("DirectVobSub %s (git %s)\nxy-VSFilter\nCopyright 2001-2012 Yu Zhuohuang, Gabest et. al.", 
            XY_ABOUT_VERSION_STR, version_sha1_short);
		    
			  SetDlgItemTextA( m_Dlg, IDC_VERSION, version.GetString() );
			  break;
		}		  
	  }

	return false;
}
Esempio n. 10
0
CStringA	FxInternal::TranscodeHandleToPlug (const CStringA& handleStr)
{
	int iLastPos=0;
	int iThisPos=0;

	CStringA result(DirectXShader::RootLongName.asChar());
	CStringA partial(DirectXShader::RootShortName.asChar());

	CStringA subStr;
	while( iLastPos= iThisPos, 
		subStr=handleStr.Tokenize(".[]", iThisPos), 
		iThisPos != -1 )
	{
		if(iLastPos == 0 
			|| handleStr[iLastPos-1]=='.'
			|| (handleStr[iLastPos-1]==']' && handleStr[iLastPos]=='.'))
		{
			partial.Append(subStr.GetString());
			result.AppendFormat(".%s", partial.GetString());
		}
		else if(handleStr[iLastPos-1]=='[' && handleStr[iThisPos-1]==']')
		{
			result.AppendFormat("[%s]", subStr);
		}
		else
			DXCC_ASSERT(false);
	}


	D3DXPARAMETER_DESC		desc;
	D3DXHANDLE handle= DecodeHandle(handleStr);
	Effect->GetParameterDesc(handle, &desc);
	if( desc.StructMembers == 0 && desc.Elements == 0 )
	{
		partial.Append("Value");
		result.AppendFormat(".%s", partial);
	}

	return result;
}
Esempio n. 11
0
bool CModDoc::SaveEnvelope(INSTRUMENTINDEX nIns, EnvelopeType nEnv, const mpt::PathString &fileName)
//--------------------------------------------------------------------------------------------------
{
	if (nIns < 1 || nIns > m_SndFile.m_nInstruments || !m_SndFile.Instruments[nIns]) return false;
	BeginWaitCursor();
	const ModInstrument *pIns = m_SndFile.Instruments[nIns];
	if(pIns == nullptr) return false;
	
	CStringA s;
	EnvelopeToString(s, pIns->GetEnvelope(nEnv));

	FILE *f = mpt_fopen(fileName, "wb");
	if(f == nullptr)
	{
		EndWaitCursor();
		return false;
	}
	fwrite(s.GetString(), s.GetLength(), 1, f);
	fclose(f);
	EndWaitCursor();
	return true;
}
Esempio n. 12
0
void KEditDialogImpl::_CalcMovePos(const std::string& cstrLastPos, std::string& strNowPos)
{
    std::string strPos[4];

    size_t nLastPos = 0;
    size_t nPos     = 0;

    for (int i = 0; i < 4; ++i)
    {
        strPos[i].erase();
        nPos = cstrLastPos.find(",", nLastPos);
        if (nPos != -1)
        {
            strPos[i] = cstrLastPos.substr(nLastPos, nPos - nLastPos);
            nLastPos = nPos + 1;
        }
        else
        {
            strPos[i] = cstrLastPos.substr(nLastPos, cstrLastPos.size() - nLastPos);
            nLastPos = cstrLastPos.size();
            continue;
        }
    }

    strNowPos.erase();
    CStringA strTmp;

    for (int i = 0; i < 4; ++i)
    {
        _CalcPrePos(i, strPos[i], strTmp);
        strNowPos += strTmp.GetString();
    }

    if (strNowPos.size() != 0)
    {
        strNowPos = strNowPos.substr(0, strNowPos.size() - 1);
    }
}
Esempio n. 13
0
HRESULT
CMayaManager::UI_LoadOptions()
{
    HRESULT hr= S_OK;
    LPDXCCPROPERTYBAG pBag= NULL;
    char szSettingFile[MAX_PATH];
    MString mszAppDir;
    UINT iProperty;

    MGlobal::executeCommand( "internalVar -userAppDir", mszAppDir, false, false );
    PathCombineA( szSettingFile, mszAppDir.asChar(), "DXUIOptions.xml" );
    if(!DXCC_SUCCEEDED(DXCCLoadPropertyBagFromFile(szSettingFile, VIEWER_OPTIONS_TYPENAME, VIEWER_OPTIONS_VERSION, &pBag)))
    {
        UI_SaveOptions();

        DXCCCreatePropertyBag(&pBag);
    }


    {
        DXCCPROPERTY_KEY key;
        DXCCPROPERTY_DESC desc;
        LPCVOID value;


        key= pBag->GetKey(PROPERTY_VIEWEROPEN);
        desc= pBag->GetPropertyDesc(key);
        pBag->GetPropertyValueAsData(key, &value);
        if(key && *(BOOL*)value)
        {
            char PanelName[MAX_PATH];
            PanelName[0]= '\0';

            MGlobal::executeCommand ("DirectX_SetViewerStartupState(1)");

            key= pBag->GetKey(PROPERTY_VIEWERWND);
            desc= pBag->GetPropertyDesc(key);
            pBag->GetPropertyValueAsData(key, &value);
            if(key)
            {

                BindViewerToPanel((LPCSTR)value);

                if(0 == lstrcmpiA((LPCSTR)value, "floating"))
                {
                    RECT WndRect = {0,0, 640, 480};

                    key= pBag->GetKey(PROPERTY_VIEWERPOSL);
                    desc= pBag->GetPropertyDesc(key);
                    pBag->GetPropertyValueAsData(key, &value);
                    if(key)
                    {
                        WndRect.left= *(INT*)value;
                    }

                    key= pBag->GetKey(PROPERTY_VIEWERPOST);
                    desc= pBag->GetPropertyDesc(key);
                    pBag->GetPropertyValueAsData(key, &value);
                    if(key)
                    {
                        WndRect.top= *(INT*)value;
                    }

                    key= pBag->GetKey(PROPERTY_VIEWERPOSR);
                    desc= pBag->GetPropertyDesc(key);
                    pBag->GetPropertyValueAsData(key, &value);
                    if(key)
                    {
                        WndRect.right= *(INT*)value;
                    }

                    key= pBag->GetKey(PROPERTY_VIEWERPOSB);
                    desc= pBag->GetPropertyDesc(key);
                    pBag->GetPropertyValueAsData(key, &value);
                    if(key)
                    {
                        WndRect.bottom= *(INT*)value;
                    }

                    MoveWindow(g_Viewer.GetRenderWindow(),
                               WndRect.left,
                               WndRect.top,
                               WndRect.right - WndRect.left,
                               WndRect.bottom - WndRect.top,
                               true);
                }
            }
        }

        key= pBag->GetKey(PROPERTY_RTPREVIEWING);
        desc= pBag->GetPropertyDesc(key);
        pBag->GetPropertyValueAsData(key, &value);
        if(key)
        {
            CStringA cmd;
            cmd.Format("menuItem -e -cb %d  $g_dxPreviewToggle", (*(BOOL*)value));

            MGlobal::executeCommand (cmd.GetString());
        }

        UI_SetPreviewState(UI_GetPreviewState());
    }

    return hr;
}
Esempio n. 14
0
HRESULT CMayaManager::Create(MObject obj)
{
    HRESULT hr= S_OK;
    MStatus stat= MS::kSuccess;
    //MItDag FindRoot;
    D3DPRESENT_PARAMETERS pp = {0};
    HWND hShell;
    HMENU hMenu;
    int iMenu;
    MArgList args;
    const MString DirectXShader_UserClassify( "shader/surface" );



    MFnPlugin plugin(obj, "Microsoft", "6.0", "Any");

    MGlobal::displayInfo("DirectX Extensions for Maya - Initialization Beginning");


    MGlobal::displayInfo("DirectX Extensions for Maya - DXCC Initialization Beginning");
    CStringA pathChangeErr;
    if(!AddDxccDllPath(pathChangeErr))
    {
        MString errStr= MString("DirectX Extensions for Maya - Error loading DXCC: ") + pathChangeErr.GetString();
        MGlobal::displayInfo(errStr);
        MessageBoxA((HWND)M3dView::applicationShell(), errStr.asChar(), "DirectX Extensions for Maya - Critical Error", MB_ICONEXCLAMATION);
        DXCC_GOTO_EXIT(e_Exit, false);
    }

#if defined(DEBUG) | defined(_DEBUG)
    DXCCSetDebugPrintfACallback( MayaDebugPrintfACallback ) ;
    DXCCSetDebugPrintfWCallback( MayaDebugPrintfWCallback ) ;
    DXCCSetBreakPointCallback( DXCCBreakPointDefaultCallback ) ;
    //g_DebugBasic= true;
    //g_DebugExtreme= true;
#endif

    MGlobal::displayInfo("DirectX Extensions for Maya - DXCC Initialization Complete");


    MGlobal::displayInfo("DirectX Extensions for Maya - DXUT Initialization Beginning");
    if( NULL == DXUTGetD3DObject() )
    {
        if(DXCC_FAILED( DXUTInit( false, false, false ) ))
        {
            MString errStr= MString("DirectX Extensions for Maya - Error loading DXUT: Most likely caused by D3D or D3DX DLL miss-match.");
            MGlobal::displayInfo(errStr);
            MessageBoxA((HWND)M3dView::applicationShell(), errStr.asChar(), "DirectX Extensions for Maya - Critical Error", MB_ICONEXCLAMATION);
            DXCC_GOTO_EXIT(e_Exit, false);
        }


        DXCC_ASSERT( DXUTGetD3DObject() != NULL );
    }
    MGlobal::displayInfo("DirectX Extensions for Maya - DXUT Initialization Complete");


    //-----------------------INITIALIZATION ------------------------//

    hr= CManager::Create();
    if(DXCC_FAILED(hr))
    {
        MGlobal::displayError("DirectX Extensions for Maya - Error");
        MGlobal::displayError("Could not initialize base plugin manager");
        DXCC_GOTO_EXIT(e_Exit, false);
    }

    DeviceCreatedEvent= CreateEventA(NULL, FALSE, FALSE, "DXCCManager_DeviceCreated");
    InitializeCriticalSection(&DeviceAndViewerSection);


    MGlobal::displayInfo("DirectX Extensions for Maya - Engine/Device Initialization Beginning");
    g_Engine.Create(this);
    MGlobal::displayInfo("DirectX Extensions for Maya - Engine/Device Initialization Complete");

    SetEngine(&g_Engine);

    pp.BackBufferWidth = 640;
    pp.BackBufferHeight = 480;
    pp.BackBufferCount = 1;
    pp.MultiSampleType = D3DMULTISAMPLE_NONE;
    pp.MultiSampleQuality = 0;
    pp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    pp.hDeviceWindow = NULL;
    pp.Windowed = true;
    pp.EnableAutoDepthStencil = true;
    pp.AutoDepthStencilFormat = D3DFMT_D16;
    pp.FullScreen_RefreshRateInHz = 0;
    pp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;

    MGlobal::displayInfo("DirectX Extensions for Maya - Viewer Initialization Beginning");
    g_Viewer.Create( &g_PreviewPipeline, &pp );
    MGlobal::displayInfo("DirectX Extensions for Maya - Viewer Initialization Complete");


    MGlobal::displayInfo("DirectX Extensions for Maya - SyncGraph Initialization Beginning");
    TagGraph.Initialize("DirectXTag", "DxTag");
    TagGraph.AddAdapter(&TagGraphLayerAdapter);
    TagGraph.AddAdapter(&TagGraphDagAdapter);
    TagGraph.AddAdapter(&TagGraphMeshAdapter);
    TagGraph.AddAdapter(&TagGraphShaderAdapter);
    TagGraph.AddAdapter(&TagGraphStdMtlAdapter);
    TagGraph.SetCallbackState(true);
    TagGraph.RegisterNodes();
    MGlobal::displayInfo("DirectX Extensions for Maya - SyncGraph Initialization Complete");


    MGlobal::displayInfo("DirectX Extensions for Maya - DirectXShader Initialization Beginning");
    DirectXShader::StaticInitialize();
    stat= plugin.registerNode(
              "DirectXShader",
              DirectXShader::id,
              DirectXShader::creator,
              DirectXShader::initialize,
              MPxNode::kDependNode,
              &DirectXShader_UserClassify );
    DXCHECK_MSTATUS(stat);
    MGlobal::displayInfo("DirectX Extensions for Maya - DirectXShader Initialization Complete");

    MGlobal::displayInfo("DirectX Extensions for Maya - XFileTranslator Initialization Beginning");
    // register the translator
    stat = plugin.registerFileTranslator(DXCC_EXPORTER,	// name
                                         NULL,			// icon
                                         XFileTranslator::creator,
                                         NULL,			// script
                                         NULL,
                                         false);
    DXCHECK_MSTATUS(stat);
    MGlobal::displayInfo("DirectX Extensions for Maya - XFileTranslator Initialization Complete");


    /*
    	//DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_EXPORT_SELECTED,  DXCCExportSelectedCommand::creator ));
    */
    CallbackId_Exiting= MSceneMessage::addCallback( MSceneMessage::kMayaExiting, CMayaManager::Callback_MayaExiting, NULL, NULL);
    CallbackId_TimeChanged= MEventMessage::addEventCallback ( "timeChanged", CMayaManager::DispatchTimeChanged, NULL, NULL);

    MGlobal::displayInfo("DirectX Extensions for Maya - MenuCommands Initialization Beginning");
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXM_UIHELP ,  DXMUiHelpCommand::creator ));
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_PREVIEW_CHANGED ,  DXCCPreviewChangedCommand::creator ));
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_EXPORT_SCENE,  DXCCExportSceneCommand::creator ));
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_EXPORT_OPTIONS,  DXCCExportOptionsCommand::creator ));
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_REBUILD_SCENE,  DXCCRebuildSceneCommand::creator ));
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_REBUILD_DIRTY,  DCCRebuildDirtyCommand::creator ));
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_VIEW_FLOATING,  DXCCFloatingViewCommand::creator ));
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_VIEW_CLOSE,  DXCCCloseViewCommand::creator ));
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_VIEW_FRONT,  DXCCFrontViewCommand::creator ));
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_VIEW_SIDE,  DXCCSideViewCommand::creator ));
    DXCHECK_MSTATUS(stat= plugin.registerCommand( DXCC_VIEW_TOP,  DXCCTopViewCommand::creator ));

    MGlobal::displayInfo("DirectX Extensions for Maya - MenuCommands Initialization Complete");

    //Menu Creation
    MGlobal::displayInfo("DirectX Extensions for Maya - Menu Initialization Beginning");
    MGlobal::executeCommand("eval( \"source DirectX\" )", true, true);
    MGlobal::displayInfo("DirectX Extensions for Maya - Menu Initialization Complete");


    //Menu Capture IDs
    MGlobal::displayInfo("DirectX Extensions for Maya - UpdateTimer Initialization Beginning");
    hShell= (HWND)M3dView::applicationShell();
    hMenu= GetMenu(hShell);
    for(iMenu= 0; iMenu < GetMenuItemCount(hMenu); iMenu++)
    {
        char szMenu[MAX_PATH];
        MENUITEMINFOA info;
        ZeroMemory(&info, sizeof(MENUITEMINFO));
        info.cbSize= sizeof(MENUITEMINFO);
        info.fMask= MIIM_STRING|MIIM_SUBMENU;
        info.dwTypeData= szMenu;
        info.cch= MAX_PATH;

        GetMenuItemInfoA(hMenu, iMenu, TRUE, &info);
        szMenu[MAX_PATH-1]= '\0';

        if(0 == lstrcmpiA(szMenu, "DirectX"))
        {
            HMENU hDirectXMenu= info.hSubMenu ;

            for(iMenu= 0; iMenu < GetMenuItemCount(hDirectXMenu); iMenu++)
            {
                ZeroMemory(&info, sizeof(MENUITEMINFO));
                info.cbSize= sizeof(MENUITEMINFO);
                info.fMask= MIIM_STRING|MIIM_SUBMENU;
                info.dwTypeData= szMenu;
                info.cch= MAX_PATH;

                GetMenuItemInfoA(hDirectXMenu, iMenu, TRUE, &info);
                szMenu[MAX_PATH-1]= '\0';

                if(0 == lstrcmpiA(szMenu, "Rebuild Dirty"))
                {
                    m_RebuildDirty_MenuId= (WPARAM)MAKELONG(GetMenuItemID(hDirectXMenu, iMenu), 0);
                    m_RebuildDirtyTimer= SetTimer(NULL, NULL, 200, CMayaManager::TimerProc);
                    break;
                }
            }
            break;
        }
    }
    MGlobal::displayInfo("DirectX Extensions for Maya - UpdateTimer Initialization Complete");

    MGlobal::displayInfo("DirectX Extensions for Maya - UI Options Loading Beginning");
    UI_LoadOptions();
    MGlobal::displayInfo("DirectX Extensions for Maya - UI Options Loading Complete");


    MGlobal::displayInfo("DirectX Extensions for Maya - State Query Command Registration Beginning");
    DXMUnitTests::RegisterCommands(plugin);
    MGlobal::displayInfo("DirectX Extensions for Maya - State Query Command Registration Complete");


    MGlobal::displayInfo("DirectX Extensions for Maya - Initialization Complete");



e_Exit:
    return hr;
}
Esempio n. 15
0
D3DXHANDLE	FxInternal::DecodeHandle(const CStringA& handleStr)
{
	return Effect->GetParameterByName(NULL, handleStr.GetString());
}
Esempio n. 16
0
//THIS FUNCTION IS QUITE COMPLICATED BECAUSE 
//IT HAS TO DEAL WITH MAYA NAME MANGLING!
//tokenize the path.
//add each token into the element list which tracks the attributes and indices
//for each entry added make sure there are no parents left out from maya name mangling.
//after the list is populated and missing elements area added 
//we reiterate and produce the final result.
MPlug		FxInternal::DecodePlug(const CStringA& plugStr)
{

	MPlug result;
	MFnDependencyNode depNode(GetSite());

	CAtlList<PathDecodeElement> elementList;

	//tokenize the path
	int iLastPos=0;
	int iThisPos=0;
	CStringA subStr;
	while( iLastPos= iThisPos, 
		subStr=plugStr.Tokenize(".[]", iThisPos), 
		iThisPos != -1 )
	{
		//char lastChar= subStr[iLastPos];
		//char thisChar= subStr[iThisPos];

		//are we looking at a named portion?
		if(iLastPos == 0 
			|| plugStr[iLastPos-1]=='.'
			|| (plugStr[iLastPos-1]==']' && plugStr[iLastPos]=='.'))
		{
			//if the name is length zero then it must be the case when 
			// you do last[#].  The situation is caused by  the sequence "]."
			//if we dont have a name we can skip since only 1d arrays are allowed.

			if(subStr.GetLength() > 0)
			{
		
				//everything we add is going to be based on the current tail.
				//because we are adding parents, as we find parents we can continue
				//to add them to this position so that they will order themselves properly
				POSITION insertPos= elementList.GetTailPosition();

				//calculate the cancel condition.
				//it is the current tail's object if a tail exists otherwise NULL
				//NULL indicates go all the way to the root
				MObject cancelObj= MObject::kNullObj;
				if(elementList.GetCount() > 0)
				{
					cancelObj= elementList.GetTail().Attribute.object();
				}


				//get the object we are currently working with
				MObject thisObj= depNode.attribute(subStr.GetString());
				if(thisObj.isNull())
					return MPlug();//Critical element of the path was not found...return NULL


				//add it to the list so that we have something to insertBefore
				elementList.AddTail();
				elementList.GetTail().Name= subStr;
				elementList.GetTail().Attribute.setObject(thisObj);



				//walk through all of the parents until we reach cancel condition.
				//we can add  the current element onto the list in the same way.
				for( MFnAttribute itrAttr( elementList.GetTail().Attribute.parent() );
					!itrAttr.object().isNull()  && (cancelObj != itrAttr.object());
					itrAttr.setObject(itrAttr.parent()))
				{
					PathDecodeElement element;
					element.Attribute.setObject( itrAttr.object() );

					//we change the position so that the grandparent is inserted before the parent
					insertPos= elementList.InsertBefore( insertPos, element);
				}
			}
		}
		//are we looking at a numbered portion?
		else if(plugStr[iLastPos-1]=='[' && plugStr[iThisPos-1]==']')
		{
			//if so change the array index.
			elementList.GetTail().IsArray= true;
			elementList.GetTail().Index = atoi( subStr.GetString() );
		}
		else
			DXCC_ASSERT(false);//VERY POORLY FORMED STRING

	}

	//produce the result plug off of the elementList.
	bool first= true;
	for(POSITION pos= elementList.GetHeadPosition();
		pos != NULL;
		elementList.GetNext(pos))
	{
		PathDecodeElement& element= elementList.GetAt(pos);

		if(first)
		{//on first one we initialize the result 
			first= false;
			result= MPlug( GetSite(), element.Attribute.object() );
		}
		else
		{
			result= result.child( element.Attribute.object() );
		}

		if(element.IsArray)
		{
			result= result.elementByLogicalIndex(element.Index);
		}


		if(result.isNull())
			return MPlug();//Critical element of the path was not found...return NULL
	}


	return result;
}