• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ BLI_addhead函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MEM_callocN

static void *ml_addview_cb(void *base, const char *str)
{
	RenderResult *rr = base;
	RenderView *rv;

	rv = MEM_callocN(sizeof(RenderView), "new render view");
	BLI_strncpy(rv->name, str, EXR_VIEW_MAXNAME);

	/* For stereo drawing we need to ensure:
	 * STEREO_LEFT_NAME  == STEREO_LEFT_ID and
	 * STEREO_RIGHT_NAME == STEREO_RIGHT_ID */

	if (STREQ(str, STEREO_LEFT_NAME)) {
		BLI_addhead(&rr->views, rv);
	}
	else if (STREQ(str, STEREO_RIGHT_NAME)) {
		RenderView *left_rv = BLI_findstring(&rr->views, STEREO_LEFT_NAME, offsetof(RenderView, name));

		if (left_rv == NULL) {
			BLI_addhead(&rr->views, rv);
		}
		else {
			BLI_insertlinkafter(&rr->views, left_rv, rv);
		}
	}
	else {
		BLI_addtail(&rr->views, rv);
	}

	return rv;
}
开发者ID:sntulix,项目名称:blender-api-javascript,代码行数:31,代码来源:render_result.c


示例2: BLI_remlink

static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *ibuf, int tx, int ty)
{
	ImThreadTile *ttile, lookuptile;
	ImGlobalTile *gtile, *replacetile;
	int toffs= ibuf->xtiles*ty + tx;

	/* test if it is already in our thread local cache */
	if((ttile=cache->tiles.first)) {
		/* check last used tile before going to hash */
		if(ttile->ibuf == ibuf && ttile->tx == tx && ttile->ty == ty)
			return ibuf->tiles[toffs];

		/* find tile in hash */
		lookuptile.ibuf = ibuf;
		lookuptile.tx = tx;
		lookuptile.ty = ty;

		if((ttile=BLI_ghash_lookup(cache->tilehash, &lookuptile))) {
			BLI_remlink(&cache->tiles, ttile);
			BLI_addhead(&cache->tiles, ttile);

			return ibuf->tiles[toffs];
		}
	}

	/* not found, have to do slow lookup in global cache */
	if(cache->unused.first == NULL) {
		ttile= cache->tiles.last;
		replacetile= ttile->global;
		BLI_remlink(&cache->tiles, ttile);
		BLI_ghash_remove(cache->tilehash, ttile, NULL, NULL);
	}
	else {
		ttile= cache->unused.first;
		replacetile= NULL;
		BLI_remlink(&cache->unused, ttile);
	}

	BLI_addhead(&cache->tiles, ttile);
	BLI_ghash_insert(cache->tilehash, ttile, ttile);

	gtile= imb_global_cache_get_tile(ibuf, tx, ty, replacetile);

	ttile->ibuf= gtile->ibuf;
	ttile->tx= gtile->tx;
	ttile->ty= gtile->ty;
	ttile->global= gtile;

	return ibuf->tiles[toffs];
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:50,代码来源:cache.c


示例3: ed_marker_duplicate_apply

/* duplicate selected TimeMarkers */
static void ed_marker_duplicate_apply(bContext *C, wmOperator *op)
{
	ListBase *markers= context_get_markers(C);
	TimeMarker *marker, *newmarker;
	
	if (markers == NULL) 
		return;

	/* go through the list of markers, duplicate selected markers and add duplicated copies
	 * to the begining of the list (unselect original markers) 
	 */
	for (marker= markers->first; marker; marker= marker->next) {
		if (marker->flag & SELECT) {
			/* unselect selected marker */
			marker->flag &= ~SELECT;
			
			/* create and set up new marker */
			newmarker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
			newmarker->flag= SELECT;
			newmarker->frame= marker->frame;
			BLI_strncpy(newmarker->name, marker->name, sizeof(marker->name));
			
			/* new marker is added to the begining of list */
			BLI_addhead(markers, newmarker);
		}
	}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:28,代码来源:anim_markers.c


示例4: group_linkobs2scene_cb

static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te),
                                   TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
	Group *group = (Group *)tselem->id;
	GroupObject *gob;
	Base *base;
	
	for (gob = group->gobject.first; gob; gob = gob->next) {
		base = BKE_scene_base_find(scene, gob->ob);
		if (base) {
			base->object->flag |= SELECT;
			base->flag |= SELECT;
		}
		else {
			/* link to scene */
			base = MEM_callocN(sizeof(Base), "add_base");
			BLI_addhead(&scene->base, base);
			base->lay = gob->ob->lay;
			gob->ob->flag |= SELECT;
			base->flag = gob->ob->flag;
			base->object = gob->ob;
			id_lib_extern((ID *)gob->ob); /* in case these are from a linked group */
		}
	}
}
开发者ID:244xiao,项目名称:blender,代码行数:25,代码来源:outliner_tools.c


示例5: ed_marker_duplicate_apply

/* duplicate selected TimeMarkers */
static void ed_marker_duplicate_apply(bContext *C)
{
	ListBase *markers = ED_context_get_markers(C);
	TimeMarker *marker, *newmarker;
	
	if (markers == NULL) 
		return;

	/* go through the list of markers, duplicate selected markers and add duplicated copies
	 * to the beginning of the list (unselect original markers)
	 */
	for (marker = markers->first; marker; marker = marker->next) {
		if (marker->flag & SELECT) {
			/* unselect selected marker */
			marker->flag &= ~SELECT;
			
			/* create and set up new marker */
			newmarker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
			newmarker->flag = SELECT;
			newmarker->frame = marker->frame;
			BLI_strncpy(newmarker->name, marker->name, sizeof(marker->name));
			
#ifdef DURIAN_CAMERA_SWITCH
			newmarker->camera = marker->camera;
#endif

			/* new marker is added to the beginning of list */
			// FIXME: bad ordering!
			BLI_addhead(markers, newmarker);
		}
	}
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:33,代码来源:anim_markers.c


示例6: wm_history_file_update

/**
 * Run after saving a file to refresh the #BLENDER_HISTORY_FILE list.
 */
static void wm_history_file_update(void)
{
	RecentFile *recent;

	/* no write history for recovered startup files */
	if (G.main->name[0] == 0)
		return;

	recent = G.recent_files.first;
	/* refresh recent-files.txt of recent opened files, when current file was changed */
	if (!(recent) || (BLI_path_cmp(recent->filepath, G.main->name) != 0)) {

		recent = wm_file_history_find(G.main->name);
		if (recent) {
			BLI_remlink(&G.recent_files, recent);
		}
		else {
			RecentFile *recent_next;
			for (recent = BLI_findlink(&G.recent_files, U.recent_files - 1); recent; recent = recent_next) {
				recent_next = recent->next;
				wm_history_file_free(recent);
			}
			recent = wm_history_file_new(G.main->name);
		}

		/* add current file to the beginning of list */
		BLI_addhead(&(G.recent_files), recent);

		/* write current file to recent-files.txt */
		wm_history_file_write();

		/* also update most recent files on System */
		GHOST_addToSystemRecentFiles(G.main->name);
	}
}
开发者ID:ChunHungLiu,项目名称:blender,代码行数:38,代码来源:wm_files.c


示例7: wm_keymap_addon_add

static void wm_keymap_addon_add(wmKeyMap *keymap, wmKeyMap *addonmap)
{
	wmKeyMapItem *kmi, *kmin;

	for(kmi=addonmap->items.first; kmi; kmi=kmi->next) {
		kmin = wm_keymap_item_copy(kmi);
		keymap_item_set_id(keymap, kmin);
		BLI_addhead(&keymap->items, kmin);
	}
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:10,代码来源:wm_keymap.c


示例8: MEM_callocN

Base *BKE_scene_base_add(Scene *sce, Object *ob)
{
	Base *b = MEM_callocN(sizeof(*b), "BKE_scene_base_add");
	BLI_addhead(&sce->base, b);

	b->object = ob;
	b->flag = ob->flag;
	b->lay = ob->lay;

	return b;
}
开发者ID:scorpion81,项目名称:blender-voro,代码行数:11,代码来源:scene.c


示例9: BKE_blender_user_menu_find

bUserMenu *BKE_blender_user_menu_ensure(ListBase *lb, char space_type, const char *context)
{
  bUserMenu *um = BKE_blender_user_menu_find(lb, space_type, context);
  if (um == NULL) {
    um = MEM_callocN(sizeof(bUserMenu), __func__);
    um->space_type = space_type;
    STRNCPY(um->context, context);
    BLI_addhead(lb, um);
  }
  return um;
}
开发者ID:dfelinto,项目名称:blender,代码行数:11,代码来源:blender_user_menu.c


示例10: BLF_dir_add

void BLF_dir_add(const char *path)
{
	DirBLF *dir;
	
	dir = blf_dir_find(path);
	if (dir) /* already in the list ? just return. */
		return;
	
	dir = (DirBLF *)MEM_callocN(sizeof(DirBLF), "BLF_dir_add");
	dir->path = BLI_strdup(path);
	BLI_addhead(&global_font_dir, dir);
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:12,代码来源:blf_dir.c


示例11: BKE_report

static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km,
                                         ReportList *reports,
                                         const char *idname,
                                         int type,
                                         int value,
                                         bool any,
                                         bool shift,
                                         bool ctrl,
                                         bool alt,
                                         bool oskey,
                                         int keymodifier,
                                         bool head)
{
  /*  wmWindowManager *wm = CTX_wm_manager(C); */
  wmKeyMapItem *kmi = NULL;
  char idname_bl[OP_MAX_TYPENAME];
  int modifier = 0;

  /* only on non-modal maps */
  if (km->flag & KEYMAP_MODAL) {
    BKE_report(reports, RPT_ERROR, "Not a non-modal keymap");
    return NULL;
  }

  WM_operator_bl_idname(idname_bl, idname);

  if (shift)
    modifier |= KM_SHIFT;
  if (ctrl)
    modifier |= KM_CTRL;
  if (alt)
    modifier |= KM_ALT;
  if (oskey)
    modifier |= KM_OSKEY;

  if (any)
    modifier = KM_ANY;

  /* create keymap item */
  kmi = WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier);

  /* [#32437] allow scripts to define hotkeys that get added to start of keymap
   *          so that they stand a chance against catch-all defines later on
   */
  if (head) {
    BLI_remlink(&km->items, kmi);
    BLI_addhead(&km->items, kmi);
  }

  return kmi;
}
开发者ID:dfelinto,项目名称:blender,代码行数:51,代码来源:rna_wm_api.c


示例12: task_scheduler_push

static void task_scheduler_push(TaskScheduler *scheduler, Task *task, TaskPriority priority)
{
	task_pool_num_increase(task->pool);

	/* add task to queue */
	BLI_mutex_lock(&scheduler->queue_mutex);

	if (priority == TASK_PRIORITY_HIGH)
		BLI_addhead(&scheduler->queue, task);
	else
		BLI_addtail(&scheduler->queue, task);

	BLI_condition_notify_one(&scheduler->queue_cond);
	BLI_mutex_unlock(&scheduler->queue_mutex);
}
开发者ID:LucaRood,项目名称:Blender,代码行数:15,代码来源:task.c


示例13: console_history_cycle_exec

/* the python exec operator uses this */
static int console_history_cycle_exec(bContext *C, wmOperator *op)
{
	SpaceConsole *sc = CTX_wm_space_console(C);
	ARegion *ar = CTX_wm_region(C);

	ConsoleLine *ci = console_history_verify(C); /* TODO - stupid, just prevents crashes when no command line */
	const bool reverse = RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */
	int prev_len = ci->len;

	/* keep a copy of the line above so when history is cycled
	 * this is the only function that needs to know about the double-up */
	if (ci->prev) {
		ConsoleLine *ci_prev = (ConsoleLine *)ci->prev;

		if (STREQ(ci->line, ci_prev->line))
			console_history_free(sc, ci_prev);
	}

	if (reverse) { /* last item in history */
		ci = sc->history.last;
		BLI_remlink(&sc->history, ci);
		BLI_addhead(&sc->history, ci);
	}
	else {
		ci = sc->history.first;
		BLI_remlink(&sc->history, ci);
		BLI_addtail(&sc->history, ci);
	}

	{   /* add a duplicate of the new arg and remove all other instances */
		ConsoleLine *cl;
		while ((cl = console_history_find(sc, ci->line, ci)))
			console_history_free(sc, cl);

		console_history_add(sc, (ConsoleLine *)sc->history.last);
	}
	
	ci = sc->history.last;
	console_select_offset(sc, ci->len - prev_len);

	/* could be wrapped so update scroll rect */
	console_textview_update_rect(sc, ar);
	ED_area_tag_redraw(CTX_wm_area(C));

	console_scroll_bottom(ar);

	return OPERATOR_FINISHED;
}
开发者ID:mistajuliax,项目名称:OctaneBlender,代码行数:49,代码来源:console_ops.c


示例14: memset

/* Create a new glyph cache for the current size and dpi. */
GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
{
	GlyphCacheBLF *gc;

	gc = (GlyphCacheBLF *)MEM_callocN(sizeof(GlyphCacheBLF), "blf_glyph_cache_new");
	gc->next = NULL;
	gc->prev = NULL;
	gc->size = font->size;
	gc->dpi = font->dpi;

	memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table));
	memset(gc->bucket, 0, sizeof(gc->bucket));

	gc->textures = (GLuint *)MEM_mallocN(sizeof(GLuint) * 256, __func__);
	gc->ntex = 256;
	gc->cur_tex = BLF_CURTEX_UNSET;
	gc->x_offs = 0;
	gc->y_offs = 0;
	gc->pad = 3;

	gc->num_glyphs = (int)font->face->num_glyphs;
	gc->rem_glyphs = (int)font->face->num_glyphs;
	gc->ascender = ((float)font->face->size->metrics.ascender) / 64.0f;
	gc->descender = ((float)font->face->size->metrics.descender) / 64.0f;

	if (FT_IS_SCALABLE(font->face)) {
		gc->max_glyph_width = (int)((float)(font->face->bbox.xMax - font->face->bbox.xMin) *
		                            (((float)font->face->size->metrics.x_ppem) /
		                             ((float)font->face->units_per_EM)));

		gc->max_glyph_height = (int)((float)(font->face->bbox.yMax - font->face->bbox.yMin) *
		                             (((float)font->face->size->metrics.y_ppem) /
		                              ((float)font->face->units_per_EM)));
	}
	else {
		gc->max_glyph_width = (int)(((float)font->face->size->metrics.max_advance) / 64.0f);
		gc->max_glyph_height = (int)(((float)font->face->size->metrics.height) / 64.0f);
	}

	gc->p2_width = 0;
	gc->p2_height = 0;

	BLI_addhead(&font->cache, gc);
	return gc;
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:46,代码来源:blf_glyph.c


示例15: BLI_mempool_alloc

/**
 * \brief Add a new Walker State
 *
 * Allocate a new empty state and put it on the worklist.
 * A pointer to the new state is returned so that the caller
 * can fill in the state data. The new state will be inserted
 * at the front for depth-first walks, and at the end for
 * breadth-first walks.
 */
void *BMW_state_add(BMWalker *walker)
{
	BMwGenericWalker *newstate;
	newstate = BLI_mempool_alloc(walker->worklist);
	newstate->depth = walker->depth;
	switch (walker->order) {
		case BMW_DEPTH_FIRST:
			BLI_addhead(&walker->states, newstate);
			break;
		case BMW_BREADTH_FIRST:
			BLI_addtail(&walker->states, newstate);
			break;
		default:
			BLI_assert(0);
			break;
	}
	return newstate;
}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:27,代码来源:bmesh_walkers.c


示例16: writeBlog

static void writeBlog(void)
{
	struct RecentFile *recent, *next_recent;
	char name[FILE_MAXDIR+FILE_MAXFILE];
	FILE *fp;
	int i;

	BLI_make_file_string("/", name, BLI_gethome(), ".Blog");

	recent = G.recent_files.first;
	/* refresh .Blog of recent opened files, when current file was changed */
	if(!(recent) || (strcmp(recent->filename, G.sce)!=0)) {
		fp= fopen(name, "w");
		if (fp) {
			/* add current file to the beginning of list */
			recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
			recent->filename = (char*)MEM_mallocN(sizeof(char)*(strlen(G.sce)+1), "name of file");
			recent->filename[0] = '\0';
			strcpy(recent->filename, G.sce);
			BLI_addhead(&(G.recent_files), recent);
			/* write current file to .Blog */
			fprintf(fp, "%s\n", recent->filename);
			recent = recent->next;
			i=1;
			/* write rest of recent opened files to .Blog */
			while((i<U.recent_files) && (recent)){
				/* this prevents to have duplicities in list */
				if (strcmp(recent->filename, G.sce)!=0) {
					fprintf(fp, "%s\n", recent->filename);
					recent = recent->next;
				}
				else {
					next_recent = recent->next;
					MEM_freeN(recent->filename);
					BLI_freelinkN(&(G.recent_files), recent);
					recent = next_recent;
				}
				i++;
			}
			fclose(fp);
		}
	}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:43,代码来源:wm_files.c


示例17: copy_object

static Object *AddNewBlenderMesh(Scene *scene, Base *base)
{
	// This little function adds a new mesh object to the blender object list
	// It uses ob to duplicate data as this seems to be easier than creating
	// a new one. This new oject contains no faces nor vertices.
	Mesh *old_me;
	Base *basen;
	Object *ob_new;

	// now create a new blender object.
	// duplicating all the settings from the previous object
	// to the new one.
	ob_new= copy_object(base->object);

	// Ok we don't want to use the actual data from the
	// last object, the above function incremented the 
	// number of users, so decrement it here.
	old_me= ob_new->data;
	old_me->id.us--;

	// Now create a new base to add into the linked list of 
	// vase objects.
	
	basen= MEM_mallocN(sizeof(Base), "duplibase");
	*basen= *base;
	BLI_addhead(&scene->base, basen);	/* addhead: anders oneindige lus */
	basen->object= ob_new;
	basen->flag &= ~SELECT;
				
	// Initialize the mesh data associated with this object.						
	ob_new->data= add_mesh("Mesh");

	// Finally assign the object type.
	ob_new->type= OB_MESH;

	return ob_new;
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:37,代码来源:MOD_boolean_util.c


示例18: copy_particle_dupliob_exec

static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
{
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
	ParticleSystem *psys= ptr.data;
	ParticleSettings *part;
	ParticleDupliWeight *dw;

	if (!psys)
		return OPERATOR_CANCELLED;
	part = psys->part;
	for (dw=part->dupliweights.first; dw; dw=dw->next) {
		if (dw->flag & PART_DUPLIW_CURRENT) {
			dw->flag &= ~PART_DUPLIW_CURRENT;
			dw = MEM_dupallocN(dw);
			dw->flag |= PART_DUPLIW_CURRENT;
			BLI_addhead(&part->dupliweights, dw);

			WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
			break;
		}
	}
	
	return OPERATOR_FINISHED;
}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:24,代码来源:particle_object.c


示例19: blf_glyph_search

GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
{
	FT_GlyphSlot slot;
	GlyphBLF *g;
	FT_Error err;
	FT_Bitmap bitmap, tempbitmap;
	const bool is_sharp = (U.text_render & USER_TEXT_DISABLE_AA) != 0;
	int flags = FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP;
	FT_BBox bbox;
	unsigned int key;

	g = blf_glyph_search(font->glyph_cache, c);
	if (g)
		return g;

	/* glyphs are dynamically created as needed by font rendering. this means that
	 * to make font rendering thread safe we have to do locking here. note that this
	 * must be a lock for the whole library and not just per font, because the font
	 * renderer uses a shared buffer internally */
	BLI_spin_lock(font->ft_lib_mutex);

	/* search again after locking */
	g = blf_glyph_search(font->glyph_cache, c);
	if (g) {
		BLI_spin_unlock(font->ft_lib_mutex);
		return g;
	}

	if (font->flags & BLF_HINTING)
		flags &= ~FT_LOAD_NO_HINTING;
	
	if (is_sharp)
		err = FT_Load_Glyph(font->face, (FT_UInt)index, FT_LOAD_TARGET_MONO);
	else
		err = FT_Load_Glyph(font->face, (FT_UInt)index, flags);  

	if (err) {
		BLI_spin_unlock(font->ft_lib_mutex);
		return NULL;
	}

	/* get the glyph. */
	slot = font->face->glyph;

	if (is_sharp) {
		err = FT_Render_Glyph(slot, FT_RENDER_MODE_MONO);

		/* Convert result from 1 bit per pixel to 8 bit per pixel */
		/* Accum errors for later, fine if not interested beyond "ok vs any error" */
		FT_Bitmap_New(&tempbitmap);
		err += FT_Bitmap_Convert(font->ft_lib, &slot->bitmap, &tempbitmap, 1); /* Does Blender use Pitch 1 always? It works so far */
		err += FT_Bitmap_Copy(font->ft_lib, &tempbitmap, &slot->bitmap);
		err += FT_Bitmap_Done(font->ft_lib, &tempbitmap);
	}
	else {
		err = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL);
	}

	if (err || slot->format != FT_GLYPH_FORMAT_BITMAP) {
		BLI_spin_unlock(font->ft_lib_mutex);
		return NULL;
	}

	g = (GlyphBLF *)MEM_callocN(sizeof(GlyphBLF), "blf_glyph_add");
	g->c = c;
	g->idx = (FT_UInt)index;
	g->xoff = -1;
	g->yoff = -1;
	bitmap = slot->bitmap;
	g->width = (int)bitmap.width;
	g->height = (int)bitmap.rows;

	if (g->width && g->height) {
		if (is_sharp) {
			/* Font buffer uses only 0 or 1 values, Blender expects full 0..255 range */
			int i;
			for (i = 0; i < (g->width * g->height); i++) {
				bitmap.buffer[i] = bitmap.buffer[i] ? 255 : 0;
			}
		}

		g->bitmap = (unsigned char *)MEM_mallocN((size_t)(g->width * g->height), "glyph bitmap");
		memcpy((void *)g->bitmap, (void *)bitmap.buffer, (size_t)(g->width * g->height));
	}

	g->advance = ((float)slot->advance.x) / 64.0f;
	g->advance_i = (int)g->advance;
	g->pos_x = (float)slot->bitmap_left;
	g->pos_y = (float)slot->bitmap_top;
	g->pitch = slot->bitmap.pitch;

	FT_Outline_Get_CBox(&(slot->outline), &bbox);
	g->box.xmin = ((float)bbox.xMin) / 64.0f;
	g->box.xmax = ((float)bbox.xMax) / 64.0f;
	g->box.ymin = ((float)bbox.yMin) / 64.0f;
	g->box.ymax = ((float)bbox.yMax) / 64.0f;

	key = blf_hash(g->c);
	BLI_addhead(&(font->glyph_cache->bucket[key]), g);

//.........这里部分代码省略.........
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:101,代码来源:blf_glyph.c


示例20: bli_builddir

static void bli_builddir(const char *dirname, const char *relname)
{
	struct dirent *fname;
	struct dirlink *dlink;
	int rellen, newnum = 0;
	char buf[256];
	DIR *dir;

	BLI_strncpy(buf, relname, sizeof(buf));
	rellen=strlen(relname);

	if (rellen) {
		buf[rellen]='/';
		rellen++;
	}
#ifndef WIN32
	if (chdir(dirname) == -1) {
		perror(dirname);
		return;
	}
#else
	UTF16_ENCODE(dirname);
	if (!SetCurrentDirectoryW(dirname_16)) {
		perror(dirname);
		free(dirname_16);
		return;
	}
	UTF16_UN_ENCODE(dirname);

#endif
	if ((dir = (DIR *)opendir("."))) {
		while ((fname = (struct dirent*) readdir(dir)) != NULL) {
			dlink = (struct dirlink *)malloc(sizeof(struct dirlink));
			if (dlink) {
				BLI_strncpy(buf + rellen, fname->d_name, sizeof(buf) - rellen);
				dlink->name = BLI_strdup(buf);
				BLI_addhead(dirbase, dlink);
				newnum++;
			}
		}
		
		if (newnum) {

			if (files) {
				void *tmp = realloc(files, (totnum+newnum) * sizeof(struct direntry));
				if (tmp) {
					files = (struct direntry *)tmp;
				}
				else { /* realloc fail */
					free(files);
					files = NULL;
				}
			}
			
			if (files==NULL)
				files=(struct direntry *)malloc(newnum * sizeof(struct direntry));

			if (files) {
				dlink = (struct dirlink *) dirbase->first;
				while (dlink) {
					memset(&files[actnum], 0, sizeof(struct direntry));
					files[actnum].relname = dlink->name;
					files[actnum].path = BLI_strdupcat(dirname, dlink->name);
// use 64 bit file size, only needed for WIN32 and WIN64. 
// Excluding other than current MSVC compiler until able to test
#ifdef WIN32
					{wchar_t * name_16 = alloc_utf16_from_8(dlink->name, 0);
#if (defined(WIN32) || defined(WIN64)) && (_MSC_VER>=1500)
					_wstat64(name_16, &files[actnum].s);
#elif defined(__MINGW32__)
					_stati64(dlink->name, &files[actnum].s);
#endif
					free(name_16);};

#else
					stat(dlink->name, &files[actnum].s);
#endif
					files[actnum].type=files[actnum].s.st_mode;
					files[actnum].flags = 0;
					totnum++;
					actnum++;
					dlink = dlink->next;
				}
			}
			else {
				printf("Couldn't get memory for dir\n");
				exit(1);
			}

			BLI_freelist(dirbase);
			if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *, const void*))bli_compare);
		}
		else {
			printf("%s empty directory\n", dirname);
		}

		closedir(dir);
	}
	else {
		printf("%s non-existant directory\n", dirname);
//.........这里部分代码省略.........
开发者ID:nttputus,项目名称:blensor,代码行数:101,代码来源:storage.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BLI_addtail函数代码示例发布时间:2022-05-30
下一篇:
C++ BLE_UUID_BLE_ASSIGN函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap