Merge branch 'master' into 28
[blender.git] / release / scripts / startup / bl_ui / properties_texture.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
3 #  This program is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU General Public License
5 #  as published by the Free Software Foundation; either version 2
6 #  of the License, or (at your option) any later version.
7 #
8 #  This program is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 #  GNU General Public License for more details.
12 #
13 #  You should have received a copy of the GNU General Public License
14 #  along with this program; if not, write to the Free Software Foundation,
15 #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21 from bpy.types import Menu, Panel, UIList
22
23 from bpy.types import (
24     Brush,
25     FreestyleLineStyle,
26     Object,
27     ParticleSettings,
28     Texture,
29 )
30
31 from rna_prop_ui import PropertyPanel
32
33 from .properties_paint_common import brush_texture_settings
34
35
36 class TEXTURE_MT_specials(Menu):
37     bl_label = "Texture Specials"
38     COMPAT_ENGINES = {'BLENDER_RENDER'}
39
40     def draw(self, context):
41         layout = self.layout
42
43         layout.operator("texture.slot_copy", icon='COPYDOWN')
44         layout.operator("texture.slot_paste", icon='PASTEDOWN')
45
46
47 class TEXTURE_UL_texslots(UIList):
48
49     def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
50         ma = data
51         slot = item
52         tex = slot.texture if slot else None
53         if self.layout_type in {'DEFAULT', 'COMPACT'}:
54             if tex:
55                 layout.prop(tex, "name", text="", emboss=False, icon_value=icon)
56             else:
57                 layout.label(text="", icon_value=icon)
58         elif self.layout_type == 'GRID':
59             layout.alignment = 'CENTER'
60             layout.label(text="", icon_value=icon)
61
62
63 def context_tex_datablock(context):
64     idblock = context.brush
65     if idblock:
66         return idblock
67
68     idblock = context.line_style
69     if idblock:
70         return idblock
71
72     if context.particle_system:
73         idblock = context.particle_system.settings
74
75     return idblock
76
77
78 class TextureButtonsPanel:
79     bl_space_type = 'PROPERTIES'
80     bl_region_type = 'WINDOW'
81     bl_context = "texture"
82
83
84 class TEXTURE_PT_preview(TextureButtonsPanel, Panel):
85     bl_label = "Preview"
86     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
87
88     @classmethod
89     def poll(cls, context):
90         tex = context.texture
91         return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.engine in cls.COMPAT_ENGINES)
92
93     def draw(self, context):
94         layout = self.layout
95
96         tex = context.texture
97         slot = getattr(context, "texture_slot", None)
98         idblock = context_tex_datablock(context)
99
100         if idblock:
101             layout.template_preview(tex, parent=idblock, slot=slot)
102         else:
103             layout.template_preview(tex, slot=slot)
104
105         # Show Alpha Button for Brush Textures, see #29502
106         idblock = context_tex_datablock(context)
107         if isinstance(idblock, Brush):
108             layout.prop(tex, "use_preview_alpha")
109
110
111 class TEXTURE_PT_context(TextureButtonsPanel, Panel):
112     bl_label = ""
113     bl_context = "texture"
114     bl_options = {'HIDE_HEADER'}
115     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
116
117     def draw(self, context):
118         layout = self.layout
119
120         tex = context.texture
121         space = context.space_data
122         pin_id = space.pin_id
123         use_pin_id = space.use_pin_id
124         user = context.texture_user
125
126         if not (use_pin_id and isinstance(pin_id, bpy.types.Texture)):
127             pin_id = None
128
129         if not pin_id:
130             layout.template_texture_user()
131
132         if user or pin_id:
133             layout.separator()
134
135             split = layout.split(percentage=0.65)
136             col = split.column()
137
138             if pin_id:
139                 col.template_ID(space, "pin_id")
140             else:
141                 propname = context.texture_user_property.identifier
142                 col.template_ID(user, propname, new="texture.new")
143
144             if tex:
145                 split = layout.split(percentage=0.2)
146                 split.label(text="Type:")
147                 split.prop(tex, "type", text="")
148
149
150 class TEXTURE_PT_node(TextureButtonsPanel, Panel):
151     bl_label = "Node"
152     bl_context = "texture"
153     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
154
155     @classmethod
156     def poll(cls, context):
157         node = context.texture_node
158         return node and (context.engine in cls.COMPAT_ENGINES)
159
160     def draw(self, context):
161         layout = self.layout
162
163         node = context.texture_node
164         ntree = node.id_data
165         layout.template_node_view(ntree, node, None)
166
167
168 class TEXTURE_PT_node_mapping(TextureButtonsPanel, Panel):
169     bl_label = "Mapping"
170     bl_context = "texture"
171     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
172
173     @classmethod
174     def poll(cls, context):
175         node = context.texture_node
176         # TODO(sergey): perform a faster/nicer check?
177         return node and hasattr(node, 'texture_mapping') and (context.engine in cls.COMPAT_ENGINES)
178
179     def draw(self, context):
180         layout = self.layout
181
182         node = context.texture_node
183
184         mapping = node.texture_mapping
185
186         layout.prop(mapping, "vector_type", expand=True)
187
188         row = layout.row()
189
190         row.column().prop(mapping, "translation")
191         row.column().prop(mapping, "rotation")
192         row.column().prop(mapping, "scale")
193
194         layout.label(text="Projection:")
195
196         row = layout.row()
197         row.prop(mapping, "mapping_x", text="")
198         row.prop(mapping, "mapping_y", text="")
199         row.prop(mapping, "mapping_z", text="")
200
201
202 class TEXTURE_PT_colors(TextureButtonsPanel, Panel):
203     bl_label = "Colors"
204     bl_options = {'DEFAULT_CLOSED'}
205     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
206
207     @classmethod
208     def poll(cls, context):
209         tex = context.texture
210         return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.engine in cls.COMPAT_ENGINES)
211
212     def draw(self, context):
213         layout = self.layout
214
215         tex = context.texture
216
217         layout.prop(tex, "use_color_ramp", text="Ramp")
218         if tex.use_color_ramp:
219             layout.template_color_ramp(tex, "color_ramp", expand=True)
220
221         split = layout.split()
222
223         col = split.column()
224         col.label(text="RGB Multiply:")
225         sub = col.column(align=True)
226         sub.prop(tex, "factor_red", text="R")
227         sub.prop(tex, "factor_green", text="G")
228         sub.prop(tex, "factor_blue", text="B")
229
230         col = split.column()
231         col.label(text="Adjust:")
232         col.prop(tex, "intensity")
233         col.prop(tex, "contrast")
234         col.prop(tex, "saturation")
235
236         col = layout.column()
237         col.prop(tex, "use_clamp", text="Clamp")
238
239
240 class TextureTypePanel(TextureButtonsPanel):
241
242     @classmethod
243     def poll(cls, context):
244         tex = context.texture
245         engine = context.engine
246         return tex and ((tex.type == cls.tex_type and not tex.use_nodes) and (engine in cls.COMPAT_ENGINES))
247
248
249 class TEXTURE_PT_clouds(TextureTypePanel, Panel):
250     bl_label = "Clouds"
251     tex_type = 'CLOUDS'
252     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
253
254     def draw(self, context):
255         layout = self.layout
256
257         tex = context.texture
258
259         layout.row().prop(tex, "cloud_type", expand=True)
260         layout.label(text="Noise:")
261         layout.row().prop(tex, "noise_type", text="Type", expand=True)
262         layout.prop(tex, "noise_basis", text="Basis")
263
264         split = layout.split()
265
266         col = split.column()
267         col.prop(tex, "noise_scale", text="Size")
268         col.prop(tex, "noise_depth", text="Depth")
269
270         split.prop(tex, "nabla", text="Nabla")
271
272
273 class TEXTURE_PT_wood(TextureTypePanel, Panel):
274     bl_label = "Wood"
275     tex_type = 'WOOD'
276     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
277
278     def draw(self, context):
279         layout = self.layout
280
281         tex = context.texture
282
283         layout.row().prop(tex, "noise_basis_2", expand=True)
284         layout.row().prop(tex, "wood_type", expand=True)
285
286         col = layout.column()
287         col.active = tex.wood_type in {'RINGNOISE', 'BANDNOISE'}
288         col.label(text="Noise:")
289         col.row().prop(tex, "noise_type", text="Type", expand=True)
290         layout.prop(tex, "noise_basis", text="Basis")
291
292         split = layout.split()
293         split.active = tex.wood_type in {'RINGNOISE', 'BANDNOISE'}
294
295         col = split.column()
296         col.prop(tex, "noise_scale", text="Size")
297         col.prop(tex, "turbulence")
298
299         split.prop(tex, "nabla")
300
301
302 class TEXTURE_PT_marble(TextureTypePanel, Panel):
303     bl_label = "Marble"
304     tex_type = 'MARBLE'
305     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
306
307     def draw(self, context):
308         layout = self.layout
309
310         tex = context.texture
311
312         layout.row().prop(tex, "marble_type", expand=True)
313         layout.row().prop(tex, "noise_basis_2", expand=True)
314         layout.label(text="Noise:")
315         layout.row().prop(tex, "noise_type", text="Type", expand=True)
316         layout.prop(tex, "noise_basis", text="Basis")
317
318         split = layout.split()
319
320         col = split.column()
321         col.prop(tex, "noise_scale", text="Size")
322         col.prop(tex, "noise_depth", text="Depth")
323
324         col = split.column()
325         col.prop(tex, "turbulence")
326         col.prop(tex, "nabla")
327
328
329 class TEXTURE_PT_magic(TextureTypePanel, Panel):
330     bl_label = "Magic"
331     tex_type = 'MAGIC'
332     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
333
334     def draw(self, context):
335         layout = self.layout
336
337         tex = context.texture
338
339         row = layout.row()
340         row.prop(tex, "noise_depth", text="Depth")
341         row.prop(tex, "turbulence")
342
343
344 class TEXTURE_PT_blend(TextureTypePanel, Panel):
345     bl_label = "Blend"
346     tex_type = 'BLEND'
347     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
348
349     def draw(self, context):
350         layout = self.layout
351
352         tex = context.texture
353
354         layout.prop(tex, "progression")
355
356         sub = layout.row()
357
358         sub.active = (tex.progression in {'LINEAR', 'QUADRATIC', 'EASING', 'RADIAL'})
359         sub.prop(tex, "use_flip_axis", expand=True)
360
361
362 class TEXTURE_PT_stucci(TextureTypePanel, Panel):
363     bl_label = "Stucci"
364     tex_type = 'STUCCI'
365     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
366
367     def draw(self, context):
368         layout = self.layout
369
370         tex = context.texture
371
372         layout.row().prop(tex, "stucci_type", expand=True)
373         layout.label(text="Noise:")
374         layout.row().prop(tex, "noise_type", text="Type", expand=True)
375         layout.prop(tex, "noise_basis", text="Basis")
376
377         row = layout.row()
378         row.prop(tex, "noise_scale", text="Size")
379         row.prop(tex, "turbulence")
380
381
382 class TEXTURE_PT_image(TextureTypePanel, Panel):
383     bl_label = "Image"
384     tex_type = 'IMAGE'
385     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
386
387     def draw(self, context):
388         layout = self.layout
389
390         tex = context.texture
391
392         layout.template_image(tex, "image", tex.image_user)
393
394
395 def texture_filter_common(tex, layout):
396     layout.label(text="Filter:")
397     layout.prop(tex, "filter_type", text="")
398     if tex.use_mipmap and tex.filter_type in {'AREA', 'EWA', 'FELINE'}:
399         if tex.filter_type == 'FELINE':
400             layout.prop(tex, "filter_lightprobes", text="Light Probes")
401         else:
402             layout.prop(tex, "filter_eccentricity", text="Eccentricity")
403
404     layout.prop(tex, "filter_size")
405     layout.prop(tex, "use_filter_size_min")
406
407
408 class TEXTURE_PT_image_sampling(TextureTypePanel, Panel):
409     bl_label = "Image Sampling"
410     bl_options = {'DEFAULT_CLOSED'}
411     tex_type = 'IMAGE'
412     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
413
414     def draw(self, context):
415         layout = self.layout
416
417         idblock = context_tex_datablock(context)
418         tex = context.texture
419         slot = getattr(context, "texture_slot", None)
420
421         split = layout.split()
422
423         col = split.column()
424         col.label(text="Alpha:")
425         row = col.row()
426         row.active = bool(tex.image and tex.image.use_alpha)
427         row.prop(tex, "use_alpha", text="Use")
428         col.prop(tex, "use_calculate_alpha", text="Calculate")
429         col.prop(tex, "invert_alpha", text="Invert")
430         col.separator()
431         col.prop(tex, "use_flip_axis", text="Flip X/Y Axis")
432
433         col = split.column()
434
435         col.prop(tex, "use_mipmap")
436         row = col.row()
437         row.active = tex.use_mipmap
438         row.prop(tex, "use_mipmap_gauss")
439         col.prop(tex, "use_interpolation")
440
441         texture_filter_common(tex, col)
442
443
444 class TEXTURE_PT_image_mapping(TextureTypePanel, Panel):
445     bl_label = "Image Mapping"
446     bl_options = {'DEFAULT_CLOSED'}
447     tex_type = 'IMAGE'
448     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
449
450     def draw(self, context):
451         layout = self.layout
452
453         tex = context.texture
454
455         layout.prop(tex, "extension")
456
457         split = layout.split()
458
459         if tex.extension == 'REPEAT':
460             col = split.column(align=True)
461             col.label(text="Repeat:")
462             col.prop(tex, "repeat_x", text="X")
463             col.prop(tex, "repeat_y", text="Y")
464
465             col = split.column(align=True)
466             col.label(text="Mirror:")
467             row = col.row(align=True)
468             row.prop(tex, "use_mirror_x", text="X")
469             row.active = (tex.repeat_x > 1)
470             row = col.row(align=True)
471             row.prop(tex, "use_mirror_y", text="Y")
472             row.active = (tex.repeat_y > 1)
473             layout.separator()
474
475         elif tex.extension == 'CHECKER':
476             col = split.column(align=True)
477             row = col.row(align=True)
478             row.prop(tex, "use_checker_even", text="Even")
479             row.prop(tex, "use_checker_odd", text="Odd")
480
481             col = split.column()
482             col.prop(tex, "checker_distance", text="Distance")
483
484             layout.separator()
485
486         split = layout.split()
487
488         col = split.column(align=True)
489         # col.prop(tex, "crop_rectangle")
490         col.label(text="Crop Minimum:")
491         col.prop(tex, "crop_min_x", text="X")
492         col.prop(tex, "crop_min_y", text="Y")
493
494         col = split.column(align=True)
495         col.label(text="Crop Maximum:")
496         col.prop(tex, "crop_max_x", text="X")
497         col.prop(tex, "crop_max_y", text="Y")
498
499
500 class TEXTURE_PT_musgrave(TextureTypePanel, Panel):
501     bl_label = "Musgrave"
502     tex_type = 'MUSGRAVE'
503     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
504
505     def draw(self, context):
506         layout = self.layout
507
508         tex = context.texture
509
510         layout.prop(tex, "musgrave_type")
511
512         split = layout.split()
513
514         col = split.column()
515         col.prop(tex, "dimension_max", text="Dimension")
516         col.prop(tex, "lacunarity")
517         col.prop(tex, "octaves")
518
519         musgrave_type = tex.musgrave_type
520         col = split.column()
521         if musgrave_type in {'HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'}:
522             col.prop(tex, "offset")
523         col.prop(tex, "noise_intensity", text="Intensity")
524         if musgrave_type in {'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'}:
525             col.prop(tex, "gain")
526
527         layout.label(text="Noise:")
528
529         layout.prop(tex, "noise_basis", text="Basis")
530
531         row = layout.row()
532         row.prop(tex, "noise_scale", text="Size")
533         row.prop(tex, "nabla")
534
535
536 class TEXTURE_PT_voronoi(TextureTypePanel, Panel):
537     bl_label = "Voronoi"
538     tex_type = 'VORONOI'
539     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
540
541     def draw(self, context):
542         layout = self.layout
543
544         tex = context.texture
545
546         split = layout.split()
547
548         col = split.column()
549         col.label(text="Distance Metric:")
550         col.prop(tex, "distance_metric", text="")
551         sub = col.column()
552         sub.active = tex.distance_metric == 'MINKOVSKY'
553         sub.prop(tex, "minkovsky_exponent", text="Exponent")
554         col.label(text="Coloring:")
555         col.prop(tex, "color_mode", text="")
556         col.prop(tex, "noise_intensity", text="Intensity")
557
558         col = split.column()
559         sub = col.column(align=True)
560         sub.label(text="Feature Weights:")
561         sub.prop(tex, "weight_1", text="1", slider=True)
562         sub.prop(tex, "weight_2", text="2", slider=True)
563         sub.prop(tex, "weight_3", text="3", slider=True)
564         sub.prop(tex, "weight_4", text="4", slider=True)
565
566         layout.label(text="Noise:")
567         row = layout.row()
568         row.prop(tex, "noise_scale", text="Size")
569         row.prop(tex, "nabla")
570
571
572 class TEXTURE_PT_distortednoise(TextureTypePanel, Panel):
573     bl_label = "Distorted Noise"
574     tex_type = 'DISTORTED_NOISE'
575     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
576
577     def draw(self, context):
578         layout = self.layout
579
580         tex = context.texture
581
582         layout.prop(tex, "noise_distortion")
583         layout.prop(tex, "noise_basis", text="Basis")
584
585         split = layout.split()
586
587         col = split.column()
588         col.prop(tex, "distortion", text="Distortion")
589         col.prop(tex, "noise_scale", text="Size")
590
591         split.prop(tex, "nabla")
592
593
594 class TextureSlotPanel(TextureButtonsPanel):
595     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
596
597     @classmethod
598     def poll(cls, context):
599         if not hasattr(context, "texture_slot"):
600             return False
601
602         return (context.engine in cls.COMPAT_ENGINES)
603
604
605 class TEXTURE_PT_mapping(TextureSlotPanel, Panel):
606     bl_label = "Mapping"
607     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
608
609     @classmethod
610     def poll(cls, context):
611         idblock = context_tex_datablock(context)
612         if isinstance(idblock, Brush) and not context.sculpt_object:
613             return False
614
615         if not getattr(context, "texture_slot", None):
616             return False
617
618         engine = context.engine
619         return (engine in cls.COMPAT_ENGINES)
620
621     def draw(self, context):
622         layout = self.layout
623
624         idblock = context_tex_datablock(context)
625
626         tex = context.texture_slot
627
628         if not isinstance(idblock, Brush):
629             split = layout.split(percentage=0.3)
630             col = split.column()
631             col.label(text="Coordinates:")
632             col = split.column()
633             col.prop(tex, "texture_coords", text="")
634
635             if tex.texture_coords == 'ORCO':
636                 """
637                 ob = context.object
638                 if ob and ob.type == 'MESH':
639                     split = layout.split(percentage=0.3)
640                     split.label(text="Mesh:")
641                     split.prop(ob.data, "texco_mesh", text="")
642                 """
643             elif tex.texture_coords == 'UV':
644                 split = layout.split(percentage=0.3)
645                 split.label(text="Map:")
646                 ob = context.object
647                 if ob and ob.type == 'MESH':
648                     split.prop_search(tex, "uv_layer", ob.data, "uv_layers", text="")
649                 else:
650                     split.prop(tex, "uv_layer", text="")
651
652             elif tex.texture_coords == 'OBJECT':
653                 split = layout.split(percentage=0.3)
654                 split.label(text="Object:")
655                 split.prop(tex, "object", text="")
656
657             elif tex.texture_coords == 'ALONG_STROKE':
658                 split = layout.split(percentage=0.3)
659                 split.label(text="Use Tips:")
660                 split.prop(tex, "use_tips", text="")
661
662         if isinstance(idblock, Brush):
663             if context.sculpt_object or context.image_paint_object:
664                 brush_texture_settings(layout, idblock, context.sculpt_object)
665         else:
666             if isinstance(idblock, FreestyleLineStyle):
667                 split = layout.split(percentage=0.3)
668                 split.label(text="Projection:")
669                 split.prop(tex, "mapping", text="")
670
671                 split = layout.split(percentage=0.3)
672                 split.separator()
673                 row = split.row()
674                 row.prop(tex, "mapping_x", text="")
675                 row.prop(tex, "mapping_y", text="")
676                 row.prop(tex, "mapping_z", text="")
677
678             row = layout.row()
679             row.column().prop(tex, "offset")
680             row.column().prop(tex, "scale")
681
682
683 class TEXTURE_PT_influence(TextureSlotPanel, Panel):
684     bl_label = "Influence"
685     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
686
687     @classmethod
688     def poll(cls, context):
689         idblock = context_tex_datablock(context)
690         if isinstance(idblock, Brush):
691             return False
692
693         if not getattr(context, "texture_slot", None):
694             return False
695
696         engine = context.engine
697         return (engine in cls.COMPAT_ENGINES)
698
699     def draw(self, context):
700
701         layout = self.layout
702
703         idblock = context_tex_datablock(context)
704
705         tex = context.texture_slot
706
707         def factor_but(layout, toggle, factor, name):
708             row = layout.row(align=True)
709             row.prop(tex, toggle, text="")
710             sub = row.row(align=True)
711             sub.active = getattr(tex, toggle)
712             sub.prop(tex, factor, text=name, slider=True)
713             return sub  # XXX, temp. use_map_normal needs to override.
714
715         if isinstance(idblock, ParticleSettings):
716             split = layout.split()
717
718             col = split.column()
719             col.label(text="General:")
720             factor_but(col, "use_map_time", "time_factor", "Time")
721             factor_but(col, "use_map_life", "life_factor", "Lifetime")
722             factor_but(col, "use_map_density", "density_factor", "Density")
723             factor_but(col, "use_map_size", "size_factor", "Size")
724
725             col = split.column()
726             col.label(text="Physics:")
727             factor_but(col, "use_map_velocity", "velocity_factor", "Velocity")
728             factor_but(col, "use_map_damp", "damp_factor", "Damp")
729             factor_but(col, "use_map_gravity", "gravity_factor", "Gravity")
730             factor_but(col, "use_map_field", "field_factor", "Force Fields")
731
732             layout.label(text="Hair:")
733
734             split = layout.split()
735
736             col = split.column()
737             factor_but(col, "use_map_length", "length_factor", "Length")
738             factor_but(col, "use_map_clump", "clump_factor", "Clump")
739             factor_but(col, "use_map_twist", "twist_factor", "Twist")
740
741             col = split.column()
742             factor_but(col, "use_map_kink_amp", "kink_amp_factor", "Kink Amplitude")
743             factor_but(col, "use_map_kink_freq", "kink_freq_factor", "Kink Frequency")
744             factor_but(col, "use_map_rough", "rough_factor", "Rough")
745
746         elif isinstance(idblock, FreestyleLineStyle):
747             split = layout.split()
748
749             col = split.column()
750             factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
751             col = split.column()
752             factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
753
754         layout.separator()
755
756         if not isinstance(idblock, ParticleSettings):
757             split = layout.split()
758
759             col = split.column()
760             col.prop(tex, "blend_type", text="Blend")
761             col.prop(tex, "use_rgb_to_intensity")
762             # color is used on gray-scale textures even when use_rgb_to_intensity is disabled.
763             col.prop(tex, "color", text="")
764
765             col = split.column()
766             col.prop(tex, "invert", text="Negative")
767             col.prop(tex, "use_stencil")
768
769
770 class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, Panel):
771     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
772     _context_path = "texture"
773     _property_type = Texture
774
775     @classmethod
776     def poll(cls, context):
777         return context.texture and (context.engine in cls.COMPAT_ENGINES)
778
779
780 classes = (
781     TEXTURE_MT_specials,
782     TEXTURE_UL_texslots,
783     TEXTURE_PT_preview,
784     TEXTURE_PT_context,
785     TEXTURE_PT_node,
786     TEXTURE_PT_node_mapping,
787     TEXTURE_PT_mapping,
788     TEXTURE_PT_influence,
789     TEXTURE_PT_colors,
790     TEXTURE_PT_clouds,
791     TEXTURE_PT_wood,
792     TEXTURE_PT_marble,
793     TEXTURE_PT_magic,
794     TEXTURE_PT_blend,
795     TEXTURE_PT_stucci,
796     TEXTURE_PT_image,
797     TEXTURE_PT_image_sampling,
798     TEXTURE_PT_image_mapping,
799     TEXTURE_PT_musgrave,
800     TEXTURE_PT_voronoi,
801     TEXTURE_PT_distortednoise,
802     TEXTURE_PT_custom_props,
803 )
804
805 if __name__ == "__main__":  # only for live edit.
806     from bpy.utils import register_class
807     for cls in classes:
808         register_class(cls)