T51461: We now select the LayerCollection at index 0 for the active ViewLayer after a collection deletion operation.
ClosedPublic

Authored by Danrae Pray (spockTheGray) on Dec 6 2017, 6:02 AM.

Details

Summary

T51461: We now select the LayerCollection at index 0 for the active ViewLayer after a collection deletion operation.

Added some functions to query outliner tree data & get LayerCollection
by index using a similar approach as we do for SceneCollection indexing.

Diff Detail

Repository
rB Blender
Dalai Felinto (dfelinto) requested changes to this revision.Dec 6 2017, 12:35 PM
Dalai Felinto (dfelinto) added inline comments.
source/blender/editors/space_outliner/outliner_collections.c
111

Why not use BKE_layer_collection_from_index?

141
158
402

Nick-picking:

- Main *mainvar = CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
430
source/blender/editors/space_outliner/outliner_intern.h
206

Use struct for SpaceOops and TreeElement to avoid warnings like: "struct declared inside parameter list"

This revision now requires changes to proceed.Dec 6 2017, 12:35 PM
  • Removed code duplication (layer_collection_from_index()) and fixed code style issues.
Danrae Pray (spockTheGray) marked 6 inline comments as done.Dec 7 2017, 4:42 AM
Danrae Pray (spockTheGray) added inline comments.
source/blender/editors/space_outliner/outliner_collections.c
111

Totally missed that function - thanks :)

Danrae Pray (spockTheGray) marked 2 inline comments as done.Dec 7 2017, 4:44 AM
This revision was not accepted when it landed; it landed in state Needs Review.Dec 13 2017, 1:01 PM
This revision was automatically updated to reflect the committed changes.

@Danrae Pray (spockTheGray) committed your patch, thanks for it.

Please notice in the final committed patch a few changes that I had to make (and that was quick to make myself and commit):

  • More descriptive for end users commit message one-line summary (the title).
  • Using typedef struct, and suppressing struct when using it (for TreeElementFindData).
  • Removed extra spaces in the end of line (for outliner_item_select in outliner_intern.h)
  • Replace tab with spaces (for outliner_item_select in outliner_intern.h)
  • Multiple changes in outliner_tree_element_from_layer_collection.