﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ASource%2FPhysics%2FUnified_Dynamics_Baking</id>
	<title>Dev:Source/Physics/Unified Dynamics Baking - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ASource%2FPhysics%2FUnified_Dynamics_Baking"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Physics/Unified_Dynamics_Baking&amp;action=history"/>
	<updated>2026-05-14T09:12:58Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Source/Physics/Unified_Dynamics_Baking&amp;diff=55554&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Physics/Unified_Dynamics_Baking&amp;diff=55554&amp;oldid=prev"/>
		<updated>2018-06-28T17:52:00Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 17:52時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Source/Physics/Unified_Dynamics_Baking&amp;diff=55553&amp;oldid=prev</id>
		<title>2010年4月3日 (土) 13:05にwiki&gt;Terrywallworkによる</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Physics/Unified_Dynamics_Baking&amp;diff=55553&amp;oldid=prev"/>
		<updated>2010-04-03T13:05:51Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==General ideas==&lt;br /&gt;
*adding a dynamic system to an object also adds BakeableSystem entry to a new list of bakeable systems in the object&lt;br /&gt;
**the BakeableSystem struct allows unified handling of all bakeable systems&lt;br /&gt;
**the struct will also store the baking with a DynamicsKey struct that will hold the data points for all systems, possibly with added custom variables&lt;br /&gt;
&lt;br /&gt;
*all wanted dynamic systems can be baked in a single run through the wanted time span&lt;br /&gt;
**systems can be manually set &amp;quot;to bake&amp;quot; and when baking is started by the user all of these systems are baked&lt;br /&gt;
**systems that need an autobake (atleast particles) are baked if the systems want it when asked after updating recalc flags through the depsgraph..&lt;br /&gt;
&lt;br /&gt;
*a unified &amp;quot;bake edit mode&amp;quot; will allow editing of all baked dynamics&lt;br /&gt;
**allthough unified, the edit mode may have differing functionality depending on system sype&lt;br /&gt;
**in case of a &amp;quot;bad bake&amp;quot; the bake can be edited at a certain frame and then rebaked starting from that frame and at the same time preserve the bake before that frame&lt;br /&gt;
&lt;br /&gt;
*editing of object's data and settings of modifiers before the baked system will be locked after the bake&lt;br /&gt;
**this is nescessary since the baked system can't react to changes mesh structure etc..&lt;br /&gt;
**alternatively atleast a warning of &amp;quot;losing bake&amp;quot; should be issued before modifications are allowed&lt;br /&gt;
&lt;br /&gt;
*baking can be done with non-integer steps&lt;br /&gt;
**all dynamic systems get current time with bsystem_time(...)&lt;br /&gt;
**a new &amp;quot;bakeoffs&amp;quot; variable will be set by the baking system, similar to the &amp;quot;bluroffs&amp;quot; and &amp;quot;fieldoffs&amp;quot; that are currently in use&lt;br /&gt;
&lt;br /&gt;
*unified baking is controlled from the outliner&lt;br /&gt;
**&amp;quot;bakeable systems&amp;quot; option for the outliner display to display only bakeable systems&lt;br /&gt;
**each system can be separately flagged &amp;quot;to bake&amp;quot;&lt;br /&gt;
**baked systems display info on the bake (memory usage etc.)&lt;br /&gt;
**option to free a system's bake&lt;br /&gt;
**a &amp;quot;BAKE&amp;quot; button and start/end frame settings to begin unified baking&lt;br /&gt;
&lt;br /&gt;
*baking should also be available from the commandline like Tony Mullen suggested&lt;br /&gt;
**a command line option to start unified baking with set systems&lt;br /&gt;
**save blend after baking is complete&lt;br /&gt;
&lt;br /&gt;
==BakeableSystem sructure==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
typedef struct BakeableSystem{&lt;br /&gt;
	Object *ob;&lt;br /&gt;
	void *system;&lt;br /&gt;
	DynamicsKey **keys;	/* baked keys for each entity */&lt;br /&gt;
	int *totkey;		/* array of amount of keys for each entity */&lt;br /&gt;
	int totentity;		/* amount of bakeable entities */&lt;br /&gt;
	short type, recalc_flag, flag;&lt;br /&gt;
	&lt;br /&gt;
	/* starting frame of baking */&lt;br /&gt;
	float (*start_frame)(Object *ob, void *system);&lt;br /&gt;
	&lt;br /&gt;
	/* end frame of baking */&lt;br /&gt;
	float (*end_frame)(Object *ob, void *system);&lt;br /&gt;
	&lt;br /&gt;
	/* timestep needed for next step */&lt;br /&gt;
	float (*timestep)(Object *ob, void *system);&lt;br /&gt;
	&lt;br /&gt;
	int (*is_baked)(Object *ob, void *system);&lt;br /&gt;
	int (*set_baking)(Object *ob, void *system);&lt;br /&gt;
	int (*needs_autobake)(Object *ob, void *system);&lt;br /&gt;
	&lt;br /&gt;
	/* return system to unbaked state, regardles of wether baking is complete or not */&lt;br /&gt;
	void (*free_bake)(Object *ob, void *system);&lt;br /&gt;
	/* prepare system to continue baking from cfra */&lt;br /&gt;
	void (*set_rebaking)(Object *ob, void *system, float cfra);&lt;br /&gt;
	&lt;br /&gt;
	/* info on the bake, like size in memory, amount of baked keys etc. */&lt;br /&gt;
	char *(*bake_info)(Object *ob, void *system);&lt;br /&gt;
	&lt;br /&gt;
	/* initializes and sets an editing mode for the baked data */&lt;br /&gt;
	void (*set_bake_edit)(Object *ob, void *system);&lt;br /&gt;
	/* clear out temporary stuff left by the edit mode etc. */&lt;br /&gt;
	void (*end_bake_edit)(Object *ob, void *system);&lt;br /&gt;
	&lt;br /&gt;
	/* in addition several edit mode calls can be implemented, like mouse button calls, selections etc..*/&lt;br /&gt;
} BakeableSystem;&lt;br /&gt;
&lt;br /&gt;
typedef struct DynamicsKey{&lt;br /&gt;
	float co[3];&lt;br /&gt;
	float vel[3];&lt;br /&gt;
	float time;&lt;br /&gt;
	/* custom variables needed by some systems */&lt;br /&gt;
	float *custom;&lt;br /&gt;
} DynamicsKey;&lt;br /&gt;
&lt;br /&gt;
/* BakeableSystem-&amp;gt;type */&lt;br /&gt;
#define BAKEABLE_PARTICLE	0&lt;br /&gt;
#define BAKEABLE_SOFTBODY	1&lt;br /&gt;
#define BAKEABLE_CLOTH		2&lt;br /&gt;
#define BAKEABLE_FLUID		3&lt;br /&gt;
#define BAKEABLE_BULLET		4&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Main functions==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void get_all_systems_to_bake(ListBase *bakelist)&lt;br /&gt;
{&lt;br /&gt;
	Object *ob;&lt;br /&gt;
	BakeableSystem *bsys;&lt;br /&gt;
	&lt;br /&gt;
	for(ob in scene){&lt;br /&gt;
		for(bsys in ob-&amp;gt;bakelist){&lt;br /&gt;
			if(bsys.flag &amp;amp; BSYS_TO_BAKE)&lt;br /&gt;
				BLI_addtail(bakelist,bsys);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void get_all_autobake_systems(ListBase *bakelist)&lt;br /&gt;
{&lt;br /&gt;
	Object *ob;&lt;br /&gt;
	BakeableSystem *bsys;&lt;br /&gt;
	&lt;br /&gt;
	for(ob in scene){&lt;br /&gt;
		for(bsys in ob-&amp;gt;bakelist){&lt;br /&gt;
			if(bsys.needs_autobake(..))&lt;br /&gt;
				BLI_addtail(bakelist,bsys);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void unified_bake(ListBase *bakelist, int from_cfra)&lt;br /&gt;
{&lt;br /&gt;
	BakeableSystem *bsys;&lt;br /&gt;
	float start_frame=from_cfra?CFRA:MAXFRAME;&lt;br /&gt;
	float end_frame=-MAXFRAME;&lt;br /&gt;
	float step=1.0, cfra;&lt;br /&gt;
	int old_cfra=CFRA;&lt;br /&gt;
	&lt;br /&gt;
	if(bakelist==0) return;&lt;br /&gt;
	&lt;br /&gt;
	for(bsys in bakelist){&lt;br /&gt;
		if(from_cfra==0){&lt;br /&gt;
			bsys.free_bake(..);&lt;br /&gt;
			start_frame=MIN(start_frame,bsys.start_frame(..));&lt;br /&gt;
			bsys.ob-&amp;gt;recalc |= bsys.recalc_flag;&lt;br /&gt;
			bsys.set_baking(..);&lt;br /&gt;
		}&lt;br /&gt;
		else&lt;br /&gt;
			bsys.set_rebaking(..);&lt;br /&gt;
			&lt;br /&gt;
		end_frame=MAX(end_frame,bsys.end_frame(..));&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	cfra=start_frame;&lt;br /&gt;
	CFRA=(int)cfra;&lt;br /&gt;
	set_bake_offs(cfra-(float)CFRA);&lt;br /&gt;
	&lt;br /&gt;
	DAG_scene_flush_update();&lt;br /&gt;
	&lt;br /&gt;
	while(cfra&amp;lt;=end_frame){&lt;br /&gt;
		for(ob in scene) {&lt;br /&gt;
			object_handle_update(ob);&lt;br /&gt;
		}&lt;br /&gt;
		update ui to show progress&lt;br /&gt;
		&lt;br /&gt;
		test for escape from baking&lt;br /&gt;
		&lt;br /&gt;
		for(bsys in bakelist){&lt;br /&gt;
			bsys.ob-&amp;gt;recalc |= bsys.recalc_flag&lt;br /&gt;
			step=MIN(step,bsys.get_timestep(..))&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		cfra+=step;&lt;br /&gt;
		CFRA=(int)cfra;&lt;br /&gt;
		set_bake_offs(cfra-(float)CFRA);&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	for(bsys in bakelist){&lt;br /&gt;
		if(bsys.is_baked()==0){&lt;br /&gt;
			bsys.free_bake(..)&lt;br /&gt;
			bsys.ob-&amp;gt;recalc = dyn.recalc_flag&lt;br /&gt;
		}&lt;br /&gt;
		else&lt;br /&gt;
			bsys.flag &amp;amp;= ~BSYS_TO_BAKE;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	CFRA=old_cfra;&lt;br /&gt;
	&lt;br /&gt;
	scene_update_for_newframe()&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Script]]&lt;/div&gt;</summary>
		<author><name>wiki&gt;Terrywallwork</name></author>
		
	</entry>
</feed>