Python API fix: Make properties_texture compatible with COMPAT_ENGINES, also a little...
authorDaniel Genrich <daniel.genrich@gmx.net>
Mon, 19 Apr 2010 00:39:46 +0000 (00:39 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Mon, 19 Apr 2010 00:39:46 +0000 (00:39 +0000)
release/scripts/io/engine_render_pov.py
release/scripts/io/netrender/client.py
release/scripts/ui/properties_data_mesh.py
release/scripts/ui/properties_texture.py

index 04d1ee8befaf0c2973293e978ddaf8e07b4787c7..8987891a4e08c98f9a44cce204e391681d5993c9 100644 (file)
@@ -888,6 +888,14 @@ for member in dir(properties_data_mesh):
     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):
index ac5825039bee108996a03c60038d165804e29abe..23ff2fd3ab6b71c89c69974eebc6cc962220424c 100644 (file)
@@ -285,3 +285,4 @@ def compatible(module):
 compatible("properties_world")
 compatible("properties_material")
 compatible("properties_data_mesh")
+compatible("properties_texture")
index 12d8258245dead3e98a1a540fd477dffa287af71..a33b4f2236814c193ae5b4801b9800f153b876ab 100644 (file)
@@ -53,7 +53,6 @@ class DataButtonsPanel(bpy.types.Panel):
     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
index 1d35aafd8aa3476a69ad91269fb4e82971f848c0..23b5bedd346dec3948be7a73be7079d2b4efc76d 100644 (file)
@@ -25,6 +25,7 @@ narrowui = 180
 
 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_specials(bpy.types.Menu):
 
 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 @@ class TextureButtonsPanel(bpy.types.Panel):
 
     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_preview(TextureButtonsPanel):
 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_context_texture(TextureButtonsPanel):
 
 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 TEXTURE_PT_colors(TextureButtonsPanel):
 
 
 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_mapping(TextureSlotPanel):
 
 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 TEXTURE_PT_influence(TextureSlotPanel):
 
 
 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_clouds(TextureTypePanel):
 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_wood(TextureTypePanel):
 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_marble(TextureTypePanel):
 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_magic(TextureTypePanel):
 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_blend(TextureTypePanel):
 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_stucci(TextureTypePanel):
 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 @@ class TEXTURE_PT_image_sampling(TextureTypePanel):
     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 @@ class TEXTURE_PT_image_mapping(TextureTypePanel):
     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_image_mapping(TextureTypePanel):
 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_plugin(TextureTypePanel):
 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 @@ class TEXTURE_PT_envmap_sampling(TextureTypePanel):
     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_envmap_sampling(TextureTypePanel):
 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_musgrave(TextureTypePanel):
 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_voronoi(TextureTypePanel):
 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_distortednoise(TextureTypePanel):
 
 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_voxeldata(TextureButtonsPanel):
 
 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 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel):
 
 class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel):
     bl_label = "Turbulence"
+    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_header(self, context):
         layout = self.layout