Blender V2.61 - r43446
|
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <unistd.h>
#include "MEM_guardedalloc.h"
#include "BLO_readfile.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "DNA_world_types.h"
#include "DNA_camera_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_lamp_types.h"
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "DNA_scene_types.h"
#include "DNA_brush_types.h"
#include "DNA_screen_types.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_image.h"
#include "BKE_icons.h"
#include "BKE_lamp.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_texture.h"
#include "BKE_world.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "PIL_time.h"
#include "RE_pipeline.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_render.h"
#include "ED_view3d.h"
#include "UI_interface.h"
#include "render_intern.h"
Go to the source code of this file.
Classes | |
struct | ShaderPreview |
Typedefs | |
typedef struct ShaderPreview | ShaderPreview |
Functions | |
ImBuf * | get_brush_icon (Brush *brush) |
void | ED_preview_init_dbase (void) |
void | ED_preview_free_dbase (void) |
static int | preview_mat_has_sss (Material *mat, bNodeTree *ntree) |
static Scene * | preview_prepare_scene (Scene *scene, ID *id, int id_type, ShaderPreview *sp) |
static int | ed_preview_draw_rect (ScrArea *sa, Scene *sce, ID *id, int split, int first, rcti *rect, rcti *newrect) |
void | ED_preview_draw (const bContext *C, void *idp, void *parentp, void *slotp, rcti *rect) |
static void | shader_preview_draw (void *spv, RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) |
static int | shader_preview_break (void *spv) |
static void | shader_preview_updatejob (void *spv) |
static void | shader_preview_render (ShaderPreview *sp, ID *id, int split, int first) |
static void | shader_preview_startjob (void *customdata, short *stop, short *do_update) |
static void | shader_preview_free (void *customdata) |
static void | icon_copy_rect (ImBuf *ibuf, unsigned int w, unsigned int h, unsigned int *rect) |
static void | set_alpha (char *cp, int sizex, int sizey, char alpha) |
static void | icon_preview_startjob (void *customdata, short *stop, short *do_update) |
static void | common_preview_startjob (void *customdata, short *stop, short *do_update, float *UNUSED(progress)) |
static void | common_preview_endjob (void *customdata) |
void | ED_preview_icon_job (const bContext *C, void *owner, ID *id, unsigned int *rect, int sizex, int sizey) |
void | ED_preview_shader_job (const bContext *C, void *owner, ID *id, ID *parent, MTex *slot, int sizex, int sizey, int method) |
void | ED_preview_kill_jobs (const struct bContext *C) |
Variables | |
static Main * | pr_main = NULL |
Definition in file render_preview.c.
typedef struct ShaderPreview ShaderPreview |
static void common_preview_endjob | ( | void * | customdata | ) | [static] |
Definition at line 947 of file render_preview.c.
References GS, ShaderPreview::id, ID_BR, NA_EDITED, ID::name, NC_BRUSH, and WM_main_add_notifier().
Referenced by ED_preview_icon_job().
static void common_preview_startjob | ( | void * | customdata, |
short * | stop, | ||
short * | do_update, | ||
float * | UNUSEDprogress | ||
) | [static] |
Definition at line 937 of file render_preview.c.
References icon_preview_startjob(), PR_ICON_RENDER, ShaderPreview::pr_method, and shader_preview_startjob().
Referenced by ED_preview_icon_job(), ED_preview_kill_jobs(), and ED_preview_shader_job().
Definition at line 526 of file render_preview.c.
References CTX_data_scene(), CTX_wm_area(), ed_preview_draw_rect(), ED_preview_shader_job(), ListBase::first, PR_BUTS_RENDER, SpaceButs::preview, SPACE_BUTS, ScrArea::spacedata, SpaceButs::spacetype, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
static int ed_preview_draw_rect | ( | ScrArea * | sa, |
Scene * | sce, | ||
ID * | id, | ||
int | split, | ||
int | first, | ||
rcti * | rect, | ||
rcti * | newrect | ||
) | [static] |
Definition at line 458 of file render_preview.c.
References ABS, RenderData::color_mgt_flag, glaDrawPixelsSafe(), GS, IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB, ID_TE, IMB_buffer_byte_from_float(), MAX2, MEM_freeN(), MEM_mallocN(), ID::name, Scene::r, R_COLOR_MANAGEMENT, R_COLOR_MANAGEMENT_PREDIVIDE, RE_AcquireResultImage(), RE_GetRender(), RE_ReleaseResultImage(), RenderResult::rectf, RenderResult::rectx, RenderResult::recty, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by ED_preview_draw().
void ED_preview_free_dbase | ( | void | ) |
Definition at line 190 of file render_preview.c.
References free_main().
Referenced by WM_exit_ext().
void ED_preview_icon_job | ( | const bContext * | C, |
void * | owner, | ||
ID * | id, | ||
unsigned int * | rect, | ||
int | sizex, | ||
int | sizey | ||
) |
Definition at line 957 of file render_preview.c.
References common_preview_endjob(), common_preview_startjob(), CTX_data_scene(), CTX_wm_manager(), CTX_wm_window(), ShaderPreview::id, MEM_callocN(), NC_MATERIAL, NULL, ShaderPreview::owner, PR_ICON_RENDER, ShaderPreview::pr_method, ShaderPreview::pr_rect, ImBuf::rect, ShaderPreview::scene, shader_preview_free(), ShaderPreview::sizex, ShaderPreview::sizey, WM_JOB_EXCL_RENDER, WM_JOB_SUSPEND, WM_jobs_callbacks(), WM_jobs_customdata(), WM_jobs_get(), WM_jobs_start(), and WM_jobs_timer().
void ED_preview_init_dbase | ( | void | ) |
Definition at line 171 of file render_preview.c.
References BLO_read_from_memory(), datatoc_preview_blend, datatoc_preview_blend_size, G, G_FILE_NO_UI, BlendFileData::main, MEM_freeN(), and NULL.
Referenced by WM_init().
void ED_preview_kill_jobs | ( | const struct bContext * | C | ) |
Definition at line 1012 of file render_preview.c.
References common_preview_startjob(), CTX_wm_manager(), NULL, and WM_jobs_kill().
Referenced by cut_links_exec(), image_open_exec(), image_reload_exec(), image_replace_exec(), image_unpack_exec(), node_active_link_viewer(), node_add_file_exec(), node_delete_exec(), node_delete_reconnect_exec(), node_duplicate_exec(), node_group_edit_exec(), node_group_make_exec(), node_group_socket_add_exec(), node_group_socket_move_down_exec(), node_group_socket_move_up_exec(), node_group_socket_remove_exec(), node_group_ungroup_exec(), node_link_invoke(), node_make_link_exec(), node_mute_exec(), node_preview_toggle_exec(), node_read_renderlayers_exec(), and node_socket_toggle_exec().
void ED_preview_shader_job | ( | const bContext * | C, |
void * | owner, | ||
ID * | id, | ||
ID * | parent, | ||
MTex * | slot, | ||
int | sizex, | ||
int | sizey, | ||
int | method | ||
) |
Definition at line 983 of file render_preview.c.
References Object::col, ShaderPreview::col, common_preview_startjob(), copy_v4_v4(), CTX_data_active_object(), CTX_data_scene(), CTX_wm_manager(), CTX_wm_window(), ShaderPreview::id, MEM_callocN(), NC_MATERIAL, NULL, ShaderPreview::owner, ShaderPreview::parent, ShaderPreview::pr_method, ShaderPreview::scene, shader_preview_free(), shader_preview_updatejob(), ShaderPreview::sizex, ShaderPreview::sizey, ShaderPreview::slot, Object::totcol, WM_JOB_EXCL_RENDER, WM_jobs_callbacks(), WM_jobs_customdata(), WM_jobs_get(), WM_jobs_start(), and WM_jobs_timer().
Definition at line 103 of file render_preview.c.
References BKE_icon_changed(), BKE_icon_getid(), BLENDER_DATAFILES, BLI_get_folder(), BLI_make_file_string(), BLI_path_abs(), BLI_strncpy(), BRUSH_CUSTOM_ICON, FILE_MAX, Brush::flag, G, IB_metadata, IB_multilayer, IB_rect, Brush::icon_filepath, ID::icon_id, Brush::icon_imbuf, Brush::id, and IMB_loadiffname().
Referenced by icon_preview_startjob().
static void icon_copy_rect | ( | ImBuf * | ibuf, |
unsigned int | w, | ||
unsigned int | h, | ||
unsigned int * | rect | ||
) | [static] |
Definition at line 813 of file render_preview.c.
References IMB_dupImBuf(), IMB_freeImBuf(), IMB_rect_from_float(), IMB_scalefastImBuf(), NULL, ImBuf::rect, ImBuf::rect_float, simple_enum_gen::w, ImBuf::x, and ImBuf::y.
Referenced by icon_preview_startjob().
static void icon_preview_startjob | ( | void * | customdata, |
short * | stop, | ||
short * | do_update | ||
) | [static] |
Definition at line 872 of file render_preview.c.
References BKE_image_get_ibuf(), ImageUser::framenr, get_brush_icon(), GS, icon_copy_rect(), Brush::icon_imbuf, ShaderPreview::id, ID_BR, ID_IM, ID_MA, ID_WO, MA_TYPE_HALO, Material::material_type, ID::name, NULL, ImageUser::ok, Image::ok, ShaderPreview::pr_rect, ImBuf::rect, ShaderPreview::scene, ImageUser::scene, set_alpha(), shader_preview_startjob(), ShaderPreview::sizex, and ShaderPreview::sizey.
Referenced by common_preview_startjob().
Definition at line 196 of file render_preview.c.
References ELEM, ListBase::first, bNode::id, MA_DIFF_SSS, bNode::next, NODE_GROUP, bNodeTree::nodes, Material::nodetree, NULL, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT, Material::sss_flag, and bNode::type.
Referenced by preview_prepare_scene().
static Scene* preview_prepare_scene | ( | Scene * | scene, |
ID * | id, | ||
int | id_type, | ||
ShaderPreview * | sp | ||
) | [static] |
Definition at line 224 of file render_preview.c.
References Object::actcol, Material::alpha, RenderData::alphamode, Scene::base, BLI_addtail(), BLI_findstring(), BLI_strncpy(), Scene::camera, RenderData::cfra, ShaderPreview::col, Object::col, RenderData::color_mgt_flag, copy_v4_v4(), Object::data, end_render_material(), RenderData::engine, World::exp, ListBase::first, Tex::flag, give_current_material(), give_matarar(), Object::id, ID_LA, ID_MA, ID_TE, ID_WO, init_render_material(), LA_SUN, LA_SUN_EFFECT_SKY, Main::lamp, ShaderPreview::lampcopy, Scene::lay, localize_lamp(), localize_material(), localize_texture(), localize_world(), MA_ATMOS, MA_FLAT, MA_LAMP, MA_OBCOLOR, MA_RAYMIRROR, MA_RAYTRANSP, MA_SHADBUF, MA_SKY, MA_SPHERE_A, MA_TEXTURE, MA_TRANSP, MA_TYPE_HALO, MA_TYPE_VOLUME, MAP_ALPHA, MTex::mapto, Main::mat, ShaderPreview::matcopy, Material::material_type, MAX2, Material::mode, RenderData::mode, Material::mode_l, Material::mtex, ID::name, Base::next, World::nodetree, Lamp::nodetree, Tex::nodetree, Material::nodetree, ntreeInitPreview(), NULL, OB_LAMP, OB_RESTRICT_RENDER, OB_TYPE_SUPPORT_MATERIAL, Main::object, Base::object, PR_ICON_RENDER, ShaderPreview::pr_method, PR_NODE_RENDER, Material::pr_type, preview_mat_has_sss(), Scene::r, R_ADDSKY, R_ALPHAPREMUL, R_COLOR_MANAGEMENT, R_OSA, R_PREVIEWBUTS, R_RAYTRACE, R_SHADOW, R_SSS, World::range, Object::restrictflag, RenderData::scemode, Main::scene, Material::septex, Material::shade_flag, ShaderPreview::sizex, ShaderPreview::sizey, ShaderPreview::slot, Lamp::sun_effect_type, MTex::tex, Main::tex, TEX_PRV_ALPHA, ShaderPreview::texcopy, Lamp::type, Object::type, MTex::which_output, Main::world, Scene::world, ShaderPreview::worldcopy, RenderData::xparts, and RenderData::yparts.
Referenced by shader_preview_render().
static void set_alpha | ( | char * | cp, |
int | sizex, | ||
int | sizey, | ||
char | alpha | ||
) | [static] |
Definition at line 864 of file render_preview.c.
References size().
Referenced by icon_preview_startjob().
static int shader_preview_break | ( | void * | spv | ) | [static] |
Definition at line 577 of file render_preview.c.
References ShaderPreview::stop.
Referenced by shader_preview_render().
static void shader_preview_draw | ( | void * | spv, |
RenderResult * | UNUSEDrr, | ||
volatile struct rcti * | UNUSEDrect | ||
) | [static] |
Definition at line 569 of file render_preview.c.
References ShaderPreview::do_update.
Referenced by shader_preview_render().
static void shader_preview_free | ( | void * | customdata | ) | [static] |
Definition at line 730 of file render_preview.c.
References BLI_remlink(), FALSE, free_lamp(), free_material(), free_texture(), free_world(), IDP_FreeProperty(), IDP_GetProperties(), Main::lamp, ShaderPreview::lampcopy, Main::mat, ShaderPreview::matcopy, MAX_MTEX, MEM_freeN(), Material::mtex, NULL, shader_preview_updatejob(), Main::tex, MTex::tex, ShaderPreview::texcopy, Main::world, and ShaderPreview::worldcopy.
Referenced by ED_preview_icon_job(), and ED_preview_shader_job().
static void shader_preview_render | ( | ShaderPreview * | sp, |
ID * | id, | ||
int | split, | ||
int | first | ||
) | [static] |
Definition at line 619 of file render_preview.c.
References Scene::camera, Object::data, ELEM, GS, ID_MA, ID_TE, RenderData::mode, ID::name, NULL, ShaderPreview::owner, PR_BUTS_RENDER, PR_ICON_RENDER, ShaderPreview::pr_method, PR_NODE_RENDER, ShaderPreview::pr_rect, preview_prepare_scene(), Scene::r, R_MATNODE_PREVIEW, R_NO_IMAGE_LOAD, R_OSA, R_TEXNODE_PREVIEW, RE_display_draw_cb(), RE_GetRender(), RE_NewRender(), RE_PreviewRender(), RE_ResultGet32(), RE_test_break_cb(), RenderData::scemode, ShaderPreview::scene, shader_preview_break(), shader_preview_draw(), RenderData::size, ShaderPreview::sizex, ShaderPreview::sizey, RenderData::xsch, and RenderData::ysch.
Referenced by shader_preview_startjob().
static void shader_preview_startjob | ( | void * | customdata, |
short * | stop, | ||
short * | do_update | ||
) | [static] |
Definition at line 713 of file render_preview.c.
References ShaderPreview::do_update, ShaderPreview::id, ShaderPreview::parent, shader_preview_render(), and ShaderPreview::stop.
Referenced by common_preview_startjob(), and icon_preview_startjob().
static void shader_preview_updatejob | ( | void * | spv | ) | [static] |
Definition at line 585 of file render_preview.c.
References GS, ShaderPreview::id, ID_LA, ID_MA, ID_TE, ID_WO, ShaderPreview::lampcopy, ShaderPreview::matcopy, ID::name, Lamp::nodetree, World::nodetree, Tex::nodetree, Material::nodetree, ntreeLocalSync(), ShaderPreview::pr_method, PR_NODE_RENDER, ShaderPreview::texcopy, and ShaderPreview::worldcopy.
Referenced by ED_preview_shader_job(), and shader_preview_free().
Definition at line 169 of file render_preview.c.