Skip to content

Commit

Permalink
Add the new addons from 2.79 - Pov Ray Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ReinerBforartists committed Aug 11, 2017
1 parent eac0c81 commit ce07786
Show file tree
Hide file tree
Showing 21 changed files with 7,348 additions and 1,067 deletions.
943 changes: 826 additions & 117 deletions release/scripts/addons/render_povray/__init__.py

Large diffs are not rendered by default.

115 changes: 62 additions & 53 deletions release/scripts/addons/render_povray/nodes.py
Expand Up @@ -36,8 +36,8 @@



############### object
############### object

class ObjectNodeTree(bpy.types.NodeTree):
'''Povray Material Nodes'''

Expand All @@ -54,7 +54,7 @@ def get_from_context(cls, context):
ob = context.active_object
if ob and ob.type not in {'LAMP'}:
ma = ob.active_material
if ma != None:
if ma is not None:
nt_name = ma.node_tree
if nt_name != '':
return nt_name, ma, ma
Expand Down Expand Up @@ -305,7 +305,7 @@ class PovrayMappingNode(Node, ObjectNodeTree):
name="Distance exponent",
description="Distance exponent",
min=0.0, max=100.0, default=1.0)

warp_tor_major_radius = FloatProperty(
name="Major radius",
description="Torus is distance from major radius",
Expand Down Expand Up @@ -357,7 +357,7 @@ class PovrayMultiplyNode(Node, ObjectNodeTree):
name="Z",
description="Number of repeats",
min=1.0, max=10000.0, default=1.0)


def init(self, context):
self.outputs.new('NodeSocketVector', "Amount")
Expand Down Expand Up @@ -476,20 +476,22 @@ class PovrayColorImageNode(Node, ObjectNodeTree):
name="Map type",
description="",
items=( ('uv_mapping', "UV", ""),
('0', "Planar", "Default planar mapping."),
('1', "Spherical", "Spherical mapping."),
('2', "Cylindrical", "Cylindrical mapping."),
('5', "Torroidal", "Torus or donut shaped mapping.")),
('0', "Planar", "Default planar mapping"),
('1', "Spherical", "Spherical mapping"),
('2', "Cylindrical", "Cylindrical mapping"),
('5', "Torroidal", "Torus or donut shaped mapping")),
default='0')
image = StringProperty(maxlen=1024) # , subtype="FILE_PATH"
interpolate = EnumProperty(
name="Interpolate",
description="Adding the interpolate keyword can smooth the jagged look of a bitmap.",
items=(('2', "Bilinear", "Gives bilinear interpolation."),
('4', "Normalized", "Gives normalized distance.")),
description="Adding the interpolate keyword can smooth the jagged look of a bitmap",
items=(
('2', "Bilinear", "Gives bilinear interpolation"),
('4', "Normalized", "Gives normalized distance"),
),
default='2')
premultiplied = BoolProperty(default=False)
once = BoolProperty(description="Not to repeat.", default=False)
once = BoolProperty(description="Not to repeat", default=False)

def init(self, context):

Expand All @@ -516,7 +518,7 @@ def draw_buttons(self, context, layout):
split = column.split(percentage=0.8,align=True)
split.prop_search(self,"image",context.blend_data,"images",text="")
split.operator("pov.imageopen",text="",icon="FILESEL")
if im != None:
if im is not None:
column.prop(im,"source",text="")
column.prop(self,"map_type",text="")
column.prop(self,"interpolate",text="")
Expand All @@ -534,7 +536,7 @@ def draw_buttons_ext(self, context, layout):
split = column.split(percentage=0.8,align=True)
split.prop_search(self,"image",context.blend_data,"images",text="")
split.operator("pov.imageopen",text="",icon="FILESEL")
if im != None:
if im is not None:
column.prop(im,"source",text="")
column.prop(self,"map_type",text="")
column.prop(self,"interpolate",text="")
Expand All @@ -554,20 +556,24 @@ class PovrayBumpMapNode(Node, ObjectNodeTree):
map_type = bpy.props.EnumProperty(
name="Map type",
description="",
items=( ('uv_mapping', "UV", ""),
('0', "Planar", "Default planar mapping."),
('1', "Spherical", "Spherical mapping."),
('2', "Cylindrical", "Cylindrical mapping."),
('5', "Torroidal", "Torus or donut shaped mapping.")),
items=(
('uv_mapping', "UV", ""),
('0', "Planar", "Default planar mapping"),
('1', "Spherical", "Spherical mapping"),
('2', "Cylindrical", "Cylindrical mapping"),
('5', "Torroidal", "Torus or donut shaped mapping")
),
default='0')
image = StringProperty(maxlen=1024) # , subtype="FILE_PATH"
interpolate = EnumProperty(
name="Interpolate",
description="Adding the interpolate keyword can smooth the jagged look of a bitmap.",
items=(('2', "Bilinear", "Gives bilinear interpolation."),
('4', "Normalized", "Gives normalized distance.")),
description="Adding the interpolate keyword can smooth the jagged look of a bitmap",
items=(
('2', "Bilinear", "Gives bilinear interpolation"),
('4', "Normalized", "Gives normalized distance"),
),
default='2')
once = BoolProperty(description="Not to repeat.", default=False)
once = BoolProperty(description="Not to repeat", default=False)

def init(self, context):

Expand All @@ -592,7 +598,7 @@ def draw_buttons(self, context, layout):
split = column.split(percentage=0.8,align=True)
split.prop_search(self,"image",context.blend_data,"images",text="")
split.operator("pov.imageopen",text="",icon="FILESEL")
if im != None:
if im is not None:
column.prop(im,"source",text="")
column.prop(self,"map_type",text="")
column.prop(self,"interpolate",text="")
Expand All @@ -608,7 +614,7 @@ def draw_buttons_ext(self, context, layout):
split = column.split(percentage=0.8,align=True)
split.prop_search(self,"image",context.blend_data,"images",text="")
split.operator("pov.imageopen",text="",icon="FILESEL")
if im != None:
if im is not None:
column.prop(im,"source",text="")
column.prop(self,"map_type",text="")
column.prop(self,"interpolate",text="")
Expand All @@ -626,21 +632,25 @@ class PovrayImagePatternNode(Node, ObjectNodeTree):
map_type = bpy.props.EnumProperty(
name="Map type",
description="",
items=( ('uv_mapping', "UV", ""),
('0', "Planar", "Default planar mapping."),
('1', "Spherical", "Spherical mapping."),
('2', "Cylindrical", "Cylindrical mapping."),
('5', "Torroidal", "Torus or donut shaped mapping.")),
items=(
('uv_mapping', "UV", ""),
('0', "Planar", "Default planar mapping"),
('1', "Spherical", "Spherical mapping"),
('2', "Cylindrical", "Cylindrical mapping"),
('5', "Torroidal", "Torus or donut shaped mapping"),
),
default='0')
image = StringProperty(maxlen=1024) # , subtype="FILE_PATH"
interpolate = EnumProperty(
name="Interpolate",
description="Adding the interpolate keyword can smooth the jagged look of a bitmap.",
items=(('2', "Bilinear", "Gives bilinear interpolation."),
('4', "Normalized", "Gives normalized distance.")),
description="Adding the interpolate keyword can smooth the jagged look of a bitmap",
items=(
('2', "Bilinear", "Gives bilinear interpolation"),
('4', "Normalized", "Gives normalized distance"),
),
default='2')
premultiplied = BoolProperty(default=False)
once = BoolProperty(description="Not to repeat.", default=False)
once = BoolProperty(description="Not to repeat", default=False)
use_alpha = BoolProperty(default=True)
def init(self, context):

Expand All @@ -659,7 +669,7 @@ def draw_buttons(self, context, layout):
split = column.split(percentage=0.8,align=True)
split.prop_search(self,"image",context.blend_data,"images",text="")
split.operator("pov.imageopen",text="",icon="FILESEL")
if im != None:
if im is not None:
column.prop(im,"source",text="")
column.prop(self,"map_type",text="")
column.prop(self,"interpolate",text="")
Expand All @@ -678,7 +688,7 @@ def draw_buttons_ext(self, context, layout):
split = column.split(percentage=0.8,align=True)
split.prop_search(self,"image",context.blend_data,"images",text="")
split.operator("pov.imageopen",text="",icon="FILESEL")
if im != None:
if im is not None:
column.prop(im,"source",text="")
column.prop(self,"map_type",text="")
column.prop(self,"interpolate",text="")
Expand Down Expand Up @@ -737,20 +747,20 @@ class ShaderPatternNode(Node, ObjectNodeTree):
spiral_arms = FloatProperty(
name="Number",
description="",
min=0.0, max=256.0, default=2.0)
min=0.0, max=256.0, default=2.0)

tiling_number = IntProperty(
name="Number",
description="",
min=1, max=27, default=1)
min=1, max=27, default=1)

gradient_orient = EnumProperty(
name="Orient",
description="",
items=(('x', "X", ""),
('y', "Y", ""),
('z', "Z", "")),
default='x')
default='x')

def init(self, context):

Expand Down Expand Up @@ -788,17 +798,17 @@ class ShaderTextureMapNode(Node, ObjectNodeTree):
brick_size_x = FloatProperty(
name="X",
description="",
min=0.0000, max=1.0000, default=0.2500)
min=0.0000, max=1.0000, default=0.2500)

brick_size_y = FloatProperty(
name="Y",
description="",
min=0.0000, max=1.0000, default=0.0525)

brick_size_z = FloatProperty(
name="Z",
description="",
min=0.0000, max=1.0000, default=0.1250)
min=0.0000, max=1.0000, default=0.1250)

brick_mortar = FloatProperty(
name="Mortar",
Expand Down Expand Up @@ -850,17 +860,17 @@ class ShaderNormalMapNode(Node, ObjectNodeTree):
brick_size_x = FloatProperty(
name="X",
description="",
min=0.0000, max=1.0000, default=0.2500)
min=0.0000, max=1.0000, default=0.2500)

brick_size_y = FloatProperty(
name="Y",
description="",
min=0.0000, max=1.0000, default=0.0525)

brick_size_z = FloatProperty(
name="Z",
description="",
min=0.0000, max=1.0000, default=0.1250)
min=0.0000, max=1.0000, default=0.1250)

brick_mortar = FloatProperty(
name="Mortar",
Expand All @@ -878,7 +888,7 @@ def init(self, context):

def draw_buttons(self, context, layout):
#for i, inp in enumerate(self.inputs):

if self.inputs[0].default_value =='brick':
layout.prop(self, "brick_mortar")
layout.label("Brick size:")
Expand Down Expand Up @@ -1015,7 +1025,7 @@ def draw_label(self):
#################################Operators########################################
##################################################################################


class NODE_OT_iso_add(bpy.types.Operator):
bl_idname = "pov.nodeisoadd"
bl_label = "Create iso props"
Expand Down Expand Up @@ -1088,7 +1098,7 @@ class NODE_OT_povray_node_output_add(bpy.types.Operator):

def execute(self, context):
tree=bpy.context.object.active_material.node_tree
tmap = tree.nodes.new('ShaderNodeOutputMaterial')
tmap = tree.nodes.new('ShaderNodeOutputMaterial')
bpy.context.object.active_material.node_tree.nodes.active=tmap
for inp in tmap.inputs:
tmap.inputs.remove(inp)
Expand Down Expand Up @@ -1249,7 +1259,7 @@ def modal(self, context, event):
def invoke(self, context, event):
context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}

class UpdatePreviewMaterial(bpy.types.Operator):
'''Operator update preview material'''
bl_idname = "node.updatepreview"
Expand Down Expand Up @@ -1294,6 +1304,5 @@ def execute(self, context):
mapstr = "Node Editor"
map = conf.keymaps[mapstr]
map.keymap_items.new("node.updatepreview",type='RIGHTMOUSE',value="PRESS")
return {'FINISHED'}


return {'FINISHED'}

0 comments on commit ce07786

Please sign in to comment.