First implementation of node previews in the shader node editor. Using the same user interface as compositor node previews, most shader nodes can now be previewed (except group in/output and material output). This is currently still an experimental feature, as polishing of the user experience and performance improvements are planned. These will be easier to do as incremental changes on this implementation. See #110353 for details on the work that remains to be done and known limitations. Implementation notes: We take advantage of the `RenderResult` available as `ImBuf` images to store a `Render` for every viewed nested node tree present in a `SpaceNode`. The computation is initiated at the moment of drawing nodes overlays. One render is started for the current nodetree, having a `ViewLayer` associated with each previewed node. We separate the previewed nodes in two categories: the shader ones and the non-shader ones. - For non-shader nodes, we use AOVs which highly speed up the rendering process by rendering every non-shader nodes at the same time. They are rendered in the first `ViewLayer`. - For shader nodes, we render them each in a different `ViewLayer`, by rerouting the node to the output of the material in the preview scene. The preview scene takes the same aspect as the Material preview scene, and the same preview object is used. At the moment of drawing the node overlay, we take the `Render` of the viewed node tree and extract the `ImBuf` of the wanted viewlayer/pass for each previewed node. Pull Request: https://projects.blender.org/blender/blender/pulls/110065
95 lines
1.7 KiB
CMake
95 lines
1.7 KiB
CMake
# SPDX-FileCopyrightText: 2023 Blender Foundation
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
set(INC
|
|
../include
|
|
../../asset_system
|
|
../../blenfont
|
|
../../blenkernel
|
|
../../blenloader
|
|
../../blentranslation
|
|
../../compositor
|
|
../../depsgraph
|
|
../../draw
|
|
../../functions
|
|
../../geometry
|
|
../../gpu
|
|
../../imbuf
|
|
../../makesrna
|
|
../../nodes
|
|
../../render
|
|
../../windowmanager
|
|
../../../../extern/fmtlib/include
|
|
|
|
# RNA_prototypes.h
|
|
${CMAKE_BINARY_DIR}/source/blender/makesrna
|
|
)
|
|
|
|
|
|
set(SRC
|
|
add_menu_assets.cc
|
|
add_node_search.cc
|
|
clipboard.cc
|
|
drawnode.cc
|
|
link_drag_search.cc
|
|
node_add.cc
|
|
node_context_path.cc
|
|
node_draw.cc
|
|
node_edit.cc
|
|
node_geometry_attribute_search.cc
|
|
node_gizmo.cc
|
|
node_group.cc
|
|
node_ops.cc
|
|
node_relationships.cc
|
|
node_select.cc
|
|
node_shader_preview.cc
|
|
node_templates.cc
|
|
node_view.cc
|
|
space_node.cc
|
|
|
|
node_intern.hh
|
|
)
|
|
|
|
set(LIB
|
|
bf_blenkernel
|
|
PRIVATE bf::blenlib
|
|
PRIVATE bf::dna
|
|
bf_editor_screen
|
|
PRIVATE bf::intern::guardedalloc
|
|
extern_fmtlib
|
|
)
|
|
|
|
if(WITH_COMPOSITOR_CPU)
|
|
add_definitions(-DWITH_COMPOSITOR_CPU)
|
|
endif()
|
|
|
|
if(WITH_OPENIMAGEDENOISE)
|
|
add_definitions(-DWITH_OPENIMAGEDENOISE)
|
|
endif()
|
|
|
|
if(WITH_OPENSUBDIV)
|
|
add_definitions(-DWITH_OPENSUBDIV)
|
|
endif()
|
|
|
|
if(WITH_TBB)
|
|
add_definitions(-DWITH_TBB)
|
|
if(WIN32)
|
|
# TBB includes Windows.h which will define min/max macros
|
|
# that will collide with the stl versions.
|
|
add_definitions(-DNOMINMAX)
|
|
endif()
|
|
list(APPEND INC_SYS
|
|
${TBB_INCLUDE_DIRS}
|
|
)
|
|
|
|
list(APPEND LIB
|
|
${TBB_LIBRARIES}
|
|
)
|
|
endif()
|
|
|
|
blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
|
|
|
# RNA_prototypes.h dna_type_offsets.h
|
|
add_dependencies(bf_editor_space_node bf_rna)
|