112 cout <<
"FRS_set_context: context 0x" << C <<
" scene 0x" <<
CTX_data_scene(C) << endl;
130 int width = re->
winx;
131 int height = re->
winy;
137 float thickness = 1.0f;
143 thickness = height / 480.0f;
151 view->setWidth(width);
152 view->setHeight(height);
153 view->setBorder(xmin, ymin, xmax, ymax);
154 view->setThickness(thickness);
157 cout <<
"\n=== Dimensions of the 2D image coordinate system ===" << endl;
158 cout <<
"Width : " << width << endl;
159 cout <<
"Height : " << height << endl;
161 cout <<
"Border : (" << xmin <<
", " << ymin <<
") - (" << xmax <<
", " << ymax <<
")"
164 cout <<
"Unit line thickness : " << thickness <<
" pixel(s)" << endl;
170 char *s = (
char *)
MEM_mallocN(strlen(name) * 2 + 1,
"escape_quotes");
184 const char *fmt =
"__import__('parameter_editor').process('%s', '%s')\n";
204 int target_condition = 0;
205 int num_non_target_positive_conditions = 0;
206 int num_non_target_negative_conditions = 0;
208 for (
int i = 0; i < num_edge_types; i++) {
209 if (conditions[i].edge_type == target) {
210 target_condition = conditions[i].
value;
212 else if (conditions[i].value > 0) {
213 ++num_non_target_positive_conditions;
215 else if (conditions[i].value < 0) {
216 ++num_non_target_negative_conditions;
223 if (num_non_target_positive_conditions > 0) {
226 if (target_condition > 0) {
229 if (target_condition < 0) {
232 if (num_non_target_negative_conditions > 0) {
237 if (target_condition > 0) {
240 if (num_non_target_negative_conditions > 0) {
243 if (target_condition < 0) {
246 if (num_non_target_positive_conditions > 0) {
253 if (target_condition > 0) {
256 if (target_condition < 0) {
260 if (num_non_target_positive_conditions > 0) {
263 if (num_non_target_negative_conditions > 0) {
268 if (num_non_target_negative_conditions > 0) {
271 if (num_non_target_positive_conditions > 0) {
297 cout <<
"\n=== Rendering options ===" << endl;
301 switch (config->
mode) {
304 cout <<
"Modules :" << endl;
307 if (module_conf->script && module_conf->is_displayed) {
308 const char *
id_name = module_conf->script->id.name + 2;
310 cout <<
" " << layer_count + 1 <<
": " <<
id_name;
311 if (module_conf->script->filepath) {
312 cout <<
" (" << module_conf->script->filepath <<
")";
332 int use_ridges_and_valleys = 0;
333 int use_suggestive_contours = 0;
334 int use_material_boundaries = 0;
348 cout <<
"Linesets:" << endl;
353 cout <<
" " << layer_count + 1 <<
": " << lineset->name <<
" - "
354 << (lineset->linestyle ? (lineset->linestyle->id.name + 2) :
"<null>") << endl;
361 ++use_ridges_and_valleys;
362 ++use_suggestive_contours;
363 ++use_material_boundaries;
367 for (
int i = 0; i < num_edge_types; i++) {
368 if (!(lineset->edge_types & conditions[i].
edge_type)) {
369 conditions[i].
value = 0;
371 else if (!(lineset->exclude_edge_types & conditions[i].
edge_type)) {
372 conditions[i].
value = 1;
375 conditions[i].
value = -1;
386 for (
int i = 0; i < num_edge_types; i++) {
387 conditions[i].
value *= -1;
389 logical_and = !logical_and;
394 ++use_ridges_and_valleys;
402 ++use_suggestive_contours;
407 ++use_material_boundaries;
433 cout <<
"Ridges and valleys : "
435 cout <<
"Suggestive contours : "
437 cout <<
"Suggestive contour Kr derivative epsilon : "
439 cout <<
"Material boundaries : "
446 bool diffuse =
false,
z =
false;
448 float *rpass_buffer_data = rpass->ibuf->float_buffer.data;
459 cout <<
"Passes :" << endl;
460 cout <<
" Diffuse = " << (diffuse ?
"enabled" :
"disabled") << endl;
461 cout <<
" Z = " << (
z ?
"enabled" :
"disabled") << endl;
478 float *src, *dest, *pixSrc, *pixDest;
479 int x,
y, rectx, recty;
481 if (freestyle_render ==
nullptr || freestyle_render->
result ==
nullptr) {
493 cout <<
"No source render layer to composite" << endl;
501 cout <<
"No source result image to composite" << endl;
507 cout <<
"src: " << rl->
rectx <<
" x " << rl->
recty << endl;
514 cout <<
"No destination render layer to composite to" << endl;
529 cout <<
"No destination result image to composite to" << endl;
535 cout <<
"dest: " << rl->
rectx <<
" x " << rl->
recty << endl;
541 for (y = 0; y < recty; y++) {
542 for (x = 0; x < rectx; x++) {
543 pixSrc = src + 4 * (rectx * y +
x);
544 if (pixSrc[3] > 0.0) {
545 pixDest = dest + 4 * (rectx * y +
x);
585 cout <<
"#===============================================================" << endl;
586 cout <<
"# Freestyle" << endl;
587 cout <<
"#===============================================================" << endl;
606 cout <<
"----------------------------------------------------------" << endl;
607 cout <<
"| " << (re->
scene->
id.
name + 2) <<
"|" << view_layer->
name << endl;
608 cout <<
"----------------------------------------------------------" << endl;
636 cout <<
"Break" << endl;
648 Render *freestyle_render =
nullptr;
649 if (strokeCount > 0) {
657 if (freestyle_render) {
678 printf(
"View map cache freed\n");
729 if (lineset->
group) {
731 lineset->
group =
nullptr;
void BKE_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt)
Scene * CTX_data_scene(const bContext *C)
bool BKE_freestyle_lineset_delete(struct FreestyleConfig *config, struct FreestyleLineSet *lineset)
void BKE_freestyle_lineset_unique_name(struct FreestyleConfig *config, struct FreestyleLineSet *lineset)
struct FreestyleLineSet * BKE_freestyle_lineset_get_active(struct FreestyleConfig *config)
Blender kernel freestyle line style functionality.
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void void void bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) ATTR_NONNULL()
MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4])
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 STRNCPY(dst, src)
The spinal tap of the system.
Depsgraph * DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode)
void DEG_graph_free(Depsgraph *graph)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
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_ALGO_CULLED_ADAPTIVE_CUMULATIVE
@ FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE
@ FREESTYLE_FE_SILHOUETTE
@ FREESTYLE_FE_RIDGE_VALLEY
@ FREESTYLE_FE_EXTERNAL_CONTOUR
@ FREESTYLE_FE_SUGGESTIVE_CONTOUR
@ FREESTYLE_FE_MATERIAL_BOUNDARY
@ FREESTYLE_SEL_EDGE_TYPES
@ 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
#define RE_PASSNAME_COMBINED
@ R_LINE_THICKNESS_ABSOLUTE
@ R_LINE_THICKNESS_RELATIVE
#define RE_PASSNAME_DIFFUSE_COLOR
#define RE_PASSNAME_FREESTYLE
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)
void FRS_paste_active_lineset(FreestyleConfig *config)
static void load_post_callback(Main *, PointerRNA **, const int, void *)
void FRS_end_stroke_rendering(Render *)
static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
void FRS_composite_result(Render *re, ViewLayer *view_layer, Render *freestyle_render)
int FRS_is_freestyle_enabled(ViewLayer *view_layer)
static void init_view(Render *re)
static bool lineset_copied
static int displayed_layer_count(ViewLayer *view_layer)
bool FRS_move_active_lineset(FreestyleConfig *config, int direction)
void FRS_delete_active_lineset(FreestyleConfig *config)
static bCallbackFuncStore load_post_callback_funcstore
static char * create_lineset_handler(char *layer_name, char *lineset_name)
void FRS_free_view_map_cache()
void FRS_init_stroke_renderer(Render *re)
Material * FRS_create_stroke_material(Main *bmain, FreestyleLineStyle *linestyle)
FreestyleGlobals g_freestyle
void FRS_begin_stroke_rendering(Render *)
void FRS_set_context(bContext *C)
static Controller * controller
static bool freestyle_is_initialized
static Config::Path * pathconfig
void FRS_do_stroke_rendering(Render *re, ViewLayer *view_layer)
void FRS_copy_active_lineset(FreestyleConfig *config)
static FreestyleLineSet lineset_buffer
Read Guarded memory(de)allocation.
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
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)
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
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)
void setCreaseAngle(float angle)
float getCreaseAngle() const
bool getComputeRidgesAndValleysFlag() const
float getSuggestiveContourKrDerivativeEpsilon() const
void setView(AppView *iView)
void setRenderMonitor(RenderMonitor *iRenderMonitor)
void InsertStyleModule(uint index, const char *iFileName)
std::string id_name(void *id)
FreestyleLineStyle linestyle
const Depsgraph * depsgraph
void RE_GetCameraWindow(Render *re, const Object *camera, float r_winmat[4][4])
Object * RE_GetCamera(Render *re)
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
static struct PyModuleDef module
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)
struct Collection * group
struct FreestyleLineStyle * linestyle
struct bNodeTree * nodetree
float unit_line_thickness
bool test_break() override
void stats_draw(RenderStats *render_stats) override
struct FreestyleConfig freestyle_config