From db40b62252e5a7716cd403a0574cc164163b2ce9 Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Mon, 17 Oct 2022 11:17:42 +0200 Subject: Sculpt: Auto-masking UI improvements Add auto-masking as a popover in the header while in Sculpt mode, following the design in T101593. These properties were present in the Options panel (and popover), they have been removed from there. Moreover, this commit makes the auto-masking section in Brush settings match the new popover. In the future this popover can be used for other modes that support auto-masking such as Grease Pencil. See D16145 for details and screenshots. Reviewed By: JulienKaspar Differential Revision: https://developer.blender.org/D16145 --- .../startup/bl_ui/properties_paint_common.py | 72 ++++++++++++------- release/scripts/startup/bl_ui/space_view3d.py | 82 +++++++++++++++++++++- .../scripts/startup/bl_ui/space_view3d_toolbar.py | 46 ------------ 3 files changed, 126 insertions(+), 74 deletions(-) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index 72a87703bd5..0e49a506e73 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -928,60 +928,80 @@ def brush_settings_advanced(layout, context, brush, popover=False): use_frontface = False if mode == 'SCULPT': + sculpt = context.tool_settings.sculpt capabilities = brush.sculpt_capabilities use_accumulate = capabilities.has_accumulate use_frontface = True col = layout.column(heading="Auto-Masking", align=True) - # topology automasking + col = layout.column(align=True) col.prop(brush, "use_automasking_topology", text="Topology") - - # face masks automasking col.prop(brush, "use_automasking_face_sets", text="Face Sets") - # boundary edges/face sets automasking + layout.separator() + + col = layout.column(align=True) col.prop(brush, "use_automasking_boundary_edges", text="Mesh Boundary") col.prop(brush, "use_automasking_boundary_face_sets", text="Face Sets Boundary") - col.prop(brush, "use_automasking_cavity", text="Cavity") - col.prop(brush, "use_automasking_cavity_inverted", text="Cavity (Inverted)") - col.prop(brush, "use_automasking_start_normal", text="Area Normal") - col.prop(brush, "use_automasking_view_normal", text="View Normal") - col.separator() - col.prop(brush, "automasking_boundary_edges_propagation_steps") + if brush.use_automasking_boundary_edges or brush.use_automasking_boundary_face_sets: + col = layout.column() + col.use_property_split = False + split = col.split(factor=0.4) + col = split.column() + split.prop(brush, "automasking_boundary_edges_propagation_steps") - sculpt = context.tool_settings.sculpt + layout.separator() - if brush.use_automasking_start_normal: - col.separator() + col = layout.column(align=True) + row = col.row() + row.prop(brush, "use_automasking_cavity", text="Cavity") - col.prop(sculpt, "automasking_start_normal_limit") - col.prop(sculpt, "automasking_start_normal_falloff") + is_cavity_active = brush.use_automasking_cavity or brush.use_automasking_cavity_inverted - if brush.use_automasking_view_normal: - col.separator() + if is_cavity_active: + row.operator("sculpt.mask_from_cavity", text="Create Mask") - col.prop(brush, "use_automasking_view_occlusion", text="Occlusion") - col.prop(sculpt, "automasking_view_normal_limit") - col.prop(sculpt, "automasking_view_normal_falloff") + col.prop(brush, "use_automasking_cavity_inverted", text="Cavity (inverted)") - if brush.use_automasking_cavity or brush.use_automasking_cavity_inverted: - col.separator() + if is_cavity_active: + col = layout.column(align=True) + col.prop(brush, "automasking_cavity_factor", text="Factor") + col.prop(brush, "automasking_cavity_blur_steps", text="Blur") - col.prop(brush, "automasking_cavity_factor", text="Cavity Factor") - col.prop(brush, "automasking_cavity_blur_steps", text="Cavity Blur") - col.prop(brush, "use_automasking_custom_cavity_curve", text="Use Curve") + col = layout.column() + col.prop(brush, "use_automasking_custom_cavity_curve", text="Custom Curve") if brush.use_automasking_custom_cavity_curve: col.template_curve_mapping(brush, "automasking_cavity_curve") layout.separator() + col = layout.column(align=True) + col.prop(brush, "use_automasking_view_normal", text="View Normal") + + if brush.use_automasking_view_normal: + col.prop(brush, "use_automasking_view_occlusion", text="Occlusion") + subcol = col.column(align=True) + subcol.active = not brush.use_automasking_view_occlusion + subcol.prop(sculpt, "automasking_view_normal_limit", text="Limit") + subcol.prop(sculpt, "automasking_view_normal_falloff", text="Falloff") + + col = layout.column() + col.prop(brush, "use_automasking_start_normal", text="Area Normal") + + if brush.use_automasking_start_normal: + col = layout.column(align=True) + col.prop(sculpt, "automasking_start_normal_limit", text="Limit") + col.prop(sculpt, "automasking_start_normal_falloff", text="Falloff") + + layout.separator() + # sculpt plane settings if capabilities.has_sculpt_plane: layout.prop(brush, "sculpt_plane") - col = layout.column(heading="Use Original", align=True) + col = layout.column(heading="Original", align=True) col.prop(brush, "use_original_normal", text="Normal") col.prop(brush, "use_original_plane", text="Plane") layout.separator() diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 3a02492635a..ea257498e11 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -838,12 +838,18 @@ class VIEW3D_HT_header(Header): text="Guides", ) - layout.separator_spacer() + elif object_mode == 'SCULPT': + layout.popover( + panel="VIEW3D_PT_sculpt_automasking", + text="", + icon="MOD_MASK" + ) + else: # Transform settings depending on tool header visibility VIEW3D_HT_header.draw_xform_template(layout, context) - layout.separator_spacer() + layout.separator_spacer() # Viewport Settings layout.popover( @@ -7680,6 +7686,77 @@ class VIEW3D_PT_paint_weight_context_menu(Panel): ) +class VIEW3D_PT_sculpt_automasking(Panel): + bl_space_type = 'VIEW_3D' + bl_region_type = 'HEADER' + bl_label = "Auto-Masking" + bl_ui_units_x = 10 + + def draw(self, context): + layout = self.layout + + tool_settings = context.tool_settings + sculpt = tool_settings.sculpt + layout.label(text="Auto-Masking") + + col = layout.column(align=True) + col.prop(sculpt, "use_automasking_topology", text="Topology") + col.prop(sculpt, "use_automasking_face_sets", text="Face Sets") + + col.separator() + + col = layout.column(align=True) + col.prop(sculpt, "use_automasking_boundary_edges", text="Mesh Boundary") + col.prop(sculpt, "use_automasking_boundary_face_sets", text="Face Sets Boundary") + + if sculpt.use_automasking_boundary_edges or sculpt.use_automasking_boundary_face_sets: + col.prop(sculpt.brush, "automasking_boundary_edges_propagation_steps") + + col.separator() + + col = layout.column(align=True) + row = col.row() + row.prop(sculpt, "use_automasking_cavity", text="Cavity") + + is_cavity_active = sculpt.use_automasking_cavity or sculpt.use_automasking_cavity_inverted + + if is_cavity_active: + row.operator("sculpt.mask_from_cavity", text="Create Mask") + + col.prop(sculpt, "use_automasking_cavity_inverted", text="Cavity (inverted)") + + if is_cavity_active: + col = layout.column(align=True) + col.prop(sculpt, "automasking_cavity_factor", text="Factor") + col.prop(sculpt, "automasking_cavity_blur_steps", text="Blur") + + col = layout.column() + col.prop(sculpt, "use_automasking_custom_cavity_curve", text="Custom Curve") + + if sculpt.use_automasking_custom_cavity_curve: + col.template_curve_mapping(sculpt, "automasking_cavity_curve") + + col.separator() + + col = layout.column(align=True) + col.prop(sculpt, "use_automasking_view_normal", text="View Normal") + + if sculpt.use_automasking_view_normal: + col.prop(sculpt, "use_automasking_view_occlusion", text="Occlusion") + subcol = col.column(align=True) + subcol.active = not sculpt.use_automasking_view_occlusion + subcol.prop(sculpt, "automasking_view_normal_limit", text="Limit") + subcol.prop(sculpt, "automasking_view_normal_falloff", text="Falloff") + + col = layout.column() + col.prop(sculpt, "use_automasking_start_normal", text="Area Normal") + + if sculpt.use_automasking_start_normal: + col = layout.column(align=True) + col.prop(sculpt, "automasking_start_normal_limit", text="Limit") + col.prop(sculpt, "automasking_start_normal_falloff", text="Falloff") + + class VIEW3D_PT_sculpt_context_menu(Panel): # Only for popover, these are dummy values. bl_space_type = 'VIEW_3D' @@ -8070,6 +8147,7 @@ classes = ( VIEW3D_PT_gpencil_sculpt_context_menu, VIEW3D_PT_gpencil_weight_context_menu, VIEW3D_PT_gpencil_draw_context_menu, + VIEW3D_PT_sculpt_automasking, VIEW3D_PT_sculpt_context_menu, TOPBAR_PT_gpencil_materials, TOPBAR_PT_gpencil_vertexcolor, diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 3357676bf2f..328e45f79b9 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -964,52 +964,6 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel): col.prop(sculpt, "use_sculpt_delay_updates") col.prop(sculpt, "use_deform_only") - col.separator() - - col = layout.column(heading="Auto-Masking", align=True) - - col.prop(sculpt, "use_automasking_topology", text="Topology") - col.prop(sculpt, "use_automasking_face_sets", text="Face Sets") - col.prop(sculpt, "use_automasking_boundary_edges", text="Mesh Boundary") - col.prop(sculpt, "use_automasking_boundary_face_sets", text="Face Sets Boundary") - col.prop(sculpt, "use_automasking_cavity", text="Cavity") - col.prop(sculpt, "use_automasking_cavity_inverted", text="Cavity (Inverted)") - col.prop(sculpt, "use_automasking_start_normal", text="Area Normal") - col.prop(sculpt, "use_automasking_view_normal", text="View Normal") - - if sculpt.use_automasking_start_normal: - col.separator() - - col.prop(sculpt, "automasking_start_normal_limit") - col.prop(sculpt, "automasking_start_normal_falloff") - - if sculpt.use_automasking_view_normal: - col.separator() - - col.prop(sculpt, "use_automasking_view_occlusion", text="Occlusion") - col.prop(sculpt, "automasking_view_normal_limit") - col.prop(sculpt, "automasking_view_normal_falloff") - - col.separator() - col.prop(sculpt.brush, "automasking_boundary_edges_propagation_steps") - - if sculpt.use_automasking_cavity or sculpt.use_automasking_cavity_inverted: - col.separator() - - col2 = col.column() - props = col2.operator("sculpt.mask_from_cavity", text="Mask From Cavity") - props.use_automask_settings = True - - col2 = col.column() - - col2.prop(sculpt, "automasking_cavity_factor", text="Cavity Factor") - col2.prop(sculpt, "automasking_cavity_blur_steps", text="Cavity Blur") - - col2.prop(sculpt, "use_automasking_custom_cavity_curve", text="Use Curve") - - if sculpt.use_automasking_custom_cavity_curve: - col2.template_curve_mapping(sculpt, "automasking_cavity_curve") - class VIEW3D_PT_sculpt_options_gravity(Panel, View3DPaintPanel): bl_context = ".sculpt_mode" # dot on purpose (access from topbar) -- cgit v1.2.3 From 96fa5e1e84d722fd9d4014ab5d100ec254d64cb5 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 18 Oct 2022 14:42:35 +0200 Subject: Cleanup: remove unused 'VIEW3D_MT_brush_context_menu_paint_modes' This was added in rB4c9fe657458f, however that new code never used this menu (but the existing `VIEW3D_MT_brush_paint_modes` instead). Differential Revision: https://developer.blender.org/D16285 --- release/scripts/startup/bl_ui/space_view3d_toolbar.py | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 328e45f79b9..a28e93c34d1 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -81,22 +81,6 @@ class VIEW3D_MT_brush_gpencil_context_menu(Menu): layout.operator("gpencil.brush_reset_all") -class VIEW3D_MT_brush_context_menu_paint_modes(Menu): - bl_label = "Enabled Modes" - - def draw(self, context): - layout = self.layout - - settings = UnifiedPaintPanel.paint_settings(context) - brush = settings.brush - - layout.prop(brush, "use_paint_sculpt", text="Sculpt") - layout.prop(brush, "use_paint_uv_sculpt", text="UV Sculpt") - layout.prop(brush, "use_paint_vertex", text="Vertex Paint") - layout.prop(brush, "use_paint_weight", text="Weight Paint") - layout.prop(brush, "use_paint_image", text="Texture Paint") - - class View3DPanel: bl_space_type = 'VIEW_3D' bl_region_type = 'UI' @@ -2373,7 +2357,6 @@ class VIEW3D_PT_gpencil_brush_presets(Panel, PresetPanel): classes = ( VIEW3D_MT_brush_context_menu, VIEW3D_MT_brush_gpencil_context_menu, - VIEW3D_MT_brush_context_menu_paint_modes, VIEW3D_PT_tools_object_options, VIEW3D_PT_tools_object_options_transform, VIEW3D_PT_tools_meshedit_options, -- cgit v1.2.3 From 4163c63def98b46fe7ddba82ade997c818ab2b96 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 18 Oct 2022 15:40:54 +0200 Subject: Curves sculptmode: fix missing mode and tool in Brush Specials For consistency with other brush based (paint) systems we should add these entries in the brushes context menu. For this, expose the brushes `ob_mode` to RNA and show this (along with the tool choice) to the appropriate menus. Differential Revision: https://developer.blender.org/D16287 --- release/scripts/startup/bl_ui/space_view3d.py | 1 + release/scripts/startup/bl_ui/space_view3d_toolbar.py | 2 ++ 2 files changed, 3 insertions(+) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index ea257498e11..39684aaf161 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -3018,6 +3018,7 @@ class VIEW3D_MT_brush_paint_modes(Menu): layout.prop(brush, "use_paint_vertex", text="Vertex Paint") layout.prop(brush, "use_paint_weight", text="Weight Paint") layout.prop(brush, "use_paint_image", text="Texture Paint") + layout.prop(brush, "use_paint_sculpt_curves", text="Sculpt Curves") class VIEW3D_MT_paint_vertex(Menu): diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index a28e93c34d1..fec156580cf 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -52,6 +52,8 @@ class VIEW3D_MT_brush_context_menu(Menu): elif context.sculpt_object: layout.prop_menu_enum(brush, "sculpt_tool") layout.operator("brush.reset") + elif context.tool_settings.curves_sculpt: + layout.prop_menu_enum(brush, "curves_sculpt_tool") class VIEW3D_MT_brush_gpencil_context_menu(Menu): -- cgit v1.2.3 From 2180e6fc9ffb173e1a36e2668f048d18cf3940f2 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 13 Sep 2022 13:19:15 +0200 Subject: Curves: make the "surface_uv_map" a searchable dropdown The users had to type in a name here, but we can also make it a dropdown choice with existing UV Maps for convenience: - dont have to remember a name or copy paste obviously - shows in red if it was removed / invalid Came up in T101028 Maniphest Tasks: T101028 Differential Revision: https://developer.blender.org/D15956 --- release/scripts/startup/bl_ui/properties_data_curves.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/properties_data_curves.py b/release/scripts/startup/bl_ui/properties_data_curves.py index ff0eabeb7d9..df80bdb4552 100644 --- a/release/scripts/startup/bl_ui/properties_data_curves.py +++ b/release/scripts/startup/bl_ui/properties_data_curves.py @@ -44,7 +44,13 @@ class DATA_PT_curves_surface(DataButtonsPanel, Panel): layout.use_property_split = True layout.prop(ob.data, "surface") - layout.prop(ob.data, "surface_uv_map", text="UV Map") + has_surface = ob.data.surface is not None + if has_surface: + layout.prop_search(ob.data, "surface_uv_map", ob.data.surface.data, "uv_layers", text="UV Map") + else: + row = layout.row() + row.prop(ob.data, "surface_uv_map", text="UV Map") + row.enabled = has_surface class CURVES_MT_add_attribute(Menu): -- cgit v1.2.3 From 59a0b49c100b8444a15f4713409004eade9fd321 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Fri, 21 Oct 2022 20:10:17 -0600 Subject: Video rendering: FFMpeg AV1 codec encoding support Previously, the Blender video renderer did not have support for encoding video to AV1 (not to be confused with the container AVI). The proposed solution is to leverage the existing FFMpeg renderer to encode to AV1. Note that avcodec_find_encoder(AV_CODEC_ID_AV1) usually returns "libaom-av1" which is the "reference implementation" for AV1 encoding (the default for FFMpeg, and is slow). "libsvtav1" is faster and preferred so there is extra handling when fetching the AV1 codec for encoding such that "libsvtav1" is used when possible. This commit should only affect the options available for video rendering, which includes the additional AV1 codec to choose from, and setting "-crf". Also note that the current release of FFMpeg for ArchLinux does not support "-crf" for "libsvtav1", but the equivalent option "-qp" is supported and used as a fallback when "libsvtav1" is used (as mentioned here: https://trac.ffmpeg.org/wiki/Encode/AV1#SVT-AV1 ). (Actually, both "-crf" and "-qp" is specified with the same value in the code. When a release of FFMpeg obtains support for "-crf" for "libsvtav1" is released, the code shouldn't be needed to change.) The usage of the AV1 codec should be very similar to the usage of the H264 codec, but is limited to the "mp4" and "mkv" containers. This patch pertains to the "VFX & Video" module, as its main purpose is to supplement the Video Sequencer tool with the additional AV1 codec for encoded video output. Differential Revision: https://developer.blender.org/D14920 Reviewed By: sergey , ISS, zeddb --- release/scripts/startup/bl_ui/properties_output.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/properties_output.py b/release/scripts/startup/bl_ui/properties_output.py index ca0e698500e..61384f25afb 100644 --- a/release/scripts/startup/bl_ui/properties_output.py +++ b/release/scripts/startup/bl_ui/properties_output.py @@ -380,7 +380,14 @@ class RENDER_PT_encoding_video(RenderOutputButtonsPanel, Panel): layout = self.layout ffmpeg = context.scene.render.ffmpeg - needs_codec = ffmpeg.format in {'AVI', 'QUICKTIME', 'MKV', 'OGG', 'MPEG4', 'WEBM'} + needs_codec = ffmpeg.format in { + 'AVI', + 'QUICKTIME', + 'MKV', + 'OGG', + 'MPEG4', + 'WEBM' + } if needs_codec: layout.prop(ffmpeg, "codec") @@ -391,7 +398,12 @@ class RENDER_PT_encoding_video(RenderOutputButtonsPanel, Panel): layout.prop(ffmpeg, "use_lossless_output") # Output quality - use_crf = needs_codec and ffmpeg.codec in {'H264', 'MPEG4', 'WEBM'} + use_crf = needs_codec and ffmpeg.codec in { + 'H264', + 'MPEG4', + 'WEBM', + 'AV1' + } if use_crf: layout.prop(ffmpeg, "constant_rate_factor") -- cgit v1.2.3 From 2186d58d1c2711f722a811e6c2885045e485efa9 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 25 Oct 2022 11:51:04 +0200 Subject: Fix T102045: Properties Editor Attribute panels errors when pinning mesh When pinning a Mesh, we cannot rely on the context object. Instead, use the context mesh now. For vertexgroups names [which are still on the object API wise], this means name collisions cannot be checked when pinning a Mesh (so print this as a warning in that case) Maniphest Tasks: T102045 Differential Revision: https://developer.blender.org/D16333 --- release/scripts/startup/bl_ui/properties_data_mesh.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index a775a3cfa1b..a6b97fbdc85 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -586,7 +586,7 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel): def draw_attribute_warnings(self, context, layout): ob = context.object - mesh = ob.data + mesh = context.mesh unique_names = set() colliding_names = [] @@ -595,8 +595,11 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel): {"position": None, "shade_smooth": None, "normal": None, "crease": None}, mesh.attributes, mesh.uv_layers, - ob.vertex_groups, + None if ob is None else ob.vertex_groups, ): + if collection is None: + colliding_names.append("Cannot check for object vertex groups when pinning mesh") + continue for name in collection.keys(): unique_names_len = len(unique_names) unique_names.add(name) -- cgit v1.2.3 From cf985180551da833d4160afcdf2cb4292e138174 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 1 Nov 2022 16:09:49 +0100 Subject: Nodes: Add node group assets in add menu This patch builds on the work from bdb57541475f to add node group assets directly in the node editor add menu. Assets are added after separators to distinguish them, but otherwise they look like any other node. The catalog trees from all configured libraries are used to build the menu hierarchy. Only catalogs with matching asset types are used though. There are a few limitations of this initial version. For now this only supports geometry nodes. Support for other built-in node systems just requires some refactoring of the corresponding add menu though. Lazy loading will be added in a followup commit. For now there is a label the first time the menu is opened. Like the search menu integration, re-saving asset library files in 3.4 is required, if it hasn't been done already. Implementation wise, there is a some ugly code here. A lot of that is because the asset system isn't complete. The RNA API doesn't work well yet, and the system isn't built to interact with multiple libraries at once. It's also ugly because of the way we combine automatic menu generation with builtin menus. As noted in a code comment, these two systems could be merged completely so that the menus for builtin nodes are also generated in the same way. Differential Revision: https://developer.blender.org/D16135 --- release/scripts/startup/bl_ui/node_add_menu.py | 6 ++++++ .../startup/bl_ui/node_add_menu_geometry.py | 23 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/node_add_menu.py b/release/scripts/startup/bl_ui/node_add_menu.py index 31b84b8f08a..d393dc04963 100644 --- a/release/scripts/startup/bl_ui/node_add_menu.py +++ b/release/scripts/startup/bl_ui/node_add_menu.py @@ -58,6 +58,12 @@ def draw_node_group_add_menu(context, layout): ops.name = "node_tree" ops.value = "bpy.data.node_groups[%r]" % group.name +def draw_assets_for_catalog(layout, catalog_path): + layout.template_node_asset_menu_items(catalog_path=catalog_path) + +def draw_root_assets(layout): + layout.menu_contents("NODE_MT_node_add_root_catalogs") + classes = ( ) diff --git a/release/scripts/startup/bl_ui/node_add_menu_geometry.py b/release/scripts/startup/bl_ui/node_add_menu_geometry.py index e1b57ec4f43..c076cd7395a 100644 --- a/release/scripts/startup/bl_ui/node_add_menu_geometry.py +++ b/release/scripts/startup/bl_ui/node_add_menu_geometry.py @@ -16,6 +16,7 @@ class NODE_MT_geometry_node_GEO_ATTRIBUTE(Menu): node_add_menu.add_node_type(layout, "GeometryNodeAttributeDomainSize") node_add_menu.add_node_type(layout, "GeometryNodeRemoveAttribute") node_add_menu.add_node_type(layout, "GeometryNodeStoreNamedAttribute") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_GEO_COLOR(Menu): @@ -32,6 +33,7 @@ class NODE_MT_geometry_node_GEO_COLOR(Menu): ops.value = "'RGBA'" node_add_menu.add_node_type(layout, "ShaderNodeRGBCurve") node_add_menu.add_node_type(layout, "FunctionNodeSeparateColor") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_GEO_CURVE(Menu): @@ -70,6 +72,7 @@ class NODE_MT_geometry_node_GEO_CURVE(Menu): node_add_menu.add_node_type(layout, "GeometryNodeSetSplineCyclic") node_add_menu.add_node_type(layout, "GeometryNodeSetSplineResolution") node_add_menu.add_node_type(layout, "GeometryNodeCurveSplineType") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE(Menu): @@ -86,6 +89,7 @@ class NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE(Menu): node_add_menu.add_node_type(layout, "GeometryNodeCurveQuadraticBezier") node_add_menu.add_node_type(layout, "GeometryNodeCurvePrimitiveQuadrilateral") node_add_menu.add_node_type(layout, "GeometryNodeCurveStar") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_curve_topology(Menu): @@ -97,6 +101,7 @@ class NODE_MT_geometry_node_curve_topology(Menu): node_add_menu.add_node_type(layout, "GeometryNodeOffsetPointInCurve") node_add_menu.add_node_type(layout, "GeometryNodeCurveOfPoint") node_add_menu.add_node_type(layout, "GeometryNodePointsOfCurve") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_GEO_GEOMETRY(Menu): @@ -122,6 +127,7 @@ class NODE_MT_geometry_node_GEO_GEOMETRY(Menu): layout.separator() node_add_menu.add_node_type(layout, "GeometryNodeSetID") node_add_menu.add_node_type(layout, "GeometryNodeSetPosition") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_GEO_INPUT(Menu): @@ -149,6 +155,7 @@ class NODE_MT_geometry_node_GEO_INPUT(Menu): node_add_menu.add_node_type(layout, "GeometryNodeInputPosition") node_add_menu.add_node_type(layout, "GeometryNodeInputRadius") node_add_menu.add_node_type(layout, "GeometryNodeInputSceneTime") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_GEO_INSTANCE(Menu): @@ -166,6 +173,7 @@ class NODE_MT_geometry_node_GEO_INSTANCE(Menu): layout.separator() node_add_menu.add_node_type(layout, "GeometryNodeInputInstanceRotation") node_add_menu.add_node_type(layout, "GeometryNodeInputInstanceScale") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_GEO_MATERIAL(Menu): @@ -181,6 +189,7 @@ class NODE_MT_geometry_node_GEO_MATERIAL(Menu): layout.separator() node_add_menu.add_node_type(layout, "GeometryNodeSetMaterial") node_add_menu.add_node_type(layout, "GeometryNodeSetMaterialIndex") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_GEO_MESH(Menu): @@ -219,6 +228,7 @@ class NODE_MT_geometry_node_GEO_MESH(Menu): node_add_menu.add_node_type(layout, "GeometryNodeInputMeshVertexNeighbors") layout.separator() node_add_menu.add_node_type(layout, "GeometryNodeSetShadeSmooth") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_PRIMITIVES_MESH(Menu): @@ -235,6 +245,7 @@ class NODE_MT_category_PRIMITIVES_MESH(Menu): node_add_menu.add_node_type(layout, "GeometryNodeMeshCircle") node_add_menu.add_node_type(layout, "GeometryNodeMeshLine") node_add_menu.add_node_type(layout, "GeometryNodeMeshUVSphere") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_mesh_topology(Menu): @@ -250,6 +261,7 @@ class NODE_MT_geometry_node_mesh_topology(Menu): node_add_menu.add_node_type(layout, "GeometryNodeFaceOfCorner"), node_add_menu.add_node_type(layout, "GeometryNodeOffsetCornerInFace"), node_add_menu.add_node_type(layout, "GeometryNodeVertexOfCorner"), + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_GEO_OUTPUT(Menu): @@ -259,6 +271,7 @@ class NODE_MT_category_GEO_OUTPUT(Menu): def draw(self, _context): layout = self.layout node_add_menu.add_node_type(layout, "GeometryNodeViewer") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_GEO_POINT(Menu): @@ -274,6 +287,7 @@ class NODE_MT_category_GEO_POINT(Menu): node_add_menu.add_node_type(layout, "GeometryNodePointsToVolume") layout.separator() node_add_menu.add_node_type(layout, "GeometryNodeSetPointRadius") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_GEO_TEXT(Menu): @@ -290,6 +304,7 @@ class NODE_MT_category_GEO_TEXT(Menu): node_add_menu.add_node_type(layout, "FunctionNodeValueToString") layout.separator() node_add_menu.add_node_type(layout, "FunctionNodeInputSpecialCharacters") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_GEO_TEXTURE(Menu): @@ -308,6 +323,7 @@ class NODE_MT_category_GEO_TEXTURE(Menu): node_add_menu.add_node_type(layout, "ShaderNodeTexVoronoi") node_add_menu.add_node_type(layout, "ShaderNodeTexWave") node_add_menu.add_node_type(layout, "ShaderNodeTexWhiteNoise") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_GEO_UTILITIES(Menu): @@ -331,6 +347,7 @@ class NODE_MT_category_GEO_UTILITIES(Menu): node_add_menu.add_node_type(layout, "FunctionNodeRandomValue") node_add_menu.add_node_type(layout, "FunctionNodeRotateEuler") node_add_menu.add_node_type(layout, "GeometryNodeSwitch") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_GEO_UV(Menu): @@ -341,6 +358,7 @@ class NODE_MT_category_GEO_UV(Menu): layout = self.layout node_add_menu.add_node_type(layout, "GeometryNodeUVPackIslands") node_add_menu.add_node_type(layout, "GeometryNodeUVUnwrap") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_GEO_VECTOR(Menu): @@ -354,6 +372,7 @@ class NODE_MT_category_GEO_VECTOR(Menu): node_add_menu.add_node_type(layout, "ShaderNodeVectorCurve") node_add_menu.add_node_type(layout, "ShaderNodeVectorMath") node_add_menu.add_node_type(layout, "ShaderNodeVectorRotate") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_GEO_VOLUME(Menu): @@ -364,6 +383,7 @@ class NODE_MT_category_GEO_VOLUME(Menu): layout = self.layout node_add_menu.add_node_type(layout, "GeometryNodeVolumeCube") node_add_menu.add_node_type(layout, "GeometryNodeVolumeToMesh") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_GEO_GROUP(Menu): @@ -373,6 +393,7 @@ class NODE_MT_category_GEO_GROUP(Menu): def draw(self, context): layout = self.layout node_add_menu.draw_node_group_add_menu(context, layout) + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_category_GEO_LAYOUT(Menu): @@ -383,6 +404,7 @@ class NODE_MT_category_GEO_LAYOUT(Menu): layout = self.layout node_add_menu.add_node_type(layout, "NodeFrame") node_add_menu.add_node_type(layout, "NodeReroute") + node_add_menu.draw_assets_for_catalog(layout, self.bl_label) class NODE_MT_geometry_node_add_all(Menu): @@ -413,6 +435,7 @@ class NODE_MT_geometry_node_add_all(Menu): layout.menu("NODE_MT_category_GEO_VOLUME") layout.menu("NODE_MT_category_GEO_GROUP") layout.menu("NODE_MT_category_GEO_LAYOUT") + node_add_menu.draw_root_assets(layout) classes = ( -- cgit v1.2.3 From 5a90bbf71675651bd74cef435c0724e5b07a544c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 2 Nov 2022 10:18:40 +1100 Subject: Cleanup: format --- release/scripts/startup/bl_ui/node_add_menu.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/node_add_menu.py b/release/scripts/startup/bl_ui/node_add_menu.py index d393dc04963..873dbd533a5 100644 --- a/release/scripts/startup/bl_ui/node_add_menu.py +++ b/release/scripts/startup/bl_ui/node_add_menu.py @@ -58,9 +58,11 @@ def draw_node_group_add_menu(context, layout): ops.name = "node_tree" ops.value = "bpy.data.node_groups[%r]" % group.name + def draw_assets_for_catalog(layout, catalog_path): layout.template_node_asset_menu_items(catalog_path=catalog_path) + def draw_root_assets(layout): layout.menu_contents("NODE_MT_node_add_root_catalogs") -- cgit v1.2.3