Ejemplo n.º 1
0
static void scene_update_all_bases(EvaluationContext *eval_ctx, Scene *scene, Scene *scene_parent)
{
	Base *base;

	for (base = scene->base.first; base; base = base->next) {
		Object *object = base->object;

		BKE_object_handle_update_ex(eval_ctx, scene_parent, object, scene->rigidbody_world);

		if (object->dup_group && (object->transflag & OB_DUPLIGROUP))
			BKE_group_handle_recalc_and_update(eval_ctx, scene_parent, object, object->dup_group);

		/* always update layer, so that animating layers works (joshua july 2010) */
		/* XXX commented out, this has depsgraph issues anyway - and this breaks setting scenes
		 * (on scene-set, the base-lay is copied to ob-lay (ton nov 2012) */
		// base->lay = ob->lay;
	}
}
Ejemplo n.º 2
0
static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent)
{
	Base *base;
	
	scene->customdata_mask = scene_parent->customdata_mask;

	/* sets first, we allow per definition current scene to have
	 * dependencies on sets, but not the other way around. */
	if (scene->set)
		scene_update_tagged_recursive(bmain, scene->set, scene_parent);
	
	/* scene objects */
	for (base = scene->base.first; base; base = base->next) {
		Object *ob = base->object;
		
		BKE_object_handle_update_ex(scene_parent, ob, scene->rigidbody_world);
		
		if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
			BKE_group_handle_recalc_and_update(scene_parent, ob, ob->dup_group);
			
		/* always update layer, so that animating layers works (joshua july 2010) */
		/* XXX commented out, this has depsgraph issues anyway - and this breaks setting scenes
		 * (on scene-set, the base-lay is copied to ob-lay (ton nov 2012) */
		// base->lay = ob->lay;
	}
	
	/* scene drivers... */
	scene_update_drivers(bmain, scene);

	/* update sound system animation */
	sound_update_scene(scene);

	/* update masking curves */
	BKE_mask_update_scene(bmain, scene);
	
}
Ejemplo n.º 3
0
static void scene_update_object_func(TaskPool *pool, void *taskdata, int threadid)
{
/* Disable print for now in favor of summary statistics at the end of update. */
#define PRINT if (false) printf

	ThreadedObjectUpdateState *state = (ThreadedObjectUpdateState *) BLI_task_pool_userdata(pool);
	void *node = taskdata;
	Object *object = DAG_get_node_object(node);
	EvaluationContext *eval_ctx = state->eval_ctx;
	Scene *scene = state->scene;
	Scene *scene_parent = state->scene_parent;

#ifdef MBALL_SINGLETHREAD_HACK
	if (object && object->type == OB_MBALL) {
		state->has_mballs = true;
	}
	else
#endif
	if (object) {
		double start_time = 0.0;
		bool add_to_stats = false;

		PRINT("Thread %d: update object %s\n", threadid, object->id.name);

		if (G.debug & G_DEBUG) {
			start_time = PIL_check_seconds_timer();

			if (object->recalc & OB_RECALC_ALL) {
				state->has_updated_objects = true;
				add_to_stats = true;
			}
		}

		/* We only update object itself here, dupli-group will be updated
		 * separately from main thread because of we've got no idea about
		 * dependnecies inside the group.
		 */
		BKE_object_handle_update_ex(eval_ctx, scene_parent, object, scene->rigidbody_world);

		/* Calculate statistics. */
		if (add_to_stats) {
			StatisicsEntry *entry;

			entry = MEM_mallocN(sizeof(StatisicsEntry), "update thread statistics");
			entry->object = object;
			entry->start_time = start_time;
			entry->duration = PIL_check_seconds_timer() - start_time;

			BLI_addtail(&state->statistics[threadid], entry);
		}
	}
	else {
		PRINT("Threda %d: update node %s\n", threadid,
		      DAG_get_node_name(node));
	}

	/* Update will decrease child's valency and schedule child with zero valency. */
	DAG_threaded_update_handle_node_updated(node,scene_update_object_add_task, pool);

#undef PRINT
}