[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28273] trunk/blender/release/scripts: Python API fix: Make properties_texture compatible with COMPAT_ENGINES, also a little enhancement for data_mesh (thanks to Matt)

Daniel Genrich daniel.genrich at gmx.net
Mon Apr 19 02:39:47 CEST 2010


Revision: 28273
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28273
Author:   genscher
Date:     2010-04-19 02:39:46 +0200 (Mon, 19 Apr 2010)

Log Message:
-----------
Python API fix: Make properties_texture compatible with COMPAT_ENGINES, also a little enhancement for data_mesh (thanks to Matt)

Modified Paths:
--------------
    trunk/blender/release/scripts/io/engine_render_pov.py
    trunk/blender/release/scripts/io/netrender/client.py
    trunk/blender/release/scripts/ui/properties_data_mesh.py
    trunk/blender/release/scripts/ui/properties_texture.py

Modified: trunk/blender/release/scripts/io/engine_render_pov.py
===================================================================
--- trunk/blender/release/scripts/io/engine_render_pov.py	2010-04-19 00:29:50 UTC (rev 28272)
+++ trunk/blender/release/scripts/io/engine_render_pov.py	2010-04-19 00:39:46 UTC (rev 28273)
@@ -888,6 +888,14 @@
     except:
         pass
 del properties_data_mesh
+import properties_texture
+for member in dir(properties_texture):
+    subclass = getattr(properties_texture, member)
+    try:
+        subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
+    except:
+        pass
+del properties_texture
 
 
 class RenderButtonsPanel(bpy.types.Panel):

Modified: trunk/blender/release/scripts/io/netrender/client.py
===================================================================
--- trunk/blender/release/scripts/io/netrender/client.py	2010-04-19 00:29:50 UTC (rev 28272)
+++ trunk/blender/release/scripts/io/netrender/client.py	2010-04-19 00:39:46 UTC (rev 28273)
@@ -285,3 +285,4 @@
 compatible("properties_world")
 compatible("properties_material")
 compatible("properties_data_mesh")
+compatible("properties_texture")

Modified: trunk/blender/release/scripts/ui/properties_data_mesh.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_mesh.py	2010-04-19 00:29:50 UTC (rev 28272)
+++ trunk/blender/release/scripts/ui/properties_data_mesh.py	2010-04-19 00:39:46 UTC (rev 28273)
@@ -53,7 +53,6 @@
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "data"
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def poll(self, context):
         engine = context.scene.render.engine

Modified: trunk/blender/release/scripts/ui/properties_texture.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_texture.py	2010-04-19 00:29:50 UTC (rev 28272)
+++ trunk/blender/release/scripts/ui/properties_texture.py	2010-04-19 00:39:46 UTC (rev 28273)
@@ -25,6 +25,7 @@
 
 class TEXTURE_MT_specials(bpy.types.Menu):
     bl_label = "Texture Specials"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -35,6 +36,7 @@
 
 class TEXTURE_MT_envmap_specials(bpy.types.Menu):
     bl_label = "Environment Map Specials"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -68,11 +70,13 @@
 
     def poll(self, context):
         tex = context.texture
-        return (tex and (tex.type != 'NONE' or tex.use_nodes))
+        engine = context.scene.render.engine
+        return (tex and (tex.type != 'NONE' or tex.use_nodes) and (engine in self.COMPAT_ENGINES))
 
 
 class TEXTURE_PT_preview(TextureButtonsPanel):
     bl_label = "Preview"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -91,9 +95,11 @@
 class TEXTURE_PT_context_texture(TextureButtonsPanel):
     bl_label = ""
     bl_show_header = False
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def poll(self, context):
-        return (context.material or context.world or context.lamp or context.brush or context.texture)
+        engine = context.scene.render.engine
+        return ((context.material or context.world or context.lamp or context.brush or context.texture) and (engine in self.COMPAT_ENGINES))
 
     def draw(self, context):
         layout = self.layout
@@ -156,14 +162,17 @@
 
 class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel):
     _context_path = "texture"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def poll(self, context): # use alternate poll since NONE texture type is ok
-        return context.texture
+        engine = context.scene.render.engine
+        return context.texture and (engine in self.COMPAT_ENGINES)
 
 
 class TEXTURE_PT_colors(TextureButtonsPanel):
     bl_label = "Colors"
     bl_default_closed = True
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -194,20 +203,24 @@
 
 
 class TextureSlotPanel(TextureButtonsPanel):
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def poll(self, context):
+        engine = context.scene.render.engine
         return (context.texture_slot and
-                TextureButtonsPanel.poll(self, context))
+                TextureButtonsPanel.poll(self, context) and (engine in self.COMPAT_ENGINES))
 
 
 class TEXTURE_PT_mapping(TextureSlotPanel):
     bl_label = "Mapping"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def poll(self, context):
         idblock = context_tex_datablock(context)
         if type(idblock) == bpy.types.Brush and not context.sculpt_object:
             return False
-        return context.texture_slot
+        engine = context.scene.render.engine
+        return context.texture_slot and (engine in self.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
@@ -294,13 +307,15 @@
 
 class TEXTURE_PT_influence(TextureSlotPanel):
     bl_label = "Influence"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def poll(self, context):
         idblock = context_tex_datablock(context)
         if type(idblock) == bpy.types.Brush:
             return False
 
-        return context.texture_slot
+        engine = context.scene.render.engine
+        return context.texture_slot and (engine in self.COMPAT_ENGINES)
 
     def draw(self, context):
 
@@ -412,15 +427,18 @@
 
 
 class TextureTypePanel(TextureButtonsPanel):
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def poll(self, context):
         tex = context.texture
-        return (tex and tex.type == self.tex_type and not tex.use_nodes)
+        engine = context.scene.render.engine
+        return ((tex and tex.type == self.tex_type and not tex.use_nodes) and (engine in self.COMPAT_ENGINES))
 
 
 class TEXTURE_PT_clouds(TextureTypePanel):
     bl_label = "Clouds"
     tex_type = 'CLOUDS'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -450,6 +468,7 @@
 class TEXTURE_PT_wood(TextureTypePanel):
     bl_label = "Wood"
     tex_type = 'WOOD'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -486,6 +505,7 @@
 class TEXTURE_PT_marble(TextureTypePanel):
     bl_label = "Marble"
     tex_type = 'MARBLE'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -517,6 +537,7 @@
 class TEXTURE_PT_magic(TextureTypePanel):
     bl_label = "Magic"
     tex_type = 'MAGIC'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -537,6 +558,7 @@
 class TEXTURE_PT_blend(TextureTypePanel):
     bl_label = "Blend"
     tex_type = 'BLEND'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -558,6 +580,7 @@
 class TEXTURE_PT_stucci(TextureTypePanel):
     bl_label = "Stucci"
     tex_type = 'STUCCI'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -586,6 +609,7 @@
 class TEXTURE_PT_image(TextureTypePanel):
     bl_label = "Image"
     tex_type = 'IMAGE'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -612,6 +636,7 @@
     bl_label = "Image Sampling"
     bl_default_closed = True
     tex_type = 'IMAGE'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -652,6 +677,7 @@
     bl_label = "Image Mapping"
     bl_default_closed = True
     tex_type = 'IMAGE'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -709,6 +735,7 @@
 class TEXTURE_PT_plugin(TextureTypePanel):
     bl_label = "Plugin"
     tex_type = 'PLUGIN'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -721,6 +748,7 @@
 class TEXTURE_PT_envmap(TextureTypePanel):
     bl_label = "Environment Map"
     tex_type = 'ENVIRONMENT_MAP'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -762,6 +790,7 @@
     bl_label = "Environment Map Sampling"
     bl_default_closed = True
     tex_type = 'ENVIRONMENT_MAP'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -774,6 +803,7 @@
 class TEXTURE_PT_musgrave(TextureTypePanel):
     bl_label = "Musgrave"
     tex_type = 'MUSGRAVE'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -821,6 +851,7 @@
 class TEXTURE_PT_voronoi(TextureTypePanel):
     bl_label = "Voronoi"
     tex_type = 'VORONOI'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -864,6 +895,7 @@
 class TEXTURE_PT_distortednoise(TextureTypePanel):
     bl_label = "Distorted Noise"
     tex_type = 'DISTORTED_NOISE'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -891,10 +923,12 @@
 
 class TEXTURE_PT_voxeldata(TextureButtonsPanel):
     bl_label = "Voxel Data"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def poll(self, context):
         tex = context.texture
-        return (tex and tex.type == 'VOXEL_DATA')
+        engine = context.scene.render.engine
+        return (tex and tex.type == 'VOXEL_DATA' and (engine in self.COMPAT_ENGINES))
 
     def draw(self, context):
         layout = self.layout
@@ -925,10 +959,12 @@
 
 class TEXTURE_PT_pointdensity(TextureButtonsPanel):
     bl_label = "Point Density"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def poll(self, context):
         tex = context.texture
-        return (tex and tex.type == 'POINT_DENSITY')
+        engine = context.scene.render.engine
+        return (tex and tex.type == 'POINT_DENSITY' and (engine in self.COMPAT_ENGINES))
 
     def draw(self, context):
         layout = self.layout
@@ -983,10 +1019,12 @@
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list