[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53377] trunk/blender/intern/cycles/ blender/addon/ui.py: Cycles Hair UI:

Thomas Dinges blender at dingto.org
Fri Dec 28 17:25:46 CET 2012


Revision: 53377
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53377
Author:   dingto
Date:     2012-12-28 16:25:41 +0000 (Fri, 28 Dec 2012)
Log Message:
-----------
Cycles Hair UI:
* Code cleanup, removed some unneeded code
* Moved "Cycles Hair Rendering" panel above "Cycles Hair settings"
* "Cycles Hair settings" panel is only visible when hair rendering ("use_curves") is enabled.

Modified Paths:
--------------
    trunk/blender/intern/cycles/blender/addon/ui.py

Modified: trunk/blender/intern/cycles/blender/addon/ui.py
===================================================================
--- trunk/blender/intern/cycles/blender/addon/ui.py	2012-12-28 16:11:04 UTC (rev 53376)
+++ trunk/blender/intern/cycles/blender/addon/ui.py	2012-12-28 16:25:41 UTC (rev 53377)
@@ -944,96 +944,91 @@
         else:
             slot = part.texture_slots[part.active_texture_index]
             layout.template_ID(slot, "texture", new="texture.new")
-            
-class CyclesParticle_PT_CurveSettings(CyclesButtonsPanel, Panel):
-    bl_label = "Cycles Hair Settings"
+
+class CyclesRender_PT_CurveRendering(CyclesButtonsPanel, Panel):
+    bl_label = "Cycles Hair Rendering"
     bl_context = "particle"
     
     @classmethod
     def poll(cls, context):
         psys = context.particle_system
         device_type = context.user_preferences.system.compute_device_type
-        if context.scene.cycles.feature_set == 'EXPERIMENTAL' and (context.scene.cycles.device == 'CPU' or device_type == 'NONE'):
-            if CyclesButtonsPanel.poll(context) and psys:
-                return True
-
-        return False
-
+        experimental = context.scene.cycles.feature_set == 'EXPERIMENTAL' and (context.scene.cycles.device == 'CPU' or device_type == 'NONE')
+        return CyclesButtonsPanel.poll(context) and experimental and psys
+        
+    def draw_header(self, context):
+        cscene = context.scene.cycles_curves
+        self.layout.prop(cscene, "use_curves", text="")
+    
     def draw(self, context):
         layout = self.layout
         
-        psys = context.particle_settings
+        scene = context.scene
+        cscene = scene.cycles_curves
         
-        cpsys = psys.cycles
+        layout.active = cscene.use_curves
         
-        row = layout.row()
-        row.prop(cpsys, "shape", text="Shape")
-        row.prop(cpsys, "use_closetip", text="Close tip")
-        row = layout.row()
-        row.prop(cpsys, "root_width", text="Root Width multiplier")
-        row = layout.row()
-        row.prop(cpsys, "tip_width", text="Tip Width multiplier")
-
-class CyclesRender_PT_CurveRendering(CyclesButtonsPanel, Panel):
-    bl_label = "Cycles Hair Rendering"
+        layout.prop(cscene, "preset", text="Mode")
+        
+        if cscene.preset == 'CUSTOM':
+            layout.prop(cscene, "primitive", text="Primitive")
+        
+            if cscene.primitive == 'TRIANGLES':
+                layout.prop(cscene, "triangle_method", text="Method")
+                if cscene.triangle_method == 'TESSELATED':
+                    layout.prop(cscene, "resolution", text="Resolution")
+                layout.prop(cscene, "use_smooth", text="Smooth")
+            elif cscene.primitive == 'LINE_SEGMENTS':
+                layout.prop(cscene, "use_backfacing", text="Check back-faces")
+                
+                row = layout.row()
+                row.prop(cscene, "use_encasing", text="Exclude encasing")
+                sub = row.row()
+                sub.active = cscene.use_encasing
+                sub.prop(cscene, "encasing_ratio", text="Ratio for encasing")
+                
+                layout.prop(cscene, "line_method", text="Method")
+                layout.prop(cscene, "use_tangent_normal", text="Use tangent normal as default")
+                layout.prop(cscene, "use_tangent_normal_geometry", text="Use tangent normal geometry")
+                layout.prop(cscene, "use_tangent_normal_correction", text="Correct tangent normal for slope")
+                layout.prop(cscene, "interpolation", text="Interpolation")
+                
+                row = layout.row()
+                row.prop(cscene, "segments", text="Segments")
+                row.prop(cscene, "normalmix", text="Ray Mix")
+            
+            row = layout.row()
+            row.prop(cscene, "use_cache", text="Export cache with children")
+            if cscene.use_cache:
+                row.prop(cscene, "use_parents", text="Include parents")  
+            
+class CyclesParticle_PT_CurveSettings(CyclesButtonsPanel, Panel):
+    bl_label = "Cycles Hair Settings"
     bl_context = "particle"
     
     @classmethod
     def poll(cls, context):
+        use_curves = context.scene.cycles_curves.use_curves
         device_type = context.user_preferences.system.compute_device_type
-        if CyclesButtonsPanel.poll(context):
-            if context.scene.cycles.feature_set == 'EXPERIMENTAL' and (context.scene.cycles.device == 'CPU' or device_type == 'NONE'):
-                return True
+        experimental = context.scene.cycles.feature_set == 'EXPERIMENTAL' and (context.scene.cycles.device == 'CPU' or device_type == 'NONE')
+        return CyclesButtonsPanel.poll(context) and experimental and use_curves
 
-        return False
-    
     def draw(self, context):
         layout = self.layout
-        scene = context.scene
-        csscene = scene.cycles_curves
         
+        psys = context.particle_settings
+        cpsys = psys.cycles
+        
         row = layout.row()
-        row.prop(csscene, "use_curves", text="Enable Cycles Hair")
-        row = layout.row()
-        row.prop(csscene, "preset", text="Mode")
+        row.prop(cpsys, "shape", text="Shape")
+        row.prop(cpsys, "use_closetip", text="Close tip")
         
-        if csscene.preset == 'CUSTOM':
-            row = layout.row()
-            row.prop(csscene, "primitive", text="Primitive")
-            row = layout.row()
-        
-            if csscene.primitive == 'TRIANGLES':
-                row.prop(csscene, "triangle_method", text="Method")
-                if csscene.triangle_method == 'TESSELATED':
-                    row = layout.row()
-                    row.prop(csscene, "resolution", text="Resolution")
-                row = layout.row()
-                row.prop(csscene, "use_smooth", text="Smooth")
-            elif csscene.primitive == 'LINE_SEGMENTS':
-                row.prop(csscene, "use_backfacing", text="Check back-faces")
-                row = layout.row()
-                row.prop(csscene, "use_encasing", text="Exclude encasing")
-                if csscene.use_encasing:
-                    row.prop(csscene, "encasing_ratio", text="Ratio for encasing")
-                row = layout.row()
-                row.prop(csscene, "line_method", text="Method")
-                row = layout.row()
-                row.prop(csscene, "use_tangent_normal", text="Use tangent normal as default")
-                row = layout.row()
-                row.prop(csscene, "use_tangent_normal_geometry", text="Use tangent normal geometry")
-                row = layout.row()
-                row.prop(csscene, "use_tangent_normal_correction", text="Correct tangent normal for slope")
-                row = layout.row()
-                row.prop(csscene, "interpolation", text="Interpolation")
-                row = layout.row()
-                row.prop(csscene, "segments", text="Segments")
-                row = layout.row()
-                row.prop(csscene, "normalmix", text="Ray Mix")
-            row = layout.row()
-            row.prop(csscene, "use_cache", text="Export cache with children")
-            if csscene.use_cache:
-                row.prop(csscene, "use_parents", text="Include parents")  
+        layout.label(text="Width multiplier:")
+        row = layout.row()
+        row.prop(cpsys, "root_width", text="Root")
+        row.prop(cpsys, "tip_width", text="Tip")
 
+
 class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
     bl_label = "Simplify"
     bl_context = "scene"




More information about the Bf-blender-cvs mailing list