pov 2.8 fixes

primitive grid radius became size and noise deprecated
This commit is contained in:
Maurice Raybaud 2019-11-24 21:15:49 +01:00
parent a96fa1e611
commit 14d4b8f4e9
1 changed files with 5 additions and 5 deletions

View File

@ -1126,8 +1126,8 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper):
hf_tex = bpy.data.textures.new('%s_hf_image'%im_name, type = 'IMAGE')
hf_tex.image = img
mat = bpy.data.materials.new('Tex_%s_hf'%im_name)
hf_slot = mat.pov_texture_slots.create(-1)
hf_slot.texture = hf_tex
hf_slot = mat.pov_texture_slots.add()
hf_slot.texture = hf_tex.name
#layers = 20*[False]
#layers[0] = True
quality = props.quality
@ -1135,12 +1135,12 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper):
w,h = hf_tex.image.size[:]
w = int(w/res)
h = int(h/res)
bpy.ops.mesh.primitive_grid_add(x_subdivisions=w, y_subdivisions=h,radius = 0.5)
bpy.ops.mesh.primitive_grid_add(x_subdivisions=w, y_subdivisions=h,size = 0.5)
ob = context.object
ob.name = ob.data.name = '%s'%im_name
ob.data.materials.append(mat)
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.noise(factor=1)
# bpy.ops.mesh.noise(factor=1) # TODO replace by a displace modifier as noise deprecated in 2.8
bpy.ops.object.mode_set(mode="OBJECT")
#needs a loop to select by index?
@ -1148,7 +1148,7 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper):
#material just left there for now
mat.texture_slots.clear(-1)
mat.pov_texture_slots.clear()
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.hide(unselected=False)
bpy.ops.object.mode_set(mode="OBJECT")