1 # ##### BEGIN GPL LICENSE BLOCK #####
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.
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.
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.
17 # ##### END GPL LICENSE BLOCK #####
22 from bl_ui.properties_physics_common import (
26 class PhysicButtonsPanel():
27 bl_space_type = 'PROPERTIES'
28 bl_region_type = 'WINDOW'
29 bl_context = "physics"
32 def poll(cls, context):
34 rd = context.scene.render
35 return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.dynamic_paint)
38 class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, bpy.types.Panel):
39 bl_label = "Dynamic Paint"
41 def draw(self, context):
44 md = context.dynamic_paint
48 layout.prop(md, "dynamicpaint_type", expand=True)
50 if md.dynamicpaint_type == 'CANVAS':
51 canvas = md.canvas_settings
52 surface = canvas.active_surface
54 row.template_list(canvas, "canvas_surfaces", canvas, "active_index", rows=2)
56 col = row.column(align=True)
57 col.operator("dpaint.surface_slot_add", icon='ZOOMIN', text="")
58 col.operator("dpaint.surface_slot_remove", icon='ZOOMOUT', text="")
61 layout.prop(surface, "name")
62 layout.prop(surface, "surface_format", expand=False)
64 if surface.surface_format != "VERTEX":
66 col.label(text="Quality:")
67 col.prop(surface, "image_resolution")
68 col.prop(surface, "use_anti_aliasing")
71 col.label(text="Frames:")
74 col = split.column(align=True)
75 col.prop(surface, "start_frame", text="Start")
76 col.prop(surface, "end_frame", text="End")
79 col.prop(surface, "substeps")
82 elif md.dynamicpaint_type == 'BRUSH':
83 brush = md.brush_settings
85 layout.prop(brush, "brush_settings_context", expand=True, icon_only=True)
87 if (brush.brush_settings_context == "GENERAL"):
88 split = layout.split()
91 col.prop(brush, "absolute_alpha")
92 col.prop(brush, "paint_erase")
93 col.prop(brush, "paint_wetness", text="Wetness")
97 sub.active = (brush.paint_source != "PSYS");
98 sub.prop(brush, "use_material")
99 if brush.use_material and brush.paint_source != "PSYS":
100 col.prop(brush, "material", text="")
101 col.prop(brush, "paint_alpha", text="Alpha Factor")
103 col.prop(brush, "paint_color", text="")
104 col.prop(brush, "paint_alpha", text="Alpha")
106 if (brush.brush_settings_context != "GENERAL"):
107 layout.label(text="-WIP-")
110 class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, bpy.types.Panel):
111 bl_label = "Dynamic Paint: Advanced"
114 def poll(cls, context):
115 md = context.dynamic_paint
116 return md and (md.dynamicpaint_type == 'CANVAS') and (context.dynamic_paint.canvas_settings.active_surface)
118 def draw(self, context):
121 canvas = context.dynamic_paint.canvas_settings
122 surface = canvas.active_surface
125 layout.prop(surface, "surface_type", expand=False)
127 if (surface.surface_type == "PAINT"):
128 layout.prop(surface, "initial_color", expand=False)
129 col = layout.split(percentage=0.33)
130 col.prop(surface, "use_dissolve", text="Dissolve:")
132 sub.active = surface.use_dissolve
133 sub.prop(surface, "dissolve_speed", text="Time")
135 if (surface.surface_type == "DISPLACE"):
136 col = layout.split(percentage=0.33)
137 col.prop(surface, "use_dissolve", text="Flatten:")
139 sub.active = surface.use_dissolve
140 sub.prop(surface, "dissolve_speed", text="Time")
142 layout.label(text="Brush Group:")
143 layout.prop(surface, "brush_group", text="")
146 class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, bpy.types.Panel):
147 bl_label = "Dynamic Paint: Output"
148 bl_options = {'DEFAULT_CLOSED'}
151 def poll(cls, context):
152 md = context.dynamic_paint
153 if ((not md) or (md.dynamicpaint_type != 'CANVAS')):
155 surface = context.dynamic_paint.canvas_settings.active_surface
156 return (surface and (not (surface.surface_format=="VERTEX" and surface.surface_type=="DISPLACE") ))
158 def draw(self, context):
161 canvas = context.dynamic_paint.canvas_settings
162 surface = canvas.active_surface
165 # vertex format outputs
166 if (surface.surface_format == "VERTEX"):
167 if (surface.surface_type == "PAINT"):
169 row.prop_search(surface, "output_name", ob.data, "vertex_colors", text="Paintmap layer: ")
170 #col = row.column(align=True)
171 #col.operator("dpaint.output_add", icon='ZOOMIN', text="")
174 row.prop_search(surface, "output_name2", ob.data, "vertex_colors", text="Wetmap layer: ")
175 #col = row.column(align=True)
176 #col.operator("dpaint.output_add", icon='ZOOMIN', text="")
178 # image format outputs
179 if (surface.surface_format == "IMAGE"):
180 col = layout.column()
181 col.label(text="UV layer:")
182 col.prop_search(surface, "uv_layer", ob.data, "uv_textures", text="")
184 col = layout.column()
185 col.prop(surface, "image_output_path", text="Output directory")
186 if (surface.surface_type == "PAINT"):
187 col.prop(surface, "output_name", text="Paintmap: ")
188 col.prop(surface, "premultiply", text="Premultiply alpha")
189 col.prop(surface, "output_name2", text="Wetmap: ")
190 if (surface.surface_type == "DISPLACE"):
191 col.prop(surface, "output_name", text="Filename: ")
194 layout.operator("dpaint.bake", text="Bake Image Sequence", icon='MOD_DYNAMICPAINT')
195 if len(canvas.ui_info) != 0:
196 layout.label(text=canvas.ui_info)
200 # col = layout.column()
201 # col.prop(surface, "output_wet")
203 # sub.active = surface.output_wet
204 # sub.prop(surface, "wet_output_path", text="")
208 # col = layout.column()
209 # col.prop(surface, "output_disp")
211 # sub.active = surface.output_disp
212 # sub.prop(surface, "displace_output_path", text="")
213 # sub.prop(surface, "displacement", text="Strength")
215 # split = sub.split()
216 # sub = split.column()
217 # sub.prop(surface, "disp_type", text="Type")
218 # sub = split.column()
219 # sub.prop(surface, "disp_format", text="Format")
222 class PHYSICS_PT_dp_effects(PhysicButtonsPanel, bpy.types.Panel):
223 bl_label = "Dynamic Paint: Effects"
224 bl_options = {'DEFAULT_CLOSED'}
227 def poll(cls, context):
228 md = context.dynamic_paint
229 if ((not md) or (md.dynamicpaint_type != 'CANVAS')):
231 surface = context.dynamic_paint.canvas_settings.active_surface
232 return surface and (surface.surface_format != "VERTEX")
234 def draw(self, context):
237 canvas = context.dynamic_paint.canvas_settings
238 surface = canvas.active_surface
240 layout.prop(surface, "effect_ui", expand=True)
242 if surface.effect_ui == "SPREAD":
243 layout.prop(surface, "use_spread")
244 col = layout.column()
245 col.active = surface.use_spread
246 col.prop(surface, "spread_speed")
248 elif surface.effect_ui == "DRIP":
249 layout.prop(surface, "use_drip")
250 col = layout.column()
251 col.active = surface.use_drip
252 col.prop(surface, "drip_speed")
254 elif surface.effect_ui == "SHRINK":
255 layout.prop(surface, "use_shrink")
256 col = layout.column()
257 col.active = surface.use_shrink
258 col.prop(surface, "shrink_speed")
261 class PHYSICS_PT_dp_cache(PhysicButtonsPanel, bpy.types.Panel):
262 bl_label = "Dynamic Paint: Cache"
263 bl_options = {'DEFAULT_CLOSED'}
266 def poll(cls, context):
267 md = context.dynamic_paint
268 return md and (md.dynamicpaint_type == 'CANVAS') and \
269 (md.canvas_settings.active_surface) and (md.canvas_settings.active_surface.uses_cache)
271 def draw(self, context):
274 surface = context.dynamic_paint.canvas_settings.active_surface
275 cache = surface.point_cache
277 point_cache_ui(self, context, cache, (cache.is_baked is False), 'DYNAMIC_PAINT')
280 class PHYSICS_PT_dp_advanced_brush(PhysicButtonsPanel, bpy.types.Panel):
281 bl_label = "Dynamic Paint: Advanced"
282 bl_options = {'DEFAULT_CLOSED'}
285 def poll(cls, context):
286 md = context.dynamic_paint
287 return md and (md.dynamicpaint_type == 'BRUSH')
289 def draw(self, context):
292 brush = context.dynamic_paint.brush_settings
295 split = layout.split()
297 col.prop(brush, "paint_source")
299 if brush.paint_source == "PSYS":
300 col.prop_search(brush, "psys", ob, "particle_systems", text="")
302 col.label(text="Particle effect:")
304 sub.active = not brush.use_part_radius
305 sub.prop(brush, "solid_radius", text="Solid Radius")
306 col.prop(brush, "use_part_radius", text="Use Particle's Radius")
307 col.prop(brush, "smooth_radius", text="Smooth radius")
309 elif brush.paint_source == "DISTANCE" or brush.paint_source == "VOLDIST":
310 col.prop(brush, "paint_distance", text="Paint Distance")
311 split = layout.row().split()
313 sub.prop(brush, "prox_facealigned", text="Face Aligned")
315 sub.prop(brush, "prox_falloff", text="Falloff")
316 if brush.prox_falloff == "RAMP":
317 col = layout.row().column()
318 col.label(text="Falloff Ramp:")
319 col.prop(brush, "prox_ramp_alpha", text="Only Use Alpha")
320 col.template_color_ramp(brush, "paint_ramp", expand=True)
323 bpy.utils.register_module(__name__)
327 bpy.utils.register_module(__name__)
329 if __name__ == "__main__":