Feature: sequence_editor.display_stack(meta_seq) function
great thanks to @Élie Michel (elie) for his wonderful help!
Differential D12048
Feature: display_stack() function for meta_toggle Authored by Félix (Miadim) on Jul 28 2021, 10:48 AM.
Details Feature: sequence_editor.display_stack(meta_seq) function great thanks to @Élie Michel (elie) for his wonderful help!
Diff Detail
Event TimelineComment Actions I think it would be nicer design, if there would be only sequence_editor.display_stack() function and you can provide either sequence or None. So you can do sequence_editor.display_stack(sequence_editor.meta_stack[-1]) to go up one level for example. I have pretty much same argument for sequencer.meta_toggle operator, I would rather keep it in C as it is core functionality and we may want to modify it in a way, that wouldn't be possible in python. Changing displayed stack seems to work, but this doenn't refresh view properly and I can see strips from parent stack until I click somewhere. I think this may be because selection must be cleared in all other stacks (in practice only last displayed), but I may be mistaken. Comment Actions I agree about the design you propose. It's cleaner. I'll change that. About the operator, maybe I didn't fix everything correctly, I'll have a look. Regarding the fact we should keep it in C, I believe, and also I need, to be able to override this kind of operators for my project (Stax). I need to handle Blender native operators with some extra operations to make it transparent for users: they use Blender as they're used to doing it, but Stax does more things in background. If they want to keep using their shortcuts and not Stax's keymap. Currently, I'm forced to create a sequencer.toggle_meta to override the sequencer.meta_toggle and to force Stax's keymap installation at startup, else this operator would be accessible only in the UI and breaks Blender workflow consistency. Comment Actions
Comment Actions There are some issues with functionality.
Otherwise this looks nice. Comment Actions
Comment Actions @Richard Antalik (ISS) I'd like to add a sequence.metas_hierarchy() which would return the whole tree of metas to the sequence, using the SEQ_get_sequence_metas_ancestors function I introduced here. Shall I add it there or create a new patch when this one will be applied? Comment Actions Functionally this looks good. Now first comment in code, actually may be doable to have only one function, because I wanted to suggest - I think, that the code from rna_SequenceEditor_display_stack which is functional, should actually go to SEQ_display_stack, otherwise I don't think there is even need for having function SEQ_display_stack. In other words, it is not adding any API functionality, only wrapping existing functionality. I will try to do quick diff as example of how this could work.
Comment Actions So in this patch (P2877), I moved functional stuff to SEQ_display_stack. This allowed me to make SEQ_get_sequence_metas_ancestors static, which allowed me to get rid of passing data via ListBase. I have renamed these functions to SEQ_meta_stack_set and seq_meta_stack_set_recursive just to not introduce another terms. IMO even display_stack rna function should be renamed to meta_stack_set, since this meta stack is used and known term. maybe even meta_stack_active_set, since there is SEQ_meta_stack_active_get? Not sure, but these are details. Now back to meta toggle operator, entering meta strip is reduced basically to simple SEQ_meta_stack_set call which is nice. no need to manually alloc or free anything, so these functions can be hidden. but exitting meta is still not nice, so I propose meta_stack_pop function, which can be used for this operator. Still not too great, because this selects strip, which is stored in MetaStack, so there still needs to be SEQ_meta_stack_active_get. However, I can return this strip as reference. So now there is no need to manipulate data manually, all is covered by API. Function SEQ_meta_stack_active_get s still used internally, so I can move it to sequencer.h file with lowercase seq prefix. I have written this as I went along and modified the code, so hopefully you can follow my train of logic. Patch will show you only final modified version... Also sorry for not making my patch clean, mainly wanted to do quick edits that work (even that is not quite guaranteed, eh) Also forgot to mention, that now function documentation comments are moved to header files. | ||||||||||||||||||||||||||||||||||