Blender V4.5
FRS_freestyle.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <iostream>
10
14
16
17using namespace std;
18using namespace Freestyle;
19
20#include "MEM_guardedalloc.h"
21
22#include "CLG_log.h"
23
25#include "DNA_freestyle_types.h"
26#include "DNA_material_types.h"
27#include "DNA_text_types.h"
28
29#include "BKE_callbacks.hh"
30#include "BKE_context.hh"
31#include "BKE_freestyle.h"
32#include "BKE_global.hh"
33#include "BKE_lib_id.hh"
34#include "BKE_linestyle.h"
35#include "BKE_scene.hh"
36#include "BKE_text.h"
37
38#include "BLT_translation.hh"
39
40#include "BLI_listbase.h"
42#include "BLI_math_matrix.h"
43#include "BLI_math_rotation.h"
44#include "BLI_string.h"
45
46#include "BPY_extern.hh"
47
49
50#include "IMB_imbuf.hh"
51
52#include "pipeline.hh"
53
54#include "FRS_freestyle.h"
55
57
58static CLG_LogRef LOG = {"render.freestyle"};
59
60// Freestyle configuration
61static bool freestyle_is_initialized = false;
62static Config::Path *pathconfig = nullptr;
63static Controller *controller = nullptr;
64static AppView *view = nullptr;
65
66// line set buffer for copy & paste
68static bool lineset_copied = false;
69
70static void load_post_callback(Main * /*main*/,
71 PointerRNA ** /*pointers*/,
72 const int /*num_pointers*/,
73 void * /*arg*/)
74{
75 lineset_copied = false;
76}
77
79 /*next*/ nullptr,
80 /*prev*/ nullptr,
81 /*func*/ load_post_callback,
82 /*arg*/ nullptr,
83 /*alloc*/ 0};
84
85//=======================================================
86// Initialization
87//=======================================================
88
90{
92 return;
93 }
94
96 controller = new Controller();
97 view = new AppView;
100 g_freestyle.scene = nullptr;
101 lineset_copied = false;
102
104
106}
107
109{
110 if (G.debug & G_DEBUG_FREESTYLE) {
111 cout << "FRS_set_context: context 0x" << C << " scene 0x" << CTX_data_scene(C) << endl;
112 }
114}
115
117{
118 delete pathconfig;
119 delete controller;
120 delete view;
121}
122
123//=======================================================
124// Rendering
125//=======================================================
126
127static void init_view(Render *re)
128{
129 int width = re->winx;
130 int height = re->winy;
131 int xmin = re->disprect.xmin;
132 int ymin = re->disprect.ymin;
133 int xmax = re->disprect.xmax;
134 int ymax = re->disprect.ymax;
135
136 float thickness = 1.0f;
137 switch (re->scene->r.line_thickness_mode) {
139 thickness = re->scene->r.unit_line_thickness * (re->r.size / 100.0f);
140 break;
142 thickness = height / 480.0f;
143 break;
144 }
145
147 g_freestyle.viewport[2] = width;
148 g_freestyle.viewport[3] = height;
149
150 view->setWidth(width);
151 view->setHeight(height);
152 view->setBorder(xmin, ymin, xmax, ymax);
153 view->setThickness(thickness);
154
155 if (G.debug & G_DEBUG_FREESTYLE) {
156 cout << "\n=== Dimensions of the 2D image coordinate system ===" << endl;
157 cout << "Width : " << width << endl;
158 cout << "Height : " << height << endl;
159 if (re->r.mode & R_BORDER) {
160 cout << "Border : (" << xmin << ", " << ymin << ") - (" << xmax << ", " << ymax << ")"
161 << endl;
162 }
163 cout << "Unit line thickness : " << thickness << " pixel(s)" << endl;
164 }
165}
166
167static char *escape_quotes(char *name)
168{
169 char *s = MEM_malloc_arrayN<char>(strlen(name) * 2 + 1, "escape_quotes");
170 char *p = s;
171 while (*name) {
172 /* Escape backslashes too, a trailing one would otherwise end the string literal. */
173 if (ELEM(*name, '\'', '\\')) {
174 *(p++) = '\\';
175 }
176 *(p++) = *(name++);
177 }
178 *p = '\0';
179 return s;
180}
181
182static char *create_lineset_handler(char *layer_name, char *lineset_name)
183{
184 const char *fmt = "__import__('parameter_editor').process('%s', '%s')\n";
185 char *s1 = escape_quotes(layer_name);
186 char *s2 = escape_quotes(lineset_name);
187 char *text = BLI_sprintfN(fmt, s1, s2);
188 MEM_freeN(s1);
189 MEM_freeN(s2);
190 return text;
191}
192
196
197// examines the conditions and returns true if the target edge type needs to be computed
199 int num_edge_types,
200 bool logical_and,
201 int target,
202 bool distinct)
203{
204 int target_condition = 0;
205 int num_non_target_positive_conditions = 0;
206 int num_non_target_negative_conditions = 0;
207
208 for (int i = 0; i < num_edge_types; i++) {
209 if (conditions[i].edge_type == target) {
210 target_condition = conditions[i].value;
211 }
212 else if (conditions[i].value > 0) {
213 ++num_non_target_positive_conditions;
214 }
215 else if (conditions[i].value < 0) {
216 ++num_non_target_negative_conditions;
217 }
218 }
219 if (distinct) {
220 // In this case, the 'target' edge type is assumed to appear on distinct edge
221 // of its own and never together with other edge types.
222 if (logical_and) {
223 if (num_non_target_positive_conditions > 0) {
224 return false;
225 }
226 if (target_condition > 0) {
227 return true;
228 }
229 if (target_condition < 0) {
230 return false;
231 }
232 if (num_non_target_negative_conditions > 0) {
233 return true;
234 }
235 }
236 else {
237 if (target_condition > 0) {
238 return true;
239 }
240 if (num_non_target_negative_conditions > 0) {
241 return true;
242 }
243 if (target_condition < 0) {
244 return false;
245 }
246 if (num_non_target_positive_conditions > 0) {
247 return false;
248 }
249 }
250 }
251 else {
252 // In this case, the 'target' edge type may appear together with other edge types.
253 if (target_condition > 0) {
254 return true;
255 }
256 if (target_condition < 0) {
257 return true;
258 }
259 if (logical_and) {
260 if (num_non_target_positive_conditions > 0) {
261 return false;
262 }
263 if (num_non_target_negative_conditions > 0) {
264 return true;
265 }
266 }
267 else {
268 if (num_non_target_negative_conditions > 0) {
269 return true;
270 }
271 if (num_non_target_positive_conditions > 0) {
272 return false;
273 }
274 }
275 }
276 return true;
277}
278
279static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
280{
281 // load mesh
282 re->i.infostr = RPT_("Freestyle: Mesh loading");
283 re->stats_draw(&re->i);
284 re->i.infostr = nullptr;
285 if (controller->LoadMesh(re, view_layer, depsgraph)) {
286 /* Returns if scene cannot be loaded or if empty. */
287 return;
288 }
289 if (re->test_break()) {
290 return;
291 }
292
293 // add style modules
294 FreestyleConfig *config = &view_layer->freestyle_config;
295
296 if (G.debug & G_DEBUG_FREESTYLE) {
297 cout << "\n=== Rendering options ===" << endl;
298 }
299 int layer_count = 0;
300
301 switch (config->mode) {
303 if (G.debug & G_DEBUG_FREESTYLE) {
304 cout << "Modules :" << endl;
305 }
306 LISTBASE_FOREACH (FreestyleModuleConfig *, module_conf, &config->modules) {
307 if (module_conf->script && module_conf->is_displayed) {
308 const char *id_name = module_conf->script->id.name + 2;
309
310 /* Style modules are Python scripts, skip them if auto-run is disabled. */
311 if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) {
314 SNPRINTF(G.autoexec_fail, RPT_("Freestyle style module '%s'"), id_name);
315 }
316 CLOG_WARN(&LOG, "Scripts disabled, skipping style module '%s'", id_name);
317 continue;
318 }
319
320 if (G.debug & G_DEBUG_FREESTYLE) {
321 cout << " " << layer_count + 1 << ": " << id_name;
322 if (module_conf->script->filepath) {
323 cout << " (" << module_conf->script->filepath << ")";
324 }
325 cout << endl;
326 }
327 controller->InsertStyleModule(layer_count, id_name, module_conf->script);
328 controller->toggleLayer(layer_count, true);
329 layer_count++;
330 }
331 }
332 if (G.debug & G_DEBUG_FREESTYLE) {
333 cout << endl;
334 }
336 (config->flags & FREESTYLE_RIDGES_AND_VALLEYS_FLAG) ? true : false);
338 (config->flags & FREESTYLE_SUGGESTIVE_CONTOURS_FLAG) ? true : false);
340 (config->flags & FREESTYLE_MATERIAL_BOUNDARIES_FLAG) ? true : false);
341 break;
343 int use_ridges_and_valleys = 0;
344 int use_suggestive_contours = 0;
345 int use_material_boundaries = 0;
346 edge_type_condition conditions[] = {
356 };
357 int num_edge_types = ARRAY_SIZE(conditions);
358 if (G.debug & G_DEBUG_FREESTYLE) {
359 cout << "Linesets:" << endl;
360 }
361 LISTBASE_FOREACH (FreestyleLineSet *, lineset, &config->linesets) {
362 if (lineset->flags & FREESTYLE_LINESET_ENABLED) {
363 if (G.debug & G_DEBUG_FREESTYLE) {
364 cout << " " << layer_count + 1 << ": " << lineset->name << " - "
365 << (lineset->linestyle ? (lineset->linestyle->id.name + 2) : "<null>") << endl;
366 }
367 char *buffer = create_lineset_handler(view_layer->name, lineset->name);
368 controller->InsertStyleModule(layer_count, lineset->name, buffer);
369 controller->toggleLayer(layer_count, true);
370 MEM_freeN(buffer);
371 if (!(lineset->selection & FREESTYLE_SEL_EDGE_TYPES) || !lineset->edge_types) {
372 ++use_ridges_and_valleys;
373 ++use_suggestive_contours;
374 ++use_material_boundaries;
375 }
376 else {
377 // conditions for feature edge selection by edge types
378 for (int i = 0; i < num_edge_types; i++) {
379 if (!(lineset->edge_types & conditions[i].edge_type)) {
380 conditions[i].value = 0; // no condition specified
381 }
382 else if (!(lineset->exclude_edge_types & conditions[i].edge_type)) {
383 conditions[i].value = 1; // condition: X
384 }
385 else {
386 conditions[i].value = -1; // condition: NOT X
387 }
388 }
389 // logical operator for the selection conditions
390 bool logical_and = ((lineset->flags & FREESTYLE_LINESET_FE_AND) != 0);
391 // negation operator
392 if (lineset->flags & FREESTYLE_LINESET_FE_NOT) {
393 // convert an Exclusive condition into an
394 // Inclusive equivalent using De Morgan's laws:
395 // - NOT (X OR Y) --> (NOT X) AND (NOT Y)
396 // - NOT (X AND Y) --> (NOT X) OR (NOT Y)
397 for (int i = 0; i < num_edge_types; i++) {
398 conditions[i].value *= -1;
399 }
400 logical_and = !logical_and;
401 }
403 conditions, num_edge_types, logical_and, FREESTYLE_FE_RIDGE_VALLEY, true))
404 {
405 ++use_ridges_and_valleys;
406 }
407 if (test_edge_type_conditions(conditions,
408 num_edge_types,
409 logical_and,
411 true))
412 {
413 ++use_suggestive_contours;
414 }
416 conditions, num_edge_types, logical_and, FREESTYLE_FE_MATERIAL_BOUNDARY, true))
417 {
418 ++use_material_boundaries;
419 }
420 }
421 layer_count++;
422 }
423 }
424 controller->setComputeRidgesAndValleysFlag(use_ridges_and_valleys > 0);
425 controller->setComputeSuggestiveContoursFlag(use_suggestive_contours > 0);
426 controller->setComputeMaterialBoundariesFlag(use_material_boundaries > 0);
427 break;
428 }
429
430 // set parameters
438
439 if (G.debug & G_DEBUG_FREESTYLE) {
440 cout << "Crease angle : " << controller->getCreaseAngle() << endl;
441 cout << "Sphere radius : " << controller->getSphereRadius() << endl;
442 cout << "Face smoothness : " << (controller->getFaceSmoothness() ? "enabled" : "disabled")
443 << endl;
444 cout << "Ridges and valleys : "
445 << (controller->getComputeRidgesAndValleysFlag() ? "enabled" : "disabled") << endl;
446 cout << "Suggestive contours : "
447 << (controller->getComputeSuggestiveContoursFlag() ? "enabled" : "disabled") << endl;
448 cout << "Suggestive contour Kr derivative epsilon : "
450 cout << "Material boundaries : "
451 << (controller->getComputeMaterialBoundariesFlag() ? "enabled" : "disabled") << endl;
452 cout << endl;
453 }
454
455 // set diffuse and z depth passes
456 RenderLayer *rl = RE_GetRenderLayer(re->result, view_layer->name);
457 bool diffuse = false, z = false;
458 LISTBASE_FOREACH (RenderPass *, rpass, &rl->passes) {
459 float *rpass_buffer_data = rpass->ibuf->float_buffer.data;
460 if (STREQ(rpass->name, RE_PASSNAME_DIFFUSE_COLOR)) {
461 controller->setPassDiffuse(rpass_buffer_data, rpass->rectx, rpass->recty);
462 diffuse = true;
463 }
464 if (STREQ(rpass->name, RE_PASSNAME_Z)) {
465 controller->setPassZ(rpass_buffer_data, rpass->rectx, rpass->recty);
466 z = true;
467 }
468 }
469 if (G.debug & G_DEBUG_FREESTYLE) {
470 cout << "Passes :" << endl;
471 cout << " Diffuse = " << (diffuse ? "enabled" : "disabled") << endl;
472 cout << " Z = " << (z ? "enabled" : "disabled") << endl;
473 }
474
476 return;
477 }
478
479 // compute view map
480 re->i.infostr = RPT_("Freestyle: View map creation");
481 re->stats_draw(&re->i);
482 re->i.infostr = nullptr;
484}
485
486void FRS_composite_result(Render *re, ViewLayer *view_layer, Render *freestyle_render)
487{
488 RenderLayer *rl;
489 float *src, *dest, *pixSrc, *pixDest;
490 int x, y, rectx, recty;
491
492 if (freestyle_render == nullptr || freestyle_render->result == nullptr) {
494 // Create a blank render pass output.
496 re->result, RE_PASSNAME_FREESTYLE, 4, "RGBA", view_layer->name, re->viewname, true);
497 }
498 return;
499 }
500
501 rl = render_get_single_layer(freestyle_render, freestyle_render->result);
502 if (!rl) {
503 if (G.debug & G_DEBUG_FREESTYLE) {
504 cout << "No source render layer to composite" << endl;
505 }
506 return;
507 }
508
509 src = RE_RenderLayerGetPass(rl, RE_PASSNAME_COMBINED, freestyle_render->viewname);
510 if (!src) {
511 if (G.debug & G_DEBUG_FREESTYLE) {
512 cout << "No source result image to composite" << endl;
513 }
514 return;
515 }
516#if 0
517 if (G.debug & G_DEBUG_FREESTYLE) {
518 cout << "src: " << rl->rectx << " x " << rl->recty << endl;
519 }
520#endif
521
522 rl = RE_GetRenderLayer(re->result, view_layer->name);
523 if (!rl) {
524 if (G.debug & G_DEBUG_FREESTYLE) {
525 cout << "No destination render layer to composite to" << endl;
526 }
527 return;
528 }
529
532 re->result, RE_PASSNAME_FREESTYLE, 4, "RGBA", view_layer->name, re->viewname, true);
534 }
535 else {
537 }
538 if (!dest) {
539 if (G.debug & G_DEBUG_FREESTYLE) {
540 cout << "No destination result image to composite to" << endl;
541 }
542 return;
543 }
544#if 0
545 if (G.debug & G_DEBUG_FREESTYLE) {
546 cout << "dest: " << rl->rectx << " x " << rl->recty << endl;
547 }
548#endif
549
550 rectx = re->rectx;
551 recty = re->recty;
552 for (y = 0; y < recty; y++) {
553 for (x = 0; x < rectx; x++) {
554 pixSrc = src + 4 * (rectx * y + x);
555 if (pixSrc[3] > 0.0) {
556 pixDest = dest + 4 * (rectx * y + x);
557 blend_color_mix_float(pixDest, pixDest, pixSrc);
558 }
559 }
560 }
561}
562
563static int displayed_layer_count(ViewLayer *view_layer)
564{
565 int count = 0;
566
567 switch (view_layer->freestyle_config.mode) {
570 if (module->script && module->is_displayed) {
571 count++;
572 }
573 }
574 break;
577 if (lineset->flags & FREESTYLE_LINESET_ENABLED) {
578 count++;
579 }
580 }
581 break;
582 }
583 return count;
584}
585
587{
588 return ((view_layer->flag & VIEW_LAYER_RENDER) && (view_layer->flag & VIEW_LAYER_FREESTYLE) &&
589 displayed_layer_count(view_layer) > 0);
590}
591
593{
594 if (G.debug & G_DEBUG_FREESTYLE) {
595 cout << endl;
596 cout << "#===============================================================" << endl;
597 cout << "# Freestyle" << endl;
598 cout << "#===============================================================" << endl;
599 }
600
601 init_view(re);
602
604}
605
607
609{
610 RenderMonitor monitor(re);
611 controller->setRenderMonitor(&monitor);
613 (view_layer->freestyle_config.flags & FREESTYLE_VIEW_MAP_CACHE) ? true : false);
614
615 if (G.debug & G_DEBUG_FREESTYLE) {
616 cout << endl;
617 cout << "----------------------------------------------------------" << endl;
618 cout << "| " << (re->scene->id.name + 2) << "|" << view_layer->name << endl;
619 cout << "----------------------------------------------------------" << endl;
620 }
621
622 /* Create depsgraph and evaluate scene. */
623 ViewLayer *scene_view_layer = (ViewLayer *)BLI_findstring(
624 &re->scene->view_layers, view_layer->name, offsetof(ViewLayer, name));
625 Depsgraph *depsgraph = DEG_graph_new(re->main, re->scene, scene_view_layer, DAG_EVAL_RENDER);
627
628 /* Init camera
629 * Objects are transformed into camera coordinate system, therefore the camera position
630 * is zero and the modelview matrix is the identity matrix. */
631 Object *ob_camera_orig = RE_GetCamera(re);
632 Object *ob_camera_eval = DEG_get_evaluated(depsgraph, ob_camera_orig);
635 RE_GetCameraWindow(re, ob_camera_eval, g_freestyle.proj);
636
637 // prepare Freestyle:
638 // - load mesh
639 // - add style modules
640 // - set parameters
641 // - compute view map
642 prepare(re, view_layer, depsgraph);
643
644 if (re->test_break()) {
646 if (G.debug & G_DEBUG_FREESTYLE) {
647 cout << "Break" << endl;
648 }
649 }
650 else {
651 // render and composite Freestyle result
652 if (controller->_ViewMap) {
653 // render strokes
654 re->i.infostr = RPT_("Freestyle: Stroke rendering");
655 re->stats_draw(&re->i);
656 re->i.infostr = nullptr;
658 int strokeCount = controller->DrawStrokes();
659 Render *freestyle_render = nullptr;
660 if (strokeCount > 0) {
661 freestyle_render = controller->RenderStrokes(re, true);
662 }
664 g_freestyle.scene = nullptr;
665
666 // composite result
667 FRS_composite_result(re, view_layer, freestyle_render);
668 if (freestyle_render) {
669 RE_FreeRender(freestyle_render);
670 }
671 }
672 }
673
674 DEG_graph_free(depsgraph);
675}
676
678{
679 // clear canvas
680 controller->Clear();
681}
682
684{
685 // free cache
687#if 0
688 if (G.debug & G_DEBUG_FREESTYLE) {
689 printf("View map cache freed\n");
690 }
691#endif
692}
693
694//=======================================================
695// Freestyle Panel Configuration
696//=======================================================
697
699{
701
702 if (lineset) {
704 lineset_buffer.flags = lineset->flags;
706 lineset_buffer.qi = lineset->qi;
708 lineset_buffer.qi_end = lineset->qi_end;
711 lineset_buffer.group = lineset->group;
712 STRNCPY(lineset_buffer.name, lineset->name);
713 lineset_copied = true;
714 }
715}
716
718{
719 if (!lineset_copied) {
720 return;
721 }
722
724
725 if (lineset) {
726 if (lineset->linestyle) {
727 id_us_min(&lineset->linestyle->id);
728 }
730 if (lineset->linestyle) {
731 id_us_plus(&lineset->linestyle->id);
732 }
733 lineset->flags = lineset_buffer.flags;
735 lineset->qi = lineset_buffer.qi;
737 lineset->qi_end = lineset_buffer.qi_end;
740 if (lineset->group) {
741 id_us_min(&lineset->group->id);
742 lineset->group = nullptr;
743 }
744 if (lineset_buffer.group) {
745 lineset->group = lineset_buffer.group;
746 id_us_plus(&lineset->group->id);
747 }
748 STRNCPY(lineset->name, lineset_buffer.name);
749 BKE_freestyle_lineset_unique_name(config, lineset);
751 }
752}
753
755{
757
758 if (lineset) {
759 BKE_freestyle_lineset_delete(config, lineset);
760 }
761}
762
763bool FRS_move_active_lineset(FreestyleConfig *config, int direction)
764{
766 return (lineset != nullptr) && BLI_listbase_link_move(&config->linesets, lineset, direction);
767}
768
769// Testing
770
772{
773 bNodeTree *nt = (linestyle->use_nodes) ? linestyle->nodetree : nullptr;
775 ma->id.us = 0;
776 return ma;
777}
Configuration file.
void BKE_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt)
Definition callbacks.cc:74
@ BKE_CB_EVT_LOAD_POST
Scene * CTX_data_scene(const bContext *C)
bool BKE_freestyle_lineset_delete(struct FreestyleConfig *config, struct FreestyleLineSet *lineset)
Definition freestyle.cc:195
void BKE_freestyle_lineset_unique_name(struct FreestyleConfig *config, struct FreestyleLineSet *lineset)
Definition freestyle.cc:148
struct FreestyleLineSet * BKE_freestyle_lineset_get_active(struct FreestyleConfig *config)
Definition freestyle.cc:212
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL
@ G_FLAG_SCRIPT_AUTOEXEC
@ G_DEBUG_FREESTYLE
void id_us_plus(ID *id)
Definition lib_id.cc:353
void id_us_min(ID *id)
Definition lib_id.cc:361
Blender kernel freestyle line style functionality.
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
Definition scene.cc:2697
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:608
void void void bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) ATTR_NONNULL()
Definition listbase.cc:436
MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4])
#define RAD2DEGF(_rad)
void unit_m4(float m[4][4])
MINLINE void zero_v3(float r[3])
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
#define SNPRINTF(dst, format,...)
Definition BLI_string.h:599
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:688
#define ARRAY_SIZE(arr)
#define ELEM(...)
#define STREQ(a, b)
#define RPT_(msgid)
#define CLOG_WARN(clg_ref,...)
Definition CLG_log.h:181
The spinal tap of the system.
@ DAG_EVAL_RENDER
Depsgraph * DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode)
Definition depsgraph.cc:278
void DEG_graph_free(Depsgraph *graph)
Definition depsgraph.cc:306
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
Object groups, one object can be in many groups at once.
@ FREESTYLE_CONTROL_EDITOR_MODE
@ FREESTYLE_CONTROL_SCRIPT_MODE
@ FREESTYLE_LINESET_FE_AND
@ FREESTYLE_LINESET_ENABLED
@ FREESTYLE_LINESET_CURRENT
@ FREESTYLE_LINESET_FE_NOT
@ FREESTYLE_SEL_EDGE_TYPES
@ FREESTYLE_FE_EDGE_MARK
@ FREESTYLE_FE_BORDER
@ FREESTYLE_FE_SILHOUETTE
@ FREESTYLE_FE_RIDGE_VALLEY
@ FREESTYLE_FE_CREASE
@ FREESTYLE_FE_EXTERNAL_CONTOUR
@ FREESTYLE_FE_CONTOUR
@ FREESTYLE_FE_SUGGESTIVE_CONTOUR
@ FREESTYLE_FE_MATERIAL_BOUNDARY
@ FREESTYLE_CULLING
@ FREESTYLE_FACE_SMOOTHNESS_FLAG
@ FREESTYLE_MATERIAL_BOUNDARIES_FLAG
@ FREESTYLE_RIDGES_AND_VALLEYS_FLAG
@ FREESTYLE_VIEW_MAP_CACHE
@ FREESTYLE_SUGGESTIVE_CONTOURS_FLAG
@ FREESTYLE_AS_RENDER_PASS
@ FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE
@ FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE
@ VIEW_LAYER_FREESTYLE
@ VIEW_LAYER_RENDER
#define RE_PASSNAME_COMBINED
@ R_LINE_THICKNESS_ABSOLUTE
@ R_LINE_THICKNESS_RELATIVE
#define RE_PASSNAME_DIFFUSE_COLOR
#define RE_PASSNAME_Z
#define RE_PASSNAME_FREESTYLE
@ R_BORDER
static bool test_edge_type_conditions(edge_type_condition *conditions, int num_edge_types, bool logical_and, int target, bool distinct)
static char * escape_quotes(char *name)
static void load_post_callback(Main *, PointerRNA **, const int, void *)
static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
static void init_view(Render *re)
static bool lineset_copied
static int displayed_layer_count(ViewLayer *view_layer)
static bCallbackFuncStore load_post_callback_funcstore
static char * create_lineset_handler(char *layer_name, char *lineset_name)
static AppView * view
static Controller * controller
static bool freestyle_is_initialized
static Config::Path * pathconfig
static FreestyleLineSet lineset_buffer
struct FreestyleGlobals g_freestyle
bool FRS_move_active_lineset(struct FreestyleConfig *config, int direction)
void FRS_set_context(struct bContext *C)
void FRS_init_stroke_renderer(struct Render *re)
void FRS_exit(void)
void FRS_end_stroke_rendering(struct Render *re)
void FRS_begin_stroke_rendering(struct Render *re)
void FRS_composite_result(struct Render *re, struct ViewLayer *view_layer, struct Render *freestyle_render)
int FRS_is_freestyle_enabled(struct ViewLayer *view_layer)
void FRS_do_stroke_rendering(struct Render *re, struct ViewLayer *view_layer)
void FRS_free_view_map_cache(void)
void FRS_paste_active_lineset(struct FreestyleConfig *config)
struct Material * FRS_create_stroke_material(struct Main *bmain, struct FreestyleLineStyle *linestyle)
void FRS_copy_active_lineset(struct FreestyleConfig *config)
void FRS_init(void)
void FRS_delete_active_lineset(struct FreestyleConfig *config)
Read Guarded memory(de)allocation.
#define C
Definition RandGen.cpp:29
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
void setWidth(uint width)
Definition AppView.h:49
void setBorder(int xmin, int ymin, int xmax, int ymax)
Definition AppView.h:57
void setThickness(float thickness)
Definition AppView.h:61
void setHeight(uint height)
Definition AppView.h:53
static Material * GetStrokeShader(Main *bmain, bNodeTree *iNodeTree, bool do_id_user)
Render * RenderStrokes(Render *re, bool render)
void setComputeSuggestiveContoursFlag(bool b)
void setPassZ(float *buf, int width, int height)
bool getFaceSmoothness() const
bool getComputeMaterialBoundariesFlag() const
void setSphereRadius(float s)
Definition Controller.h:132
void setComputeMaterialBoundariesFlag(bool b)
void setVisibilityAlgo(int algo)
void setComputeRidgesAndValleysFlag(bool b)
void setFaceSmoothness(bool iBool)
void setPassDiffuse(float *buf, int width, int height)
float getSphereRadius() const
Definition Controller.h:136
void DeleteViewMap(bool freeCache=false)
int LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
bool getComputeSuggestiveContoursFlag() const
void setViewMapCache(bool iBool)
void toggleLayer(uint index, bool iDisplay)
void setContext(bContext *C)
void setSuggestiveContourKrDerivativeEpsilon(float dkr)
Definition Controller.h:140
void setCreaseAngle(float angle)
Definition Controller.h:124
float getCreaseAngle() const
Definition Controller.h:128
bool getComputeRidgesAndValleysFlag() const
float getSuggestiveContourKrDerivativeEpsilon() const
Definition Controller.h:144
void setView(AppView *iView)
void setRenderMonitor(RenderMonitor *iRenderMonitor)
void InsertStyleModule(uint index, const char *iFileName)
std::string id_name(void *id)
#define offsetof(t, d)
#define printf(...)
void RE_GetCameraWindow(Render *re, const Object *camera, float r_winmat[4][4])
Object * RE_GetCamera(Render *re)
#define LOG(severity)
Definition log.h:32
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:133
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
#define G(x, y, z)
inherits from class Rep
Definition AppCanvas.cpp:20
void RE_create_render_pass(RenderResult *rr, const char *name, int channels, const char *chan_id, const char *layername, const char *viewname, const bool allocate)
void RE_FreeRender(Render *re)
RenderLayer * RE_GetRenderLayer(RenderResult *rr, const char *name)
float * RE_RenderLayerGetPass(RenderLayer *rl, const char *name, const char *viewname)
RenderLayer * render_get_single_layer(Render *re, RenderResult *rr)
RenderResult * result
float proj[4][4]
struct Scene * scene
struct Collection * group
struct FreestyleLineStyle * linestyle
struct bNodeTree * nodetree
int us
Definition DNA_ID.h:425
char name[66]
Definition DNA_ID.h:415
float unit_line_thickness
ListBase passes
Definition RE_pipeline.h:89
const char * infostr
bool test_break() override
RenderData r
struct Main * main
Scene * scene
char viewname[MAX_NAME]
RenderStats i
rcti disprect
void stats_draw(RenderStats *render_stats) override
struct RenderData r
ListBase view_layers
struct FreestyleConfig freestyle_config
char name[64]
int ymin
int ymax
int xmin
int xmax
i
Definition text_draw.cc:230