diff options
74 files changed, 4806 insertions, 2192 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index d58dec211be..e7536838199 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -39,1809 +39,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): def draw(self, context): layout = self.layout - - ob = context.object - layout.operator_menu_enum("object.modifier_add", "type") - - for md in ob.modifiers: - box = layout.template_modifier(md) - if box: - # match enum type to our functions, avoids a lookup table. - getattr(self, md.type)(box, ob, md) - - # the mt.type enum is (ab)used for a lookup on function names - # ...to avoid lengthy if statements - # so each type must have a function here. - - def ARMATURE(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.label(text="Object:") - col.prop(md, "object", text="") - col.prop(md, "use_deform_preserve_volume") - - col = split.column() - col.label(text="Bind To:") - col.prop(md, "use_vertex_groups", text="Vertex Groups") - col.prop(md, "use_bone_envelopes", text="Bone Envelopes") - - layout.separator() - - split = layout.split() - - row = split.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - sub = row.row(align=True) - sub.active = bool(md.vertex_group) - sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - split.prop(md, "use_multi_modifier") - - def ARRAY(self, layout, _ob, md): - layout.prop(md, "fit_type") - - if md.fit_type == 'FIXED_COUNT': - layout.prop(md, "count") - elif md.fit_type == 'FIT_LENGTH': - layout.prop(md, "fit_length") - elif md.fit_type == 'FIT_CURVE': - layout.prop(md, "curve") - - layout.separator() - - split = layout.split() - - col = split.column() - col.prop(md, "use_constant_offset") - sub = col.column() - sub.active = md.use_constant_offset - sub.prop(md, "constant_offset_displace", text="") - - col.separator() - - col.prop(md, "use_merge_vertices", text="Merge") - sub = col.column() - sub.active = md.use_merge_vertices - sub.prop(md, "use_merge_vertices_cap", text="First Last") - sub.prop(md, "merge_threshold", text="Distance") - - col = split.column() - col.prop(md, "use_relative_offset") - sub = col.column() - sub.active = md.use_relative_offset - sub.prop(md, "relative_offset_displace", text="") - - col.separator() - - col.prop(md, "use_object_offset") - sub = col.column() - sub.active = md.use_object_offset - sub.prop(md, "offset_object", text="") - - row = layout.row() - split = row.split() - col = split.column() - col.label(text="UVs:") - sub = col.column(align=True) - sub.prop(md, "offset_u") - sub.prop(md, "offset_v") - layout.separator() - - layout.prop(md, "start_cap") - layout.prop(md, "end_cap") - - def BEVEL(self, layout, ob, md): - offset_type = md.offset_type - if offset_type == 'PERCENT': - layout.prop(md, "width_pct") - else: - offset_text = "Width" - if offset_type == 'DEPTH': - offset_text = "Depth" - elif offset_type == 'OFFSET': - offset_text = "Offset" - layout.prop(md, "width", text=offset_text) - layout.row().prop(md, "offset_type", expand=True) - - split = layout.split() - col = split.column() - col.prop(md, "use_only_vertices") - col.prop(md, "use_clamp_overlap") - col.prop(md, "loop_slide") - col = split.column() - col.prop(md, "mark_seam") - col.prop(md, "mark_sharp") - col.prop(md, "harden_normals") - - layout.row().prop(md, "segments") - layout.row().prop(md, "profile") - layout.row().prop(md, "material") - - layout.label(text="Miter Type:") - layout.row().prop(md, "miter_outer", text="Outer") - layout.row().prop(md, "miter_inner", text="Inner") - if md.miter_inner in {'MITER_PATCH', 'MITER_ARC'}: - layout.row().prop(md, "spread") - - layout.label(text="Limit Method:") - layout.row().prop(md, "limit_method", expand=True) - if md.limit_method == 'ANGLE': - layout.prop(md, "angle_limit") - elif md.limit_method == 'VGROUP': - row = layout.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - layout.label(text="Face Strength Mode:") - layout.row().prop(md, "face_strength_mode", expand=True) - - layout.label(text="Intersection Type:") - layout.row().prop(md, "vmesh_method", expand=True) - layout.row().prop(md, "use_custom_profile") - row = layout.row() - row.enabled = md.use_custom_profile - if md.use_custom_profile: - layout.template_curveprofile(md, "custom_profile") - - def BOOLEAN(self, layout, _ob, md): - split = layout.split() - - col = split.column() - col.label(text="Operation:") - col.prop(md, "operation", text="") - - col = split.column() - col.label(text="Object:") - col.prop(md, "object", text="") - - layout.prop(md, "double_threshold") - - if bpy.app.debug: - layout.prop(md, "debug_options") - - def BUILD(self, layout, _ob, md): - split = layout.split() - - col = split.column() - col.prop(md, "frame_start") - col.prop(md, "frame_duration") - col.prop(md, "use_reverse") - - col = split.column() - col.prop(md, "use_random_order") - sub = col.column() - sub.active = md.use_random_order - sub.prop(md, "seed") - - def MESH_CACHE(self, layout, _ob, md): - layout.prop(md, "cache_format") - layout.prop(md, "filepath") - - if md.cache_format == 'ABC': - layout.prop(md, "sub_object") - - layout.label(text="Evaluation:") - layout.prop(md, "factor", slider=True) - layout.prop(md, "deform_mode") - layout.prop(md, "interpolation") - - layout.label(text="Time Mapping:") - - row = layout.row() - row.prop(md, "time_mode", expand=True) - row = layout.row() - row.prop(md, "play_mode", expand=True) - if md.play_mode == 'SCENE': - layout.prop(md, "frame_start") - layout.prop(md, "frame_scale") - else: - time_mode = md.time_mode - if time_mode == 'FRAME': - layout.prop(md, "eval_frame") - elif time_mode == 'TIME': - layout.prop(md, "eval_time") - elif time_mode == 'FACTOR': - layout.prop(md, "eval_factor") - - layout.label(text="Axis Mapping:") - split = layout.split(factor=0.5, align=True) - split.alert = (md.forward_axis[-1] == md.up_axis[-1]) - split.label(text="Forward/Up Axis:") - split.prop(md, "forward_axis", text="") - split.prop(md, "up_axis", text="") - split = layout.split(factor=0.5) - split.label(text="Flip Axis:") - row = split.row() - row.prop(md, "flip_axis") - - def MESH_SEQUENCE_CACHE(self, layout, ob, md): - layout.label(text="Cache File Properties:") - box = layout.box() - box.template_cache_file(md, "cache_file") - - cache_file = md.cache_file - - layout.label(text="Modifier Properties:") - box = layout.box() - - if cache_file is not None: - box.prop_search(md, "object_path", cache_file, "object_paths") - - if ob.type == 'MESH': - box.row().prop(md, "read_data") - - def CAST(self, layout, ob, md): - split = layout.split(factor=0.25) - - split.label(text="Cast Type:") - split.prop(md, "cast_type", text="") - - split = layout.split(factor=0.25) - - col = split.column() - col.prop(md, "use_x") - col.prop(md, "use_y") - col.prop(md, "use_z") - - col = split.column() - col.prop(md, "factor") - col.prop(md, "radius") - col.prop(md, "size") - col.prop(md, "use_radius_as_size") - - split = layout.split() - - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - col = split.column() - col.label(text="Control Object:") - col.prop(md, "object", text="") - if md.object: - col.prop(md, "use_transform") - - def CLOTH(self, layout, _ob, _md): - layout.label(text="Settings are inside the Physics tab") - - def COLLISION(self, layout, _ob, _md): - layout.label(text="Settings are inside the Physics tab") - - def CURVE(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.label(text="Object:") - col.prop(md, "object", text="") - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - layout.label(text="Deformation Axis:") - layout.row().prop(md, "deform_axis", expand=True) - - def DECIMATE(self, layout, ob, md): - decimate_type = md.decimate_type - - row = layout.row() - row.prop(md, "decimate_type", expand=True) - - if decimate_type == 'COLLAPSE': - has_vgroup = bool(md.vertex_group) - layout.prop(md, "ratio") - - split = layout.split() - - col = split.column() - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - layout_info = col - - col = split.column() - row = col.row() - row.active = has_vgroup - row.prop(md, "vertex_group_factor") - - col.prop(md, "use_collapse_triangulate") - row = col.split(factor=0.75) - row.prop(md, "use_symmetry") - row.prop(md, "symmetry_axis", text="") - - elif decimate_type == 'UNSUBDIV': - layout.prop(md, "iterations") - layout_info = layout - else: # decimate_type == 'DISSOLVE': - layout.prop(md, "angle_limit") - layout.prop(md, "use_dissolve_boundaries") - layout.label(text="Delimit:") - row = layout.row() - row.prop(md, "delimit") - layout_info = layout - - layout_info.label( - text=iface_("Face Count: {:,}".format(md.face_count)), - translate=False, - ) - - def DISPLACE(self, layout, ob, md): - has_texture = (md.texture is not None) - - col = layout.column(align=True) - col.label(text="Texture:") - col.template_ID(md, "texture", new="texture.new") - - split = layout.split() - - col = split.column(align=True) - col.label(text="Direction:") - col.prop(md, "direction", text="") - if md.direction in {'X', 'Y', 'Z', 'RGB_TO_XYZ'}: - col.label(text="Space:") - col.prop(md, "space", text="") - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - col = split.column(align=True) - col.active = has_texture - col.label(text="Texture Coordinates:") - col.prop(md, "texture_coords", text="") - if md.texture_coords == 'OBJECT': - col.label(text="Object:") - col.prop(md, "texture_coords_object", text="") - obj = md.texture_coords_object - if obj and obj.type == 'ARMATURE': - col.label(text="Bone:") - col.prop_search(md, "texture_coords_bone", obj.data, "bones", text="") - elif md.texture_coords == 'UV' and ob.type == 'MESH': - col.label(text="UV Map:") - col.prop_search(md, "uv_layer", ob.data, "uv_layers", text="") - - layout.separator() - - row = layout.row() - row.prop(md, "mid_level") - row.prop(md, "strength") - - def DYNAMIC_PAINT(self, layout, _ob, _md): - layout.label(text="Settings are inside the Physics tab") - - def EDGE_SPLIT(self, layout, _ob, md): - split = layout.split() - - col = split.column() - col.prop(md, "use_edge_angle", text="Edge Angle") - sub = col.column() - sub.active = md.use_edge_angle - sub.prop(md, "split_angle") - - split.prop(md, "use_edge_sharp", text="Sharp Edges") - - def EXPLODE(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - sub = col.column() - sub.active = bool(md.vertex_group) - sub.prop(md, "protect") - col.label(text="Particle UV") - col.prop_search(md, "particle_uv", ob.data, "uv_layers", text="") - - col = split.column() - col.prop(md, "use_edge_cut") - col.prop(md, "show_unborn") - col.prop(md, "show_alive") - col.prop(md, "show_dead") - col.prop(md, "use_size") - - layout.operator("object.explode_refresh", text="Refresh") - - def FLUID_SIMULATION(self, layout, _ob, _md): - layout.label(text="Settings are inside the Physics tab") - - def HOOK(self, layout, ob, md): - use_falloff = (md.falloff_type != 'NONE') - split = layout.split() - - col = split.column() - col.label(text="Object:") - col.prop(md, "object", text="") - if md.object and md.object.type == 'ARMATURE': - col.label(text="Bone:") - col.prop_search(md, "subtarget", md.object.data, "bones", text="") - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - layout.separator() - - row = layout.row(align=True) - if use_falloff: - row.prop(md, "falloff_radius") - row.prop(md, "strength", slider=True) - layout.prop(md, "falloff_type") - - col = layout.column() - if use_falloff: - if md.falloff_type == 'CURVE': - col.template_curve_mapping(md, "falloff_curve") - - split = layout.split() - - col = split.column() - col.prop(md, "use_falloff_uniform") - - if ob.mode == 'EDIT': - row = col.row(align=True) - row.operator("object.hook_reset", text="Reset") - row.operator("object.hook_recenter", text="Recenter") - - row = layout.row(align=True) - row.operator("object.hook_select", text="Select") - row.operator("object.hook_assign", text="Assign") - - def LAPLACIANDEFORM(self, layout, ob, md): - is_bind = md.is_bind - - layout.prop(md, "iterations") - - row = layout.row(align=True) - row.enabled = not is_bind - row.prop_search(md, "vertex_group", ob, "vertex_groups") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - layout.separator() - - row = layout.row() - row.enabled = bool(md.vertex_group) - row.operator("object.laplaciandeform_bind", text="Unbind" if is_bind else "Bind") - - def LAPLACIANSMOOTH(self, layout, ob, md): - layout.prop(md, "iterations") - - split = layout.split(factor=0.25) - - col = split.column() - col.label(text="Axis:") - col.prop(md, "use_x") - col.prop(md, "use_y") - col.prop(md, "use_z") - - col = split.column() - col.label(text="Lambda:") - col.prop(md, "lambda_factor", text="Factor") - col.prop(md, "lambda_border", text="Border") - - col.separator() - col.prop(md, "use_volume_preserve") - col.prop(md, "use_normalized") - - layout.label(text="Vertex Group:") - row = layout.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - def LATTICE(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.label(text="Object:") - col.prop(md, "object", text="") - - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - layout.separator() - layout.prop(md, "strength", slider=True) - - def MASK(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.label(text="Mode:") - col.prop(md, "mode", text="") - - col = split.column() - if md.mode == 'ARMATURE': - col.label(text="Armature:") - row = col.row(align=True) - row.prop(md, "armature", text="") - sub = row.row(align=True) - sub.active = (md.armature is not None) - sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - elif md.mode == 'VERTEX_GROUP': - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - sub = row.row(align=True) - sub.active = bool(md.vertex_group) - sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - col = layout.column() - col.prop(md, "threshold") - - def MESH_DEFORM(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.enabled = not md.is_bound - col.label(text="Object:") - col.prop(md, "object", text="") - - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - sub = row.row(align=True) - sub.active = bool(md.vertex_group) - sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - layout.separator() - row = layout.row() - row.enabled = not md.is_bound - row.prop(md, "precision") - row.prop(md, "use_dynamic_bind") - - layout.separator() - if md.is_bound: - layout.operator("object.meshdeform_bind", text="Unbind") - else: - layout.operator("object.meshdeform_bind", text="Bind") - - def MIRROR(self, layout, _ob, md): - axis_text = "XYZ" - split = layout.split(factor=0.33) - - col = split.column() - col.label(text="Axis:") - for i, text in enumerate(axis_text): - col.prop(md, "use_axis", text=text, index=i) - - col = split.column() - col.label(text="Bisect:") - for i, text in enumerate(axis_text): - colsub = col.column() - colsub.prop(md, "use_bisect_axis", text=text, index=i) - colsub.active = md.use_axis[i] - - col = split.column() - col.label(text="Flip:") - for i, text in enumerate(axis_text): - colsub = col.column() - colsub.prop(md, "use_bisect_flip_axis", text=text, index=i) - colsub.active = md.use_axis[i] and md.use_bisect_axis[i] - - layout.separator() - - col = layout.column() - col.label(text="Mirror Object:") - col.prop(md, "mirror_object", text="") - - layout.separator() - - col = layout.column() - col.label(text="Options:") - - row = layout.row() - row.prop(md, "use_mirror_vertex_groups", text="Vertex Groups") - row.prop(md, "use_clip", text="Clipping") - row = layout.row() - row.prop(md, "use_mirror_merge", text="Merge") - - col = layout.column() - if md.use_mirror_merge is True: - col.prop(md, "merge_threshold") - - layout.separator() - col = layout.column() - - col.label(text="Textures:") - row = layout.row() - row.prop(md, "use_mirror_u", text="Flip U") - row.prop(md, "use_mirror_v", text="Flip V") - row = layout.row() - row.prop(md, "use_mirror_udim", text="Flip UDIM") - - col = layout.column(align=True) - - if md.use_mirror_u: - col.prop(md, "mirror_offset_u") - - if md.use_mirror_v: - col.prop(md, "mirror_offset_v") - - col = layout.column(align=True) - col.prop(md, "offset_u") - col.prop(md, "offset_v") - - def MULTIRES(self, layout, ob, md): - # Changing some of the properties can not be done once there is an - # actual displacement stored for this multires modifier. This check - # will disallow those properties from change. - # This is a bit stupid check but should be sufficient for the usual - # multires usage. It might become less strict and only disallow - # modifications if there is CD_MDISPS layer, or if there is actual - # non-zero displacement but such checks will be too slow to be done - # on every redraw. - have_displacement = (md.total_levels != 0) - - row = layout.row() - row.enabled = not have_displacement - row.prop(md, "subdivision_type", expand=True) - - split = layout.split() - col = split.column() - col.prop(md, "levels", text="Preview") - col.prop(md, "sculpt_levels", text="Sculpt") - col.prop(md, "render_levels", text="Render") - - row = col.row() - row.enabled = not have_displacement - row.prop(md, "quality") - - col = split.column() - - col.enabled = ob.mode != 'EDIT' - op = col.operator("object.multires_subdivide", text="Subdivide") - op.mode = 'CATMULL_CLARK' - - op = col.operator("object.multires_subdivide", text="Subdivide Simple") - op.mode = 'SIMPLE' - - op = col.operator("object.multires_subdivide", text="Subdivide Linear") - op.mode = 'LINEAR' - - col.operator("object.multires_higher_levels_delete", text="Delete Higher") - col.operator("object.multires_unsubdivide", text="Unsubdivide") - col.operator("object.multires_reshape", text="Reshape") - col.operator("object.multires_base_apply", text="Apply Base") - col.operator("object.multires_rebuild_subdiv", text="Rebuild Subdivisions") - col.prop(md, "uv_smooth", text="") - col.prop(md, "show_only_control_edges") - - row = col.row() - row.enabled = not have_displacement - row.prop(md, "use_creases") - - layout.separator() - - col = layout.column() - row = col.row() - if md.is_external: - row.operator("object.multires_external_pack", text="Pack External") - row.label() - row = col.row() - row.prop(md, "filepath", text="") - else: - row.operator("object.multires_external_save", text="Save External...") - row.label() - - def OCEAN(self, layout, _ob, md): - if not bpy.app.build_options.mod_oceansim: - layout.label(text="Built without OceanSim modifier") - return - - layout.prop(md, "geometry_mode") - - if md.geometry_mode == 'GENERATE': - row = layout.row() - row.prop(md, "repeat_x") - row.prop(md, "repeat_y") - - layout.separator() - - split = layout.split() - - col = split.column() - col.prop(md, "time") - col.prop(md, "depth") - col.prop(md, "random_seed") - - col = split.column() - col.prop(md, "resolution") - col.prop(md, "size") - col.prop(md, "spatial_size") - - layout.separator() - - layout.prop(md, "spectrum") - - if md.spectrum in {'TEXEL_MARSEN_ARSLOE', 'JONSWAP'}: - split = layout.split() - - col = split.column() - col.prop(md, "sharpen_peak_jonswap") - - col = split.column() - col.prop(md, "fetch_jonswap") - - layout.label(text="Waves:") - - split = layout.split() - - col = split.column() - col.prop(md, "choppiness") - col.prop(md, "wave_scale", text="Scale") - col.prop(md, "wave_scale_min") - col.prop(md, "wind_velocity") - - col = split.column() - col.prop(md, "wave_alignment", text="Alignment") - sub = col.column() - sub.active = (md.wave_alignment > 0.0) - sub.prop(md, "wave_direction", text="Direction") - sub.prop(md, "damping") - - layout.separator() - - layout.prop(md, "use_normals") - - split = layout.split() - - col = split.column() - col.prop(md, "use_foam") - sub = col.row() - sub.active = md.use_foam - sub.prop(md, "foam_coverage", text="Coverage") - - col = split.column() - col.active = md.use_foam - col.label(text="Foam Data Layer Name:") - col.prop(md, "foam_layer_name", text="") - - layout.separator() - - if md.is_cached: - layout.operator("object.ocean_bake", text="Delete Bake").free = True - else: - layout.operator("object.ocean_bake").free = False - - split = layout.split() - split.enabled = not md.is_cached - - col = split.column(align=True) - col.prop(md, "frame_start", text="Start") - col.prop(md, "frame_end", text="End") - - col = split.column(align=True) - col.label(text="Cache path:") - col.prop(md, "filepath", text="") - - split = layout.split() - split.enabled = not md.is_cached - - col = split.column() - col.active = md.use_foam - col.prop(md, "bake_foam_fade") - - col = split.column() - - def PARTICLE_INSTANCE(self, layout, ob, md): - layout.prop(md, "object") - if md.object: - layout.prop_search(md, "particle_system", md.object, "particle_systems", text="Particle System") - else: - layout.prop(md, "particle_system_index", text="Particle System") - - split = layout.split() - col = split.column() - col.label(text="Create From:") - layout.prop(md, "space", text="") - col.prop(md, "use_normal") - col.prop(md, "use_children") - col.prop(md, "use_size") - - col = split.column() - col.label(text="Show Particles When:") - col.prop(md, "show_alive") - col.prop(md, "show_unborn") - col.prop(md, "show_dead") - - row = layout.row(align=True) - row.prop(md, "particle_amount", text="Amount") - row.prop(md, "particle_offset", text="Offset") - - row = layout.row(align=True) - row.prop(md, "axis", expand=True) - - layout.separator() - - layout.prop(md, "use_path", text="Create Along Paths") - - col = layout.column() - col.active = md.use_path - col.prop(md, "use_preserve_shape") - - row = col.row(align=True) - row.prop(md, "position", slider=True) - row.prop(md, "random_position", text="Random", slider=True) - row = col.row(align=True) - row.prop(md, "rotation", slider=True) - row.prop(md, "random_rotation", text="Random", slider=True) - - layout.separator() - - col = layout.column() - col.prop_search(md, "index_layer_name", ob.data, "vertex_colors", text="Index Layer") - col.prop_search(md, "value_layer_name", ob.data, "vertex_colors", text="Value Layer") - - def PARTICLE_SYSTEM(self, layout, _ob, _md): - layout.label(text="Settings can be found inside the Particle context") - - def SCREW(self, layout, _ob, md): - split = layout.split() - - col = split.column() - col.prop(md, "axis") - col.prop(md, "object", text="AxisOb") - col.prop(md, "angle") - col.prop(md, "steps") - col.prop(md, "render_steps") - col.prop(md, "use_smooth_shade") - col.prop(md, "use_merge_vertices") - sub = col.column() - sub.active = md.use_merge_vertices - sub.prop(md, "merge_threshold") - - col = split.column() - row = col.row() - row.active = (md.object is None or md.use_object_screw_offset is False) - row.prop(md, "screw_offset") - row = col.row() - row.active = (md.object is not None) - row.prop(md, "use_object_screw_offset") - col.prop(md, "use_normal_calculate") - col.prop(md, "use_normal_flip") - col.prop(md, "iterations") - col.prop(md, "use_stretch_u") - col.prop(md, "use_stretch_v") - - def SHRINKWRAP(self, layout, ob, md): - split = layout.split() - col = split.column() - col.label(text="Target:") - col.prop(md, "target", text="") - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - split = layout.split() - - col = split.column() - col.prop(md, "offset") - - col = split.column() - col.label(text="Mode:") - col.prop(md, "wrap_method", text="") - - if md.wrap_method in {'PROJECT', 'NEAREST_SURFACEPOINT', 'TARGET_PROJECT'}: - col.prop(md, "wrap_mode", text="") - - if md.wrap_method == 'PROJECT': - split = layout.split() - col = split.column() - col.prop(md, "subsurf_levels") - col = split.column() - - col.prop(md, "project_limit", text="Limit") - split = layout.split(factor=0.25) - - col = split.column() - col.label(text="Axis:") - col.prop(md, "use_project_x") - col.prop(md, "use_project_y") - col.prop(md, "use_project_z") - - col = split.column() - col.label(text="Direction:") - col.prop(md, "use_negative_direction") - col.prop(md, "use_positive_direction") - - subcol = col.column() - subcol.active = md.use_negative_direction and md.cull_face != 'OFF' - subcol.prop(md, "use_invert_cull") - - col = split.column() - col.label(text="Cull Faces:") - col.prop(md, "cull_face", expand=True) - - layout.prop(md, "auxiliary_target") - - def SIMPLE_DEFORM(self, layout, ob, md): - - layout.row().prop(md, "deform_method", expand=True) - - split = layout.split() - - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - split = layout.split() - - col = split.column() - col.label(text="Axis, Origin:") - col.prop(md, "origin", text="") - - col.prop(md, "deform_axis") - - if md.deform_method in {'TAPER', 'STRETCH', 'TWIST'}: - row = col.row(align=True) - row.label(text="Lock:") - deform_axis = md.deform_axis - if deform_axis != 'X': - row.prop(md, "lock_x") - if deform_axis != 'Y': - row.prop(md, "lock_y") - if deform_axis != 'Z': - row.prop(md, "lock_z") - - col = split.column() - col.label(text="Deform:") - if md.deform_method in {'TAPER', 'STRETCH'}: - col.prop(md, "factor") - else: - col.prop(md, "angle") - col.prop(md, "limits", slider=True) - - def FLUID(self, layout, _ob, _md): - layout.label(text="Settings are inside the Physics tab") - - def SMOOTH(self, layout, ob, md): - split = layout.split(factor=0.25) - - col = split.column() - col.label(text="Axis:") - col.prop(md, "use_x") - col.prop(md, "use_y") - col.prop(md, "use_z") - - col = split.column() - col.prop(md, "factor") - col.prop(md, "iterations") - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - def SOFT_BODY(self, layout, _ob, _md): - layout.label(text="Settings are inside the Physics tab") - - def SOLIDIFY(self, layout, ob, md): - - layout.row().prop(md, "solidify_mode") - - solidify_mode = md.solidify_mode - - if solidify_mode == 'NON_MANIFOLD': - layout.prop(md, "nonmanifold_thickness_mode") - layout.prop(md, "nonmanifold_boundary_mode") - - split = layout.split() - - col = split.column() - col.prop(md, "thickness") - col.prop(md, "thickness_clamp") - row = col.row() - row.active = md.thickness_clamp > 0.0 - row.prop(md, "use_thickness_angle_clamp") - - col.separator() - - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - sub = row.row(align=True) - sub.active = bool(md.vertex_group) - sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - sub = col.row() - sub.active = bool(md.vertex_group) - sub.prop(md, "thickness_vertex_group", text="Factor") - if solidify_mode == 'NON_MANIFOLD': - sub = col.row() - sub.active = bool(md.vertex_group) - sub.prop(md, "use_flat_faces") - - if solidify_mode == 'EXTRUDE': - col.label(text="Crease:") - col.prop(md, "edge_crease_inner", text="Inner") - col.prop(md, "edge_crease_outer", text="Outer") - col.prop(md, "edge_crease_rim", text="Rim") - col.label(text="Bevel:") - col.prop(md, "bevel_convex") - else: - col.label(text="Bevel:") - col.prop(md, "bevel_convex") - col.separator() - col.prop(md, "nonmanifold_merge_threshold") - - col = split.column() - - col.prop(md, "offset") - - col.prop(md, "use_flip_normals") - - if solidify_mode == 'EXTRUDE': - col.prop(md, "use_even_offset") - col.prop(md, "use_quality_normals") - - col.prop(md, "use_rim") - col_rim = col.column() - col_rim.active = md.use_rim - col_rim.prop(md, "use_rim_only") - - col.separator() - - col.label(text="Material Index Offset:") - - sub = col.column() - row = sub.split(factor=0.4, align=True) - row.prop(md, "material_offset", text="") - row = row.row(align=True) - row.active = md.use_rim - row.prop(md, "material_offset_rim", text="Rim") - - col.separator() - - row = col.row(align=True) - row.label(text="Shell Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "shell_vertex_group", ob, "vertex_groups", text="") - row = col.row(align=True) - row.label(text="Rim Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "rim_vertex_group", ob, "vertex_groups", text="") - - def SUBSURF(self, layout, ob, md): - from bpy import context - layout.row().prop(md, "subdivision_type", expand=True) - - split = layout.split() - col = split.column() - - scene = context.scene - engine = context.engine - show_adaptive_options = ( - engine == 'CYCLES' and md == ob.modifiers[-1] and - scene.cycles.feature_set == 'EXPERIMENTAL' - ) - if show_adaptive_options: - col.label(text="Render:") - col.prop(ob.cycles, "use_adaptive_subdivision", text="Adaptive") - if ob.cycles.use_adaptive_subdivision: - col.prop(ob.cycles, "dicing_rate") - else: - col.prop(md, "render_levels", text="Levels") - - col.separator() - - col.label(text="Viewport:") - col.prop(md, "levels", text="Levels") - else: - col.label(text="Subdivisions:") - sub = col.column(align=True) - sub.prop(md, "render_levels", text="Render") - sub.prop(md, "levels", text="Viewport") - - col.prop(md, "quality") - - col = split.column() - col.label(text="Options:") - - sub = col.column() - sub.active = (not show_adaptive_options) or (not ob.cycles.use_adaptive_subdivision) - sub.prop(md, "uv_smooth", text="") - - col.prop(md, "show_only_control_edges") - col.prop(md, "use_creases") - - if show_adaptive_options and ob.cycles.use_adaptive_subdivision: - col = layout.column(align=True) - col.scale_y = 0.6 - col.separator() - col.label(text="Final Dicing Rate:") - col.separator() - - render = max(scene.cycles.dicing_rate * ob.cycles.dicing_rate, 0.1) - preview = max(scene.cycles.preview_dicing_rate * ob.cycles.dicing_rate, 0.1) - col.label(text=f"Render {render:.2f} px, Preview {preview:.2f} px") - - def SURFACE(self, layout, _ob, _md): - layout.label(text="Settings are inside the Physics tab") - - def SURFACE_DEFORM(self, layout, _ob, md): - split = layout.split() - col = split.column() - col.active = not md.is_bound - - col.label(text="Target:") - col.prop(md, "target", text="") - - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", _ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - split = layout.split() - col = split.column() - col.prop(md, "falloff") - col = split.column() - col.prop(md, "strength") - - col = layout.column() - - if md.is_bound: - col.operator("object.surfacedeform_bind", text="Unbind") - else: - col.active = md.target is not None - col.operator("object.surfacedeform_bind", text="Bind") - - def UV_PROJECT(self, layout, ob, md): - split = layout.split() - col = split.column() - col.prop_search(md, "uv_layer", ob.data, "uv_layers") - col.separator() - - col.prop(md, "projector_count", text="Projectors") - for proj in md.projectors: - col.prop(proj, "object", text="") - - col = split.column() - sub = col.column(align=True) - sub.prop(md, "aspect_x", text="Aspect X") - sub.prop(md, "aspect_y", text="Aspect Y") - - sub = col.column(align=True) - sub.prop(md, "scale_x", text="Scale X") - sub.prop(md, "scale_y", text="Scale Y") - - def WARP(self, layout, ob, md): - use_falloff = (md.falloff_type != 'NONE') - split = layout.split() - - col = split.column() - col.label(text="From:") - col.prop(md, "object_from", text="") - - col = split.column() - col.label(text="To:") - col.prop(md, "object_to", text="") - - split = layout.split() - col = split.column() - obj = md.object_from - if obj and obj.type == 'ARMATURE': - col.label(text="Bone:") - col.prop_search(md, "bone_from", obj.data, "bones", text="") - - col = split.column() - obj = md.object_to - if obj and obj.type == 'ARMATURE': - col.label(text="Bone:") - col.prop_search(md, "bone_to", obj.data, "bones", text="") - - split = layout.split() - col = split.column() - col.prop(md, "use_volume_preserve") - col = split.column() - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - col = layout.column() - - row = col.row(align=True) - row.prop(md, "strength") - if use_falloff: - row.prop(md, "falloff_radius") - - col.prop(md, "falloff_type") - if use_falloff: - if md.falloff_type == 'CURVE': - col.template_curve_mapping(md, "falloff_curve") - - # 2 new columns - split = layout.split() - col = split.column() - col.label(text="Texture:") - col.template_ID(md, "texture", new="texture.new") - - col = split.column() - col.label(text="Texture Coordinates:") - col.prop(md, "texture_coords", text="") - - if md.texture_coords == 'OBJECT': - layout.prop(md, "texture_coords_object", text="Object") - obj = md.texture_coords_object - if obj and obj.type == 'ARMATURE': - layout.prop_search(md, "texture_coords_bone", obj.data, "bones", text="Bone") - elif md.texture_coords == 'UV' and ob.type == 'MESH': - layout.prop_search(md, "uv_layer", ob.data, "uv_layers") - - def WAVE(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.label(text="Motion:") - col.prop(md, "use_x") - col.prop(md, "use_y") - col.prop(md, "use_cyclic") - - col = split.column() - col.prop(md, "use_normal") - sub = col.column() - sub.active = md.use_normal - sub.prop(md, "use_normal_x", text="X") - sub.prop(md, "use_normal_y", text="Y") - sub.prop(md, "use_normal_z", text="Z") - - split = layout.split() - - col = split.column() - col.label(text="Time:") - sub = col.column(align=True) - sub.prop(md, "time_offset", text="Offset") - sub.prop(md, "lifetime", text="Life") - col.prop(md, "damping_time", text="Damping") - - col = split.column() - col.label(text="Position:") - sub = col.column(align=True) - sub.prop(md, "start_position_x", text="X") - sub.prop(md, "start_position_y", text="Y") - col.prop(md, "falloff_radius", text="Falloff") - - layout.separator() - - layout.prop(md, "start_position_object") - row = layout.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - split = layout.split(factor=0.33) - col = split.column() - col.label(text="Texture") - col = split.column() - col.template_ID(md, "texture", new="texture.new") - layout.prop(md, "texture_coords") - if md.texture_coords == 'UV' and ob.type == 'MESH': - layout.prop_search(md, "uv_layer", ob.data, "uv_layers") - elif md.texture_coords == 'OBJECT': - layout.prop(md, "texture_coords_object") - obj = md.texture_coords_object - if obj and obj.type == 'ARMATURE': - layout.prop_search(md, "texture_coords_bone", obj.data, "bones") - - layout.separator() - - split = layout.split() - - col = split.column() - col.prop(md, "speed", slider=True) - col.prop(md, "height", slider=True) - - col = split.column() - col.prop(md, "width", slider=True) - col.prop(md, "narrowness", slider=True) - - def REMESH(self, layout, _ob, md): - if not bpy.app.build_options.mod_remesh: - layout.label(text="Built without Remesh modifier") - return - - layout.prop(md, "mode") - - row = layout.row() - if md.mode == 'VOXEL': - layout.prop(md, "voxel_size") - layout.prop(md, "adaptivity") - else: - row.prop(md, "octree_depth") - row.prop(md, "scale") - - if md.mode == 'SHARP': - layout.prop(md, "sharpness") - - layout.prop(md, "use_remove_disconnected") - row = layout.row() - row.active = md.use_remove_disconnected - row.prop(md, "threshold") - - layout.prop(md, "use_smooth_shade") - - @staticmethod - def vertex_weight_mask(layout, ob, md): - layout.label(text="Influence/Mask Options:") - - split = layout.split(factor=0.4) - split.label(text="Global Influence:") - split.prop(md, "mask_constant", text="") - - if not md.mask_texture: - split = layout.split(factor=0.4) - split.label(text="Vertex Group Mask:") - row = split.row(align=True) - row.prop_search(md, "mask_vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_mask_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - if not md.mask_vertex_group: - split = layout.split(factor=0.4) - split.label(text="Texture Mask:") - split.template_ID(md, "mask_texture", new="texture.new") - if md.mask_texture: - split = layout.split() - - col = split.column() - col.label(text="Texture Coordinates:") - col.prop(md, "mask_tex_mapping", text="") - - col = split.column() - col.label(text="Use Channel:") - col.prop(md, "mask_tex_use_channel", text="") - - if md.mask_tex_mapping == 'OBJECT': - layout.prop(md, "mask_tex_map_object", text="Object") - obj = md.mask_tex_map_object - if obj and obj.type == 'ARMATURE': - layout.prop_search(md, "mask_tex_map_bone", obj.data, "bones", text="Bone") - elif md.mask_tex_mapping == 'UV' and ob.type == 'MESH': - layout.prop_search(md, "mask_tex_uv_layer", ob.data, "uv_layers") - - def VERTEX_WEIGHT_EDIT(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.label(text="Vertex Group:") - col.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - - col.label(text="Default Weight:") - col.prop(md, "default_weight", text="") - - col = split.column() - col.prop(md, "use_add") - sub = col.column() - sub.active = md.use_add - sub.prop(md, "add_threshold") - - col = col.column() - col.prop(md, "use_remove") - sub = col.column() - sub.active = md.use_remove - sub.prop(md, "remove_threshold") - - layout.separator() - - row = layout.row(align=True) - row.prop(md, "falloff_type") - row.prop(md, "invert_falloff", text="", icon='ARROW_LEFTRIGHT') - if md.falloff_type == 'CURVE': - layout.template_curve_mapping(md, "map_curve") - - row = layout.row(align=True) - row.prop(md, "normalize") - - # Common mask options - layout.separator() - self.vertex_weight_mask(layout, ob, md) - - def VERTEX_WEIGHT_MIX(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.label(text="Vertex Group A:") - row = col.row(align=True) - row.prop_search(md, "vertex_group_a", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group_a", text="", icon='ARROW_LEFTRIGHT') - col.label(text="Default Weight A:") - col.prop(md, "default_weight_a", text="") - - col.label(text="Mix Mode:") - col.prop(md, "mix_mode", text="") - - col = split.column() - col.label(text="Vertex Group B:") - row = col.row(align=True) - row.prop_search(md, "vertex_group_b", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group_b", text="", icon='ARROW_LEFTRIGHT') - col.label(text="Default Weight B:") - col.prop(md, "default_weight_b", text="") - - col.label(text="Mix Set:") - col.prop(md, "mix_set", text="") - - row = layout.row(align=True) - row.prop(md, "normalize") - - # Common mask options - layout.separator() - self.vertex_weight_mask(layout, ob, md) - - def VERTEX_WEIGHT_PROXIMITY(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.label(text="Vertex Group:") - col.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - - col = split.column() - col.label(text="Target Object:") - col.prop(md, "target", text="") - - split = layout.split() - - col = split.column() - col.label(text="Distance:") - col.prop(md, "proximity_mode", text="") - if md.proximity_mode == 'GEOMETRY': - col.row().prop(md, "proximity_geometry") - - col = split.column() - col.label() - col.prop(md, "min_dist") - col.prop(md, "max_dist") - - layout.separator() - row = layout.row(align=True) - row.prop(md, "falloff_type") - row.prop(md, "invert_falloff", text="", icon='ARROW_LEFTRIGHT') - - row = layout.row(align=True) - row.prop(md, "normalize") - - # Common mask options - layout.separator() - self.vertex_weight_mask(layout, ob, md) - - def SKIN(self, layout, _ob, md): - row = layout.row() - row.operator("object.skin_armature_create", text="Create Armature") - row.operator("mesh.customdata_skin_add") - - layout.separator() - - row = layout.row(align=True) - row.prop(md, "branch_smoothing") - row.prop(md, "use_smooth_shade") - - split = layout.split() - - col = split.column() - col.label(text="Selected Vertices:") - sub = col.column(align=True) - sub.operator("object.skin_loose_mark_clear", text="Mark Loose").action = 'MARK' - sub.operator("object.skin_loose_mark_clear", text="Clear Loose").action = 'CLEAR' - - sub = col.column() - sub.operator("object.skin_root_mark", text="Mark Root") - sub.operator("object.skin_radii_equalize", text="Equalize Radii") - - col = split.column() - col.label(text="Symmetry Axes:") - col.prop(md, "use_x_symmetry") - col.prop(md, "use_y_symmetry") - col.prop(md, "use_z_symmetry") - - def TRIANGULATE(self, layout, _ob, md): - row = layout.row() - - col = row.column() - col.label(text="Quad Method:") - col.prop(md, "quad_method", text="") - col.prop(md, "keep_custom_normals") - col = row.column() - col.label(text="Ngon Method:") - col.prop(md, "ngon_method", text="") - col.label(text="Minimum Vertices:") - col.prop(md, "min_vertices", text="") - - def UV_WARP(self, layout, ob, md): - split = layout.split() - col = split.column() - col.prop(md, "center") - - col = split.column() - col.label(text="UV Axis:") - col.prop(md, "axis_u", text="") - col.prop(md, "axis_v", text="") - - split = layout.split() - col = split.column() - col.label(text="From:") - col.prop(md, "object_from", text="") - - col = split.column() - col.label(text="To:") - col.prop(md, "object_to", text="") - - split = layout.split() - col = split.column() - obj = md.object_from - if obj and obj.type == 'ARMATURE': - col.label(text="Bone:") - col.prop_search(md, "bone_from", obj.data, "bones", text="") - - col = split.column() - obj = md.object_to - if obj and obj.type == 'ARMATURE': - col.label(text="Bone:") - col.prop_search(md, "bone_to", obj.data, "bones", text="") - - split = layout.split() - col = split.column() - col.label(text="Offset:") - col.prop(md, "offset", text="") - - col = split.column() - col.label(text="Scale:") - col.prop(md, "scale", text="") - - col = split.column() - col.label(text="Rotate:") - col.prop(md, "rotation", text="") - - split = layout.split() - - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - col = split.column() - col.label(text="UV Map:") - col.prop_search(md, "uv_layer", ob.data, "uv_layers", text="") - - def WIREFRAME(self, layout, ob, md): - has_vgroup = bool(md.vertex_group) - - split = layout.split() - - col = split.column() - col.prop(md, "thickness", text="Thickness") - - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - sub = row.row(align=True) - sub.active = has_vgroup - sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - row = col.row(align=True) - row.active = has_vgroup - row.prop(md, "thickness_vertex_group", text="Factor") - - col.prop(md, "use_crease", text="Crease Edges") - row = col.row() - row.active = md.use_crease - row.prop(md, "crease_weight", text="Crease Weight") - - col = split.column() - - col.prop(md, "offset") - col.prop(md, "use_even_offset", text="Even Thickness") - col.prop(md, "use_relative_offset", text="Relative Thickness") - col.prop(md, "use_boundary", text="Boundary") - col.prop(md, "use_replace", text="Replace Original") - - col.prop(md, "material_offset", text="Material Offset") - - def WELD(self, layout, ob, md): - layout.prop(md, "merge_threshold", text="Distance") - layout.prop(md, "max_interactions") - row = layout.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - def DATA_TRANSFER(self, layout, ob, md): - row = layout.row(align=True) - row.prop(md, "object") - sub = row.row(align=True) - sub.active = bool(md.object) - sub.prop(md, "use_object_transform", text="", icon='GROUP') - - layout.separator() - - split = layout.split(factor=0.333) - split.prop(md, "use_vert_data") - use_vert = md.use_vert_data - row = split.row() - row.active = use_vert - row.prop(md, "vert_mapping", text="") - if use_vert: - col = layout.column(align=True) - split = col.split(factor=0.333, align=True) - sub = split.column(align=True) - sub.prop(md, "data_types_verts") - sub = split.column(align=True) - row = sub.row(align=True) - row.prop(md, "layers_vgroup_select_src", text="") - row.label(icon='RIGHTARROW') - row.prop(md, "layers_vgroup_select_dst", text="") - row = sub.row(align=True) - row.label(text="", icon='NONE') - - layout.separator() - - split = layout.split(factor=0.333) - split.prop(md, "use_edge_data") - use_edge = md.use_edge_data - row = split.row() - row.active = use_edge - row.prop(md, "edge_mapping", text="") - if use_edge: - col = layout.column(align=True) - split = col.split(factor=0.333, align=True) - sub = split.column(align=True) - sub.prop(md, "data_types_edges") - - layout.separator() - - split = layout.split(factor=0.333) - split.prop(md, "use_loop_data") - use_loop = md.use_loop_data - row = split.row() - row.active = use_loop - row.prop(md, "loop_mapping", text="") - if use_loop: - col = layout.column(align=True) - split = col.split(factor=0.333, align=True) - sub = split.column(align=True) - sub.prop(md, "data_types_loops") - sub = split.column(align=True) - row = sub.row(align=True) - row.label(text="", icon='NONE') - row = sub.row(align=True) - row.prop(md, "layers_vcol_select_src", text="") - row.label(icon='RIGHTARROW') - row.prop(md, "layers_vcol_select_dst", text="") - row = sub.row(align=True) - row.prop(md, "layers_uv_select_src", text="") - row.label(icon='RIGHTARROW') - row.prop(md, "layers_uv_select_dst", text="") - col.prop(md, "islands_precision") - - layout.separator() - - split = layout.split(factor=0.333) - split.prop(md, "use_poly_data") - use_poly = md.use_poly_data - row = split.row() - row.active = use_poly - row.prop(md, "poly_mapping", text="") - if use_poly: - col = layout.column(align=True) - split = col.split(factor=0.333, align=True) - sub = split.column(align=True) - sub.prop(md, "data_types_polys") - - layout.separator() - - split = layout.split() - col = split.column() - row = col.row(align=True) - sub = row.row(align=True) - sub.active = md.use_max_distance - sub.prop(md, "max_distance") - row.prop(md, "use_max_distance", text="", icon='STYLUS_PRESSURE') - - col = split.column() - col.prop(md, "ray_radius") - - layout.separator() - - split = layout.split() - col = split.column() - col.prop(md, "mix_mode") - col.prop(md, "mix_factor") - - col = split.column() - row = col.row() - row.active = bool(md.object) - row.operator("object.datalayout_transfer", text="Generate Data Layers") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - sub = row.row(align=True) - sub.active = bool(md.vertex_group) - sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - def NORMAL_EDIT(self, layout, ob, md): - has_vgroup = bool(md.vertex_group) - do_polynors_fix = not md.no_polynors_fix - needs_object_offset = (((md.mode == 'RADIAL') and not md.target) or - ((md.mode == 'DIRECTIONAL') and md.use_direction_parallel)) - - row = layout.row() - row.prop(md, "mode", expand=True) - - split = layout.split() - - col = split.column() - col.prop(md, "target", text="") - sub = col.column(align=True) - sub.active = needs_object_offset - sub.prop(md, "offset") - row = col.row(align=True) - - col = split.column() - row = col.row() - row.active = (md.mode == 'DIRECTIONAL') - row.prop(md, "use_direction_parallel") - - subcol = col.column(align=True) - subcol.label(text="Mix Mode:") - subcol.prop(md, "mix_mode", text="") - subcol.prop(md, "mix_factor") - row = subcol.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - sub = row.row(align=True) - sub.active = has_vgroup - sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - row = subcol.row(align=True) - row.prop(md, "mix_limit") - row.prop(md, "no_polynors_fix", text="", icon='UNLOCKED' if do_polynors_fix else 'LOCKED') - - def CORRECTIVE_SMOOTH(self, layout, ob, md): - is_bind = md.is_bind - - layout.prop(md, "factor", text="Factor") - layout.prop(md, "iterations") - layout.prop(md, "scale") - row = layout.row() - row.prop(md, "smooth_type") - - split = layout.split() - - col = split.column() - col.label(text="Vertex Group:") - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - - col = split.column() - col.prop(md, "use_only_smooth") - col.prop(md, "use_pin_boundary") - - layout.prop(md, "rest_source") - if md.rest_source == 'BIND': - layout.operator("object.correctivesmooth_bind", text="Unbind" if is_bind else "Bind") - - def WEIGHTED_NORMAL(self, layout, ob, md): - layout.label(text="Weighting Mode:") - split = layout.split(align=True) - col = split.column(align=True) - col.prop(md, "mode", text="") - col.prop(md, "weight", text="Weight") - col.prop(md, "keep_sharp") - - col = split.column(align=True) - row = col.row(align=True) - row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - row.active = bool(md.vertex_group) - row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') - col.prop(md, "thresh", text="Threshold") - col.prop(md, "face_influence") - - def SIMULATION(self, layout, ob, md): - layout.prop(md, "simulation") - layout.prop(md, "data_path") + layout.template_modifiers() class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel): diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index ad67ee290b0..e4cf7d44f05 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -28,6 +28,7 @@ extern "C" { #endif +struct ARegionType; struct BMEditMesh; struct CustomData_MeshMasks; struct DepsNodeHandle; @@ -351,13 +352,22 @@ typedef struct ModifierTypeInfo { * more like "ensure the data is freed". */ void (*freeRuntimeData)(void *runtime_data); + + /* Register the panel types for the modifier's UI. */ + void (*panelRegister)(struct ARegionType *region_type); } ModifierTypeInfo; +/* Used to find a modifier's panel type. */ +#define MODIFIER_TYPE_PANEL_PREFIX "MOD_PT_" + /* Initialize modifier's global data (type info and some common global storages). */ void BKE_modifier_init(void); const ModifierTypeInfo *BKE_modifier_get_info(ModifierType type); +/* For modifier UI panels. */ +void BKE_modifier_type_panel_id(ModifierType type, char *r_idname); + /* Modifier utility calls, do call through type pointer and return * default values if pointer is optional. */ diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 6b54a530034..324a9d3ccb0 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -116,6 +116,17 @@ const ModifierTypeInfo *BKE_modifier_get_info(ModifierType type) } } +/** + * Get the idname of the modifier type's panel, which was defined in the #panelRegister callback. + */ +void BKE_modifier_type_panel_id(ModifierType type, char *r_idname) +{ + const ModifierTypeInfo *mti = BKE_modifier_get_info(type); + + strcpy(r_idname, MODIFIER_TYPE_PANEL_PREFIX); + strcat(r_idname, mti->name); +} + /***/ ModifierData *BKE_modifier_new(int type) @@ -127,8 +138,9 @@ ModifierData *BKE_modifier_new(int type) BLI_strncpy(md->name, DATA_(mti->name), sizeof(md->name)); md->type = type; - md->mode = eModifierMode_Realtime | eModifierMode_Render | eModifierMode_Expanded; + md->mode = eModifierMode_Realtime | eModifierMode_Render; md->flag = eModifierFlag_OverrideLibrary_Local; + md->ui_expand_flag = 1; /* Only open the main panel at the beginning, not the subpanels. */ if (mti->flags & eModifierTypeFlag_EnableInEditmode) { md->mode |= eModifierMode_Editmode; @@ -342,6 +354,7 @@ void BKE_modifier_copydata_ex(ModifierData *md, ModifierData *target, const int target->mode = md->mode; target->flag = md->flag; + target->ui_expand_flag = md->ui_expand_flag; if (mti->copyData) { mti->copyData(md, target, flag); diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index ed23b69c623..c5628b43960 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -266,5 +266,18 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) */ { /* Keep this block, even when empty. */ + + if (!DNA_struct_elem_find(fd->filesdna, "ModifierData", "short", "ui_expand_flag")) { + for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) { + LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { + if (md->mode & eModifierMode_Expanded_DEPRECATED) { + md->ui_expand_flag = 1; + } + else { + md->ui_expand_flag = 0; + } + } + } + } } } diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index e027efce1d3..cd25ee54392 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -370,12 +370,17 @@ bool ED_object_modifier_remove(struct ReportList *reports, struct Object *ob, struct ModifierData *md); void ED_object_modifier_clear(struct Main *bmain, struct Object *ob); -int ED_object_modifier_move_down(struct ReportList *reports, - struct Object *ob, - struct ModifierData *md); -int ED_object_modifier_move_up(struct ReportList *reports, - struct Object *ob, - struct ModifierData *md); +bool ED_object_modifier_move_down(struct ReportList *reports, + struct Object *ob, + struct ModifierData *md); +bool ED_object_modifier_move_up(struct ReportList *reports, + struct Object *ob, + struct ModifierData *md); +bool ED_object_modifier_move_to_index(struct ReportList *reports, + struct Object *ob, + struct ModifierData *md, + const int index); + int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Depsgraph *depsgraph, diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 01bc59f71e7..11dbb105072 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -2002,7 +2002,7 @@ void uiTemplatePathBuilder(uiLayout *layout, const char *propname, struct PointerRNA *root_ptr, const char *text); -uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); +void uiTemplateModifiers(uiLayout *layout, struct bContext *C); uiLayout *uiTemplateGpencilModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); void uiTemplateGpencilColorPreview(uiLayout *layout, struct bContext *C, diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 6001e1ea1b5..1d55e2b3e4b 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1816,360 +1816,50 @@ void uiTemplatePathBuilder(uiLayout *layout, /** \} */ /* -------------------------------------------------------------------- */ -/** \name Modifier Template +/** \name Modifiers Template + * + * Template for building the panel layout for the active object's modifiers. * \{ */ -#define ERROR_LIBDATA_MESSAGE TIP_("Can't edit external library data") - -static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v) +static void modifier_panel_id(void *md_link, char *r_name) { - Object *ob = ob_v; - ModifierData *md = md_v; - ModifierData *nmd = BKE_modifier_new(md->type); - - BKE_modifier_copydata(md, nmd); - nmd->mode &= ~eModifierMode_Virtual; - - BLI_addhead(&ob->modifiers, nmd); - - BKE_modifier_unique_name(&ob->modifiers, nmd); - - ob->partype = PAROBJECT; - - WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); - DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); - - ED_undo_push(C, "Modifier convert to real"); + ModifierData *md = (ModifierData *)md_link; + BKE_modifier_type_panel_id(md->type, r_name); } -static bool modifier_can_delete(ModifierData *md) +void uiTemplateModifiers(uiLayout *UNUSED(layout), bContext *C) { - /* fluid particle modifier can't be deleted here */ - if (md->type == eModifierType_ParticleSystem) { - short particle_type = ((ParticleSystemModifierData *)md)->psys->part->type; - if (ELEM(particle_type, - PART_FLUID, - PART_FLUID_FLIP, - PART_FLUID_FOAM, - PART_FLUID_SPRAY, - PART_FLUID_BUBBLE, - PART_FLUID_TRACER, - PART_FLUID_SPRAYFOAM, - PART_FLUID_SPRAYBUBBLE, - PART_FLUID_FOAMBUBBLE, - PART_FLUID_SPRAYFOAMBUBBLE)) { - return false; - } - } - return true; -} + ScrArea *sa = CTX_wm_area(C); + ARegion *region = CTX_wm_region(C); -/* Check whether Modifier is a simulation or not, - * this is used for switching to the physics/particles context tab */ -static int modifier_is_simulation(ModifierData *md) -{ - /* Physic Tab */ - if (ELEM(md->type, - eModifierType_Cloth, - eModifierType_Collision, - eModifierType_Fluidsim, - eModifierType_Fluid, - eModifierType_Softbody, - eModifierType_Surface, - eModifierType_DynamicPaint)) { - return 1; - } - /* Particle Tab */ - else if (md->type == eModifierType_ParticleSystem) { - return 2; - } - else { - return 0; - } -} - -static uiLayout *draw_modifier(uiLayout *layout, - Scene *scene, - Object *ob, - ModifierData *md, - int index, - int cageIndex, - int lastCageIndex) -{ - const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); - PointerRNA ptr; - uiBut *but; - uiBlock *block; - uiLayout *box, *column, *row, *sub; - uiLayout *result = NULL; - int isVirtual = (md->mode & eModifierMode_Virtual); - char str[128]; - - /* create RNA pointer */ - RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr); - - column = uiLayoutColumn(layout, true); - uiLayoutSetContextPointer(column, "modifier", &ptr); - - /* rounded header ------------------------------------------------------------------- */ - box = uiLayoutBox(column); - - if (isVirtual) { - row = uiLayoutRow(box, false); - uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND); - block = uiLayoutGetBlock(row); - /* VIRTUAL MODIFIER */ - /* XXX this is not used now, since these cannot be accessed via RNA */ - BLI_snprintf(str, sizeof(str), IFACE_("%s parent deform"), md->name); - uiDefBut(block, - UI_BTYPE_LABEL, - 0, - str, - 0, - 0, - 185, - UI_UNIT_Y, - NULL, - 0.0, - 0.0, - 0.0, - 0.0, - TIP_("Modifier name")); - - but = uiDefBut(block, - UI_BTYPE_BUT, - 0, - IFACE_("Make Real"), - 0, - 0, - 80, - 16, - NULL, - 0.0, - 0.0, - 0.0, - 0.0, - TIP_("Convert virtual modifier to a real modifier")); - UI_but_func_set(but, modifiers_convertToReal, ob, md); + Object *ob; + SpaceProperties *sbuts = CTX_wm_space_properties(C); + if (sbuts != NULL && (sbuts->pinid != NULL) && GS(sbuts->pinid->name) == ID_OB) { + ob = (Object *)sbuts->pinid; } else { - /* REAL MODIFIER */ - row = uiLayoutRow(box, false); - block = uiLayoutGetBlock(row); - - UI_block_emboss_set(block, UI_EMBOSS_NONE); - /* Open/Close ................................. */ - uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NONE); - - /* modifier-type icon */ - uiItemL(row, "", RNA_struct_ui_icon(ptr.type)); - UI_block_emboss_set(block, UI_EMBOSS); - - /* modifier name */ - if (mti->isDisabled && mti->isDisabled(scene, md, 0)) { - uiLayoutSetRedAlert(row, true); - } - uiItemR(row, &ptr, "name", 0, "", ICON_NONE); - uiLayoutSetRedAlert(row, false); - - /* mode enabling buttons */ - UI_block_align_begin(block); - /* Collision and Surface are always enabled, hide buttons! */ - if (((md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && - (md->type != eModifierType_Surface)) { - uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE); - uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE); - - if (mti->flags & eModifierTypeFlag_SupportsEditmode) { - sub = uiLayoutRow(row, true); - if (!(md->mode & eModifierMode_Realtime)) { - uiLayoutSetActive(sub, false); - } - uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE); - } - } - - if (ob->type == OB_MESH) { - if (BKE_modifier_supports_cage(scene, md) && (index <= lastCageIndex)) { - sub = uiLayoutRow(row, true); - if (index < cageIndex || !BKE_modifier_couldbe_cage(scene, md)) { - uiLayoutSetActive(sub, false); - } - uiItemR(sub, &ptr, "show_on_cage", 0, "", ICON_NONE); - } - } /* tessellation point for curve-typed objects */ - else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { - /* some modifiers could work with pre-tessellated curves only */ - if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) { - /* add disabled pre-tessellated button, so users could have - * message for this modifiers */ - but = uiDefIconButBitI(block, - UI_BTYPE_TOGGLE, - eModifierMode_ApplyOnSpline, - 0, - ICON_SURFACE_DATA, - 0, - 0, - UI_UNIT_X - 2, - UI_UNIT_Y, - &md->mode, - 0.0, - 0.0, - 0.0, - 0.0, - TIP_("This modifier can only be applied on splines' points")); - UI_but_flag_enable(but, UI_BUT_DISABLED); - } - else if (mti->type != eModifierTypeType_Constructive) { - /* constructive modifiers tessellates curve before applying */ - uiItemR(row, &ptr, "use_apply_on_spline", 0, "", ICON_NONE); - } - } - - UI_block_align_end(block); - - /* Up/Down + Delete ........................... */ - UI_block_align_begin(block); - uiItemO(row, "", ICON_TRIA_UP, "OBJECT_OT_modifier_move_up"); - uiItemO(row, "", ICON_TRIA_DOWN, "OBJECT_OT_modifier_move_down"); - UI_block_align_end(block); - - UI_block_emboss_set(block, UI_EMBOSS_NONE); - /* When Modifier is a simulation, - * show button to switch to context rather than the delete button. */ - if (modifier_can_delete(md) && !modifier_is_simulation(md)) { - uiItemO(row, "", ICON_X, "OBJECT_OT_modifier_remove"); - } - else if (modifier_is_simulation(md) == 1) { - uiItemStringO( - row, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PHYSICS"); - } - else if (modifier_is_simulation(md) == 2) { - uiItemStringO( - row, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PARTICLES"); - } - UI_block_emboss_set(block, UI_EMBOSS); + ob = CTX_data_active_object(C); } + ListBase *modifiers = &ob->modifiers; - /* modifier settings (under the header) --------------------------------------------------- */ - if (!isVirtual && (md->mode & eModifierMode_Expanded)) { - /* apply/convert/copy */ - box = uiLayoutBox(column); - row = uiLayoutRow(box, false); + bool panels_match = UI_panel_list_matches_data(region, modifiers, modifier_panel_id); - if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) { - /* only here obdata, the rest of modifiers is ob level */ - UI_block_lock_set(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE); + if (!panels_match) { + UI_panels_free_instanced(C, region); + ModifierData *md = modifiers->first; + for (int i = 0; md; i++, md = md->next) { + const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); + if (mti->panelRegister) { + char panel_idname[MAX_NAME]; + modifier_panel_id(md, panel_idname); - if (md->type == eModifierType_ParticleSystem) { - ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; - - if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) { - if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) { - uiItemO(row, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), - ICON_NONE, - "OBJECT_OT_duplicates_make_real"); - } - else if (psys->part->ren_as == PART_DRAW_PATH) { - uiItemO(row, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), - ICON_NONE, - "OBJECT_OT_modifier_convert"); - } + Panel *new_panel = UI_panel_add_instanced(sa, region, ®ion->panels, panel_idname, i); + if (new_panel != NULL) { + UI_panel_set_expand_from_list_data(C, new_panel); } } - else { - uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT); - uiItemEnumO(row, - "OBJECT_OT_modifier_apply", - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), - 0, - "apply_as", - MODIFIER_APPLY_DATA); - - if (BKE_modifier_is_same_topology(md) && !BKE_modifier_is_non_geometrical(md)) { - uiItemEnumO(row, - "OBJECT_OT_modifier_apply", - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"), - 0, - "apply_as", - MODIFIER_APPLY_SHAPE); - } - } - - UI_block_lock_clear(block); - UI_block_lock_set(block, ob && ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE); - - if (!ELEM(md->type, - eModifierType_Fluidsim, - eModifierType_Softbody, - eModifierType_ParticleSystem, - eModifierType_Cloth, - eModifierType_Fluid)) { - uiItemO(row, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"), - ICON_NONE, - "OBJECT_OT_modifier_copy"); - } } - - /* result is the layout block inside the box, - * that we return so that modifier settings can be drawn */ - result = uiLayoutColumn(box, false); - block = uiLayoutAbsoluteBlock(box); } - - /* error messages */ - if (md->error) { - box = uiLayoutBox(column); - row = uiLayoutRow(box, false); - uiItemL(row, md->error, ICON_ERROR); - } - - return result; -} - -uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - Scene *scene = CTX_data_scene(C); - Object *ob; - ModifierData *md, *vmd; - VirtualModifierData virtualModifierData; - int i, lastCageIndex, cageIndex; - - /* verify we have valid data */ - if (!RNA_struct_is_a(ptr->type, &RNA_Modifier)) { - RNA_warning("Expected modifier on object"); - return NULL; - } - - ob = (Object *)ptr->owner_id; - md = ptr->data; - - if (!ob || !(GS(ob->id.name) == ID_OB)) { - RNA_warning("Expected modifier on object"); - return NULL; - } - - UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED(ob)), ERROR_LIBDATA_MESSAGE); - - /* find modifier and draw it */ - cageIndex = BKE_modifiers_get_cage_index(scene, ob, &lastCageIndex, 0); - - /* XXX virtual modifiers are not accessible for python */ - vmd = BKE_modifiers_get_virtual_modifierlist(ob, &virtualModifierData); - - for (i = 0; vmd; i++, vmd = vmd->next) { - if (md == vmd) { - return draw_modifier(layout, scene, ob, md, i, cageIndex, lastCageIndex); - } - else if (vmd->mode & eModifierMode_Virtual) { - i--; - } - } - - return NULL; } /** \} */ @@ -2178,6 +1868,8 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) /** \name Grease Pencil Modifier Template * \{ */ +#define ERROR_LIBDATA_MESSAGE TIP_("Can't edit external library data") + static uiLayout *gpencil_draw_modifier(uiLayout *layout, Object *ob, GpencilModifierData *md) { const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type); diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index d7a7b4ca110..c5a6e38fbcb 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -162,6 +162,7 @@ void OBJECT_OT_modifier_add(struct wmOperatorType *ot); void OBJECT_OT_modifier_remove(struct wmOperatorType *ot); void OBJECT_OT_modifier_move_up(struct wmOperatorType *ot); void OBJECT_OT_modifier_move_down(struct wmOperatorType *ot); +void OBJECT_OT_modifier_move_to_index(struct wmOperatorType *ot); void OBJECT_OT_modifier_apply(struct wmOperatorType *ot); void OBJECT_OT_modifier_convert(struct wmOperatorType *ot); void OBJECT_OT_modifier_copy(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 9398a5f2ce7..0bd49f74db9 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -430,7 +430,7 @@ void ED_object_modifier_clear(Main *bmain, Object *ob) DEG_relations_tag_update(bmain); } -int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md) +bool ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md) { if (md->prev) { const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); @@ -440,18 +440,22 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md if (nmti->flags & eModifierTypeFlag_RequiresOriginalData) { BKE_report(reports, RPT_WARNING, "Cannot move above a modifier requiring original data"); - return 0; + return false; } } BLI_remlink(&ob->modifiers, md); BLI_insertlinkbefore(&ob->modifiers, md->prev, md); } + else { + BKE_report(reports, RPT_WARNING, "Cannot move modifier beyond the start of the list"); + return false; + } - return 1; + return true; } -int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *md) +bool ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *md) { if (md->next) { const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); @@ -461,15 +465,53 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData * if (nmti->type != eModifierTypeType_OnlyDeform) { BKE_report(reports, RPT_WARNING, "Cannot move beyond a non-deforming modifier"); - return 0; + return false; } } BLI_remlink(&ob->modifiers, md); BLI_insertlinkafter(&ob->modifiers, md->next, md); } + else { + BKE_report(reports, RPT_WARNING, "Cannot move modifier beyond the end of the list"); + return false; + } - return 1; + return true; +} + +bool ED_object_modifier_move_to_index(ReportList *reports, + Object *ob, + ModifierData *md, + const int index) +{ + BLI_assert(md != NULL); + BLI_assert(index >= 0); + if (index >= BLI_listbase_count(&ob->modifiers)) { + BKE_report(reports, RPT_WARNING, "Cannot move modifier beyond the end of the stack"); + return false; + } + + int md_index = BLI_findindex(&ob->modifiers, md); + BLI_assert(md_index != -1); + if (md_index < index) { + /* Move modifier down in list. */ + for (; md_index < index; md_index++) { + if (!ED_object_modifier_move_down(reports, ob, md)) { + break; + } + } + } + else { + /* Move modifier up in list. */ + for (; md_index > index; md_index--) { + if (!ED_object_modifier_move_up(reports, ob, md)) { + break; + } + } + } + + return true; } int ED_object_modifier_convert(ReportList *UNUSED(reports), @@ -1180,6 +1222,60 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot) /** \} */ /* ------------------------------------------------------------------- */ +/** \name Move to Index Modifier Operator + * \{ */ + +static bool modifier_move_to_index_poll(bContext *C) +{ + return edit_modifier_poll(C); +} + +static int modifier_move_to_index_exec(bContext *C, wmOperator *op) +{ + Object *ob = ED_object_active_context(C); + ModifierData *md = edit_modifier_property_get(op, ob, 0); + int index = RNA_int_get(op->ptr, "index"); + + if (!ED_object_modifier_move_to_index(op->reports, ob, md, index)) { + return OPERATOR_CANCELLED; + } + + DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); + + return OPERATOR_FINISHED; +} + +static int modifier_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +{ + if (edit_modifier_invoke_properties(C, op)) { + return modifier_move_to_index_exec(C, op); + } + else { + return OPERATOR_CANCELLED; + } +} + +void OBJECT_OT_modifier_move_to_index(wmOperatorType *ot) +{ + ot->name = "Move Active Modifier to Index"; + ot->description = "Move the active modifier to an index in the stack"; + ot->idname = "OBJECT_OT_modifier_move_to_index"; + + ot->invoke = modifier_move_to_index_invoke; + ot->exec = modifier_move_to_index_exec; + ot->poll = modifier_move_to_index_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; + edit_modifier_properties(ot); + RNA_def_int( + ot->srna, "index", 0, 0, INT_MAX, "Index", "The index to move the modifier to", 0, INT_MAX); +} + +/** \} */ + +/* ------------------------------------------------------------------- */ /** \name Apply Modifier Operator * \{ */ diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 819b6c18a44..05f1ced8615 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -130,6 +130,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_modifier_remove); WM_operatortype_append(OBJECT_OT_modifier_move_up); WM_operatortype_append(OBJECT_OT_modifier_move_down); + WM_operatortype_append(OBJECT_OT_modifier_move_to_index); WM_operatortype_append(OBJECT_OT_modifier_apply); WM_operatortype_append(OBJECT_OT_modifier_convert); WM_operatortype_append(OBJECT_OT_modifier_copy); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index c06c107d4a3..187334a5c34 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -30,8 +30,11 @@ #include "BLI_utildefines.h" #include "BKE_context.h" +#include "BKE_modifier.h" #include "BKE_screen.h" +#include "DNA_modifier_types.h" + #include "ED_screen.h" #include "ED_space_api.h" #include "ED_view3d.h" /* To draw toolbar UI. */ @@ -632,6 +635,15 @@ void ED_spacetype_buttons(void) #endif BLI_addhead(&st->regiontypes, art); + /* Register the panel types from modifiers. The actual panels are built per modifier rather than + * per modifier type. */ + for (ModifierType i = 0; i < NUM_MODIFIER_TYPES; i++) { + const ModifierTypeInfo *mti = BKE_modifier_get_info(i); + if (mti != NULL && mti->panelRegister != NULL) { + mti->panelRegister(art); + } + } + /* regions: header */ art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region"); art->regionid = RGN_TYPE_HEADER; diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 13972ae032d..a2b96ac2772 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -103,7 +103,8 @@ typedef enum ModifierMode { eModifierMode_Render = (1 << 1), eModifierMode_Editmode = (1 << 2), eModifierMode_OnCage = (1 << 3), - eModifierMode_Expanded = (1 << 4), + /* Old modifier box expansion, just for versioning. */ + eModifierMode_Expanded_DEPRECATED = (1 << 4), eModifierMode_Virtual = (1 << 5), eModifierMode_ApplyOnSpline = (1 << 6), eModifierMode_DisableTemporary = (1u << 31), @@ -115,7 +116,8 @@ typedef struct ModifierData { int type, mode; int stackindex; short flag; - char _pad[2]; + /* An "expand" bit for each of the modifier's (sub)panels. */ + short ui_expand_flag; /** MAX_NAME. */ char name[64]; diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 585f866ffae..e9b8595ce3c 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2808,7 +2808,7 @@ static void rna_def_modifier_array(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); /* PROP_TRANSLATION causes units to be used which we don't want */ - prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "scale"); RNA_def_property_ui_text( prop, @@ -2824,7 +2824,8 @@ static void rna_def_modifier_array(BlenderRNA *brna) prop = RNA_def_property(srna, "use_merge_vertices_cap", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGEFINAL); - RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in first and last duplicates"); + RNA_def_property_ui_text( + prop, "Merge End Vertices", "Merge vertices in first and last duplicates"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE); @@ -3356,7 +3357,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna) prop = RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_cast_type_items); - RNA_def_property_ui_text(prop, "Cast Type", "Target object shape"); + RNA_def_property_ui_text(prop, "Shape", "Target object shape"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); @@ -3958,6 +3959,12 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem prop_affect_items[] = { + {0, "EDGES", 0, "Edges", "Affect only edges"}, + {MOD_BEVEL_VERT, "VERTICES", 0, "Vertices", "Affect only vertices"}, + {0, NULL, 0, NULL, NULL}, + }; + srna = RNA_def_struct(brna, "BevelModifier", "Modifier"); RNA_def_struct_ui_text( srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded"); @@ -3986,9 +3993,10 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts"); RNA_def_property_update(prop, 0, "rna_BevelModifier_update_segments"); - prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_VERT); - RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges"); + prop = RNA_def_property(srna, "affect", PROP_ENUM, PROP_NONE); /* as an enum */ + RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags"); + RNA_def_property_enum_items(prop, prop_affect_items); + RNA_def_property_ui_text(prop, "Affect", "Affect edges or vertices"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE); @@ -4036,7 +4044,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "mat"); RNA_def_property_range(prop, -1, SHRT_MAX); RNA_def_property_ui_text( - prop, "Material", "Material index of generated faces, -1 for automatic"); + prop, "Material Index", "Material index of generated faces, -1 for automatic"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "loop_slide", PROP_BOOLEAN, PROP_NONE); @@ -4063,7 +4071,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "face_str_mode"); RNA_def_property_enum_items(prop, prop_harden_normals_items); RNA_def_property_ui_text( - prop, "Set Face Strength", "Whether to set face strength, and which faces to set it on"); + prop, "Face Strength", "Whether to set face strength, and which faces to set it on"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "miter_outer", PROP_ENUM, PROP_NONE); @@ -4164,7 +4172,7 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna) prop = RNA_def_property(srna, "wrap_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "shrinkType"); RNA_def_property_enum_items(prop, shrink_type_items); - RNA_def_property_ui_text(prop, "Mode", ""); + RNA_def_property_ui_text(prop, "Wrap Method", ""); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE); @@ -4923,7 +4931,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna), prop = RNA_def_property(srna, "mask_vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "mask_defgrp_name"); - RNA_def_property_ui_text(prop, "Mask VGroup", "Masking vertex group name"); + RNA_def_property_ui_text(prop, "Mask Vertex Group", "Masking vertex group name"); RNA_def_property_string_funcs(prop, NULL, NULL, mask_vgroup_setter); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -5422,7 +5430,7 @@ static void rna_def_modifier_remesh(BlenderRNA *brna) prop = RNA_def_property(srna, "use_remove_disconnected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_FLOOD_FILL); - RNA_def_property_ui_text(prop, "Remove Disconnected Pieces", ""); + RNA_def_property_ui_text(prop, "Remove Disconnected", ""); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE); @@ -5977,6 +5985,8 @@ static void rna_def_modifier_meshseqcache(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_ENUM_FLAG); RNA_def_property_enum_sdna(prop, NULL, "read_flag"); RNA_def_property_enum_items(prop, read_flag_items); + RNA_def_property_ui_text(prop, "Read Data", "Data to read from the cache"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); RNA_define_lib_overridable(false); @@ -6161,7 +6171,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna) {DT_TYPE_MDEFORMVERT, "VGROUP_WEIGHTS", 0, - "Vertex Group(s)", + "Vertex Groups", "Transfer active or all vertex groups"}, # if 0 /* TODO */ {DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"}, @@ -6178,19 +6188,15 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna) static const EnumPropertyItem DT_layer_edge_items[] = { {DT_TYPE_SHARP_EDGE, "SHARP_EDGE", 0, "Sharp", "Transfer sharp mark"}, {DT_TYPE_SEAM, "SEAM", 0, "UV Seam", "Transfer UV seam mark"}, - {DT_TYPE_CREASE, "CREASE", 0, "Subsurf Crease", "Transfer crease values"}, + {DT_TYPE_CREASE, "CREASE", 0, "Crease", "Transfer subdivision crease values"}, {DT_TYPE_BWEIGHT_EDGE, "BEVEL_WEIGHT_EDGE", 0, "Bevel Weight", "Transfer bevel weights"}, - {DT_TYPE_FREESTYLE_EDGE, - "FREESTYLE_EDGE", - 0, - "Freestyle Mark", - "Transfer Freestyle edge mark"}, + {DT_TYPE_FREESTYLE_EDGE, "FREESTYLE_EDGE", 0, "Freestyle", "Transfer Freestyle edge mark"}, {0, NULL, 0, NULL, NULL}, }; static const EnumPropertyItem DT_layer_loop_items[] = { {DT_TYPE_LNOR, "CUSTOM_NORMAL", 0, "Custom Normals", "Transfer custom normals"}, - {DT_TYPE_VCOL, "VCOL", 0, "VCol", "Vertex (face corners) colors"}, + {DT_TYPE_VCOL, "VCOL", 0, "Vertex Colors", "Vertex (face corners) colors"}, {DT_TYPE_UV, "UV", 0, "UVs", "Transfer UV layers"}, {0, NULL, 0, NULL, NULL}, }; @@ -6374,7 +6380,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna) 0.0f, 0.0f, 1.0f, - "Islands Handling Refinement", + "Islands Precision", "Factor controlling precision of islands handling " "(typically, 0.1 should be enough, higher values can make things really slow)", 0.0f, @@ -6855,7 +6861,7 @@ void RNA_def_modifier(BlenderRNA *brna) prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded); + RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface"); RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 8d0e403aa2d..fd65b713d15 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -1209,13 +1209,9 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR); api_ui_item_common_text(func); - func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier"); + func = RNA_def_function(srna, "template_modifiers", "uiTemplateModifiers"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); - RNA_def_function_ui_description(func, "Generates the UI layout for modifiers"); - parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data"); - RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); - parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); - RNA_def_function_return(func, parm); + RNA_def_function_ui_description(func, "Generates the UI layout for the modifier stack"); func = RNA_def_function(srna, "template_greasepencil_modifier", "uiTemplateGpencilModifier"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 8ab7d35070b..78db7de2ac2 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -23,12 +23,15 @@ set(INC intern ../blenfont ../blenkernel + ../blentranslation ../blenlib ../bmesh ../depsgraph + ../editors/include ../makesdna ../makesrna ../render/extern/include + ../windowmanager ../../../intern/eigen ../../../intern/guardedalloc ) @@ -89,6 +92,7 @@ set(SRC intern/MOD_surface.c intern/MOD_surfacedeform.c intern/MOD_triangulate.c + intern/MOD_ui_common.c intern/MOD_util.c intern/MOD_uvproject.c intern/MOD_uvwarp.c @@ -105,6 +109,7 @@ set(SRC MOD_modifiertypes.h intern/MOD_meshcache_util.h intern/MOD_solidify_util.h + intern/MOD_ui_common.h intern/MOD_util.h intern/MOD_weightvg_util.h ) @@ -157,6 +162,11 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +# To disable adaptive subdivision test in subsurf UI without cycles +if(WITH_CYCLES) + add_definitions(-DWITH_CYCLES) +endif() + # So we can have special tricks in modifier system. add_definitions(${GL_DEFINITIONS}) diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 99ce447236b..84651f79e8a 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -26,17 +26,27 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_armature_types.h" #include "DNA_mesh_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "BKE_action.h" +#include "BKE_context.h" #include "BKE_editmesh.h" #include "BKE_lattice.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" @@ -45,6 +55,7 @@ #include "MEM_guardedalloc.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void initData(ModifierData *md) @@ -244,6 +255,36 @@ static void deformMatrices(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE); + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "use_deform_preserve_volume", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "use_multi_modifier", 0, NULL, ICON_NONE); + + col = uiLayoutColumnWithHeading(layout, true, "Bind to"); + uiItemR(col, &ptr, "use_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE); + uiItemR(col, &ptr, "use_bone_envelopes", 0, IFACE_("Bone Envelopes"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Armature, panel_draw); +} + ModifierTypeInfo modifierType_Armature = { /* name */ "Armature", /* structName */ "ArmatureModifierData", @@ -274,4 +315,5 @@ ModifierTypeInfo modifierType_Armature = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index fc127c48fc9..68e12a8bbef 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -29,12 +29,16 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_curve_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_curve.h" #include "BKE_displist.h" #include "BKE_lib_id.h" @@ -42,7 +46,14 @@ #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_object_deform.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "DEG_depsgraph.h" @@ -822,6 +833,179 @@ static bool isDisabled(const struct Scene *UNUSED(scene), return false; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "fit_type", 0, NULL, ICON_NONE); + + int fit_type = RNA_enum_get(&ptr, "fit_type"); + if (fit_type == MOD_ARR_FIXEDCOUNT) { + uiItemR(layout, &ptr, "count", 0, NULL, ICON_NONE); + } + else if (fit_type == MOD_ARR_FITLENGTH) { + uiItemR(layout, &ptr, "fit_length", 0, NULL, ICON_NONE); + } + else if (fit_type == MOD_ARR_FITCURVE) { + uiItemR(layout, &ptr, "curve", 0, NULL, ICON_NONE); + } + + uiItemS(layout); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "start_cap", 0, IFACE_("Cap Start"), ICON_NONE); + uiItemR(col, &ptr, "end_cap", 0, IFACE_("End"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void relative_offset_header_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_relative_offset", 0, NULL, ICON_NONE); +} + +static void relative_offset_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiLayout *col = uiLayoutColumn(layout, false); + + uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_relative_offset")); + uiItemR(col, &ptr, "relative_offset_displace", 0, IFACE_("Factor"), ICON_NONE); +} + +static void constant_offset_header_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_constant_offset", 0, NULL, ICON_NONE); +} + +static void constant_offset_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiLayout *col = uiLayoutColumn(layout, false); + + uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_constant_offset")); + uiItemR(col, &ptr, "constant_offset_displace", 0, IFACE_("Distance"), ICON_NONE); +} + +/** + * Object offset in a subpanel for consistency with the other offset types. + */ +static void object_offset_header_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_object_offset", 0, NULL, ICON_NONE); +} + +static void object_offset_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiLayout *col = uiLayoutColumn(layout, false); + + uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_object_offset")); + uiItemR(col, &ptr, "offset_object", 0, IFACE_("Object"), ICON_NONE); +} + +static void symmetry_panel_header_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_merge_vertices", 0, IFACE_("Merge"), ICON_NONE); +} + +static void symmetry_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiLayout *col = uiLayoutColumn(layout, false); + uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_merge_vertices")); + uiItemR(col, &ptr, "merge_threshold", 0, IFACE_("Distance"), ICON_NONE); + uiItemR(col, &ptr, "use_merge_vertices_cap", 0, IFACE_("First and Last Copies"), ICON_NONE); +} + +static void uv_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "offset_u", UI_ITEM_R_EXPAND, IFACE_("Offset U"), ICON_NONE); + uiItemR(col, &ptr, "offset_v", UI_ITEM_R_EXPAND, IFACE_("V"), ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Array, panel_draw); + modifier_subpanel_register(region_type, + "relative_offset", + "", + relative_offset_header_draw, + relative_offset_draw, + panel_type); + modifier_subpanel_register(region_type, + "constant_offset", + "", + constant_offset_header_draw, + constant_offset_draw, + panel_type); + modifier_subpanel_register( + region_type, "object_offset", "", object_offset_header_draw, object_offset_draw, panel_type); + modifier_subpanel_register( + region_type, "merge", "", symmetry_panel_header_draw, symmetry_panel_draw, panel_type); + modifier_subpanel_register(region_type, "uv", "UVs", NULL, uv_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Array = { /* name */ "Array", /* structName */ "ArrayModifierData", @@ -853,4 +1037,5 @@ ModifierTypeInfo modifierType_Array = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index fb1b3cd219e..76b8985975e 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -27,16 +27,28 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_curveprofile_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" +#include "BKE_curveprofile.h" #include "BKE_deform.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "BKE_curveprofile.h" @@ -263,6 +275,149 @@ static bool isDisabled(const Scene *UNUSED(scene), ModifierData *md, bool UNUSED return (bmd->value == 0.0f); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, false); + const char *offset_name = ""; + if (RNA_enum_get(&ptr, "offset_type") == BEVEL_AMT_PERCENT) { + uiItemR(col, &ptr, "width_pct", 0, NULL, ICON_NONE); + } + else { + switch (RNA_enum_get(&ptr, "offset_type")) { + case BEVEL_AMT_DEPTH: + offset_name = "Depth"; + break; + case BEVEL_AMT_WIDTH: + offset_name = "Width"; + break; + case BEVEL_AMT_OFFSET: + offset_name = "Offset"; + break; + } + uiItemR(col, &ptr, "width", 0, IFACE_(offset_name), ICON_NONE); + } + uiItemR(col, &ptr, "offset_type", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "segments", 0, NULL, ICON_NONE); + + uiItemS(layout); + + uiItemR(layout, &ptr, "affect", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + uiItemS(layout); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "limit_method", 0, NULL, ICON_NONE); + int limit_method = RNA_enum_get(&ptr, "limit_method"); + if (limit_method == MOD_BEVEL_ANGLE) { + uiItemR(col, &ptr, "angle_limit", 0, NULL, ICON_NONE); + } + else if (limit_method == MOD_BEVEL_VGROUP) { + modifier_vgroup_ui(col, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + } + + modifier_panel_end(layout, &ptr); +} + +static void geometry_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "miter_inner", 0, IFACE_("Miter Inner"), ICON_NONE); + uiItemR(layout, &ptr, "miter_outer", 0, IFACE_("Outer"), ICON_NONE); + if (RNA_enum_get(&ptr, "miter_inner") == BEVEL_MITER_ARC) { + uiItemR(layout, &ptr, "spread", 0, NULL, ICON_NONE); + } + uiItemS(layout); + + uiItemR(layout, &ptr, "vmesh_method", 0, IFACE_("Intersections"), ICON_NONE); + uiItemR(layout, &ptr, "use_clamp_overlap", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "loop_slide", 0, NULL, ICON_NONE); +} + +static void shading_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "harden_normals", 0, NULL, ICON_NONE); + + col = uiLayoutColumnWithHeading(layout, true, IFACE_("Mark")); + uiItemR(col, &ptr, "mark_seam", 0, IFACE_("Seam"), ICON_NONE); + uiItemR(col, &ptr, "mark_sharp", 0, IFACE_("Sharp"), ICON_NONE); + + uiItemR(layout, &ptr, "material", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "face_strength_mode", 0, NULL, ICON_NONE); +} + +static void profile_panel_draw(const bContext *C, Panel *panel) +{ + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + uiLayout *layout = panel->layout; + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "profile", UI_ITEM_R_SLIDER, IFACE_("Shape"), ICON_NONE); +} + +static void custom_profile_panel_draw_header(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_custom_profile", 0, NULL, ICON_NONE); +} + +static void custom_profile_panel_draw(const bContext *C, Panel *panel) +{ + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + uiLayout *layout = panel->layout; + + uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_custom_profile")); + + uiTemplateCurveProfile(layout, &ptr, "custom_profile"); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Bevel, panel_draw); + PanelType *bevel_profil_panel = modifier_subpanel_register( + region_type, "profile", "Profile", NULL, profile_panel_draw, panel_type); + modifier_subpanel_register(region_type, + "custom", + "", + custom_profile_panel_draw_header, + custom_profile_panel_draw, + bevel_profil_panel); + modifier_subpanel_register( + region_type, "geometry", "Geometry", NULL, geometry_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "shading", "Shading", NULL, shading_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Bevel = { /* name */ "Bevel", /* structName */ "BevelModifierData", @@ -290,4 +445,5 @@ ModifierTypeInfo modifierType_Bevel = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* uiPanel */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index d8b375b0ee9..c2412b295ff 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -31,17 +31,28 @@ #include "BLI_math_geom.h" #include "BLI_math_matrix.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_global.h" /* only to check G.debug */ #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" +#include "RNA_access.h" + +#include "MOD_ui_common.h" #include "MOD_util.h" #include "DEG_depsgraph_query.h" @@ -346,6 +357,32 @@ static void requiredDataMask(Object *UNUSED(ob), r_cddata_masks->fmask |= CD_MASK_MTFACE; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "operation", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "double_threshold", 0, NULL, ICON_NONE); + + if (G.debug) { + uiLayout *col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "debug_options", 0, NULL, ICON_NONE); + } + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Boolean, panel_draw); +} + ModifierTypeInfo modifierType_Boolean = { /* name */ "Boolean", /* structName */ "BooleanModifierData", @@ -375,4 +412,5 @@ ModifierTypeInfo modifierType_Boolean = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 2cd52005362..93f97c7c5b8 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -32,15 +32,24 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "DEG_depsgraph_query.h" +#include "BKE_context.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_particle.h" #include "BKE_scene.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static void initData(ModifierData *md) { @@ -275,6 +284,52 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct return result; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "frame_start", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "frame_duration", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "use_reverse", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void random_panel_header_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_random_order", 0, NULL, ICON_NONE); +} + +static void random_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_random_order")); + uiItemR(layout, &ptr, "seed", 0, NULL, ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Build, panel_draw); + modifier_subpanel_register( + region_type, "randomize", "", random_panel_header_draw, random_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Build = { /* name */ "Build", /* structName */ "BuildModifierData", @@ -304,4 +359,5 @@ ModifierTypeInfo modifierType_Build = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index ef8530557d7..2f475e9fca6 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -25,19 +25,30 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void initData(ModifierData *md) @@ -523,6 +534,47 @@ static void deformVertsEM(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA cast_object_ptr = RNA_pointer_get(&ptr, "object"); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "cast_type", 0, NULL, ICON_NONE); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis")); + uiItemR(row, &ptr, "use_x", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_y", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_z", toggles_flag, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "radius", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "size", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "use_radius_as_size", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE); + if (!RNA_pointer_is_null(&cast_object_ptr)) { + uiItemR(layout, &ptr, "use_radius_as_size", 0, NULL, ICON_NONE); + } + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Cast, panel_draw); +} + ModifierTypeInfo modifierType_Cast = { /* name */ "Cast", /* structName */ "CastModifierData", @@ -553,4 +605,5 @@ ModifierTypeInfo modifierType_Cast = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index da7485b5a2d..c7551b1be00 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -27,15 +27,19 @@ #include "BLI_listbase.h" +#include "BLT_translation.h" + #include "DNA_cloth_types.h" #include "DNA_key_types.h" #include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" #include "MEM_guardedalloc.h" #include "BKE_cloth.h" +#include "BKE_context.h" #include "BKE_effect.h" #include "BKE_global.h" #include "BKE_key.h" @@ -44,10 +48,17 @@ #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_pointcache.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_physics.h" #include "DEG_depsgraph_query.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void initData(ModifierData *md) @@ -253,6 +264,23 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Cloth, panel_draw); +} + ModifierTypeInfo modifierType_Cloth = { /* name */ "Cloth", /* structName */ "ClothModifierData", @@ -283,4 +311,5 @@ ModifierTypeInfo modifierType_Cloth = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 0c6133ed7a6..c58ba3b62dc 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -25,13 +25,17 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "MEM_guardedalloc.h" #include "BKE_collision.h" +#include "BKE_context.h" #include "BKE_global.h" #include "BKE_lib_id.h" #include "BKE_mesh.h" @@ -39,8 +43,15 @@ #include "BKE_modifier.h" #include "BKE_pointcache.h" #include "BKE_scene.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "DEG_depsgraph_query.h" @@ -241,6 +252,23 @@ static void updateDepsgraph(ModifierData *UNUSED(md), const ModifierUpdateDepsgr DEG_add_modifier_to_transform_relation(ctx->node, "Collision Modifier"); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Collision, panel_draw); +} + ModifierTypeInfo modifierType_Collision = { /* name */ "Collision", /* structName */ "CollisionModifierData", @@ -270,4 +298,5 @@ ModifierTypeInfo modifierType_Collision = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index 3b2268ea14d..3d9f59fba24 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -27,19 +27,30 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" #include "MEM_guardedalloc.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_mesh.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "BLI_strict_flags.h" @@ -769,6 +780,42 @@ static void deformVertsEM(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "factor", 0, IFACE_("Factor"), ICON_NONE); + uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "scale", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "smooth_type", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + uiItemR(layout, &ptr, "use_only_smooth", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "use_pin_boundary", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "rest_source", 0, NULL, ICON_NONE); + if (RNA_enum_get(&ptr, "rest_source") == MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) { + uiItemO(layout, + (RNA_boolean_get(&ptr, "is_bind") ? IFACE_("Unbind") : IFACE_("Bind")), + ICON_NONE, + "OBJECT_OT_correctivesmooth_bind"); + } + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_CorrectiveSmooth, panel_draw); +} + ModifierTypeInfo modifierType_CorrectiveSmooth = { /* name */ "CorrectiveSmooth", /* structName */ "CorrectiveSmoothModifierData", @@ -798,4 +845,5 @@ ModifierTypeInfo modifierType_CorrectiveSmooth = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index eec87a918ec..491827720f0 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -25,22 +25,33 @@ #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_editmesh.h" #include "BKE_lattice.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void initData(ModifierData *md) @@ -154,6 +165,29 @@ static void deformVertsEM(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "object", 0, IFACE_("Curve Object"), ICON_NONE); + uiItemR(layout, &ptr, "deform_axis", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Curve, panel_draw); +} + ModifierTypeInfo modifierType_Curve = { /* name */ "Curve", /* structName */ "CurveModifierData", @@ -184,4 +218,5 @@ ModifierTypeInfo modifierType_Curve = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c index dea4bad6999..e9436147649 100644 --- a/source/blender/modifiers/intern/MOD_datatransfer.c +++ b/source/blender/modifiers/intern/MOD_datatransfer.c @@ -25,11 +25,15 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_data_transfer.h" #include "BKE_lib_id.h" @@ -38,10 +42,18 @@ #include "BKE_mesh_remap.h" #include "BKE_modifier.h" #include "BKE_report.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" + +#include "MOD_ui_common.h" #include "MOD_util.h" /************************************** @@ -231,6 +243,235 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return result; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *sub, *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + row = uiLayoutRow(layout, true); + uiItemR(row, &ptr, "object", 0, IFACE_("Source"), ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetPropDecorate(sub, false); + uiItemR(sub, &ptr, "use_object_transform", 0, "", ICON_ORIENTATION_GLOBAL); + + uiItemR(layout, &ptr, "mix_mode", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "mix_factor", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + uiItemO(layout, "Generate Data Layers", ICON_NONE, "OBJECT_OT_datalayout_transfer"); + + modifier_panel_end(layout, &ptr); +} + +static void vertex_panel_draw_header(const bContext *C, Panel *panel) +{ + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + uiLayout *layout = panel->layout; + + uiItemR(layout, &ptr, "use_vert_data", 0, NULL, ICON_NONE); +} + +static void vertex_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + bool use_vert_data = RNA_boolean_get(&ptr, "use_vert_data"); + uiLayoutSetActive(layout, use_vert_data); + + uiItemR(layout, &ptr, "data_types_verts", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "vert_mapping", 0, IFACE_("Mapping"), ICON_NONE); +} + +static void vertex_vgroup_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetActive(layout, RNA_enum_get(&ptr, "data_types_verts") & DT_TYPE_MDEFORMVERT); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "layers_vgroup_select_src", 0, IFACE_("Layer Selection"), ICON_NONE); + uiItemR(layout, &ptr, "layers_vgroup_select_dst", 0, IFACE_("Layer Mapping"), ICON_NONE); +} + +static void edge_panel_draw_header(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_edge_data", 0, NULL, ICON_NONE); +} + +static void edge_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_edge_data")); + + uiItemR(layout, &ptr, "data_types_edges", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "edge_mapping", 0, IFACE_("Mapping"), ICON_NONE); +} + +static void face_corner_panel_draw_header(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_loop_data", 0, NULL, ICON_NONE); +} + +static void face_corner_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_loop_data")); + + uiItemR(layout, &ptr, "data_types_loops", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "loop_mapping", 0, IFACE_("Mapping"), ICON_NONE); +} + +static void face_corner_vcol_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiLayoutSetActive(layout, RNA_enum_get(&ptr, "data_types_loops") & DT_TYPE_VCOL); + + uiItemR(layout, &ptr, "layers_vcol_select_src", 0, IFACE_("Layer Selection"), ICON_NONE); + uiItemR(layout, &ptr, "layers_vcol_select_dst", 0, IFACE_("Layer Mapping"), ICON_NONE); +} + +static void face_corner_uv_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiLayoutSetActive(layout, RNA_enum_get(&ptr, "data_types_loops") & DT_TYPE_UV); + + uiItemR(layout, &ptr, "layers_uv_select_src", 0, IFACE_("Layer Selection"), ICON_NONE); + uiItemR(layout, &ptr, "layers_uv_select_dst", 0, IFACE_("Layer Mapping"), ICON_NONE); + uiItemR(layout, &ptr, "islands_precision", 0, NULL, ICON_NONE); +} + +static void face_panel_draw_header(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_poly_data", 0, NULL, ICON_NONE); +} + +static void face_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_poly_data")); + + uiItemR(layout, &ptr, "data_types_polys", 0, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "poly_mapping", 0, IFACE_("Mapping"), ICON_NONE); +} + +static void advanced_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row, *sub; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Max Distance")); + uiItemR(row, &ptr, "use_max_distance", 0, "", ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_max_distance")); + uiItemR(sub, &ptr, "max_distance", 0, "", ICON_NONE); + + uiItemR(layout, &ptr, "ray_radius", 0, NULL, ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register( + region_type, eModifierType_DataTransfer, panel_draw); + PanelType *vertex_panel = modifier_subpanel_register( + region_type, "vertex", "", vertex_panel_draw_header, vertex_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "vertex_vgroup", "Vertex Groups", NULL, vertex_vgroup_panel_draw, vertex_panel); + + modifier_subpanel_register( + region_type, "edge", "", edge_panel_draw_header, edge_panel_draw, panel_type); + + PanelType *face_corner_panel = modifier_subpanel_register(region_type, + "face_corner", + "", + face_corner_panel_draw_header, + face_corner_panel_draw, + panel_type); + modifier_subpanel_register(region_type, + "face_corner_vcol", + "Vertex Colors", + NULL, + face_corner_vcol_panel_draw, + face_corner_panel); + modifier_subpanel_register( + region_type, "face_corner_uv", "UVs", NULL, face_corner_uv_panel_draw, face_corner_panel); + + modifier_subpanel_register( + region_type, "face", "", face_panel_draw_header, face_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "advanced", "Topology Mapping", NULL, advanced_panel_draw, panel_type); +} + #undef HIGH_POLY_WARNING #undef DT_TYPES_AFFECT_MESH @@ -264,4 +505,5 @@ ModifierTypeInfo modifierType_DataTransfer = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 2bd33af7582..5b494baea1a 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -25,14 +25,24 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "MEM_guardedalloc.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_mesh.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" @@ -46,6 +56,7 @@ # include "PIL_time_utildefines.h" #endif +#include "MOD_ui_common.h" #include "MOD_util.h" static void initData(ModifierData *md) @@ -215,6 +226,57 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return result; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *sub, *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + int decimate_type = RNA_enum_get(&ptr, "decimate_type"); + char count_info[32]; + snprintf(count_info, 32, IFACE_("Face Count: %d"), RNA_int_get(&ptr, "face_count")); + + uiItemR(layout, &ptr, "decimate_type", 0, NULL, ICON_NONE); + + if (decimate_type == MOD_DECIM_MODE_COLLAPSE) { + uiItemR(layout, &ptr, "ratio", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + row = uiLayoutRowWithHeading(layout, true, "Symmetry"); + uiLayoutSetPropDecorate(row, false); + sub = uiLayoutRow(row, true); + uiItemR(sub, &ptr, "use_symmetry", 0, "", ICON_NONE); + sub = uiLayoutRow(sub, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_symmetry")); + uiItemR(sub, &ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemDecoratorR(row, &ptr, "symmetry_axis", 0); + + uiItemR(layout, &ptr, "use_collapse_triangulate", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + } + else if (decimate_type == MOD_DECIM_MODE_UNSUBDIV) { + uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE); + } + else { /* decimate_type == MOD_DECIM_MODE_DISSOLVE. */ + uiItemR(layout, &ptr, "angle_limit", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "delimit", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "use_dissolve_boundaries", 0, NULL, ICON_NONE); + } + uiItemL(layout, count_info, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Decimate, panel_draw); +} + ModifierTypeInfo modifierType_Decimate = { /* name */ "Decimate", /* structName */ "DecimateModifierData", @@ -244,4 +306,5 @@ ModifierTypeInfo modifierType_Decimate = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 0cb882d0532..d562559d66d 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -26,10 +26,14 @@ #include "BLI_math.h" #include "BLI_task.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_editmesh.h" @@ -39,13 +43,20 @@ #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_object.h" +#include "BKE_screen.h" #include "BKE_texture.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "RE_shader_ext.h" @@ -419,6 +430,73 @@ static void deformVertsEM(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA texture_ptr = RNA_pointer_get(&ptr, "texture"); + bool has_texture = !RNA_pointer_is_null(&texture_ptr); + int texture_coords = RNA_enum_get(&ptr, "texture_coords"); + + uiLayoutSetPropSep(layout, true); + + uiTemplateID(layout, C, &ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL); + + col = uiLayoutColumn(layout, false); + uiLayoutSetActive(col, has_texture); + uiItemR(col, &ptr, "texture_coords", 0, IFACE_("Coordinates"), ICON_NONE); + if (texture_coords == MOD_DISP_MAP_OBJECT) { + uiItemR(col, &ptr, "texture_coords_object", 0, NULL, ICON_NONE); + PointerRNA texture_coords_obj_ptr = RNA_pointer_get(&ptr, "texture_coords_object"); + if (!RNA_pointer_is_null(&texture_coords_obj_ptr) && + (RNA_enum_get(&texture_coords_obj_ptr, "type") == OB_ARMATURE)) { + PointerRNA texture_coords_obj_data_ptr = RNA_pointer_get(&texture_coords_obj_ptr, "data"); + uiItemPointerR(layout, + &ptr, + "texture_coords_bone", + &texture_coords_obj_data_ptr, + "bones", + IFACE_("Bone"), + ICON_NONE); + } + } + else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) { + uiItemR(col, &ptr, "uv_layer", 0, NULL, ICON_NONE); + } + + uiItemS(layout); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "direction", 0, 0, ICON_NONE); + if (ELEM(RNA_enum_get(&ptr, "direction"), + MOD_DISP_DIR_X, + MOD_DISP_DIR_Y, + MOD_DISP_DIR_Z, + MOD_DISP_DIR_RGB_XYZ)) { + uiItemR(col, &ptr, "space", 0, NULL, ICON_NONE); + } + + uiItemS(layout); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "mid_level", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(col, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Displace, panel_draw); +} + ModifierTypeInfo modifierType_Displace = { /* name */ "Displace", /* structName */ "DisplaceModifierData", @@ -448,4 +526,5 @@ ModifierTypeInfo modifierType_Displace = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index 3cace5745e6..f8a100f1f0a 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -23,17 +23,27 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_dynamicpaint_types.h" #include "DNA_mesh_types.h" #include "DNA_object_force_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_dynamicpaint.h" #include "BKE_layer.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" @@ -41,6 +51,7 @@ #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static void initData(ModifierData *md) { @@ -172,6 +183,23 @@ static void foreachTexLink(ModifierData *UNUSED(md), // walk(userData, ob, md, ""); /* re-enable when possible */ } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_DynamicPaint, panel_draw); +} + ModifierTypeInfo modifierType_DynamicPaint = { /* name */ "Dynamic Paint", /* structName */ "DynamicPaintModifierData", @@ -203,4 +231,5 @@ ModifierTypeInfo modifierType_DynamicPaint = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ freeRuntimeData, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index dd5669cd10c..0134b5c9d64 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -30,16 +30,27 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "bmesh.h" #include "bmesh_tools.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static Mesh *doEdgeSplit(Mesh *mesh, EdgeSplitModifierData *emd) { @@ -127,6 +138,32 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx) return result; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row, *sub; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Edge Angle")); + uiItemR(row, &ptr, "use_edge_angle", 0, "", ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_edge_angle")); + uiItemR(sub, &ptr, "split_angle", 0, "", ICON_NONE); + + uiItemR(layout, &ptr, "use_edge_sharp", 0, IFACE_("Sharp Edges"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_EdgeSplit, panel_draw); +} + ModifierTypeInfo modifierType_EdgeSplit = { /* name */ "EdgeSplit", /* structName */ "EdgeSplitModifierData", @@ -158,4 +195,5 @@ ModifierTypeInfo modifierType_EdgeSplit = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 747269f4c80..0c1eedd429a 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -28,11 +28,15 @@ #include "BLI_math.h" #include "BLI_rand.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_lattice.h" #include "BKE_lib_id.h" @@ -40,12 +44,19 @@ #include "BKE_modifier.h" #include "BKE_particle.h" #include "BKE_scene.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static void initData(ModifierData *md) { @@ -1174,6 +1185,49 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return mesh; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data"); + bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0; + + uiLayoutSetPropSep(layout, true); + + uiItemPointerR(layout, &ptr, "particle_uv", &obj_data_ptr, "uv_layers", NULL, ICON_NONE); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Show")); + uiItemR(row, &ptr, "show_alive", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "show_dead", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "show_unborn", toggles_flag, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "use_edge_cut", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "use_size", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, has_vertex_group); + uiItemR(row, &ptr, "protect", 0, NULL, ICON_NONE); + + uiItemO(layout, IFACE_("Refresh"), ICON_NONE, "OBJECT_OT_explode_refresh"); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Explode, panel_draw); +} + ModifierTypeInfo modifierType_Explode = { /* name */ "Explode", /* structName */ "ExplodeModifierData", @@ -1202,4 +1256,5 @@ ModifierTypeInfo modifierType_Explode = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_fluid.c b/source/blender/modifiers/intern/MOD_fluid.c index d3f05ee714f..0ef062d72d5 100644 --- a/source/blender/modifiers/intern/MOD_fluid.c +++ b/source/blender/modifiers/intern/MOD_fluid.c @@ -27,17 +27,27 @@ #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_collection_types.h" #include "DNA_fluid_types.h" #include "DNA_mesh_types.h" #include "DNA_object_force_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_fluid.h" #include "BKE_layer.h" #include "BKE_lib_query.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" @@ -45,6 +55,7 @@ #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static void initData(ModifierData *md) { @@ -194,6 +205,23 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Fluid, panel_draw); +} + ModifierTypeInfo modifierType_Fluid = { /* name */ "Fluid", /* structName */ "FluidModifierData", @@ -223,4 +251,5 @@ ModifierTypeInfo modifierType_Fluid = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index d93b3c56e5a..2eff026c040 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -25,23 +25,34 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "BKE_action.h" #include "BKE_colortools.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void initData(ModifierData *md) @@ -388,6 +399,75 @@ static void deformVertsEM(struct ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row, *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA hook_object_ptr = RNA_pointer_get(&ptr, "object"); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "object", 0, NULL, ICON_NONE); + if (!RNA_pointer_is_null(&hook_object_ptr) && + RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) { + PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data"); + uiItemPointerR( + col, &ptr, "subtarget", &hook_object_data_ptr, "bones", IFACE_("Bone"), ICON_NONE); + } + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + uiItemR(layout, &ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + if (RNA_enum_get(&ob_ptr, "mode") == OB_MODE_EDIT) { + row = uiLayoutRow(layout, true); + uiItemO(row, "Reset", ICON_NONE, "OBJECT_OT_hook_reset"); + uiItemO(row, "Recenter", ICON_NONE, "OBJECT_OT_hook_recenter"); + row = uiLayoutRow(layout, true); + uiItemO(row, "Select", ICON_NONE, "OBJECT_OT_hook_select"); + uiItemO(row, "Assign", ICON_NONE, "OBJECT_OT_hook_assign"); + } + + modifier_panel_end(layout, &ptr); +} + +static void falloff_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + bool use_falloff = RNA_enum_get(&ptr, "falloff_type") != eWarp_Falloff_None; + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "falloff_type", 0, IFACE_("Type"), ICON_NONE); + + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, use_falloff); + uiItemR(row, &ptr, "falloff_radius", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "use_falloff_uniform", 0, NULL, ICON_NONE); + + if (RNA_enum_get(&ptr, "falloff_type") == eWarp_Falloff_Curve) { + uiTemplateCurveMapping(layout, &ptr, "falloff_curve", 0, false, false, false, false); + } +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Hook, panel_draw); + modifier_subpanel_register( + region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Hook = { /* name */ "Hook", /* structName */ "HookModifierData", @@ -417,4 +497,5 @@ ModifierTypeInfo modifierType_Hook = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 0ca8bc55fb8..b7975bec77a 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -29,9 +29,13 @@ #include "MEM_guardedalloc.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" @@ -39,7 +43,14 @@ #include "BKE_mesh_mapping.h" #include "BKE_mesh_runtime.h" #include "BKE_particle.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "eigen_capi.h" @@ -808,6 +819,41 @@ static void freeData(ModifierData *md) lmd->total_verts = 0; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + bool is_bind = RNA_boolean_get(&ptr, "is_bind"); + bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0; + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + uiItemS(layout); + + row = uiLayoutRow(layout, true); + uiLayoutSetEnabled(row, has_vertex_group); + uiItemO(row, + is_bind ? IFACE_("Unbind") : IFACE_("Bind"), + ICON_NONE, + "OBJECT_OT_laplaciandeform_bind"); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_LaplacianDeform, panel_draw); +} + ModifierTypeInfo modifierType_LaplacianDeform = { /* name */ "LaplacianDeform", /* structName */ "LaplacianDeformModifierData", @@ -836,4 +882,5 @@ ModifierTypeInfo modifierType_LaplacianDeform = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index 643afc5b5fc..130c280c5f2 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -25,18 +25,29 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "MEM_guardedalloc.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "eigen_capi.h" @@ -572,8 +583,43 @@ static void deformVertsEM(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "iterations", 0, NULL, ICON_NONE); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis")); + uiItemR(row, &ptr, "use_x", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_y", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_z", toggles_flag, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "lambda_factor", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "lambda_border", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "use_volume_preserve", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "use_normalized", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_LaplacianSmooth, panel_draw); +} + ModifierTypeInfo modifierType_LaplacianSmooth = { - /* name */ "Laplacian Smooth", + /* name */ "LaplacianSmooth", /* structName */ "LaplacianSmoothModifierData", /* structSize */ sizeof(LaplacianSmoothModifierData), /* type */ eModifierTypeType_OnlyDeform, @@ -601,4 +647,5 @@ ModifierTypeInfo modifierType_LaplacianSmooth = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 0a7aa006fcc..31cfe3bb407 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -25,19 +25,30 @@ #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_editmesh.h" #include "BKE_lattice.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void initData(ModifierData *md) @@ -137,6 +148,30 @@ static void deformVertsEM(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + uiItemR(layout, &ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Lattice, panel_draw); +} + ModifierTypeInfo modifierType_Lattice = { /* name */ "Lattice", /* structName */ "LatticeModifierData", @@ -167,4 +202,5 @@ ModifierTypeInfo modifierType_Lattice = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_mask.cc b/source/blender/modifiers/intern/MOD_mask.cc index 18b88864926..c6de980d674 100644 --- a/source/blender/modifiers/intern/MOD_mask.cc +++ b/source/blender/modifiers/intern/MOD_mask.cc @@ -28,23 +28,39 @@ #include "BLI_ghash.h" #include "BLI_listbase.h" +#include "BLT_translation.h" + #include "DNA_armature_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "BKE_action.h" /* BKE_pose_channel_find_name */ +#include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +/* SpaceType struct has a member called 'new' which obviously conflicts with C++ + * so temporarily redefining the new keyword to make it compile. */ +#define new extern_new +#include "BKE_screen.h" +#undef new + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "BLI_array.hh" #include "BLI_listbase_wrapper.hh" @@ -387,6 +403,42 @@ static bool isDisabled(const struct Scene *UNUSED(scene), return mmd->ob_arm && mmd->ob_arm->type != OB_ARMATURE; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *sub, *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + int mode = RNA_enum_get(&ptr, "mode"); + + uiItemR(layout, &ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + if (mode == MOD_MASK_MODE_ARM) { + row = uiLayoutRow(layout, true); + uiItemR(row, &ptr, "armature", 0, NULL, ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetPropDecorate(sub, false); + uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT); + } + else if (mode == MOD_MASK_MODE_VGROUP) { + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", nullptr); + } + + uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Mask, panel_draw); +} + ModifierTypeInfo modifierType_Mask = { /* name */ "Mask", /* structName */ "MaskModifierData", @@ -418,4 +470,5 @@ ModifierTypeInfo modifierType_Mask = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c index 219de1569b3..2d104e1e0c2 100644 --- a/source/blender/modifiers/intern/MOD_meshcache.c +++ b/source/blender/modifiers/intern/MOD_meshcache.c @@ -26,22 +26,32 @@ #include "BLI_path_util.h" #include "BLI_string.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_scene.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" #include "MOD_meshcache_util.h" /* utility functions */ - #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static void initData(ModifierData *md) { @@ -287,8 +297,90 @@ static void deformVertsEM(ModifierData *md, meshcache_do(mcmd, scene, ctx->object, vertexCos, numVerts); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "cache_format", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "filepath", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "factor", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(layout, &ptr, "deform_mode", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "interpolation", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void time_remapping_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "time_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "play_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + if (RNA_enum_get(&ptr, "play_mode") == MOD_MESHCACHE_PLAY_CFEA) { + uiItemR(layout, &ptr, "frame_start", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "frame_scale", 0, NULL, ICON_NONE); + } + else { /* play_mode == MOD_MESHCACHE_PLAY_EVAL */ + int time_mode = RNA_enum_get(&ptr, "time_mode"); + if (time_mode == MOD_MESHCACHE_TIME_FRAME) { + uiItemR(layout, &ptr, "eval_frame", 0, NULL, ICON_NONE); + } + else if (time_mode == MOD_MESHCACHE_TIME_SECONDS) { + uiItemR(layout, &ptr, "eval_time", 0, NULL, ICON_NONE); + } + else { /* time_mode == MOD_MESHCACHE_TIME_FACTOR */ + uiItemR(layout, &ptr, "eval_factor", 0, NULL, ICON_NONE); + } + } +} + +static void axis_mapping_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, true); + uiLayoutSetRedAlert(col, RNA_enum_get(&ptr, "forward_axis") == RNA_enum_get(&ptr, "up_axis")); + uiItemR(col, &ptr, "forward_axis", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "up_axis", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "flip_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register( + region_type, eModifierType_MeshCache, panel_draw); + modifier_subpanel_register(region_type, + "time_remapping", + "Time Remapping", + NULL, + time_remapping_panel_draw, + panel_type); + modifier_subpanel_register( + region_type, "axis_mapping", "Axis Mapping", NULL, axis_mapping_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_MeshCache = { - /* name */ "Mesh Cache", + /* name */ "MeshCache", /* structName */ "MeshCacheModifierData", /* structSize */ sizeof(MeshCacheModifierData), /* type */ eModifierTypeType_OnlyDeform, @@ -317,4 +409,5 @@ ModifierTypeInfo modifierType_MeshCache = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 57b5f3891b2..c24515e01eb 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -26,11 +26,15 @@ #include "BLI_math.h" #include "BLI_task.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_global.h" @@ -39,12 +43,19 @@ #include "BKE_mesh.h" #include "BKE_mesh_runtime.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "MEM_guardedalloc.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #ifdef __SSE2__ @@ -558,6 +569,43 @@ void BKE_modifier_mdef_compact_influences(ModifierData *md) mmd->bindweights = NULL; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + bool is_bound = RNA_boolean_get(&ptr, "is_bound"); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, true); + uiLayoutSetEnabled(col, !is_bound); + uiItemR(col, &ptr, "object", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + col = uiLayoutColumn(layout, false); + uiLayoutSetEnabled(col, !is_bound); + uiItemR(col, &ptr, "precision", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "use_dynamic_bind", 0, NULL, ICON_NONE); + + uiItemO(layout, + is_bound ? IFACE_("Unbind") : IFACE_("Bind"), + ICON_NONE, + "OBJECT_OT_meshdeform_bind"); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_MeshDeform, panel_draw); +} + ModifierTypeInfo modifierType_MeshDeform = { /* name */ "MeshDeform", /* structName */ "MeshDeformModifierData", @@ -588,4 +636,5 @@ ModifierTypeInfo modifierType_MeshDeform = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index 51275c4e58f..801badc382c 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -23,21 +23,32 @@ #include "BLI_string.h" #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_cachefile_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" #include "BKE_cachefile.h" +#include "BKE_context.h" #include "BKE_lib_query.h" #include "BKE_scene.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #ifdef WITH_ALEMBIC # include "ABC_alembic.h" @@ -185,8 +196,41 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *box; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA cache_file_ptr = RNA_pointer_get(&ptr, "cache_file"); + bool has_cache_file = !RNA_pointer_is_null(&cache_file_ptr); + + box = uiLayoutBox(layout); + uiTemplateCacheFile(box, C, &ptr, "cache_file"); + + uiLayoutSetPropSep(layout, true); + + if (has_cache_file) { + uiItemPointerR(layout, &ptr, "object_path", &cache_file_ptr, "object_paths", NULL, ICON_NONE); + } + + if (RNA_enum_get(&ob_ptr, "type") == OB_MESH) { + uiItemR(layout, &ptr, "read_data", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + } + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_MeshSequenceCache, panel_draw); +} + ModifierTypeInfo modifierType_MeshSequenceCache = { - /* name */ "Mesh Sequence Cache", + /* name */ "MeshSequenceCache", /* structName */ "MeshSeqCacheModifierData", /* structSize */ sizeof(MeshSeqCacheModifierData), /* type */ eModifierTypeType_Constructive, @@ -214,4 +258,5 @@ ModifierTypeInfo modifierType_MeshSequenceCache = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index bbbcac262ca..949b115a25f 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -23,16 +23,26 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_mesh_mirror.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "bmesh.h" #include "bmesh_tools.h" @@ -43,6 +53,7 @@ #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static void initData(ModifierData *md) { @@ -113,6 +124,93 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return result; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row, *col, *sub; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PropertyRNA *prop; + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + col = uiLayoutColumn(layout, false); + uiLayoutSetPropSep(col, true); + + prop = RNA_struct_find_property(&ptr, "use_axis"); + row = uiLayoutRowWithHeading(col, true, IFACE_("Axis")); + uiItemFullR(row, &ptr, prop, 0, 0, toggles_flag, IFACE_("X"), ICON_NONE); + uiItemFullR(row, &ptr, prop, 1, 0, toggles_flag, IFACE_("Y"), ICON_NONE); + uiItemFullR(row, &ptr, prop, 2, 0, toggles_flag, IFACE_("Z"), ICON_NONE); + + prop = RNA_struct_find_property(&ptr, "use_bisect_axis"); + row = uiLayoutRowWithHeading(col, true, IFACE_("Bisect")); + uiItemFullR(row, &ptr, prop, 0, 0, toggles_flag, IFACE_("X"), ICON_NONE); + uiItemFullR(row, &ptr, prop, 1, 0, toggles_flag, IFACE_("Y"), ICON_NONE); + uiItemFullR(row, &ptr, prop, 2, 0, toggles_flag, IFACE_("Z"), ICON_NONE); + + prop = RNA_struct_find_property(&ptr, "use_bisect_flip_axis"); + row = uiLayoutRowWithHeading(col, true, IFACE_("Flip")); + uiItemFullR(row, &ptr, prop, 0, 0, toggles_flag, IFACE_("X"), ICON_NONE); + uiItemFullR(row, &ptr, prop, 1, 0, toggles_flag, IFACE_("Y"), ICON_NONE); + uiItemFullR(row, &ptr, prop, 2, 0, toggles_flag, IFACE_("Z"), ICON_NONE); + + uiItemS(col); + + uiItemR(col, &ptr, "mirror_object", 0, NULL, ICON_NONE); + + uiItemR(col, &ptr, "use_clip", 0, IFACE_("Clipping"), ICON_NONE); + + row = uiLayoutRowWithHeading(col, true, IFACE_("Merge")); + uiItemR(row, &ptr, "use_mirror_merge", 0, "", ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_merge")); + uiItemR(sub, &ptr, "merge_threshold", 0, "", ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void data_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col, *row, *sub; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumnWithHeading(layout, false, IFACE_("Mirror U")); + row = uiLayoutRow(col, true); + uiLayoutSetPropDecorate(row, false); + sub = uiLayoutRow(row, true); + uiItemR(sub, &ptr, "use_mirror_u", 0, "", ICON_NONE); + sub = uiLayoutRow(sub, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_u")); + uiItemR(sub, &ptr, "mirror_offset_u", UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemDecoratorR(row, &ptr, "mirror_offset_v", 0); + + col = uiLayoutColumnWithHeading(layout, false, "V"); + row = uiLayoutRow(col, true); + uiLayoutSetPropDecorate(row, false); + sub = uiLayoutRow(row, true); + uiItemR(sub, &ptr, "use_mirror_v", 0, "", ICON_NONE); + sub = uiLayoutRow(sub, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_v")); + uiItemR(sub, &ptr, "mirror_offset_v", UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemDecoratorR(row, &ptr, "mirror_offset_v", 0); + + uiItemR(layout, &ptr, "use_mirror_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE); + uiItemR(layout, &ptr, "use_mirror_udim", 0, IFACE_("Flip UDIM"), ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Mirror, panel_draw); + modifier_subpanel_register(region_type, "data", "Data", NULL, data_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Mirror = { /* name */ "Mirror", /* structName */ "MirrorModifierData", @@ -146,4 +244,5 @@ ModifierTypeInfo modifierType_Mirror = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 5174a996480..75ec5eb5be7 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -27,24 +27,37 @@ #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" #include "BKE_cdderivedmesh.h" +#include "BKE_context.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_multires.h" #include "BKE_paint.h" +#include "BKE_screen.h" #include "BKE_subdiv.h" #include "BKE_subdiv_ccg.h" #include "BKE_subdiv_deform.h" #include "BKE_subdiv_mesh.h" #include "BKE_subsurf.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + +#include "WM_types.h" /* For subdivide operator UI. */ + #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" typedef struct MultiresRuntimeData { /* Cached subdivision surface descriptor, with topology and settings. */ @@ -272,6 +285,112 @@ static void deformMatrices(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row, *col, *split, *col2; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + MultiresModifierData *mmd = (MultiresModifierData *)ptr.data; + + PointerRNA op_ptr; + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "subdivision_type", 0, NULL, ICON_NONE); + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "levels", 0, IFACE_("Levels Viewport"), ICON_NONE); + uiItemR(col, &ptr, "render_levels", 0, IFACE_("Render"), ICON_NONE); + uiItemR(layout, &ptr, "show_only_control_edges", 0, NULL, ICON_NONE); + + uiItemS(layout); + + split = uiLayoutSplit(layout, 0.5f, false); + uiLayoutSetEnabled(split, ELEM(RNA_enum_get(&ob_ptr, "mode"), OB_MODE_EDIT, OB_MODE_SCULPT)); + col = uiLayoutColumn(split, false); + col2 = uiLayoutColumn(split, false); + + uiItemO(col, IFACE_("Unsubdivide"), ICON_NONE, "OBJECT_OT_multires_unsubdivide"); + + row = uiLayoutRow(col2, true); + uiItemFullO(row, + "OBJECT_OT_multires_subdivide", + IFACE_("Subdivide"), + ICON_NONE, + NULL, + WM_OP_EXEC_DEFAULT, + 0, + &op_ptr); + RNA_enum_set(&op_ptr, "mode", MULTIRES_SUBDIVIDE_CATMULL_CLARK); + uiItemFullO(row, + "OBJECT_OT_multires_subdivide", + IFACE_("Simple"), + ICON_NONE, /* TODO: Needs icon, remove text */ + NULL, + WM_OP_EXEC_DEFAULT, + 0, + &op_ptr); + RNA_enum_set(&op_ptr, "mode", MULTIRES_SUBDIVIDE_SIMPLE); + uiItemFullO(row, + "OBJECT_OT_multires_subdivide", + IFACE_("Linear"), + ICON_NONE, /* TODO: Needs icon, remove text */ + NULL, + WM_OP_EXEC_DEFAULT, + 0, + &op_ptr); + RNA_enum_set(&op_ptr, "mode", MULTIRES_SUBDIVIDE_LINEAR); + + uiItemL(col, "", ICON_NONE); + uiItemO(col2, IFACE_("Delete Higher"), ICON_NONE, "OBJECT_OT_multires_higher_levels_delete"); + + uiItemO(col, IFACE_("Reshape"), ICON_NONE, "OBJECT_OT_multires_reshape"); + uiItemO(col2, IFACE_("Apply Base"), ICON_NONE, "OBJECT_OT_multires_base_apply"); + + uiItemS(layout); + + if (mmd->totlvl == 0) { + uiItemO( + layout, IFACE_("Rebuild Subdivisions"), ICON_NONE, "OBJECT_OT_multires_rebuild_subdiv"); + } + + col = uiLayoutColumn(layout, false); + row = uiLayoutRow(col, false); + if (RNA_boolean_get(&ptr, "is_external")) { + uiItemO(row, IFACE_("Pack External"), ICON_NONE, "OBJECT_OT_multires_external_pack"); + row = uiLayoutRow(col, false); + uiItemR(row, &ptr, "filepath", 0, "", ICON_NONE); + } + else { + uiItemO(col, IFACE_("Save External..."), ICON_NONE, "OBJECT_OT_multires_external_save"); + } + + modifier_panel_end(layout, &ptr); +} + +static void advanced_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "quality", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "uv_smooth", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "use_creases", 0, NULL, ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Multires, panel_draw); + modifier_subpanel_register( + region_type, "advanced", "Advanced", NULL, advanced_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Multires = { /* name */ "Multires", /* structName */ "MultiresModifierData", @@ -302,4 +421,5 @@ ModifierTypeInfo modifierType_Multires = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ freeRuntimeData, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index 1521cfab356..c1901a97cda 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -27,17 +27,28 @@ #include "BLI_bitmap.h" #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void generate_vert_coordinates(Mesh *mesh, @@ -689,8 +700,86 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return normalEditModifier_do((NormalEditModifierData *)md, ctx, ctx->object, mesh); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + int mode = RNA_enum_get(&ptr, "mode"); + + uiItemR(layout, &ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiLayoutSetActive(col, mode == MOD_NORMALEDIT_MODE_DIRECTIONAL); + uiItemR(col, &ptr, "use_direction_parallel", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +/* This panel could be open by default, but it isn't currently. */ +static void mix_mode_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "mix_mode", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "mix_factor", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + row = uiLayoutRow(layout, true); + uiItemR(row, &ptr, "mix_limit", 0, NULL, ICON_NONE); + uiItemR(row, + &ptr, + "no_polynors_fix", + 0, + "", + (RNA_boolean_get(&ptr, "no_polynors_fix") ? ICON_LOCKED : ICON_UNLOCKED)); +} + +static void offset_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + int mode = RNA_enum_get(&ptr, "mode"); + PointerRNA target_ptr = RNA_pointer_get(&ptr, "target"); + bool needs_object_offset = (mode == MOD_NORMALEDIT_MODE_RADIAL && + RNA_pointer_is_null(&target_ptr)) || + (mode == MOD_NORMALEDIT_MODE_DIRECTIONAL && + RNA_boolean_get(&ptr, "use_direction_parallel")); + + uiLayoutSetPropSep(layout, true); + + uiLayoutSetActive(layout, needs_object_offset); + uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register( + region_type, eModifierType_NormalEdit, panel_draw); + modifier_subpanel_register(region_type, "mix", "Mix", NULL, mix_mode_panel_draw, panel_type); + modifier_subpanel_register(region_type, "offset", "Offset", NULL, offset_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_NormalEdit = { - /* name */ "Set Split Normals", + /* name */ "NormalEdit", /* structName */ "NormalEditModifierData", /* structSize */ sizeof(NormalEditModifierData), /* type */ eModifierTypeType_Constructive, @@ -719,4 +808,5 @@ ModifierTypeInfo modifierType_NormalEdit = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 4c7c644952b..e16a23f54c6 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -27,21 +27,34 @@ #include "BLI_math_inline.h" #include "BLI_task.h" +#include "BLT_translation.h" + #include "DNA_customdata_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_lib_id.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_ocean.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + +#include "WM_types.h" /* For UI free bake operator. */ #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #ifdef WITH_OCEANSIM static void init_cache_data(Object *ob, struct OceanModifierData *omd) @@ -494,6 +507,172 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return result; } +// #define WITH_OCEANSIM +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; +#ifdef WITH_OCEANSIM + uiLayout *col; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "geometry_mode", 0, NULL, ICON_NONE); + if (RNA_enum_get(&ptr, "geometry_mode") == MOD_OCEAN_GEOM_GENERATE) { + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "repeat_x", 0, IFACE_("Repeat X"), ICON_NONE); + uiItemR(col, &ptr, "repeat_y", 0, IFACE_("Y"), ICON_NONE); + } + uiItemR(layout, &ptr, "random_seed", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "resolution", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "time", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "depth", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "size", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "spatial_size", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "use_normals", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); + +#else /* WITH_OCEANSIM */ + uiItemL(layout, IFACE_("Built without Ocean modifier"), ICON_NONE); + UNUSED_VARS(C); +#endif /* WITH_OCEANSIM */ +} + +#ifdef WITH_OCEANSIM +static void waves_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "wave_scale", 0, IFACE_("Scale"), ICON_NONE); + uiItemR(layout, &ptr, "wave_scale_min", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "choppiness", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "wind_velocity", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "wave_alignment", 0, IFACE_("Alignment"), ICON_NONE); + col = uiLayoutColumn(layout, false); + uiLayoutSetActive(col, RNA_float_get(&ptr, "wave_alignment") > 0.0f); + uiItemR(col, &ptr, "wave_direction", 0, IFACE_("Direction"), ICON_NONE); + uiItemR(col, &ptr, "damping", 0, NULL, ICON_NONE); +} + +static void foam_panel_draw_header(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_foam", 0, IFACE_("Foam"), ICON_NONE); +} + +static void foam_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + bool use_foam = RNA_boolean_get(&ptr, "use_foam"); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, false); + uiLayoutSetActive(col, use_foam); + uiItemR(col, &ptr, "foam_coverage", 0, IFACE_("Coverage"), ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiLayoutSetActive(col, use_foam); + uiItemR(col, &ptr, "foam_layer_name", 0, IFACE_("Data Layer"), ICON_NONE); +} + +static void spectrum_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + int spectrum = RNA_enum_get(&ptr, "spectrum"); + + uiItemR(layout, &ptr, "spectrum", 0, NULL, ICON_NONE); + if (ELEM(spectrum, MOD_OCEAN_SPECTRUM_TEXEL_MARSEN_ARSLOE, MOD_OCEAN_SPECTRUM_JONSWAP)) { + uiItemR(layout, &ptr, "sharpen_peak_jonswap", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "fetch_jonswap", 0, NULL, ICON_NONE); + } +} + +static void bake_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + bool is_cached = RNA_boolean_get(&ptr, "is_cached"); + bool use_foam = RNA_boolean_get(&ptr, "use_foam"); + + if (is_cached) { + PointerRNA op_ptr; + uiItemFullO(layout, + "OBJECT_OT_ocean_bake", + IFACE_("Delete Bake"), + ICON_NONE, + NULL, + WM_OP_EXEC_DEFAULT, + 0, + &op_ptr); + RNA_boolean_set(&op_ptr, "free", true); + } + else { + uiItemO(layout, NULL, ICON_NONE, "OBJECT_OT_ocean_bake"); + } + + uiItemR(layout, &ptr, "filepath", 0, NULL, ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiLayoutSetEnabled(col, !is_cached); + uiItemR(col, &ptr, "frame_start", 0, IFACE_("Start"), ICON_NONE); + uiItemR(col, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiLayoutSetActive(col, use_foam); + uiItemR(col, &ptr, "bake_foam_fade", 0, NULL, ICON_NONE); +} +#endif /* WITH_OCEANSIM */ + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Ocean, panel_draw); +#ifdef WITH_OCEANSIM + modifier_subpanel_register(region_type, "waves", "Waves", NULL, waves_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "foam", "", foam_panel_draw_header, foam_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "spectrum", "Spectrum", NULL, spectrum_panel_draw, panel_type); + modifier_subpanel_register(region_type, "bake", "Bake", NULL, bake_panel_draw, panel_type); +#else + UNUSED_VARS(panel_type); +#endif /* WITH_OCEANSIM */ +} ModifierTypeInfo modifierType_Ocean = { /* name */ "Ocean", @@ -525,4 +704,5 @@ ModifierTypeInfo modifierType_Ocean = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 644962ab71c..0a9fb964281 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -30,9 +30,13 @@ #include "BLI_rand.h" #include "BLI_string.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_effect.h" #include "BKE_lattice.h" #include "BKE_lib_query.h" @@ -40,11 +44,18 @@ #include "BKE_modifier.h" #include "BKE_particle.h" #include "BKE_pointcache.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static void initData(ModifierData *md) { @@ -546,6 +557,129 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return result; } + +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA particle_obj_ptr = RNA_pointer_get(&ptr, "object"); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE); + if (!RNA_pointer_is_null(&particle_obj_ptr)) { + uiItemPointerR(layout, + &ptr, + "particle_system", + &particle_obj_ptr, + "particle_systems", + "Particle System", + ICON_NONE); + } + else { + uiItemR(layout, &ptr, "particle_system_index", 0, IFACE_("Particle System"), ICON_NONE); + } + + uiItemS(layout); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Create Instances")); + uiItemR(row, &ptr, "use_normal", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_children", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_size", toggles_flag, NULL, ICON_NONE); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Show")); + uiItemR(row, &ptr, "show_alive", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "show_dead", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "show_unborn", toggles_flag, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "particle_amount", 0, IFACE_("Amount"), ICON_NONE); + uiItemR(layout, &ptr, "particle_offset", 0, IFACE_("Offset"), ICON_NONE); + + uiItemS(layout); + + uiItemR(layout, &ptr, "space", 0, IFACE_("Coordinate Space"), ICON_NONE); + row = uiLayoutRow(layout, true); + uiItemR(row, &ptr, "axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void path_panel_draw_header(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemR(layout, &ptr, "use_path", 0, IFACE_("Create Along Paths"), ICON_NONE); +} + +static void path_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_path")); + + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "position", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, &ptr, "random_position", UI_ITEM_R_SLIDER, IFACE_("Random"), ICON_NONE); + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "rotation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, &ptr, "random_rotation", UI_ITEM_R_SLIDER, IFACE_("Random"), ICON_NONE); + + uiItemR(layout, &ptr, "use_preserve_shape", 0, NULL, ICON_NONE); +} + +static void layers_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data"); + + uiLayoutSetPropSep(layout, true); + + uiItemPointerR(layout, + &ptr, + "index_layer_name", + &obj_data_ptr, + "vertex_colors", + IFACE_("Index"), + ICON_NONE); + uiItemPointerR(layout, + &ptr, + "value_layer_name", + &obj_data_ptr, + "vertex_colors", + IFACE_("Value"), + ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register( + region_type, eModifierType_ParticleInstance, panel_draw); + modifier_subpanel_register( + region_type, "paths", "", path_panel_draw_header, path_panel_draw, panel_type); + modifier_subpanel_register(region_type, "layers", "Layers", NULL, layers_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_ParticleInstance = { /* name */ "ParticleInstance", /* structName */ "ParticleInstanceModifierData", @@ -576,4 +710,5 @@ ModifierTypeInfo modifierType_ParticleInstance = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index e72a484e3a0..b63fb18de69 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -25,17 +25,28 @@ #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_material_types.h" #include "DNA_mesh_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_particle.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void initData(ModifierData *md) @@ -247,6 +258,43 @@ static void deformVertsEM(ModifierData *md, } #endif +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + Object *ob = ob_ptr.data; + ModifierData *md = (ModifierData *)ptr.data; + ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; + + uiItemL(layout, IFACE_("Settings are in the particle tab"), ICON_NONE); + + if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) { + if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) { + uiItemO(layout, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), + ICON_NONE, + "OBJECT_OT_duplicates_make_real"); + } + else if (psys->part->ren_as == PART_DRAW_PATH) { + uiItemO(layout, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), + ICON_NONE, + "OBJECT_OT_modifier_convert"); + } + } + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_ParticleSystem, panel_draw); +} + ModifierTypeInfo modifierType_ParticleSystem = { /* name */ "ParticleSystem", /* structName */ "ParticleSystemModifierData", @@ -280,4 +328,5 @@ ModifierTypeInfo modifierType_ParticleSystem = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index 5a262adf47c..a76b3acb783 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -27,16 +27,27 @@ #include "BLI_math_base.h" #include "BLI_threads.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" -#include "MOD_modifiertypes.h" - +#include "BKE_context.h" #include "BKE_mesh.h" #include "BKE_mesh_remesh_voxel.h" #include "BKE_mesh_runtime.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + +#include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include <assert.h> #include <stdlib.h> @@ -226,6 +237,54 @@ static Mesh *modifyMesh(ModifierData *UNUSED(md), #endif /* !WITH_MOD_REMESH */ +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; +#ifdef WITH_MOD_REMESH + uiLayout *row; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + int mode = RNA_enum_get(&ptr, "mode"); + + uiItemR(layout, &ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + if (mode == MOD_REMESH_VOXEL) { + uiItemR(layout, &ptr, "voxel_size", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "adaptivity", 0, NULL, ICON_NONE); + } + else { + uiItemR(layout, &ptr, "octree_depth", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "scale", 0, NULL, ICON_NONE); + + if (mode == MOD_REMESH_SHARP_FEATURES) { + uiItemR(layout, &ptr, "sharpness", 0, NULL, ICON_NONE); + } + + uiItemR(layout, &ptr, "use_remove_disconnected", 0, NULL, ICON_NONE); + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, RNA_boolean_get(&ptr, "use_remove_disconnected")); + uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE); + } + uiItemR(layout, &ptr, "use_smooth_shade", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); + +#else /* WITH_MOD_REMESH */ + uiItemL(layout, IFACE_("Built without Remesh modifier"), ICON_NONE); + UNUSED_VARS(C); +#endif /* WITH_MOD_REMESH */ +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Remesh, panel_draw); +} + ModifierTypeInfo modifierType_Remesh = { /* name */ "Remesh", /* structName */ "RemeshModifierData", @@ -254,5 +313,7 @@ ModifierTypeInfo modifierType_Remesh = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index d3d42068812..b1c49ba2fec 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -29,18 +29,30 @@ #include "BLI_alloca.h" #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" + #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "BLI_strict_flags.h" @@ -1156,6 +1168,83 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, walk(userData, ob, <md->ob_axis, IDWALK_CB_NOP); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *sub, *row, *col; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + PointerRNA screw_obj_ptr = RNA_pointer_get(&ptr, "object"); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "angle", 0, NULL, ICON_NONE); + row = uiLayoutRow(col, false); + uiLayoutSetActive(row, + RNA_pointer_is_null(&screw_obj_ptr) || + !RNA_boolean_get(&ptr, "use_object_screw_offset")); + uiItemR(row, &ptr, "screw_offset", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "iterations", 0, NULL, ICON_NONE); + + uiItemS(layout); + col = uiLayoutColumn(layout, false); + row = uiLayoutRow(col, false); + uiItemR(row, &ptr, "axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(col, &ptr, "object", 0, IFACE_("Axis Object"), ICON_NONE); + sub = uiLayoutColumn(col, false); + uiLayoutSetActive(sub, !RNA_pointer_is_null(&screw_obj_ptr)); + uiItemR(sub, &ptr, "use_object_screw_offset", 0, NULL, ICON_NONE); + + uiItemS(layout); + + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "steps", 0, IFACE_("Steps Viewport"), ICON_NONE); + uiItemR(col, &ptr, "render_steps", 0, IFACE_("Render"), ICON_NONE); + + uiItemS(layout); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Merge")); + uiItemR(row, &ptr, "use_merge_vertices", 0, "", ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_merge_vertices")); + uiItemR(sub, &ptr, "merge_threshold", 0, "", ICON_NONE); + + uiItemS(layout); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Stretch UVs")); + uiItemR(row, &ptr, "use_stretch_u", toggles_flag, IFACE_("U"), ICON_NONE); + uiItemR(row, &ptr, "use_stretch_v", toggles_flag, IFACE_("V"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void normals_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "use_smooth_shade", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "use_normal_calculate", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "use_normal_flip", 0, NULL, ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Screw, panel_draw); + modifier_subpanel_register( + region_type, "normals", "Normals", NULL, normals_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Screw = { /* name */ "Screw", /* structName */ "ScrewModifierData", @@ -1187,4 +1276,5 @@ ModifierTypeInfo modifierType_Screw = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index abab0aff927..bd3301b543c 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -147,4 +147,5 @@ ModifierTypeInfo modifierType_ShapeKey = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ NULL, }; diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 11dc0a92769..c0f7a0a7db0 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -25,18 +25,29 @@ #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" #include "BKE_shrinkwrap.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph_query.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static bool dependsOnNormals(ModifierData *md); @@ -203,6 +214,65 @@ static bool dependsOnNormals(ModifierData *md) return false; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row, *col; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + int wrap_method = RNA_enum_get(&ptr, "wrap_method"); + + uiItemR(layout, &ptr, "wrap_method", 0, NULL, ICON_NONE); + + if (ELEM(wrap_method, + MOD_SHRINKWRAP_PROJECT, + MOD_SHRINKWRAP_NEAREST_SURFACE, + MOD_SHRINKWRAP_TARGET_PROJECT)) { + uiItemR(layout, &ptr, "wrap_mode", 0, NULL, ICON_NONE); + } + + if (wrap_method == MOD_SHRINKWRAP_PROJECT) { + uiItemR(layout, &ptr, "project_limit", 0, IFACE_("Limit"), ICON_NONE); + uiItemR(layout, &ptr, "subsurf_levels", 0, NULL, ICON_NONE); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis")); + uiItemR(row, &ptr, "use_project_x", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_project_y", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_project_z", toggles_flag, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "use_negative_direction", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "use_positive_direction", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "cull_face", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + col = uiLayoutColumn(layout, false); + uiLayoutSetActive(col, + RNA_boolean_get(&ptr, "use_negative_direction") && + RNA_enum_get(&ptr, "cull_face") != 0); + uiItemR(col, &ptr, "use_invert_cull", 0, NULL, ICON_NONE); + } + + uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE); + if (wrap_method == MOD_SHRINKWRAP_PROJECT) { + uiItemR(layout, &ptr, "auxiliary_target", 0, NULL, ICON_NONE); + } + uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Shrinkwrap, panel_draw); +} + ModifierTypeInfo modifierType_Shrinkwrap = { /* name */ "Shrinkwrap", /* structName */ "ShrinkwrapModifierData", @@ -234,4 +304,5 @@ ModifierTypeInfo modifierType_Shrinkwrap = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index a81b42905e3..3a3b3a4f3ce 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -25,19 +25,30 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "bmesh.h" @@ -452,6 +463,80 @@ static void deformVertsEM(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + int deform_method = RNA_enum_get(&ptr, "deform_method"); + + row = uiLayoutRow(layout, false); + uiItemR(row, &ptr, "deform_method", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + uiLayoutSetPropSep(layout, true); + + if (ELEM(deform_method, MOD_SIMPLEDEFORM_MODE_TAPER, MOD_SIMPLEDEFORM_MODE_STRETCH)) { + uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE); + } + else { + uiItemR(layout, &ptr, "angle", 0, NULL, ICON_NONE); + } + + uiItemR(layout, &ptr, "origin", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "deform_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void restrictions_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + int deform_method = RNA_enum_get(&ptr, "deform_method"); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "limits", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + if (ELEM(deform_method, + MOD_SIMPLEDEFORM_MODE_TAPER, + MOD_SIMPLEDEFORM_MODE_STRETCH, + MOD_SIMPLEDEFORM_MODE_TWIST)) { + int deform_axis = RNA_enum_get(&ptr, "deform_axis"); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Lock")); + if (deform_axis != 0) { + uiItemR(row, &ptr, "lock_x", toggles_flag, NULL, ICON_NONE); + } + if (deform_axis != 1) { + uiItemR(row, &ptr, "lock_y", toggles_flag, NULL, ICON_NONE); + } + if (deform_axis != 2) { + uiItemR(row, &ptr, "lock_z", toggles_flag, NULL, ICON_NONE); + } + } + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register( + region_type, eModifierType_SimpleDeform, panel_draw); + modifier_subpanel_register( + region_type, "restrictions", "Restrictions", NULL, restrictions_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_SimpleDeform = { /* name */ "SimpleDeform", /* structName */ "SimpleDeformModifierData", @@ -484,4 +569,5 @@ ModifierTypeInfo modifierType_SimpleDeform = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_simulation.cc b/source/blender/modifiers/intern/MOD_simulation.cc index f52daf53186..a9af48b682f 100644 --- a/source/blender/modifiers/intern/MOD_simulation.cc +++ b/source/blender/modifiers/intern/MOD_simulation.cc @@ -34,6 +34,7 @@ #include "DNA_object_types.h" #include "DNA_pointcloud_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" #include "DNA_simulation_types.h" #include "BKE_customdata.h" @@ -41,10 +42,22 @@ #include "BKE_mesh.h" #include "BKE_modifier.h" +/* SpaceType struct has a member called 'new' which obviously conflicts with C++ + * so temporarily redefining the new keyword to make it compile. */ +#define new extern_new +#include "BKE_screen.h" +#undef new + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx) { @@ -77,6 +90,25 @@ static PointCloud *modifyPointCloud(ModifierData *md, return pointcloud; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiItemR(layout, &ptr, "simulation", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "data_path", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Mask, panel_draw); +} + ModifierTypeInfo modifierType_Simulation = { /* name */ "Simulation", /* structName */ "SimulationModifierData", @@ -106,4 +138,5 @@ ModifierTypeInfo modifierType_Simulation = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 34590736e37..38d7b31a335 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -61,18 +61,31 @@ #include "BLI_math_geom.h" #include "BLI_stack.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_lib_id.h" #include "BKE_mesh.h" #include "BKE_mesh_mapping.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + +#include "WM_types.h" /* For skin mark clear operator UI. */ #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "bmesh.h" @@ -1934,6 +1947,64 @@ static void requiredDataMask(Object *UNUSED(ob), r_cddata_masks->vmask |= CD_MASK_MVERT_SKIN | CD_MASK_MDEFORMVERT; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA op_ptr; + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "branch_smoothing", 0, NULL, ICON_NONE); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Symmetry")); + uiItemR(row, &ptr, "use_x_symmetry", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_y_symmetry", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_z_symmetry", toggles_flag, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "use_smooth_shade", 0, NULL, ICON_NONE); + + row = uiLayoutRow(layout, false); + uiItemO(row, IFACE_("Create Armature"), ICON_NONE, "OBJECT_OT_skin_armature_create"); + uiItemO(row, NULL, ICON_NONE, "MESH_OT_customdata_skin_add"); + + row = uiLayoutRow(layout, true); + uiItemFullO(row, + "OBJECT_OT_skin_loose_mark_clear", + IFACE_("Mark Loose"), + ICON_NONE, + NULL, + WM_OP_EXEC_DEFAULT, + 0, + &op_ptr); + RNA_enum_set(&op_ptr, "action", 0); /* SKIN_LOOSE_MARK */ + uiItemFullO(row, + "OBJECT_OT_skin_loose_mark_clear", + IFACE_("Clear Loose"), + ICON_NONE, + NULL, + WM_OP_EXEC_DEFAULT, + 0, + &op_ptr); + RNA_enum_set(&op_ptr, "action", 1); /* SKIN_LOOSE_CLEAR */ + + uiItemO(layout, IFACE_("Mark Root"), ICON_NONE, "OBJECT_OT_skin_root_mark"); + uiItemO(layout, IFACE_("Equalize Radii"), ICON_NONE, "OBJECT_OT_skin_radii_equalize"); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Skin, panel_draw); +} + ModifierTypeInfo modifierType_Skin = { /* name */ "Skin", /* structName */ "SkinModifierData", @@ -1961,5 +2032,7 @@ ModifierTypeInfo modifierType_Skin = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 7ac6690e3a7..21313746ce3 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -27,16 +27,27 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_mesh.h" #include "BKE_particle.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void initData(ModifierData *md) @@ -226,6 +237,37 @@ static void deformVertsEM(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row, *col; + uiLayout *layout = panel->layout; + int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis")); + uiItemR(row, &ptr, "use_x", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_y", toggles_flag, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_z", toggles_flag, NULL, ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "factor", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "iterations", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Smooth, panel_draw); +} + ModifierTypeInfo modifierType_Smooth = { /* name */ "Smooth", /* structName */ "SmoothModifierData", @@ -256,4 +298,5 @@ ModifierTypeInfo modifierType_Smooth = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c index 92516d3d417..515303b7271 100644 --- a/source/blender/modifiers/intern/MOD_softbody.c +++ b/source/blender/modifiers/intern/MOD_softbody.c @@ -25,20 +25,31 @@ #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_object_force_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_layer.h" #include "BKE_particle.h" +#include "BKE_screen.h" #include "BKE_softbody.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_physics.h" #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static void deformVerts(ModifierData *UNUSED(md), const ModifierEvalContext *ctx, @@ -73,6 +84,23 @@ static void updateDepsgraph(ModifierData *UNUSED(md), const ModifierUpdateDepsgr DEG_add_modifier_to_transform_relation(ctx->node, "SoftBody Modifier"); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Softbody, panel_draw); +} + ModifierTypeInfo modifierType_Softbody = { /* name */ "Softbody", /* structName */ "SoftbodyModifierData", @@ -104,4 +132,5 @@ ModifierTypeInfo modifierType_Softbody = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 01277facacf..09351450d3b 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -21,13 +21,26 @@ * \ingroup modifiers */ +#include <string.h> + #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_particle.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_solidify_util.h" @@ -84,6 +97,164 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return mesh; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *sub, *row, *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + int solidify_mode = RNA_enum_get(&ptr, "solidify_mode"); + bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0; + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "solidify_mode", 0, NULL, ICON_NONE); + + if (solidify_mode == MOD_SOLIDIFY_MODE_NONMANIFOLD) { + uiItemR(layout, &ptr, "nonmanifold_thickness_mode", 0, IFACE_("Thickness"), ICON_NONE); + uiItemR(layout, &ptr, "nonmanifold_boundary_mode", 0, IFACE_("Boundary"), ICON_NONE); + } + + uiItemR(layout, &ptr, "thickness", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE); + + if (solidify_mode == MOD_SOLIDIFY_MODE_NONMANIFOLD) { + uiItemR(layout, &ptr, "nonmanifold_merge_threshold", 0, NULL, ICON_NONE); + } + + col = uiLayoutColumnWithHeading(layout, false, "Rim"); + uiItemR(col, &ptr, "use_rim", 0, IFACE_("Fill"), ICON_NONE); + sub = uiLayoutColumn(col, false); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_rim")); + uiItemR(sub, &ptr, "use_rim_only", 0, NULL, ICON_NONE); + + uiItemS(layout); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, has_vertex_group); + uiItemR(row, &ptr, "thickness_vertex_group", 0, IFACE_("Factor"), ICON_NONE); + + if (solidify_mode == MOD_SOLIDIFY_MODE_NONMANIFOLD) { + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, has_vertex_group); + uiItemR(row, &ptr, "use_flat_faces", 0, NULL, ICON_NONE); + } + + modifier_panel_end(layout, &ptr); +} + +static void normals_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + int solidify_mode = RNA_enum_get(&ptr, "solidify_mode"); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "use_flip_normals", 0, NULL, ICON_NONE); + if (solidify_mode == MOD_SOLIDIFY_MODE_EXTRUDE) { + uiItemR(layout, &ptr, "use_quality_normals", 0, IFACE_("High Quality"), ICON_NONE); + uiItemR(layout, &ptr, "use_even_offset", 0, NULL, ICON_NONE); + } +} + +static void materials_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "material_offset", 0, NULL, ICON_NONE); + col = uiLayoutColumn(layout, true); + uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_rim")); + uiItemR(col, &ptr, "material_offset_rim", 0, IFACE_("Rim"), ICON_NONE); +} + +static void edge_data_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + int solidify_mode = RNA_enum_get(&ptr, "solidify_mode"); + + uiLayoutSetPropSep(layout, true); + + if (solidify_mode == MOD_SOLIDIFY_MODE_EXTRUDE) { + uiItemR(layout, &ptr, "edge_crease_inner", 0, IFACE_("Inner"), ICON_NONE); + uiItemR(layout, &ptr, "edge_crease_outer", 0, IFACE_("Outer"), ICON_NONE); + uiItemR(layout, &ptr, "edge_crease_rim", 0, IFACE_("Rim"), ICON_NONE); + } + uiItemR(layout, &ptr, "bevel_convex", UI_ITEM_R_SLIDER, NULL, ICON_NONE); +} + +static void clamp_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "thickness_clamp", 0, NULL, ICON_NONE); + row = uiLayoutRow(layout, false); + uiLayoutSetActive(row, RNA_float_get(&ptr, "thickness_clamp") > 0.0f); + uiItemR(row, &ptr, "use_thickness_angle_clamp", 0, NULL, ICON_NONE); +} + +static void vertex_group_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, false); + uiItemPointerR(col, &ptr, "shell_vertex_group", &ob_ptr, "vertex_groups", "Shell", ICON_NONE); + uiItemPointerR(col, &ptr, "rim_vertex_group", &ob_ptr, "vertex_groups", "Rim", ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Solidify, panel_draw); + modifier_subpanel_register( + region_type, "normals", "Normals", NULL, normals_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "materials", "Materials", NULL, materials_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "edge_data", "Edge Data", NULL, edge_data_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "clamp", "Thickness Clamp", NULL, clamp_panel_draw, panel_type); + modifier_subpanel_register(region_type, + "vertex_groups", + "Output Vertex Groups", + NULL, + vertex_group_panel_draw, + panel_type); +} + ModifierTypeInfo modifierType_Solidify = { /* name */ "Solidify", /* structName */ "SolidifyModifierData", @@ -116,4 +287,5 @@ ModifierTypeInfo modifierType_Solidify = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index e054e3478ea..2b2f6893a2e 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -22,26 +22,40 @@ */ #include <stddef.h> +#include <string.h> #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_scene.h" +#include "BKE_screen.h" #include "BKE_subdiv.h" #include "BKE_subdiv_ccg.h" #include "BKE_subdiv_deform.h" #include "BKE_subdiv_mesh.h" #include "BKE_subsurf.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RE_engine.h" + +#include "RNA_access.h" + #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "intern/CCGSubSurf.h" @@ -275,6 +289,142 @@ static void deformMatrices(ModifierData *md, } } +#ifdef WITH_CYCLES +static bool get_show_adaptive_options(const bContext *C, Panel *panel) +{ + /* Don't show adaptive options if cycles isn't the active engine. */ + const struct RenderEngineType *engine_type = CTX_data_engine_type(C); + if (!STREQ(engine_type->idname, "CYCLES")) { + return false; + } + + /* Only show adaptive options if this is the last modifier. */ + PointerRNA md_ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &md_ptr); + ModifierData *md = md_ptr.data; + if (md->next != NULL) { + return false; + } + + /* Don't show adaptive options if the cycles experimental feature set is disabled. */ + Scene *scene = CTX_data_scene(C); + PointerRNA scene_ptr; + RNA_id_pointer_create(&scene->id, &scene_ptr); + if (BKE_scene_uses_cycles(scene)) { + PointerRNA cycles_ptr = RNA_pointer_get(&scene_ptr, "cycles"); + if (RNA_enum_get(&cycles_ptr, "feature_set") != 1) { /* EXPERIMENTAL */ + return false; + } + } + + return true; +} +#endif + +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + /* Only test for adaptive subdivision if built with cycles. */ + bool show_adaptive_options = false; + bool ob_use_adaptive_subdivision = false; + PointerRNA cycles_ptr = {NULL}; + PointerRNA ob_cycles_ptr = {NULL}; +#ifdef WITH_CYCLES + PointerRNA scene_ptr; + Scene *scene = CTX_data_scene(C); + RNA_id_pointer_create(&scene->id, &scene_ptr); + if (BKE_scene_uses_cycles(scene)) { + cycles_ptr = RNA_pointer_get(&scene_ptr, "cycles"); + ob_cycles_ptr = RNA_pointer_get(&ob_ptr, "cycles"); + if (!RNA_pointer_is_null(&ob_cycles_ptr)) { + ob_use_adaptive_subdivision = RNA_boolean_get(&ob_cycles_ptr, "use_adaptive_subdivision"); + show_adaptive_options = get_show_adaptive_options(C, panel); + } + } +#endif + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "subdivision_type", 0, IFACE_("Type"), ICON_NONE); + + if (show_adaptive_options) { + uiItemR(layout, + &ob_cycles_ptr, + "use_adaptive_subdivision", + 0, + IFACE_("Adaptive Subdivision"), + ICON_NONE); + } + if (ob_use_adaptive_subdivision && show_adaptive_options) { + uiItemR(layout, &ob_cycles_ptr, "dicing_rate", 0, NULL, ICON_NONE); + float render = MAX2(RNA_float_get(&cycles_ptr, "dicing_rate") * + RNA_float_get(&ob_cycles_ptr, "dicing_rate"), + 0.1f); + float preview = MAX2(RNA_float_get(&cycles_ptr, "preview_dicing_rate") * + RNA_float_get(&ob_cycles_ptr, "dicing_rate"), + 0.1f); + char output[64]; + snprintf(output, 64, "Final Scale: Render %.2f px, Viewport %.2f px", render, preview); + uiItemL(layout, output, ICON_NONE); + + uiItemS(layout); + + uiItemR(layout, &ptr, "levels", 0, IFACE_("Levels Viewport"), ICON_NONE); + } + else { + uiLayout *col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "levels", 0, IFACE_("Levels Viewport"), ICON_NONE); + uiItemR(col, &ptr, "render_levels", 0, IFACE_("Render"), ICON_NONE); + } + + uiItemR(layout, &ptr, "show_only_control_edges", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void advanced_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + bool ob_use_adaptive_subdivision = false; + bool show_adaptive_options = false; +#ifdef WITH_CYCLES + Scene *scene = CTX_data_scene(C); + if (BKE_scene_uses_cycles(scene)) { + PointerRNA ob_cycles_ptr = RNA_pointer_get(&ob_ptr, "cycles"); + if (!RNA_pointer_is_null(&ob_cycles_ptr)) { + ob_use_adaptive_subdivision = RNA_boolean_get(&ob_cycles_ptr, "use_adaptive_subdivision"); + show_adaptive_options = get_show_adaptive_options(C, panel); + } + } +#endif + + uiLayoutSetPropSep(layout, true); + + uiLayoutSetActive(layout, !(show_adaptive_options && ob_use_adaptive_subdivision)); + uiItemR(layout, &ptr, "quality", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "uv_smooth", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "use_creases", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Subsurf, panel_draw); + modifier_subpanel_register( + region_type, "advanced", "Advanced", NULL, advanced_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Subsurf = { /* name */ "Subdivision", /* structName */ "SubsurfModifierData", @@ -306,4 +456,5 @@ ModifierTypeInfo modifierType_Subsurf = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ freeRuntimeData, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index b7449cbe91c..252022a5439 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -25,19 +25,30 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" #include "BKE_bvhutils.h" +#include "BKE_context.h" #include "BKE_lib_id.h" #include "BKE_mesh.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "MEM_guardedalloc.h" @@ -182,6 +193,23 @@ static void deformVerts(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Surface, panel_draw); +} + ModifierTypeInfo modifierType_Surface = { /* name */ "Surface", /* structName */ "SurfaceModifierData", @@ -212,4 +240,5 @@ ModifierTypeInfo modifierType_Surface = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index 4169c76272e..4a2ed1d71db 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -24,25 +24,35 @@ #include "BLI_math_geom.h" #include "BLI_task.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" #include "BKE_bvhutils.h" +#include "BKE_context.h" +#include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh_runtime.h" #include "BKE_modifier.h" +#include "BKE_screen.h" -#include "BKE_deform.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" +#include "MOD_ui_common.h" #include "MOD_util.h" typedef struct SDefAdjacency { @@ -1385,8 +1395,50 @@ static bool isDisabled(const Scene *UNUSED(scene), ModifierData *md, bool UNUSED !(smd->verts != NULL && !(smd->flags & MOD_SDEF_BIND)); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA target_ptr = RNA_pointer_get(&ptr, "target"); + + bool is_bound = RNA_boolean_get(&ptr, "is_bound"); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, false); + uiLayoutSetActive(col, !is_bound); + uiItemR(col, &ptr, "target", 0, NULL, ICON_NONE); + + uiItemR(col, &ptr, "falloff", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + uiItemS(layout); + + col = uiLayoutColumn(layout, false); + if (is_bound) { + uiItemO(col, IFACE_("Unbind"), ICON_NONE, "OBJECT_OT_surfacedeform_bind"); + } + else { + uiLayoutSetActive(col, !RNA_pointer_is_null(&target_ptr)); + uiItemO(col, IFACE_("Bind"), ICON_NONE, "OBJECT_OT_surfacedeform_bind"); + } + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_SurfaceDeform, panel_draw); +} + ModifierTypeInfo modifierType_SurfaceDeform = { - /* name */ "Surface Deform", + /* name */ "SurfaceDeform", /* structName */ "SurfaceDeformModifierData", /* structSize */ sizeof(SurfaceDeformModifierData), /* type */ eModifierTypeType_OnlyDeform, @@ -1414,4 +1466,5 @@ ModifierTypeInfo modifierType_SurfaceDeform = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c index bb88bda6394..351a1016a35 100644 --- a/source/blender/modifiers/intern/MOD_triangulate.c +++ b/source/blender/modifiers/intern/MOD_triangulate.c @@ -22,17 +22,28 @@ #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "bmesh.h" #include "bmesh_tools.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" static Mesh *triangulate_mesh(Mesh *mesh, const int quad_method, @@ -115,6 +126,29 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx) return result; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "quad_method", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "ngon_method", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "min_vertices", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "keep_custom_normals", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Triangulate, panel_draw); +} + ModifierTypeInfo modifierType_Triangulate = { /* name */ "Triangulate", /* structName */ "TriangulateModifierData", @@ -144,5 +178,7 @@ ModifierTypeInfo modifierType_Triangulate = { /* dependsOnNormals */ NULL, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, + /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c new file mode 100644 index 00000000000..973afe5fef6 --- /dev/null +++ b/source/blender/modifiers/intern/MOD_ui_common.c @@ -0,0 +1,426 @@ +/* This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup modifiers + */ + +#include <string.h> + +#include "BLI_listbase.h" + +#include "MEM_guardedalloc.h" + +#include "BKE_context.h" +#include "BKE_modifier.h" +#include "BKE_object.h" +#include "BKE_screen.h" + +#include "DNA_object_force_types.h" +#include "DNA_object_types.h" +#include "DNA_particle_types.h" +#include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "DNA_space_types.h" + +#include "ED_object.h" + +#include "BLT_translation.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" /* Self include */ + +static Object *get_modifier_object(const bContext *C) +{ + SpaceProperties *sbuts = CTX_wm_space_properties(C); + if (sbuts != NULL && (sbuts->pinid != NULL) && GS(sbuts->pinid->name) == ID_OB) { + return (Object *)sbuts->pinid; + } + else { + return CTX_data_active_object(C); + } +} + +/** + * Poll function so these modifier panels don't show for other object types with modifiers (only + * grease pencil currently). + */ +static bool modifier_ui_poll(const bContext *C, PanelType *UNUSED(pt)) +{ + Object *ob = get_modifier_object(C); + + return (ob != NULL) && (ob->type != OB_GPENCIL); +} + +/* -------------------------------------------------------------------- */ +/** \name Panel Drag and Drop, Expansion Saving + * \{ */ + +/** + * Move a modifier to the index it's moved to after a drag and drop. + */ +static void modifier_reorder(bContext *C, Panel *panel, int new_index) +{ + Object *ob = get_modifier_object(C); + + ModifierData *md = BLI_findlink(&ob->modifiers, panel->runtime.list_index); + PointerRNA props_ptr; + wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_modifier_move_to_index", false); + WM_operator_properties_create_ptr(&props_ptr, ot); + RNA_string_set(&props_ptr, "modifier", md->name); + RNA_int_set(&props_ptr, "index", new_index); + WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); + WM_operator_properties_free(&props_ptr); +} + +static short get_modifier_expand_flag(const bContext *C, Panel *panel) +{ + Object *ob = get_modifier_object(C); + ModifierData *md = BLI_findlink(&ob->modifiers, panel->runtime.list_index); + return md->ui_expand_flag; +} + +static void set_modifier_expand_flag(const bContext *C, Panel *panel, short expand_flag) +{ + Object *ob = get_modifier_object(C); + ModifierData *md = BLI_findlink(&ob->modifiers, panel->runtime.list_index); + md->ui_expand_flag = expand_flag; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Modifier Panel Layouts + * \{ */ + +/** + * Draw modifier error message. + */ +void modifier_panel_end(uiLayout *layout, PointerRNA *ptr) +{ + ModifierData *md = ptr->data; + if (md->error) { + uiLayout *row = uiLayoutRow(layout, false); + uiItemL(row, IFACE_(md->error), ICON_ERROR); + } +} + +/** + * Gets RNA pointers for the active object and the panel's modifier data. Also locks + * the layout if the modifer is from a linked object, and sets the context pointer. + */ +#define ERROR_LIBDATA_MESSAGE TIP_("External library data") +void modifier_panel_get_property_pointers(const bContext *C, + Panel *panel, + PointerRNA *r_ob_ptr, + PointerRNA *r_md_ptr) +{ + Object *ob = get_modifier_object(C); + + ModifierData *md = BLI_findlink(&ob->modifiers, panel->runtime.list_index); + + RNA_pointer_create(&ob->id, &RNA_Modifier, md, r_md_ptr); + + if (r_ob_ptr != NULL) { + RNA_pointer_create(&ob->id, &RNA_Object, ob, r_ob_ptr); + } + + uiBlock *block = uiLayoutGetBlock(panel->layout); + UI_block_lock_set( + block, BKE_object_obdata_is_libdata(ob) || ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE); + + uiLayoutSetContextPointer(panel->layout, "modifier", r_md_ptr); +} + +/** + * Helper function for modifier layouts to draw vertex group settings. + */ +void modifier_vgroup_ui(uiLayout *layout, + PointerRNA *ptr, + PointerRNA *ob_ptr, + const char *vgroup_prop, + const char *invert_vgroup_prop, + const char *text) +{ + bool has_vertex_group = RNA_string_length(ptr, vgroup_prop) != 0; + + uiLayout *row = uiLayoutRow(layout, true); + uiItemPointerR(row, ptr, vgroup_prop, ob_ptr, "vertex_groups", text, ICON_NONE); + if (invert_vgroup_prop != NULL) { + uiLayout *sub = uiLayoutRow(row, true); + uiLayoutSetActive(sub, has_vertex_group); + uiLayoutSetPropDecorate(sub, false); + uiItemR(sub, ptr, invert_vgroup_prop, 0, "", ICON_ARROW_LEFTRIGHT); + } + if (uiLayoutGetPropDecorate(layout)) { + uiItemL(row, "", ICON_BLANK1); + } +} + +/** + * Check whether Modifier is a simulation or not. Used for switching to the + * physics/particles context tab. + */ +static int modifier_is_simulation(ModifierData *md) +{ + /* Physic Tab */ + if (ELEM(md->type, + eModifierType_Cloth, + eModifierType_Collision, + eModifierType_Fluidsim, + eModifierType_Fluid, + eModifierType_Softbody, + eModifierType_Surface, + eModifierType_DynamicPaint)) { + return 1; + } + /* Particle Tab */ + else if (md->type == eModifierType_ParticleSystem) { + return 2; + } + else { + return 0; + } +} + +static bool modifier_can_delete(ModifierData *md) +{ + /* fluid particle modifier can't be deleted here */ + if (md->type == eModifierType_ParticleSystem) { + short particle_type = ((ParticleSystemModifierData *)md)->psys->part->type; + if (ELEM(particle_type, + PART_FLUID, + PART_FLUID_FLIP, + PART_FLUID_FOAM, + PART_FLUID_SPRAY, + PART_FLUID_BUBBLE, + PART_FLUID_TRACER, + PART_FLUID_SPRAYFOAM, + PART_FLUID_SPRAYBUBBLE, + PART_FLUID_FOAMBUBBLE, + PART_FLUID_SPRAYFOAMBUBBLE)) { + return false; + } + } + return true; +} + +static void modifier_ops_extra_draw(bContext *UNUSED(C), uiLayout *layout, void *md_v) +{ + ModifierData *md = (ModifierData *)md_v; + + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); + + uiItemEnumO(layout, + "OBJECT_OT_modifier_apply", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), + 0, + "apply_as", + MODIFIER_APPLY_DATA); + + if (BKE_modifier_is_same_topology(md) && !BKE_modifier_is_non_geometrical(md)) { + uiItemEnumO(layout, + "OBJECT_OT_modifier_apply", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply As Shapekey"), + ICON_SHAPEKEY_DATA, + "apply_as", + MODIFIER_APPLY_SHAPE); + } + + if (!ELEM(md->type, + eModifierType_Fluidsim, + eModifierType_Softbody, + eModifierType_ParticleSystem, + eModifierType_Cloth, + eModifierType_Fluid)) { + uiItemO(layout, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), + ICON_DUPLICATE, + "OBJECT_OT_modifier_copy"); + } + + if (modifier_can_delete(md) && !modifier_is_simulation(md)) { + uiItemO(layout, + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete"), + ICON_X, + "OBJECT_OT_modifier_remove"); + } +} + +static void modifier_panel_header(const bContext *C, Panel *panel) +{ + uiLayout *row, *sub; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + Object *ob = get_modifier_object(C); + + /* Don't use #modifier_panel_get_property_pointers, we don't want to lock the header. */ + ModifierData *md = BLI_findlink(&ob->modifiers, panel->runtime.list_index); + RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr); + uiLayoutSetContextPointer(panel->layout, "modifier", &ptr); + + const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); + Scene *scene = CTX_data_scene(C); + int index = panel->runtime.list_index; + bool narrow_panel = (panel->sizex < UI_UNIT_X * 8 && panel->sizex != 0); + + /* Modifier Icon. */ + row = uiLayoutRow(layout, false); + if (mti->isDisabled && mti->isDisabled(scene, md, 0)) { + uiLayoutSetRedAlert(row, true); + } + uiItemL(row, "", RNA_struct_ui_icon(ptr.type)); + + /* Modifier Name. */ + if (!narrow_panel) { + uiItemR(layout, &ptr, "name", 0, "", ICON_NONE); + } + + /* Switch context buttons. */ + if (modifier_is_simulation(md) == 1) { + uiItemStringO( + layout, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PHYSICS"); + } + else if (modifier_is_simulation(md) == 2) { + uiItemStringO( + layout, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PARTICLES"); + } + + /* Mode switching buttons. */ + row = uiLayoutRow(layout, true); + if (ob->type == OB_MESH) { + int last_cage_index; + int cage_index = BKE_modifiers_get_cage_index(scene, ob, &last_cage_index, 0); + if (BKE_modifier_supports_cage(scene, md) && (index <= last_cage_index)) { + sub = uiLayoutRow(row, true); + if (index < cage_index || !BKE_modifier_couldbe_cage(scene, md)) { + uiLayoutSetActive(sub, false); + } + uiItemR(sub, &ptr, "show_on_cage", 0, "", ICON_NONE); + } + } /* Tessellation point for curve-typed objects. */ + else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { + if (mti->type != eModifierTypeType_Constructive) { + /* Constructive modifiers tessellates curve before applying. */ + uiItemR(layout, &ptr, "use_apply_on_spline", 0, "", ICON_NONE); + } + } + /* Collision and Surface are always enabled, hide buttons. */ + if (((md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && + (md->type != eModifierType_Surface)) { + if (mti->flags & eModifierTypeFlag_SupportsEditmode) { + sub = uiLayoutRow(row, true); + uiLayoutSetActive(sub, (md->mode & eModifierMode_Realtime)); + uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE); + } + uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE); + uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE); + } + + row = uiLayoutRow(layout, false); + uiItemMenuF(row, "", ICON_DOWNARROW_HLT, modifier_ops_extra_draw, md); + + /* Some padding at the end, so the buttons aren't too close to the drag button. */ + uiItemS(layout); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Modifier Registration Helpers + * \{ */ + +/** + * Create a panel in the context's region + */ +PanelType *modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw) +{ + /* Get the name for the modifier's panel. */ + char panel_idname[BKE_ST_MAXNAME]; + BKE_modifier_type_panel_id(type, panel_idname); + + PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname); + + strcpy(panel_type->idname, panel_idname); + strcpy(panel_type->label, ""); + strcpy(panel_type->context, "modifier"); + strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); + + panel_type->draw_header = modifier_panel_header; + panel_type->draw = draw; + panel_type->poll = modifier_ui_poll; + + /* Give the panel the special flag that says it was built here and corresponds to a + * modifer rather than a PanelType. */ + panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED; + panel_type->reorder = modifier_reorder; + panel_type->get_list_data_expand_flag = get_modifier_expand_flag; + panel_type->set_list_data_expand_flag = set_modifier_expand_flag; + + BLI_addtail(®ion_type->paneltypes, panel_type); + + return panel_type; +} + +/** + * Add a shild panel to the parent. + * + * \note To create the panel type's idname, it appends the \a name argument to the \a parent's + * idname. + */ +PanelType *modifier_subpanel_register(ARegionType *region_type, + const char *name, + const char *label, + PanelDrawFn draw_header, + PanelDrawFn draw, + PanelType *parent) +{ + /* Create the subpanel's ID name. */ + char panel_idname[BKE_ST_MAXNAME]; + strcpy(panel_idname, parent->idname); + strcat(panel_idname, "_"); + strcat(panel_idname, name); + + PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname); + + strcpy(panel_type->idname, panel_idname); + strcpy(panel_type->label, label); + strcpy(panel_type->context, "modifier"); + strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); + + panel_type->draw_header = draw_header; + panel_type->draw = draw; + panel_type->poll = modifier_ui_poll; + panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX); + + BLI_assert(parent != NULL); + strcpy(panel_type->parent_id, parent->idname); + panel_type->parent = parent; + BLI_addtail(&parent->children, BLI_genericNodeN(panel_type)); + BLI_addtail(®ion_type->paneltypes, panel_type); + + return panel_type; +} + +/** \} */ diff --git a/source/blender/modifiers/intern/MOD_ui_common.h b/source/blender/modifiers/intern/MOD_ui_common.h new file mode 100644 index 00000000000..59c0fe1c413 --- /dev/null +++ b/source/blender/modifiers/intern/MOD_ui_common.h @@ -0,0 +1,70 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup modifiers + */ + +#ifndef __MOD_UI_COMMON_H__ +#define __MOD_UI_COMMON_H__ + +/* so modifier types match their defines */ +#include "MOD_modifiertypes.h" + +#include "DEG_depsgraph_build.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct ARegionType; +struct bContext; +struct PanelType; +struct uiLayout; +typedef void (*PanelDrawFn)(const bContext *, struct Panel *); + +void modifier_panel_buttons(const struct bContext *C, struct Panel *panel); + +void modifier_vgroup_ui(struct uiLayout *layout, + struct PointerRNA *ptr, + struct PointerRNA *ob_ptr, + const char *vgroup_prop, + const char *invert_vgroup_prop, + const char *text); + +void modifier_panel_end(struct uiLayout *layout, PointerRNA *ptr); + +void modifier_panel_get_property_pointers(const bContext *C, + struct Panel *panel, + struct PointerRNA *r_ob_ptr, + struct PointerRNA *r_ptr); + +struct PanelType *modifier_panel_register(struct ARegionType *region_type, + ModifierType type, + PanelDrawFn draw); + +struct PanelType *modifier_subpanel_register(struct ARegionType *region_type, + const char *name, + const char *label, + PanelDrawFn draw_header, + PanelDrawFn draw, + struct PanelType *parent); + +#ifdef __cplusplus +} +#endif + +#endif /* __MOD_UI_COMMON_H__ */ diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 580a065f35e..07a57806f87 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -28,17 +28,28 @@ #include "BLI_math.h" #include "BLI_uvproject.h" +#include "BLT_translation.h" + #include "DNA_camera_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "BKE_camera.h" +#include "BKE_context.h" #include "BKE_lib_query.h" #include "BKE_material.h" #include "BKE_mesh.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MEM_guardedalloc.h" @@ -313,6 +324,43 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return result; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *sub; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data"); + + uiLayoutSetPropSep(layout, true); + + uiItemPointerR(layout, &ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE); + + sub = uiLayoutColumn(layout, true); + uiItemR(sub, &ptr, "aspect_x", 0, IFACE_("Aspect X"), ICON_NONE); + uiItemR(sub, &ptr, "aspect_y", 0, IFACE_("Y"), ICON_NONE); + + sub = uiLayoutColumn(layout, true); + uiItemR(sub, &ptr, "scale_x", 0, IFACE_("Scale X"), ICON_NONE); + uiItemR(sub, &ptr, "scale_y", 0, IFACE_("Y"), ICON_NONE); + + uiItemR(layout, &ptr, "projector_count", 0, IFACE_("Projectors"), ICON_NONE); + RNA_BEGIN (&ptr, projector_ptr, "projectors") { + uiItemR(layout, &projector_ptr, "object", 0, NULL, ICON_NONE); + } + RNA_END; + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_UVProject, panel_draw); +} + ModifierTypeInfo modifierType_UVProject = { /* name */ "UVProject", /* structName */ "UVProjectModifierData", @@ -343,4 +391,5 @@ ModifierTypeInfo modifierType_UVProject = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c index 4ece36d82a4..a8321cdc26a 100644 --- a/source/blender/modifiers/intern/MOD_uvwarp.c +++ b/source/blender/modifiers/intern/MOD_uvwarp.c @@ -25,17 +25,28 @@ #include "BLI_math.h" #include "BLI_task.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "BKE_action.h" /* BKE_pose_channel_find_name */ +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_lib_query.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph_query.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void uv_warp_from_mat4_pair(float uv_dst[2], const float uv_src[2], float warp_mat[4][4]) @@ -245,6 +256,70 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte DEG_add_modifier_to_transform_relation(ctx->node, "UVWarp Modifier"); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + PointerRNA warp_obj_ptr; + PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data"); + + uiLayoutSetPropSep(layout, true); + + uiItemPointerR(layout, &ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "center", 0, NULL, ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "axis_u", 0, IFACE_("Axis U"), ICON_NONE); + uiItemR(col, &ptr, "axis_v", 0, IFACE_("V"), ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "object_from", 0, NULL, ICON_NONE); + warp_obj_ptr = RNA_pointer_get(&ptr, "object_from"); + if (!RNA_pointer_is_null(&warp_obj_ptr) && RNA_enum_get(&warp_obj_ptr, "type") == OB_ARMATURE) { + PointerRNA warp_obj_data_ptr = RNA_pointer_get(&warp_obj_ptr, "data"); + uiItemPointerR(col, &ptr, "bone_from", &warp_obj_data_ptr, "bones", NULL, ICON_NONE); + } + + uiItemR(col, &ptr, "object_to", 0, IFACE_("To"), ICON_NONE); + warp_obj_ptr = RNA_pointer_get(&ptr, "object_to"); + if (!RNA_pointer_is_null(&warp_obj_ptr) && RNA_enum_get(&warp_obj_ptr, "type") == OB_ARMATURE) { + PointerRNA warp_obj_data_ptr = RNA_pointer_get(&warp_obj_ptr, "data"); + uiItemPointerR(col, &ptr, "bone_to", &warp_obj_data_ptr, "bones", NULL, ICON_NONE); + } + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + modifier_panel_end(layout, &ptr); +} + +static void transform_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "scale", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "rotation", 0, NULL, ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_UVWarp, panel_draw); + modifier_subpanel_register( + region_type, "offset", "Transform", NULL, transform_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_UVWarp = { /* name */ "UVWarp", /* structName */ "UVWarpModifierData", @@ -275,4 +350,5 @@ ModifierTypeInfo modifierType_UVWarp = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 692f0ca18f0..eab8ba478aa 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -26,25 +26,36 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "BKE_action.h" /* BKE_pose_channel_find_name */ #include "BKE_colortools.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" #include "BKE_texture.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" #include "RE_shader_ext.h" +#include "MOD_ui_common.h" #include "MOD_util.h" static void initData(ModifierData *md) @@ -393,6 +404,111 @@ static void deformVertsEM(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "object_from", 0, NULL, ICON_NONE); + PointerRNA from_obj_ptr = RNA_pointer_get(&ptr, "object_from"); + if (!RNA_pointer_is_null(&from_obj_ptr) && RNA_enum_get(&from_obj_ptr, "type") == OB_ARMATURE) { + + PointerRNA from_obj_data_ptr = RNA_pointer_get(&from_obj_ptr, "data"); + uiItemPointerR(col, &ptr, "bone_from", &from_obj_data_ptr, "bones", IFACE_("Bone"), ICON_NONE); + } + + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "object_to", 0, NULL, ICON_NONE); + PointerRNA to_obj_ptr = RNA_pointer_get(&ptr, "object_to"); + if (!RNA_pointer_is_null(&to_obj_ptr) && RNA_enum_get(&to_obj_ptr, "type") == OB_ARMATURE) { + PointerRNA to_obj_data_ptr = RNA_pointer_get(&to_obj_ptr, "data"); + uiItemPointerR(col, &ptr, "bone_to", &to_obj_data_ptr, "bones", IFACE_("Bone"), ICON_NONE); + } + + uiItemR(layout, &ptr, "use_volume_preserve", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "strength", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + modifier_panel_end(layout, &ptr); +} + +static void falloff_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + bool use_falloff = (RNA_enum_get(&ptr, "falloff_type") != eWarp_Falloff_None); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "falloff_type", 0, NULL, ICON_NONE); + + if (use_falloff) { + uiItemR(layout, &ptr, "falloff_radius", 0, NULL, ICON_NONE); + } + + if (use_falloff && RNA_enum_get(&ptr, "falloff_type") == eWarp_Falloff_Curve) { + uiTemplateCurveMapping(layout, &ptr, "falloff_curve", 0, false, false, false, false); + } +} + +static void texture_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + int texture_coords = RNA_enum_get(&ptr, "texture_coords"); + + uiTemplateID(layout, C, &ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "texture_coords", 0, IFACE_("Coordinates"), ICON_NONE); + + if (texture_coords == MOD_DISP_MAP_OBJECT) { + uiItemR(layout, &ptr, "texture_coords_object", 0, "Object", ICON_NONE); + PointerRNA texture_coords_obj_ptr = RNA_pointer_get(&ptr, "texture_coords_object"); + if (!RNA_pointer_is_null(&texture_coords_obj_ptr) && + (RNA_enum_get(&texture_coords_obj_ptr, "type") == OB_ARMATURE)) { + PointerRNA texture_coords_obj_data_ptr = RNA_pointer_get(&texture_coords_obj_ptr, "data"); + uiItemPointerR(layout, + &ptr, + "texture_coords_bone", + &texture_coords_obj_data_ptr, + "bones", + IFACE_("Bone"), + ICON_NONE); + } + } + else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) { + PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data"); + uiItemPointerR(layout, &ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE); + } +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Warp, panel_draw); + modifier_subpanel_register( + region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "texture", "Texture", NULL, texture_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Warp = { /* name */ "Warp", /* structName */ "WarpModifierData", @@ -422,4 +538,5 @@ ModifierTypeInfo modifierType_Warp = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 90d9f451f75..48aca9284eb 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -25,23 +25,34 @@ #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_editmesh.h" #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_scene.h" +#include "BKE_screen.h" #include "BKE_texture.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "MEM_guardedalloc.h" #include "RE_shader_ext.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "DEG_depsgraph.h" @@ -365,6 +376,122 @@ static void deformVertsEM(ModifierData *md, } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *sub, *row, *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + row = uiLayoutRowWithHeading(layout, true, "Motion"); + uiItemR(row, &ptr, "use_x", UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE, NULL, ICON_NONE); + uiItemR(row, &ptr, "use_y", UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "use_cyclic", 0, NULL, ICON_NONE); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Along Normals")); + uiItemR(row, &ptr, "use_normal", 0, "", ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_normal")); + uiItemR(sub, &ptr, "use_normal_x", UI_ITEM_R_TOGGLE, "X", ICON_NONE); + uiItemR(sub, &ptr, "use_normal_y", UI_ITEM_R_TOGGLE, "Y", ICON_NONE); + uiItemR(sub, &ptr, "use_normal_z", UI_ITEM_R_TOGGLE, "Z", ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "falloff_radius", 0, "Falloff", ICON_NONE); + uiItemR(col, &ptr, "height", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, &ptr, "width", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, &ptr, "narrowness", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + modifier_panel_end(layout, &ptr); +} + +static void position_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "start_position_object", 0, IFACE_("Object"), ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "start_position_x", 0, "Start position X", ICON_NONE); + uiItemR(col, &ptr, "start_position_y", 0, "Y", ICON_NONE); +} + +static void time_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, false); + uiItemR(col, &ptr, "time_offset", 0, "Offset", ICON_NONE); + uiItemR(col, &ptr, "lifetime", 0, "Life", ICON_NONE); + uiItemR(col, &ptr, "damping_time", 0, "Damping", ICON_NONE); + uiItemR(col, &ptr, "speed", UI_ITEM_R_SLIDER, NULL, ICON_NONE); +} + +static void texture_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + int texture_coords = RNA_enum_get(&ptr, "texture_coords"); + + uiTemplateID(layout, C, &ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "texture_coords", 0, IFACE_("Coordinates"), ICON_NONE); + if (texture_coords == MOD_DISP_MAP_OBJECT) { + uiItemR(layout, &ptr, "texture_coords_object", 0, NULL, ICON_NONE); + PointerRNA texture_coords_obj_ptr = RNA_pointer_get(&ptr, "texture_coords_object"); + if (!RNA_pointer_is_null(&texture_coords_obj_ptr) && + (RNA_enum_get(&texture_coords_obj_ptr, "type") == OB_ARMATURE)) { + PointerRNA texture_coords_obj_data_ptr = RNA_pointer_get(&texture_coords_obj_ptr, "data"); + uiItemPointerR(layout, + &ptr, + "texture_coords_bone", + &texture_coords_obj_data_ptr, + "bones", + IFACE_("Bone"), + ICON_NONE); + } + } + else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) { + PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data"); + uiItemPointerR(layout, &ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE); + } +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Wave, panel_draw); + modifier_subpanel_register( + region_type, "position", "Start Position", NULL, position_panel_draw, panel_type); + modifier_subpanel_register(region_type, "time", "Time", NULL, time_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "texture", "Texture", NULL, texture_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Wave = { /* name */ "Wave", /* structName */ "WaveModifierData", @@ -395,4 +522,5 @@ ModifierTypeInfo modifierType_Wave = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c index 3baf7c878dc..dc1b7ba8a75 100644 --- a/source/blender/modifiers/intern/MOD_weighted_normal.c +++ b/source/blender/modifiers/intern/MOD_weighted_normal.c @@ -24,16 +24,27 @@ #include "BLI_linklist.h" #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_lib_id.h" #include "BKE_mesh.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "bmesh.h" @@ -700,8 +711,36 @@ static bool dependsOnNormals(ModifierData *UNUSED(md)) return true; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "weight", 0, IFACE_("Weight"), ICON_NONE); + uiItemR(layout, &ptr, "thresh", 0, IFACE_("Threshold"), ICON_NONE); + + uiItemR(layout, &ptr, "keep_sharp", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "face_influence", 0, NULL, ICON_NONE); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_WeightedNormal, panel_draw); +} + ModifierTypeInfo modifierType_WeightedNormal = { - /* name */ "Weighted Normal", + /* name */ "WeightedNormal", /* structName */ "WeightedNormalModifierData", /* structSize */ sizeof(WeightedNormalModifierData), /* type */ eModifierTypeType_Constructive, @@ -730,4 +769,5 @@ ModifierTypeInfo modifierType_WeightedNormal = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 1a38787777f..54d3aa46344 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -27,6 +27,8 @@ #include "BLI_rand.h" #include "BLI_string.h" +#include "BLT_translation.h" + #include "DNA_color_types.h" /* CurveMapping. */ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" @@ -35,15 +37,22 @@ #include "DNA_scene_types.h" #include "BKE_colortools.h" /* CurveMapping. */ +#include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_modifier.h" #include "BKE_texture.h" /* Texture masking. */ +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "MOD_weightvg_util.h" #include "RE_shader_ext.h" /* Texture masking. */ @@ -329,3 +338,48 @@ void weightvg_update_vg(MDeformVert *dvert, } } } + +/* Common vertex weight mask interface elements for the modifier panels. + */ +void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout) +{ + PointerRNA mask_texture_ptr = RNA_pointer_get(ptr, "mask_texture"); + bool has_mask_texture = !RNA_pointer_is_null(&mask_texture_ptr); + bool has_mask_vertex_group = RNA_string_length(ptr, "mask_vertex_group") != 0; + int mask_tex_mapping = RNA_enum_get(ptr, "mask_tex_mapping"); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, ptr, "mask_constant", UI_ITEM_R_SLIDER, IFACE_("Global Influence:"), ICON_NONE); + + if (!has_mask_texture) { + modifier_vgroup_ui(layout, ptr, ob_ptr, "mask_vertex_group", "invert_mask_vertex_group", NULL); + } + + if (!has_mask_vertex_group) { + uiTemplateID(layout, + C, + ptr, + "mask_texture", + "texture.new", + NULL, + NULL, + 0, + ICON_NONE, + IFACE_("Mask Texture")); + + if (has_mask_texture) { + uiItemR(layout, ptr, "mask_tex_use_channel", 0, IFACE_("Channel"), ICON_NONE); + uiItemR(layout, ptr, "mask_tex_mapping", 0, NULL, ICON_NONE); + + if (mask_tex_mapping == MOD_DISP_MAP_OBJECT) { + uiItemR(layout, ptr, "mask_tex_map_object", 0, IFACE_("Object"), ICON_NONE); + } + else if (mask_tex_mapping == MOD_DISP_MAP_UV && RNA_enum_get(ob_ptr, "type") == OB_MESH) { + PointerRNA obj_data_ptr = RNA_pointer_get(ob_ptr, "data"); + uiItemPointerR( + layout, ptr, "mask_tex_uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE); + } + } + } +}
\ No newline at end of file diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h index 50597d43112..725574dc0a5 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.h +++ b/source/blender/modifiers/intern/MOD_weightvg_util.h @@ -30,9 +30,11 @@ struct MDeformWeight; struct Mesh; struct ModifierEvalContext; struct Object; +struct PointerRNA; struct RNG; struct Scene; struct Tex; +struct uiLayout; /* * XXX I'd like to make modified weights visible in WeightPaint mode, @@ -89,4 +91,5 @@ void weightvg_update_vg(struct MDeformVert *dvert, const float rem_thresh, const bool do_normalize); +void weightvg_ui_common(const bContext *C, PointerRNA *ob_ptr, PointerRNA *ptr, uiLayout *layout); #endif /* __MOD_WEIGHTVG_UTIL_H__ */ diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 8ce1aaee942..9a9ab55a835 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -27,24 +27,35 @@ #include "BLI_listbase.h" #include "BLI_rand.h" +#include "BLT_translation.h" + #include "DNA_color_types.h" /* CurveMapping. */ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "BKE_colortools.h" /* CurveMapping. */ +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_lib_query.h" #include "BKE_modifier.h" +#include "BKE_screen.h" #include "BKE_texture.h" /* Texture masking. */ +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "MOD_weightvg_util.h" @@ -303,6 +314,91 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return mesh; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *sub, *col, *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + col = uiLayoutColumn(layout, true); + uiItemPointerR(col, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE); + + uiItemR(layout, &ptr, "default_weight", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + col = uiLayoutColumnWithHeading(layout, false, IFACE_("Group Add")); + row = uiLayoutRow(col, true); + uiLayoutSetPropDecorate(row, false); + sub = uiLayoutRow(row, true); + uiItemR(sub, &ptr, "use_add", 0, "", ICON_NONE); + sub = uiLayoutRow(sub, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_add")); + uiLayoutSetPropSep(sub, false); + uiItemR(sub, &ptr, "add_threshold", UI_ITEM_R_SLIDER, "Threshold", ICON_NONE); + uiItemDecoratorR(row, &ptr, "add_threshold", 0); + + col = uiLayoutColumnWithHeading(layout, false, IFACE_("Group Remove")); + row = uiLayoutRow(col, true); + uiLayoutSetPropDecorate(row, false); + sub = uiLayoutRow(row, true); + uiItemR(sub, &ptr, "use_remove", 0, "", ICON_NONE); + sub = uiLayoutRow(sub, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_remove")); + uiLayoutSetPropSep(sub, false); + uiItemR(sub, &ptr, "remove_threshold", UI_ITEM_R_SLIDER, "Threshold", ICON_NONE); + uiItemDecoratorR(row, &ptr, "remove_threshold", 0); + + uiItemR(layout, &ptr, "normalize", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void falloff_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row, *sub; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + row = uiLayoutRow(layout, true); + uiItemR(row, &ptr, "falloff_type", 0, IFACE_("Type"), ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetPropSep(sub, false); + uiItemR(row, &ptr, "invert_falloff", 0, "", ICON_ARROW_LEFTRIGHT); + if (RNA_enum_get(&ptr, "falloff_type") == MOD_WVG_MAPPING_CURVE) { + uiTemplateCurveMapping(layout, &ptr, "map_curve", 0, false, false, false, false); + } +} + +static void influence_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + weightvg_ui_common(C, &ob_ptr, &ptr, layout); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register( + region_type, eModifierType_WeightVGEdit, panel_draw); + modifier_subpanel_register( + region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type); + modifier_subpanel_register( + region_type, "influence", "Influence", NULL, influence_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_WeightVGEdit = { /* name */ "VertexWeightEdit", /* structName */ "WeightVGEditModifierData", @@ -333,4 +429,5 @@ ModifierTypeInfo modifierType_WeightVGEdit = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index a71b1d9d0e8..e089720b3e3 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -26,23 +26,34 @@ #include "BLI_listbase.h" #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_lib_query.h" #include "BKE_modifier.h" +#include "BKE_screen.h" #include "BKE_texture.h" /* Texture masking. */ +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "MOD_weightvg_util.h" @@ -449,6 +460,54 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return mesh; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group_a", "invert_vertex_group_a", NULL); + modifier_vgroup_ui( + layout, &ptr, &ob_ptr, "vertex_group_b", "invert_vertex_group_b", IFACE_("B")); + + uiItemS(layout); + + uiItemR(layout, &ptr, "default_weight_a", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "default_weight_b", 0, IFACE_("B"), ICON_NONE); + + uiItemS(layout); + + uiItemR(layout, &ptr, "mix_set", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "mix_mode", 0, NULL, ICON_NONE); + + uiItemR(layout, &ptr, "normalize", 0, NULL, ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void influence_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + weightvg_ui_common(C, &ob_ptr, &ptr, layout); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register( + region_type, eModifierType_WeightVGMix, panel_draw); + modifier_subpanel_register( + region_type, "influence", "Influence", NULL, influence_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_WeightVGMix = { /* name */ "VertexWeightMix", /* structName */ "WeightVGMixModifierData", @@ -479,4 +538,5 @@ ModifierTypeInfo modifierType_WeightVGMix = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index e3f833ff81e..02d1f7a94aa 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -29,12 +29,16 @@ #include "BLI_rand.h" #include "BLI_task.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "BKE_bvhutils.h" +#include "BKE_context.h" #include "BKE_curve.h" #include "BKE_customdata.h" #include "BKE_deform.h" @@ -42,14 +46,21 @@ #include "BKE_lib_query.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" #include "BKE_texture.h" /* Texture masking. */ +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" + #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" #include "MEM_guardedalloc.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "MOD_util.h" #include "MOD_weightvg_util.h" @@ -630,6 +641,65 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return mesh; } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row, *col, *sub; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemPointerR(layout, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE); + + uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE); + + uiItemS(layout); + + uiItemR(layout, &ptr, "proximity_mode", 0, NULL, ICON_NONE); + if (RNA_enum_get(&ptr, "proximity_mode") == MOD_WVG_PROXIMITY_GEOMETRY) { + uiItemR(layout, &ptr, "proximity_geometry", UI_ITEM_R_EXPAND, IFACE_("Geometry"), ICON_NONE); + } + + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "min_dist", 0, NULL, ICON_NONE); + uiItemR(col, &ptr, "max_dist", 0, NULL, ICON_NONE); + + uiItemS(layout); + + row = uiLayoutRow(layout, true); + uiItemR(row, &ptr, "falloff_type", 0, NULL, ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetPropSep(sub, false); + uiItemR(row, &ptr, "invert_falloff", 0, "", ICON_ARROW_LEFTRIGHT); + modifier_panel_end(layout, &ptr); + + uiItemS(layout); + + uiItemR(layout, &ptr, "normalize", 0, NULL, ICON_NONE); +} + +static void influence_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + weightvg_ui_common(C, &ob_ptr, &ptr, layout); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register( + region_type, eModifierType_WeightVGProximity, panel_draw); + modifier_subpanel_register( + region_type, "influence", "Influence", NULL, influence_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_WeightVGProximity = { /* name */ "VertexWeightProximity", /* structName */ "WeightVGProximityModifierData", @@ -660,4 +730,5 @@ ModifierTypeInfo modifierType_WeightVGProximity = { /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; diff --git a/source/blender/modifiers/intern/MOD_weld.c b/source/blender/modifiers/intern/MOD_weld.c index 3bef0ad6bf7..76ca85163d9 100644 --- a/source/blender/modifiers/intern/MOD_weld.c +++ b/source/blender/modifiers/intern/MOD_weld.c @@ -35,19 +35,30 @@ #include "BLI_kdopbvh.h" #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" #include "BKE_bvhutils.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_mesh.h" #include "BKE_modifier.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "DEG_depsgraph.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" //#define USE_WELD_DEBUG //#define USE_WELD_NORMALS @@ -1939,6 +1950,28 @@ static void requiredDataMask(Object *UNUSED(ob), } } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "merge_threshold", 0, IFACE_("Distance"), ICON_NONE); + uiItemR(layout, &ptr, "max_interactions", 0, NULL, ICON_NONE); + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + modifier_panel_end(layout, &ptr); +} + +static void panelRegister(ARegionType *region_type) +{ + modifier_panel_register(region_type, eModifierType_Weld, panel_draw); +} + ModifierTypeInfo modifierType_Weld = { /* name */ "Weld", /* structName */ "WeldModifierData", @@ -1970,6 +2003,7 @@ ModifierTypeInfo modifierType_Weld = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; /** \} */ diff --git a/source/blender/modifiers/intern/MOD_wireframe.c b/source/blender/modifiers/intern/MOD_wireframe.c index 4e2e97a2b8b..66a03ee5d71 100644 --- a/source/blender/modifiers/intern/MOD_wireframe.c +++ b/source/blender/modifiers/intern/MOD_wireframe.c @@ -18,15 +18,28 @@ * \ingroup modifiers */ +#include <string.h> + #include "BLI_utildefines.h" +#include "BLT_translation.h" + #include "DNA_mesh_types.h" #include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "BKE_context.h" #include "BKE_deform.h" #include "BKE_mesh.h" +#include "BKE_screen.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "RNA_access.h" #include "MOD_modifiertypes.h" +#include "MOD_ui_common.h" #include "bmesh.h" #include "tools/bmesh_wireframe.h" @@ -104,6 +117,67 @@ static Mesh *modifyMesh(ModifierData *md, const struct ModifierEvalContext *ctx, return WireframeModifier_do((WireframeModifierData *)md, ctx->object, mesh); } +static void panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *col, *row, *sub; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + uiLayoutSetPropSep(layout, true); + + uiItemR(layout, &ptr, "thickness", 0, IFACE_("Thickness"), ICON_NONE); + uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "use_boundary", 0, IFACE_("Boundary"), ICON_NONE); + uiItemR(col, &ptr, "use_replace", 0, IFACE_("Replace Original"), ICON_NONE); + + col = uiLayoutColumnWithHeading(layout, true, IFACE_("Thickness")); + uiItemR(col, &ptr, "use_even_offset", 0, IFACE_("Even"), ICON_NONE); + uiItemR(col, &ptr, "use_relative_offset", 0, IFACE_("Relative"), ICON_NONE); + + row = uiLayoutRowWithHeading(layout, true, IFACE_("Crease Edges")); + uiItemR(row, &ptr, "use_crease", 0, "", ICON_NONE); + sub = uiLayoutRow(row, true); + uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_crease")); + uiItemR(sub, &ptr, "crease_weight", UI_ITEM_R_SLIDER, "", ICON_NONE); + + uiItemR(layout, &ptr, "material_offset", 0, IFACE_("Material Offset"), ICON_NONE); + + modifier_panel_end(layout, &ptr); +} + +static void vertex_group_panel_draw(const bContext *C, Panel *panel) +{ + uiLayout *row; + uiLayout *layout = panel->layout; + + PointerRNA ptr; + PointerRNA ob_ptr; + modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + + bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0; + + uiLayoutSetPropSep(layout, true); + + modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + + row = uiLayoutRow(layout, true); + uiLayoutSetActive(row, has_vertex_group); + uiItemR(row, &ptr, "thickness_vertex_group", 0, IFACE_("Factor"), ICON_NONE); +} + +static void panelRegister(ARegionType *region_type) +{ + PanelType *panel_type = modifier_panel_register( + region_type, eModifierType_Wireframe, panel_draw); + modifier_subpanel_register( + region_type, "vertex_group", "Vertex Group", NULL, vertex_group_panel_draw, panel_type); +} + ModifierTypeInfo modifierType_Wireframe = { /* name */ "Wireframe", /* structName */ "WireframeModifierData", @@ -133,4 +207,5 @@ ModifierTypeInfo modifierType_Wireframe = { /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, + /* panelRegister */ panelRegister, }; |