bugfix [#24708] World Notifier Problems

also draw stars when 'Only Render' option is enabled.
This commit is contained in:
2010-11-15 08:53:35 +00:00
parent 4661fb03a9
commit df9bedddcf
4 changed files with 35 additions and 15 deletions

View File

@@ -654,6 +654,13 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_WORLD_DRAW:
/* handled by space_view3d_listener() for v3d access */
break;
case ND_WORLD_STARS:
{
RegionView3D *rv3d= ar->regiondata;
if(rv3d->persp == RV3D_CAMOB) {
ED_region_tag_redraw(ar);
}
}
}
break;
case NC_LAMP:

View File

@@ -2332,22 +2332,25 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
// needs to be done always, gridview is adjusted in drawgrid() now
rv3d->gridview= v3d->grid;
if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
if(rv3d->view==0 || rv3d->persp != RV3D_ORTHO) {
if(rv3d->view==0 || rv3d->persp != RV3D_ORTHO) {
if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
drawfloor(scene, v3d);
if(rv3d->persp==RV3D_CAMOB) {
if(scene->world) {
if(scene->world->mode & WO_STARS) {
RE_make_stars(NULL, scene, star_stuff_init_func, star_stuff_vertex_func,
star_stuff_term_func);
}
}
if(rv3d->persp==RV3D_CAMOB) {
if(scene->world) {
if(scene->world->mode & WO_STARS) {
RE_make_stars(NULL, scene, star_stuff_init_func, star_stuff_vertex_func,
star_stuff_term_func);
}
}
if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
if(v3d->flag & V3D_DISPBGPICS) draw_bgpic(scene, ar, v3d);
}
}
else {
}
else {
if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
ED_region_pixelspace(ar);
drawgrid(&scene->unit, ar, v3d, &grid_unit);
/* XXX make function? replaces persp(1) */

View File

@@ -98,6 +98,15 @@ static void rna_World_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, wo);
}
static void rna_World_stars_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
World *wo= ptr->id.data;
DAG_id_flush_update(&wo->id, 0);
WM_main_add_notifier(NC_WORLD|ND_WORLD_STARS, wo);
}
#else
static void rna_def_world_mtex(BlenderRNA *brna)
@@ -414,31 +423,31 @@ static void rna_def_world_stars(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS);
RNA_def_property_ui_text(prop, "Use Stars", "Enable starfield generation");
RNA_def_property_update(prop, 0, "rna_World_draw_update");
RNA_def_property_update(prop, 0, "rna_World_stars_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, 0, "rna_World_update");
RNA_def_property_update(prop, 0, "rna_World_draw_update"); /* use normal update since this isnt visualized */
prop= RNA_def_property(srna, "distance_min", 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, 0, "rna_World_update");
RNA_def_property_update(prop, 0, "rna_World_stars_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, 0, "rna_World_draw_update");
RNA_def_property_update(prop, 0, "rna_World_stars_update");
prop= RNA_def_property(srna, "color_random", 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, 0, "rna_World_update");
RNA_def_property_update(prop, 0, "rna_World_stars_update");
/* unused
prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);

View File

@@ -219,6 +219,7 @@ typedef struct wmNotifier {
/* NC_WORLD World */
#define ND_WORLD_DRAW (45<<16)
#define ND_WORLD_STARS (46<<16)
/* NC_TEXT Text */
#define ND_CURSOR (50<<16)