예제 #1
0
void
OSOReaderToMaster::instruction_arg (const char *name)
{
    ustring argname (name);
    UstringIntMap::const_iterator found = m_symmap.find (argname);
    if (found != m_symmap.end()) {
        m_master->m_args.push_back (found->second);
        ++m_nargs;
        return;
    }
    m_shadingsys.error ("Parsing shader %s: unknown arg %s",
                        m_master->shadername().c_str(), name);
    m_errors = true;
}
예제 #2
0
// 本体とプラグインの設定情報を読込み、ツリーに反映する
void ConfigFormUnit::LoadOptionTree() {
	tTVPCommandOptionList* options = TVPGetEngineCommandDesc();
	if( options ) {
		LoadPluginOptionDesc( options, L"\\", L"dll" );
		LoadPluginOptionDesc( options, L"\\", L"tpm" );
		LoadPluginOptionDesc( options, L"plugin\\", L"dll" );
		LoadPluginOptionDesc( options, L"plugin\\", L"tpm" );

		tTJSVariant val;
		HTREEITEM hFirst = NULL;
		// 有効なアイテム数をカウント
		tjs_uint itemcount = 0;
		tjs_uint count = options->Categories.size();
		for( tjs_uint i = 0; i < count; i++ ) {
			const tTVPCommandOptionCategory& category = options->Categories[i];
			tjs_uint optcount = category.Options.size();
			for( tjs_uint j = 0; j < optcount; j++ ) {
				if( category.Options[j].User ) itemcount++;
			}
		}
		TreeItems.resize(itemcount);

		tjs_uint itemidx = 0;
		for( tjs_uint i = 0; i < count; i++ ) {
			const tTVPCommandOptionCategory& category = options->Categories[i];
			tjs_uint optcount = category.Options.size();
			// まずはカテゴリに有効なアイテムがあるかチェックする
			bool hasitem = false;
			for( tjs_uint j = 0; j < optcount; j++ ) {
				if( category.Options[j].User ) {
					hasitem = true;
					break;
				}
			}
			if( hasitem == false ) continue;
			HTREEITEM hItem = InsertTreeItem( TVI_ROOT, category.Name );
			if( hFirst == NULL ) hFirst = hItem;
			for( tjs_uint j = 0; j < optcount; j++ ) {
				const tTVPCommandOption& option = category.Options[j];
				if( option.User ) {
					TreeItem& curitem = TreeItems[itemidx];
					curitem.Text = option.Caption;
					curitem.Parameter = option.Name;
					curitem.Description = std::wstring(L"-")+option.Name+std::wstring(L"\n")+option.Description;
					ConvertReturnCode( curitem.Description );
					tjs_uint valcount = option.Values.size();
					curitem.Select.resize( valcount );
					curitem.Defalut = -1;
					std::wstring argname( std::wstring(L"-") + option.Name );
					std::wstring selectvalue;
					if( TVPGetCommandLine( argname.c_str(), &val) ) {
						ttstr str(val);
						selectvalue.assign( str.c_str(), str.length() );
					}
					tjs_int selectindex = -1;
					for( tjs_uint k = 0; k < valcount; k++ ) {
						std::pair<std::wstring, std::wstring>& sel = curitem.Select[k];
						const tTVPCommandOptionsValue& val = option.Values[k];
						sel.first = val.Value;
						sel.second = val.Description;
						if( val.IsDefault ) {
							curitem.Defalut = k;
						}
						if( selectindex < 0 && !selectvalue.empty() && selectvalue == val.Value ) {
							selectindex = k;
						}
					}
					if( selectindex >= 0 ) {
						curitem.Value = selectindex;
					} else if( curitem.Defalut >= 0 ) {
						curitem.Value = curitem.Defalut;
					} else {
						curitem.Value = 0;
					}

					if( curitem.Defalut != curitem.Value ) {
						curitem.Caption = std::wstring(L"* ") + curitem.Text + std::wstring(L" : ") + curitem.Select[curitem.Value].second;
					} else {
						curitem.Caption = curitem.Text + std::wstring(L" : ") + curitem.Select[curitem.Value].second;
					}
					curitem.ItemHandle = InsertTreeItem( hItem, curitem.Caption );
					itemidx++;
				}
			}
			TreeView_Expand( TreeControl, hItem, TVE_EXPAND );
		}
		TreeView_SelectItem( TreeControl, hFirst );
		delete options;
	}
}