Blender  V3.3
Classes | Functions | Variables
FRS_freestyle.cpp File Reference
#include <iostream>
#include <map>
#include <set>
#include "../application/AppCanvas.h"
#include "../application/AppConfig.h"
#include "../application/AppView.h"
#include "../application/Controller.h"
#include "BlenderStrokeRenderer.h"
#include "MEM_guardedalloc.h"
#include "DNA_camera_types.h"
#include "DNA_collection_types.h"
#include "DNA_freestyle_types.h"
#include "DNA_material_types.h"
#include "DNA_text_types.h"
#include "BKE_callbacks.h"
#include "BKE_context.h"
#include "BKE_freestyle.h"
#include "BKE_global.h"
#include "BKE_lib_id.h"
#include "BKE_linestyle.h"
#include "BKE_scene.h"
#include "BKE_text.h"
#include "BLT_translation.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_math_color_blend.h"
#include "BPY_extern.h"
#include "DEG_depsgraph_query.h"
#include "pipeline.h"
#include "FRS_freestyle.h"

Go to the source code of this file.

Classes

struct  edge_type_condition
 

Functions

static void load_post_callback (struct Main *, struct PointerRNA **, const int, void *)
 
void FRS_init ()
 
void FRS_set_context (bContext *C)
 
void FRS_exit ()
 
static void init_view (Render *re)
 
static char * escape_quotes (char *name)
 
static char * create_lineset_handler (char *layer_name, char *lineset_name)
 
static bool test_edge_type_conditions (struct edge_type_condition *conditions, int num_edge_types, bool logical_and, int target, bool distinct)
 
static void prepare (Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
 
void FRS_composite_result (Render *re, ViewLayer *view_layer, Render *freestyle_render)
 
static int displayed_layer_count (ViewLayer *view_layer)
 
int FRS_is_freestyle_enabled (ViewLayer *view_layer)
 
void FRS_init_stroke_renderer (Render *re)
 
void FRS_begin_stroke_rendering (Render *UNUSED(re))
 
void FRS_do_stroke_rendering (Render *re, ViewLayer *view_layer)
 
void FRS_end_stroke_rendering (Render *)
 
void FRS_free_view_map_cache (void)
 
void FRS_copy_active_lineset (FreestyleConfig *config)
 
void FRS_paste_active_lineset (FreestyleConfig *config)
 
void FRS_delete_active_lineset (FreestyleConfig *config)
 
bool FRS_move_active_lineset (FreestyleConfig *config, int direction)
 
MaterialFRS_create_stroke_material (Main *bmain, struct FreestyleLineStyle *linestyle)
 

Variables

struct FreestyleGlobals g_freestyle
 
static bool freestyle_is_initialized = false
 
static Config::Pathpathconfig = nullptr
 
static Controllercontroller = nullptr
 
static AppViewview = nullptr
 
static FreestyleLineSet lineset_buffer
 
static bool lineset_copied = false
 
static bCallbackFuncStore load_post_callback_funcstore
 

Function Documentation

◆ create_lineset_handler()

static char* create_lineset_handler ( char *  layer_name,
char *  lineset_name 
)
static

Definition at line 178 of file FRS_freestyle.cpp.

References BLI_sprintfN(), escape_quotes(), and MEM_freeN.

Referenced by prepare().

◆ displayed_layer_count()

static int displayed_layer_count ( ViewLayer view_layer)
static

◆ escape_quotes()

static char* escape_quotes ( char *  name)
static

Definition at line 164 of file FRS_freestyle.cpp.

References MEM_mallocN.

Referenced by create_lineset_handler().

◆ FRS_begin_stroke_rendering()

void FRS_begin_stroke_rendering ( Render UNUSEDre)

Definition at line 599 of file FRS_freestyle.cpp.

◆ FRS_composite_result()

void FRS_composite_result ( Render re,
ViewLayer view_layer,
Render freestyle_render 
)

◆ FRS_copy_active_lineset()

void FRS_copy_active_lineset ( FreestyleConfig config)

◆ FRS_create_stroke_material()

Material* FRS_create_stroke_material ( Main bmain,
struct FreestyleLineStyle linestyle 
)

◆ FRS_delete_active_lineset()

void FRS_delete_active_lineset ( FreestyleConfig config)

◆ FRS_do_stroke_rendering()

void FRS_do_stroke_rendering ( Render re,
ViewLayer view_layer 
)

◆ FRS_end_stroke_rendering()

void FRS_end_stroke_rendering ( Render re)

Definition at line 672 of file FRS_freestyle.cpp.

References Freestyle::Controller::Clear(), and controller.

◆ FRS_exit()

void FRS_exit ( void  )

Definition at line 113 of file FRS_freestyle.cpp.

References controller, pathconfig, and view.

Referenced by RE_FreeAllRender().

◆ FRS_free_view_map_cache()

void FRS_free_view_map_cache ( void  )

◆ FRS_init()

void FRS_init ( void  )

◆ FRS_init_stroke_renderer()

void FRS_init_stroke_renderer ( Render re)

◆ FRS_is_freestyle_enabled()

int FRS_is_freestyle_enabled ( ViewLayer view_layer)

◆ FRS_move_active_lineset()

bool FRS_move_active_lineset ( struct FreestyleConfig config,
int  direction 
)

Reinsert the active lineset at an offset direction from current position.

Returns
if position of active lineset has changed.

Definition at line 758 of file FRS_freestyle.cpp.

References BKE_freestyle_lineset_get_active(), BLI_listbase_link_move(), and FreestyleConfig::linesets.

◆ FRS_paste_active_lineset()

void FRS_paste_active_lineset ( FreestyleConfig config)

◆ FRS_set_context()

void FRS_set_context ( bContext C)

Definition at line 105 of file FRS_freestyle.cpp.

References C, controller, CTX_data_scene(), G, G_DEBUG_FREESTYLE, and Freestyle::Controller::setContext().

Referenced by main().

◆ init_view()

static void init_view ( Render re)
static

◆ load_post_callback()

static void load_post_callback ( struct Main ,
struct PointerRNA **  ,
const int  ,
void  
)
static

Definition at line 66 of file FRS_freestyle.cpp.

References lineset_copied.

◆ prepare()

static void prepare ( Render re,
ViewLayer view_layer,
Depsgraph depsgraph 
)
static

Definition at line 275 of file FRS_freestyle.cpp.

References ARRAY_SIZE, buffer, Freestyle::Controller::ComputeViewMap(), controller, FreestyleConfig::crease_angle, create_lineset_handler(), depsgraph, FreestyleConfig::dkr_epsilon, edge_type_condition::edge_type, ListBase::first, FreestyleConfig::flags, FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE, FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE, ViewLayer::freestyle_config, FREESTYLE_CONTROL_EDITOR_MODE, FREESTYLE_CONTROL_SCRIPT_MODE, FREESTYLE_CULLING, FREESTYLE_FACE_SMOOTHNESS_FLAG, FREESTYLE_FE_BORDER, FREESTYLE_FE_CONTOUR, FREESTYLE_FE_CREASE, FREESTYLE_FE_EDGE_MARK, FREESTYLE_FE_EXTERNAL_CONTOUR, FREESTYLE_FE_MATERIAL_BOUNDARY, FREESTYLE_FE_RIDGE_VALLEY, FREESTYLE_FE_SILHOUETTE, FREESTYLE_FE_SUGGESTIVE_CONTOUR, FREESTYLE_LINESET_ENABLED, FREESTYLE_LINESET_FE_AND, FREESTYLE_LINESET_FE_NOT, FREESTYLE_MATERIAL_BOUNDARIES_FLAG, FREESTYLE_RIDGES_AND_VALLEYS_FLAG, FREESTYLE_SEL_EDGE_TYPES, FREESTYLE_SUGGESTIVE_CONTOURS_FLAG, G, G_DEBUG_FREESTYLE, Freestyle::Controller::getComputeMaterialBoundariesFlag(), Freestyle::Controller::getComputeRidgesAndValleysFlag(), Freestyle::Controller::getComputeSuggestiveContoursFlag(), Freestyle::Controller::getCreaseAngle(), Freestyle::Controller::getFaceSmoothness(), Freestyle::Controller::getSphereRadius(), Freestyle::Controller::getSuggestiveContourKrDerivativeEpsilon(), Freestyle::Controller::hitViewMapCache(), Render::i, id_name(), RenderStats::infostr, Freestyle::Controller::InsertStyleModule(), FreestyleConfig::linesets, Freestyle::Controller::LoadMesh(), MEM_freeN, FreestyleConfig::mode, FreestyleConfig::modules, ViewLayer::name, RenderLayer::passes, RAD2DEGF, RE_GetRenderLayer(), RE_PASSNAME_DIFFUSE_COLOR, RE_PASSNAME_Z, Render::result, Render::sdh, Freestyle::Controller::setComputeMaterialBoundariesFlag(), Freestyle::Controller::setComputeRidgesAndValleysFlag(), Freestyle::Controller::setComputeSuggestiveContoursFlag(), Freestyle::Controller::setCreaseAngle(), Freestyle::Controller::setFaceSmoothness(), Freestyle::Controller::setPassDiffuse(), Freestyle::Controller::setPassZ(), Freestyle::Controller::setSphereRadius(), Freestyle::Controller::setSuggestiveContourKrDerivativeEpsilon(), Freestyle::Controller::setVisibilityAlgo(), FreestyleConfig::sphere_radius, Render::stats_draw, STREQ, Render::tbh, Render::test_break, test_edge_type_conditions(), TIP_, Freestyle::Controller::toggleLayer(), edge_type_condition::value, and z.

Referenced by FRS_do_stroke_rendering(), and register_closure().

◆ test_edge_type_conditions()

static bool test_edge_type_conditions ( struct edge_type_condition conditions,
int  num_edge_types,
bool  logical_and,
int  target,
bool  distinct 
)
static

Definition at line 194 of file FRS_freestyle.cpp.

References edge_type_condition::value.

Referenced by prepare().

Variable Documentation

◆ controller

Controller* controller = nullptr
static

◆ freestyle_is_initialized

bool freestyle_is_initialized = false
static

Definition at line 57 of file FRS_freestyle.cpp.

Referenced by FRS_init().

◆ g_freestyle

struct FreestyleGlobals g_freestyle

◆ lineset_buffer

FreestyleLineSet lineset_buffer
static

Definition at line 63 of file FRS_freestyle.cpp.

Referenced by FRS_copy_active_lineset(), and FRS_paste_active_lineset().

◆ lineset_copied

bool lineset_copied = false
static

◆ load_post_callback_funcstore

bCallbackFuncStore load_post_callback_funcstore
static
Initial value:
= {
nullptr,
nullptr,
nullptr,
0
}
static void load_post_callback(struct Main *, struct PointerRNA **, const int, void *)

Definition at line 74 of file FRS_freestyle.cpp.

Referenced by FRS_init().

◆ pathconfig

Config::Path* pathconfig = nullptr
static

Definition at line 58 of file FRS_freestyle.cpp.

Referenced by FRS_exit(), and FRS_init().

◆ view

AppView* view = nullptr
static

Definition at line 60 of file FRS_freestyle.cpp.

Referenced by blender::eevee::Film::accumulate(), blender::ui::AbstractViewItem::add_rename_button(), axis_set_view(), blender::ui::AbstractViewItem::begin_renaming(), BKE_image_is_multiview(), BKE_image_memorypack(), BKE_image_packfiles(), BKE_image_render_write_exr(), BKE_scene_disable_color_management(), blender_camera_view_subset(), blo_do_versions_300(), BPy_IDArray_getbuffer(), BPy_IDArray_releasebuffer(), blender::ui::ViewItemAPIWrapper::can_rename(), colormanage_check_view_settings(), colormanage_load_config(), colormanage_view_add(), colormanage_view_get_named(), colormanage_view_get_named_for_display(), colormanage_view_settings_to_cache(), colormanagement_view_item_add(), blender::compositor::ImageNode::convert_to_operations(), draw_armature_pose(), draw_call_is_culled(), draw_compute_culling(), DRW_culling_box_test(), DRW_culling_frustum_corners_get(), DRW_culling_frustum_planes_get(), DRW_culling_min_max_test(), DRW_culling_plane_test(), DRW_culling_sphere_test(), drw_manager_init(), DRW_notify_view_update(), drw_notify_view_update_offscreen(), DRW_view_camtexco_get(), DRW_view_camtexco_set(), DRW_view_clip_planes_set(), DRW_view_create(), DRW_view_create_sub(), DRW_view_default_set(), DRW_view_far_distance_get(), DRW_view_frustum_corners_get(), DRW_view_frustum_planes_get(), DRW_view_is_persp_get(), DRW_view_near_distance_get(), DRW_view_persmat_get(), DRW_view_set_active(), DRW_view_update(), DRW_view_update_sub(), DRW_view_viewmat_get(), DRW_view_winmat_get(), ED_view3d_axis_view_opposite(), ED_view3d_quat_from_axis_view(), ED_view3d_quat_to_axis_view(), eevee_ensure_cascade_views(), eevee_ensure_cube_views(), eevee_lightbake_cache_create(), EEVEE_render_view_sync(), EEVEE_shadows_draw(), EEVEE_shadows_draw_cascades(), blender::ui::AbstractViewItem::end_renaming(), blender::draw::Texture::ensure_layer_views(), blender::draw::Texture::ensure_mip_views(), exr_print_filecontents(), external_image_space_matrix_set(), blender::ui::find_item_from_rename_button(), blender::draw::Texture::free(), FRS_exit(), FRS_init(), get_display_colorspace_name(), blender::compositor::MultilayerBaseOperation::get_im_buf(), getGPUDisplayShader(), GHOST_WindowCocoa::getValid(), GHOST_WindowCocoa::GHOST_WindowCocoa(), ghost_xr_draw_view_info_from_view(), GPENCIL_render_init(), GPU_matrix_project_2fv(), GPU_matrix_project_3fv(), GPU_matrix_unproject_3fv(), GPU_texture_create_view(), GPU_viewport_bind(), GPU_viewport_color_texture(), gpu_viewport_draw_colormanaged(), GPU_viewport_draw_to_screen(), GPU_viewport_draw_to_screen_ex(), GPU_viewport_overlay_texture(), GPU_viewport_unbind_from_offscreen(), image_memorypack_imbuf(), image_render_pass_get(), image_save_single(), imapaint_pick_uv(), imapaint_tri_weights(), IMB_colormanagement_setup_glsl_draw_from_space(), IMB_colormanagement_validate_settings(), IMB_colormanagement_view_get_default_name(), IMB_colormanagement_view_get_indexed_name(), IMB_colormanagement_view_get_named_index(), IMB_colormanagement_view_items_add(), imb_exr_get_views(), imb_exr_multilayer_parse_channels_from_file(), IMB_exrtile_write_channels(), init_view(), GHOST_WindowCocoa::invalidate(), lineart_main_load_geometries(), lineart_main_try_generate_shadow(), ml_addpass_cb(), MOD_lineart_chain_offset_towards_camera(), blender::compositor::MultilayerBaseOperation::MultilayerBaseOperation(), NODE_DEFINE(), OCIO_configGetDisplayColorSpaceName(), OCIO_createDisplayProcessor(), OCIO_gpuDisplayShaderBind(), parse_channel_name(), pchan_culling_test_bbone(), pchan_culling_test_custom(), pchan_culling_test_envelope(), pchan_culling_test_line(), pchan_culling_test_octohedral(), pchan_culling_test_simple(), pchan_culling_test_wire(), pchan_culling_test_with_radius_scale(), point_is_visible(), project_brush_radius(), pygpu_buffer__bf_getbuffer(), pygpu_buffer__bf_releasebuffer(), RE_create_render_pass(), region_quadview_init_rv3d(), blender::ui::AbstractViewItem::rename_apply(), blender::eevee::ForwardPipeline::render(), render_result_new(), sequencer_ibuf_get(), GHOST_WindowCocoa::setNativePixelSize(), blender::tests::TEST(), ui_block_add_view_impl(), ui_block_view_find_idname(), wm_draw_region_bind(), wm_draw_region_blend(), wm_draw_region_blit(), wm_draw_region_texture(), wm_draw_window(), wm_draw_window_offscreen(), wm_draw_window_onscreen(), wm_stereo3d_draw_sidebyside(), wm_stereo3d_draw_topbottom(), and workbench_render_matrices_init().