Sorry, three commits in one, became difficult to untangle..
Editors Modules * render/ module added in editors, moved the preview render code there and also shading related operators. * physics/ module made more consistent with other modules. renaming files, making a single physics_ops.c for operators and keymaps. Also move all particle related operators here now. * space_buttons/ now should have only operators relevant to the buttons specificially. Updates & Notifiers * Material/Texture/World/Lamp can now be passed to DAG_id_flush_update, which will go back to a callback in editors. Eventually these should be in the depsgraph itself, but for now this gives a unified call for doing updates. * GLSL materials are now refreshed on changes. There's still various cases missing, * Preview icons now hook into this system, solving various update cases that were missed before. * Also fixes issue in my last commit, where some preview would not render, problem is avoided in the new system. Icon Rendering * On systems with support for non-power of two textures, an OpenGL texture is now used instead of glDrawPixels. This avoids problems with icons get clipped on region borders. On my Linux desktop, this gives an 1.1x speedup, and on my Mac laptop a 2.3x speedup overall in redrawing the full window, with the default setup. The glDrawPixels implementation on Mac seems to have a lot of overhread. * Preview icons are now drawn using proper premul alpha, and never faded so you can see them clearly. * Also tried to fix issue with texture node preview rendering, globals can't be used with threads reliably.
This commit is contained in:
@@ -513,11 +513,11 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
|
||||
#row.template_list(boids, "states", boids, "active_boid_state_index", compact="True")
|
||||
#col = row.row()
|
||||
#subrow = col.row(align=True)
|
||||
#subrow.itemO("boid.boidstate_add", icon='ICON_ZOOMIN', text="")
|
||||
#subrow.itemO("boid.boidstate_del", icon='ICON_ZOOMOUT', text="")
|
||||
#subrow.itemO("boid.state_add", icon='ICON_ZOOMIN', text="")
|
||||
#subrow.itemO("boid.state_del", icon='ICON_ZOOMOUT', text="")
|
||||
#subrow = row.row(align=True)
|
||||
#subrow.itemO("boid.boidstate_move_up", icon='VICON_MOVE_UP', text="")
|
||||
#subrow.itemO("boid.boidstate_move_down", icon='VICON_MOVE_DOWN', text="")
|
||||
#subrow.itemO("boid.state_move_up", icon='VICON_MOVE_UP', text="")
|
||||
#subrow.itemO("boid.state_move_down", icon='VICON_MOVE_DOWN', text="")
|
||||
|
||||
state = boids.active_boid_state
|
||||
|
||||
@@ -536,12 +536,12 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel):
|
||||
col = row.column()
|
||||
subrow = col.row()
|
||||
subcol = subrow.column(align=True)
|
||||
subcol.item_menu_enumO("boid.boidrule_add", "type", icon='ICON_ZOOMIN', text="")
|
||||
subcol.itemO("boid.boidrule_del", icon='ICON_ZOOMOUT', text="")
|
||||
subcol.item_menu_enumO("boid.rule_add", "type", icon='ICON_ZOOMIN', text="")
|
||||
subcol.itemO("boid.rule_del", icon='ICON_ZOOMOUT', text="")
|
||||
subrow = col.row()
|
||||
subcol = subrow.column(align=True)
|
||||
subcol.itemO("boid.boidrule_move_up", icon='VICON_MOVE_UP', text="")
|
||||
subcol.itemO("boid.boidrule_move_down", icon='VICON_MOVE_DOWN', text="")
|
||||
subcol.itemO("boid.rule_move_up", icon='VICON_MOVE_UP', text="")
|
||||
subcol.itemO("boid.rule_move_down", icon='VICON_MOVE_DOWN', text="")
|
||||
|
||||
rule = state.active_boid_rule
|
||||
|
||||
|
||||
@@ -115,5 +115,8 @@ void DAG_ids_flush_update(int time);
|
||||
|
||||
/* (re)-create dependency graph for armature pose */
|
||||
void DAG_pose_sort(struct Object *ob);
|
||||
|
||||
/* callback for editors module to do updates */
|
||||
void DAG_editors_update_cb(void (*func)(struct Main *bmain, struct ID *id));
|
||||
|
||||
#endif
|
||||
|
||||
@@ -426,7 +426,7 @@ extern struct ListBase node_all_textures;
|
||||
/* API */
|
||||
int ntreeTexTagAnimated(struct bNodeTree *ntree);
|
||||
void ntreeTexSetPreviewFlag(int);
|
||||
void ntreeTexExecTree(struct bNodeTree *ntree, struct TexResult *target, float *coord, float *dxt, float *dyt, short thread, struct Tex *tex, short which_output, int cfra);
|
||||
void ntreeTexExecTree(struct bNodeTree *ntree, struct TexResult *target, float *coord, float *dxt, float *dyt, short thread, struct Tex *tex, short which_output, int cfra, int preview);
|
||||
void ntreeTexCheckCyclics(struct bNodeTree *ntree);
|
||||
char* ntreeTexOutputMenu(struct bNodeTree *ntree);
|
||||
|
||||
|
||||
@@ -1607,6 +1607,21 @@ void graph_print_adj_list(void)
|
||||
|
||||
/* ************************ API *********************** */
|
||||
|
||||
/* mechanism to allow editors to be informed of depsgraph updates,
|
||||
to do their own updates based on changes... */
|
||||
static void (*EditorsUpdateCb)(Main *bmain, ID *id)= NULL;
|
||||
|
||||
void DAG_editors_update_cb(void (*func)(Main *bmain, ID *id))
|
||||
{
|
||||
EditorsUpdateCb= func;
|
||||
}
|
||||
|
||||
static void dag_editors_update(Main *bmain, ID *id)
|
||||
{
|
||||
if(EditorsUpdateCb)
|
||||
EditorsUpdateCb(bmain, id);
|
||||
}
|
||||
|
||||
/* groups with objects in this scene need to be put in the right order as well */
|
||||
static void scene_sort_groups(Scene *sce)
|
||||
{
|
||||
@@ -2239,6 +2254,9 @@ void DAG_id_flush_update(ID *id, short flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* update editors */
|
||||
dag_editors_update(bmain, id);
|
||||
}
|
||||
|
||||
/* flush to other objects that depend on this one */
|
||||
|
||||
@@ -43,7 +43,7 @@ DIRS = armature \
|
||||
metaball \
|
||||
gpencil \
|
||||
physics \
|
||||
preview \
|
||||
render \
|
||||
uvedit \
|
||||
space_outliner \
|
||||
space_time \
|
||||
|
||||
@@ -14,7 +14,7 @@ SConscript(['datafiles/SConscript',
|
||||
'curve/SConscript',
|
||||
'gpencil/SConscript',
|
||||
'physics/SConscript',
|
||||
'preview/SConscript',
|
||||
'render/SConscript',
|
||||
'sound/SConscript',
|
||||
'space_buttons/SConscript',
|
||||
'space_file/SConscript',
|
||||
|
||||
@@ -38,6 +38,7 @@ struct RadialControl;
|
||||
struct rcti;
|
||||
struct wmWindowManager;
|
||||
struct PTCacheEdit;
|
||||
struct Scene;
|
||||
|
||||
/* particle edit mode */
|
||||
void PE_free_ptcache_edit(struct PTCacheEdit *edit);
|
||||
@@ -46,7 +47,7 @@ int PE_start_edit(struct PTCacheEdit *edit);
|
||||
/* access */
|
||||
struct PTCacheEdit *PE_get_current(struct Scene *scene, struct Object *ob);
|
||||
int PE_minmax(struct Scene *scene, float *min, float *max);
|
||||
struct ParticleEditSettings *PE_settings(Scene *scene);
|
||||
struct ParticleEditSettings *PE_settings(struct Scene *scene);
|
||||
|
||||
/* update calls */
|
||||
void PE_hide_keys_time(struct Scene *scene, struct PTCacheEdit *edit, float cfra);
|
||||
@@ -59,15 +60,11 @@ int PE_circle_select(struct bContext *C, int selecting, short *mval, float rad);
|
||||
int PE_lasso_select(struct bContext *C, short mcords[][2], short moves, short select);
|
||||
|
||||
/* undo */
|
||||
void PE_undo_push(Scene *scene, char *str);
|
||||
void PE_undo_step(Scene *scene, int step);
|
||||
void PE_undo(Scene *scene);
|
||||
void PE_redo(Scene *scene);
|
||||
void PE_undo_menu(Scene *scene, Object *ob);
|
||||
|
||||
/* operators */
|
||||
void ED_operatortypes_particle(void);
|
||||
void ED_keymap_particle(struct wmWindowManager *wm);
|
||||
void PE_undo_push(struct Scene *scene, char *str);
|
||||
void PE_undo_step(struct Scene *scene, int step);
|
||||
void PE_undo(struct Scene *scene);
|
||||
void PE_redo(struct Scene *scene);
|
||||
void PE_undo_menu(struct Scene *scene, struct Object *ob);
|
||||
|
||||
#endif /* ED_PARTICLE_H */
|
||||
|
||||
|
||||
@@ -31,11 +31,8 @@
|
||||
#define ED_PHYSICS_H
|
||||
|
||||
/* operators */
|
||||
|
||||
void ED_operatortypes_boids(void);
|
||||
void ED_operatortypes_pointcache(void);
|
||||
void ED_operatortypes_fluid(void);
|
||||
//void ED_keymap_pointcache(struct wmWindowManager *wm);
|
||||
void ED_operatortypes_physics(void);
|
||||
void ED_keymap_physics(struct wmWindowManager *wm);
|
||||
|
||||
#endif /* ED_PHYSICS_H */
|
||||
|
||||
|
||||
@@ -21,22 +21,29 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef ED_PREVIEWRENDER_H
|
||||
#define ED_PREVIEWRENDER_H
|
||||
#ifndef ED_RENDER_H
|
||||
#define ED_RENDER_H
|
||||
|
||||
#include "DNA_vec_types.h"
|
||||
|
||||
struct View3D;
|
||||
struct SpaceButs;
|
||||
struct RenderInfo;
|
||||
struct Scene;
|
||||
struct Image;
|
||||
struct Render;
|
||||
struct bContext;
|
||||
struct ID;
|
||||
struct Main;
|
||||
struct MTex;
|
||||
struct Render;
|
||||
struct RenderInfo;
|
||||
|
||||
#define PREVIEW_RENDERSIZE 140
|
||||
/* render_ops.c */
|
||||
|
||||
void ED_operatortypes_render(void);
|
||||
|
||||
/* render_shading.c */
|
||||
|
||||
void ED_render_id_flush_update(struct Main *bmain, struct ID *id);
|
||||
|
||||
/* render_preview.c */
|
||||
|
||||
#define _RENDERSIZE 140
|
||||
|
||||
/* stores rendered preview - is also used for icons */
|
||||
typedef struct RenderInfo {
|
||||
@@ -57,9 +57,9 @@ int UI_icon_get_height(int icon_id);
|
||||
void UI_icon_draw(float x, float y, int icon_id);
|
||||
void UI_icon_draw_preview(float x, float y, int icon_id, int nocreate);
|
||||
|
||||
void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect);
|
||||
void UI_icon_draw_aspect_blended(float x, float y, int icon_id, float aspect, int shade);
|
||||
void UI_icon_draw_size_blended(float x, float y, int size, int icon_id, int shade);
|
||||
void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha);
|
||||
void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb);
|
||||
void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha);
|
||||
void UI_icons_free();
|
||||
void UI_icons_free_drawinfo(void *drawinfo);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#include "BIF_glutil.h"
|
||||
|
||||
#include "ED_datafiles.h"
|
||||
#include "ED_previewrender.h"
|
||||
#include "ED_render.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_interface_icons.h"
|
||||
@@ -86,23 +86,45 @@ typedef struct IconImage {
|
||||
|
||||
typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
|
||||
|
||||
#define ICON_TYPE_PREVIEW 0
|
||||
#define ICON_TYPE_TEXTURE 1
|
||||
#define ICON_TYPE_BUFFER 2
|
||||
#define ICON_TYPE_VECTOR 3
|
||||
|
||||
typedef struct DrawInfo {
|
||||
int type;
|
||||
|
||||
union {
|
||||
/* type specific data */
|
||||
struct {
|
||||
VectorDrawFunc func;
|
||||
} vector;
|
||||
struct {
|
||||
IconImage* image;
|
||||
} buffer;
|
||||
struct {
|
||||
int x, y, w, h;
|
||||
} texture;
|
||||
} data;
|
||||
} DrawInfo;
|
||||
|
||||
typedef struct IconTexture {
|
||||
GLuint id;
|
||||
int w;
|
||||
int h;
|
||||
float aspect;
|
||||
VectorDrawFunc drawFunc; /* If drawFunc is defined then it is a vector icon, otherwise use rect */
|
||||
IconImage* icon;
|
||||
} DrawInfo;
|
||||
float invw;
|
||||
float invh;
|
||||
} IconTexture;
|
||||
|
||||
/* ******************* STATIC LOCAL VARS ******************* */
|
||||
/* static here to cache results of icon directory scan, so it's not
|
||||
* scanning the filesystem each time the menu is drawn */
|
||||
static struct ListBase iconfilelist = {0, 0};
|
||||
|
||||
static IconTexture icongltex = {0, 0, 0, 0.0f, 0.0f};
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int size)
|
||||
static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int size, int type)
|
||||
{
|
||||
Icon *new_icon = NULL;
|
||||
IconImage *iimg = NULL;
|
||||
@@ -116,23 +138,28 @@ static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int
|
||||
new_icon->type = 0;
|
||||
|
||||
di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
|
||||
di->drawFunc = 0;
|
||||
di->w = size;
|
||||
di->h = size;
|
||||
di->aspect = 1.0f;
|
||||
|
||||
iimg = MEM_mallocN(sizeof(IconImage), "icon_img");
|
||||
iimg->rect = MEM_mallocN(size*size*sizeof(unsigned int), "icon_rect");
|
||||
iimg->w = size;
|
||||
iimg->h = size;
|
||||
di->type= type;
|
||||
|
||||
/* Here we store the rect in the icon - same as before */
|
||||
imgsize = bbuf->x;
|
||||
for (y=0; y<size; y++) {
|
||||
memcpy(&iimg->rect[y*size], &bbuf->rect[(y+yofs)*imgsize+xofs], size*sizeof(int));
|
||||
if(type == ICON_TYPE_TEXTURE) {
|
||||
di->data.texture.x= xofs;
|
||||
di->data.texture.y= yofs;
|
||||
di->data.texture.w= size;
|
||||
di->data.texture.h= size;
|
||||
}
|
||||
else if(type == ICON_TYPE_BUFFER) {
|
||||
iimg = MEM_mallocN(sizeof(IconImage), "icon_img");
|
||||
iimg->rect = MEM_mallocN(size*size*sizeof(unsigned int), "icon_rect");
|
||||
iimg->w = size;
|
||||
iimg->h = size;
|
||||
|
||||
di->icon = iimg;
|
||||
/* Here we store the rect in the icon - same as before */
|
||||
imgsize = bbuf->x;
|
||||
for (y=0; y<size; y++) {
|
||||
memcpy(&iimg->rect[y*size], &bbuf->rect[(y+yofs)*imgsize+xofs], size*sizeof(int));
|
||||
}
|
||||
|
||||
di->data.buffer.image = iimg;
|
||||
}
|
||||
|
||||
new_icon->drawinfo_free = UI_icons_free_drawinfo;
|
||||
new_icon->drawinfo = di;
|
||||
@@ -151,11 +178,8 @@ static void def_internal_vicon( int icon_id, VectorDrawFunc drawFunc)
|
||||
new_icon->type = 0;
|
||||
|
||||
di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
|
||||
di->drawFunc =drawFunc;
|
||||
di->w = ICON_DEFAULT_HEIGHT;
|
||||
di->h = ICON_DEFAULT_HEIGHT;
|
||||
di->aspect = 1.0f;
|
||||
di->icon = NULL;
|
||||
di->type= ICON_TYPE_VECTOR;
|
||||
di->data.vector.func =drawFunc;
|
||||
|
||||
new_icon->drawinfo_free = 0;
|
||||
new_icon->drawinfo = di;
|
||||
@@ -431,7 +455,7 @@ static void init_internal_icons()
|
||||
{
|
||||
bTheme *btheme= U.themes.first;
|
||||
ImBuf *bbuf= NULL;
|
||||
int x, y;
|
||||
int x, y, icontype;
|
||||
char iconfilestr[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char filenamestr[FILE_MAXFILE+16]; // 16 == strlen(".blender/icons/")+1
|
||||
|
||||
@@ -451,17 +475,54 @@ static void init_internal_icons()
|
||||
printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
|
||||
IMB_freeImBuf(bbuf);
|
||||
bbuf= NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(bbuf==NULL)
|
||||
bbuf = IMB_ibImageFromMemory((int *)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect);
|
||||
|
||||
if(bbuf) {
|
||||
/* free existing texture if any */
|
||||
if(icongltex.id) {
|
||||
glDeleteTextures(1, &icongltex.id);
|
||||
icongltex.id= 0;
|
||||
}
|
||||
|
||||
/* we only use a texture for cards with non-power of two */
|
||||
if(GLEW_ARB_texture_non_power_of_two) {
|
||||
glGenTextures(1, &icongltex.id);
|
||||
|
||||
if(icongltex.id) {
|
||||
icongltex.w = bbuf->x;
|
||||
icongltex.h = bbuf->y;
|
||||
icongltex.invw = 1.0f/bbuf->x;
|
||||
icongltex.invh = 1.0f/bbuf->y;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, icongltex.id);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bbuf->x, bbuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, bbuf->rect);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
if(glGetError() == GL_OUT_OF_MEMORY) {
|
||||
glDeleteTextures(1, &icongltex.id);
|
||||
icongltex.id= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(icongltex.id)
|
||||
icontype= ICON_TYPE_TEXTURE;
|
||||
else
|
||||
icontype= ICON_TYPE_BUFFER;
|
||||
|
||||
for (y=0; y<ICON_GRID_ROWS; y++) {
|
||||
for (x=0; x<ICON_GRID_COLS; x++) {
|
||||
def_internal_icon(bbuf, BIFICONID_FIRST + y*ICON_GRID_COLS + x,
|
||||
x*(ICON_GRID_W+ICON_GRID_MARGIN)+ICON_GRID_MARGIN,
|
||||
y*(ICON_GRID_H+ICON_GRID_MARGIN)+ICON_GRID_MARGIN, ICON_GRID_W);
|
||||
y*(ICON_GRID_H+ICON_GRID_MARGIN)+ICON_GRID_MARGIN, ICON_GRID_W,
|
||||
icontype);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -588,6 +649,11 @@ ListBase *UI_iconfile_list(void)
|
||||
|
||||
void UI_icons_free()
|
||||
{
|
||||
if(icongltex.id) {
|
||||
glDeleteTextures(1, &icongltex.id);
|
||||
icongltex.id= 0;
|
||||
}
|
||||
|
||||
free_iconfile_list(&iconfilelist);
|
||||
BKE_icons_free();
|
||||
}
|
||||
@@ -596,12 +662,14 @@ void UI_icons_free_drawinfo(void *drawinfo)
|
||||
{
|
||||
DrawInfo *di = drawinfo;
|
||||
|
||||
if (di)
|
||||
{
|
||||
if (di->icon) {
|
||||
MEM_freeN(di->icon->rect);
|
||||
MEM_freeN(di->icon);
|
||||
if(di) {
|
||||
if(di->type == ICON_TYPE_BUFFER) {
|
||||
if(di->data.buffer.image) {
|
||||
MEM_freeN(di->data.buffer.image->rect);
|
||||
MEM_freeN(di->data.buffer.image);
|
||||
}
|
||||
}
|
||||
|
||||
MEM_freeN(di);
|
||||
}
|
||||
}
|
||||
@@ -611,12 +679,7 @@ static DrawInfo *icon_create_drawinfo()
|
||||
DrawInfo *di = NULL;
|
||||
|
||||
di = MEM_callocN(sizeof(DrawInfo), "di_icon");
|
||||
|
||||
di->drawFunc = 0;
|
||||
di->w = ICON_DEFAULT_HEIGHT;
|
||||
di->h = ICON_DEFAULT_HEIGHT;
|
||||
di->icon = NULL;
|
||||
di->aspect = 1.0f;
|
||||
di->type= ICON_TYPE_PREVIEW;
|
||||
|
||||
return di;
|
||||
}
|
||||
@@ -640,7 +703,7 @@ int UI_icon_get_width(int icon_id)
|
||||
}
|
||||
|
||||
if (di)
|
||||
return di->w;
|
||||
return ICON_DEFAULT_HEIGHT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -665,7 +728,7 @@ int UI_icon_get_height(int icon_id)
|
||||
}
|
||||
|
||||
if (di)
|
||||
return di->h;
|
||||
return ICON_DEFAULT_HEIGHT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -718,12 +781,23 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple
|
||||
prv_img->w[miplevel], prv_img->h[miplevel]);
|
||||
}
|
||||
|
||||
static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, int rh, unsigned int *rect)
|
||||
static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, int rh, unsigned int *rect, float alpha, float *rgb)
|
||||
{
|
||||
|
||||
/* modulate color */
|
||||
if(alpha != 1.0f)
|
||||
glPixelTransferf(GL_ALPHA_SCALE, alpha);
|
||||
|
||||
if(rgb) {
|
||||
glPixelTransferf(GL_RED_SCALE, rgb[0]);
|
||||
glPixelTransferf(GL_GREEN_SCALE, rgb[1]);
|
||||
glPixelTransferf(GL_BLUE_SCALE, rgb[2]);
|
||||
}
|
||||
|
||||
/* position */
|
||||
glRasterPos2f(x, y);
|
||||
// XXX ui_rasterpos_safe(x, y, aspect);
|
||||
|
||||
/* draw */
|
||||
if((w<1 || h<1)) {
|
||||
// XXX - TODO 2.5 verify whether this case can happen
|
||||
// and only print in debug
|
||||
@@ -731,23 +805,68 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw,
|
||||
}
|
||||
/* rect contains image in 'rendersize', we only scale if needed */
|
||||
else if(rw!=w && rh!=h) {
|
||||
ImBuf *ima;
|
||||
if(w>2000 || h>2000) { /* something has gone wrong! */
|
||||
printf("insane icon size w=%d h=%d\n",w,h);
|
||||
return;
|
||||
}
|
||||
/* first allocate imbuf for scaling and copy preview into it */
|
||||
ima = IMB_allocImBuf(rw, rh, 32, IB_rect, 0);
|
||||
memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int));
|
||||
|
||||
/* scale it */
|
||||
IMB_scaleImBuf(ima, w, h);
|
||||
glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect);
|
||||
|
||||
IMB_freeImBuf(ima);
|
||||
else {
|
||||
ImBuf *ima;
|
||||
|
||||
/* first allocate imbuf for scaling and copy preview into it */
|
||||
ima = IMB_allocImBuf(rw, rh, 32, IB_rect, 0);
|
||||
memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int));
|
||||
|
||||
/* scale it */
|
||||
IMB_scaleImBuf(ima, w, h);
|
||||
glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect);
|
||||
|
||||
IMB_freeImBuf(ima);
|
||||
}
|
||||
}
|
||||
else
|
||||
glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect);
|
||||
|
||||
/* restore color */
|
||||
if(alpha != 0.0f)
|
||||
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
|
||||
|
||||
if(rgb) {
|
||||
glPixelTransferf(GL_RED_SCALE, 1.0f);
|
||||
glPixelTransferf(GL_GREEN_SCALE, 1.0f);
|
||||
glPixelTransferf(GL_BLUE_SCALE, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int iw, int ih, float alpha, float *rgb)
|
||||
{
|
||||
float x1, x2, y1, y2;
|
||||
|
||||
if(rgb) glColor4f(rgb[0], rgb[1], rgb[2], alpha);
|
||||
else glColor4f(1.0f, 1.0f, 1.0f, alpha);
|
||||
|
||||
x1= ix*icongltex.invw;
|
||||
x2= (ix + ih)*icongltex.invw;
|
||||
y1= iy*icongltex.invh;
|
||||
y2= (iy + ih)*icongltex.invh;
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, icongltex.id);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(x1, y1);
|
||||
glVertex2f(x, y);
|
||||
|
||||
glTexCoord2f(x2, y1);
|
||||
glVertex2f(x+w, y);
|
||||
|
||||
glTexCoord2f(x2, y2);
|
||||
glVertex2f(x+w, y+h);
|
||||
|
||||
glTexCoord2f(x1, y2);
|
||||
glVertex2f(x, y+h);
|
||||
glEnd();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
/* Drawing size for preview images at level miplevel */
|
||||
@@ -760,10 +879,12 @@ static int preview_size(int miplevel)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void icon_draw_size(float x, float y, int icon_id, float aspect, int miplevel, int draw_size, int nocreate)
|
||||
static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int nocreate)
|
||||
{
|
||||
Icon *icon = NULL;
|
||||
DrawInfo *di = NULL;
|
||||
IconImage *iimg;
|
||||
int w, h;
|
||||
|
||||
icon = BKE_icon_get(icon_id);
|
||||
|
||||
@@ -771,7 +892,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, int mipl
|
||||
printf("icon_draw_mipmap: Internal error, no icon for icon ID: %d\n", icon_id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
di = (DrawInfo*)icon->drawinfo;
|
||||
|
||||
if (!di) {
|
||||
@@ -781,31 +902,38 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, int mipl
|
||||
icon->drawinfo_free = UI_icons_free_drawinfo;
|
||||
}
|
||||
|
||||
di->aspect = aspect;
|
||||
/* scale width and height according to aspect */
|
||||
di->w = (int)(draw_size/di->aspect + 0.5f);
|
||||
di->h = (int)(draw_size/di->aspect + 0.5f);
|
||||
w = (int)(draw_size/aspect + 0.5f);
|
||||
h = (int)(draw_size/aspect + 0.5f);
|
||||
|
||||
if (di->drawFunc) {
|
||||
if(di->type == ICON_TYPE_VECTOR) {
|
||||
/* vector icons use the uiBlock transformation, they are not drawn
|
||||
with untransformed coordinates like the other icons */
|
||||
di->drawFunc(x, y, ICON_DEFAULT_HEIGHT, ICON_DEFAULT_HEIGHT, 1.0f);
|
||||
di->data.vector.func(x, y, ICON_DEFAULT_HEIGHT, ICON_DEFAULT_HEIGHT, 1.0f);
|
||||
}
|
||||
else if (di->icon) {
|
||||
/* it is a builtin icon */
|
||||
if (!di->icon->rect) return; /* something has gone wrong! */
|
||||
|
||||
icon_draw_rect(x,y,di->w, di->h, di->aspect, di->icon->w, di->icon->h, di->icon->rect);
|
||||
else if(di->type == ICON_TYPE_TEXTURE) {
|
||||
icon_draw_texture(x, y, w, h, di->data.texture.x, di->data.texture.y,
|
||||
di->data.texture.w, di->data.texture.h, alpha, rgb);
|
||||
}
|
||||
else {
|
||||
else if(di->type == ICON_TYPE_BUFFER) {
|
||||
/* it is a builtin icon */
|
||||
iimg= di->data.buffer.image;
|
||||
|
||||
if(!iimg->rect) return; /* something has gone wrong! */
|
||||
|
||||
icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb);
|
||||
}
|
||||
else if(di->type == ICON_TYPE_PREVIEW) {
|
||||
PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj);
|
||||
|
||||
if (pi) {
|
||||
if(pi) {
|
||||
/* no create icon on this level in code */
|
||||
if(!pi->rect[miplevel]) return; /* something has gone wrong! */
|
||||
|
||||
if (!pi->rect[miplevel]) return; /* something has gone wrong! */
|
||||
|
||||
icon_draw_rect(x,y,di->w, di->h, di->aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel]);
|
||||
/* preview images use premul alpha ... */
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -847,50 +975,35 @@ int ui_id_icon_get(bContext *C, ID *id)
|
||||
return iconid;
|
||||
}
|
||||
|
||||
static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, int miplevel, int nocreate)
|
||||
static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, float alpha, int miplevel, int nocreate)
|
||||
{
|
||||
int draw_size = preview_size(miplevel);
|
||||
icon_draw_size(x,y,icon_id, aspect, miplevel, draw_size, nocreate);
|
||||
icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate);
|
||||
}
|
||||
|
||||
|
||||
void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect)
|
||||
void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha)
|
||||
{
|
||||
icon_draw_mipmap(x,y,icon_id, aspect, PREVIEW_MIPMAP_ZERO, 0);
|
||||
icon_draw_mipmap(x, y, icon_id, aspect, alpha, PREVIEW_MIPMAP_ZERO, 0);
|
||||
}
|
||||
|
||||
void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb)
|
||||
{
|
||||
int draw_size = preview_size(PREVIEW_MIPMAP_ZERO);
|
||||
icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, 0);
|
||||
}
|
||||
|
||||
void UI_icon_draw(float x, float y, int icon_id)
|
||||
{
|
||||
UI_icon_draw_aspect(x, y, icon_id, 1.0f);
|
||||
UI_icon_draw_aspect(x, y, icon_id, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void UI_icon_draw_size_blended(float x, float y, int size, int icon_id, int shade)
|
||||
void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha)
|
||||
{
|
||||
if(shade < 0) {
|
||||
float r= (128+shade)/128.0f;
|
||||
glPixelTransferf(GL_ALPHA_SCALE, r);
|
||||
}
|
||||
|
||||
icon_draw_size(x,y,icon_id, 1.0f, 0, size, 1);
|
||||
|
||||
if(shade < 0)
|
||||
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
|
||||
icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, 0, size, 1);
|
||||
}
|
||||
|
||||
void UI_icon_draw_preview(float x, float y, int icon_id, int nocreate)
|
||||
{
|
||||
icon_draw_mipmap(x,y,icon_id, 1.0f, PREVIEW_MIPMAP_LARGE, nocreate);
|
||||
icon_draw_mipmap(x, y, icon_id, 1.0f, 1.0f, PREVIEW_MIPMAP_LARGE, nocreate);
|
||||
}
|
||||
|
||||
void UI_icon_draw_aspect_blended(float x, float y, int icon_id, float aspect, int shade)
|
||||
{
|
||||
if(shade < 0) {
|
||||
float r= (128+shade)/128.0f;
|
||||
glPixelTransferf(GL_ALPHA_SCALE, r);
|
||||
}
|
||||
|
||||
UI_icon_draw_aspect(x, y, icon_id, aspect);
|
||||
|
||||
if(shade < 0)
|
||||
glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
#include "ED_previewrender.h"
|
||||
#include "ED_render.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
|
||||
@@ -697,7 +697,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
|
||||
/* icons have been standardized... and this call draws in untransformed coordinates */
|
||||
#define ICON_HEIGHT 16.0f
|
||||
|
||||
static void widget_draw_icon(uiBut *but, BIFIconID icon, int blend, rcti *rect)
|
||||
static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect)
|
||||
{
|
||||
int xs=0, ys=0;
|
||||
float aspect, height;
|
||||
@@ -724,7 +724,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, int blend, rcti *rect)
|
||||
if ELEM4(but->type, TOG, ROW, TOGN, LISTROW) {
|
||||
if(but->flag & UI_SELECT);
|
||||
else if(but->flag & UI_ACTIVE);
|
||||
else blend= -60;
|
||||
else alpha= 0.5f;
|
||||
}
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
@@ -757,14 +757,14 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, int blend, rcti *rect)
|
||||
ys= (rect->ymin+rect->ymax- height)/2;
|
||||
}
|
||||
|
||||
UI_icon_draw_aspect_blended(xs, ys, icon, aspect, blend);
|
||||
UI_icon_draw_aspect(xs, ys, icon, aspect, alpha);
|
||||
}
|
||||
|
||||
if(but->flag & UI_ICON_SUBMENU) {
|
||||
xs= rect->xmax-17;
|
||||
ys= (rect->ymin+rect->ymax- height)/2;
|
||||
|
||||
UI_icon_draw_aspect_blended(xs, ys, ICON_RIGHTARROW_THIN, aspect, blend);
|
||||
UI_icon_draw_aspect(xs, ys, ICON_RIGHTARROW_THIN, aspect, alpha);
|
||||
}
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
@@ -902,7 +902,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
|
||||
|
||||
/* check for button text label */
|
||||
if (but->type == ICONTEXTROW) {
|
||||
widget_draw_icon(but, (BIFIconID) (but->icon+but->iconadd), 0, rect);
|
||||
widget_draw_icon(but, (BIFIconID) (but->icon+but->iconadd), 1.0f, rect);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -913,14 +913,14 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
|
||||
else if(but->pointype==INT)
|
||||
dualset= BTST( *(((int *)but->poin)+1), but->bitnr);
|
||||
|
||||
widget_draw_icon(but, ICON_DOT, dualset?0:-100, rect);
|
||||
widget_draw_icon(but, ICON_DOT, dualset?1.0f:0.25f, rect);
|
||||
}
|
||||
|
||||
/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
|
||||
and offset the text label to accomodate it */
|
||||
|
||||
if (but->flag & UI_HAS_ICON) {
|
||||
widget_draw_icon(but, but->icon+but->iconadd, 0, rect);
|
||||
widget_draw_icon(but, but->icon+but->iconadd, 1.0f, rect);
|
||||
|
||||
rect->xmin += UI_icon_get_width(but->icon+but->iconadd);
|
||||
|
||||
@@ -2581,7 +2581,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid,
|
||||
int xs= rect->xmin+4;
|
||||
int ys= 1 + (rect->ymin+rect->ymax- ICON_HEIGHT)/2;
|
||||
glEnable(GL_BLEND);
|
||||
UI_icon_draw_aspect_blended(xs, ys, iconid, 1.2f, 0); /* XXX scale weak get from fstyle? */
|
||||
UI_icon_draw_aspect(xs, ys, iconid, 1.2f, 0.5f); /* XXX scale weak get from fstyle? */
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,5 +175,9 @@ void OBJECT_OT_game_property_remove(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_shape_key_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_shape_key_remove(struct wmOperatorType *ot);
|
||||
|
||||
/* object_group.c */
|
||||
void OBJECT_OT_group_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_group_remove(struct wmOperatorType *ot);
|
||||
|
||||
#endif /* ED_OBJECT_INTERN_H */
|
||||
|
||||
|
||||
@@ -176,6 +176,9 @@ void ED_operatortypes_object(void)
|
||||
|
||||
WM_operatortype_append(LATTICE_OT_select_all_toggle);
|
||||
WM_operatortype_append(LATTICE_OT_make_regular);
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_group_add);
|
||||
WM_operatortype_append(OBJECT_OT_group_remove);
|
||||
|
||||
/* macros */
|
||||
ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
|
||||
|
||||
@@ -25,35 +25,21 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
//#include <stdlib.h>
|
||||
//#include <string.h>
|
||||
//
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_boid_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
//#include "DNA_curve_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
//#include "DNA_material_types.h"
|
||||
//#include "DNA_texture_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
//#include "DNA_world_types.h"
|
||||
|
||||
#include "BKE_boids.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
//#include "BKE_font.h"
|
||||
//#include "BKE_library.h"
|
||||
//#include "BKE_main.h"
|
||||
//#include "BKE_material.h"
|
||||
#include "BKE_particle.h"
|
||||
//#include "BKE_texture.h"
|
||||
//#include "BKE_utildefines.h"
|
||||
//#include "BKE_world.h"
|
||||
|
||||
//#include "BLI_editVert.h"
|
||||
#include "BLI_listbase.h"
|
||||
//
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_enum_types.h"
|
||||
#include "RNA_define.h"
|
||||
@@ -61,13 +47,10 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
//#include "ED_curve.h"
|
||||
//#include "ED_mesh.h"
|
||||
//
|
||||
//#include "buttons_intern.h" // own include
|
||||
#include "physics_intern.h"
|
||||
|
||||
/************************ add/del boid rule operators *********************/
|
||||
static int boidrule_add_exec(bContext *C, wmOperator *op)
|
||||
static int rule_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
@@ -101,23 +84,23 @@ static int boidrule_add_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void BOID_OT_boidrule_add(wmOperatorType *ot)
|
||||
void BOID_OT_rule_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Boid Rule";
|
||||
ot->description = "Add a boid rule to the current boid state.";
|
||||
ot->idname= "BOID_OT_boidrule_add";
|
||||
ot->idname= "BOID_OT_rule_add";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= WM_menu_invoke;
|
||||
ot->exec= boidrule_add_exec;
|
||||
ot->exec= rule_add_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", "");
|
||||
}
|
||||
static int boidrule_del_exec(bContext *C, wmOperator *op)
|
||||
static int rule_del_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
@@ -153,21 +136,21 @@ static int boidrule_del_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void BOID_OT_boidrule_del(wmOperatorType *ot)
|
||||
void BOID_OT_rule_del(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Remove Boid Rule";
|
||||
ot->idname= "BOID_OT_boidrule_del";
|
||||
ot->idname= "BOID_OT_rule_del";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= boidrule_del_exec;
|
||||
ot->exec= rule_del_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/************************ move up/down boid rule operators *********************/
|
||||
static int boidrule_move_up_exec(bContext *C, wmOperator *op)
|
||||
static int rule_move_up_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
@@ -194,19 +177,19 @@ static int boidrule_move_up_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void BOID_OT_boidrule_move_up(wmOperatorType *ot)
|
||||
void BOID_OT_rule_move_up(wmOperatorType *ot)
|
||||
{
|
||||
ot->name= "Move Up Boid Rule";
|
||||
ot->description= "Move boid rule up in the list.";
|
||||
ot->idname= "BOID_OT_boidrule_move_up";
|
||||
ot->idname= "BOID_OT_rule_move_up";
|
||||
|
||||
ot->exec= boidrule_move_up_exec;
|
||||
ot->exec= rule_move_up_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int boidrule_move_down_exec(bContext *C, wmOperator *op)
|
||||
static int rule_move_down_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
@@ -233,13 +216,13 @@ static int boidrule_move_down_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void BOID_OT_boidrule_move_down(wmOperatorType *ot)
|
||||
void BOID_OT_rule_move_down(wmOperatorType *ot)
|
||||
{
|
||||
ot->name= "Move Down Boid Rule";
|
||||
ot->description= "Move boid rule down in the list.";
|
||||
ot->idname= "BOID_OT_boidrule_move_down";
|
||||
ot->idname= "BOID_OT_rule_move_down";
|
||||
|
||||
ot->exec= boidrule_move_down_exec;
|
||||
ot->exec= rule_move_down_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
@@ -247,7 +230,7 @@ void BOID_OT_boidrule_move_down(wmOperatorType *ot)
|
||||
|
||||
|
||||
/************************ add/del boid state operators *********************/
|
||||
static int boidstate_add_exec(bContext *C, wmOperator *op)
|
||||
static int state_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
ParticleSystem *psys= ptr.data;
|
||||
@@ -273,20 +256,20 @@ static int boidstate_add_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void BOID_OT_boidstate_add(wmOperatorType *ot)
|
||||
void BOID_OT_state_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Boid State";
|
||||
ot->description = "Add a boid state to the particle system.";
|
||||
ot->idname= "BOID_OT_boidstate_add";
|
||||
ot->idname= "BOID_OT_state_add";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= boidstate_add_exec;
|
||||
ot->exec= state_add_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
static int boidstate_del_exec(bContext *C, wmOperator *op)
|
||||
static int state_del_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
@@ -327,21 +310,21 @@ static int boidstate_del_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void BOID_OT_boidstate_del(wmOperatorType *ot)
|
||||
void BOID_OT_state_del(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Remove Boid State";
|
||||
ot->idname= "BOID_OT_boidstate_del";
|
||||
ot->idname= "BOID_OT_state_del";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= boidstate_del_exec;
|
||||
ot->exec= state_del_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/************************ move up/down boid state operators *********************/
|
||||
static int boidstate_move_up_exec(bContext *C, wmOperator *op)
|
||||
static int state_move_up_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
ParticleSystem *psys= ptr.data;
|
||||
@@ -366,19 +349,19 @@ static int boidstate_move_up_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void BOID_OT_boidstate_move_up(wmOperatorType *ot)
|
||||
void BOID_OT_state_move_up(wmOperatorType *ot)
|
||||
{
|
||||
ot->name= "Move Up Boid State";
|
||||
ot->description= "Move boid state up in the list.";
|
||||
ot->idname= "BOID_OT_boidstate_move_up";
|
||||
ot->idname= "BOID_OT_state_move_up";
|
||||
|
||||
ot->exec= boidstate_move_up_exec;
|
||||
ot->exec= state_move_up_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int boidstate_move_down_exec(bContext *C, wmOperator *op)
|
||||
static int state_move_down_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
@@ -403,28 +386,15 @@ static int boidstate_move_down_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void BOID_OT_boidstate_move_down(wmOperatorType *ot)
|
||||
void BOID_OT_state_move_down(wmOperatorType *ot)
|
||||
{
|
||||
ot->name= "Move Down Boid State";
|
||||
ot->description= "Move boid state down in the list.";
|
||||
ot->idname= "BOID_OT_boidstate_move_down";
|
||||
ot->idname= "BOID_OT_state_move_down";
|
||||
|
||||
ot->exec= boidstate_move_down_exec;
|
||||
ot->exec= state_move_down_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
void ED_operatortypes_boids(void)
|
||||
{
|
||||
WM_operatortype_append(BOID_OT_boidrule_add);
|
||||
WM_operatortype_append(BOID_OT_boidrule_del);
|
||||
WM_operatortype_append(BOID_OT_boidrule_move_up);
|
||||
WM_operatortype_append(BOID_OT_boidrule_move_down);
|
||||
|
||||
WM_operatortype_append(BOID_OT_boidstate_add);
|
||||
WM_operatortype_append(BOID_OT_boidstate_del);
|
||||
WM_operatortype_append(BOID_OT_boidstate_move_up);
|
||||
WM_operatortype_append(BOID_OT_boidstate_move_down);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ static void PTCacheUndo_clear(PTCacheEdit *edit);
|
||||
|
||||
/**************************** utilities *******************************/
|
||||
|
||||
static int PE_poll(bContext *C)
|
||||
int PE_poll(bContext *C)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= CTX_data_active_object(C);
|
||||
@@ -120,7 +120,7 @@ static int PE_poll(bContext *C)
|
||||
return (edit && (ob->mode & OB_MODE_PARTICLE_EDIT));
|
||||
}
|
||||
|
||||
static int PE_hair_poll(bContext *C)
|
||||
int PE_hair_poll(bContext *C)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= CTX_data_active_object(C);
|
||||
@@ -134,7 +134,7 @@ static int PE_hair_poll(bContext *C)
|
||||
return (edit && edit->psys && (ob->mode & OB_MODE_PARTICLE_EDIT));
|
||||
}
|
||||
|
||||
static int PE_poll_3dview(bContext *C)
|
||||
int PE_poll_3dview(bContext *C)
|
||||
{
|
||||
return PE_poll(C) && CTX_wm_area(C)->spacetype == SPACE_VIEW3D &&
|
||||
CTX_wm_region(C)->regiontype == RGN_TYPE_WINDOW;
|
||||
@@ -3948,61 +3948,3 @@ void PARTICLE_OT_specials_menu(wmOperatorType *ot)
|
||||
ot->poll= PE_hair_poll;
|
||||
}
|
||||
|
||||
/**************************** registration **********************************/
|
||||
|
||||
void ED_operatortypes_particle(void)
|
||||
{
|
||||
WM_operatortype_append(PARTICLE_OT_select_all_toggle);
|
||||
WM_operatortype_append(PARTICLE_OT_select_first);
|
||||
WM_operatortype_append(PARTICLE_OT_select_last);
|
||||
WM_operatortype_append(PARTICLE_OT_select_linked);
|
||||
WM_operatortype_append(PARTICLE_OT_select_less);
|
||||
WM_operatortype_append(PARTICLE_OT_select_more);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_hide);
|
||||
WM_operatortype_append(PARTICLE_OT_reveal);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_rekey);
|
||||
WM_operatortype_append(PARTICLE_OT_subdivide);
|
||||
WM_operatortype_append(PARTICLE_OT_remove_doubles);
|
||||
WM_operatortype_append(PARTICLE_OT_delete);
|
||||
WM_operatortype_append(PARTICLE_OT_mirror);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_brush_set);
|
||||
WM_operatortype_append(PARTICLE_OT_brush_edit);
|
||||
WM_operatortype_append(PARTICLE_OT_brush_radial_control);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_specials_menu);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_particle_edit_toggle);
|
||||
WM_operatortype_append(PARTICLE_OT_edited_clear);
|
||||
}
|
||||
|
||||
void ED_keymap_particle(wmWindowManager *wm)
|
||||
{
|
||||
wmKeyMap *keymap;
|
||||
|
||||
keymap= WM_keymap_find(wm, "Particle", 0, 0);
|
||||
keymap->poll= PE_poll;
|
||||
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1);
|
||||
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_delete", XKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_delete", DELKEY, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, 0, 0);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
|
||||
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", ACTIONMOUSE, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
|
||||
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_specials_menu", WKEY, KM_PRESS, 0, 0);
|
||||
}
|
||||
|
||||
575
source/blender/editors/physics/particle_object.c
Normal file
575
source/blender/editors/physics/particle_object.c
Normal file
@@ -0,0 +1,575 @@
|
||||
/**
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
#include "BLI_arithb.h"
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_pointcache.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "ED_particle.h"
|
||||
|
||||
#include "physics_intern.h"
|
||||
|
||||
/********************** particle system slot operators *********************/
|
||||
|
||||
static int particle_system_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
if(!scene || !ob)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
object_add_particle_system(scene, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_particle_system_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Particle System Slot";
|
||||
ot->idname= "OBJECT_OT_particle_system_add";
|
||||
ot->description="Add a particle system.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= particle_system_add_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int particle_system_remove_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
if(!scene || !ob)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
object_remove_particle_system(scene, ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_particle_system_remove(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Remove Particle System Slot";
|
||||
ot->idname= "OBJECT_OT_particle_system_remove";
|
||||
ot->description="Remove the selected particle system.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= particle_system_remove_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/********************** new particle settings operator *********************/
|
||||
|
||||
static int psys_poll(bContext *C)
|
||||
{
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
return (ptr.data != NULL);
|
||||
}
|
||||
|
||||
static int new_particle_settings_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Main *bmain= CTX_data_main(C);
|
||||
ParticleSystem *psys;
|
||||
ParticleSettings *part = NULL;
|
||||
Object *ob;
|
||||
PointerRNA ptr;
|
||||
|
||||
ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
|
||||
psys = ptr.data;
|
||||
|
||||
/* add or copy particle setting */
|
||||
if(psys->part)
|
||||
part= psys_copy_settings(psys->part);
|
||||
else
|
||||
part= psys_new_settings("ParticleSettings", bmain);
|
||||
|
||||
ob= ptr.id.data;
|
||||
|
||||
if(psys->part)
|
||||
psys->part->id.us--;
|
||||
|
||||
psys->part = part;
|
||||
|
||||
psys_check_boid_data(psys);
|
||||
|
||||
DAG_scene_sort(scene);
|
||||
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void PARTICLE_OT_new(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "New Particle Settings";
|
||||
ot->idname= "PARTICLE_OT_new";
|
||||
ot->description="Add new particle settings.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= new_particle_settings_exec;
|
||||
ot->poll= psys_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/********************** keyed particle target operators *********************/
|
||||
|
||||
static int new_particle_target_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
ParticleSystem *psys= ptr.data;
|
||||
Object *ob = ptr.id.data;
|
||||
|
||||
ParticleTarget *pt;
|
||||
|
||||
if(!psys)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
pt = psys->targets.first;
|
||||
for(; pt; pt=pt->next)
|
||||
pt->flag &= ~PTARGET_CURRENT;
|
||||
|
||||
pt = MEM_callocN(sizeof(ParticleTarget), "keyed particle target");
|
||||
|
||||
pt->flag |= PTARGET_CURRENT;
|
||||
pt->psys = 1;
|
||||
|
||||
BLI_addtail(&psys->targets, pt);
|
||||
|
||||
DAG_scene_sort(scene);
|
||||
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void PARTICLE_OT_new_target(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "New Particle Target";
|
||||
ot->idname= "PARTICLE_OT_new_target";
|
||||
ot->description="Add a new particle target.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= new_particle_target_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int remove_particle_target_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
ParticleSystem *psys= ptr.data;
|
||||
Object *ob = ptr.id.data;
|
||||
|
||||
ParticleTarget *pt;
|
||||
|
||||
if(!psys)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
pt = psys->targets.first;
|
||||
for(; pt; pt=pt->next) {
|
||||
if(pt->flag & PTARGET_CURRENT) {
|
||||
BLI_remlink(&psys->targets, pt);
|
||||
MEM_freeN(pt);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
pt = psys->targets.last;
|
||||
|
||||
if(pt)
|
||||
pt->flag |= PTARGET_CURRENT;
|
||||
|
||||
DAG_scene_sort(scene);
|
||||
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void PARTICLE_OT_remove_target(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Remove Particle Target";
|
||||
ot->idname= "PARTICLE_OT_remove_target";
|
||||
ot->description="Remove the selected particle target.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= remove_particle_target_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/************************ move up particle target operator *********************/
|
||||
|
||||
static int target_move_up_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
ParticleSystem *psys= ptr.data;
|
||||
Object *ob = ptr.id.data;
|
||||
ParticleTarget *pt;
|
||||
|
||||
if(!psys)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
pt = psys->targets.first;
|
||||
for(; pt; pt=pt->next) {
|
||||
if(pt->flag & PTARGET_CURRENT && pt->prev) {
|
||||
BLI_remlink(&psys->targets, pt);
|
||||
BLI_insertlink(&psys->targets, pt->prev->prev, pt);
|
||||
|
||||
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void PARTICLE_OT_target_move_up(wmOperatorType *ot)
|
||||
{
|
||||
ot->name= "Move Up Target";
|
||||
ot->idname= "PARTICLE_OT_target_move_up";
|
||||
ot->description= "Move particle target up in the list.";
|
||||
|
||||
ot->exec= target_move_up_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/************************ move down particle target operator *********************/
|
||||
|
||||
static int target_move_down_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
ParticleSystem *psys= ptr.data;
|
||||
Object *ob = ptr.id.data;
|
||||
ParticleTarget *pt;
|
||||
|
||||
if(!psys)
|
||||
return OPERATOR_CANCELLED;
|
||||
pt = psys->targets.first;
|
||||
for(; pt; pt=pt->next) {
|
||||
if(pt->flag & PTARGET_CURRENT && pt->next) {
|
||||
BLI_remlink(&psys->targets, pt);
|
||||
BLI_insertlink(&psys->targets, pt->next, pt);
|
||||
|
||||
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void PARTICLE_OT_target_move_down(wmOperatorType *ot)
|
||||
{
|
||||
ot->name= "Move Down Target";
|
||||
ot->idname= "PARTICLE_OT_target_move_down";
|
||||
ot->description= "Move particle target down in the list.";
|
||||
|
||||
ot->exec= target_move_down_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/************************ connect/disconnect hair operators *********************/
|
||||
|
||||
static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
|
||||
{
|
||||
ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
|
||||
ParticleData *pa;
|
||||
PTCacheEdit *edit;
|
||||
PTCacheEditPoint *point;
|
||||
PTCacheEditKey *ekey = NULL;
|
||||
HairKey *key;
|
||||
int i, k;
|
||||
float hairmat[4][4];
|
||||
|
||||
if(!ob || !psys || psys->flag & PSYS_GLOBAL_HAIR)
|
||||
return;
|
||||
|
||||
if(!psys->part || psys->part->type != PART_HAIR)
|
||||
return;
|
||||
|
||||
edit = psys->edit;
|
||||
point= edit ? edit->points : NULL;
|
||||
|
||||
for(i=0, pa=psys->particles; i<psys->totpart; i++,pa++) {
|
||||
if(point) {
|
||||
ekey = point->keys;
|
||||
point++;
|
||||
}
|
||||
|
||||
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
|
||||
|
||||
for(k=0,key=pa->hair; k<pa->totkey; k++,key++) {
|
||||
Mat4MulVecfl(hairmat,key->co);
|
||||
|
||||
if(ekey) {
|
||||
ekey->flag &= ~PEK_USE_WCO;
|
||||
ekey++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
psys_free_path_cache(psys, psys->edit);
|
||||
|
||||
psys->flag |= PSYS_GLOBAL_HAIR;
|
||||
|
||||
PE_update_object(scene, ob, 0);
|
||||
}
|
||||
|
||||
static int disconnect_hair_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
ParticleSystem *psys= NULL;
|
||||
int all = RNA_boolean_get(op->ptr, "all");
|
||||
|
||||
if(!ob)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
if(all) {
|
||||
for(psys=ob->particlesystem.first; psys; psys=psys->next) {
|
||||
disconnect_hair(scene, ob, psys);
|
||||
}
|
||||
}
|
||||
else {
|
||||
psys = ptr.data;
|
||||
disconnect_hair(scene, ob, psys);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void PARTICLE_OT_disconnect_hair(wmOperatorType *ot)
|
||||
{
|
||||
ot->name= "Disconnect Hair";
|
||||
ot->description= "Disconnect hair from the emitter mesh.";
|
||||
ot->idname= "PARTICLE_OT_disconnect_hair";
|
||||
|
||||
ot->exec= disconnect_hair_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "all", 0, "All hair", "Disconnect all hair systems from the emitter mesh");
|
||||
}
|
||||
|
||||
static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
|
||||
{
|
||||
ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
|
||||
ParticleData *pa;
|
||||
PTCacheEdit *edit;
|
||||
PTCacheEditPoint *point;
|
||||
PTCacheEditKey *ekey;
|
||||
HairKey *key;
|
||||
BVHTreeFromMesh bvhtree;
|
||||
BVHTreeNearest nearest;
|
||||
MFace *mface;
|
||||
DerivedMesh *dm = NULL;
|
||||
int numverts;
|
||||
int i, k;
|
||||
float hairmat[4][4], imat[4][4];
|
||||
float v[4][3], vec[3];
|
||||
|
||||
if(!psys || !psys->part || psys->part->type != PART_HAIR)
|
||||
return;
|
||||
|
||||
edit= psys->edit;
|
||||
point= edit ? edit->points : NULL;
|
||||
|
||||
if(psmd->dm->deformedOnly)
|
||||
dm= psmd->dm;
|
||||
else
|
||||
dm= mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
|
||||
|
||||
numverts = dm->getNumVerts (dm);
|
||||
|
||||
memset( &bvhtree, 0, sizeof(bvhtree) );
|
||||
|
||||
/* convert to global coordinates */
|
||||
for (i=0; i<numverts; i++)
|
||||
Mat4MulVecfl (ob->obmat, CDDM_get_vert(dm, i)->co);
|
||||
|
||||
bvhtree_from_mesh_faces(&bvhtree, dm, 0.0, 2, 6);
|
||||
|
||||
for(i=0, pa= psys->particles; i<psys->totpart; i++,pa++) {
|
||||
key = pa->hair;
|
||||
|
||||
nearest.index = -1;
|
||||
nearest.dist = FLT_MAX;
|
||||
|
||||
BLI_bvhtree_find_nearest(bvhtree.tree, key->co, &nearest, bvhtree.nearest_callback, &bvhtree);
|
||||
|
||||
if(nearest.index == -1) {
|
||||
printf("No nearest point found for hair root!");
|
||||
continue;
|
||||
}
|
||||
|
||||
mface = CDDM_get_face(dm,nearest.index);
|
||||
|
||||
VecCopyf(v[0], CDDM_get_vert(dm,mface->v1)->co);
|
||||
VecCopyf(v[1], CDDM_get_vert(dm,mface->v2)->co);
|
||||
VecCopyf(v[2], CDDM_get_vert(dm,mface->v3)->co);
|
||||
if(mface->v4) {
|
||||
VecCopyf(v[3], CDDM_get_vert(dm,mface->v4)->co);
|
||||
MeanValueWeights(v, 4, nearest.co, pa->fuv);
|
||||
}
|
||||
else
|
||||
MeanValueWeights(v, 3, nearest.co, pa->fuv);
|
||||
|
||||
pa->num = nearest.index;
|
||||
pa->num_dmcache = psys_particle_dm_face_lookup(ob,psmd->dm,pa->num,pa->fuv,NULL);
|
||||
|
||||
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
|
||||
Mat4Invert(imat,hairmat);
|
||||
|
||||
VECSUB(vec, nearest.co, key->co);
|
||||
|
||||
if(point) {
|
||||
ekey = point->keys;
|
||||
point++;
|
||||
}
|
||||
|
||||
for(k=0,key=pa->hair; k<pa->totkey; k++,key++) {
|
||||
VECADD(key->co, key->co, vec);
|
||||
Mat4MulVecfl(imat,key->co);
|
||||
|
||||
if(ekey) {
|
||||
ekey->flag |= PEK_USE_WCO;
|
||||
ekey++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free_bvhtree_from_mesh(&bvhtree);
|
||||
if(!psmd->dm->deformedOnly)
|
||||
dm->release(dm);
|
||||
|
||||
psys_free_path_cache(psys, psys->edit);
|
||||
|
||||
psys->flag &= ~PSYS_GLOBAL_HAIR;
|
||||
|
||||
PE_update_object(scene, ob, 0);
|
||||
}
|
||||
|
||||
static int connect_hair_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||
ParticleSystem *psys= NULL;
|
||||
int all = RNA_boolean_get(op->ptr, "all");
|
||||
|
||||
if(!ob)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
if(all) {
|
||||
for(psys=ob->particlesystem.first; psys; psys=psys->next) {
|
||||
connect_hair(scene, ob, psys);
|
||||
}
|
||||
}
|
||||
else {
|
||||
psys = ptr.data;
|
||||
connect_hair(scene, ob, psys);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void PARTICLE_OT_connect_hair(wmOperatorType *ot)
|
||||
{
|
||||
ot->name= "Connect Hair";
|
||||
ot->description= "Connect hair to the emitter mesh.";
|
||||
ot->idname= "PARTICLE_OT_connect_hair";
|
||||
|
||||
ot->exec= connect_hair_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "all", 0, "All hair", "Connect all hair systems to the emitter mesh");
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "physics_intern.h" // own include
|
||||
|
||||
/* enable/disable overall compilation */
|
||||
#ifndef DISABLE_ELBEEM
|
||||
|
||||
@@ -1200,8 +1202,3 @@ void FLUID_OT_bake(wmOperatorType *ot)
|
||||
ot->poll= ED_operator_object_active;
|
||||
}
|
||||
|
||||
void ED_operatortypes_fluid(void)
|
||||
{
|
||||
WM_operatortype_append(FLUID_OT_bake);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,72 @@
|
||||
#ifndef ED_PHYSICS_INTERN_H
|
||||
#define ED_PHYSICS_INTERN_H
|
||||
|
||||
struct wmOperatorType;
|
||||
|
||||
/* particle_edit.c */
|
||||
int PE_poll(struct bContext *C);
|
||||
int PE_hair_poll(struct bContext *C);
|
||||
int PE_poll_3dview(struct bContext *C);
|
||||
|
||||
void PARTICLE_OT_select_all_toggle(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_select_first(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_select_last(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_select_linked(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_select_less(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_select_more(struct wmOperatorType *ot);
|
||||
|
||||
void PARTICLE_OT_hide(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_reveal(struct wmOperatorType *ot);
|
||||
|
||||
void PARTICLE_OT_rekey(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_subdivide(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_remove_doubles(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_delete(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_mirror(struct wmOperatorType *ot);
|
||||
|
||||
void PARTICLE_OT_brush_set(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_brush_edit(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_brush_radial_control(struct wmOperatorType *ot);
|
||||
|
||||
void PARTICLE_OT_specials_menu(struct wmOperatorType *ot);
|
||||
|
||||
void PARTICLE_OT_particle_edit_toggle(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_edited_clear(struct wmOperatorType *ot);
|
||||
|
||||
/* particle_object.c */
|
||||
void OBJECT_OT_particle_system_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_particle_system_remove(struct wmOperatorType *ot);
|
||||
|
||||
void PARTICLE_OT_new(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_new_target(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_remove_target(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_target_move_up(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_target_move_down(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_connect_hair(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_disconnect_hair(struct wmOperatorType *ot);
|
||||
|
||||
/* particle_boids.c */
|
||||
void BOID_OT_rule_add(struct wmOperatorType *ot);
|
||||
void BOID_OT_rule_del(struct wmOperatorType *ot);
|
||||
void BOID_OT_rule_move_up(struct wmOperatorType *ot);
|
||||
void BOID_OT_rule_move_down(struct wmOperatorType *ot);
|
||||
|
||||
void BOID_OT_state_add(struct wmOperatorType *ot);
|
||||
void BOID_OT_state_del(struct wmOperatorType *ot);
|
||||
void BOID_OT_state_move_up(struct wmOperatorType *ot);
|
||||
void BOID_OT_state_move_down(struct wmOperatorType *ot);
|
||||
|
||||
/* physics_fluid.c */
|
||||
void FLUID_OT_bake(struct wmOperatorType *ot);
|
||||
|
||||
/* physics_pointcache.c */
|
||||
void PTCACHE_OT_bake_all(struct wmOperatorType *ot);
|
||||
void PTCACHE_OT_free_bake_all(struct wmOperatorType *ot);
|
||||
void PTCACHE_OT_bake(struct wmOperatorType *ot);
|
||||
void PTCACHE_OT_free_bake(struct wmOperatorType *ot);
|
||||
void PTCACHE_OT_bake_from_cache(struct wmOperatorType *ot);
|
||||
void PTCACHE_OT_add_new(struct wmOperatorType *ot);
|
||||
void PTCACHE_OT_remove(struct wmOperatorType *ot);
|
||||
|
||||
#endif /* ED_PHYSICS_INTERN_H */
|
||||
|
||||
|
||||
173
source/blender/editors/physics/physics_ops.c
Normal file
173
source/blender/editors/physics/physics_ops.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/**
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "ED_physics.h"
|
||||
|
||||
#include "physics_intern.h" // own include
|
||||
|
||||
/***************************** particles ***********************************/
|
||||
|
||||
static void operatortypes_particle(void)
|
||||
{
|
||||
WM_operatortype_append(PARTICLE_OT_select_all_toggle);
|
||||
WM_operatortype_append(PARTICLE_OT_select_first);
|
||||
WM_operatortype_append(PARTICLE_OT_select_last);
|
||||
WM_operatortype_append(PARTICLE_OT_select_linked);
|
||||
WM_operatortype_append(PARTICLE_OT_select_less);
|
||||
WM_operatortype_append(PARTICLE_OT_select_more);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_hide);
|
||||
WM_operatortype_append(PARTICLE_OT_reveal);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_rekey);
|
||||
WM_operatortype_append(PARTICLE_OT_subdivide);
|
||||
WM_operatortype_append(PARTICLE_OT_remove_doubles);
|
||||
WM_operatortype_append(PARTICLE_OT_delete);
|
||||
WM_operatortype_append(PARTICLE_OT_mirror);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_brush_set);
|
||||
WM_operatortype_append(PARTICLE_OT_brush_edit);
|
||||
WM_operatortype_append(PARTICLE_OT_brush_radial_control);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_specials_menu);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_particle_edit_toggle);
|
||||
WM_operatortype_append(PARTICLE_OT_edited_clear);
|
||||
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_particle_system_add);
|
||||
WM_operatortype_append(OBJECT_OT_particle_system_remove);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_new);
|
||||
WM_operatortype_append(PARTICLE_OT_new_target);
|
||||
WM_operatortype_append(PARTICLE_OT_remove_target);
|
||||
WM_operatortype_append(PARTICLE_OT_target_move_up);
|
||||
WM_operatortype_append(PARTICLE_OT_target_move_down);
|
||||
WM_operatortype_append(PARTICLE_OT_connect_hair);
|
||||
WM_operatortype_append(PARTICLE_OT_disconnect_hair);
|
||||
}
|
||||
|
||||
static void keymap_particle(wmWindowManager *wm)
|
||||
{
|
||||
wmKeyMap *keymap;
|
||||
|
||||
keymap= WM_keymap_find(wm, "Particle", 0, 0);
|
||||
keymap->poll= PE_poll;
|
||||
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1);
|
||||
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_delete", XKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_delete", DELKEY, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, 0, 0);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
|
||||
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", ACTIONMOUSE, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_brush_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
|
||||
|
||||
WM_keymap_add_item(keymap, "PARTICLE_OT_specials_menu", WKEY, KM_PRESS, 0, 0);
|
||||
}
|
||||
|
||||
/******************************* boids *************************************/
|
||||
|
||||
static void operatortypes_boids(void)
|
||||
{
|
||||
WM_operatortype_append(BOID_OT_rule_add);
|
||||
WM_operatortype_append(BOID_OT_rule_del);
|
||||
WM_operatortype_append(BOID_OT_rule_move_up);
|
||||
WM_operatortype_append(BOID_OT_rule_move_down);
|
||||
|
||||
WM_operatortype_append(BOID_OT_state_add);
|
||||
WM_operatortype_append(BOID_OT_state_del);
|
||||
WM_operatortype_append(BOID_OT_state_move_up);
|
||||
WM_operatortype_append(BOID_OT_state_move_down);
|
||||
}
|
||||
|
||||
/********************************* fluid ***********************************/
|
||||
|
||||
static void operatortypes_fluid(void)
|
||||
{
|
||||
WM_operatortype_append(FLUID_OT_bake);
|
||||
}
|
||||
|
||||
/**************************** point cache **********************************/
|
||||
|
||||
static void operatortypes_pointcache(void)
|
||||
{
|
||||
WM_operatortype_append(PTCACHE_OT_bake_all);
|
||||
WM_operatortype_append(PTCACHE_OT_free_bake_all);
|
||||
WM_operatortype_append(PTCACHE_OT_bake);
|
||||
WM_operatortype_append(PTCACHE_OT_free_bake);
|
||||
WM_operatortype_append(PTCACHE_OT_bake_from_cache);
|
||||
WM_operatortype_append(PTCACHE_OT_add_new);
|
||||
WM_operatortype_append(PTCACHE_OT_remove);
|
||||
}
|
||||
|
||||
//static void keymap_pointcache(wmWindowManager *wm)
|
||||
//{
|
||||
// wmKeyMap *keymap= WM_keymap_find(wm, "Pointcache", 0, 0);
|
||||
//
|
||||
// WM_keymap_add_item(keymap, "PHYSICS_OT_bake_all", AKEY, KM_PRESS, 0, 0);
|
||||
// WM_keymap_add_item(keymap, "PHYSICS_OT_free_all", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
|
||||
// WM_keymap_add_item(keymap, "PHYSICS_OT_bake_particle_system", PADMINUS, KM_PRESS, KM_CTRL, 0);
|
||||
// WM_keymap_add_item(keymap, "PHYSICS_OT_free_particle_system", LKEY, KM_PRESS, 0, 0);
|
||||
//}
|
||||
|
||||
/****************************** general ************************************/
|
||||
|
||||
void ED_operatortypes_physics(void)
|
||||
{
|
||||
operatortypes_particle();
|
||||
operatortypes_boids();
|
||||
operatortypes_fluid();
|
||||
operatortypes_pointcache();
|
||||
}
|
||||
|
||||
void ED_keymap_physics(wmWindowManager *wm)
|
||||
{
|
||||
keymap_particle(wm);
|
||||
//keymap_pointcache(wm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
@@ -332,26 +334,4 @@ void PTCACHE_OT_remove(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
/**************************** registration **********************************/
|
||||
|
||||
void ED_operatortypes_pointcache(void)
|
||||
{
|
||||
WM_operatortype_append(PTCACHE_OT_bake_all);
|
||||
WM_operatortype_append(PTCACHE_OT_free_bake_all);
|
||||
WM_operatortype_append(PTCACHE_OT_bake);
|
||||
WM_operatortype_append(PTCACHE_OT_free_bake);
|
||||
WM_operatortype_append(PTCACHE_OT_bake_from_cache);
|
||||
WM_operatortype_append(PTCACHE_OT_add_new);
|
||||
WM_operatortype_append(PTCACHE_OT_remove);
|
||||
}
|
||||
|
||||
//void ED_keymap_pointcache(wmWindowManager *wm)
|
||||
//{
|
||||
// wmKeyMap *keymap= WM_keymap_find(wm, "Pointcache", 0, 0);
|
||||
//
|
||||
// WM_keymap_add_item(keymap, "PHYSICS_OT_bake_all", AKEY, KM_PRESS, 0, 0);
|
||||
// WM_keymap_add_item(keymap, "PHYSICS_OT_free_all", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
|
||||
// WM_keymap_add_item(keymap, "PHYSICS_OT_bake_particle_system", PADMINUS, KM_PRESS, KM_CTRL, 0);
|
||||
// WM_keymap_add_item(keymap, "PHYSICS_OT_free_particle_system", LKEY, KM_PRESS, 0, 0);
|
||||
//}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#
|
||||
# Makes module object directory and bounces make to subdirectories.
|
||||
|
||||
LIBNAME = ed_preview
|
||||
LIBNAME = ed_render
|
||||
DIR = $(OCGDIR)/blender/$(LIBNAME)
|
||||
|
||||
include nan_compile.mk
|
||||
@@ -9,4 +9,4 @@ incs += ' #/intern/guardedalloc ../../gpu'
|
||||
incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern'
|
||||
incs += ' ../../blenloader'
|
||||
|
||||
env.BlenderLib ( 'bf_editors_preview', sources, Split(incs), [], libtype=['core'], priority=[45] )
|
||||
env.BlenderLib ( 'bf_editors_render', sources, Split(incs), [], libtype=['core'], priority=[45] )
|
||||
@@ -26,12 +26,24 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef PREVIEWRENDER_INTERN_H
|
||||
#define PREVIEWRENDER_INTERN_H
|
||||
#ifndef RENDER_INTERN_H
|
||||
#define RENDER_INTERN_H
|
||||
|
||||
/* internal exports only */
|
||||
struct wmOperatorType;
|
||||
|
||||
/* render_shading.c */
|
||||
void OBJECT_OT_material_slot_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_material_slot_remove(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_material_slot_assign(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_material_slot_select(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_material_slot_deselect(struct wmOperatorType *ot);
|
||||
|
||||
void MATERIAL_OT_new(struct wmOperatorType *ot);
|
||||
void TEXTURE_OT_new(struct wmOperatorType *ot);
|
||||
void WORLD_OT_new(struct wmOperatorType *ot);
|
||||
|
||||
#endif /* PREVIEWRENDER_INTERN_H */
|
||||
void SCENE_OT_render_layer_add(struct wmOperatorType *ot);
|
||||
void SCENE_OT_render_layer_remove(struct wmOperatorType *ot);
|
||||
|
||||
#endif /* RENDER_INTERN_H */
|
||||
|
||||
54
source/blender/editors/render/render_ops.c
Normal file
54
source/blender/editors/render/render_ops.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "render_intern.h" // own include
|
||||
|
||||
/***************************** render ***********************************/
|
||||
|
||||
void ED_operatortypes_render(void)
|
||||
{
|
||||
WM_operatortype_append(OBJECT_OT_material_slot_add);
|
||||
WM_operatortype_append(OBJECT_OT_material_slot_remove);
|
||||
WM_operatortype_append(OBJECT_OT_material_slot_assign);
|
||||
WM_operatortype_append(OBJECT_OT_material_slot_select);
|
||||
WM_operatortype_append(OBJECT_OT_material_slot_deselect);
|
||||
|
||||
WM_operatortype_append(MATERIAL_OT_new);
|
||||
WM_operatortype_append(TEXTURE_OT_new);
|
||||
WM_operatortype_append(WORLD_OT_new);
|
||||
|
||||
WM_operatortype_append(SCENE_OT_render_layer_add);
|
||||
WM_operatortype_append(SCENE_OT_render_layer_remove);
|
||||
}
|
||||
|
||||
@@ -88,12 +88,12 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "ED_previewrender.h"
|
||||
#include "ED_render.h"
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "previewrender_intern.h"
|
||||
#include "render_intern.h"
|
||||
|
||||
#define PR_XMIN 10
|
||||
#define PR_YMIN 5
|
||||
@@ -294,6 +294,14 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
|
||||
}
|
||||
|
||||
sce->r.color_mgt_flag = scene->r.color_mgt_flag;
|
||||
/* exception: don't color manage texture previews or icons */
|
||||
if((sp && sp->pr_method==PR_ICON_RENDER) || id_type == ID_TE)
|
||||
sce->r.color_mgt_flag &= ~R_COLOR_MANAGEMENT;
|
||||
if((sp && sp->pr_method==PR_ICON_RENDER) && id_type != ID_WO)
|
||||
sce->r.alphamode= R_ALPHAPREMUL;
|
||||
else
|
||||
sce->r.alphamode= R_ADDSKY;
|
||||
|
||||
sce->r.cfra= scene->r.cfra;
|
||||
|
||||
if(id_type==ID_MA) {
|
||||
@@ -364,9 +372,6 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
|
||||
|
||||
sce->lay= 1<<MA_TEXTURE;
|
||||
|
||||
/* exception: don't color manage texture previews */
|
||||
sce->r.color_mgt_flag &= ~R_COLOR_MANAGEMENT;
|
||||
|
||||
for(base= sce->base.first; base; base= base->next) {
|
||||
if(base->object->id.name[2]=='t') {
|
||||
Material *mat= give_current_material(base->object, base->object->actcol);
|
||||
@@ -1081,12 +1086,9 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
|
||||
ShaderPreview *sp;
|
||||
|
||||
/* XXX ugly global still, but we can't do preview while rendering */
|
||||
if(G.rendering)
|
||||
if(G.rendering) {
|
||||
printf("abort icon because rendering\n");
|
||||
return;
|
||||
|
||||
/* XXX this is not correct, can't work with threads */
|
||||
if(GS(id->name) == ID_TE) {
|
||||
ntreeTexSetPreviewFlag(1);
|
||||
}
|
||||
|
||||
steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner);
|
||||
@@ -1094,7 +1096,7 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
|
||||
|
||||
/* customdata for preview thread */
|
||||
sp->scene= CTX_data_scene(C);
|
||||
sp->owner= owner;
|
||||
sp->owner= id;
|
||||
sp->sizex= sizex;
|
||||
sp->sizey= sizey;
|
||||
sp->pr_method= PR_ICON_RENDER;
|
||||
@@ -1107,9 +1109,6 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
|
||||
WM_jobs_callbacks(steve, common_preview_startjob, NULL, NULL);
|
||||
|
||||
WM_jobs_start(CTX_wm_manager(C), steve);
|
||||
|
||||
/* signal to rerender icon in menus */
|
||||
BKE_icon_changed(BKE_icon_getid(id));
|
||||
}
|
||||
|
||||
void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, MTex *slot, int sizex, int sizey)
|
||||
@@ -1118,12 +1117,9 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
|
||||
ShaderPreview *sp;
|
||||
|
||||
/* XXX ugly global still, but we can't do preview while rendering */
|
||||
if(G.rendering)
|
||||
if(G.rendering) {
|
||||
printf("abort shader because rendering\n");
|
||||
return;
|
||||
|
||||
/* XXX this is not correct, can't work with threads */
|
||||
if(GS(id->name) == ID_TE) {
|
||||
ntreeTexSetPreviewFlag(1);
|
||||
}
|
||||
|
||||
steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner);
|
||||
@@ -1145,9 +1141,6 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
|
||||
WM_jobs_callbacks(steve, common_preview_startjob, NULL, shader_preview_updatejob);
|
||||
|
||||
WM_jobs_start(CTX_wm_manager(C), steve);
|
||||
|
||||
/* signal to rerender icon in menus */
|
||||
BKE_icon_changed(BKE_icon_getid(id));
|
||||
}
|
||||
|
||||
|
||||
645
source/blender/editors/render/render_shading.c
Normal file
645
source/blender/editors/render/render_shading.c
Normal file
@@ -0,0 +1,645 @@
|
||||
/**
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contributor(s): Blender Foundation
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_lamp_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_font.h"
|
||||
#include "BKE_icons.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_world.h"
|
||||
|
||||
#include "BLI_arithb.h"
|
||||
#include "BLI_editVert.h"
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "GPU_material.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_enum_types.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "ED_curve.h"
|
||||
#include "ED_mesh.h"
|
||||
#include "ED_render.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "render_intern.h" // own include
|
||||
|
||||
/***************************** Updates ***********************************
|
||||
* ED_render_id_flush_update gets called from DAG_id_flush_update, to do *
|
||||
* editor level updates when the ID changes. when these ID blocks are in *
|
||||
* the dependency graph, we can get rid of the manual dependency checks */
|
||||
|
||||
static int mtex_use_tex(MTex **mtex, int tot, Tex *tex)
|
||||
{
|
||||
int a;
|
||||
|
||||
if(!mtex)
|
||||
return 0;
|
||||
|
||||
for(a=0; a<tot; a++)
|
||||
if(mtex[a] && mtex[a]->tex == tex)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nodes_use_tex(bNodeTree *ntree, Tex *tex)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
for(node=ntree->nodes.first; node; node= node->next) {
|
||||
if(node->id) {
|
||||
if(node->id == (ID*)tex) {
|
||||
return 1;
|
||||
}
|
||||
else if(node->type==NODE_GROUP) {
|
||||
if(nodes_use_tex((bNodeTree *)node->id, tex))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void material_changed(Main *bmain, Material *ma)
|
||||
{
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&ma->id));
|
||||
|
||||
/* glsl */
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
static void texture_changed(Main *bmain, Tex *tex)
|
||||
{
|
||||
Material *ma;
|
||||
Lamp *la;
|
||||
World *wo;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&tex->id));
|
||||
|
||||
/* find materials */
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next) {
|
||||
if(mtex_use_tex(ma->mtex, MAX_MTEX, tex));
|
||||
else if(ma->use_nodes && ma->nodetree && nodes_use_tex(ma->nodetree, tex));
|
||||
else continue;
|
||||
|
||||
BKE_icon_changed(BKE_icon_getid(&ma->id));
|
||||
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
/* find lamps */
|
||||
for(la=bmain->lamp.first; la; la=la->id.next) {
|
||||
if(mtex_use_tex(la->mtex, MAX_MTEX, tex));
|
||||
else continue;
|
||||
|
||||
BKE_icon_changed(BKE_icon_getid(&la->id));
|
||||
}
|
||||
|
||||
/* find worlds */
|
||||
for(wo=bmain->world.first; wo; wo=wo->id.next) {
|
||||
if(mtex_use_tex(wo->mtex, MAX_MTEX, tex));
|
||||
else continue;
|
||||
|
||||
BKE_icon_changed(BKE_icon_getid(&wo->id));
|
||||
}
|
||||
}
|
||||
|
||||
static void lamp_changed(Main *bmain, Lamp *la)
|
||||
{
|
||||
Object *ob;
|
||||
Material *ma;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&la->id));
|
||||
|
||||
/* glsl */
|
||||
for(ob=bmain->object.first; ob; ob=ob->id.next)
|
||||
if(ob->data == la && ob->gpulamp.first)
|
||||
GPU_lamp_free(ob);
|
||||
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next)
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
static void world_changed(Main *bmain, World *wo)
|
||||
{
|
||||
Material *ma;
|
||||
|
||||
/* icons */
|
||||
BKE_icon_changed(BKE_icon_getid(&wo->id));
|
||||
|
||||
/* glsl */
|
||||
for(ma=bmain->mat.first; ma; ma=ma->id.next)
|
||||
if(ma->gpumaterial.first)
|
||||
GPU_material_free(ma);
|
||||
}
|
||||
|
||||
void ED_render_id_flush_update(Main *bmain, ID *id)
|
||||
{
|
||||
switch(GS(id->name)) {
|
||||
case ID_MA:
|
||||
material_changed(bmain, (Material*)id);
|
||||
break;
|
||||
case ID_TE:
|
||||
texture_changed(bmain, (Tex*)id);
|
||||
break;
|
||||
case ID_WO:
|
||||
world_changed(bmain, (World*)id);
|
||||
break;
|
||||
case ID_LA:
|
||||
lamp_changed(bmain, (Lamp*)id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/********************** material slot operators *********************/
|
||||
|
||||
static int material_slot_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
|
||||
if(!ob)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
object_add_material_slot(ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_material_slot_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Material Slot";
|
||||
ot->idname= "OBJECT_OT_material_slot_add";
|
||||
ot->description="Add a new material slot or duplicate the selected one.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= material_slot_add_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int material_slot_remove_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
|
||||
if(!ob)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
object_remove_material_slot(ob);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_material_slot_remove(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Remove Material Slot";
|
||||
ot->idname= "OBJECT_OT_material_slot_remove";
|
||||
ot->description="Remove the selected material slot.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= material_slot_remove_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int material_slot_assign_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
|
||||
if(!ob)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
if(ob && ob->actcol>0) {
|
||||
if(ob->type == OB_MESH) {
|
||||
EditMesh *em= ((Mesh*)ob->data)->edit_mesh;
|
||||
EditFace *efa;
|
||||
|
||||
if(em) {
|
||||
for(efa= em->faces.first; efa; efa=efa->next)
|
||||
if(efa->f & SELECT)
|
||||
efa->mat_nr= ob->actcol-1;
|
||||
}
|
||||
}
|
||||
else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
|
||||
ListBase *editnurb= ((Curve*)ob->data)->editnurb;
|
||||
Nurb *nu;
|
||||
|
||||
if(editnurb) {
|
||||
for(nu= editnurb->first; nu; nu= nu->next)
|
||||
if(isNurbsel(nu))
|
||||
nu->mat_nr= nu->charidx= ob->actcol-1;
|
||||
}
|
||||
}
|
||||
else if(ob->type == OB_FONT) {
|
||||
EditFont *ef= ((Curve*)ob->data)->editfont;
|
||||
int i, selstart, selend;
|
||||
|
||||
if(ef && BKE_font_getselection(ob, &selstart, &selend)) {
|
||||
for(i=selstart; i<=selend; i++)
|
||||
ef->textbufinfo[i].mat_nr = ob->actcol-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_material_slot_assign(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Assign Material Slot";
|
||||
ot->idname= "OBJECT_OT_material_slot_assign";
|
||||
ot->description="Assign the material in the selected material slot to the selected vertices.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= material_slot_assign_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int material_slot_de_select(bContext *C, int select)
|
||||
{
|
||||
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
|
||||
|
||||
if(!ob)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
if(ob->type == OB_MESH) {
|
||||
EditMesh *em= ((Mesh*)ob->data)->edit_mesh;
|
||||
|
||||
if(em) {
|
||||
if(select)
|
||||
EM_select_by_material(em, ob->actcol-1);
|
||||
else
|
||||
EM_deselect_by_material(em, ob->actcol-1);
|
||||
}
|
||||
}
|
||||
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
|
||||
ListBase *editnurb= ((Curve*)ob->data)->editnurb;
|
||||
Nurb *nu;
|
||||
BPoint *bp;
|
||||
BezTriple *bezt;
|
||||
int a;
|
||||
|
||||
for(nu= editnurb->first; nu; nu=nu->next) {
|
||||
if(nu->mat_nr==ob->actcol-1) {
|
||||
if(nu->bezt) {
|
||||
a= nu->pntsu;
|
||||
bezt= nu->bezt;
|
||||
while(a--) {
|
||||
if(bezt->hide==0) {
|
||||
if(select) {
|
||||
bezt->f1 |= SELECT;
|
||||
bezt->f2 |= SELECT;
|
||||
bezt->f3 |= SELECT;
|
||||
}
|
||||
else {
|
||||
bezt->f1 &= ~SELECT;
|
||||
bezt->f2 &= ~SELECT;
|
||||
bezt->f3 &= ~SELECT;
|
||||
}
|
||||
}
|
||||
bezt++;
|
||||
}
|
||||
}
|
||||
else if(nu->bp) {
|
||||
a= nu->pntsu*nu->pntsv;
|
||||
bp= nu->bp;
|
||||
while(a--) {
|
||||
if(bp->hide==0) {
|
||||
if(select) bp->f1 |= SELECT;
|
||||
else bp->f1 &= ~SELECT;
|
||||
}
|
||||
bp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int material_slot_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
return material_slot_de_select(C, 1);
|
||||
}
|
||||
|
||||
void OBJECT_OT_material_slot_select(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Select Material Slot";
|
||||
ot->idname= "OBJECT_OT_material_slot_select";
|
||||
ot->description="Select vertices assigned to the selected material slot.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= material_slot_select_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int material_slot_deselect_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
return material_slot_de_select(C, 0);
|
||||
}
|
||||
|
||||
void OBJECT_OT_material_slot_deselect(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Deselect Material Slot";
|
||||
ot->idname= "OBJECT_OT_material_slot_deselect";
|
||||
ot->description="Deselect vertices assigned to the selected material slot.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= material_slot_deselect_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/********************** new material operator *********************/
|
||||
|
||||
static int new_material_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
|
||||
Object *ob;
|
||||
PointerRNA ptr;
|
||||
int index;
|
||||
|
||||
/* add or copy material */
|
||||
if(ma)
|
||||
ma= copy_material(ma);
|
||||
else
|
||||
ma= add_material("Material");
|
||||
|
||||
ma->id.us--; /* compensating for us++ in assign_material */
|
||||
|
||||
/* attempt to assign to material slot */
|
||||
ptr= CTX_data_pointer_get_type(C, "material_slot", &RNA_MaterialSlot);
|
||||
|
||||
if(ptr.data) {
|
||||
ob= ptr.id.data;
|
||||
index= (Material**)ptr.data - ob->mat;
|
||||
|
||||
assign_material(ob, ma, index+1);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_MATERIAL|NA_ADDED, ma);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MATERIAL_OT_new(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "New Material";
|
||||
ot->idname= "MATERIAL_OT_new";
|
||||
ot->description="Add a new material.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= new_material_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/********************** new texture operator *********************/
|
||||
|
||||
static int new_texture_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
|
||||
ID *id;
|
||||
MTex *mtex;
|
||||
PointerRNA ptr;
|
||||
|
||||
/* add or copy texture */
|
||||
if(tex)
|
||||
tex= copy_texture(tex);
|
||||
else
|
||||
tex= add_texture("Texture");
|
||||
|
||||
id_us_min(&tex->id);
|
||||
|
||||
/* attempt to assign to texture slot */
|
||||
ptr= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot);
|
||||
|
||||
if(ptr.data) {
|
||||
id= ptr.id.data;
|
||||
mtex= ptr.data;
|
||||
|
||||
if(mtex) {
|
||||
if(mtex->tex)
|
||||
id_us_min(&mtex->tex->id);
|
||||
mtex->tex= tex;
|
||||
id_us_plus(&tex->id);
|
||||
}
|
||||
|
||||
/* XXX nodes, notifier .. */
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_TEXTURE|NA_ADDED, tex);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void TEXTURE_OT_new(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "New Texture";
|
||||
ot->idname= "TEXTURE_OT_new";
|
||||
ot->description="Add a new texture.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= new_texture_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/********************** new world operator *********************/
|
||||
|
||||
static int new_world_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data;
|
||||
|
||||
/* add or copy world */
|
||||
if(wo)
|
||||
wo= copy_world(wo);
|
||||
else
|
||||
wo= add_world("World");
|
||||
|
||||
/* assign to scene */
|
||||
if(scene->world)
|
||||
id_us_min(&scene->world->id);
|
||||
scene->world= wo;
|
||||
|
||||
WM_event_add_notifier(C, NC_WORLD|NA_ADDED, wo);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void WORLD_OT_new(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "New World";
|
||||
ot->idname= "WORLD_OT_new";
|
||||
ot->description= "Add a new world.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= new_world_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/********************** render layer operators *********************/
|
||||
|
||||
static int render_layer_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
|
||||
scene_add_render_layer(scene);
|
||||
scene->r.actlay= BLI_countlist(&scene->r.layers) - 1;
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void SCENE_OT_render_layer_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Render Layer";
|
||||
ot->idname= "SCENE_OT_render_layer_add";
|
||||
ot->description="Add a render layer.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= render_layer_add_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int render_layer_remove_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
SceneRenderLayer *rl;
|
||||
int act= scene->r.actlay;
|
||||
|
||||
if(BLI_countlist(&scene->r.layers) <= 1)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
rl= BLI_findlink(&scene->r.layers, scene->r.actlay);
|
||||
BLI_remlink(&scene->r.layers, rl);
|
||||
MEM_freeN(rl);
|
||||
|
||||
scene->r.actlay= 0;
|
||||
|
||||
if(scene->nodetree) {
|
||||
bNode *node;
|
||||
for(node= scene->nodetree->nodes.first; node; node= node->next) {
|
||||
if(node->type==CMP_NODE_R_LAYERS && node->id==NULL) {
|
||||
if(node->custom1==act)
|
||||
node->custom1= 0;
|
||||
else if(node->custom1>act)
|
||||
node->custom1--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void SCENE_OT_render_layer_remove(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Remove Render Layer";
|
||||
ot->idname= "SCENE_OT_render_layer_remove";
|
||||
ot->description="Remove the selected render layer.";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= render_layer_remove_exec;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
#include "ED_markers.h"
|
||||
#include "ED_mesh.h"
|
||||
#include "ED_object.h"
|
||||
#include "ED_particle.h"
|
||||
#include "ED_physics.h"
|
||||
#include "ED_render.h"
|
||||
#include "ED_screen.h"
|
||||
#include "ED_sculpt.h"
|
||||
#include "ED_space_api.h"
|
||||
@@ -92,15 +92,13 @@ void ED_spacetypes_init(void)
|
||||
ED_operatortypes_sculpt();
|
||||
ED_operatortypes_uvedit();
|
||||
ED_operatortypes_paint();
|
||||
ED_operatortypes_particle();
|
||||
ED_operatortypes_physics();
|
||||
ED_operatortypes_curve();
|
||||
ED_operatortypes_armature();
|
||||
ED_operatortypes_marker();
|
||||
ED_operatortypes_pointcache();
|
||||
ED_operatortypes_fluid();
|
||||
ED_operatortypes_metaball();
|
||||
ED_operatortypes_boids();
|
||||
ED_operatortypes_sound();
|
||||
ED_operatortypes_render();
|
||||
|
||||
ui_view2d_operatortypes();
|
||||
|
||||
@@ -127,7 +125,7 @@ void ED_spacetypes_keymap(wmWindowManager *wm)
|
||||
ED_keymap_uvedit(wm);
|
||||
ED_keymap_curve(wm);
|
||||
ED_keymap_armature(wm);
|
||||
ED_keymap_particle(wm);
|
||||
ED_keymap_physics(wm);
|
||||
ED_keymap_metaball(wm);
|
||||
ED_keymap_paint(wm);
|
||||
ED_marker_keymap(wm);
|
||||
|
||||
@@ -64,33 +64,6 @@ void buttons_context_draw(const struct bContext *C, struct uiLayout *layout);
|
||||
void buttons_context_register(struct ARegionType *art);
|
||||
|
||||
/* buttons_ops.c */
|
||||
void OBJECT_OT_group_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_group_remove(struct wmOperatorType *ot);
|
||||
|
||||
void OBJECT_OT_material_slot_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_material_slot_remove(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_material_slot_assign(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_material_slot_select(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_material_slot_deselect(struct wmOperatorType *ot);
|
||||
|
||||
void MATERIAL_OT_new(struct wmOperatorType *ot);
|
||||
void TEXTURE_OT_new(struct wmOperatorType *ot);
|
||||
void WORLD_OT_new(struct wmOperatorType *ot);
|
||||
|
||||
void OBJECT_OT_particle_system_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_particle_system_remove(struct wmOperatorType *ot);
|
||||
|
||||
void PARTICLE_OT_new(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_new_target(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_remove_target(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_target_move_up(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_target_move_down(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_connect_hair(struct wmOperatorType *ot);
|
||||
void PARTICLE_OT_disconnect_hair(struct wmOperatorType *ot);
|
||||
|
||||
void SCENE_OT_render_layer_add(struct wmOperatorType *ot);
|
||||
void SCENE_OT_render_layer_remove(struct wmOperatorType *ot);
|
||||
|
||||
void BUTTONS_OT_file_browse(struct wmOperatorType *ot);
|
||||
void BUTTONS_OT_toolbox(struct wmOperatorType *ot);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -57,7 +57,7 @@
|
||||
#include "UI_resources.h"
|
||||
#include "UI_view2d.h"
|
||||
|
||||
#include "ED_previewrender.h"
|
||||
#include "ED_render.h"
|
||||
|
||||
#include "buttons_intern.h" // own include
|
||||
|
||||
@@ -185,33 +185,6 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
|
||||
|
||||
void buttons_operatortypes(void)
|
||||
{
|
||||
WM_operatortype_append(OBJECT_OT_group_add);
|
||||
WM_operatortype_append(OBJECT_OT_group_remove);
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_material_slot_add);
|
||||
WM_operatortype_append(OBJECT_OT_material_slot_remove);
|
||||
WM_operatortype_append(OBJECT_OT_material_slot_assign);
|
||||
WM_operatortype_append(OBJECT_OT_material_slot_select);
|
||||
WM_operatortype_append(OBJECT_OT_material_slot_deselect);
|
||||
|
||||
WM_operatortype_append(MATERIAL_OT_new);
|
||||
WM_operatortype_append(TEXTURE_OT_new);
|
||||
WM_operatortype_append(WORLD_OT_new);
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_particle_system_add);
|
||||
WM_operatortype_append(OBJECT_OT_particle_system_remove);
|
||||
|
||||
WM_operatortype_append(PARTICLE_OT_new);
|
||||
WM_operatortype_append(PARTICLE_OT_new_target);
|
||||
WM_operatortype_append(PARTICLE_OT_remove_target);
|
||||
WM_operatortype_append(PARTICLE_OT_target_move_up);
|
||||
WM_operatortype_append(PARTICLE_OT_target_move_down);
|
||||
WM_operatortype_append(PARTICLE_OT_connect_hair);
|
||||
WM_operatortype_append(PARTICLE_OT_disconnect_hair);
|
||||
|
||||
WM_operatortype_append(SCENE_OT_render_layer_add);
|
||||
WM_operatortype_append(SCENE_OT_render_layer_remove);
|
||||
|
||||
WM_operatortype_append(BUTTONS_OT_toolbox);
|
||||
WM_operatortype_append(BUTTONS_OT_file_browse);
|
||||
}
|
||||
|
||||
@@ -313,16 +313,16 @@ static int get_file_icon(struct direntry *file)
|
||||
static void file_draw_icon(int sx, int sy, int icon, int width, int height)
|
||||
{
|
||||
float x,y;
|
||||
int blend=0;
|
||||
float alpha=1.0f;
|
||||
|
||||
x = (float)(sx);
|
||||
y = (float)(sy-height);
|
||||
|
||||
if (icon == ICON_FILE_BLANK) blend = -80;
|
||||
if (icon == ICON_FILE_BLANK) alpha = 0.375f;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
UI_icon_draw_aspect_blended(x, y, icon, 1.f, blend);
|
||||
UI_icon_draw_aspect(x, y, icon, 1.f, alpha);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
|
||||
icon_id= ICON_MATERIAL_DATA;
|
||||
iconofs-= 18.0f;
|
||||
glEnable(GL_BLEND);
|
||||
UI_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, icon_id, snode->aspect, -60);
|
||||
UI_icon_draw_aspect(iconofs, rct->ymax-NODE_DY+2, icon_id, snode->aspect, 0.5f);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
if(node->type == NODE_GROUP) {
|
||||
@@ -693,21 +693,18 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
|
||||
iconofs-= 18.0f;
|
||||
glEnable(GL_BLEND);
|
||||
if(node->id->lib) {
|
||||
glPixelTransferf(GL_GREEN_SCALE, 0.7f);
|
||||
glPixelTransferf(GL_BLUE_SCALE, 0.3f);
|
||||
UI_icon_draw_aspect(iconofs, rct->ymax-NODE_DY+2, ICON_NODE, snode->aspect);
|
||||
glPixelTransferf(GL_GREEN_SCALE, 1.0f);
|
||||
glPixelTransferf(GL_BLUE_SCALE, 1.0f);
|
||||
float rgb[3] = {1.0f, 0.7f, 0.3f};
|
||||
UI_icon_draw_aspect_color(iconofs, rct->ymax-NODE_DY+2, ICON_NODE, snode->aspect, rgb);
|
||||
}
|
||||
else {
|
||||
UI_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, ICON_NODE, snode->aspect, -60);
|
||||
UI_icon_draw_aspect(iconofs, rct->ymax-NODE_DY+2, ICON_NODE, snode->aspect, 0.5f);
|
||||
}
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
if(node->typeinfo->flag & NODE_OPTIONS) {
|
||||
iconofs-= 18.0f;
|
||||
glEnable(GL_BLEND);
|
||||
UI_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, ICON_BUTS, snode->aspect, -60);
|
||||
UI_icon_draw_aspect(iconofs, rct->ymax-NODE_DY+2, ICON_BUTS, snode->aspect, 0.5f);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
{ /* always hide/reveal unused sockets */
|
||||
@@ -720,7 +717,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
|
||||
else*/
|
||||
shade= -90;
|
||||
glEnable(GL_BLEND);
|
||||
UI_icon_draw_aspect_blended(iconofs, rct->ymax-NODE_DY+2, ICON_PLUS, snode->aspect, shade);
|
||||
UI_icon_draw_aspect(iconofs, rct->ymax-NODE_DY+2, ICON_PLUS, snode->aspect, 0.5f);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "ED_previewrender.h"
|
||||
#include "ED_render.h"
|
||||
|
||||
#include "BIF_gl.h"
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_node.h"
|
||||
|
||||
#include "ED_previewrender.h"
|
||||
#include "ED_render.h"
|
||||
#include "ED_space_api.h"
|
||||
#include "ED_screen.h"
|
||||
|
||||
|
||||
@@ -448,12 +448,21 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NC_WORLD:
|
||||
switch(wmn->data) {
|
||||
case ND_WORLD_DRAW:
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NC_LAMP:
|
||||
switch(wmn->data) {
|
||||
case ND_LIGHTING_DRAW:
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NC_IMAGE:
|
||||
/* this could be more fine grained checks if we had
|
||||
* more context than just the region */
|
||||
|
||||
@@ -1,7 +1,28 @@
|
||||
/**
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "DNA_listBase.h"
|
||||
|
||||
#ifndef DNA_MODIFIER_TYPES_H
|
||||
#define DNA_MODIFIER_TYPES_H
|
||||
|
||||
|
||||
@@ -419,7 +419,7 @@ extern Object workob;
|
||||
|
||||
#define OB_FROMDUPLI 512
|
||||
#define OB_DONE 1024
|
||||
#define OB_RADIO 2048
|
||||
#define OB_RADIO 2048 /* deprecated */
|
||||
#define OB_FROMGROUP 4096
|
||||
|
||||
/* ob->recalc (flag bits!) */
|
||||
|
||||
@@ -51,6 +51,9 @@ EnumPropertyItem brush_sculpt_tool_items[] = {
|
||||
|
||||
#include "BKE_texture.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
static void rna_Brush_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
{
|
||||
Brush *brush= (Brush*)ptr->data;
|
||||
@@ -87,6 +90,12 @@ static void rna_Brush_active_texture_set(PointerRNA *ptr, PointerRNA value)
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_Brush_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
Brush *br= (Brush*)ptr->data;
|
||||
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, br);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_brush(BlenderRNA *brna)
|
||||
@@ -118,130 +127,157 @@ static void rna_def_brush(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, prop_blend_items);
|
||||
RNA_def_property_ui_text(prop, "Blending mode", "Brush blending mode.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, brush_sculpt_tool_items);
|
||||
RNA_def_property_ui_text(prop, "Sculpt Tool", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
|
||||
RNA_def_property_enum_items(prop, prop_flip_direction_items);
|
||||
RNA_def_property_ui_text(prop, "Direction", "Mapping type to use for this image in the game engine.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
/* number values */
|
||||
prop= RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 1, 200);
|
||||
RNA_def_property_ui_text(prop, "Size", "Diameter of the brush.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "jitter", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "jitter");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Jitter", "Jitter the position of the brush while painting.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "spacing", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "spacing");
|
||||
RNA_def_property_range(prop, 1.0f, 100.0f);
|
||||
RNA_def_property_ui_text(prop, "Spacing", "Spacing between brush stamps.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 10, 200);
|
||||
RNA_def_property_ui_text(prop, "Smooth Stroke Radius", "Minimum distance from last point before stroke continues.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "smooth_stroke_factor", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.5, 0.99);
|
||||
RNA_def_property_ui_text(prop, "Smooth Stroke Factor", "Higher values give a smoother stroke.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "rate", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "rate");
|
||||
RNA_def_property_range(prop, 0.010f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Rate", "Number of paints per second for Airbrush.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "rgb");
|
||||
RNA_def_property_ui_text(prop, "Color", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "alpha");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Strength", "The amount of pressure on the brush.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
/* flag */
|
||||
prop= RNA_def_property(srna, "use_airbrush", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_AIRBRUSH);
|
||||
RNA_def_property_ui_text(prop, "Airbrush", "Keep applying paint effect while holding mouse (spray).");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_TORUS);
|
||||
RNA_def_property_ui_text(prop, "Wrap", "Enable torus wrapping while painting.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_strength_pressure", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE);
|
||||
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
|
||||
RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_size_pressure", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE);
|
||||
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
|
||||
RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_jitter_pressure", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_JITTER_PRESSURE);
|
||||
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
|
||||
RNA_def_property_ui_text(prop, "Jitter Pressure", "Enable tablet pressure sensitivity for jitter.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_spacing_pressure", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACING_PRESSURE);
|
||||
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
|
||||
RNA_def_property_ui_text(prop, "Spacing Pressure", "Enable tablet pressure sensitivity for spacing.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_rake", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RAKE);
|
||||
RNA_def_property_ui_text(prop, "Rake", "Rotate the brush texture to match the stroke direction.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_anchor", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ANCHORED);
|
||||
RNA_def_property_ui_text(prop, "Anchored", "Keep the brush anchored to the initial location.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_space", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE);
|
||||
RNA_def_property_ui_text(prop, "Space", "Limit brush application to the distance specified by spacing.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_smooth_stroke", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SMOOTH_STROKE);
|
||||
RNA_def_property_ui_text(prop, "Smooth Stroke", "Brush lags behind mouse and follows a smoother path.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PERSISTENT);
|
||||
RNA_def_property_ui_text(prop, "Persistent", "Sculpts on a persistent layer of the mesh.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
/* not exposed in the interface yet
|
||||
prop= RNA_def_property(srna, "fixed_tex", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX);
|
||||
RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position.");*/
|
||||
RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update"); */
|
||||
|
||||
prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
/* texture */
|
||||
rna_def_mtex_common(srna, "rna_Brush_mtex_begin", "rna_Brush_active_texture_get",
|
||||
"rna_Brush_active_texture_set", "TextureSlot");
|
||||
"rna_Brush_active_texture_set", "TextureSlot", "rna_Brush_update");
|
||||
|
||||
/* clone tool */
|
||||
prop= RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "clone.image");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Clone Image", "Image for clone tool.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "clone_opacity", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "clone.alpha");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Clone Opacity", "Opacity of clone image display.");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop= RNA_def_property(srna, "clone_offset", PROP_FLOAT, PROP_XYZ);
|
||||
RNA_def_property_float_sdna(prop, NULL, "clone.offset");
|
||||
RNA_def_property_ui_text(prop, "Clone Offset", "");
|
||||
RNA_def_property_ui_range(prop, -1.0f , 1.0f, 10.0f, 3);
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ void RNA_def_world(struct BlenderRNA *brna);
|
||||
void rna_def_animdata_common(struct StructRNA *srna);
|
||||
|
||||
void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable);
|
||||
void rna_def_mtex_common(struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname);
|
||||
void rna_def_mtex_common(struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *update);
|
||||
void rna_def_render_layer_common(struct StructRNA *srna, int scene);
|
||||
|
||||
void rna_ID_name_get(struct PointerRNA *ptr, char *value);
|
||||
|
||||
@@ -33,14 +33,17 @@
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
|
||||
#include "WM_types.h"
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_texture.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
static void rna_Lamp_buffer_size_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
Lamp *la= (Lamp*)ptr->data;
|
||||
@@ -113,6 +116,30 @@ static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_Lamp_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
Lamp *la= ptr->id.data;
|
||||
|
||||
DAG_id_flush_update(&la->id, 0);
|
||||
WM_event_add_notifier(C, NC_LAMP|ND_LIGHTING, la);
|
||||
}
|
||||
|
||||
static void rna_Lamp_draw_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
Lamp *la= ptr->id.data;
|
||||
|
||||
DAG_id_flush_update(&la->id, 0);
|
||||
WM_event_add_notifier(C, NC_LAMP|ND_LIGHTING_DRAW, la);
|
||||
}
|
||||
|
||||
static void rna_Lamp_sky_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
Lamp *la= ptr->id.data;
|
||||
|
||||
DAG_id_flush_update(&la->id, 0);
|
||||
WM_event_add_notifier(C, NC_LAMP|ND_SKY, la);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_lamp_mtex(BlenderRNA *brna)
|
||||
@@ -144,24 +171,24 @@ static void rna_def_lamp_mtex(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "map_color", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mapto", LAMAP_COL);
|
||||
RNA_def_property_ui_text(prop, "Color", "Lets the texture affect the basic color of the lamp.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "map_shadow", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mapto", LAMAP_SHAD);
|
||||
RNA_def_property_ui_text(prop, "Shadow", "Lets the texture affect the shadow color of the lamp.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "colfac");
|
||||
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
|
||||
RNA_def_property_ui_text(prop, "Color Factor", "Amount texture affects color values.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_factor", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "colfac");
|
||||
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
|
||||
RNA_def_property_ui_text(prop, "Shadow Factor", "Amount texture affects shadow.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
}
|
||||
|
||||
static void rna_def_lamp_sky_settings(BlenderRNA *brna)
|
||||
@@ -203,92 +230,92 @@ static void rna_def_lamp_sky_settings(BlenderRNA *brna)
|
||||
RNA_def_property_enum_sdna(prop, NULL, "sky_colorspace");
|
||||
RNA_def_property_enum_items(prop, prop_skycolorspace_items);
|
||||
RNA_def_property_ui_text(prop, "Sky Color Space", "Color space to use for internal XYZ->RGB color conversion.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "sky_blend_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "skyblendtype");
|
||||
RNA_def_property_enum_items(prop, prop_blendmode_items);
|
||||
RNA_def_property_ui_text(prop, "Sky Blend Mode", "Blend mode for combining sun sky with world sky.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
/* Number values */
|
||||
|
||||
prop= RNA_def_property(srna, "horizon_brightness", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, 20.0f);
|
||||
RNA_def_property_ui_text(prop, "Horizon Brightness", "Horizon brightness.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "spread", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Horizon Spread", "Horizon Spread.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "sun_brightness", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Sun Brightness", "Sun brightness.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Sun Size", "Sun size.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "backscattered_light", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, -1.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Backscattered Light", "Backscattered light.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "sun_intensity", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Sun Intensity", "Sun intensity.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "atmosphere_turbidity", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "atm_turbidity");
|
||||
RNA_def_property_range(prop, 1.0f, 30.0f);
|
||||
RNA_def_property_ui_text(prop, "Atmosphere Turbidity", "Sky turbidity.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "atmosphere_inscattering", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "atm_inscattering_factor");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Atmosphere Inscatter", "Scatter contribution factor.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "atmosphere_extinction", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "atm_extinction_factor");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Atmosphere Extinction", "Extinction scattering contribution factor.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "atmosphere_distance_factor", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "atm_distance_factor");
|
||||
RNA_def_property_range(prop, 0.0f, 500.0f);
|
||||
RNA_def_property_ui_text(prop, "Atmosphere Distance Factor", "Multiplier to convert blender units to physical distance.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "sky_blend", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "skyblendfac");
|
||||
RNA_def_property_range(prop, 0.0f, 2.0f);
|
||||
RNA_def_property_ui_text(prop, "Sky Blend", "Blend factor with sky.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "sky_exposure", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, 20.0f);
|
||||
RNA_def_property_ui_text(prop, "Sky Exposure", "Strength of sky shading exponential exposure correction.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
/* boolean */
|
||||
|
||||
prop= RNA_def_property(srna, "sky", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", LA_SUN_EFFECT_SKY);
|
||||
RNA_def_property_ui_text(prop, "Sky", "Apply sun effect on sky.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
|
||||
prop= RNA_def_property(srna, "atmosphere", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", LA_SUN_EFFECT_AP);
|
||||
RNA_def_property_ui_text(prop, "Atmosphere", "Apply sun effect on atmosphere.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
|
||||
}
|
||||
|
||||
static void rna_def_lamp(BlenderRNA *brna)
|
||||
@@ -312,48 +339,48 @@ static void rna_def_lamp(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, prop_type_items);
|
||||
RNA_def_property_ui_text(prop, "Type", "Type of Lamp.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "dist");
|
||||
RNA_def_property_ui_range(prop, 0, 1000, 1.0, 2);
|
||||
RNA_def_property_ui_text(prop, "Distance", "Falloff distance - the light is at half the original intensity at this point.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_ui_range(prop, 0, 10.0, 0.1, 2);
|
||||
RNA_def_property_ui_text(prop, "Energy", "Amount of light that the lamp emits.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "r");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Color", "Light color.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_LAYER);
|
||||
RNA_def_property_ui_text(prop, "Layer", "Illuminates objects only on the same layer the lamp is on.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "negative", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_NEG);
|
||||
RNA_def_property_ui_text(prop, "Negative", "Lamp casts negative light.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "specular", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", LA_NO_SPEC);
|
||||
RNA_def_property_ui_text(prop, "Specular", "Lamp creates specular highlights.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "diffuse", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", LA_NO_DIFF);
|
||||
RNA_def_property_ui_text(prop, "Diffuse", "Lamp does diffuse shading.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
/* textures */
|
||||
rna_def_mtex_common(srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get",
|
||||
"rna_Lamp_active_texture_set", "LampTextureSlot");
|
||||
"rna_Lamp_active_texture_set", "LampTextureSlot", "rna_Lamp_update");
|
||||
}
|
||||
|
||||
static void rna_def_lamp_falloff(StructRNA *srna)
|
||||
@@ -371,29 +398,29 @@ static void rna_def_lamp_falloff(StructRNA *srna)
|
||||
prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, prop_fallofftype_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff Type", "Intensity Decay with distance.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
|
||||
RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "sphere", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SPHERE);
|
||||
RNA_def_property_ui_text(prop, "Sphere", "Sets light intensity to zero beyond lamp distance.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "linear_attenuation", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "att1");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Linear Attenuation", "Linear distance attentuation.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "quadratic_attenuation", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "att2");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Quadratic Attenuation", "Quadratic distance attentuation.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
}
|
||||
|
||||
static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area)
|
||||
@@ -426,55 +453,55 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area)
|
||||
RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
|
||||
RNA_def_property_enum_items(prop, (spot)? prop_spot_shadow_items: prop_shadow_items);
|
||||
RNA_def_property_ui_text(prop, "Shadow Method", "Method to compute lamp shadow with.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "shdwr");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Shadow Color", "Color of shadows cast by the lamp.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "only_shadow", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_ONLYSHADOW);
|
||||
RNA_def_property_ui_text(prop, "Only Shadow", "Causes light to cast shadows only without illuminating objects.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_ray_sampling_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "ray_samp_method");
|
||||
RNA_def_property_enum_items(prop, (area)? prop_spot_ray_sampling_method_items: prop_ray_sampling_method_items);
|
||||
RNA_def_property_ui_text(prop, "Shadow Ray Sampling Method", "Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, (area)? "shadow_ray_samples_x": "shadow_ray_samples", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "ray_samp");
|
||||
RNA_def_property_range(prop, 1, 64);
|
||||
RNA_def_property_ui_text(prop, (area)? "Shadow Ray Samples": "Shadow Ray Samples X","Amount of samples taken extra (samples x samples).");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
if(area) {
|
||||
prop= RNA_def_property(srna, "shadow_ray_samples_y", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "ray_sampy");
|
||||
RNA_def_property_range(prop, 1, 64);
|
||||
RNA_def_property_ui_text(prop, "Shadow Ray Samples Y", "Amount of samples taken extra (samples x samples).");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
}
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_adaptive_threshold", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "adapt_thresh");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "Shadow Adaptive Threshold", "Threshold for Adaptive Sampling (Raytraced shadows).");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_soft_size", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "soft");
|
||||
RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
|
||||
RNA_def_property_ui_text(prop, "Shadow Soft Size", "Light size for ray shadow sampling (Raytraced shadows).");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_layer", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_LAYER_SHADOW);
|
||||
RNA_def_property_ui_text(prop, "Shadow Layer", "Causes only objects on the same layer to cast shadows.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
}
|
||||
|
||||
static void rna_def_point_lamp(BlenderRNA *brna)
|
||||
@@ -510,41 +537,41 @@ static void rna_def_area_lamp(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "umbra", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ray_samp_type", LA_SAMP_UMBRA);
|
||||
RNA_def_property_ui_text(prop, "Umbra", "Emphasize parts that are fully shadowed (Constant Jittered sampling).");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "dither", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ray_samp_type", LA_SAMP_DITHER);
|
||||
RNA_def_property_ui_text(prop, "Dither", "Use 2x2 dithering for sampling (Constant Jittered sampling).");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "jitter", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ray_samp_type", LA_SAMP_JITTER);
|
||||
RNA_def_property_ui_text(prop, "Jitter", "Use noise for sampling (Constant Jittered sampling).");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "area_shape");
|
||||
RNA_def_property_enum_items(prop, prop_areashape_items);
|
||||
RNA_def_property_ui_text(prop, "Shape", "Shape of the area lamp.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "area_size");
|
||||
RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
|
||||
RNA_def_property_ui_text(prop, "Size", "Size of the area of the area Lamp, X direction size for Rectangle shapes.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "area_sizey");
|
||||
RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
|
||||
RNA_def_property_ui_text(prop, "Size Y", "Size of the area of the area Lamp in the Y direction for Rectangle shapes.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "k");
|
||||
RNA_def_property_ui_range(prop, 0.001, 2.0, 0.1, 3);
|
||||
RNA_def_property_ui_text(prop, "Gamma", "Light gamma correction value.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
}
|
||||
|
||||
static void rna_def_spot_lamp(BlenderRNA *brna)
|
||||
@@ -581,101 +608,101 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "square", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SQUARE);
|
||||
RNA_def_property_ui_text(prop, "Square", "Casts a square spot light shape.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "halo", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_HALO);
|
||||
RNA_def_property_ui_text(prop, "Halo", "Renders spotlight with a volumetric halo (Buffer Shadows).");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "halo_intensity", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "haint");
|
||||
RNA_def_property_ui_range(prop, 0, 5.0, 0.1, 3);
|
||||
RNA_def_property_ui_text(prop, "Halo Intensity", "Brightness of the spotlight's halo cone (Buffer Shadows).");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "halo_step", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "shadhalostep");
|
||||
RNA_def_property_range(prop, 0, 12);
|
||||
RNA_def_property_ui_text(prop, "Halo Step", "Volumetric halo sampling frequency.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "bufsize");
|
||||
RNA_def_property_range(prop, 512, 10240);
|
||||
RNA_def_property_ui_text(prop, "Shadow Buffer Size", "Resolution of the shadow buffer, higher values give crisper shadows but use more memory");
|
||||
RNA_def_property_int_funcs(prop, NULL, "rna_Lamp_buffer_size_set", NULL);
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_filter_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "filtertype");
|
||||
RNA_def_property_enum_items(prop, prop_shadbuffiltertype_items);
|
||||
RNA_def_property_ui_text(prop, "Shadow Filter Type", "Type of shadow filter (Buffer Shadows).");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_sample_buffers", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "buffers");
|
||||
RNA_def_property_enum_items(prop, prop_numbuffer_items);
|
||||
RNA_def_property_ui_text(prop, "Shadow Sample Buffers", "Number of shadow buffers to render for better AA, this increases memory usage.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "spot_blend", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "spotblend");
|
||||
RNA_def_property_range(prop, 0.0f ,1.0f);
|
||||
RNA_def_property_ui_text(prop, "Spot Blend", "The softness of the spotlight edge.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "spotsize");
|
||||
RNA_def_property_range(prop, 1.0f ,180.0f);
|
||||
RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam in degrees.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "clipsta");
|
||||
RNA_def_property_range(prop, 0.0f, 9999.0f);
|
||||
RNA_def_property_ui_text(prop, "Shadow Buffer Clip Start", "Shadow map clip start: objects closer will not generate shadows");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "clipend");
|
||||
RNA_def_property_range(prop, 0.0f, 9999.0f);
|
||||
RNA_def_property_ui_text(prop, "Shadow Buffer Clip End", "Shadow map clip end beyond which objects will not generate shadows.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "bias");
|
||||
RNA_def_property_range(prop, 0.0f, 5.0f);
|
||||
RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Shadow buffer sampling bias.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_buffer_soft", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "soft");
|
||||
RNA_def_property_range(prop, 0.0f, 100.0f);
|
||||
RNA_def_property_ui_text(prop, "Shadow Buffer Soft", "Size of shadow buffer sampling area.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_buffer_samples", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "samp");
|
||||
RNA_def_property_range(prop, 1, 16);
|
||||
RNA_def_property_ui_text(prop, "Samples", "Number of shadow buffer samples.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "shadow_buffer_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "buftype");
|
||||
RNA_def_property_enum_items(prop, prop_shadbuftype_items);
|
||||
RNA_def_property_ui_text(prop, "Shadow Buffer Type", "Type of shadow buffer.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_update");
|
||||
|
||||
prop= RNA_def_property(srna, "auto_clip_start", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_START);
|
||||
RNA_def_property_ui_text(prop, "Autoclip Start", "Automatic calculation of clipping-start, based on visible vertices.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "auto_clip_end", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_END);
|
||||
RNA_def_property_ui_text(prop, "Autoclip End", "Automatic calculation of clipping-end, based on visible vertices.");
|
||||
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
|
||||
}
|
||||
|
||||
static void rna_def_sun_lamp(BlenderRNA *brna)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -34,14 +34,17 @@
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "WM_types.h"
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_texture.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
static PointerRNA rna_World_ambient_occlusion_get(PointerRNA *ptr)
|
||||
{
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_WorldAmbientOcclusion, ptr->id.data);
|
||||
@@ -95,6 +98,22 @@ static void rna_World_active_texture_set(PointerRNA *ptr, PointerRNA value)
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_World_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
World *wo= ptr->id.data;
|
||||
|
||||
DAG_id_flush_update(&wo->id, 0);
|
||||
WM_event_add_notifier(C, NC_WORLD, wo);
|
||||
}
|
||||
|
||||
static void rna_World_draw_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
World *wo= ptr->id.data;
|
||||
|
||||
DAG_id_flush_update(&wo->id, 0);
|
||||
WM_event_add_notifier(C, NC_WORLD|ND_WORLD_DRAW, wo);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_world_mtex(BlenderRNA *brna)
|
||||
@@ -119,22 +138,22 @@ static void rna_def_world_mtex(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "map_blend", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_BLEND);
|
||||
RNA_def_property_ui_text(prop, "Blend", "Affect the color progression of the background.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "map_horizon", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_HORIZ);
|
||||
RNA_def_property_ui_text(prop, "Horizon", "Affect the color of the horizon.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "map_zenith_up", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_ZENUP);
|
||||
RNA_def_property_ui_text(prop, "Zenith Up", "Affect the color of the zenith above.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "map_zenith_down", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_ZENDOWN);
|
||||
RNA_def_property_ui_text(prop, "Zenith Down", "Affect the color of the zenith below.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
/* unused
|
||||
prop= RNA_def_property(srna, "map_mist", PROP_BOOLEAN, PROP_NONE);
|
||||
@@ -145,38 +164,38 @@ static void rna_def_world_mtex(BlenderRNA *brna)
|
||||
RNA_def_property_enum_sdna(prop, NULL, "texco");
|
||||
RNA_def_property_enum_items(prop, texco_items);
|
||||
RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "object");
|
||||
RNA_def_property_struct_type(prop, "Object");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "varfac");
|
||||
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
|
||||
RNA_def_property_ui_text(prop, "Blend Factor", "Amount texture affects color progression of the background.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "horizon_factor", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "colfac");
|
||||
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
|
||||
RNA_def_property_ui_text(prop, "Horizon Factor", "Amount texture affects color of the horizon.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "zenith_up_factor", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "colfac");
|
||||
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
|
||||
RNA_def_property_ui_text(prop, "Zenith Up Factor", "Amount texture affects color of the zenith above.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "zenith_down_factor", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "colfac");
|
||||
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
|
||||
RNA_def_property_ui_text(prop, "Zenith Down Factor", "Amount texture affects color of the zenith below.");
|
||||
RNA_def_property_update(prop, NC_TEXTURE, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
}
|
||||
|
||||
static void rna_def_ambient_occlusion(BlenderRNA *brna)
|
||||
@@ -215,83 +234,100 @@ static void rna_def_ambient_occlusion(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_AMB_OCC);
|
||||
RNA_def_property_ui_text(prop, "Enabled", "Use Ambient Occlusion to add light based on distance between elements, creating the illusion of omnipresent light");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "aodist");
|
||||
RNA_def_property_ui_text(prop, "Distance", "Length of rays, defines how far away other faces give occlusion effect.");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "falloff_strength", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "aodistfac");
|
||||
RNA_def_property_ui_text(prop, "Strength", "Distance attenuation factor, the higher, the 'shorter' the shadows.");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "aoenergy");
|
||||
RNA_def_property_ui_range(prop, 0, 10, 0.1, 3);
|
||||
RNA_def_property_ui_text(prop, "Energy", "Amount of enerygy generated by ambient occlusion.");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "bias", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "aobias");
|
||||
RNA_def_property_range(prop, 0, 0.5);
|
||||
RNA_def_property_ui_text(prop, "Bias", "Bias (in radians) to prevent smoothed faces from showing banding (for Raytrace Constant Jittered).");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "ao_adapt_thresh");
|
||||
RNA_def_property_range(prop, 0, 1);
|
||||
RNA_def_property_ui_text(prop, "Threshold", "Samples below this threshold will be considered fully shadowed/unshadowed and skipped (for Raytrace Adaptive QMC).");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "adapt_to_speed", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "ao_adapt_speed_fac");
|
||||
RNA_def_property_range(prop, 0, 1);
|
||||
RNA_def_property_ui_text(prop, "Adapt To Speed", "Use the speed vector pass to reduce AO samples in fast moving pixels. Higher values result in more aggressive sample reduction. Requires Vec pass enabled (for Raytrace Adaptive QMC).");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "error_tolerance", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "ao_approx_error");
|
||||
RNA_def_property_range(prop, 0.0001, 10);
|
||||
RNA_def_property_ui_text(prop, "Error Tolerance", "Low values are slower and higher quality (for Approximate).");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "ao_approx_correction");
|
||||
RNA_def_property_range(prop, 0, 1);
|
||||
RNA_def_property_ui_range(prop, 0, 1, 0.1, 2);
|
||||
RNA_def_property_ui_text(prop, "Correction", "Ad-hoc correction for over-occlusion due to the approximation (for Approximate).");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "falloff", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AODIST);
|
||||
RNA_def_property_ui_text(prop, "Falloff", "");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "pixel_cache", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AOCACHE);
|
||||
RNA_def_property_ui_text(prop, "Pixel Cache", "Cache AO results in pixels and interpolate over neighbouring pixels for speedup (for Approximate).");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "aosamp");
|
||||
RNA_def_property_range(prop, 1, 32);
|
||||
RNA_def_property_ui_text(prop, "Samples", "Amount of ray samples. Higher values give smoother results and longer rendering times");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "aomix");
|
||||
RNA_def_property_enum_items(prop, blend_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Blend Mode", "Defines how AO mixes with material shading.");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "color", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "aocolor");
|
||||
RNA_def_property_enum_items(prop, prop_color_items);
|
||||
RNA_def_property_ui_text(prop, "Color", "Defines the color of the AO light");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "sample_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "ao_samp_method");
|
||||
RNA_def_property_enum_items(prop, prop_sample_method_items);
|
||||
RNA_def_property_ui_text(prop, "Sample Method", "Method for generating shadow samples (for Raytrace).");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "gather_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "ao_gather_method");
|
||||
RNA_def_property_enum_items(prop, prop_gather_method_items);
|
||||
RNA_def_property_ui_text(prop, "Gather Method", "");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "passes", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "ao_approx_passes");
|
||||
RNA_def_property_range(prop, 0, 10);
|
||||
RNA_def_property_ui_text(prop, "Passes", "Number of preprocessing passes to reduce overocclusion (for Approximate).");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
}
|
||||
|
||||
static void rna_def_world_mist(BlenderRNA *brna)
|
||||
@@ -313,35 +349,39 @@ static void rna_def_world_mist(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_MIST);
|
||||
RNA_def_property_ui_text(prop, "Enabled", "Occlude objects with the environment color as they are further away.");
|
||||
RNA_def_property_update(prop, 0, "rna_World_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "misi");
|
||||
RNA_def_property_range(prop, 0, 1);
|
||||
RNA_def_property_ui_text(prop, "Intensity", "Intensity of the mist effect.");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "miststa");
|
||||
RNA_def_property_range(prop, 0, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
|
||||
RNA_def_property_ui_text(prop, "Start", "Starting distance of the mist, measured from the camera");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "depth", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "mistdist");
|
||||
RNA_def_property_range(prop, 0, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
|
||||
RNA_def_property_ui_text(prop, "Depth", "The distance over which the mist effect fades in");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_draw_update");
|
||||
|
||||
prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "misthi");
|
||||
RNA_def_property_range(prop, 0, 100);
|
||||
RNA_def_property_ui_text(prop, "Height", "Control how much mist density decreases with height");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "mistype");
|
||||
RNA_def_property_enum_items(prop, falloff_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff", "Type of transition used to fade mist");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
}
|
||||
|
||||
static void rna_def_world_stars(BlenderRNA *brna)
|
||||
@@ -357,37 +397,38 @@ static void rna_def_world_stars(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS);
|
||||
RNA_def_property_ui_text(prop, "Enabled", "Enable starfield generation.");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "starsize");
|
||||
RNA_def_property_range(prop, 0, 10);
|
||||
RNA_def_property_ui_text(prop, "Size", "Average screen dimension of stars.");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "min_distance", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "starmindist");
|
||||
RNA_def_property_range(prop, 0, 1000);
|
||||
RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance to the camera for stars.");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "average_separation", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "stardist");
|
||||
RNA_def_property_range(prop, 2, 1000);
|
||||
RNA_def_property_ui_text(prop, "Average Separation", "Average distance between any two stars.");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "color_randomization", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "starcolnoise");
|
||||
RNA_def_property_range(prop, 0, 1);
|
||||
RNA_def_property_ui_text(prop, "Color Randomization", "Randomize star colors.");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
/* unused
|
||||
prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "starr");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Color", "Stars color.");*/
|
||||
RNA_def_property_ui_text(prop, "Color", "Stars color.");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");*/
|
||||
}
|
||||
|
||||
void RNA_def_world(BlenderRNA *brna)
|
||||
@@ -412,53 +453,55 @@ void RNA_def_world(BlenderRNA *brna)
|
||||
|
||||
rna_def_animdata_common(srna);
|
||||
rna_def_mtex_common(srna, "rna_World_mtex_begin", "rna_World_active_texture_get",
|
||||
"rna_World_active_texture_set", "WorldTextureSlot");
|
||||
"rna_World_active_texture_set", "WorldTextureSlot", "rna_World_update");
|
||||
|
||||
/* colors */
|
||||
prop= RNA_def_property(srna, "horizon_color", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "horr");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Horizon Color", "Color at the horizon.");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "zenr");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Zenith Color", "Color at the zenith.");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "ambient_color", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "ambr");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Ambient Color", "");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
/* exp, range */
|
||||
prop= RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "exp");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
RNA_def_property_ui_text(prop, "Exposure", "Amount of exponential color correction for light.");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "range");
|
||||
RNA_def_property_range(prop, 0.2, 5.0);
|
||||
RNA_def_property_ui_text(prop, "Range", "The color range that will be mapped to 0-1.");
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
/* sky type */
|
||||
prop= RNA_def_property(srna, "blend_sky", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYBLEND);
|
||||
RNA_def_property_ui_text(prop, "Blend Sky", "Render background with natural progression from horizon to zenith.");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "paper_sky", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYPAPER);
|
||||
RNA_def_property_ui_text(prop, "Paper Sky", "Flatten blend or texture coordinates.");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
prop= RNA_def_property(srna, "real_sky", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYREAL);
|
||||
RNA_def_property_ui_text(prop, "Real Sky", "Render background with a real horizon, relative to the camera angle.");
|
||||
RNA_def_property_update(prop, NC_WORLD, NULL);
|
||||
RNA_def_property_update(prop, 0, "rna_World_update");
|
||||
|
||||
/* nested structs */
|
||||
prop= RNA_def_property(srna, "ambient_occlusion", PROP_POINTER, PROP_NONE);
|
||||
|
||||
@@ -47,8 +47,6 @@
|
||||
|
||||
#define PREV_RES 128 /* default preview resolution */
|
||||
|
||||
int preview_flag = 0;
|
||||
|
||||
void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, short thread)
|
||||
{
|
||||
if(dg->node->need_exec)
|
||||
@@ -217,7 +215,8 @@ void ntreeTexExecTree(
|
||||
short thread,
|
||||
Tex *tex,
|
||||
short which_output,
|
||||
int cfra
|
||||
int cfra,
|
||||
int preview
|
||||
){
|
||||
TexResult dummy_texres;
|
||||
TexCallData data;
|
||||
@@ -231,21 +230,14 @@ void ntreeTexExecTree(
|
||||
data.dxt = dxt;
|
||||
data.dyt = dyt;
|
||||
data.target = texres;
|
||||
data.do_preview = preview_flag;
|
||||
data.do_preview = preview;
|
||||
data.thread = thread;
|
||||
data.which_output = which_output;
|
||||
data.cfra= cfra;
|
||||
|
||||
preview_flag = 0;
|
||||
|
||||
ntreeExecTree(nodes, &data, thread);
|
||||
}
|
||||
|
||||
void ntreeTexSetPreviewFlag(int doit)
|
||||
{
|
||||
preview_flag = doit;
|
||||
}
|
||||
|
||||
char* ntreeTexOutputMenu(bNodeTree *ntree)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
@@ -102,8 +102,6 @@ float tex_input_value(bNodeStack *in, TexParams *params, short thread);
|
||||
void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn);
|
||||
void tex_do_preview(bNode *node, bNodeStack *ns, TexCallData *cdata);
|
||||
|
||||
void ntreeTexExecTree(bNodeTree *nodes, TexResult *texres, float *coord, float *dxt, float *dyt, short thread, struct Tex *tex, short which_output, int cfra);
|
||||
|
||||
void params_from_cdata(TexParams *out, TexCallData *in);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -721,7 +721,7 @@ static int evalnodes(Tex *tex, float *texvec, float *dxt, float *dyt, TexResult
|
||||
short rv = TEX_INT;
|
||||
bNodeTree *nodes = tex->nodetree;
|
||||
|
||||
ntreeTexExecTree(nodes, texres, texvec, dxt, dyt, thread, tex, which_output, R.r.cfra);
|
||||
ntreeTexExecTree(nodes, texres, texvec, dxt, dyt, thread, tex, which_output, R.r.cfra, (R.r.scemode & R_NODE_PREVIEW));
|
||||
|
||||
if(texres->nor) rv |= TEX_NOR;
|
||||
rv |= TEX_RGB;
|
||||
|
||||
@@ -183,9 +183,12 @@ typedef struct wmNotifier {
|
||||
#define ND_SHADING_DRAW (31<<16)
|
||||
|
||||
/* NC_LAMP Lamp */
|
||||
#define ND_LIGHTING (44<<16)
|
||||
#define ND_LIGHTING_DRAW (45<<16)
|
||||
#define ND_SKY (46<<16)
|
||||
#define ND_LIGHTING (40<<16)
|
||||
#define ND_LIGHTING_DRAW (41<<16)
|
||||
#define ND_SKY (42<<16)
|
||||
|
||||
/* NC_WORLD World */
|
||||
#define ND_WORLD_DRAW (45<<16)
|
||||
|
||||
/* NC_TEXT Text */
|
||||
#define ND_CURSOR (50<<16)
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
#include "ED_armature.h"
|
||||
#include "ED_keyframing.h"
|
||||
#include "ED_node.h"
|
||||
#include "ED_previewrender.h"
|
||||
#include "ED_render.h"
|
||||
#include "ED_space_api.h"
|
||||
#include "ED_screen.h"
|
||||
#include "ED_util.h"
|
||||
@@ -89,6 +89,7 @@
|
||||
#include "GPU_extensions.h"
|
||||
#include "GPU_draw.h"
|
||||
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_sound.h"
|
||||
|
||||
static void wm_init_reports(bContext *C)
|
||||
@@ -112,6 +113,7 @@ void WM_init(bContext *C)
|
||||
|
||||
set_free_windowmanager_cb(wm_close_and_free); /* library.c */
|
||||
set_blender_test_break_cb(wm_window_testbreak); /* blender.c */
|
||||
DAG_editors_update_cb(ED_render_id_flush_update); /* depsgraph.c */
|
||||
|
||||
ED_spacetypes_init(); /* editors/space_api/spacetype.c */
|
||||
|
||||
@@ -128,6 +130,8 @@ void WM_init(bContext *C)
|
||||
|
||||
wm_init_reports(C); /* reports cant be initialized before the wm */
|
||||
|
||||
GPU_extensions_init();
|
||||
|
||||
UI_init();
|
||||
|
||||
// clear_matcopybuf(); /* XXX */
|
||||
@@ -138,8 +142,6 @@ void WM_init(bContext *C)
|
||||
|
||||
ED_preview_init_dbase();
|
||||
|
||||
GPU_extensions_init();
|
||||
|
||||
G.ndofdevice = -1; /* XXX bad initializer, needs set otherwise buttons show! */
|
||||
|
||||
read_Blog();
|
||||
|
||||
Reference in New Issue
Block a user