當前位置: 首頁>>代碼示例>>C++>>正文


C++ BLI_freelinkN函數代碼示例

本文整理匯總了C++中BLI_freelinkN函數的典型用法代碼示例。如果您正苦於以下問題:C++ BLI_freelinkN函數的具體用法?C++ BLI_freelinkN怎麽用?C++ BLI_freelinkN使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了BLI_freelinkN函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: poselib_remove_exec

static int poselib_remove_exec(bContext *C, wmOperator *op)
{
	Object *ob = get_poselib_object(C);
	bAction *act = (ob) ? ob->poselib : NULL;
	TimeMarker *marker;
	int marker_index;
	FCurve *fcu;
	PropertyRNA *prop;

	/* check if valid poselib */
	if (act == NULL) {
		BKE_report(op->reports, RPT_ERROR, "Object does not have pose lib data");
		return OPERATOR_CANCELLED;
	}

	prop = RNA_struct_find_property(op->ptr, "pose");
	if (RNA_property_is_set(op->ptr, prop)) {
		marker_index = RNA_property_enum_get(op->ptr, prop);
	}
	else {
		marker_index = act->active_marker - 1;
	}

	/* get index (and pointer) of pose to remove */
	marker = BLI_findlink(&act->markers, marker_index);
	if (marker == NULL) {
		BKE_reportf(op->reports, RPT_ERROR, "Invalid pose specified %d", marker_index);
		return OPERATOR_CANCELLED;
	}
	
	/* remove relevant keyframes */
	for (fcu = act->curves.first; fcu; fcu = fcu->next) {
		BezTriple *bezt;
		unsigned int i;
		
		if (fcu->bezt) {
			for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
				/* check if remove */
				if (IS_EQF(bezt->vec[1][0], (float)marker->frame)) {
					delete_fcurve_key(fcu, i, 1);
					break;
				}
			}
		}
	}
	
	/* remove poselib from list */
	BLI_freelinkN(&act->markers, marker);
	
	/* fix active pose number */
	act->active_marker = 0;
	
	/* send notifiers for this - using keyframe editing notifiers, since action 
	 * may be being shown in anim editors as active action 
	 */
	WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
	
	/* done */
	return OPERATOR_FINISHED;
}
開發者ID:castlelore,項目名稱:blender-git,代碼行數:60,代碼來源:pose_lib.c

示例2: free_anim_copybuf

// XXX find some header to put this in!
void free_anim_copybuf (void)
{
	tAnimCopybufItem *aci, *acn;
	
	/* free each buffer element */
	for (aci= animcopybuf.first; aci; aci= acn) {
		acn= aci->next;
		
		/* free keyframes */
		if (aci->bezt) 
			MEM_freeN(aci->bezt);
			
		/* free RNA-path */
		if (aci->rna_path)
			MEM_freeN(aci->rna_path);
			
		/* free ourself */
		BLI_freelinkN(&animcopybuf, aci);
	}
	
	/* restore initial state */
	animcopybuf.first= animcopybuf.last= NULL;
	animcopy_firstframe= 999999999.0f;
	animcopy_lastframe= -999999999.0f;
}
開發者ID:rexbron,項目名稱:blender-ocio,代碼行數:26,代碼來源:keyframes_general.c

示例3: clip_delete_track

void clip_delete_track(bContext *C, MovieClip *clip, MovieTrackingTrack *track)
{
	MovieTracking *tracking= &clip->tracking;
	MovieTrackingStabilization *stab= &tracking->stabilization;

	int has_bundle= 0, update_stab= 0;

	if(track==tracking->act_track)
		tracking->act_track= NULL;

	if(track==stab->rot_track) {
		stab->rot_track= NULL;

		update_stab= 1;
	}

	/* handle reconstruction display in 3d viewport */
	if(track->flag&TRACK_HAS_BUNDLE)
		has_bundle= 1;

	BKE_tracking_free_track(track);
	BLI_freelinkN(&tracking->tracks, track);

	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);

	if(update_stab) {
		tracking->stabilization.ok= 0;

		DAG_id_tag_update(&clip->id, 0);
		WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
	}

	if(has_bundle)
		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
}
開發者ID:mik0001,項目名稱:Blender,代碼行數:35,代碼來源:clip_utils.c

示例4: splineik_execute_tree

/* Evaluate the chain starting from the nominated bone */
static void splineik_execute_tree(Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime)
{
	tSplineIK_Tree *tree;

	/* for each pose-tree, execute it if it is spline, otherwise just free it */
	while ((tree = pchan_root->siktree.first) != NULL) {
		int i;

		/* walk over each bone in the chain, calculating the effects of spline IK
		 *     - the chain is traversed in the opposite order to storage order (i.e. parent to children)
		 *       so that dependencies are correct
		 */
		for (i = tree->chainlen - 1; i >= 0; i--) {
			bPoseChannel *pchan = tree->chain[i];
			splineik_evaluate_bone(tree, scene, ob, pchan, i, ctime);
		}

		/* free the tree info specific to SplineIK trees now */
		if (tree->chain)
			MEM_freeN(tree->chain);
		if (tree->free_points)
			MEM_freeN(tree->points);

		/* free this tree */
		BLI_freelinkN(&pchan_root->siktree, tree);
	}
}
開發者ID:Andrewson3D,項目名稱:blender-for-vray,代碼行數:28,代碼來源:armature_update.c

示例5: remove_active_keyingset_exec

static int remove_active_keyingset_exec (bContext *C, wmOperator *op)
{
	Scene *scene= CTX_data_scene(C);
	KeyingSet *ks;
	
	/* verify the Keying Set to use:
	 *	- use the active one
	 *	- return error if it doesn't exist
	 */
	if (scene->active_keyingset == 0) {
		BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove");
		return OPERATOR_CANCELLED;
	}
	else
		ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
	
	/* free KeyingSet's data, then remove it from the scene */
	BKE_keyingset_free(ks);
	BLI_freelinkN(&scene->keyingsets, ks);
	
	/* the active one should now be the previously second-to-last one */
	scene->active_keyingset--;
	
	/* send notifiers */
	WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
	
	return OPERATOR_FINISHED;
}
開發者ID:jinjoh,項目名稱:NOOR,代碼行數:28,代碼來源:keyingsets.c

示例6: undo_stack_push_end

static void undo_stack_push_end(UndoStack *stack)
{
	UndoElem *uel;
	uintptr_t totmem, maxmem;

	if(U.undomemory != 0) {
		/* limit to maximum memory (afterwards, we can't know in advance) */
		totmem= 0;
		maxmem= ((uintptr_t)U.undomemory)*1024*1024;

		uel= stack->elems.last;
		while(uel) {
			totmem+= uel->undosize;
			if(totmem>maxmem) break;
			uel= uel->prev;
		}

		if(uel) {
			while(stack->elems.first!=uel) {
				UndoElem *first= stack->elems.first;
				undo_elem_free(stack, first);
				BLI_freelinkN(&stack->elems, first);
			}
		}
	}
}
開發者ID:BHCLL,項目名稱:blendocv,代碼行數:26,代碼來源:paint_undo.c

示例7: BKE_pose_remove_group

/* Remove the active bone-group */
void BKE_pose_remove_group(Object *ob)
{
	bPose *pose = (ob) ? ob->pose : NULL;
	bActionGroup *grp = NULL;
	bPoseChannel *pchan;
	
	/* sanity checks */
	if (ELEM(NULL, ob, pose))
		return;
	if (pose->active_group <= 0)
		return;
	
	/* get group to remove */
	grp = BLI_findlink(&pose->agroups, pose->active_group - 1);
	if (grp) {
		/* adjust group references (the trouble of using indices!):
		 *	- firstly, make sure nothing references it 
		 *	- also, make sure that those after this item get corrected
		 */
		for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
			if (pchan->agrp_index == pose->active_group)
				pchan->agrp_index = 0;
			else if (pchan->agrp_index > pose->active_group)
				pchan->agrp_index--;
		}
		
		/* now, remove it from the pose */
		BLI_freelinkN(&pose->agroups, grp);
		pose->active_group--;
		if (pose->active_group < 0 || pose->agroups.first == NULL) {
			pose->active_group = 0;
		}
	}
}
開發者ID:diosney,項目名稱:blender,代碼行數:35,代碼來源:action.c

示例8: remove_active_ks_path_exec

static int remove_active_ks_path_exec (bContext *C, wmOperator *op)
{
	Scene *scene= CTX_data_scene(C);
	KeyingSet *ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
	
	/* if there is a KeyingSet, find the nominated path to remove */
	if (ks) {
		KS_Path *ksp= BLI_findlink(&ks->paths, ks->active_path-1);
		
		if (ksp) {
			/* NOTE: sync this code with BKE_keyingset_free() */
			{
				/* free RNA-path info */
				MEM_freeN(ksp->rna_path);
				
				/* free path itself */
				BLI_freelinkN(&ks->paths, ksp);
			}
			
			/* the active path should now be the previously second-to-last active one */
			ks->active_path--;
		}
		else {
			BKE_report(op->reports, RPT_ERROR, "No active Keying Set Path to remove");
			return OPERATOR_CANCELLED;
		}
	}
	else {
		BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove a path from");
		return OPERATOR_CANCELLED;
	}
	
	return OPERATOR_FINISHED;
}
開發者ID:jinjoh,項目名稱:NOOR,代碼行數:34,代碼來源:keyingsets.c

示例9: ANIM_fcurves_copybuf_free

/* This function frees any MEM_calloc'ed copy/paste buffer data */
void ANIM_fcurves_copybuf_free(void)
{
	tAnimCopybufItem *aci, *acn;
	
	/* free each buffer element */
	for (aci = animcopybuf.first; aci; aci = acn) {
		acn = aci->next;
		
		/* free keyframes */
		if (aci->bezt) 
			MEM_freeN(aci->bezt);
			
		/* free RNA-path */
		if (aci->rna_path)
			MEM_freeN(aci->rna_path);
			
		/* free ourself */
		BLI_freelinkN(&animcopybuf, aci);
	}
	
	/* restore initial state */
	BLI_listbase_clear(&animcopybuf);
	animcopy_firstframe = 999999999.0f;
	animcopy_lastframe = -999999999.0f;
}
開發者ID:DarkDefender,項目名稱:blender-npr-tess2,代碼行數:26,代碼來源:keyframes_general.c

示例10: BLI_replaceNode

void BLI_replaceNode(BGraph *graph, BNode *node_src, BNode *node_replaced)
{
	BArc *arc, *next_arc;
	
	for (arc = graph->arcs.first; arc; arc = next_arc) {
		next_arc = arc->next;
		
		if (arc->head == node_replaced) {
			arc->head = node_src;
			node_replaced->degree--;
			node_src->degree++;
		}

		if (arc->tail == node_replaced) {
			arc->tail = node_src;
			node_replaced->degree--;
			node_src->degree++;
		}
		
		if (arc->head == arc->tail) {
			node_src->degree -= 2;
			
			graph->free_arc(arc);
			BLI_freelinkN(&graph->arcs, arc);
		}
	}
	
	if (node_replaced->degree == 0) {
		BLI_removeNode(graph, node_replaced);
	}
}
開發者ID:DarkDefender,項目名稱:blender-npr-tess2,代碼行數:31,代碼來源:graph.c

示例11: ANIM_keyingset_info_unregister

/* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */
void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
{
	KeyingSet *ks, *ksn;
	
	/* find relevant builtin KeyingSets which use this, and remove them */
	// TODO: this isn't done now, since unregister is really only used atm when we
	// reload the scripts, which kindof defeats the purpose of "builtin"?
	for (ks= builtin_keyingsets.first; ks; ks= ksn) {
		ksn = ks->next;
		
		/* remove if matching typeinfo name */
		if (strcmp(ks->typeinfo, ksi->idname) == 0) {
			Scene *scene;
			BKE_keyingset_free(ks);
			BLI_remlink(&builtin_keyingsets, ks);

			for(scene= bmain->scene.first; scene; scene= scene->id.next)
				BLI_remlink_safe(&scene->keyingsets, ks);

			MEM_freeN(ks);
		}
	}
	
	/* free the type info */
	BLI_freelinkN(&keyingset_type_infos, ksi);
}
開發者ID:BHCLL,項目名稱:blendocv,代碼行數:27,代碼來源:keyingsets.c

示例12: BKE_pose_remove_group

/* Remove the given bone-group (expects 'virtual' index (+1 one, used by active_group etc.))
 * index might be invalid ( < 1), in which case it will be find from grp. */
void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index)
{
	bPoseChannel *pchan;
	int idx = index;
	
	if (idx < 1) {
		idx = BLI_findindex(&pose->agroups, grp) + 1;
	}
	
	BLI_assert(idx > 0);
	
	/* adjust group references (the trouble of using indices!):
	 *  - firstly, make sure nothing references it
	 *  - also, make sure that those after this item get corrected
	 */
	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
		if (pchan->agrp_index == idx)
			pchan->agrp_index = 0;
		else if (pchan->agrp_index > idx)
			pchan->agrp_index--;
	}

	/* now, remove it from the pose */
	BLI_freelinkN(&pose->agroups, grp);
	if (pose->active_group >= idx) {
		pose->active_group--;
		if (pose->active_group < 0 || BLI_listbase_is_empty(&pose->agroups)) {
			pose->active_group = 0;
		}
	}
}
開發者ID:SuriyaaKudoIsc,項目名稱:blender-git,代碼行數:33,代碼來源:action.c

示例13: task_scheduler_clear

static void task_scheduler_clear(TaskScheduler *scheduler, TaskPool *pool)
{
	Task *task, *nexttask;
	size_t done = 0;

	BLI_mutex_lock(&scheduler->queue_mutex);

	/* free all tasks from this pool from the queue */
	for (task = scheduler->queue.first; task; task = nexttask) {
		nexttask = task->next;

		if (task->pool == pool) {
			if (task->free_taskdata)
				MEM_freeN(task->taskdata);
			BLI_freelinkN(&scheduler->queue, task);

			done++;
		}
	}

	BLI_mutex_unlock(&scheduler->queue_mutex);

	/* notify done */
	task_pool_num_decrease(pool, done);
}
開發者ID:flair2005,項目名稱:mechanical-blender,代碼行數:25,代碼來源:task.c

示例14: BLI_removeArc

void BLI_removeArc(BGraph *graph, BArc *arc)
{
	if (graph->free_arc) {
		graph->free_arc(arc);
	}

	BLI_freelinkN(&graph->arcs, arc);
}
開發者ID:nttputus,項目名稱:blensor,代碼行數:8,代碼來源:graph.c

示例15: remove_keyingset_button_exec

static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
{
	Scene *scene= CTX_data_scene(C);
	KeyingSet *ks = NULL;
	PropertyRNA *prop= NULL;
	PointerRNA ptr;
	char *path = NULL;
	short success= 0;
	int index=0;
	
	/* verify the Keying Set to use:
	 *	- use the active one for now (more control over this can be added later)
	 *	- return error if it doesn't exist
	 */
	if (scene->active_keyingset == 0) {
		BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove property from");
		return OPERATOR_CANCELLED;
	}
	else
		ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
	
	/* try to add to keyingset using property retrieved from UI */
	memset(&ptr, 0, sizeof(PointerRNA));
	uiAnimContextProperty(C, &ptr, &prop, &index);

	if (ptr.data && prop) {
		path= RNA_path_from_ID_to_property(&ptr, prop);
		
		if (path) {
			KS_Path *ksp;
			
			/* try to find a path matching this description */
			ksp= BKE_keyingset_find_destination(ks, ptr.id.data, ks->name, path, index, KSP_GROUP_KSNAME);
			
			if (ksp) {
				/* just free it... */
				MEM_freeN(ksp->rna_path);
				BLI_freelinkN(&ks->paths, ksp);
				
				success= 1;
			}
			
			/* free temp path used */
			MEM_freeN(path);
		}
	}
	
	
	if (success) {
		/* send updates */
		ED_anim_dag_flush_update(C);	
		
		/* for now, only send ND_KEYS for KeyingSets */
		WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
	}
	
	return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
開發者ID:jinjoh,項目名稱:NOOR,代碼行數:58,代碼來源:keyingsets.c


注:本文中的BLI_freelinkN函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。