Ejemplo n.º 1
0
void ED_editors_init(bContext *C)
{
	wmWindowManager *wm = CTX_wm_manager(C);
	Main *bmain = CTX_data_main(C);
	Scene *sce = CTX_data_scene(C);
	Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL;
	ID *data;

	/* toggle on modes for objects that were saved with these enabled. for
	 * e.g. linked objects we have to ensure that they are actually the
	 * active object in this scene. */
	for (ob = bmain->object.first; ob; ob = ob->id.next) {
		int mode = ob->mode;

		if (mode && (mode != OB_MODE_POSE)) {
			ob->mode = 0;
			data = ob->data;

			if (ob == obact && !ob->id.lib && !(data && data->lib))
				ED_object_toggle_modes(C, mode);
		}
	}

	/* image editor paint mode */
	if (sce) {
		ED_space_image_paint_update(wm, sce->toolsettings);
	}
}
Ejemplo n.º 2
0
void ED_editors_init(bContext *C)
{
	wmWindowManager *wm = CTX_wm_manager(C);
	Main *bmain = CTX_data_main(C);
	Scene *sce = CTX_data_scene(C);
	Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL;
	ID *data;

	if (wm->undo_stack == NULL) {
		wm->undo_stack = BKE_undosys_stack_create();
	}

	/* This is called during initialization, so we don't want to store any reports */
	ReportList *reports = CTX_wm_reports(C);
	int reports_flag_prev = reports->flag & ~RPT_STORE;

	SWAP(int, reports->flag, reports_flag_prev);

	/* toggle on modes for objects that were saved with these enabled. for
	 * e.g. linked objects we have to ensure that they are actually the
	 * active object in this scene. */
	for (ob = bmain->object.first; ob; ob = ob->id.next) {
		int mode = ob->mode;

		if (!ELEM(mode, OB_MODE_OBJECT, OB_MODE_POSE)) {
			ob->mode = OB_MODE_OBJECT;
			data = ob->data;

			if (ob == obact && !ID_IS_LINKED(ob) && !(data && ID_IS_LINKED(data)))
				ED_object_mode_toggle(C, mode);
		}
	}

	/* image editor paint mode */
	if (sce) {
		ED_space_image_paint_update(bmain, wm, sce);
	}

	SWAP(int, reports->flag, reports_flag_prev);
}