Newer
Older
row.prop(tex, "mapping_y", text="")
row.prop(tex, "mapping_z", text="")
row = layout.row()
row.column().prop(tex, "offset")
row.column().prop(tex, "scale")
class TEXTURE_PT_POV_influence(TextureSlotPanel, Panel):
"""Use this class to define pov texture influence buttons."""
bl_label = "Influence"
COMPAT_ENGINES = {"POVRAY_RENDER"}
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
@classmethod
def poll(cls, context):
idblock = pov_context_tex_datablock(context)
if (
# isinstance(idblock, Brush) and # Brush used for everything since 2.8
context.scene.texture_context
== "OTHER"
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
): # XXX replace by isinstance(idblock, bpy.types.Brush) and ...
return False
# Specify below also for pov_world_texture_slots, lights etc.
# to display for various types of slots but only when any
if not getattr(idblock, "pov_texture_slots", 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 = idblock.pov_texture_slots[
idblock.pov.active_texture_index
] # bpy.data.textures[mat.active_texture_index]
# below tex unused yet ...maybe for particles?
try:
tex = bpy.data.textures[
idblock.pov_texture_slots[idblock.pov.active_texture_index].texture
] # NOT USED
except KeyError:
tex = None # NOT USED
def factor_but(layout, toggle, factor, name):
row = layout.row(align=True)
row.prop(texslot, toggle, text="")
sub = row.row(align=True)
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"}:
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
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")
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":
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
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):
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 = split.column()
# 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):
"""Use this class to define pov texture gamma buttons."""
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")
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
def draw(self, context):
layout = self.layout
tex = context.texture
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
# tex = context.texture
# col = layout.column()
# col.label(text="Replace properties with:")
# col.prop(tex.pov, "replacement_text", text="")
classes = (
WORLD_TEXTURE_SLOTS_UL_POV_layerlist,
TEXTURE_MT_POV_specials,
# TEXTURE_PT_context # todo: solve UI design for painting
TEXTURE_PT_POV_context_texture,
TEXTURE_PT_colors,
TEXTURE_PT_POV_type,
TEXTURE_PT_POV_preview,
TEXTURE_PT_POV_parameters,
TEXTURE_PT_POV_tex_gamma,
MATERIAL_TEXTURE_SLOTS_UL_POV_layerlist,
TEXTURE_OT_POV_texture_slot_add,
TEXTURE_OT_POV_texture_slot_remove,
TEXTURE_OT_POV_context_texture_update,
TEXTURE_PT_POV_influence,
TEXTURE_PT_POV_mapping,
)
def register():
for cls in classes:
register_class(cls)
def unregister():
for cls in reversed(classes):
# if cls != TEXTURE_PT_context:
unregister_class(cls)