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


C++ GS函数代码示例

本文整理汇总了C++中GS函数的典型用法代码示例。如果您正苦于以下问题:C++ GS函数的具体用法?C++ GS怎么用?C++ GS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: icon_preview_startjob_all_sizes

static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short *do_update, float *progress)
{
	IconPreview *ip = (IconPreview *)customdata;
	IconPreviewSize *cur_size = ip->sizes.first;
	const bool use_new_shading = BKE_scene_use_new_shading_nodes(ip->scene);

	while (cur_size) {
		ShaderPreview *sp = MEM_callocN(sizeof(ShaderPreview), "Icon ShaderPreview");

		/* construct shader preview from image size and previewcustomdata */
		sp->scene = ip->scene;
		sp->owner = ip->owner;
		sp->sizex = cur_size->sizex;
		sp->sizey = cur_size->sizey;
		sp->pr_method = PR_ICON_RENDER;
		sp->pr_rect = cur_size->rect;
		sp->id = ip->id;

		if (use_new_shading) {
			/* texture icon rendering is hardcoded to use BI,
			 * so don't even think of using cycle's bmain for
			 * texture icons
			 */
			if (GS(ip->id->name) != ID_TE)
				sp->pr_main = G_pr_main_cycles;
			else
				sp->pr_main = G_pr_main;
		}
		else {
			sp->pr_main = G_pr_main;
		}

		common_preview_startjob(sp, stop, do_update, progress);
		shader_preview_free(sp);

		cur_size = cur_size->next;
	}
}
开发者ID:mcgrathd,项目名称:blender,代码行数:38,代码来源:render_preview.c

示例2: unpack_generate_paths

static void unpack_generate_paths(
        const char *name, ID *id, char *abspath_r, char *relpath_r, size_t abspathlen, size_t relpathlen)
{
	char tempname[FILE_MAX];
	char tempdir[FILE_MAXDIR];

	BLI_split_dirfile(name, tempdir, tempname, sizeof(tempdir), sizeof(tempname));

	if (tempname[0] == '\0') {
		/* Note: we do not have any real way to re-create extension out of data... */
		BLI_strncpy(tempname, id->name + 2, sizeof(tempname));
		printf("%s\n", tempname);
		BLI_filename_make_safe(tempname);
		printf("%s\n", tempname);
	}

	if (tempdir[0] == '\0') {
		/* Fallback to relative dir. */
		BLI_strncpy(tempdir, "//", sizeof(tempdir));
	}

	switch (GS(id->name)) {
		case ID_VF:
			BLI_snprintf(relpath_r, relpathlen, "//fonts/%s", tempname);
			break;
		case ID_SO:
			BLI_snprintf(relpath_r, relpathlen, "//sounds/%s", tempname);
			break;
		case ID_IM:
			BLI_snprintf(relpath_r, relpathlen, "//textures/%s", tempname);
			break;
	}

	{
		size_t len = BLI_strncpy_rlen(abspath_r, tempdir, abspathlen);
		BLI_strncpy(abspath_r + len, tempname, abspathlen - len);
	}
}
开发者ID:akonneker,项目名称:blensor,代码行数:38,代码来源:packedFile.c

示例3: BKE_libblock_free_us

void BKE_libblock_free_us(Main *bmain, void *idv)      /* test users */
{
	ID *id = idv;
	
	id_us_min(id);

	/* XXX This is a temp (2.77) hack so that we keep same behavior as in 2.76 regarding groups when deleting an object.
	 *     Since only 'user_one' usage of objects is groups, and only 'real user' usage of objects is scenes,
	 *     removing that 'user_one' tag when there is no more real (scene) users of an object ensures it gets
	 *     fully unlinked.
	 *     But only for local objects, not linked ones!
	 *     Otherwise, there is no real way to get rid of an object anymore - better handling of this is TODO.
	 */
	if ((GS(id->name) == ID_OB) && (id->us == 1) && (id->lib == NULL)) {
		id_us_clear_real(id);
	}

	if (id->us == 0) {
		BKE_libblock_unlink(bmain, id, false, false);
		
		BKE_libblock_free(bmain, id);
	}
}
开发者ID:wisaac407,项目名称:blender,代码行数:23,代码来源:library_remap.c

示例4: copy_to_selected_list

static int copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb, int *use_path)
{
	*use_path = FALSE;

	if (RNA_struct_is_a(ptr->type, &RNA_EditBone))
		*lb = CTX_data_collection_get(C, "selected_editable_bones");
	else if (RNA_struct_is_a(ptr->type, &RNA_PoseBone))
		*lb = CTX_data_collection_get(C, "selected_pose_bones");
	else if (RNA_struct_is_a(ptr->type, &RNA_Sequence))
		*lb = CTX_data_collection_get(C, "selected_editable_sequences");
	else {
		ID *id = ptr->id.data;

		if (id && GS(id->name) == ID_OB) {
			*lb = CTX_data_collection_get(C, "selected_editable_objects");
			*use_path = TRUE;
		}
		else
			return 0;
	}
	
	return 1;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:23,代码来源:interface_ops.c

示例5: SDIR

void SDIR(astr A_S,aint K1,aint K2) {
																								//	Procedure SDIR[A$,K1,K2]
	aint I;
	astr PAT_S="", NAME_S="";
	OKNO(100,60,140,160);													//	   OKNO[100,60,140,160]
	GADGET(OKX+10,OKY+8,120,15,A_S,K1,0,K2,31,-1);//	   GADGET[OKX+10,OKY+8,120,15,A$,K1,0,K2,31,-1]
																								//	   If Exist(KAT$+"archiwum")
	PAT_S=KAT_S+"archiwum/";											//	      PAT$=KAT$+"archiwum/"
	if( ! DirExists(PAT_S) ) {
		PAT_S="./";
	}
																								//	   Else
																								//	      REQUEST["archiwum:","Archiwum"]
																								//	      PAT$="archiwum:"
																								//	   End If
																								//
	for( I=0; I<=4; ++I ) {												//	   For I=0 To 4
		NAME_S = _sdir_get_file_name(I);
		GADGET(OKX+10,OKY+28+(I*20),120,15,NAME_S,8,1,6,31,I+1);//	      GADGET[OKX+10,OKY+28+(I*20),120,15,NAME$,8,1,6,31,I+1]
	}																							//	   Next
	GADGET(OKX+10,OKY+128,120,15,GS("226"),8,1,6,31,6);//	   GADGET[OKX+10,OKY+128,120,15,"Exit",8,1,6,31,6]
	Param_S=PAT_S;																							//	End Proc[PAT$]
}
开发者ID:boskee,项目名称:lamos,代码行数:23,代码来源:lgn_diskacs.cpp

示例6: while

bool CSettingConfig::UpdateAdvanced ( bool AdvancedMode, HTREEITEM hItem )
{
	while (hItem)
	{
		CSettingsPage * Page = (CSettingsPage * )m_PagesTreeList.GetItemData(hItem);
		if (!AdvancedMode && Page == m_AdvancedPage)
		{
			m_PagesTreeList.DeleteItem(hItem);
			return true;
		}
		if (AdvancedMode && Page == m_GeneralOptionsPage)
		{
			m_PagesTreeList.InsertItemW(TVIF_TEXT | TVIF_PARAM,GS(m_AdvancedPage->PageTitle()),0,0,0,0,(ULONG)m_AdvancedPage,hItem,TVI_FIRST);
			return true;
		}
		if (UpdateAdvanced(AdvancedMode,m_PagesTreeList.GetChildItem(hItem)))
		{
			return true;
		}
		hItem = m_PagesTreeList.GetNextSiblingItem(hItem);
	}
	return false;
}
开发者ID:Hiro5,项目名称:project64,代码行数:23,代码来源:Settings+Config.cpp

示例7: GS

void COptionsShortCutsPage::OnShortCutChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
    //Get the virtual key info
    int index = m_VirtualKeyList.GetCurSel();
    if (index < 0) { return; }
    WORD key = (WORD)m_VirtualKeyList.GetItemData(index);
    bool bCtrl = (SendDlgItemMessage(IDC_CTL, BM_GETCHECK, 0, 0) == BST_CHECKED);
    bool bAlt = (SendDlgItemMessage(IDC_ALT, BM_GETCHECK, 0, 0) == BST_CHECKED);
    bool bShift = (SendDlgItemMessage(IDC_SHIFT, BM_GETCHECK, 0, 0) == BST_CHECKED);

    ACCESS_MODE AccessLevel = (ACCESS_MODE)m_CpuState.GetItemData(m_CpuState.GetCurSel());

    stdstr str = GS(m_ShortCuts.GetMenuItemName(key, bCtrl, bAlt, bShift, AccessLevel));
    if (str.length() > 0)
    {
        str.resize(std::remove(str.begin(), str.end(), '&') - str.begin());
    }
    else
    {
        str = "None";
    }
    SetDlgItemText(IDC_ASSIGNED_MENU_ITEM, str.c_str());
}
开发者ID:NickG22293,项目名称:project64,代码行数:23,代码来源:SettingsPage-KeyboardShortcuts.cpp

示例8: new_id

int new_id(ListBase *lb, ID *id, const char *tname)
{
	int result;
	char name[22];
	
	/* if library, don't rename */
	if(id->lib) return 0;

	/* if no libdata given, look up based on ID */
	if(lb==NULL) lb= wich_libbase(G.main, GS(id->name));

	if(tname==0) {	/* if no name given, use name of current ID */
		strncpy(name, id->name+2, 21);
		result= strlen(id->name+2);
	}
	else { /* else make a copy (tname args can be const) */
		strncpy(name, tname, 21);
		result= strlen(tname);
	}

	/* if result > 21, strncpy don't put the final '\0' to name. */
	if( result >= 21 ) name[21]= 0;

	result = check_for_dupid( lb, id, name );
	strcpy( id->name+2, name );

	/* This was in 2.43 and previous releases
	 * however all data in blender should be sorted, not just duplicate names
	 * sorting should not hurt, but noting just incause it alters the way other
	 * functions work, so sort every time */
	/* if( result )
		sort_alpha_id(lb, id);*/
	
	sort_alpha_id(lb, id);
	
	return result;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:37,代码来源:library.c

示例9: BKE_unpack_id

/* ID should be not NULL */
void BKE_unpack_id(Main *bmain, ID *id, ReportList *reports, int how)
{
	switch (GS(id->name)) {
		case ID_IM:
		{
			Image *ima = (Image *)id;
			if (BKE_image_has_packedfile(ima)) {
				unpackImage(bmain, reports, ima, how);
			}
			break;
		}
		case ID_VF:
		{
			VFont *vf = (VFont *)id;
			if (vf->packedfile) {
				unpackVFont(bmain, reports, vf, how);
			}
			break;
		}
		case ID_SO:
		{
			bSound *snd = (bSound *)id;
			if (snd->packedfile) {
				unpackSound(bmain, reports, snd, how);
			}
			break;
		}
		case ID_LI:
		{
			Library *li = (Library *)id;
			BKE_reportf(reports, RPT_ERROR, "Cannot unpack individual Library file, '%s'", li->name);
			break;
		}
		default:
			break;
	}
}
开发者ID:wchargin,项目名称:blender,代码行数:38,代码来源:packedFile.c

示例10: CTX_wm_area

/* Create new action */
static bAction *action_create_new(bContext *C, bAction *oldact)
{
	ScrArea *sa = CTX_wm_area(C);
	bAction *action;
	
	/* create action - the way to do this depends on whether we've got an
	 * existing one there already, in which case we make a copy of it
	 * (which is useful for "versioning" actions within the same file)
	 */
	if (oldact && GS(oldact->id.name) == ID_AC) {
		/* make a copy of the existing action */
		action = BKE_action_copy(CTX_data_main(C), oldact);
	}
	else {
		/* just make a new (empty) action */
		action = add_empty_action(CTX_data_main(C), "Action");
	}
	
	/* when creating new ID blocks, there is already 1 user (as for all new datablocks), 
	 * but the RNA pointer code will assign all the proper users instead, so we compensate
	 * for that here
	 */
	BLI_assert(action->id.us == 1);
	id_us_min(&action->id);
	
	/* set ID-Root type */
	if (sa->spacetype == SPACE_ACTION) {
		SpaceAction *saction = (SpaceAction *)sa->spacedata.first;
		
		if (saction->mode == SACTCONT_SHAPEKEY)
			action->idroot = ID_KE;
		else
			action->idroot = ID_OB;
	}
	
	return action;
}
开发者ID:diekev,项目名称:blender,代码行数:38,代码来源:action_data.c

示例11: ED_object_shape_key_remove_all

static bool ED_object_shape_key_remove_all(Main *bmain, Object *ob)
{
    Key *key;

    key = BKE_key_from_object(ob);
    if (key == NULL)
        return false;

    switch (GS(key->from->name)) {
    case ID_ME:
        ((Mesh *)key->from)->key    = NULL;
        break;
    case ID_CU:
        ((Curve *)key->from)->key   = NULL;
        break;
    case ID_LT:
        ((Lattice *)key->from)->key = NULL;
        break;
    }

    BKE_libblock_free_us(bmain, key);

    return true;
}
开发者ID:caomw,项目名称:blender-ui,代码行数:24,代码来源:object_shapekey.c

示例12: BKE_libblock_alloc

/* used everywhere in blenkernel */
void *BKE_libblock_copy_ex(Main *bmain, ID *id)
{
	ID *idn;
	size_t idn_len;

	idn = BKE_libblock_alloc(bmain, GS(id->name), id->name + 2);

	assert(idn != NULL);

	idn_len = MEM_allocN_len(idn);
	if ((int)idn_len - (int)sizeof(ID) > 0) { /* signed to allow neg result */
		const char *cp = (const char *)id;
		char *cpn = (char *)idn;

		memcpy(cpn + sizeof(ID), cp + sizeof(ID), idn_len - sizeof(ID));
	}
	
	id->newid = idn;
	idn->flag |= LIB_NEW;

	BKE_libblock_copy_data(idn, id, false);
	
	return idn;
}
开发者ID:manwapastorelli,项目名称:blender-git,代码行数:25,代码来源:library.c

示例13: CreateFile

bool CFlashram::LoadFlashram()
{
    CPath FileName;

    FileName.SetDriveDirectory(g_Settings->LoadStringVal(Directory_NativeSave).c_str());
    FileName.SetName(g_Settings->LoadStringVal(Game_GameName).c_str());
    FileName.SetExtension("fla");

    if (!FileName.DirectoryExists())
    {
        FileName.DirectoryCreate();
    }

    m_hFile = CreateFile(FileName, m_ReadOnly ? GENERIC_READ : GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS,
        FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
    if (m_hFile == INVALID_HANDLE_VALUE)
    {
        WriteTrace(TraceN64System, TraceError, "Failed to open (%s), ReadOnly = %d, LastError = %X", (LPCTSTR)FileName, m_ReadOnly, GetLastError());
        g_Notify->DisplayError(GS(MSG_FAIL_OPEN_FLASH));
        return false;
    }
    SetFilePointer(m_hFile, 0, NULL, FILE_BEGIN);
    return true;
}
开发者ID:minnowc,项目名称:project64,代码行数:24,代码来源:FlashRam.cpp

示例14: ui_id_icon_get

int ui_id_icon_get(const bContext *C, ID *id, const bool big)
{
	int iconid = 0;
	
	/* icon */
	switch (GS(id->name)) {
		case ID_BR:
			iconid = ui_id_brush_get_icon(C, id);
			break;
		case ID_MA: /* fall through */
		case ID_TE: /* fall through */
		case ID_IM: /* fall through */
		case ID_WO: /* fall through */
		case ID_LA: /* fall through */
			iconid = BKE_icon_id_ensure(id);
			/* checks if not exists, or changed */
			UI_id_icon_render(C, NULL, id, big, true);
			break;
		default:
			break;
	}

	return iconid;
}
开发者ID:AwesomeDoesIt,项目名称:blender-git,代码行数:24,代码来源:interface_icons.c

示例15: BKE_previewimg_free_id

void BKE_previewimg_free_id(ID *id) 
{
	if (GS(id->name) == ID_MA) {
		Material *mat = (Material*)id;	
		BKE_previewimg_free(&mat->preview);
	} else if (GS(id->name) == ID_TE) {
		Tex *tex = (Tex*)id;
		BKE_previewimg_free(&tex->preview);
	} else if (GS(id->name) == ID_WO) {
		World *wo = (World*)id;
		BKE_previewimg_free(&wo->preview);
	} else if (GS(id->name) == ID_LA) {
		Lamp *la  = (Lamp*)id;
		BKE_previewimg_free(&la->preview);
	} else if (GS(id->name) == ID_IM) {
		Image *img  = (Image*)id;
		BKE_previewimg_free(&img->preview);
	} else if (GS(id->name) == ID_BR) {
		Brush *br  = (Brush*)id;
		BKE_previewimg_free(&br->preview);
	}
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:22,代码来源:icons.c


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