Blender Internal:
authorThomas Dinges <blender@dingto.org>
Wed, 20 Nov 2013 18:09:24 +0000 (19:09 +0100)
committerThomas Dinges <blender@dingto.org>
Wed, 20 Nov 2013 18:13:41 +0000 (19:13 +0100)
* Remove Stars feature. This was a quite minimalistic feature and there are
better alternatives with more control (particles for example).

Removal discussed during BCon13 developer meeting and already years before, time to do it..

Reviewed By: brecht
Differential Revision: http://developer.blender.org/D17

release/scripts/startup/bl_ui/properties_world.py
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/world.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/makesdna/DNA_ipo_types.h
source/blender/makesdna/DNA_world_types.h
source/blender/makesrna/intern/rna_world.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/source/convertblender.c

index 0b8d8a45a085921edafe3f5ba7931efc5ef7a0dc..0b6ce41eb5d9571bbb221cd182b6d1194fd5fa4a 100644 (file)
@@ -244,34 +244,6 @@ class WORLD_PT_mist(WorldButtonsPanel, Panel):
         layout.prop(world.mist_settings, "falloff")
 
 
-class WORLD_PT_stars(WorldButtonsPanel, Panel):
-    bl_label = "Stars"
-    bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
-
-    def draw_header(self, context):
-        world = context.world
-
-        self.layout.prop(world.star_settings, "use_stars", text="")
-
-    def draw(self, context):
-        layout = self.layout
-
-        world = context.world
-
-        layout.active = world.star_settings.use_stars
-
-        split = layout.split()
-
-        col = split.column()
-        col.prop(world.star_settings, "size")
-        col.prop(world.star_settings, "color_random", text="Colors")
-
-        col = split.column()
-        col.prop(world.star_settings, "distance_min", text="Min. Dist")
-        col.prop(world.star_settings, "average_separation", text="Separation")
-
-
 class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
     _context_path = "world"
index ecc4a03d2551e8c436ce4239e6a8baf7d21aa1f7..8ef3b7ef23d8829bde6b64a5399927d2225ef3ab 100644 (file)
@@ -712,17 +712,6 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index)
                        return "mist.start";
                case WO_MISTHI:
                        return "mist.height";
-
-               case WO_STAR_R:
-               case WO_STAR_G:
-               case WO_STAR_B:
-                       printf("WARNING: WO_STAR_R/G/B deprecated\n");
-                       return NULL;
-               
-               case WO_STARDIST:
-                       return "stars.min_distance";
-               case WO_STARSIZE:
-                       return "stars.size";
                
                default: /* for now, we assume that the others were MTex channels */
                        return mtex_adrcodes_to_paths(adrcode, array_index);
index 206f829eaa83e4b4f82c95656a8a36a7121456e8..c5a932e4173ef82fbabd5274e3636f2e3c1580bd 100644 (file)
@@ -92,8 +92,6 @@ World *add_world(Main *bmain, const char *name)
        wrld->zeng = 0.01f;
        wrld->zenb = 0.01f;
        wrld->skytype = 0;
-       wrld->stardist = 15.0f;
-       wrld->starsize = 2.0f;
 
        wrld->exp = 0.0f;
        wrld->exposure = wrld->range = 1.0f;
index 1bf137e578719eeb8cc5e725d4c8893f45480179..abdf017c6eebd0b33c86c903706c62fa834f8277 100644 (file)
@@ -64,7 +64,6 @@
 #include "BKE_movieclip.h"
 
 #include "RE_engine.h"
-#include "RE_pipeline.h"  /* make_stars */
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
@@ -3279,14 +3278,6 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
                if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
                        drawfloor(scene, v3d, grid_unit);
                }
-               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);
-                               }
-                       }
-               }
        }
        else {
                if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
index 2699c6e576e7505efd1354237175105d4d66883b..b4088cc5a5d1f5a76cf33276c08a04214371119c 100644 (file)
@@ -308,6 +308,7 @@ typedef struct Ipo {
 #define WO_MISTSTA     10
 #define WO_MISTHI      11
 
+/* Stars are deprecated */
 #define WO_STAR_R      12
 #define WO_STAR_G      13
 #define WO_STAR_B      14
index a0863b18cca73fbfdf3e6895beac5144c404e8d1..44f7813bda09470b0e15e23421f92271a5477a37 100644 (file)
@@ -96,8 +96,9 @@ typedef struct World {
        float misi, miststa, mistdist, misthi;
        
        float starr  DNA_DEPRECATED, starg  DNA_DEPRECATED, starb  DNA_DEPRECATED, stark  DNA_DEPRECATED; /* Deprecated */
-       float starsize, starmindist;
-       float stardist, starcolnoise;
+       
+       float starsize DNA_DEPRECATED, starmindist DNA_DEPRECATED;
+       float stardist DNA_DEPRECATED, starcolnoise DNA_DEPRECATED;
        
        /* unused now: DOF */
        short dofsta, dofend, dofmin, dofmax;
@@ -142,7 +143,7 @@ typedef struct World {
 
 /* mode */
 #define WO_MIST                       1
-#define WO_STARS               2
+#define WO_STARS               2 /* deprecated */
 /*#define WO_DOF                 4*/
 #define WO_ACTIVITY_CULLING       8
 #define WO_ENV_LIGHT                     16
index b689a82c23149cee4d0d23441c8355925b0e827a..c7997bebedbe80c7cf59045075876ce51dc8d0c8 100644 (file)
@@ -56,10 +56,6 @@ static PointerRNA rna_World_lighting_get(PointerRNA *ptr)
        return rna_pointer_inherit_refine(ptr, &RNA_WorldLighting, ptr->id.data);
 }
 
-static PointerRNA rna_World_stars_get(PointerRNA *ptr)
-{
-       return rna_pointer_inherit_refine(ptr, &RNA_WorldStarsSettings, ptr->id.data);
-}
 
 static PointerRNA rna_World_mist_get(PointerRNA *ptr)
 {
@@ -114,14 +110,6 @@ static void rna_World_draw_mist_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
        WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
 }
 
-static void rna_World_stars_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
-{
-       World *wo = ptr->id.data;
-
-       DAG_id_tag_update(&wo->id, 0);
-       WM_main_add_notifier(NC_WORLD | ND_WORLD_STARS, wo);
-}
-
 static void rna_World_use_nodes_update(bContext *C, PointerRNA *ptr)
 {
        World *wrld = (World *)ptr->data;
@@ -450,46 +438,6 @@ static void rna_def_world_mist(BlenderRNA *brna)
        RNA_def_property_update(prop, 0, "rna_World_update");
 }
 
-static void rna_def_world_stars(BlenderRNA *brna)
-{
-       StructRNA *srna;
-       PropertyRNA *prop;
-
-       srna = RNA_def_struct(brna, "WorldStarsSettings", NULL);
-       RNA_def_struct_sdna(srna, "World");
-       RNA_def_struct_nested(brna, srna, "World");
-       RNA_def_struct_ui_text(srna, "World Stars", "Stars settings for a World data-block");
-
-       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_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_draw_update"); /* use normal update since this isn't 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_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_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_stars_update");
-}
-
 void RNA_def_world(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -568,12 +516,6 @@ void RNA_def_world(BlenderRNA *brna)
        RNA_def_property_pointer_funcs(prop, "rna_World_mist_get", NULL, NULL, NULL);
        RNA_def_property_ui_text(prop, "Mist", "World mist settings");
 
-       prop = RNA_def_property(srna, "star_settings", PROP_POINTER, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_struct_type(prop, "WorldStarsSettings");
-       RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL, NULL, NULL);
-       RNA_def_property_ui_text(prop, "Stars", "World stars settings");
-
        /* nodes */
        prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
@@ -588,7 +530,6 @@ void RNA_def_world(BlenderRNA *brna)
 
        rna_def_lighting(brna);
        rna_def_world_mist(brna);
-       rna_def_world_stars(brna);
        rna_def_world_mtex(brna);
 }
 
index 79826a6369017215c0c5506f43ee3fee7116acb3..109524c9814522f1c5b03caaf65896cbb1d57325 100644 (file)
@@ -247,10 +247,6 @@ int RE_WriteEnvmapResult(struct ReportList *reports, struct Scene *scene, struct
 /* do a full sample buffer compo */
 void RE_MergeFullSample(struct Render *re, struct Main *bmain, struct Scene *sce, struct bNodeTree *ntree);
 
-/* ancient stars function... go away! */
-void RE_make_stars(struct Render *re, struct Scene *scenev3d, void (*initfunc)(void),
-                   void (*vertexfunc)(const float *),  void (*termfunc)(void));
-
 /* display and event callbacks */
 void RE_display_init_cb        (struct Render *re, void *handle, void (*f)(void *handle, RenderResult *rr));
 void RE_display_clear_cb(struct Render *re, void *handle, void (*f)(void *handle, RenderResult *rr));
index b4873e7d31061999c654e848f421454d3192cbf5..c5c804e97007d974e636d50923450ccbdef3539e 100644 (file)
@@ -160,175 +160,6 @@ static HaloRen *initstar(Render *re, ObjectRen *obr, const float vec[3], float h
        return har;
 }
 
-/* there must be a 'fixed' amount of stars generated between
- *         near and far
- * all stars must by preference lie on the far and solely
- *        differ in clarity/color
- */
-
-void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
-                   void (*vertexfunc)(const float *),  void (*termfunc)(void))
-{
-       extern unsigned char hash[512];
-       ObjectRen *obr= NULL;
-       World *wrld= NULL;
-       HaloRen *har;
-       Scene *scene;
-       Object *camera;
-       Camera *cam;
-       RNG *rng;
-       double dblrand, hlfrand;
-       float vec[4], fx, fy, fz;
-       float fac, starmindist, clipend;
-       float mat[4][4], stargrid, maxrand, maxjit, force, alpha;
-       int x, y, z, sx, sy, sz, ex, ey, ez, done = FALSE;
-       unsigned int totstar= 0;
-       
-       if (initfunc) {
-               scene= scenev3d;
-               wrld= scene->world;
-       }
-       else {
-               scene= re->scene;
-               wrld= &(re->wrld);
-       }
-
-       stargrid = wrld->stardist;                      /* distance between stars */
-       maxrand = 2.0;                                          /* amount a star can be shifted (in grid units) */
-       maxjit = (wrld->starcolnoise);          /* amount a color is being shifted */
-       
-       /* size of stars */
-       force = ( wrld->starsize );
-       
-       /* minimal free space (starting at camera) */
-       starmindist= wrld->starmindist;
-       
-       if (stargrid <= 0.10f) return;
-       
-       if (re) re->flag |= R_HALO;
-       else stargrid *= 1.0f;                          /* then it draws fewer */
-       
-       if (re) invert_m4_m4(mat, re->viewmat);
-       else unit_m4(mat);
-       
-       /* BOUNDING BOX CALCULATION
-        * bbox goes from z = loc_near_var | loc_far_var,
-        * x = -z | +z,
-        * y = -z | +z
-        */
-
-       camera= re ? RE_GetCamera(re) : scene->camera;
-
-       if (camera==NULL || camera->type != OB_CAMERA)
-               return;
-
-       cam = camera->data;
-       clipend = cam->clipend;
-       
-       /* convert to grid coordinates */
-       
-       sx = ((mat[3][0] - clipend) / stargrid) - maxrand;
-       sy = ((mat[3][1] - clipend) / stargrid) - maxrand;
-       sz = ((mat[3][2] - clipend) / stargrid) - maxrand;
-       
-       ex = ((mat[3][0] + clipend) / stargrid) + maxrand;
-       ey = ((mat[3][1] + clipend) / stargrid) + maxrand;
-       ez = ((mat[3][2] + clipend) / stargrid) + maxrand;
-       
-       dblrand = maxrand * stargrid;
-       hlfrand = 2.0 * dblrand;
-       
-       if (initfunc) {
-               initfunc();
-       }
-
-       if (re) /* add render object for stars */
-               obr= RE_addRenderObject(re, NULL, NULL, 0, 0, 0);
-       
-       rng = BLI_rng_new(0);
-       
-       for (x = sx, fx = sx * stargrid; x <= ex; x++, fx += stargrid) {
-               for (y = sy, fy = sy * stargrid; y <= ey; y++, fy += stargrid) {
-                       for (z = sz, fz = sz * stargrid; z <= ez; z++, fz += stargrid) {
-
-                               BLI_rng_seed(rng, (hash[z & 0xff] << 24) + (hash[y & 0xff] << 16) + (hash[x & 0xff] << 8));
-                               vec[0] = fx + (hlfrand * BLI_rng_get_double(rng)) - dblrand;
-                               vec[1] = fy + (hlfrand * BLI_rng_get_double(rng)) - dblrand;
-                               vec[2] = fz + (hlfrand * BLI_rng_get_double(rng)) - dblrand;
-                               vec[3] = 1.0;
-                               
-                               if (vertexfunc) {
-                                       if (done & 1) vertexfunc(vec);
-                                       done++;
-                               }
-                               else {
-                                       if (re)
-                                               mul_m4_v3(re->viewmat, vec);
-                                       
-                                       /* in vec are global coordinates
-                                        * calculate distance to camera
-                                        * and using that, define the alpha
-                                        */
-                                       alpha = len_v3(vec);
-
-                                       if (alpha >= clipend) alpha = 0.0;
-                                       else if (alpha <= starmindist) alpha = 0.0;
-                                       else if (alpha <= 2.0f * starmindist) {
-                                               alpha = (alpha - starmindist) / starmindist;
-                                       }
-                                       else {
-                                               alpha -= 2.0f * starmindist;
-                                               alpha /= (clipend - 2.0f * starmindist);
-                                               alpha = 1.0f - alpha;
-                                       }
-                                       
-                                       
-                                       if (alpha != 0.0f) {
-                                               fac = force * BLI_rng_get_double(rng);
-                                               
-                                               har = initstar(re, obr, vec, fac);
-                                               
-                                               if (har) {
-                                                       har->alfa = sqrt(sqrt(alpha));
-                                                       har->add= 255;
-                                                       har->r = har->g = har->b = 1.0;
-                                                       if (maxjit) {
-                                                               har->r += ((maxjit * BLI_rng_get_double(rng)) ) - maxjit;
-                                                               har->g += ((maxjit * BLI_rng_get_double(rng)) ) - maxjit;
-                                                               har->b += ((maxjit * BLI_rng_get_double(rng)) ) - maxjit;
-                                                       }
-                                                       har->hard = 32;
-                                                       har->lay= -1;
-                                                       har->type |= HA_ONLYSKY;
-                                                       done++;
-                                               }
-                                       }
-                               }
-
-                               /* break out of the loop if generating stars takes too long */
-                               if (re && !(totstar % 1000000)) {
-                                       if (re->test_break(re->tbh)) {
-                                               x= ex + 1;
-                                               y= ey + 1;
-                                               z= ez + 1;
-                                       }
-                               }
-                               
-                               totstar++;
-                       }
-                       /* do not call blender_test_break() here, since it is used in UI as well, confusing the callback system */
-                       /* main cause is G.is_break of course, a global again... (ton) */
-               }
-       }
-       if (termfunc) termfunc();
-
-       if (obr)
-               re->tothalo += obr->tothalo;
-
-       BLI_rng_free(rng);
-}
-
-
 /* ------------------------------------------------------------------------- */
 /* tool functions/defines for ad hoc simplification and possible future 
  * cleanup      */
@@ -5370,13 +5201,6 @@ void RE_Database_Preprocess(Render *re)
 
                /* don't sort stars */
                tothalo= re->tothalo;
-               if (!re->test_break(re->tbh)) {
-                       if (re->wrld.mode & WO_STARS) {
-                               re->i.infostr = IFACE_("Creating Starfield");
-                               re->stats_draw(re->sdh, &re->i);
-                               RE_make_stars(re, NULL, NULL, NULL, NULL);
-                       }
-               }
                sort_halos(re, tothalo);
                
                init_camera_inside_volumes(re);