| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | import bpy | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class PhysicButtonsPanel(bpy.types.Panel): | 
					
						
							|  |  |  | 	__space_type__ = "BUTTONS_WINDOW" | 
					
						
							|  |  |  | 	__region_type__ = "WINDOW" | 
					
						
							|  |  |  | 	__context__ = "physics" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	def poll(self, context): | 
					
						
							| 
									
										
										
										
											2009-07-03 14:11:00 +00:00
										 |  |  | 		ob = context.object | 
					
						
							|  |  |  | 		return (ob and ob.type == 'MESH') | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | class PHYSICS_PT_cloth(PhysicButtonsPanel): | 
					
						
							|  |  |  | 	__idname__ = "PHYSICS_PT_cloth" | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 	__label__ = "Cloth" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	def draw(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 		md = context.cloth | 
					
						
							|  |  |  | 		ob = context.object | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 		split = layout.split() | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 		split.operator_context = "EXEC_DEFAULT" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if md: | 
					
						
							|  |  |  | 			# remove modifier + settings | 
					
						
							|  |  |  | 			split.set_context_pointer("modifier", md) | 
					
						
							| 
									
										
										
										
											2009-07-17 12:26:40 +00:00
										 |  |  | 			split.itemO("object.modifier_remove", text="Remove") | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			row = split.row(align=True) | 
					
						
							|  |  |  | 			row.itemR(md, "render", text="") | 
					
						
							|  |  |  | 			row.itemR(md, "realtime", text="") | 
					
						
							|  |  |  | 		else: | 
					
						
							|  |  |  | 			# add modifier | 
					
						
							| 
									
										
										
										
											2009-07-17 12:26:40 +00:00
										 |  |  | 			split.item_enumO("object.modifier_add", "type", "CLOTH", text="Add") | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 			split.itemL() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if md: | 
					
						
							|  |  |  | 			cloth = md.settings | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			split = layout.split() | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-07-16 14:31:32 +00:00
										 |  |  | 			col = split.column() | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 			col.itemR(cloth, "quality", slider=True) | 
					
						
							| 
									
										
										
										
											2009-07-16 14:31:32 +00:00
										 |  |  | 			col.itemL(text="Gravity:") | 
					
						
							|  |  |  | 			col.itemR(cloth, "gravity", text="") | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-13 22:35:04 +00:00
										 |  |  | 			col.itemR(cloth, "pin_cloth", text="Pin") | 
					
						
							| 
									
										
										
										
											2009-07-16 14:31:32 +00:00
										 |  |  | 			colsub = col.column(align=True) | 
					
						
							|  |  |  | 			colsub.active = cloth.pin_cloth | 
					
						
							|  |  |  | 			colsub.itemR(cloth, "pin_stiffness", text="Stiffness") | 
					
						
							|  |  |  | 			colsub.item_pointerR(cloth, "mass_vertex_group", ob, "vertex_groups", text="") | 
					
						
							| 
									
										
										
										
											2009-07-13 22:35:04 +00:00
										 |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-07-16 14:31:32 +00:00
										 |  |  | 			col = split.column() | 
					
						
							| 
									
										
										
										
											2009-07-13 22:35:04 +00:00
										 |  |  | 			col.itemL(text="Presets...") | 
					
						
							| 
									
										
										
										
											2009-07-16 14:31:32 +00:00
										 |  |  | 			col.itemL(text="Material:") | 
					
						
							|  |  |  | 			colsub = col.column(align=True) | 
					
						
							|  |  |  | 			colsub.itemR(cloth, "mass") | 
					
						
							|  |  |  | 			colsub.itemR(cloth, "structural_stiffness", text="Structural") | 
					
						
							|  |  |  | 			colsub.itemR(cloth, "bending_stiffness", text="Bending") | 
					
						
							|  |  |  | 			col.itemL(text="Damping:") | 
					
						
							|  |  |  | 			colsub = col.column(align=True) | 
					
						
							|  |  |  | 			colsub.itemR(cloth, "spring_damping", text="Spring") | 
					
						
							|  |  |  | 			colsub.itemR(cloth, "air_damping", text="Air") | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			# Disabled for now | 
					
						
							|  |  |  | 			"""
 | 
					
						
							|  |  |  | 			if cloth.mass_vertex_group: | 
					
						
							|  |  |  | 				layout.itemL(text="Goal:") | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 				col = layout.column_flow() | 
					
						
							|  |  |  | 				col.itemR(cloth, "goal_default", text="Default") | 
					
						
							|  |  |  | 				col.itemR(cloth, "goal_spring", text="Stiffness") | 
					
						
							|  |  |  | 				col.itemR(cloth, "goal_friction", text="Friction") | 
					
						
							|  |  |  | 			"""
 | 
					
						
							| 
									
										
											  
											
												Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
	- exact (not marked)
	- outdated (simulation is not done completely with current settings)
	- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
	- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
	- Speeds up the "quick caching" very much.
	- Frames between cached frames are interpolated from the cached frames.
	- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
	[Normal cache]
	- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
	- Becomes non-exact: After larger than 1 frame steps.
	- Becomes outdated: After any change effecting the simulation other than frame steps.
	- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
	[Quick cache]
	- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
	- Becomes non-exact: Always from frame 1 (unless cache step = 1).
	- Becomes outdated: Never.
	- Pros/cons: Not very accurate, but super fast!
	- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
	- step forwards (to unknown) -> simulate from last exact frame, store result
	- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
	- Baking does the same, but runs the simulation all the way to the end of simulation.
	- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
	
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
											
										 
											2009-06-27 15:28:58 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | class PHYSICS_PT_cloth_cache(PhysicButtonsPanel): | 
					
						
							|  |  |  | 	__idname__= "PHYSICS_PT_cloth_cache" | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 	__label__ = "Cloth Cache" | 
					
						
							| 
									
										
											  
											
												Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
	- exact (not marked)
	- outdated (simulation is not done completely with current settings)
	- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
	- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
	- Speeds up the "quick caching" very much.
	- Frames between cached frames are interpolated from the cached frames.
	- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
	[Normal cache]
	- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
	- Becomes non-exact: After larger than 1 frame steps.
	- Becomes outdated: After any change effecting the simulation other than frame steps.
	- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
	[Quick cache]
	- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
	- Becomes non-exact: Always from frame 1 (unless cache step = 1).
	- Becomes outdated: Never.
	- Pros/cons: Not very accurate, but super fast!
	- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
	- step forwards (to unknown) -> simulate from last exact frame, store result
	- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
	- Baking does the same, but runs the simulation all the way to the end of simulation.
	- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
	
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
											
										 
											2009-06-27 15:28:58 +00:00
										 |  |  | 	__default_closed__ = True | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 	def poll(self, context): | 
					
						
							|  |  |  | 		return (context.cloth != None) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
	- exact (not marked)
	- outdated (simulation is not done completely with current settings)
	- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
	- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
	- Speeds up the "quick caching" very much.
	- Frames between cached frames are interpolated from the cached frames.
	- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
	[Normal cache]
	- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
	- Becomes non-exact: After larger than 1 frame steps.
	- Becomes outdated: After any change effecting the simulation other than frame steps.
	- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
	[Quick cache]
	- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
	- Becomes non-exact: Always from frame 1 (unless cache step = 1).
	- Becomes outdated: Never.
	- Pros/cons: Not very accurate, but super fast!
	- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
	- step forwards (to unknown) -> simulate from last exact frame, store result
	- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
	- Baking does the same, but runs the simulation all the way to the end of simulation.
	- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
	
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
											
										 
											2009-06-27 15:28:58 +00:00
										 |  |  | 	def draw(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		cache = context.cloth.point_cache | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		row = layout.row() | 
					
						
							|  |  |  | 		row.itemR(cache, "name") | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		row = layout.row() | 
					
						
							|  |  |  | 		row.itemR(cache, "start_frame") | 
					
						
							|  |  |  | 		row.itemR(cache, "end_frame") | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		row = layout.row() | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		if cache.baked == True: | 
					
						
							| 
									
										
										
										
											2009-07-17 12:26:40 +00:00
										 |  |  | 			row.itemO("ptcache.free_bake_cloth", text="Free Bake") | 
					
						
							| 
									
										
											  
											
												Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
	- exact (not marked)
	- outdated (simulation is not done completely with current settings)
	- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
	- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
	- Speeds up the "quick caching" very much.
	- Frames between cached frames are interpolated from the cached frames.
	- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
	[Normal cache]
	- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
	- Becomes non-exact: After larger than 1 frame steps.
	- Becomes outdated: After any change effecting the simulation other than frame steps.
	- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
	[Quick cache]
	- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
	- Becomes non-exact: Always from frame 1 (unless cache step = 1).
	- Becomes outdated: Never.
	- Pros/cons: Not very accurate, but super fast!
	- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
	- step forwards (to unknown) -> simulate from last exact frame, store result
	- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
	- Baking does the same, but runs the simulation all the way to the end of simulation.
	- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
	
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
											
										 
											2009-06-27 15:28:58 +00:00
										 |  |  | 		else: | 
					
						
							| 
									
										
										
										
											2009-07-17 12:26:40 +00:00
										 |  |  | 			row.item_booleanO("ptcache.cache_cloth", "bake", True, text="Bake") | 
					
						
							| 
									
										
											  
											
												Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
	- exact (not marked)
	- outdated (simulation is not done completely with current settings)
	- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
	- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
	- Speeds up the "quick caching" very much.
	- Frames between cached frames are interpolated from the cached frames.
	- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
	[Normal cache]
	- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
	- Becomes non-exact: After larger than 1 frame steps.
	- Becomes outdated: After any change effecting the simulation other than frame steps.
	- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
	[Quick cache]
	- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
	- Becomes non-exact: Always from frame 1 (unless cache step = 1).
	- Becomes outdated: Never.
	- Pros/cons: Not very accurate, but super fast!
	- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
	- step forwards (to unknown) -> simulate from last exact frame, store result
	- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
	- Baking does the same, but runs the simulation all the way to the end of simulation.
	- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
	
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
											
										 
											2009-06-27 15:28:58 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		subrow = row.row() | 
					
						
							|  |  |  | 		subrow.enabled = cache.frames_skipped or cache.outdated | 
					
						
							| 
									
										
										
										
											2009-07-17 12:26:40 +00:00
										 |  |  | 		subrow.itemO("ptcache.cache_cloth", text="Calculate to Current Frame") | 
					
						
							| 
									
										
											  
											
												Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
	- exact (not marked)
	- outdated (simulation is not done completely with current settings)
	- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
	- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
	- Speeds up the "quick caching" very much.
	- Frames between cached frames are interpolated from the cached frames.
	- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
	[Normal cache]
	- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
	- Becomes non-exact: After larger than 1 frame steps.
	- Becomes outdated: After any change effecting the simulation other than frame steps.
	- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
	[Quick cache]
	- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
	- Becomes non-exact: Always from frame 1 (unless cache step = 1).
	- Becomes outdated: Never.
	- Pros/cons: Not very accurate, but super fast!
	- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
	- step forwards (to unknown) -> simulate from last exact frame, store result
	- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
	- Baking does the same, but runs the simulation all the way to the end of simulation.
	- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
	
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
											
										 
											2009-06-27 15:28:58 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 		row = layout.row() | 
					
						
							|  |  |  | 		#row.enabled = particle_panel_enabled(psys) | 
					
						
							| 
									
										
										
										
											2009-07-17 12:26:40 +00:00
										 |  |  | 		row.itemO("ptcache.bake_from_cloth_cache", text="Current Cache to Bake") | 
					
						
							| 
									
										
											  
											
												Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
	- exact (not marked)
	- outdated (simulation is not done completely with current settings)
	- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
	- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
	- Speeds up the "quick caching" very much.
	- Frames between cached frames are interpolated from the cached frames.
	- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
	[Normal cache]
	- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
	- Becomes non-exact: After larger than 1 frame steps.
	- Becomes outdated: After any change effecting the simulation other than frame steps.
	- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
	[Quick cache]
	- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
	- Becomes non-exact: Always from frame 1 (unless cache step = 1).
	- Becomes outdated: Never.
	- Pros/cons: Not very accurate, but super fast!
	- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
	- step forwards (to unknown) -> simulate from last exact frame, store result
	- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
	- Baking does the same, but runs the simulation all the way to the end of simulation.
	- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
	
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
											
										 
											2009-06-27 15:28:58 +00:00
										 |  |  | 		row.itemR(cache, "step"); | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
											  
											
												Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
	- exact (not marked)
	- outdated (simulation is not done completely with current settings)
	- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
	- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
	- Speeds up the "quick caching" very much.
	- Frames between cached frames are interpolated from the cached frames.
	- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
	[Normal cache]
	- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
	- Becomes non-exact: After larger than 1 frame steps.
	- Becomes outdated: After any change effecting the simulation other than frame steps.
	- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
	[Quick cache]
	- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
	- Becomes non-exact: Always from frame 1 (unless cache step = 1).
	- Becomes outdated: Never.
	- Pros/cons: Not very accurate, but super fast!
	- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
	- step forwards (to unknown) -> simulate from last exact frame, store result
	- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
	- Baking does the same, but runs the simulation all the way to the end of simulation.
	- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
	
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
											
										 
											2009-06-27 15:28:58 +00:00
										 |  |  | 		row = layout.row() | 
					
						
							|  |  |  | 		#row.enabled = particle_panel_enabled(psys) | 
					
						
							|  |  |  | 		row.itemR(cache, "quick_cache") | 
					
						
							|  |  |  | 		row.itemR(cache, "disk_cache") | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		layout.itemL(text=cache.info) | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		layout.itemS() | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		row = layout.row() | 
					
						
							| 
									
										
										
										
											2009-07-17 12:26:40 +00:00
										 |  |  | 		row.itemO("ptcache.bake_all", "bake", True, text="Bake All Dynamics") | 
					
						
							|  |  |  | 		row.itemO("ptcache.free_bake_all", text="Free All Bakes") | 
					
						
							|  |  |  | 		layout.itemO("ptcache.bake_all", text="Update All Dynamics to current frame") | 
					
						
							| 
									
										
											  
											
												Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
	- exact (not marked)
	- outdated (simulation is not done completely with current settings)
	- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
	- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
	- Speeds up the "quick caching" very much.
	- Frames between cached frames are interpolated from the cached frames.
	- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
	[Normal cache]
	- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
	- Becomes non-exact: After larger than 1 frame steps.
	- Becomes outdated: After any change effecting the simulation other than frame steps.
	- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
	[Quick cache]
	- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
	- Becomes non-exact: Always from frame 1 (unless cache step = 1).
	- Becomes outdated: Never.
	- Pros/cons: Not very accurate, but super fast!
	- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
	- step forwards (to unknown) -> simulate from last exact frame, store result
	- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
	- Baking does the same, but runs the simulation all the way to the end of simulation.
	- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
	
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
											
										 
											2009-06-27 15:28:58 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): | 
					
						
							|  |  |  | 	__idname__ = "PHYSICS_PT_clothcollision" | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 	__label__ = "Cloth Collision" | 
					
						
							| 
									
										
										
										
											2009-07-16 14:31:32 +00:00
										 |  |  | 	__default_closed__ = True | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	def poll(self, context): | 
					
						
							|  |  |  | 		return (context.cloth != None) | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	def draw_header(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							| 
									
										
										
										
											2009-06-18 14:20:25 +00:00
										 |  |  | 		cloth = context.cloth.collision_settings | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 		layout.itemR(cloth, "enable_collision", text="") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	def draw(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							| 
									
										
										
										
											2009-06-18 14:20:25 +00:00
										 |  |  | 		cloth = context.cloth.collision_settings | 
					
						
							| 
									
										
										
										
											2009-07-13 22:35:04 +00:00
										 |  |  | 		split = layout.split() | 
					
						
							| 
									
										
										
										
											2009-05-29 09:53:46 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-13 22:35:04 +00:00
										 |  |  | 		layout.active = cloth.enable_collision | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-13 22:35:04 +00:00
										 |  |  | 		col = split.column(align=True) | 
					
						
							|  |  |  | 		col.itemR(cloth, "collision_quality", slider=True, text="Quality") | 
					
						
							| 
									
										
										
										
											2009-07-20 17:15:41 +00:00
										 |  |  | 		col.itemR(cloth, "min_distance", slider=True, text="Distance") | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 		col.itemR(cloth, "friction") | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-16 14:31:32 +00:00
										 |  |  | 		col = split.column(align=True) | 
					
						
							| 
									
										
										
										
											2009-07-13 22:35:04 +00:00
										 |  |  | 		col.itemR(cloth, "enable_self_collision", text="Self Collision") | 
					
						
							|  |  |  | 		col = col.column(align=True) | 
					
						
							| 
									
										
										
										
											2009-05-29 09:53:46 +00:00
										 |  |  | 		col.active = cloth.enable_self_collision | 
					
						
							| 
									
										
										
										
											2009-07-13 22:35:04 +00:00
										 |  |  | 		col.itemR(cloth, "self_collision_quality", slider=True, text="Quality") | 
					
						
							| 
									
										
										
										
											2009-07-20 17:15:41 +00:00
										 |  |  | 		col.itemR(cloth, "self_min_distance", slider=True, text="Distance") | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): | 
					
						
							|  |  |  | 	__idname__ = "PHYSICS_PT_stiffness" | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 	__label__ = "Cloth Stiffness Scaling" | 
					
						
							| 
									
										
										
										
											2009-07-16 14:31:32 +00:00
										 |  |  | 	__default_closed__ = True | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	def poll(self, context): | 
					
						
							|  |  |  | 		return (context.cloth != None) | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	def draw_header(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							| 
									
										
										
										
											2009-06-13 21:22:21 +00:00
										 |  |  | 		cloth = context.cloth.settings | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 		layout.itemR(cloth, "stiffness_scaling", text="") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	def draw(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | 		ob = context.object | 
					
						
							| 
									
										
										
										
											2009-06-13 21:22:21 +00:00
										 |  |  | 		cloth = context.cloth.settings | 
					
						
							| 
									
										
										
										
											2009-05-29 09:53:46 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		layout.active = cloth.stiffness_scaling	 | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		split = layout.split() | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-16 14:31:32 +00:00
										 |  |  | 		col = split.column() | 
					
						
							|  |  |  | 		col.itemL(text="Structural Stiffness:") | 
					
						
							|  |  |  | 		colsub = col.column(align=True) | 
					
						
							|  |  |  | 		colsub.itemR(cloth, "structural_stiffness_max", text="Max") | 
					
						
							|  |  |  | 		colsub.item_pointerR(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="") | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-16 14:31:32 +00:00
										 |  |  | 		col = split.column() | 
					
						
							|  |  |  | 		col.itemL(text="Bending Stiffness:") | 
					
						
							|  |  |  | 		colsub = col.column(align=True) | 
					
						
							|  |  |  | 		colsub.itemR(cloth, "bending_stiffness_max", text="Max") | 
					
						
							|  |  |  | 		colsub.item_pointerR(cloth, "bending_vertex_group", ob, "vertex_groups", text="") | 
					
						
							| 
									
										
										
										
											2009-05-25 18:32:28 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | bpy.types.register(PHYSICS_PT_cloth) | 
					
						
							| 
									
										
											  
											
												Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
	- exact (not marked)
	- outdated (simulation is not done completely with current settings)
	- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
	- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
	- Speeds up the "quick caching" very much.
	- Frames between cached frames are interpolated from the cached frames.
	- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
	[Normal cache]
	- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
	- Becomes non-exact: After larger than 1 frame steps.
	- Becomes outdated: After any change effecting the simulation other than frame steps.
	- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
	[Quick cache]
	- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
	- Becomes non-exact: Always from frame 1 (unless cache step = 1).
	- Becomes outdated: Never.
	- Pros/cons: Not very accurate, but super fast!
	- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
	- step forwards (to unknown) -> simulate from last exact frame, store result
	- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
	- Baking does the same, but runs the simulation all the way to the end of simulation.
	- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
	
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
											
										 
											2009-06-27 15:28:58 +00:00
										 |  |  | bpy.types.register(PHYSICS_PT_cloth_cache) | 
					
						
							| 
									
										
										
										
											2009-07-02 19:41:31 +00:00
										 |  |  | bpy.types.register(PHYSICS_PT_cloth_collision) | 
					
						
							| 
									
										
										
										
											2009-07-16 22:06:04 +00:00
										 |  |  | bpy.types.register(PHYSICS_PT_cloth_stiffness) | 
					
						
							| 
									
										
										
										
											2009-07-21 00:55:20 +00:00
										 |  |  | 
 |