1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981
|
# SPDX-FileCopyrightText: 2011-2023 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
from bpy.types import (
Panel,
UIList,
)
from bpy.app.translations import contexts as i18n_contexts
from bl_ui.properties_physics_common import (
point_cache_ui,
effector_weights_ui,
)
class PHYSICS_UL_dynapaint_surfaces(UIList):
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
# assert(isinstance(item, bpy.types.DynamicPaintSurface)
surf = item
sticon = layout.enum_item_icon(surf, "surface_type", surf.surface_type)
if self.layout_type in {'DEFAULT', 'COMPACT'}:
row = layout.row(align=True)
row.label(text="", icon_value=icon)
row.prop(surf, "name", text="", emboss=False, icon_value=sticon)
row = layout.row(align=True)
row.prop(surf, "is_active", text="")
elif self.layout_type == 'GRID':
layout.alignment = 'CENTER'
row = layout.row(align=True)
row.label(text="", icon_value=icon)
row.label(text="", icon_value=sticon)
class PhysicButtonsPanel:
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
@staticmethod
def poll_dyn_paint(context):
ob = context.object
return (ob and ob.type == 'MESH') and context.dynamic_paint
@staticmethod
def poll_dyn_canvas(context):
if not PhysicButtonsPanel.poll_dyn_paint(context):
return False
md = context.dynamic_paint
return (md and md.ui_type == 'CANVAS' and md.canvas_settings and md.canvas_settings.canvas_surfaces.active)
@staticmethod
def poll_dyn_canvas_paint(context):
if not PhysicButtonsPanel.poll_dyn_canvas(context):
return False
surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
return (surface.surface_type == 'PAINT')
@staticmethod
def poll_dyn_canvas_brush(context):
if not PhysicButtonsPanel.poll_dyn_paint(context):
return False
md = context.dynamic_paint
return (md and md.ui_type == 'BRUSH' and md.brush_settings)
@staticmethod
def poll_dyn_output(context):
if not PhysicButtonsPanel.poll_dyn_canvas(context):
return False
surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
return (not (surface.surface_format == 'VERTEX' and (surface.surface_type in {'DISPLACE', 'WAVE'})))
@staticmethod
def poll_dyn_output_maps(context):
if not PhysicButtonsPanel.poll_dyn_output(context):
return False
surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
return (surface.surface_format == 'IMAGE' and surface.surface_type == 'PAINT')
class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, Panel):
bl_label = "Dynamic Paint"
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_paint(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
layout.use_property_split = True
md = context.dynamic_paint
layout.prop(md, "ui_type")
class PHYSICS_PT_dynamic_paint_settings(PhysicButtonsPanel, Panel):
bl_label = "Settings"
bl_parent_id = "PHYSICS_PT_dynamic_paint"
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_paint(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
md = context.dynamic_paint
if md.ui_type == 'CANVAS':
canvas = md.canvas_settings
if canvas is None:
layout.operator("dpaint.type_toggle", text="Add Canvas").type = 'CANVAS'
return # do nothing.
layout.operator("dpaint.type_toggle", text="Remove Canvas", icon='X').type = 'CANVAS'
surface = canvas.canvas_surfaces.active
row = layout.row()
row.template_list(
"PHYSICS_UL_dynapaint_surfaces", "", canvas, "canvas_surfaces",
canvas.canvas_surfaces, "active_index", rows=1,
)
col = row.column(align=True)
col.operator("dpaint.surface_slot_add", icon='ADD', text="")
col.operator("dpaint.surface_slot_remove", icon='REMOVE', text="")
layout.separator()
layout.use_property_split = True
if surface:
flow = layout.grid_flow(
row_major=True, columns=0, even_columns=True, even_rows=False, align=False,
)
col = flow.column()
col.prop(surface, "surface_format")
if surface.surface_format != 'VERTEX':
col.prop(surface, "image_resolution")
col.prop(surface, "use_antialiasing")
col = flow.column(align=True)
col.prop(surface, "frame_start", text="Frame Start")
col.prop(surface, "frame_end", text="End")
col.prop(surface, "frame_substeps")
elif md.ui_type == 'BRUSH':
brush = md.brush_settings
if brush is None:
layout.operator("dpaint.type_toggle", text="Add Brush").type = 'BRUSH'
return # do nothing.
layout.operator("dpaint.type_toggle", text="Remove Brush", icon='X').type = 'BRUSH'
layout.use_property_split = True
flow = layout.grid_flow(
row_major=True, columns=0, even_columns=True, even_rows=False, align=False,
)
col = flow.column()
col.prop(brush, "paint_color")
col.prop(brush, "paint_alpha", text="Alpha", slider=True)
col = flow.column()
col.prop(brush, "paint_wetness", text="Wetness", slider=True)
col.prop(brush, "use_absolute_alpha")
col.prop(brush, "use_paint_erase")
class PHYSICS_PT_dp_surface_canvas(PhysicButtonsPanel, Panel):
bl_label = "Surface"
bl_parent_id = "PHYSICS_PT_dynamic_paint"
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
layout.use_property_split = True
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
surface_type = surface.surface_type
layout.prop(surface, "surface_type")
layout.separator()
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
# per type settings
if surface_type == 'DISPLACE':
col = flow.column()
if surface.surface_format == 'VERTEX':
col.prop(surface, "depth_clamp")
col.prop(surface, "displace_factor")
col.prop(surface, "use_incremental_displace")
col.separator()
elif surface_type == 'WAVE':
col = flow.column()
col.prop(surface, "use_wave_open_border")
col.prop(surface, "wave_timescale")
col.prop(surface, "wave_speed")
col.separator()
col = flow.column()
col.prop(surface, "wave_damping")
col.prop(surface, "wave_spring")
col.prop(surface, "wave_smoothness")
col.separator()
col = flow.column()
col.prop(surface, "brush_collection")
if surface_type not in {'DISPLACE', 'WAVE'}:
col = flow.column() # flow the layout otherwise.
col.prop(surface, "brush_influence_scale", text="Scale Influence", text_ctxt=i18n_contexts.id_simulation)
col.prop(surface, "brush_radius_scale", text="Radius")
class PHYSICS_PT_dp_surface_canvas_paint_dry(PhysicButtonsPanel, Panel):
bl_label = "Dry"
bl_parent_id = "PHYSICS_PT_dp_surface_canvas"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas_paint(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
self.layout.prop(surface, "use_drying", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
flow.active = surface.use_drying
col = flow.column()
col.prop(surface, "dry_speed", text="Time")
col = flow.column()
col.prop(surface, "color_dry_threshold", text="Color")
col.prop(surface, "use_dry_log", text="Slow")
class PHYSICS_PT_dp_surface_canvas_paint_dissolve(PhysicButtonsPanel, Panel):
bl_label = "Dissolve"
bl_translation_context = i18n_contexts.id_simulation
bl_parent_id = "PHYSICS_PT_dp_surface_canvas"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas(context):
return False
surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
return (surface.surface_type != 'WAVE' and context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
self.layout.prop(surface, "use_dissolve", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
flow.active = surface.use_dissolve
col = flow.column()
col.prop(surface, "dissolve_speed", text="Time")
col = flow.column()
col.prop(surface, "use_dissolve_log", text="Slow")
class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel):
bl_label = "Output"
bl_parent_id = "PHYSICS_PT_dynamic_paint"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_output(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
layout.use_property_split = True
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
ob = context.object
surface_type = surface.surface_type
# vertex format outputs.
if surface.surface_format == 'VERTEX':
if surface_type == 'PAINT':
# paint-map output.
row = layout.row()
row.prop_search(surface, "output_name_a", ob.data, "vertex_colors", text="Paintmap Layer")
icons = 'REMOVE' if surface.output_exists(object=ob, index=0) else 'ADD'
row.operator("dpaint.output_toggle", icon=icons, text="").output = 'A'
# wet-map output.
row = layout.row()
row.prop_search(surface, "output_name_b", ob.data, "vertex_colors", text="Wetmap Layer")
icons = 'REMOVE' if surface.output_exists(object=ob, index=1) else 'ADD'
row.operator("dpaint.output_toggle", icon=icons, text="").output = 'B'
elif surface_type == 'WEIGHT':
row = layout.row()
row.prop_search(surface, "output_name_a", ob, "vertex_groups", text="Vertex Group")
icons = 'REMOVE' if surface.output_exists(object=ob, index=0) else 'ADD'
row.operator("dpaint.output_toggle", icon=icons, text="").output = 'A'
# image format outputs.
if surface.surface_format == 'IMAGE':
layout.operator("dpaint.bake", text="Bake Image Sequence", icon='MOD_DYNAMICPAINT')
layout.prop(surface, "image_output_path", text="Cache Path")
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
col = flow.column()
col.prop_search(surface, "uv_layer", ob.data, "uv_layers", text="UV Map")
col = flow.column()
col.prop(surface, "image_fileformat")
col.prop(surface, "use_premultiply", text="Premultiply Alpha")
if surface_type != 'PAINT':
col = col.column()
col.prop(surface, "output_name_a", text="Filename")
if surface_type == 'DISPLACE':
col.prop(surface, "displace_type", text="Displace Type")
col.prop(surface, "depth_clamp")
elif surface_type == 'WAVE':
col.prop(surface, "depth_clamp", text="Wave Clamp")
class PHYSICS_PT_dp_canvas_output_paintmaps(PhysicButtonsPanel, Panel):
bl_label = "Paintmaps"
bl_parent_id = "PHYSICS_PT_dp_canvas_output"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_output_maps(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
self.layout.prop(surface, "use_output_a", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
sub = layout.column()
sub.active = surface.use_output_a
sub.prop(surface, "output_name_a", text="Name")
class PHYSICS_PT_dp_canvas_output_wetmaps(PhysicButtonsPanel, Panel):
bl_label = "Wetmaps"
bl_parent_id = "PHYSICS_PT_dp_canvas_output"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_output_maps(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
self.layout.prop(surface, "use_output_b", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
sub = layout.column()
sub.active = surface.use_output_b
sub.prop(surface, "output_name_b", text="Name")
class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, Panel):
bl_label = "Initial Color"
bl_parent_id = "PHYSICS_PT_dynamic_paint"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas_paint(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
ob = context.object
layout.use_property_split = True
col = layout.column()
col.prop(surface, "init_color_type", text="Type", expand=False)
if surface.init_color_type != 'NONE':
col.separator()
# dissolve
if surface.init_color_type == 'COLOR':
layout.prop(surface, "init_color")
elif surface.init_color_type == 'TEXTURE':
col.prop(surface, "init_texture")
col.prop_search(surface, "init_layername", ob.data, "uv_layers", text="UV Map")
elif surface.init_color_type == 'VERTEX_COLOR':
col.prop_search(surface, "init_layername", ob.data, "vertex_colors", text="Color Layer")
class PHYSICS_PT_dp_effects(PhysicButtonsPanel, Panel):
bl_label = "Effects"
bl_parent_id = "PHYSICS_PT_dynamic_paint"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas_paint(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, _context):
return # do nothing.
class PHYSICS_PT_dp_effects_spread(PhysicButtonsPanel, Panel):
bl_label = "Spread"
bl_parent_id = "PHYSICS_PT_dp_effects"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_paint(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
self.layout.prop(surface, "use_spread", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
layout.active = surface.use_spread
col = flow.column()
col.prop(surface, "spread_speed", text="Speed")
col = flow.column()
col.prop(surface, "color_spread_speed", text="Color")
class PHYSICS_PT_dp_effects_drip(PhysicButtonsPanel, Panel):
bl_label = "Drip"
bl_parent_id = "PHYSICS_PT_dp_effects"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_paint(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
self.layout.prop(surface, "use_drip", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
flow.active = surface.use_drip
col = flow.column()
col.prop(surface, "drip_velocity", slider=True)
col = flow.column()
col.prop(surface, "drip_acceleration", slider=True)
class PHYSICS_PT_dp_effects_drip_weights(PhysicButtonsPanel, Panel):
bl_label = "Weights"
bl_parent_id = "PHYSICS_PT_dp_effects_drip"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_paint(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
layout.active = surface.use_drip
effector_weights_ui(self, surface.effector_weights, 'DYNAMIC_PAINT')
class PHYSICS_PT_dp_effects_shrink(PhysicButtonsPanel, Panel):
bl_label = "Shrink"
bl_parent_id = "PHYSICS_PT_dp_effects"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_paint(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
self.layout.prop(surface, "use_shrink", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
layout.active = surface.use_shrink
layout.prop(surface, "shrink_speed", text="Speed")
class PHYSICS_PT_dp_cache(PhysicButtonsPanel, Panel):
bl_label = "Cache"
bl_parent_id = "PHYSICS_PT_dynamic_paint"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas(context):
return False
surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
return (surface.is_cache_user and (context.engine in cls.COMPAT_ENGINES))
def draw(self, context):
surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
cache = surface.point_cache
point_cache_ui(self, cache, (cache.is_baked is False), 'DYNAMIC_PAINT')
class PHYSICS_PT_dp_brush_source(PhysicButtonsPanel, Panel):
bl_label = "Source"
bl_parent_id = "PHYSICS_PT_dynamic_paint"
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas_brush(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
layout.use_property_split = True
brush = context.dynamic_paint.brush_settings
ob = context.object
layout.prop(brush, "paint_source", text="Paint")
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
if brush.paint_source == 'PARTICLE_SYSTEM':
col = flow.column()
col.separator()
col.prop_search(brush, "particle_system", ob, "particle_systems")
if brush.particle_system:
col = flow.column()
sub = col.column()
sub.active = not brush.use_particle_radius
sub.prop(brush, "solid_radius", text="Effect Solid Radius")
col.prop(brush, "use_particle_radius", text="Use Particle's Radius")
col.prop(brush, "smooth_radius", text="Smooth Radius")
if brush.paint_source in {'DISTANCE', 'VOLUME_DISTANCE', 'POINT'}:
col = flow.column()
col.separator()
col.prop(brush, "paint_distance", text="Distance")
col.prop(brush, "proximity_falloff")
if brush.paint_source == 'VOLUME_DISTANCE':
col.prop(brush, "invert_proximity")
col = flow.column()
col.prop(brush, "use_negative_volume")
if brush.paint_source in {'DISTANCE', 'VOLUME_DISTANCE'}:
col = flow.column() if brush.paint_source != 'VOLUME_DISTANCE' else col.column()
col.prop(brush, "use_proximity_project")
sub = col.column()
sub.active = brush.use_proximity_project
sub.prop(brush, "ray_direction")
class PHYSICS_PT_dp_brush_source_color_ramp(PhysicButtonsPanel, Panel):
bl_label = "Falloff Ramp"
bl_parent_id = "PHYSICS_PT_dp_brush_source"
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas_brush(context):
return False
brush = context.dynamic_paint.brush_settings
return (
(brush.paint_source in {'DISTANCE', 'VOLUME_DISTANCE', 'POINT'}) and
(brush.proximity_falloff == 'RAMP') and
(context.engine in cls.COMPAT_ENGINES)
)
def draw(self, context):
layout = self.layout
layout.use_property_split = True
brush = context.dynamic_paint.brush_settings
layout.prop(brush, "use_proximity_ramp_alpha", text="Only Use Alpha")
layout.use_property_split = False
layout.template_color_ramp(brush, "paint_ramp", expand=True)
class PHYSICS_PT_dp_brush_velocity(PhysicButtonsPanel, Panel):
bl_label = "Velocity"
bl_parent_id = "PHYSICS_PT_dynamic_paint"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas_brush(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
layout.use_property_split = True
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
brush = context.dynamic_paint.brush_settings
col = flow.column()
col.prop(brush, "use_velocity_alpha")
col.prop(brush, "use_velocity_color")
col = flow.column()
col.prop(brush, "use_velocity_depth")
sub = col.column()
sub.active = (brush.use_velocity_alpha or brush.use_velocity_color or brush.use_velocity_depth)
sub.prop(brush, "velocity_max")
class PHYSICS_PT_dp_brush_velocity_color_ramp(PhysicButtonsPanel, Panel):
bl_label = "Ramp"
bl_parent_id = "PHYSICS_PT_dp_brush_velocity"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas_brush(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
brush = context.dynamic_paint.brush_settings
layout.template_color_ramp(brush, "velocity_ramp", expand=True)
class PHYSICS_PT_dp_brush_velocity_smudge(PhysicButtonsPanel, Panel):
bl_label = "Smudge"
bl_parent_id = "PHYSICS_PT_dp_brush_velocity"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas_brush(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
brush = context.dynamic_paint.brush_settings
self.layout.prop(brush, "use_smudge", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
brush = context.dynamic_paint.brush_settings
layout.active = brush.use_smudge
layout.prop(brush, "smudge_strength", text="Strength", slider=True)
class PHYSICS_PT_dp_brush_wave(PhysicButtonsPanel, Panel):
bl_label = "Waves"
bl_parent_id = "PHYSICS_PT_dynamic_paint"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
if not PhysicButtonsPanel.poll_dyn_canvas_brush(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
layout.use_property_split = True
brush = context.dynamic_paint.brush_settings
layout.prop(brush, "wave_type", text="Type")
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
if brush.wave_type != 'REFLECT':
col = flow.column()
col.prop(brush, "wave_factor")
col = flow.column()
col.prop(brush, "wave_clamp")
classes = (
PHYSICS_UL_dynapaint_surfaces,
PHYSICS_PT_dynamic_paint,
PHYSICS_PT_dynamic_paint_settings,
PHYSICS_PT_dp_surface_canvas,
PHYSICS_PT_dp_surface_canvas_paint_dissolve,
PHYSICS_PT_dp_surface_canvas_paint_dry,
PHYSICS_PT_dp_cache,
PHYSICS_PT_dp_effects,
PHYSICS_PT_dp_effects_spread,
PHYSICS_PT_dp_effects_drip,
PHYSICS_PT_dp_effects_drip_weights,
PHYSICS_PT_dp_effects_shrink,
PHYSICS_PT_dp_canvas_initial_color,
PHYSICS_PT_dp_brush_source,
PHYSICS_PT_dp_brush_source_color_ramp,
PHYSICS_PT_dp_brush_velocity,
PHYSICS_PT_dp_brush_velocity_color_ramp,
PHYSICS_PT_dp_brush_velocity_smudge,
PHYSICS_PT_dp_brush_wave,
PHYSICS_PT_dp_canvas_output,
PHYSICS_PT_dp_canvas_output_paintmaps,
PHYSICS_PT_dp_canvas_output_wetmaps,
)
if __name__ == "__main__": # only for live edit.
from bpy.utils import register_class
for cls in classes:
register_class(cls)
|