Commit: 78a8d3685bd3487eb0b5dd55793f94fe7235e377
Author: Bastien Montagne
Date:   Mon Jun 11 15:40:37 2018 +0200
Branches: master
https://developer.blender.org/rB78a8d3685bd3487eb0b5dd55793f94fe7235e377

Cleanup: remove moar ugly G.main usages...

BKE_image was an ugly nest, could fix all but the ones from compositor,
so moved ugly G.main there, at least we know where the Evil is that way ;)

===================================================================

M       source/blender/blenkernel/BKE_image.h
M       source/blender/blenkernel/BKE_mesh.h
M       source/blender/blenkernel/BKE_node.h
M       source/blender/blenkernel/intern/bpath.c
M       source/blender/blenkernel/intern/image.c
M       source/blender/blenkernel/intern/mesh_convert.c
M       source/blender/blenkernel/intern/node.c
M       source/blender/blenkernel/intern/packedFile.c
M       source/blender/collada/DocumentImporter.cpp
M       source/blender/compositor/operations/COM_CompositorOperation.cpp
M       source/blender/editors/include/ED_node.h
M       source/blender/editors/interface/interface_eyedropper_color.c
M       source/blender/editors/object/object_add.c
M       source/blender/editors/render/render_internal.c
M       source/blender/editors/render/render_opengl.c
M       source/blender/editors/render/render_view.c
M       source/blender/editors/sculpt_paint/paint_image_proj.c
M       source/blender/editors/space_image/image_edit.c
M       source/blender/editors/space_image/image_ops.c
M       source/blender/editors/space_node/drawnode.c
M       source/blender/editors/space_node/node_add.c
M       source/blender/editors/space_node/node_edit.c
M       source/blender/editors/space_node/node_view.c
M       source/blender/makesrna/intern/rna_color.c
M       source/blender/makesrna/intern/rna_image.c
M       source/blender/makesrna/intern/rna_image_api.c
M       source/blender/makesrna/intern/rna_main_api.c
M       source/blender/makesrna/intern/rna_nodetree.c
M       source/blender/makesrna/intern/rna_scene.c
M       source/blender/nodes/composite/node_composite_tree.c
M       source/blender/nodes/composite/nodes/node_composite_splitViewer.c
M       source/blender/nodes/composite/nodes/node_composite_viewer.c
M       source/blender/nodes/shader/node_shader_tree.c
M       source/blender/nodes/texture/node_texture_tree.c
M       source/blender/render/intern/source/convertblender.c
M       source/blender/render/intern/source/pipeline.c
M       source/blender/windowmanager/intern/wm_draw.c
M       source/blender/windowmanager/intern/wm_operators.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_image.h 
b/source/blender/blenkernel/BKE_image.h
index 1af123759e6..fc018dbfe81 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -190,25 +190,25 @@ void BKE_image_alpha_mode_from_extension(struct Image 
*image);
 /* returns a new image or NULL if it can't load */
 struct Image *BKE_image_load(struct Main *bmain, const char *filepath);
 /* returns existing Image when filename/type is same (frame optional) */
-struct Image *BKE_image_load_exists_ex(const char *filepath, bool *r_exists);
-struct Image *BKE_image_load_exists(const char *filepath);
+struct Image *BKE_image_load_exists_ex(struct Main *bmain, const char 
*filepath, bool *r_exists);
+struct Image *BKE_image_load_exists(struct Main *bmain, const char *filepath);
 
 /* adds image, adds ibuf, generates color or pattern */
 struct Image *BKE_image_add_generated(
         struct Main *bmain, unsigned int width, unsigned int height, const 
char *name,
         int depth, int floatbuf, short gen_type, const float color[4], const 
bool stereo3d);
 /* adds image from imbuf, owns imbuf */
-struct Image *BKE_image_add_from_imbuf(struct ImBuf *ibuf, const char *name);
+struct Image *BKE_image_add_from_imbuf(struct Main *bmain, struct ImBuf *ibuf, 
const char *name);
 
 /* for reload, refresh, pack */
 void BKE_image_init_imageuser(struct Image *ima, struct ImageUser *iuser);
-void BKE_image_signal(struct Image *ima, struct ImageUser *iuser, int signal);
+void BKE_image_signal(struct Main *bmain, struct Image *ima, struct ImageUser 
*iuser, int signal);
 
 void BKE_image_walk_all_users(const struct Main *mainp, void *customdata,
                               void callback(struct Image *ima, struct 
ImageUser *iuser, void *customdata));
 
 /* ensures an Image exists for viewing nodes or render */
-struct Image *BKE_image_verify_viewer(int type, const char *name);
+struct Image *BKE_image_verify_viewer(struct Main *bmain, int type, const char 
*name);
 /* ensures the view node cache is compatible with the scene views */
 void BKE_image_verify_viewer_views(const struct RenderData *rd, struct Image 
*ima, struct ImageUser *iuser);
 
@@ -242,27 +242,27 @@ void BKE_image_backup_render(struct Scene *scene, struct 
Image *ima, bool free_c
 bool BKE_image_save_openexr_multiview(struct Image *ima, struct ImBuf *ibuf, 
const char *filepath, const int flags);
 
 /* goes over all textures that use images */
-void    BKE_image_free_all_textures(void);
+void    BKE_image_free_all_textures(struct Main *bmain);
 
 /* does one image! */
 void    BKE_image_free_anim_ibufs(struct Image *ima, int except_frame);
 
 /* does all images with type MOVIE or SEQUENCE */
-void BKE_image_all_free_anim_ibufs(int except_frame);
+void BKE_image_all_free_anim_ibufs(struct Main *bmain, int except_frame);
 
 void BKE_image_memorypack(struct Image *ima);
 void BKE_image_packfiles(struct ReportList *reports, struct Image *ima, const 
char *basepath);
 void BKE_image_packfiles_from_mem(struct ReportList *reports, struct Image 
*ima, char *data, const size_t data_len);
 
 /* prints memory statistics for images */
-void BKE_image_print_memlist(void);
+void BKE_image_print_memlist(struct Main *bmain);
 
 /* empty image block, of similar type and filename */
 void BKE_image_copy_data(struct Main *bmain, struct Image *ima_dst, const 
struct Image *ima_src, const int flag);
 struct Image *BKE_image_copy(struct Main *bmain, const struct Image *ima);
 
 /* merge source into dest, and free source */
-void BKE_image_merge(struct Image *dest, struct Image *source);
+void BKE_image_merge(struct Main *bmain, struct Image *dest, struct Image 
*source);
 
 /* scale the image */
 bool BKE_image_scale(struct Image *image, int width, int height);
diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index 2c7ba845960..3d69358960f 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -154,10 +154,10 @@ int BKE_mesh_nurbs_displist_to_mdata(
         struct MLoop **r_allloop, struct MPoly **r_allpoly,
         struct MLoopUV **r_alluv, int *r_totloop, int *r_totpoly);
 void BKE_mesh_from_nurbs_displist(
-        struct Object *ob, struct ListBase *dispbase, const bool use_orco_uv, 
const char *obdata_name);
-void BKE_mesh_from_nurbs(struct Object *ob);
+        struct Main *bmain, struct Object *ob, struct ListBase *dispbase, 
const bool use_orco_uv, const char *obdata_name);
+void BKE_mesh_from_nurbs(struct Main *bmain, struct Object *ob);
 void BKE_mesh_to_curve_nurblist(struct DerivedMesh *dm, struct ListBase 
*nurblist, const int edge_users_test);
-void BKE_mesh_to_curve(struct Scene *scene, struct Object *ob);
+void BKE_mesh_to_curve(struct Main *bmain, struct Scene *scene, struct Object 
*ob);
 
 struct Mesh *BKE_mesh_new_from_object(
         struct Main *bmain, struct Scene *sce, struct Object *ob,
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 7a3bf81a2af..5439b16e211 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -291,7 +291,7 @@ typedef struct bNodeTreeType {
        /* calls allowing threaded composite */
        void (*localize)(struct bNodeTree *localtree, struct bNodeTree *ntree);
        void (*local_sync)(struct bNodeTree *localtree, struct bNodeTree 
*ntree);
-       void (*local_merge)(struct bNodeTree *localtree, struct bNodeTree 
*ntree);
+       void (*local_merge)(struct Main *bmain, struct bNodeTree *localtree, 
struct bNodeTree *ntree);
 
        /* Tree update. Overrides nodetype->updatetreefunc! */
        void (*update)(struct bNodeTree *ntree);
@@ -369,7 +369,7 @@ int             ntreeOutputExists(struct bNode *node, 
struct bNodeSocket *testso
 void            ntreeNodeFlagSet(const bNodeTree *ntree, const int flag, const 
bool enable);
 struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree);
 void            ntreeLocalSync(struct bNodeTree *localtree, struct bNodeTree 
*ntree);
-void            ntreeLocalMerge(struct bNodeTree *localtree, struct bNodeTree 
*ntree);
+void            ntreeLocalMerge(struct Main *bmain, struct bNodeTree 
*localtree, struct bNodeTree *ntree);
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/bpath.c 
b/source/blender/blenkernel/intern/bpath.c
index e6be42088db..0b191e1f69b 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -442,7 +442,7 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, 
BPathVisitor visit_cb, const int
                                                            /* image may have 
been painted onto (and not saved, T44543) */
                                                            
!BKE_image_is_dirty(ima))
                                                        {
-                                                               
BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
+                                                               
BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_RELOAD);
                                                                
BKE_image_walk_all_users(bmain, ima, bpath_traverse_image_user_cb);
                                                        }
                                                }
diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index 1d909ba1a76..95fb96c875f 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -500,7 +500,7 @@ void BKE_image_make_local(Main *bmain, Image *ima, const 
bool lib_local)
        BKE_id_make_local_generic(bmain, &ima->id, true, lib_local);
 }
 
-void BKE_image_merge(Image *dest, Image *source)
+void BKE_image_merge(Main *bmain, Image *dest, Image *source)
 {
        /* sanity check */
        if (dest && source && dest != source) {
@@ -518,7 +518,7 @@ void BKE_image_merge(Image *dest, Image *source)
                }
                BLI_spin_unlock(&image_spin);
 
-               BKE_libblock_free(G.main, source);
+               BKE_libblock_free(bmain, source);
        }
 }
 
@@ -617,7 +617,7 @@ Image *BKE_image_load(Main *bmain, const char *filepath)
 /* otherwise creates new. */
 /* does not load ibuf itself */
 /* pass on optional frame for #name images */
-Image *BKE_image_load_exists_ex(const char *filepath, bool *r_exists)
+Image *BKE_image_load_exists_ex(Main *bmain, const char *filepath, bool 
*r_exists)
 {
        Image *ima;
        char str[FILE_MAX], strtest[FILE_MAX];
@@ -626,10 +626,10 @@ Image *BKE_image_load_exists_ex(const char *filepath, 
bool *r_exists)
        BLI_path_abs(str, BKE_main_blendfile_path_from_global());
 
        /* first search an identical filepath */
-       for (ima = G.main->image.first; ima; ima = ima->id.next) {
+       for (ima = bmain->image.first; ima; ima = ima->id.next) {
                if (ima->source != IMA_SRC_VIEWER && ima->source != 
IMA_SRC_GENERATED) {
                        STRNCPY(strtest, ima->name);
-                       BLI_path_abs(strtest, ID_BLEND_PATH(G.main, &ima->id));
+                       BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &ima->id));
 
                        if (BLI_path_cmp(strtest, str) == 0) {
                                if ((BKE_image_has_anim(ima) == false) ||
@@ -648,12 +648,12 @@ Image *BKE_image_load_exists_ex(const char *filepath, 
bool *r_exists)
 
        if (r_exists)
                *r_exists = false;
-       return BKE_image_load(G.main, filepath);
+       return BKE_image_load(bmain, filepath);
 }
 
-Image *BKE_image_load_exists(const char *filepath)
+Image *BKE_image_load_exists(Main *bmain, const char *filepath)
 {
-       return BKE_image_load_exists_ex(filepath, NULL);
+       return BKE_image_load_exists_ex(bmain, filepath, NULL);
 }
 
 static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const 
char *name, int depth, int floatbuf, short gen_type,
@@ -755,7 +755,7 @@ Image *BKE_image_add_generated(
 /* Create an image image from ibuf. The refcount of ibuf is increased,
  * caller should take care to drop its reference by calling
  * IMB_freeImBuf if needed. */
-Image *BKE_image_add_from_imbuf(ImBuf *ibuf, const char *name)
+Image *BKE_image_add_from_imbuf(Main *bmain, ImBuf *ibuf, const char *name)
 {
        /* on save, type is changed to FILE in editsima.c */
        Image *ima;
@@ -764,7 +764,7 @@ Image *BKE_image_add_from_imbuf(ImBuf *ibuf, const char 
*name)
                name = BLI_path_basename(ibuf->name);
        }
 
-       ima = image_alloc(G.main, name, IMA_SRC_FILE, IMA_TYPE_IMAGE);
+       ima = image_alloc(bmain, name, IMA_SRC_FILE, IMA_TYPE_IMAGE);
 
        if (ima) {
                STRNCPY(ima->name, ibuf->name);
@@ -933,12 +933,12 @@ void BKE_image_tag_time(Image *ima)
 }
 
 #if 0
-static void tag_all_images_time()
+static void tag_all_images_time(Main *bmain)
 {
        Image *ima;
        int ctime = PIL_check_seconds_timer_i();
 
-       ima = G.main->

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to