[SCM] yafaray-exporter/upstream: Imported Upstream version 0.1.2
mfv-guest at users.alioth.debian.org
mfv-guest at users.alioth.debian.org
Fri Mar 30 15:28:10 UTC 2012
The following commit has been merged in the upstream branch:
commit 762aa4158a2d41f3b2ece5f2948f95464baa5658
Author: Matteo F. Vescovi <mfv.debian at gmail.com>
Date: Fri Mar 30 17:26:24 2012 +0200
Imported Upstream version 0.1.2
diff --git a/README b/README
index 7b90ccb..5ed1b3f 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Yafaray exporter for Blender 2.61:
+Yafaray exporter for Blender 2.62:
The exporter is in an experimental stage, so use it for testing purposes only.
For the latest exporter updates check:
@@ -14,7 +14,7 @@ or look into this forum post for other platform builds:
http://www.yafaray.org/community/forum/viewtopic.php?f=16&t=3520
-Download and extract the exporter files and folders to the 'Blender/2.61/scripts/addons/yafaray' directory.
+Download and extract the exporter files and folders to the 'Blender/2.62/scripts/addons/yafaray' directory.
We need to test it, please post bugreports and feature requests here:
http://www.yafaray.org/development/bugtracker/yafaray
diff --git a/__init__.py b/__init__.py
index 82115cf..60c9881 100644
--- a/__init__.py
+++ b/__init__.py
@@ -36,8 +36,7 @@ bl_info = {
"Michele Castigliego (subcomandante), Bert Buchholz, "
"Rodrigo Placencia (DarkTide), Alexander Smirnov (Exvion)",
"version": (0, 1, 2, 'alpha'),
- "blender": (2, 6, 1),
- "api": 42615,
+ "blender": (2, 6, 2),
"location": "Info Header > Engine dropdown menu",
"warning": "both YafaRay 0.1.2 and this script are in alpha state",
"wiki_url": "http://www.yafaray.org/community/forum",
@@ -85,7 +84,7 @@ def load_handler(dummy):
print("Load Handler: Convert Yafaray texture \"{0}\" with texture type: \"{1}\" to \"{2}\"".format(tex.name, tex.yaf_tex_type, tex.type))
tex.yaf_tex_type = tex.type
# convert image output file type setting from blender to yafaray's file type setting on file load, so that both are the same...
- if bpy.context.scene.render.image_settings.file_format != bpy.context.scene.img_output:
+ if bpy.context.scene.render.image_settings.file_format is not bpy.context.scene.img_output:
bpy.context.scene.img_output = bpy.context.scene.render.image_settings.file_format
diff --git a/io/yaf_integrator.py b/io/yaf_integrator.py
index 0947b9f..8608194 100644
--- a/io/yaf_integrator.py
+++ b/io/yaf_integrator.py
@@ -86,7 +86,7 @@ class yafIntegrator:
causticType = switchCausticType.get(causticTypeStr)
yi.paramsSetString("caustic_type", causticType)
- if causticType != 'none' and causticType != 'path':
+ if causticType not in {'none', 'path'}:
yi.paramsSetInt("photons", scene.intg_photons)
yi.paramsSetInt("caustic_mix", scene.intg_caustic_mix)
yi.paramsSetInt("caustic_depth", scene.intg_caustic_depth)
diff --git a/io/yaf_light.py b/io/yaf_light.py
index 4de9eb0..4e91a47 100644
--- a/io/yaf_light.py
+++ b/io/yaf_light.py
@@ -31,11 +31,9 @@ class yafLight:
self.preview = preview
def makeSphere(self, nu, nv, x, y, z, rad, mat):
-
yi = self.yi
# get next free id from interface
-
ID = yi.getNextFreeID()
yi.startGeometry()
@@ -105,23 +103,19 @@ class yafLight:
yi.printInfo("Exporting Lamp: {0} [{1}]".format(name, lampType))
if lamp.create_geometry and not self.lightMat:
- self.yi.paramsClearAll()
- self.yi.paramsSetString("type", "light_mat")
+ yi.paramsClearAll()
+ yi.paramsSetColor("color", color[0], color[1], color[2]) # color for spherelight and area light geometry
+ yi.paramsSetString("type", "light_mat")
self.lightMat = self.yi.createMaterial("lm")
self.yi.paramsClearAll()
if lampType == "point":
yi.paramsSetString("type", "pointlight")
- power = 0.5 * power * power # original value
-
- if getattr(lamp, "use_sphere", False):
- radius = lamp.shadow_soft_size
- power /= (radius * radius) # radius < 1 crash geometry ?
-
+ if getattr(lamp, "use_sphere"):
+ radius = max(lamp.distance, 0.01) # avoid ZeroDivisionError
if lamp.create_geometry:
ID = self.makeSphere(24, 48, pos[0], pos[1], pos[2], radius, self.lightMat)
yi.paramsSetInt("object", ID)
-
yi.paramsSetString("type", "spherelight")
yi.paramsSetInt("samples", lamp.yaf_samples)
yi.paramsSetFloat("radius", radius)
@@ -143,35 +137,35 @@ class yafLight:
yi.paramsSetFloat("shadowFuzzyness", lamp.shadow_fuzzyness)
yi.paramsSetBool("photon_only", lamp.photon_only)
yi.paramsSetInt("samples", lamp.yaf_samples)
- power = 0.5 * power * power
elif lampType == "sun":
yi.paramsSetString("type", "sunlight")
yi.paramsSetInt("samples", lamp.yaf_samples)
yi.paramsSetFloat("angle", lamp.angle)
yi.paramsSetPoint("direction", dir[0], dir[1], dir[2])
- if lamp.directional:
- yi.paramsSetString("type", "directional")
- yi.paramsSetBool("infinite", lamp.infinite)
+
+ elif lampType == "directional":
+ yi.paramsSetString("type", "directional")
+ yi.paramsSetPoint("direction", dir[0], dir[1], dir[2])
+ yi.paramsSetBool("infinite", lamp.infinite)
+ if not lamp.infinite:
yi.paramsSetFloat("radius", lamp.shadow_soft_size)
+ yi.paramsSetPoint("from", pos[0], pos[1], pos[2])
elif lampType == "ies":
- # use for IES light
yi.paramsSetString("type", "ieslight")
yi.paramsSetPoint("to", to[0], to[1], to[2])
ies_file = abspath(lamp.ies_file)
- if ies_file != "" and not os.path.exists(ies_file):
+ if not any(ies_file) and not os.path.exists(ies_file):
+ yi.printWarning("IES file not found for {0}".format(name))
return False
yi.paramsSetString("file", ies_file)
yi.paramsSetInt("samples", lamp.yaf_samples)
yi.paramsSetBool("soft_shadows", lamp.ies_soft_shadows)
- # yi.paramsSetFloat("cone_angle", degrees(lamp.spot_size)) # not used for IES, cone angle is defined in IES File?
elif lampType == "area":
-
sizeX = 1.0
sizeY = 1.0
-
matrix = lamp_object.matrix_world.copy()
# generate an untransformed rectangle in the XY plane with
@@ -205,12 +199,19 @@ class yafLight:
yi.paramsSetString("type", "arealight")
yi.paramsSetInt("samples", lamp.yaf_samples)
-
yi.paramsSetPoint("corner", point[0], point[1], point[2])
yi.paramsSetPoint("point1", corner1[0], corner1[1], corner1[2])
yi.paramsSetPoint("point2", corner3[0], corner3[1], corner3[2])
- yi.paramsSetPoint("from", pos[0], pos[1], pos[2])
+ if lampType not in {"sun", "directional"}:
+ # "from" is not used for sunlight and infinite directional light
+ yi.paramsSetPoint("from", pos[0], pos[1], pos[2])
+ if lampType in {"point", "spot"}:
+ if getattr(lamp, "use_sphere"):
+ power = 0.5 * power * power / (radius * radius)
+ else:
+ power = 0.5 * power * power
+
yi.paramsSetColor("color", color[0], color[1], color[2])
yi.paramsSetFloat("power", power)
yi.createLight(name)
diff --git a/io/yaf_material.py b/io/yaf_material.py
index bea86db..9f89dca 100644
--- a/io/yaf_material.py
+++ b/io/yaf_material.py
@@ -105,9 +105,9 @@ class yafMaterial:
tex = mtex.texture # texture object instance
# lots to do...
- isImage = (tex.yaf_tex_type == 'IMAGE')
+ isImage = tex.yaf_tex_type == 'IMAGE'
- if (isImage or (tex.yaf_tex_type == 'VORONOI' and tex.color_mode != 'INTENSITY')):
+ if (isImage or (tex.yaf_tex_type == 'VORONOI' and tex.color_mode not in 'INTENSITY')):
isColored = True
else:
isColored = False
@@ -168,15 +168,14 @@ class yafMaterial:
yi.paramsSetString("texco", texco)
if mtex.object:
- texmat = mtex.object.matrix_local.inverted()
+ texmat = mtex.object.matrix_world.inverted()
rtmatrix = yafrayinterface.new_floatArray(4 * 4)
for x in range(4):
for y in range(4):
idx = (y + x * 4)
yafrayinterface.floatArray_setitem(rtmatrix, idx, texmat[x][y])
-
- yi.paramsSetMemMatrix("transform", rtmatrix, True)
+ yi.paramsSetMemMatrix("transform", rtmatrix, False)
yafrayinterface.delete_floatArray(rtmatrix)
yi.paramsSetInt("proj_x", proj2int(mtex.mapping_x))
@@ -353,7 +352,7 @@ class yafMaterial:
bEmit = mat.emit
if self.preview:
- if mat.name.find("check") != -1:
+ if mat.name.startswith("checker"):
bEmit = 0.35
i = 0
diff --git a/io/yaf_object.py b/io/yaf_object.py
index 3d24cf6..6e25ab1 100644
--- a/io/yaf_object.py
+++ b/io/yaf_object.py
@@ -325,28 +325,24 @@ class yafObject(object):
yi.paramsSetFloat("sigma_s", obj.vol_scatter)
yi.paramsSetInt("attgridScale", self.scene.world.v_int_attgridres)
- v = [list(bb) for bb in obj.bound_box]
- bmin = min(v)
- bmax = max(v)
-
- # BoundingBox: get the low corner (minx, miny, minz) and the
- # up corner (maxx, maxy, maxz) then apply object scale, also
- # clamp the values to min: -1e10 and max: 1e10
- minx = max(bmin[0] * obj.scale.x, -1e10)
- miny = max(bmin[1] * obj.scale.y, -1e10)
- minz = max(bmin[2] * obj.scale.z, -1e10)
- maxx = min(bmax[0] * obj.scale.x, 1e10)
- maxy = min(bmax[1] * obj.scale.y, 1e10)
- maxz = min(bmax[2] * obj.scale.z, 1e10)
-
- yi.paramsSetFloat("minX", minx)
- yi.paramsSetFloat("minY", miny)
- yi.paramsSetFloat("minZ", minz)
- yi.paramsSetFloat("maxX", maxx)
- yi.paramsSetFloat("maxY", maxy)
- yi.paramsSetFloat("maxZ", maxz)
+ # Calculate BoundingBox: get the low corner (minx, miny, minz)
+ # and the up corner (maxx, maxy, maxz) then apply object scale,
+ # also clamp the values to min: -1e10 and max: 1e10
+
+ mesh = obj.to_mesh(self.scene, True, 'RENDER')
+ mesh.transform(matrix)
+
+ vec = [j for v in mesh.vertices for j in v.co]
+
+ yi.paramsSetFloat("minX", max(min(vec[0::3]), -1e10))
+ yi.paramsSetFloat("minY", max(min(vec[1::3]), -1e10))
+ yi.paramsSetFloat("minZ", max(min(vec[2::3]), -1e10))
+ yi.paramsSetFloat("maxX", min(max(vec[0::3]), 1e10))
+ yi.paramsSetFloat("maxY", min(max(vec[1::3]), 1e10))
+ yi.paramsSetFloat("maxZ", min(max(vec[2::3]), 1e10))
yi.createVolumeRegion("VR.{0}-{1}".format(obj.name, str(obj.__hash__())))
+ bpy.data.meshes.remove(mesh)
def writeGeometry(self, ID, obj, matrix, obType=0, oMat=None):
diff --git a/io/yaf_texture.py b/io/yaf_texture.py
index d27a09e..27e8442 100644
--- a/io/yaf_texture.py
+++ b/io/yaf_texture.py
@@ -293,7 +293,7 @@ class yafTexture:
image_tex = "yaf_extracted_image_{0}.{1}".format(clean_name(tex.name), fileformat)
image_tex = os.path.join(save_dir, extract_path, image_tex)
image_tex = abspath(image_tex)
- texture.image.save_render(image_tex, scene)
+ tex.image.save_render(image_tex, scene)
else:
if tex.image.library is not None:
image_tex = abspath(tex.image.filepath, library=tex.image.library)
diff --git a/prop/yaf_light.py b/prop/yaf_light.py
index 1620ac0..44e386a 100644
--- a/prop/yaf_light.py
+++ b/prop/yaf_light.py
@@ -31,7 +31,7 @@ Lamp = bpy.types.Lamp
def call_lighttype_update(self, context):
lamp = context.lamp
if lamp is not None:
- switchLampType = {'area': 'AREA', 'spot': 'SPOT', 'sun': 'SUN', 'point': 'POINT', 'ies': 'SPOT'}
+ switchLampType = {'area': 'AREA', 'spot': 'SPOT', 'sun': 'SUN', 'point': 'POINT', 'ies': 'SPOT', 'directional': 'SUN'}
lamp.type = switchLampType.get(lamp.lamp_type)
@@ -44,7 +44,8 @@ def register():
('sun', "Sun", "Constant direction parallel ray light source"),
('spot', "Spot", "Directional cone light source"),
('ies', "IES", "Directional cone light source from ies file"),
- ('area', "Area", "Directional area light source")
+ ('area', "Area", "Directional area light source"),
+ ('directional', "Directional", "Directional Sun light")
),
default="point", update=call_lighttype_update)
@@ -56,7 +57,7 @@ def register():
Lamp.directional = BoolProperty(
name="Directional",
- description="",
+ description="Directional sunlight type, like 'spot' (for concentrate photons at area)",
default=False)
Lamp.create_geometry = BoolProperty(
diff --git a/prop/yaf_scene.py b/prop/yaf_scene.py
index c49c1e8..d2182cb 100644
--- a/prop/yaf_scene.py
+++ b/prop/yaf_scene.py
@@ -34,7 +34,7 @@ Scene = bpy.types.Scene
def call_update_fileformat(self, context):
scene = context.scene
render = scene.render
- if scene.img_output != render.image_settings.file_format:
+ if scene.img_output is not render.image_settings.file_format:
render.image_settings.file_format = scene.img_output
if render.image_settings.file_format == "OPEN_EXR" and scene.gs_z_channel:
render.image_settings.use_zbuffer = True
diff --git a/prop/yaf_world.py b/prop/yaf_world.py
index 9bbf587..88b1ad5 100644
--- a/prop/yaf_world.py
+++ b/prop/yaf_world.py
@@ -28,11 +28,6 @@ from bpy.props import (EnumProperty,
World = bpy.types.World
-def call_world_update(self, context):
- world = context.scene.world
- world.ambient_color.update_tag()
-
-
def register():
########### YafaRays world background properties #############
World.bg_type = EnumProperty(
@@ -44,8 +39,7 @@ def register():
('Sunsky2', "Sunsky2", "New model of Sunsky background"),
('Single Color', "Single Color", "Single color background")
),
- default="Single Color",
- update=call_world_update)
+ default="Single Color")
World.bg_color_space = EnumProperty(
name="Color space",
@@ -55,48 +49,42 @@ def register():
('sRGB (D65)', "sRGB (D65)", "Select color space model"),
('sRGB (D50)', "sRGB (D50)", "Select color space model")
),
- default="CIE (E)",
- update=call_world_update)
+ default="CIE (E)")
World.bg_zenith_color = FloatVectorProperty(
name="Zenith color",
description="Zenith color",
subtype='COLOR',
min=0.0, max=1.0,
- default=(0.57, 0.65, 1.0),
- update=call_world_update)
+ default=(0.57, 0.65, 1.0))
World.bg_horizon_color = FloatVectorProperty(
name="Horizon color",
description="Horizon color",
subtype='COLOR',
min=0.0, max=1.0,
- default=(1.0, 1.0, 0.5),
- update=call_world_update)
+ default=(1.0, 1.0, 0.5))
World.bg_zenith_ground_color = FloatVectorProperty(
name="Zenith ground color",
description="Zenith ground color",
subtype='COLOR',
min=0.0, max=1.0,
- default=(1.0, 0.9, 0.8),
- update=call_world_update)
+ default=(1.0, 0.9, 0.8))
World.bg_horizon_ground_color = FloatVectorProperty(
name="Horizon ground color",
description="Horizon ground color",
subtype='COLOR',
min=0.0, max=1.0,
- default=(0.8, 0.6, 0.3),
- update=call_world_update)
+ default=(0.8, 0.6, 0.3))
World.bg_single_color = FloatVectorProperty(
name="Background color",
description="Background color",
subtype='COLOR',
min=0.0, max=1.0,
- default=(0.7, 0.7, 0.7),
- update=call_world_update)
+ default=(0.7, 0.7, 0.7))
World.bg_use_ibl = BoolProperty(
name="Use IBL",
@@ -123,57 +111,49 @@ def register():
name="Rotation",
description="Rotation offset of background texture",
min=0.0, max=360.0,
- default=0.0,
- update=call_world_update)
+ default=0.0)
World.bg_turbidity = FloatProperty(
name="Turbidity",
description="Turbidity of the atmosphere",
min=1.0, max=20.0,
- default=2.0,
- update=call_world_update)
+ default=2.0)
World.bg_ds_turbidity = FloatProperty( # Darktides turbidity has different values
name="Turbidity",
description="Turbidity of the atmosphere",
min=2.0, max=12.0,
- default=2.0,
- update=call_world_update)
+ default=2.0)
World.bg_a_var = FloatProperty(
name="Brightness of horizon gradient",
description="Darkening or brightening towards horizon",
min=0.0, max=10.0,
- default=1.0,
- update=call_world_update)
+ default=1.0)
World.bg_b_var = FloatProperty(
name="Luminance of horizon",
description="Luminance gradient near the horizon",
min=0.0, max=10.0,
- default=1.0,
- update=call_world_update)
+ default=1.0)
World.bg_c_var = FloatProperty(
name="Solar region intensity",
description="Relative intensity of circumsolar region",
min=0.0, max=10.0,
- default=1.0,
- update=call_world_update)
+ default=1.0)
World.bg_d_var = FloatProperty(
name="Width of circumsolor region",
description="Width of circumsolar region",
min=0.0, max=10.0,
- default=1.0,
- update=call_world_update)
+ default=1.0)
World.bg_e_var = FloatProperty(
name="Backscattered light",
description="Relative backscattered light",
min=0.0, max=10.0,
- default=1.0,
- update=call_world_update)
+ default=1.0)
World.bg_from = FloatVectorProperty(
name="Set sun position",
@@ -181,68 +161,58 @@ def register():
subtype='DIRECTION',
step=10, precision=3,
min=-1.0, max=1.0,
- default=(1.0, 1.0, 1.0),
- update=call_world_update)
+ default=(1.0, 1.0, 1.0))
World.bg_add_sun = BoolProperty(
name="Add sun",
description="Add a real sun light",
- default=False,
- update=call_world_update)
+ default=False)
World.bg_sun_power = FloatProperty(
name="Sunlight power",
description="Sunlight power",
min=0.0, max=10.0,
- default=1.0,
- update=call_world_update)
+ default=1.0)
World.bg_background_light = BoolProperty(
name="Add skylight",
description="Add skylight",
- default=False,
- update=call_world_update)
+ default=False)
World.bg_light_samples = IntProperty(
name="Samples",
description="Set skylight and sunlight samples",
min=1, max=512,
- default=16,
- update=call_world_update)
+ default=16)
World.bg_dsaltitude = FloatProperty(
name="Altitude",
description="Moves the sky dome above or below the camera position",
min=-1.0, max=2.0,
- default=0.0,
- update=call_world_update)
+ default=0.0)
World.bg_dsnight = BoolProperty(
name="Night",
description="Activate experimental night mode",
- default=False,
- update=call_world_update)
+ default=False)
World.bg_dsbright = FloatProperty(
name="Sky brightness",
description="Brightness of the sky",
min=0.0, max=10.0,
- default=1.0,
- update=call_world_update)
+ default=1.0)
World.bg_power = FloatProperty(
name="Skylight power",
description="Multiplier for background color",
min=0.0,
- default=1.0,
- update=call_world_update)
+ default=1.0)
World.bg_exposure = FloatProperty(
name="Exposure",
description="Exposure correction for the sky (0 = no correction)",
min=0.0, max=10.0,
- default=1.0,
- update=call_world_update)
+ default=1.0)
World.bg_clamp_rgb = BoolProperty(
name="Clamp RGB",
@@ -252,8 +222,7 @@ def register():
World.bg_gamma_enc = BoolProperty(
name="Gamma encoding",
description="Apply gamma encoding to the sky",
- default=True,
- update=call_world_update)
+ default=True)
########### YafaRays volume integrator properties #############
World.v_int_type = EnumProperty(
diff --git a/ui/properties_yaf_light.py b/ui/properties_yaf_light.py
index 3af71a5..bfd89fd 100644
--- a/ui/properties_yaf_light.py
+++ b/ui/properties_yaf_light.py
@@ -31,7 +31,7 @@ class LampButtonsPanel():
def poll(cls, context):
engine = context.scene.render.engine
lamp = context.lamp
- switchLampType = {'area': 'AREA', 'spot': 'SPOT', 'sun': 'SUN', 'point': 'POINT', 'ies': 'SPOT'}
+ switchLampType = {'area': 'AREA', 'spot': 'SPOT', 'sun': 'SUN', 'point': 'POINT', 'ies': 'SPOT', 'directional': "SUN"}
return lamp and ((lamp.lamp_type == cls.lamp_type) and (lamp.type == switchLampType.get(lamp.lamp_type, None)) and (engine in cls.COMPAT_ENGINES))
@@ -133,13 +133,23 @@ class YAF_PT_lamp_sun(LampButtonsPanel, Panel):
layout.prop(lamp, "color")
layout.prop(lamp, "yaf_energy", text="Power")
- layout.prop(lamp, "angle")
layout.prop(lamp, "yaf_samples")
- layout.prop(lamp, "directional", toggle=True)
- if lamp.directional:
- box = layout.box()
- box.prop(lamp, "shadow_soft_size")
- box.prop(lamp, "infinite")
+ layout.prop(lamp, "angle")
+
+
+class YAF_PT_lamp_directional(LampButtonsPanel, Panel):
+ bl_label = "Directional lamp settings"
+ lamp_type = 'directional'
+
+ def draw(self, context):
+ layout = self.layout
+ lamp = context.lamp
+
+ layout.prop(lamp, "color")
+ layout.prop(lamp, "yaf_energy", text="Power")
+ layout.prop(lamp, "infinite")
+ if not lamp.infinite:
+ layout.prop(lamp, "shadow_soft_size", text="Radius of directional cone")
class YAF_PT_lamp_point(LampButtonsPanel, Panel):
@@ -156,7 +166,7 @@ class YAF_PT_lamp_point(LampButtonsPanel, Panel):
layout.prop(lamp, "use_sphere", toggle=True)
if lamp.use_sphere:
box = layout.box()
- box.prop(lamp, "shadow_soft_size")
+ box.prop(lamp, "distance", text="Radius of sphere light")
box.prop(lamp, "yaf_samples")
box.prop(lamp, "create_geometry")
diff --git a/ui/properties_yaf_texture.py b/ui/properties_yaf_texture.py
index 98c5b3a..910d6f7 100644
--- a/ui/properties_yaf_texture.py
+++ b/ui/properties_yaf_texture.py
@@ -19,8 +19,14 @@
# <pep8 compliant>
import bpy
+from bl_ui.properties_material import active_node_mat
from bl_ui.properties_texture import context_tex_datablock
-from bpy.types import Panel
+from bpy.types import (Panel,
+ Texture,
+ Brush,
+ Material,
+ World,
+ ParticleSettings)
class YAF_TextureButtonsPanel():
@@ -32,7 +38,7 @@ class YAF_TextureButtonsPanel():
@classmethod
def poll(cls, context):
tex = context.texture
- return tex and (tex.yaf_tex_type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in cls.COMPAT_ENGINES)
+ return tex and (tex.yaf_tex_type not in 'NONE' or tex.use_nodes) and (context.scene.render.engine in cls.COMPAT_ENGINES)
class YAF_TEXTURE_PT_context_texture(YAF_TextureButtonsPanel, Panel):
@@ -47,26 +53,26 @@ class YAF_TEXTURE_PT_context_texture(YAF_TextureButtonsPanel, Panel):
return False
return ((context.material or context.world or context.brush or context.texture \
- or context.particle_system or isinstance(context.space_data.pin_id, bpy.types.ParticleSettings)) \
+ or context.particle_system or isinstance(context.space_data.pin_id, ParticleSettings)) \
and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
- slot = context.texture_slot
- node = context.texture_node
+ slot = getattr(context, "texture_slot", None)
+ node = getattr(context, "texture_node", None)
space = context.space_data
tex = context.texture
idblock = context_tex_datablock(context)
pin_id = space.pin_id
- if space.use_pin_id and not isinstance(pin_id, bpy.types.Texture):
+ if space.use_pin_id and not isinstance(pin_id, Texture):
idblock = pin_id
pin_id = None
if not space.use_pin_id:
layout.prop(space, "texture_context", expand=True)
- tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, bpy.types.Brush))
+ tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, Brush))
if tex_collection:
row = layout.row()
@@ -78,7 +84,7 @@ class YAF_TEXTURE_PT_context_texture(YAF_TextureButtonsPanel, Panel):
col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")
- split = layout.split(percentage=0.75)
+ split = layout.split(percentage=0.65)
col = split.column()
if tex_collection:
@@ -94,8 +100,7 @@ class YAF_TEXTURE_PT_context_texture(YAF_TextureButtonsPanel, Panel):
col = split.column()
if tex:
- layout.separator()
- split = layout.split(percentage=0.3)
+ split = layout.split(percentage=0.2)
if tex.use_nodes:
@@ -104,7 +109,7 @@ class YAF_TEXTURE_PT_context_texture(YAF_TextureButtonsPanel, Panel):
split.prop(slot, "output_node", text="")
else:
- split.label(text="Texture type:")
+ split.label(text="Type:")
split.prop(tex, "yaf_tex_type", text="")
@@ -124,6 +129,10 @@ class YAF_TEXTURE_PT_preview(YAF_TextureButtonsPanel, Panel):
else:
layout.template_preview(tex, slot=slot)
+ #Show Alpha Button for Brush Textures, see #29502
+ if context.space_data.texture_context == 'BRUSH':
+ layout.prop(tex, "use_preview_alpha")
+
class YAF_TextureSlotPanel(YAF_TextureButtonsPanel):
COMPAT_ENGINES = {'YAFA_RENDER'}
@@ -147,6 +156,7 @@ class YAF_TextureTypePanel(YAF_TextureButtonsPanel):
return tex and ((tex.yaf_tex_type == cls.tex_type and not tex.use_nodes) and (engine in cls.COMPAT_ENGINES))
+# --- YafaRay's own Texture Type Panels --- #
class YAF_TEXTURE_PT_clouds(YAF_TextureTypePanel, Panel):
bl_label = "Clouds"
tex_type = 'CLOUDS'
@@ -230,7 +240,7 @@ class YAF_TEXTURE_PT_blend(YAF_TextureTypePanel, Panel):
tex = context.texture
layout.prop(tex, "progression")
- if tex.progression != 'LINEAR': # TODO: remove this if other progression types are supported
+ if tex.progression not in 'LINEAR': # TODO: remove this if other progression types are supported
layout.label(text="Not yet supported in YafaRay")
else:
layout.label(text=" ")
@@ -401,6 +411,22 @@ class YAF_TEXTURE_PT_distortednoise(YAF_TextureTypePanel, Panel):
split.prop(tex, "noise_scale", text="Size")
+class YAF_TEXTURE_PT_ocean(YAF_TextureTypePanel, Panel):
+ bl_label = "Ocean"
+ tex_type = 'OCEAN'
+ COMPAT_ENGINES = {'YAFA_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+ ot = tex.ocean
+
+ col = layout.column()
+ col.prop(ot, "ocean_object")
+ col.prop(ot, "output")
+
+
class YAF_TEXTURE_PT_mapping(YAF_TextureSlotPanel, Panel):
bl_label = "YafaRay Mapping (Map Input)"
COMPAT_ENGINES = {'YAFA_RENDER'}
@@ -408,7 +434,7 @@ class YAF_TEXTURE_PT_mapping(YAF_TextureSlotPanel, Panel):
@classmethod
def poll(cls, context):
idblock = context_tex_datablock(context)
- if isinstance(idblock, bpy.types.Brush) and not context.sculpt_object:
+ if isinstance(idblock, Brush) and not context.sculpt_object:
return False
if not getattr(context, "texture_slot", None):
@@ -425,7 +451,7 @@ class YAF_TEXTURE_PT_mapping(YAF_TextureSlotPanel, Panel):
tex = context.texture_slot
# textype = context.texture
- if not isinstance(idblock, bpy.types.Brush):
+ if not isinstance(idblock, Brush):
split = layout.split(percentage=0.3)
col = split.column()
col.label(text="Coordinates:")
@@ -450,7 +476,7 @@ class YAF_TEXTURE_PT_mapping(YAF_TextureSlotPanel, Panel):
split.label(text="Object:")
split.prop(tex, "object", text="")
- if isinstance(idblock, bpy.types.Brush):
+ if isinstance(idblock, Brush):
if context.sculpt_object:
layout.label(text="Brush Mapping:")
layout.prop(tex, "map_mode", expand=True)
@@ -459,7 +485,7 @@ class YAF_TEXTURE_PT_mapping(YAF_TextureSlotPanel, Panel):
row.active = tex.map_mode in {'FIXED', 'TILED'}
row.prop(tex, "angle")
else:
- if isinstance(idblock, bpy.types.Material):
+ if isinstance(idblock, Material):
split = layout.split(percentage=0.3)
split.label(text="Projection:")
split.prop(tex, "mapping", text="")
@@ -492,7 +518,7 @@ class YAF_TEXTURE_PT_influence(YAF_TextureSlotPanel, Panel):
@classmethod
def poll(cls, context):
idblock = context_tex_datablock(context)
- if isinstance(idblock, bpy.types.Brush):
+ if isinstance(idblock, Brush):
return False
if not getattr(context, "texture_slot", None):
@@ -537,7 +563,7 @@ class YAF_TEXTURE_PT_influence(YAF_TextureSlotPanel, Panel):
materialShaderNodes["shinydiffusemat"] = ["DiffuseColor", "MirrorAmount", "MirrorColor", "Transparency", "Translucency", "Bump"]
materialShaderNodes["blend"] = ["BlendAmount"]
- if isinstance(idblock, bpy.types.Material):
+ if isinstance(idblock, Material):
nodes = materialShaderNodes[idblock.mat_type]
col = layout.column()
@@ -547,7 +573,7 @@ class YAF_TEXTURE_PT_influence(YAF_TextureSlotPanel, Panel):
if node == "Bump" and getattr(tex, "use_map_normal") and texture.yaf_tex_type == 'IMAGE':
col.prop(texture, "yaf_is_normal_map", "Use map as normal map")
- elif isinstance(idblock, bpy.types.World): # for setup world texture
+ elif isinstance(idblock, World): # for setup world texture
split = layout.split()
col = split.column()
@@ -558,7 +584,7 @@ class YAF_TEXTURE_PT_influence(YAF_TextureSlotPanel, Panel):
factor_but(col, "use_map_zenith_up", "zenith_up_factor", "Zenith Up")
factor_but(col, "use_map_zenith_down", "zenith_down_factor", "Zenith Down")
- if not isinstance(idblock, bpy.types.ParticleSettings) and not isinstance(idblock, bpy.types.World):
+ if not isinstance(idblock, ParticleSettings) and not isinstance(idblock, World):
split = layout.split()
col = split.column()
@@ -570,7 +596,7 @@ class YAF_TEXTURE_PT_influence(YAF_TextureSlotPanel, Panel):
col.prop(tex, "invert", text="Negative")
col.prop(tex, "use_stencil")
- if isinstance(idblock, bpy.types.Material) or isinstance(idblock, bpy.types.World):
+ if isinstance(idblock, Material) or isinstance(idblock, World):
layout.separator()
layout.row().prop(tex, "default_value", text="Default Value", slider=True)
--
yafaray-exporter packaging
More information about the pkg-multimedia-commits
mailing list