Cleanup: use doxy-sections for pipeline, text_drag & effects

Also improve on the doc-string for RE_RenderFrame & RE_RenderAnim.
This commit is contained in:
Campbell Barton 2022-03-07 10:51:22 +11:00
parent a5f972c018
commit fae45a43fa
5 changed files with 249 additions and 57 deletions

View File

@ -36,7 +36,9 @@
#include "WM_api.h"
#include "WM_types.h"
/******************** text font drawing ******************/
/* -------------------------------------------------------------------- */
/** \name Text Font Drawing
* \{ */
typedef struct TextDrawContext {
int font_id;
@ -141,7 +143,11 @@ static void format_draw_color(const TextDrawContext *tdc, char formatchar)
}
}
/************************** draw text *****************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Draw Text
* \{ */
/**
* Notes on word-wrap
@ -556,7 +562,11 @@ static void text_draw(const SpaceText *st,
flatten_string_free(&fs);
}
/************************ cache utilities *****************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Cache Utilities
* \{ */
typedef struct DrawCache {
int *line_height;
@ -766,7 +776,11 @@ void text_free_caches(SpaceText *st)
}
}
/************************ word-wrap utilities *****************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Word-Wrap Utilities
* \{ */
/* cache should be updated in caller */
static int text_get_visible_lines_no(const SpaceText *st, int lineno)
@ -845,7 +859,11 @@ int text_get_total_lines(SpaceText *st, ARegion *region)
return drawcache->total_lines;
}
/************************ draw scrollbar *****************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Draw Scroll-Bar
* \{ */
static void calc_text_rcts(SpaceText *st, ARegion *region, rcti *scroll, rcti *back)
{
@ -1006,7 +1024,11 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back)
col);
}
/*********************** draw documentation *******************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Draw Documentation
* \{ */
#if 0
static void draw_documentation(const SpaceText *st, ARegion *region)
@ -1118,7 +1140,11 @@ static void draw_documentation(const SpaceText *st, ARegion *region)
}
#endif
/*********************** draw suggestion list *******************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Draw Suggestion List
* \{ */
static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc, ARegion *region)
{
@ -1221,7 +1247,11 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
}
}
/*********************** draw cursor ************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Draw Cursor
* \{ */
static void draw_text_decoration(SpaceText *st, ARegion *region)
{
@ -1383,7 +1413,11 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
immUnbindProgram();
}
/******************* draw matching brackets *********************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Draw Matching Brackets
* \{ */
static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegion *region)
{
@ -1544,7 +1578,11 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
}
}
/*********************** main region drawing *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Main Region Drawing
* \{ */
void draw_text_main(SpaceText *st, ARegion *region)
{
@ -1707,7 +1745,11 @@ void draw_text_main(SpaceText *st, ARegion *region)
text_font_end(&tdc);
}
/************************** update ***************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Update & Coordinate Conversion
* \{ */
void text_update_character_width(SpaceText *st)
{
@ -1861,3 +1903,5 @@ error:
r_pixel_co[0] = r_pixel_co[1] = -1;
return false;
}
/** \} */

View File

@ -322,9 +322,13 @@ bool RE_WriteRenderViewsMovie(struct ReportList *reports,
bool preview);
/**
* Only #RE_NewRender() needed, main Blender render calls.
*
* General Blender frame render call.
*
* \note Only #RE_NewRender() needed, main Blender render calls.
*
* \param write_still: Saves frames to disk (typically disabled). Useful for batch-operations
* (rendering from Python for e.g.) when an additional save action for is inconvenient.
* This is the default behavior for #RE_RenderAnim.
*/
void RE_RenderFrame(struct Render *re,
struct Main *bmain,
@ -334,7 +338,7 @@ void RE_RenderFrame(struct Render *re,
int frame,
bool write_still);
/**
* Saves images to disk.
* A version of #RE_RenderFrame that saves images to disk.
*/
void RE_RenderAnim(struct Render *re,
struct Main *bmain,

View File

@ -116,14 +116,20 @@
* - save file or append in movie
*/
/* ********* globals ******** */
/* -------------------------------------------------------------------- */
/** \name Globals
* \{ */
/* here we store all renders */
static struct {
ListBase renderlist;
} RenderGlobal = {{NULL, NULL}};
/* ********* callbacks ******** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Callbacks
* \{ */
static void render_callback_exec_null(Render *re, Main *bmain, eCbEvent evt)
{
@ -141,7 +147,11 @@ static void render_callback_exec_id(Render *re, Main *bmain, ID *id, eCbEvent ev
BKE_callback_exec_id(bmain, id, evt);
}
/* ********* alloc and free ******** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Allocation & Free
* \{ */
static int do_write_image_or_movie(Render *re,
Main *bmain,
@ -308,7 +318,11 @@ static bool render_scene_has_layers_to_render(Scene *scene, ViewLayer *single_la
return false;
}
/* *************************************************** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Public Render API
* \{ */
Render *RE_GetRender(const char *name)
{
@ -686,7 +700,11 @@ void RE_FreePersistentData(const Scene *scene)
}
}
/* ********* initialize state ******** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name Initialize State
* \{ */
static void re_init_resolution(Render *re, Render *source, int winx, int winy, rcti *disprect)
{
@ -905,7 +923,11 @@ void RE_test_break_cb(Render *re, void *handle, int (*f)(void *handle))
re->tbh = handle;
}
/* ********* GL Context ******** */
/** \} */
/* -------------------------------------------------------------------- */
/** \name OpenGL Context
* \{ */
void RE_gl_context_create(Render *re)
{
@ -944,6 +966,16 @@ void *RE_gpu_context_get(Render *re)
return re->gpu_context;
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Render & Composite Scenes (Implementation & Public API)
*
* Main high-level functions defined here are:
* - #RE_RenderFrame
* - #RE_RenderAnim
* \{ */
/* ************ This part uses API, for rendering Blender scenes ********** */
/* make sure disprect is not affected by the render border */
@ -1940,6 +1972,12 @@ void RE_RenderFreestyleExternal(Render *re)
}
#endif
/** \} */
/* -------------------------------------------------------------------- */
/** \name Read/Write Render Result (Images & Movies)
* \{ */
bool RE_WriteRenderViewsImage(
ReportList *reports, RenderResult *rr, Scene *scene, const bool stamp, char *name)
{
@ -2600,11 +2638,6 @@ bool RE_ReadRenderResult(Scene *scene, Scene *scenode)
return success;
}
void RE_init_threadcount(Render *re)
{
re->r.threads = BKE_render_num_threads(&re->r);
}
void RE_layer_load_from_file(
RenderLayer *layer, ReportList *reports, const char *filename, int x, int y)
{
@ -2785,6 +2818,12 @@ RenderPass *RE_create_gp_pass(RenderResult *rr, const char *layername, const cha
return render_layer_add_pass(rr, rl, 4, RE_PASSNAME_COMBINED, viewname, "RGBA", true);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Miscellaneous Public Render API
* \{ */
bool RE_allow_render_generic_object(Object *ob)
{
/* override not showing object when duplis are used with particles */
@ -2796,3 +2835,10 @@ bool RE_allow_render_generic_object(Object *ob)
}
return true;
}
void RE_init_threadcount(Render *re)
{
re->r.threads = BKE_render_num_threads(&re->r);
}
/** \} */

View File

@ -58,6 +58,10 @@
static struct SeqEffectHandle get_sequence_effect_impl(int seq_type);
/* -------------------------------------------------------------------- */
/** \name Internal Utilities
* \{ */
static void slice_get_byte_buffers(const SeqRenderData *context,
const ImBuf *ibuf1,
const ImBuf *ibuf2,
@ -108,7 +112,11 @@ static void slice_get_float_buffers(const SeqRenderData *context,
}
}
/*********************** Glow effect *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Glow Effect
* \{ */
enum {
GlowR = 0,
@ -178,7 +186,11 @@ static ImBuf *prepare_effect_imbufs(const SeqRenderData *context,
return out;
}
/*********************** Alpha Over *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Alpha Over Effect
* \{ */
static void init_alpha_over_or_under(Sequence *seq)
{
@ -288,7 +300,11 @@ static void do_alphaover_effect(const SeqRenderData *context,
}
}
/*********************** Alpha Under *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Alpha Under Effect
* \{ */
static void do_alphaunder_effect_byte(
float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out)
@ -405,7 +421,11 @@ static void do_alphaunder_effect(const SeqRenderData *context,
}
}
/*********************** Cross *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Cross Effect
* \{ */
static void do_cross_effect_byte(
float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out)
@ -482,7 +502,11 @@ static void do_cross_effect(const SeqRenderData *context,
}
}
/*********************** Gamma Cross *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Gamma Cross
* \{ */
/* copied code from initrender.c */
static unsigned short gamtab[65536];
@ -726,7 +750,11 @@ static void do_gammacross_effect(const SeqRenderData *context,
}
}
/*********************** Add *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Color Add Effect
* \{ */
static void do_add_effect_byte(
float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out)
@ -802,7 +830,11 @@ static void do_add_effect(const SeqRenderData *context,
}
}
/*********************** Sub *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Color Subtract Effect
* \{ */
static void do_sub_effect_byte(
float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out)
@ -880,7 +912,11 @@ static void do_sub_effect(const SeqRenderData *context,
}
}
/*********************** Drop *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Drop Effect
* \{ */
/* Must be > 0 or add precopy, etc to the function */
#define XOFF 8
@ -954,7 +990,11 @@ static void do_drop_effect_float(
memcpy(out, rt1, sizeof(*out) * yoff * 4 * x);
}
/*********************** Mul *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Multiply Effect
* \{ */
static void do_mul_effect_byte(
float fac, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out)
@ -1035,7 +1075,12 @@ static void do_mul_effect(const SeqRenderData *context,
}
}
/*********************** Blend Mode ***************************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Blend Mode Effect
* \{ */
typedef void (*IMB_blend_func_byte)(unsigned char *dst,
const unsigned char *src1,
const unsigned char *src2);
@ -1268,7 +1313,13 @@ static void do_blend_mode_effect(const SeqRenderData *context,
fac, context->rectx, total_lines, rect1, rect2, seq->blend_mode, rect_out);
}
}
/*********************** Color Mix Effect *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Color Mix Effect
* \{ */
static void init_colormix_effect(Sequence *seq)
{
ColorMixVars *data;
@ -1314,7 +1365,11 @@ static void do_colormix_effect(const SeqRenderData *context,
}
}
/*********************** Wipe *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Wipe Effect
* \{ */
typedef struct WipeZone {
float angle;
@ -1334,7 +1389,9 @@ static void precalc_wipe_zone(WipeZone *wipezone, WipeVars *wipe, int xo, int yo
wipezone->pythangle = 1.0f / sqrtf(wipezone->angle * wipezone->angle + 1.0f);
}
/* This function calculates the blur band for the wipe effects */
/**
* This function calculates the blur band for the wipe effects.
*/
static float in_band(float width, float dist, int side, int dir)
{
float alpha;
@ -1757,7 +1814,11 @@ static ImBuf *do_wipe_effect(const SeqRenderData *context,
return out;
}
/*********************** Transform *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform Effect
* \{ */
static void init_transform_effect(Sequence *seq)
{
@ -1909,7 +1970,11 @@ static void do_transform_effect(const SeqRenderData *context,
transform->interpolation);
}
/*********************** Glow *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Glow Effect
* \{ */
static void RVBlurBitmap2_float(float *map, int width, int height, float blur, int quality)
{
@ -2229,7 +2294,11 @@ static ImBuf *do_glow_effect(const SeqRenderData *context,
return out;
}
/*********************** Solid color *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Solid Color Effect
* \{ */
static void init_solid_color(Sequence *seq)
{
@ -2324,9 +2393,13 @@ static ImBuf *do_solid_color(const SeqRenderData *context,
return out;
}
/*********************** Mulitcam *************************/
/** \} */
/* no effect inputs for multicam, we use give_ibuf_seq */
/* -------------------------------------------------------------------- */
/** \name Mulit-Camera Effect
* \{ */
/** No effect inputs for multi-camera, we use #give_ibuf_seq. */
static int num_inputs_multicam(void)
{
return 0;
@ -2367,9 +2440,13 @@ static ImBuf *do_multicam(const SeqRenderData *context,
return out;
}
/*********************** Adjustment *************************/
/** \} */
/* no effect inputs for adjustment, we use give_ibuf_seq */
/* -------------------------------------------------------------------- */
/** \name Adjustment Effect
* \{ */
/** No effect inputs for adjustment, we use #give_ibuf_seq. */
static int num_inputs_adjustment(void)
{
return 0;
@ -2438,7 +2515,11 @@ static ImBuf *do_adjustment(const SeqRenderData *context,
return out;
}
/*********************** Speed *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Speed Effect
* \{ */
static void init_speed_effect(Sequence *seq)
{
@ -2639,7 +2720,11 @@ static ImBuf *do_speed_effect(const SeqRenderData *context,
return IMB_dupImBuf(ibuf1);
}
/*********************** overdrop *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Over-Drop Effect
* \{ */
static void do_overdrop_effect(const SeqRenderData *context,
Sequence *UNUSED(seq),
@ -2675,7 +2760,11 @@ static void do_overdrop_effect(const SeqRenderData *context,
}
}
/*********************** Gaussian Blur *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Gaussian Blur
* \{ */
/* NOTE: This gaussian blur implementation accumulates values in the square
* kernel rather that doing X direction and then Y direction because of the
@ -3099,7 +3188,11 @@ static ImBuf *do_gaussian_blur_effect(const SeqRenderData *context,
return out;
}
/*********************** text *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Text Effect
* \{ */
static void init_text_effect(Sequence *seq)
{
@ -3341,7 +3434,11 @@ static ImBuf *do_text_effect(const SeqRenderData *context,
return out;
}
/*********************** sequence effect factory *************************/
/** \} */
/* -------------------------------------------------------------------- */
/** \name Sequence Effect Factory
* \{ */
static void init_noop(Sequence *UNUSED(seq))
{
@ -3592,6 +3689,12 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
return rval;
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Public Sequencer Effect API
* \{ */
struct SeqEffectHandle SEQ_effect_handle_get(Sequence *seq)
{
struct SeqEffectHandle rval = {false, false, NULL};
@ -3639,3 +3742,5 @@ int SEQ_effect_get_num_inputs(int seq_type)
}
return 0;
}
/** \} */

View File

@ -15,13 +15,6 @@ struct Scene;
struct SeqRenderData;
struct Sequence;
/* **********************************************************************
* sequencer.c
*
* Sequencer editing functions
* **********************************************************************
*/
struct SeqEffectHandle seq_effect_get_sequence_blend(struct Sequence *seq);
/**
* Build frame map when speed in mode #SEQ_SPEED_MULTIPLY is animated.