Newer
Older
else:
split.label(text="Type:")
split.prop(tex, "type", text="")
return
tex_collection = (pin_id is None) and (node is None) and (spacedependant.texture_context not in ('LINESTYLE','OTHER'))
if tex_collection:
pov = getattr(context, "pov", None)
active_texture_index = getattr(spacedependant, "active_texture_index", None)
print(active_texture_index)
row = layout.row()
row.template_list("TEXTURE_UL_texslots", "", idblock, "texture_slots",
idblock, "active_texture_index", rows=2, maxrows=16, type="DEFAULT")
# row.template_list("WORLD_TEXTURE_SLOTS_UL_List", "texture_slots", world,
# world.texture_slots, world, "active_texture_index", rows=2)
col = row.column(align=True)
col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
col.menu("TEXTURE_MT_POV_specials", icon='DOWNARROW_HLT', text="")
if tex_collection:
layout.template_ID(idblock, "active_texture", new="texture.new")
elif node:
layout.template_ID(node, "texture", new="texture.new")
elif idblock:
layout.template_ID(idblock, "texture", new="texture.new")
if pin_id:
layout.template_ID(space, "pin_id")
if tex:
split = layout.split(factor=0.2)
if tex.use_nodes:
if slot:
split.label(text="Output:")
split.prop(slot, "output_node", text="")
else:
split.label(text="Type:")
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
class TEXTURE_PT_colors(TextureButtonsPanel, Panel):
bl_label = "Colors"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'POVRAY_RENDER'}
def draw(self, context):
layout = self.layout
tex = context.texture
layout.prop(tex, "use_color_ramp", text="Ramp")
if tex.use_color_ramp:
layout.template_color_ramp(tex, "color_ramp", expand=True)
split = layout.split()
col = split.column()
col.label(text="RGB Multiply:")
sub = col.column(align=True)
sub.prop(tex, "factor_red", text="R")
sub.prop(tex, "factor_green", text="G")
sub.prop(tex, "factor_blue", text="B")
col = split.column()
col.label(text="Adjust:")
col.prop(tex, "intensity")
col.prop(tex, "contrast")
col.prop(tex, "saturation")
col = layout.column()
col.prop(tex, "use_clamp", text="Clamp")
# Texture Slot Panels #
class MATERIAL_OT_POV_texture_slot_add(Operator):
bl_idname = "pov.textureslotadd"
bl_label = "Add"
bl_description = "Add texture_slot"
bl_options = {'REGISTER', 'UNDO'}
COMPAT_ENGINES = {'POVRAY_RENDER'}
def execute(self,context):
tex = bpy.data.textures.new(name = 'Texture',type = 'IMAGE')
tex.use_fake_user = True
ob = context.scene.view_layers["View Layer"].objects.active
slot = ob.active_material.pov_texture_slots.add()
slot.name = tex.name
slot.texture = tex.name
return {'FINISHED'}
class MATERIAL_OT_POV_texture_slot_remove(Operator):
bl_idname = "pov.textureslotremove"
bl_label = "Remove"
bl_description = "Remove texture_slot"
bl_options = {'REGISTER', 'UNDO'}
COMPAT_ENGINES = {'POVRAY_RENDER'}
def execute(self,context):
pass
# tex = bpy.data.textures.new()
# tex_slot = context.object.active_material.pov_texture_slots.add()
# tex_slot.name = tex.name
return {'FINISHED'}
class TextureSlotPanel(TextureButtonsPanel):
COMPAT_ENGINES = {'POVRAY_RENDER'}
@classmethod
def poll(cls, context):
if not hasattr(context, "pov_texture_slot"):
return False
engine = context.scene.render.engine
return TextureButtonsPanel.poll(cls, context) and (engine in cls.COMPAT_ENGINES)
class TEXTURE_PT_POV_type(TextureButtonsPanel, Panel):
bl_label = "POV Textures"
COMPAT_ENGINES = {'POVRAY_RENDER'}
bl_options = {'HIDE_HEADER'}
Maurice Raybaud
committed
def draw(self, context):
layout = self.layout
tex = context.texture
split.label(text="POV:")
split.prop(tex.pov, "tex_pattern_type", text="")
# row = layout.row()
# row.template_list("WORLD_TEXTURE_SLOTS_UL_List", "texture_slots", world,
# world.texture_slots, world, "active_texture_index")
class TEXTURE_PT_POV_preview(TextureButtonsPanel, Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'POVRAY_RENDER'}
bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
if not hasattr(context, "pov_texture_slot"):
return False
tex=context.texture
mat=bpy.context.active_object.active_material
return (tex and (tex.pov.tex_pattern_type != 'emulator') and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
tex = context.texture
slot = getattr(context, "pov_texture_slot", None)
idblock = pov_context_tex_datablock(context)
layout = self.layout
# if idblock:
# layout.template_preview(tex, parent=idblock, slot=slot)
if tex.pov.tex_pattern_type != 'emulator':
layout.operator("tex.preview_update")
else:
layout.template_preview(tex, slot=slot)
class TEXTURE_PT_POV_parameters(TextureButtonsPanel, Panel):
bl_label = "POV Pattern Options"
COMPAT_ENGINES = {'POVRAY_RENDER'}
def draw(self, context):
mat = bpy.context.active_object.active_material
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
layout = self.layout
tex = context.texture
align=True
if tex is not None and tex.pov.tex_pattern_type != 'emulator':
if tex.pov.tex_pattern_type == 'agate':
layout.prop(tex.pov, "modifier_turbulence", text="Agate Turbulence")
if tex.pov.tex_pattern_type in {'spiral1', 'spiral2'}:
layout.prop(tex.pov, "modifier_numbers", text="Number of arms")
if tex.pov.tex_pattern_type == 'tiling':
layout.prop(tex.pov, "modifier_numbers", text="Pattern number")
if tex.pov.tex_pattern_type == 'magnet':
layout.prop(tex.pov, "magnet_style", text="Magnet style")
if tex.pov.tex_pattern_type == 'quilted':
row = layout.row(align=align)
row.prop(tex.pov, "modifier_control0", text="Control0")
row.prop(tex.pov, "modifier_control1", text="Control1")
if tex.pov.tex_pattern_type == 'brick':
col = layout.column(align=align)
row = col.row()
row.prop(tex.pov, "brick_size_x", text="Brick size X")
row.prop(tex.pov, "brick_size_y", text="Brick size Y")
row=col.row()
row.prop(tex.pov, "brick_size_z", text="Brick size Z")
row.prop(tex.pov, "brick_mortar", text="Brick mortar")
if tex.pov.tex_pattern_type in {'julia','mandel','magnet'}:
col = layout.column(align=align)
if tex.pov.tex_pattern_type == 'julia':
row = col.row()
row.prop(tex.pov, "julia_complex_1", text="Complex 1")
row.prop(tex.pov, "julia_complex_2", text="Complex 2")
if tex.pov.tex_pattern_type == 'magnet' and tex.pov.magnet_style == 'julia':
row = col.row()
row.prop(tex.pov, "julia_complex_1", text="Complex 1")
row.prop(tex.pov, "julia_complex_2", text="Complex 2")
row=col.row()
if tex.pov.tex_pattern_type in {'julia','mandel'}:
row.prop(tex.pov, "f_exponent", text="Exponent")
row.prop(tex.pov, "magnet_type", text="Type")
row.prop(tex.pov, "f_iter", text="Iterations")
row=col.row()
row.prop(tex.pov, "f_ior", text="Interior")
row.prop(tex.pov, "f_ior_fac", text="Factor I")
row=col.row()
row.prop(tex.pov, "f_eor", text="Exterior")
row.prop(tex.pov, "f_eor_fac", text="Factor E")
layout.label(text="Gradient orientation:")
column_flow = layout.column_flow(columns=3, align=True)
column_flow.prop(tex.pov, "grad_orient_x", text="X")
column_flow.prop(tex.pov, "grad_orient_y", text="Y")
column_flow.prop(tex.pov, "grad_orient_z", text="Z")
if tex.pov.tex_pattern_type == 'pavement':
layout.prop(tex.pov, "pave_sides", text="Pavement:number of sides")
col = layout.column(align=align)
column_flow = col.column_flow(columns=3, align=True)
column_flow.prop(tex.pov, "pave_tiles", text="Tiles")
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
if tex.pov.pave_sides == '4' and tex.pov.pave_tiles == 6:
column_flow.prop(tex.pov, "pave_pat_35", text="Pattern")
if tex.pov.pave_sides == '6' and tex.pov.pave_tiles == 5:
column_flow.prop(tex.pov, "pave_pat_22", text="Pattern")
if tex.pov.pave_sides == '4' and tex.pov.pave_tiles == 5:
column_flow.prop(tex.pov, "pave_pat_12", text="Pattern")
if tex.pov.pave_sides == '3' and tex.pov.pave_tiles == 6:
column_flow.prop(tex.pov, "pave_pat_12", text="Pattern")
if tex.pov.pave_sides == '6' and tex.pov.pave_tiles == 4:
column_flow.prop(tex.pov, "pave_pat_7", text="Pattern")
if tex.pov.pave_sides == '4' and tex.pov.pave_tiles == 4:
column_flow.prop(tex.pov, "pave_pat_5", text="Pattern")
if tex.pov.pave_sides == '3' and tex.pov.pave_tiles == 5:
column_flow.prop(tex.pov, "pave_pat_4", text="Pattern")
if tex.pov.pave_sides == '6' and tex.pov.pave_tiles == 3:
column_flow.prop(tex.pov, "pave_pat_3", text="Pattern")
if tex.pov.pave_sides == '3' and tex.pov.pave_tiles == 4:
column_flow.prop(tex.pov, "pave_pat_3", text="Pattern")
if tex.pov.pave_sides == '4' and tex.pov.pave_tiles == 3:
column_flow.prop(tex.pov, "pave_pat_2", text="Pattern")
if tex.pov.pave_sides == '6' and tex.pov.pave_tiles == 6:
column_flow.label(text="!!! 5 tiles!")
column_flow.prop(tex.pov, "pave_form", text="Form")
if tex.pov.tex_pattern_type == 'function':
layout.prop(tex.pov, "func_list", text="Functions")
if tex.pov.tex_pattern_type == 'function' and tex.pov.func_list != "NONE":
func = None
if tex.pov.func_list in {"f_noise3d", "f_ph", "f_r", "f_th"}:
func = 0
if tex.pov.func_list in {"f_comma","f_crossed_trough","f_cubic_saddle",
"f_cushion","f_devils_curve","f_enneper","f_glob",
"f_heart","f_hex_x","f_hex_y","f_hunt_surface",
"f_klein_bottle","f_kummer_surface_v1",
"f_lemniscate_of_gerono","f_mitre","f_nodal_cubic",
"f_noise_generator","f_odd","f_paraboloid","f_pillow",
"f_piriform","f_quantum","f_quartic_paraboloid",
"f_quartic_saddle","f_sphere","f_steiners_roman",
"f_torus_gumdrop","f_umbrella"}:
func = 1
if tex.pov.func_list in {"f_bicorn","f_bifolia","f_boy_surface","f_superellipsoid",
"f_torus"}:
func = 2
if tex.pov.func_list in {"f_ellipsoid","f_folium_surface","f_hyperbolic_torus",
"f_kampyle_of_eudoxus","f_parabolic_torus",
"f_quartic_cylinder","f_torus2"}:
func = 3
if tex.pov.func_list in {"f_blob2","f_cross_ellipsoids","f_flange_cover",
"f_isect_ellipsoids","f_kummer_surface_v2",
"f_ovals_of_cassini","f_rounded_box","f_spikes_2d",
"f_strophoid"}:
if tex.pov.func_list in {"f_algbr_cyl1","f_algbr_cyl2","f_algbr_cyl3",
"f_algbr_cyl4","f_blob","f_mesh1","f_poly4","f_spikes"}:
if tex.pov.func_list in {"f_devils_curve_2d","f_dupin_cyclid",
"f_folium_surface_2d","f_hetero_mf",
"f_kampyle_of_eudoxus_2d","f_lemniscate_of_gerono_2d",
"f_polytubes","f_ridge","f_ridged_mf","f_spiral",
"f_witch_of_agnesi"}:
func = 6
if tex.pov.func_list in {"f_helix1","f_helix2","f_piriform_2d","f_strophoid_2d"}:
func = 7
if tex.pov.func_list == "f_helical_torus":
func = 8
column_flow = layout.column_flow(columns=3, align=True)
column_flow.prop(tex.pov, "func_plus_x", text="")
column_flow.prop(tex.pov, "func_x", text="Value")
column_flow = layout.column_flow(columns=3, align=True)
column_flow.prop(tex.pov, "func_plus_y", text="")
column_flow.prop(tex.pov, "func_y", text="Value")
column_flow = layout.column_flow(columns=3, align=True)
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
column_flow.prop(tex.pov, "func_plus_z", text="")
column_flow.prop(tex.pov, "func_z", text="Value")
row=layout.row(align=align)
if func > 0:
row.prop(tex.pov, "func_P0", text="P0")
if func > 1:
row.prop(tex.pov, "func_P1", text="P1")
row=layout.row(align=align)
if func > 2:
row.prop(tex.pov, "func_P2", text="P2")
if func > 3:
row.prop(tex.pov, "func_P3", text="P3")
row=layout.row(align=align)
if func > 4:
row.prop(tex.pov, "func_P4", text="P4")
if func > 5:
row.prop(tex.pov, "func_P5", text="P5")
row=layout.row(align=align)
if func > 6:
row.prop(tex.pov, "func_P6", text="P6")
if func > 7:
row.prop(tex.pov, "func_P7", text="P7")
row=layout.row(align=align)
row.prop(tex.pov, "func_P8", text="P8")
row.prop(tex.pov, "func_P9", text="P9")
###################################################End Patterns############################
layout.prop(tex.pov, "warp_types", text="Warp types") #warp
if tex.pov.warp_types == "TOROIDAL":
layout.prop(tex.pov, "warp_tor_major_radius", text="Major radius")
if tex.pov.warp_types not in {"CUBIC","NONE"}:
layout.prop(tex.pov, "warp_orientation", text="Warp orientation")
col = layout.column(align=align)
row = col.row()
row.prop(tex.pov, "warp_dist_exp", text="Distance exponent")
row = col.row()
row.prop(tex.pov, "modifier_frequency", text="Frequency")
row.prop(tex.pov, "modifier_phase", text="Phase")
row=layout.row()
row.label(text="Offset:")
row.label(text="Scale:")
row.label(text="Rotate:")
row=col.row()
row.prop(tex.pov, "tex_mov_x", text="X")
row.prop(tex.pov, "tex_scale_x", text="X")
row.prop(tex.pov, "tex_rot_x", text="X")
row=col.row()
row.prop(tex.pov, "tex_mov_y", text="Y")
row.prop(tex.pov, "tex_scale_y", text="Y")
row.prop(tex.pov, "tex_rot_y", text="Y")
row=col.row()
row.prop(tex.pov, "tex_mov_z", text="Z")
row.prop(tex.pov, "tex_scale_z", text="Z")
row.prop(tex.pov, "tex_rot_z", text="Z")
row=layout.row()
row.label(text="Turbulence:")
row=col.row()
row.prop(tex.pov, "warp_turbulence_x", text="X")
row.prop(tex.pov, "modifier_octaves", text="Octaves")
row=col.row()
row.prop(tex.pov, "warp_turbulence_y", text="Y")
row.prop(tex.pov, "modifier_lambda", text="Lambda")
row=col.row()
row.prop(tex.pov, "warp_turbulence_z", text="Z")
row.prop(tex.pov, "modifier_omega", text="Omega")
class TEXTURE_PT_POV_influence(TextureSlotPanel, Panel):
bl_label = "Influence"
COMPAT_ENGINES = {'POVRAY_RENDER'}
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
# bl_context = 'texture'
idblock = pov_context_tex_datablock(context)
if (isinstance(idblock, Brush) and bpy.context.scene.texture_context == 'OTHER'): #XXX replace by bpy.types.Brush?
# if not getattr(context, "pov_texture_slot", None):
# return False
engine = context.scene.render.engine
return (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
idblock = pov_context_tex_datablock(context)
# tex = context.pov_texture_slot
mat = bpy.context.active_object.active_material
texslot = mat.pov_texture_slots[mat.active_texture_index] #bpy.data.textures[mat.active_texture_index]
tex = bpy.data.textures[mat.pov_texture_slots[mat.active_texture_index].texture]
def factor_but(layout, toggle, factor, name):
row = layout.row(align=True)
row.prop(texslot, toggle, text="")
sub.active = getattr(texslot, toggle)
sub.prop(texslot, factor, text=name, slider=True)
return sub # XXX, temp. use_map_normal needs to override.
if isinstance(idblock, Material):
split = layout.split()
col = split.column()
if idblock.pov.type in {'SURFACE', 'WIRE'}:
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
split = layout.split()
col = split.column()
col.label(text="Diffuse:")
factor_but(col, "use_map_diffuse", "diffuse_factor", "Intensity")
factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
factor_but(col, "use_map_translucency", "translucency_factor", "Translucency")
col.label(text="Specular:")
factor_but(col, "use_map_specular", "specular_factor", "Intensity")
factor_but(col, "use_map_color_spec", "specular_color_factor", "Color")
factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")
col = split.column()
col.label(text="Shading:")
factor_but(col, "use_map_ambient", "ambient_factor", "Ambient")
factor_but(col, "use_map_emit", "emit_factor", "Emit")
factor_but(col, "use_map_mirror", "mirror_factor", "Mirror")
factor_but(col, "use_map_raymir", "raymir_factor", "Ray Mirror")
col.label(text="Geometry:")
# XXX replace 'or' when displacement is fixed to not rely on normal influence value.
sub_tmp = factor_but(col, "use_map_normal", "normal_factor", "Normal")
sub_tmp.active = (texslot.use_map_normal or texslot.use_map_displacement)
# END XXX
factor_but(col, "use_map_warp", "warp_factor", "Warp")
factor_but(col, "use_map_displacement", "displacement_factor", "Displace")
# ~ sub = col.column()
# ~ sub.active = texslot.use_map_translucency or texslot.map_emit or texslot.map_alpha or texslot.map_raymir or texslot.map_hardness or texslot.map_ambient or texslot.map_specularity or texslot.map_reflection or texslot.map_mirror
#~ sub.prop(texslot, "default_value", text="Amount", slider=True)
elif idblock.pov.type == 'HALO':
layout.label(text="Halo:")
split = layout.split()
col = split.column()
factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
col = split.column()
factor_but(col, "use_map_raymir", "raymir_factor", "Size")
factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")
factor_but(col, "use_map_translucency", "translucency_factor", "Add")
elif idblock.pov.type == 'VOLUME':
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
layout.label(text="Volume:")
split = layout.split()
col = split.column()
factor_but(col, "use_map_density", "density_factor", "Density")
factor_but(col, "use_map_emission", "emission_factor", "Emission")
factor_but(col, "use_map_scatter", "scattering_factor", "Scattering")
factor_but(col, "use_map_reflect", "reflection_factor", "Reflection")
col = split.column()
col.label(text=" ")
factor_but(col, "use_map_color_emission", "emission_color_factor", "Emission Color")
factor_but(col, "use_map_color_transmission", "transmission_color_factor", "Transmission Color")
factor_but(col, "use_map_color_reflection", "reflection_color_factor", "Reflection Color")
layout.label(text="Geometry:")
split = layout.split()
col = split.column()
factor_but(col, "use_map_warp", "warp_factor", "Warp")
col = split.column()
factor_but(col, "use_map_displacement", "displacement_factor", "Displace")
elif isinstance(idblock, Light):
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
split = layout.split()
col = split.column()
factor_but(col, "use_map_color", "color_factor", "Color")
col = split.column()
factor_but(col, "use_map_shadow", "shadow_factor", "Shadow")
elif isinstance(idblock, World):
split = layout.split()
col = split.column()
factor_but(col, "use_map_blend", "blend_factor", "Blend")
factor_but(col, "use_map_horizon", "horizon_factor", "Horizon")
col = split.column()
factor_but(col, "use_map_zenith_up", "zenith_up_factor", "Zenith Up")
factor_but(col, "use_map_zenith_down", "zenith_down_factor", "Zenith Down")
elif isinstance(idblock, ParticleSettings):
split = layout.split()
col = split.column()
col.label(text="General:")
factor_but(col, "use_map_time", "time_factor", "Time")
factor_but(col, "use_map_life", "life_factor", "Lifetime")
factor_but(col, "use_map_density", "density_factor", "Density")
factor_but(col, "use_map_size", "size_factor", "Size")
col = split.column()
col.label(text="Physics:")
factor_but(col, "use_map_velocity", "velocity_factor", "Velocity")
factor_but(col, "use_map_damp", "damp_factor", "Damp")
factor_but(col, "use_map_gravity", "gravity_factor", "Gravity")
factor_but(col, "use_map_field", "field_factor", "Force Fields")
layout.label(text="Hair:")
split = layout.split()
col = split.column()
factor_but(col, "use_map_length", "length_factor", "Length")
factor_but(col, "use_map_clump", "clump_factor", "Clump")
factor_but(col, "use_map_twist", "twist_factor", "Twist")
col = split.column()
factor_but(col, "use_map_kink_amp", "kink_amp_factor", "Kink Amplitude")
factor_but(col, "use_map_kink_freq", "kink_freq_factor", "Kink Frequency")
factor_but(col, "use_map_rough", "rough_factor", "Rough")
elif isinstance(idblock, FreestyleLineStyle):
split = layout.split()
col = split.column()
factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
col = split.column()
factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
layout.separator()
if not isinstance(idblock, ParticleSettings):
split = layout.split()
col = split.column()
# col.prop(tex, "blend_type", text="Blend") #deprecated since 2.8
# col.prop(tex, "use_rgb_to_intensity") #deprecated since 2.8
# color is used on gray-scale textures even when use_rgb_to_intensity is disabled.
# col.prop(tex, "color", text="") #deprecated since 2.8
# col.prop(tex, "invert", text="Negative") #deprecated since 2.8
# col.prop(tex, "use_stencil") #deprecated since 2.8
#if isinstance(idblock, (Material, World)):
#col.prop(tex, "default_value", text="DVar", slider=True)
class TEXTURE_PT_POV_tex_gamma(TextureButtonsPanel, Panel):
bl_label = "Image Gamma"
COMPAT_ENGINES = {'POVRAY_RENDER'}
def draw_header(self, context):
tex = context.texture
self.layout.prop(tex.pov, "tex_gamma_enable", text="", icon='SEQ_LUMA_WAVEFORM')
def draw(self, context):
layout = self.layout
tex = context.texture
Bastien Montagne
committed
layout.active = tex.pov.tex_gamma_enable
layout.prop(tex.pov, "tex_gamma_value", text="Gamma Value")
#commented out below UI for texture only custom code inside exported material:
# class TEXTURE_PT_povray_replacement_text(TextureButtonsPanel, Panel):
# bl_label = "Custom POV Code"
# COMPAT_ENGINES = {'POVRAY_RENDER'}
# def draw(self, context):
# layout = self.layout
Maurice Raybaud
committed
# tex = context.texture
Maurice Raybaud
committed
# col = layout.column()
# col.label(text="Replace properties with:")
# col.prop(tex.pov, "replacement_text", text="")
Maurice Raybaud
committed
class OBJECT_PT_POV_obj_parameters(ObjectButtonsPanel, Panel):
bl_label = "POV"
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
return (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
obj = context.object
split = layout.split()
col = split.column(align=True)
Bastien Montagne
committed
col.prop(obj.pov, "importance_value", text="Importance")
Bastien Montagne
committed
col.prop(obj.pov, "collect_photons", text="Receive Photon Caustics")
Maurice Raybaud
committed
if obj.pov.collect_photons:
col.prop(obj.pov, "spacing_multiplier", text="Photons Spacing Multiplier")
split = layout.split()
col = split.column()
col.prop(obj.pov,"hollow")
col.prop(obj.pov,"double_illuminate")
if obj.type == 'META' or obj.pov.curveshape == 'lathe':
#if obj.pov.curveshape == 'sor'
col.prop(obj.pov,"sturm")
col.prop(obj.pov,"no_shadow")
col.prop(obj.pov,"no_image")
col.prop(obj.pov,"no_reflection")
col.prop(obj.pov,"no_radiosity")
col.prop(obj.pov,"inverse")
col.prop(obj.pov,"hierarchy")
# col.prop(obj.pov,"boundorclip",text="Bound / Clip")
# if obj.pov.boundorclip != "none":
# col.prop_search(obj.pov,"boundorclipob",context.blend_data,"objects",text="Object")
# text = "Clipped by"
# if obj.pov.boundorclip == "clipped_by":
# text = "Bounded by"
# col.prop(obj.pov,"addboundorclip",text=text)
Campbell Barton
committed
class OBJECT_PT_POV_obj_sphere(PovDataButtonsPanel, Panel):
bl_label = "POV Sphere"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
return (obj and obj.pov.object_as == 'SPHERE' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
col = layout.column()
if obj.pov.object_as == 'SPHERE':
if obj.pov.unlock_parameters == False:
col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Sphere radius: " + str(obj.pov.sphere_radius))
else:
col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
layout.operator("pov.sphere_update", text="Update",icon="SHADING_RENDERED")
#col.label(text="Parameters:")
col.prop(obj.pov, "sphere_radius", text="Radius of Sphere")
Maurice Raybaud
committed
class OBJECT_PT_POV_obj_cylinder(PovDataButtonsPanel, Panel):
bl_label = "POV Cylinder"
Maurice Raybaud
committed
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
return (obj and obj.pov.object_as == 'CYLINDER' and (engine in cls.COMPAT_ENGINES))
Maurice Raybaud
committed
def draw(self, context):
layout = self.layout
obj = context.object
Maurice Raybaud
committed
col = layout.column()
if obj.pov.object_as == 'CYLINDER':
if obj.pov.unlock_parameters == False:
col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
Maurice Raybaud
committed
col.label(text="Cylinder radius: " + str(obj.pov.cylinder_radius))
col.label(text="Cylinder cap location: " + str(obj.pov.cylinder_location_cap))
else:
col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
Maurice Raybaud
committed
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
layout.operator("pov.cylinder_update", text="Update",icon="MESH_CYLINDER")
Maurice Raybaud
committed
#col.label(text="Parameters:")
col.prop(obj.pov, "cylinder_radius")
col.prop(obj.pov, "cylinder_location_cap")
class OBJECT_PT_POV_obj_cone(PovDataButtonsPanel, Panel):
bl_label = "POV Cone"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
return (obj and obj.pov.object_as == 'CONE' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
col = layout.column()
if obj.pov.object_as == 'CONE':
if obj.pov.unlock_parameters == False:
col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Cone base radius: " + str(obj.pov.cone_base_radius))
col.label(text="Cone cap radius: " + str(obj.pov.cone_cap_radius))
col.label(text="Cone proxy segments: " + str(obj.pov.cone_segments))
col.label(text="Cone height: " + str(obj.pov.cone_height))
else:
col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
layout.operator("pov.cone_update", text="Update",icon="MESH_CONE")
#col.label(text="Parameters:")
col.prop(obj.pov, "cone_base_radius", text="Radius of Cone Base")
col.prop(obj.pov, "cone_cap_radius", text="Radius of Cone Cap")
col.prop(obj.pov, "cone_segments", text="Segmentation of Cone proxy")
col.prop(obj.pov, "cone_height", text="Height of the cone")
class OBJECT_PT_POV_obj_superellipsoid(PovDataButtonsPanel, Panel):
bl_label = "POV Superquadric ellipsoid"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
return (obj and obj.pov.object_as == 'SUPERELLIPSOID' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
col = layout.column()
if obj.pov.object_as == 'SUPERELLIPSOID':
if obj.pov.unlock_parameters == False:
col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Radial segmentation: " + str(obj.pov.se_u))
col.label(text="Lateral segmentation: " + str(obj.pov.se_v))
col.label(text="Ring shape: " + str(obj.pov.se_n1))
col.label(text="Cross-section shape: " + str(obj.pov.se_n2))
col.label(text="Fill up and down: " + str(obj.pov.se_edit))
else:
col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
layout.operator("pov.superellipsoid_update", text="Update",icon="MOD_SUBSURF")
#col.label(text="Parameters:")
col.prop(obj.pov, "se_u")
col.prop(obj.pov, "se_v")
col.prop(obj.pov, "se_n1")
col.prop(obj.pov, "se_n2")
col.prop(obj.pov, "se_edit")
class OBJECT_PT_POV_obj_torus(PovDataButtonsPanel, Panel):
bl_label = "POV Torus"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
return (obj and obj.pov.object_as == 'TORUS' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
col = layout.column()
if obj.pov.object_as == 'TORUS':
if obj.pov.unlock_parameters == False:
col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Torus major radius: " + str(obj.pov.torus_major_radius))
col.label(text="Torus minor radius: " + str(obj.pov.torus_minor_radius))
col.label(text="Torus major segments: " + str(obj.pov.torus_major_segments))
col.label(text="Torus minor segments: " + str(obj.pov.torus_minor_segments))
else:
col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
layout.operator("pov.torus_update", text="Update",icon="MESH_TORUS")
#col.label(text="Parameters:")
col.prop(obj.pov, "torus_major_radius")
col.prop(obj.pov, "torus_minor_radius")
col.prop(obj.pov, "torus_major_segments")
col.prop(obj.pov, "torus_minor_segments")
class OBJECT_PT_POV_obj_supertorus(PovDataButtonsPanel, Panel):
bl_label = "POV SuperTorus"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
return (obj and obj.pov.object_as == 'SUPERTORUS' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
col = layout.column()
if obj.pov.object_as == 'SUPERTORUS':
if obj.pov.unlock_parameters == False:
col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="SuperTorus major radius: " + str(obj.pov.st_major_radius))
col.label(text="SuperTorus minor radius: " + str(obj.pov.st_minor_radius))
col.label(text="SuperTorus major segments: " + str(obj.pov.st_u))
col.label(text="SuperTorus minor segments: " + str(obj.pov.st_v))
col.label(text="SuperTorus Ring Manipulator: " + str(obj.pov.st_ring))
col.label(text="SuperTorus Cross Manipulator: " + str(obj.pov.st_cross))
col.label(text="SuperTorus Internal And External radii: " + str(obj.pov.st_ie))
col.label(text="SuperTorus accuracy: " + str(ob.pov.st_accuracy))
col.label(text="SuperTorus max gradient: " + str(ob.pov.st_max_gradient))
col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
layout.operator("pov.supertorus_update", text="Update",icon="MESH_TORUS")
#col.label(text="Parameters:")
col.prop(obj.pov, "st_major_radius")
col.prop(obj.pov, "st_minor_radius")
col.prop(obj.pov, "st_u")
col.prop(obj.pov, "st_v")
col.prop(obj.pov, "st_ring")
col.prop(obj.pov, "st_cross")
col.prop(obj.pov, "st_ie")
#col.prop(obj.pov, "st_edit") #?
col.prop(obj.pov, "st_accuracy")
col.prop(obj.pov, "st_max_gradient")
class OBJECT_PT_POV_obj_parametric(PovDataButtonsPanel, Panel):
bl_label = "POV Parametric surface"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
return (obj and obj.pov.object_as == 'PARAMETRIC' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
col = layout.column()
if obj.pov.object_as == 'PARAMETRIC':
if obj.pov.unlock_parameters == False:
col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Minimum U: " + str(obj.pov.u_min))
col.label(text="Minimum V: " + str(obj.pov.v_min))
col.label(text="Maximum U: " + str(obj.pov.u_max))
col.label(text="Minimum V: " + str(obj.pov.v_min))
col.label(text="X Function: " + str(obj.pov.x_eq))
col.label(text="Y Function: " + str(obj.pov.y_eq))
col.label(text="Z Function: " + str(obj.pov.x_eq))
else:
col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
layout.operator("pov.parametric_update", text="Update",icon="SCRIPTPLUGINS")
col.prop(obj.pov, "u_min", text="Minimum U")
col.prop(obj.pov, "v_min", text="Minimum V")
col.prop(obj.pov, "u_max", text="Maximum U")
col.prop(obj.pov, "v_max", text="Minimum V")
col.prop(obj.pov, "x_eq", text="X Function")
col.prop(obj.pov, "y_eq", text="Y Function")
col.prop(obj.pov, "z_eq", text="Z Function")
class OBJECT_PT_povray_replacement_text(ObjectButtonsPanel, Panel):
Maurice Raybaud
committed
bl_label = "Custom POV Code"
Campbell Barton
committed
COMPAT_ENGINES = {'POVRAY_RENDER'}
Maurice Raybaud
committed
def draw(self, context):
layout = self.layout
obj = context.object
Maurice Raybaud
committed
col.label(text="Replace properties with:")
Bastien Montagne
committed
col.prop(obj.pov, "replacement_text", text="")
Maurice Raybaud
committed
###############################################################################
# Add Povray Objects
###############################################################################
class VIEW_MT_POV_primitives_add(bpy.types.Menu):
"""Define the menu with presets"""
bl_idname = "VIEW_MT_POV_primitives_add"
bl_label = "Povray"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
def draw(self,context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.menu(VIEW_MT_POV_Basic_Shapes.bl_idname, text = "Primitives",icon="GROUP")
layout.menu(VIEW_MT_POV_import.bl_idname, text = "Import",icon="IMPORT")
class VIEW_MT_POV_Basic_Shapes(bpy.types.Menu):
bl_idname = "POVRAY_MT_basic_shape_tools"
bl_label = "Basic_shapes"
def draw(self,context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("pov.addplane", text="Infinite Plane",icon = 'MESH_PLANE')
layout.operator("pov.addbox", text="Box",icon = 'MESH_CUBE')
layout.operator("pov.addsphere", text="Sphere",icon = 'SHADING_RENDERED')
layout.operator("pov.addcylinder", text="Cylinder",icon="MESH_CYLINDER")
layout.operator("pov.cone_add", text="Cone",icon="MESH_CONE")
layout.operator("pov.addtorus", text="Torus",icon = 'MESH_TORUS')
layout.separator()
layout.operator("pov.addrainbow", text="Rainbow",icon="COLOR")
layout.operator("pov.addlathe", text="Lathe",icon = 'MOD_SCREW')
layout.operator("pov.addprism", text="Prism",icon = 'MOD_SOLIDIFY')
layout.operator("pov.addsuperellipsoid", text="Superquadric Ellipsoid",icon = 'MOD_SUBSURF')
layout.operator("pov.addheightfield", text="Height Field",icon="RNDCURVE")
layout.operator("pov.addspheresweep", text="Sphere Sweep",icon = 'FORCE_CURVE')
layout.separator()
layout.operator("pov.addblobsphere", text="Blob Sphere",icon = 'META_DATA')
layout.separator()
layout.operator("pov.addisosurfacebox", text="Isosurface Box",icon="META_CUBE")
layout.operator("pov.addisosurfacesphere", text="Isosurface Sphere",icon="META_BALL")
layout.operator("pov.addsupertorus", text="Supertorus",icon="SURFACE_NTORUS")
layout.separator()
layout.label(text = "Macro based")
layout.operator("pov.addpolygontocircle", text="Polygon To Circle Blending",icon="MOD_CAST")
layout.operator("pov.addloft", text="Loft",icon="SURFACE_NSURFACE")
Maurice Raybaud
committed
layout.separator()
# Warning if the Add Advanced Objects addon containing
# Add mesh extra objects is not enabled