[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22861] branches/blender2.5/blender: Point cache editing:

Janne Karhu jhkarh at utu.fi
Sat Aug 29 17:20:36 CEST 2009


Revision: 22861
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22861
Author:   jhk
Date:     2009-08-29 17:20:36 +0200 (Sat, 29 Aug 2009)

Log Message:
-----------
Point cache editing:
- Baked point caches for particles, cloth and softbody can now be edited in particle mode.
	* This overwrites the old cloth/sb cache editmode editing.
	* The type of editable system is chosen from a menu.
	* For particles the current particle system and it's current cache are used.
- Currently this only works for caches that are in memory, but some automatic conversion from disk to memory and back can be implemented later.
- All tools from hair editing can't be applied to point caches and are hidden in the tool panel and specials menu. Some functionality like subdividing paths can be later implemented in a slightly different way from how it works for hair.
- Code is not yet optimized for speed, so editing might be slow sometimes.

Known issues:
- Cloth doesn't update properly while in particle mode, due to the way cloth modifier currently works. Daniel can you check on this?
- As "particle mode" is not only for particles any more some other name would be in place?
- Better icons are needed for the path, point, and tip-modes as the current icons from mesh edit mode are quite misleading.
- Direct editing of point velocities is not yet implemented, but will be in the future.

Other changes:
- Hair editing doesn't require a "make editable" button press any more.
- Multiple caches in single particle system disables changing emission properties.
- Unified ui code for all point cache panels.
	* Defined in buttons_particle.py and imported for cloth, smoke & softbody.
- Proper disabling of properties in ui after baking point caches. (Daniel could you please make needed disable code for smoke panels as their functionality is not familiar to me.)
- Hair weight brush has been removed. Once hair dynamics is re-implemented I'll code a more useable alternative to the functionality.

Bug fixes:
- Unlinking particle settings crashed.
- Deleting the active object with particles in the scene crashed.
- Softbody didn't write point caches correctly on save.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_particle.py
    branches/blender2.5/blender/release/ui/buttons_physics_cloth.py
    branches/blender2.5/blender/release/ui/buttons_physics_smoke.py
    branches/blender2.5/blender/release/ui/buttons_physics_softbody.py
    branches/blender2.5/blender/release/ui/space_view3d_toolbar.py
    branches/blender2.5/blender/source/blender/blenkernel/BKE_particle.h
    branches/blender2.5/blender/source/blender/blenkernel/BKE_pointcache.h
    branches/blender2.5/blender/source/blender/blenkernel/intern/cloth.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/particle.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/particle_system.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/pointcache.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/scene.c
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c
    branches/blender2.5/blender/source/blender/editors/include/ED_particle.h
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh.c
    branches/blender2.5/blender/source/blender/editors/physics/ed_pointcache.c
    branches/blender2.5/blender/source/blender/editors/physics/editparticle.c
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/drawobject.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c
    branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c
    branches/blender2.5/blender/source/blender/editors/transform/transform_manipulator.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_object_force.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_particle_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_scene_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_particle.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_sculpt_paint.c

Modified: branches/blender2.5/blender/release/ui/buttons_particle.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_particle.py	2009-08-29 14:53:00 UTC (rev 22860)
+++ branches/blender2.5/blender/release/ui/buttons_particle.py	2009-08-29 15:20:36 UTC (rev 22861)
@@ -2,13 +2,79 @@
 import bpy
 
 def particle_panel_enabled(psys):
-	return psys.point_cache.baked==False and psys.editable==False
+	return psys.point_cache.baked==False and psys.edited==False
 	
 def particle_panel_poll(context):
 	psys = context.particle_system
 	if psys==None:	return False
 	if psys.settings==None:  return False
 	return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR')
+	
+def point_cache_ui(self, cache, enabled, particles, smoke):
+	layout = self.layout
+	layout.set_context_pointer("PointCache", cache)
+	
+	row = layout.row()
+	row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2 )
+	col = row.column(align=True)
+	col.itemO("ptcache.add_new", icon='ICON_ZOOMIN', text="")
+	col.itemO("ptcache.remove", icon='ICON_ZOOMOUT', text="")
+	
+	row = layout.row()
+	row.itemL(text="File Name:")
+	if particles:
+		row.itemR(cache, "external")
+	
+	if cache.external:
+		split = layout.split(percentage=0.80)
+		split.itemR(cache, "name", text="")
+		split.itemR(cache, "index", text="")
+		
+		layout.itemL(text="File Path:")
+		layout.itemR(cache, "filepath", text="")
+		
+		layout.itemL(text=cache.info)
+	else:
+		layout.itemR(cache, "name", text="")
+		
+		if not particles:
+			row = layout.row()
+			row.enabled = enabled
+			row.itemR(cache, "start_frame")
+			row.itemR(cache, "end_frame")
+		
+		row = layout.row()
+	
+		if cache.baked == True:
+			row.itemO("ptcache.free_bake", text="Free Bake")
+		else:
+			row.item_booleanO("ptcache.bake", "bake", True, text="Bake")
+	
+		sub = row.row()
+		sub.enabled = (cache.frames_skipped or cache.outdated) and enabled
+		sub.itemO("ptcache.bake", "bake", False, text="Calculate to Current Frame")
+		
+		row = layout.row()
+		row.enabled = enabled
+		row.itemO("ptcache.bake_from_cache", text="Current Cache to Bake")
+		row.itemR(cache, "step");
+	
+		if not smoke:
+			row = layout.row()
+			sub = row.row()
+			sub.enabled = enabled
+			sub.itemR(cache, "quick_cache")
+			row.itemR(cache, "disk_cache")
+	
+		layout.itemL(text=cache.info)
+		
+		layout.itemS()
+		
+		row = layout.row()
+		row.item_booleanO("ptcache.bake_all", "bake", True, text="Bake All Dynamics")
+		row.itemO("ptcache.free_bake_all", text="Free All Bakes")
+		layout.itemO("ptcache.bake_all", "bake", False, text="Update All Dynamics to current frame")
+	
 
 class ParticleButtonsPanel(bpy.types.Panel):
 	__space_type__ = 'PROPERTIES'
@@ -38,7 +104,16 @@
 			col.itemO("object.particle_system_add", icon='ICON_ZOOMIN', text="")
 			col.itemO("object.particle_system_remove", icon='ICON_ZOOMOUT', text="")
 
-		if psys:
+		if psys and not psys.settings:
+			split = layout.split(percentage=0.32)
+			col = split.column()
+			col.itemL(text="Name:")
+			col.itemL(text="Settings:")
+			
+			col = split.column()
+			col.itemR(psys, "name", text="")
+			col.template_ID(psys, "settings", new="particle.new")
+		elif psys:
 			part = psys.settings
 			
 			split = layout.split(percentage=0.32)
@@ -69,10 +144,10 @@
 				
 				split = layout.split(percentage=0.65)
 				if part.type=='HAIR':
-					if psys.editable==True:
-						split.itemO("particle.editable_set", text="Free Edit")
+					if psys.edited==True:
+						split.itemO("particle.edited_clear", text="Free Edit")
 					else:
-						split.itemO("particle.editable_set", text="Make Editable")
+						split.itemL(text="")
 					row = split.row()
 					row.enabled = particle_panel_enabled(psys)
 					row.itemR(part, "hair_step")
@@ -96,7 +171,7 @@
 		psys = context.particle_system
 		part = psys.settings
 		
-		layout.enabled = particle_panel_enabled(psys)
+		layout.enabled = particle_panel_enabled(psys) and not psys.multiple_caches
 		
 		row = layout.row()
 		row.itemR(part, "amount")
@@ -149,77 +224,9 @@
 		layout = self.layout
 
 		psys = context.particle_system
-		part = psys.settings
-		cache = psys.point_cache
-		layout.set_context_pointer("PointCache", cache)
 		
-		row = layout.row()
-		row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2 )
-		col = row.column(align=True)
-		col.itemO("ptcache.add_new", icon='ICON_ZOOMIN', text="")
-		col.itemO("ptcache.remove", icon='ICON_ZOOMOUT', text="")
-		
-		row = layout.row()
-		row.itemL(text="File Name:")
-		row.itemR(cache, "external")
-		
-		if cache.external:
-			split = layout.split(percentage=0.80)
-			split.itemR(cache, "name", text="")
-			split.itemR(cache, "index", text="")
-			
-			layout.itemL(text="File Path:")
-			layout.itemR(cache, "filepath", text="")
-			
-			layout.itemL(text=cache.info)
-			
-			#split = layout.split()
-			
-			#col = split.column(align=True)
-			#col.itemR(part, "start")
-			#col.itemR(part, "end")
+		point_cache_ui(self, psys.point_cache, particle_panel_enabled(psys), 1, 0)
 
-			#col = split.column(align=True)
-			#col.itemR(part, "lifetime")
-			#col.itemR(part, "random_lifetime", slider=True)
-		else:
-			layout.itemR(cache, "name", text="")
-			
-			row = layout.row()
-		
-			if cache.baked == True:
-				row.itemO("ptcache.free_bake", text="Free Bake")
-			else:
-				row.item_booleanO("ptcache.bake", "bake", True, text="Bake")
-		
-			subrow = row.row()
-			subrow.enabled = (cache.frames_skipped or cache.outdated) and particle_panel_enabled(psys)
-			subrow.itemO("ptcache.bake", "bake", False, text="Calculate to Current Frame")
-			
-			row = layout.row()
-			row.enabled = particle_panel_enabled(psys)
-			row.itemO("ptcache.bake_from_cache", text="Current Cache to Bake")
-			row.itemR(cache, "step");
-		
-			row = layout.row()
-			subrow = row.row()
-			subrow.enabled = particle_panel_enabled(psys)
-			subrow.itemR(cache, "quick_cache")
-			row.itemR(cache, "disk_cache")
-		
-			layout.itemL(text=cache.info)
-			
-			layout.itemS()
-			
-			row = layout.row()
-			row.item_booleanO("ptcache.bake_all", "bake", True, text="Bake All Dynamics")
-			row.itemO("ptcache.free_bake_all", text="Free All Bakes")
-			layout.itemO("ptcache.bake_all", "bake", False, text="Update All Dynamics to current frame")
-		
-		# for particles these are figured out automatically
-		#row.itemR(cache, "start_frame")
-		#row.itemR(cache, "end_frame")
-
 class PARTICLE_PT_initial(ParticleButtonsPanel):
 	__label__ = "Velocity"
 	

Modified: branches/blender2.5/blender/release/ui/buttons_physics_cloth.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_physics_cloth.py	2009-08-29 14:53:00 UTC (rev 22860)
+++ branches/blender2.5/blender/release/ui/buttons_physics_cloth.py	2009-08-29 15:20:36 UTC (rev 22861)
@@ -1,6 +1,11 @@
 
 import bpy
 
+from buttons_particle import point_cache_ui
+
+def cloth_panel_enabled(md):
+	return md.point_cache.baked==False
+
 class PhysicButtonsPanel(bpy.types.Panel):
 	__space_type__ = 'PROPERTIES'
 	__region_type__ = 'WINDOW'
@@ -41,6 +46,8 @@
 
 			split = layout.split()
 			
+			split.active = cloth_panel_enabled(md)
+			
 			col = split.column()
 			col.itemL(text="Quality:")
 			col.itemR(cloth, "quality", text="Steps",slider=True)
@@ -85,54 +92,9 @@
 		return (context.cloth != None)
 
 	def draw(self, context):
-		layout = self.layout
-
-		cache = context.cloth.point_cache
-		layout.set_context_pointer("PointCache", cache)
+		md = context.cloth
+		point_cache_ui(self, md.point_cache, cloth_panel_enabled(md), 0, 0)
 		
-		row = layout.row()
-		row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2)
-		col = row.column(align=True)
-		col.itemO("ptcache.add_new", icon='ICON_ZOOMIN', text="")
-		col.itemO("ptcache.remove", icon='ICON_ZOOMOUT', text="")
-		
-		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:
-			row.itemO("ptcache.free_bake", text="Free Bake")
-		else:
-			row.item_booleanO("ptcache.bake", "bake", True, text="Bake")
-		
-		subrow = row.row()
-		subrow.enabled = cache.frames_skipped or cache.outdated
-		subrow.itemO("ptcache.bake", "bake", False, text="Calculate to Current Frame")
-			
-		row = layout.row()
-		#row.enabled = particle_panel_enabled(psys)
-		row.itemO("ptcache.bake_from_cache", text="Current Cache to Bake")
-		row.itemR(cache, "step");
-	
-		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()
-		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", "bake", False, text="Update All Dynamics to current frame")
-		
 class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
 	__label__ = "Cloth Collision"
 	__default_closed__ = True
@@ -143,7 +105,8 @@
 	def draw_header(self, context):
 		layout = self.layout
 		cloth = context.cloth.collision_settings
-	
+		
+		layout.active = cloth_panel_enabled(context.cloth)
 		layout.itemR(cloth, "enable_collision", text="")
 
 	def draw(self, context):
@@ -151,7 +114,7 @@
 		cloth = context.cloth.collision_settings
 		split = layout.split()
 		
-		layout.active = cloth.enable_collision
+		layout.active = cloth.enable_collision and cloth_panel_enabled(md)
 		
 		col = split.column()
 		col.itemR(cloth, "collision_quality", slider=True, text="Quality")
@@ -176,6 +139,7 @@
 		layout = self.layout
 		cloth = context.cloth.settings
 	
+		layout.active = cloth_panel_enabled(context.cloth)
 		layout.itemR(cloth, "stiffness_scaling", text="")
 
 	def draw(self, context):
@@ -183,7 +147,7 @@
 		ob = context.object
 		cloth = context.cloth.settings
 		
-		layout.active = cloth.stiffness_scaling	
+		layout.active = cloth.stiffness_scaling	and cloth_panel_enabled(md)
 		
 		split = layout.split()
 		

Modified: branches/blender2.5/blender/release/ui/buttons_physics_smoke.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_physics_smoke.py	2009-08-29 14:53:00 UTC (rev 22860)
+++ branches/blender2.5/blender/release/ui/buttons_physics_smoke.py	2009-08-29 15:20:36 UTC (rev 22861)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list