Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2009-08-29 19:20:36 +0400
committerJanne Karhu <jhkarh@gmail.com>2009-08-29 19:20:36 +0400
commit874d38eeb401a75f849cc36c7d7b911129c3aa75 (patch)
treef9d1ad815e40cfd27668dae5be83de72b385c650 /release/ui/buttons_particle.py
parentc03004f93eb94d4af10acaf0b7e8ca7adb097dd0 (diff)
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.
Diffstat (limited to 'release/ui/buttons_particle.py')
-rw-r--r--release/ui/buttons_particle.py157
1 files changed, 82 insertions, 75 deletions
diff --git a/release/ui/buttons_particle.py b/release/ui/buttons_particle.py
index 0454f2a4023..0b18b7c2072 100644
--- a/release/ui/buttons_particle.py
+++ b/release/ui/buttons_particle.py
@@ -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 @@ class PARTICLE_PT_particles(ParticleButtonsPanel):
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 @@ class PARTICLE_PT_particles(ParticleButtonsPanel):
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 @@ class PARTICLE_PT_emission(ParticleButtonsPanel):
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,76 +224,8 @@ class PARTICLE_PT_cache(ParticleButtonsPanel):
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")
-
- #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")
+ point_cache_ui(self, psys.point_cache, particle_panel_enabled(psys), 1, 0)
class PARTICLE_PT_initial(ParticleButtonsPanel):
__label__ = "Velocity"