Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-02-19 07:06:14 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-02-19 07:07:32 +0300
commit3afe218a7d71ce4bb5d9b661bc966e8c99541184 (patch)
tree4834aea5f3a08fac6aba2debbf491992ccfa414e /source/blender/editors
parent9f8dd4f9e5c0a397485262ec815a88de4fa6cee4 (diff)
Cleanup: assign Main, use existing assignments
Avoid accessing inline since it's often used multiple times. In some cases it was already defined.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_markers.c3
-rw-r--r--source/blender/editors/interface/interface_templates.c3
-rw-r--r--source/blender/editors/object/object_add.c2
-rw-r--r--source/blender/editors/object/object_select.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c3
-rw-r--r--source/blender/editors/space_clip/clip_ops.c2
-rw-r--r--source/blender/editors/space_image/image_ops.c3
-rw-r--r--source/blender/editors/space_nla/nla_edit.c3
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c8
-rw-r--r--source/blender/editors/space_text/text_ops.c3
11 files changed, 24 insertions, 14 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index e0d72ab5198..8d3c932cbe6 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -1557,8 +1557,9 @@ static void MARKER_OT_rename(wmOperatorType *ot)
static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
ListBase *markers = ED_context_get_markers(C);
- Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scenes, RNA_enum_get(op->ptr, "scene"));
+ Scene *scene_to = BLI_findlink(&bmain->scenes, RNA_enum_get(op->ptr, "scene"));
TimeMarker *marker, *marker_new;
if (scene_to == NULL) {
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 6feabd15daa..9294f614e18 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -6871,6 +6871,7 @@ static char *progress_tooltip_func(bContext *UNUSED(C), void *argN, const char *
void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
{
+ Main *bmain = CTX_data_main(C);
wmWindowManager *wm = CTX_wm_manager(C);
ScrArea *sa = CTX_wm_area(C);
uiBlock *block;
@@ -6884,7 +6885,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
Scene *scene;
/* another scene can be rendering too, for example via compositor */
- for (scene = CTX_data_main(C)->scenes.first; scene; scene = scene->id.next) {
+ for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY)) {
handle_event = B_STOPOTHER;
icon = ICON_NONE;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index e99c7543bf3..7891f59a62e 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1326,7 +1326,7 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
}
}
else {
- collection = BLI_findlink(&CTX_data_main(C)->collections, RNA_enum_get(op->ptr, "collection"));
+ collection = BLI_findlink(&bmain->collections, RNA_enum_get(op->ptr, "collection"));
}
if (!ED_object_add_generic_get_opts(C, op, 'Z', loc, rot, NULL, &local_view_bits, NULL)) {
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 43e46f6bef2..29b2ba59ee9 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -836,14 +836,15 @@ static bool select_grouped_parent(bContext *C) /* Makes parent active and de-sel
/* Select objects in the same group as the active */
static bool select_grouped_collection(bContext *C, Object *ob)
{
+ Main *bmain = CTX_data_main(C);
bool changed = false;
Collection *collection, *ob_collections[COLLECTION_MENU_MAX];
int collection_count = 0, i;
uiPopupMenu *pup;
uiLayout *layout;
- for (collection = CTX_data_main(C)->collections.first;
- collection && collection_count < COLLECTION_MENU_MAX;
+ for (collection = bmain->collections.first;
+ collection && (collection_count < COLLECTION_MENU_MAX);
collection = collection->id.next) {
if (BKE_collection_has_object(collection, ob)) {
ob_collections[collection_count] = collection;
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index e5656062969..d3e5859def2 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -6065,7 +6065,8 @@ void paint_proj_stroke_done(void *ps_handle_p)
/* use project paint to re-apply an image */
static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
{
- Image *image = BLI_findlink(&CTX_data_main(C)->images, RNA_enum_get(op->ptr, "image"));
+ Main *bmain = CTX_data_main(C);
+ Image *image = BLI_findlink(&bmain->images, RNA_enum_get(op->ptr, "image"));
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
ProjPaintState ps = {NULL};
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 71ffb1af434..70729de3d4c 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -209,7 +209,7 @@ static int open_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "directory", dir_only);
if (relative) {
- BLI_path_rel(dir_only, CTX_data_main(C)->name);
+ BLI_path_rel(dir_only, bmain->name);
}
prop = RNA_struct_find_property(op->ptr, "files");
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 5793ef4f3ec..6dc4a7f950c 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -3199,6 +3199,7 @@ void IMAGE_OT_pack(wmOperatorType *ot)
static int image_unpack_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Image *ima = image_from_context(C);
int method = RNA_enum_get(op->ptr, "method");
@@ -3206,7 +3207,7 @@ static int image_unpack_exec(bContext *C, wmOperator *op)
if (RNA_struct_property_is_set(op->ptr, "id")) {
char imaname[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "id", imaname);
- ima = BLI_findstring(&CTX_data_main(C)->images, imaname, offsetof(ID, name) + 2);
+ ima = BLI_findstring(&bmain->images, imaname, offsetof(ID, name) + 2);
if (!ima) {
ima = image_from_context(C);
}
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index ac6ee125798..150a4ef127f 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -587,6 +587,7 @@ void NLA_OT_view_frame(wmOperatorType *ot)
/* add the specified action as new strip */
static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
bAnimContext ac;
Scene *scene;
@@ -608,7 +609,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
cfra = (float)CFRA;
/* get action to use */
- act = BLI_findlink(&CTX_data_main(C)->actions, RNA_enum_get(op->ptr, "action"));
+ act = BLI_findlink(&bmain->actions, RNA_enum_get(op->ptr, "action"));
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid action to add");
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 8d6aff1bd6e..503a4570352 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -1926,6 +1926,7 @@ static void actionset_id_cb(TreeElement *UNUSED(te),
static int outliner_action_set_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
@@ -1938,7 +1939,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
/* get action to use */
- act = BLI_findlink(&CTX_data_main(C)->actions, RNA_enum_get(op->ptr, "action"));
+ act = BLI_findlink(&bmain->actions, RNA_enum_get(op->ptr, "action"));
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid action to add");
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 49270abf8ce..74620a97d01 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -348,7 +348,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
start_frame = RNA_int_get(op->ptr, "frame_start");
channel = RNA_int_get(op->ptr, "channel");
- sce_seq = BLI_findlink(&CTX_data_main(C)->scenes, RNA_enum_get(op->ptr, "scene"));
+ sce_seq = BLI_findlink(&bmain->scenes, RNA_enum_get(op->ptr, "scene"));
if (sce_seq == NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene not found");
@@ -420,6 +420,7 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
/* add movieclip operator */
static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, true);
@@ -432,7 +433,7 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
start_frame = RNA_int_get(op->ptr, "frame_start");
channel = RNA_int_get(op->ptr, "channel");
- clip = BLI_findlink(&CTX_data_main(C)->movieclips, RNA_enum_get(op->ptr, "clip"));
+ clip = BLI_findlink(&bmain->movieclips, RNA_enum_get(op->ptr, "clip"));
if (clip == NULL) {
BKE_report(op->reports, RPT_ERROR, "Movie clip not found");
@@ -504,6 +505,7 @@ void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot)
static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, true);
@@ -516,7 +518,7 @@ static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op)
start_frame = RNA_int_get(op->ptr, "frame_start");
channel = RNA_int_get(op->ptr, "channel");
- mask = BLI_findlink(&CTX_data_main(C)->masks, RNA_enum_get(op->ptr, "mask"));
+ mask = BLI_findlink(&bmain->masks, RNA_enum_get(op->ptr, "mask"));
if (mask == NULL) {
BKE_report(op->reports, RPT_ERROR, "Mask not found");
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 1462cb2cc10..ab1f5f53e7b 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -820,13 +820,14 @@ static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUS
{
#ifdef WITH_PYTHON
# if 0
+ Main *bmain = CTX_data_main(C);
Text *text = CTX_data_edit_text(C);
Object *ob;
bConstraint *con;
short update;
/* check all pyconstraints */
- for (ob = CTX_data_main(C)->objects.first; ob; ob = ob->id.next) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
update = 0;
if (ob->type == OB_ARMATURE && ob->pose) {
bPoseChannel *pchan;