Dev:2.8/Source/LayersCollections/BaseRefactorTasks

提供: wiki
< Dev:2.8/Source‎ | LayersCollections
2017年2月28日 (火) 20:26時点におけるwiki>Dfelintoによる版 (Base / object layer)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Base Refactor Tasks

As part of the Layer project we moved the Base storage from Scene to SceneLayer. Which means that every part in Blender that is referring to Scene.base needs to be updated to reflect that.

Example commits:

Which SceneLayer to use

Most of the changes are trivial, and boil down to determining which SceneLayer you want to use.

Whenever possible, we should use CTX_data_scene_layer to get the active SceneLayer. Under the hood this calls BKE_scene_layer_context_active, but it allows for override from Python scripters and (in the future) for different SceneLayers in different windows.

In the rare cases when this is not possible, we should use one of the following util functions: BKE_scene_layer_render_active(scene) and BKE_scene_layer_context_active(scene).

Most of the time you will want to use BKE_scene_layer_context_active, which takes the current SceneLayer depending on the (yet to be implemented) workspace. In a few cases you want to use BKE_scene_layer_render_active which is the render layer used when you render (F12). For exporters this may be the preferable option, but that's up to the developers to decide.

Base related defines

Besides that, the "API" to access the base changed. So now instead of doing OBACT, BASACT, FIRSTBASE, BASE_VISIBLE, ... we do OBACT_NEW, BASACT_NEW, FIRSTBASE_NEW, BASE_VISIBLE_NEW, ..., respectively. For all instances of this see DNA_scene_types.h.

Once the Base related code was updated, it's time to rename any instance of BaseLegacy to Base, so we know this part of the code was double-checked.

Base / object layer

We no longer support base->lay, or ob->lay. Instead, we should check for base visibility. For example:

-if ((scene->lay & (ob->lay | base->lay)) == 0)) {
+if ((base->flag & VISIBLED) != 0) {

Extra functions

ED_base_object_select should be replaced by ED_object_base_select as well, and any reference to (base->flag & SELECT) should be replaced by (base->flag & BASE_SELECTED). I can batch replace them all later. But it's interesting to do it manually now, so we now which parts of the code are yet to be tackled.

Patches

If you have any patch to address some of the remaining cases, please add dfelinto as a reviewer so I can take a look at it.

Stats

You can see the daily update of BaseLegacy and the old base defines (OBACT, BASE_EDITABLE_BGMODE, ...) here:

We want those graphs to go to zero.