GDQuest / blender-power-sequencer

Add-on for video editing in Blender 3D: edit videos faster! Included in Blender 2.81+
https://gdquest.com/blender/power-sequencer/
GNU General Public License v3.0
708 stars 58 forks source link

Move main functions/operators into official Blender? #310

Closed tin2tin closed 5 years ago

tin2tin commented 5 years ago

Have you considered moving some of what you would consider as 'must-have functions' into the official Blender-built-in library of operators and add them to the built-in menus too?

If the operators are in standalone classes, the process is very simple. I used it for the VSE Reworked project:

It is this Blender-file I'm adding the operators to: https://developer.blender.org/diffusion/B/browse/master/release/scripts/startup/bl_operators/sequencer.py The VSE Reworked version: https://github.com/tin2tin/blender_vse_reworked/blob/master/sequencer.py

And this Blender-file I'm adding the UI changes to: https://developer.blender.org/diffusion/B/browse/master/release/scripts/startup/bl_ui/space_sequencer.py The VSE Reworked version: https://github.com/tin2tin/blender_vse_reworked/blob/master/space_sequencer.py

How the current changes look and work: https://devtalk.blender.org/t/the-video-sequence-editor-reworked-a-ready-to-patch-suggestion/3264/98

The VSE maintainer, Richard, wrote to me that he'll push the VSE Reworked files into the official Blender soon, so it would be great if you guys would like to contribute too before he's making the push?

NathanLovato commented 5 years ago

I'm preparing to launch a Kickstarter right now so I won't have time in the coming weeks. But all the code is open source and almost all operators are self-contained.

What are the guidelines? What is wanted and what isn't?

I notice that the reworked VSE has operators that we had coded already but they seem to be coded from scratch. You can take anything from our repo and just copy paste the code, you know.

Also are there no programming guidelines? There's a mix of snake_case, typical in Python, and camelCase in variable names, among other things.

NathanLovato commented 5 years ago

If I could I'd rather have most of the features we have here and that Blender does not have as part of it, but I don't think that'd be wanted as-is. I've got to keep my company afloat right now but later this year I'm hoping to visit the Blender foundation, give a hand on the VSE, and learn a bit of C.

Right now may I rely on you a little bit? Is there anything you think would be particularly nice to include in your Python rework of the VSE from Power Sequencer? If so I'll check the guidelines again for official add-ons and prepare a PR with the operators you'd like.

tin2tin commented 5 years ago

Personally, I do not have any more time to invest in the VSE. I got to prioritize paying my bills. And I'm not a coder. So I'm way out of my comfort zone here. As far as I know that are no other guidelines than pep8. Basically, I just tried to mimic the code style of the existing classes.

For me, the work has been very limited by being unable to use def outside of classes, unable to use globals or calling operators outside that very file(bl_operators/sequencer.py). Maybe you know how to surpass these limitations? If it is not possible, everything must be contained within that single class/file(bl_operators/sequencer.py). From my understanding, the PS is using a lot of functions outside the classes, so I haven't been able to use the PS code for the VSE Reworked project, but maybe that's only an illustration of my limited skills as a coder?

Of the functions, I would have liked to add myself to VSE Reworked, but didn't manage to is proper paste/insert/overwrite due to the odd behavior of built-in copy function concerning effect strips. And without being able to select channels the Y value of where to paste/insert/overwrite is missing. I know the active strip maybe could be used as an indicator of what channel to start from, but the visual indication of what strip is the active one is just too vague to be usable, IMHO. So for me it is also a design problem how insert/overwrite should be done. Those are basic nle functions the VSE should have, IMHO, but maybe the VSE needs channel headers(inc. functions) to implement those functions in a meaningful way.

I do not know how much work it would be to add PS functions to the bl_operators/sequencer.py file, so I feel it would not be right I was to cherry-pick functions. And there are no overall guidelines from the Blender Institute as long as there is consistency with the rest of Blender afaik. Personally, I think that there shouldn't be any functions without UI access. Ex. it took me several months to find out about the mouse select + ctrl/alt/shift functions. You shouldn't have to look into the manual or even worse into the source code to find info about essential functions: https://github.com/dfelinto/blender/blob/master/source/blender/editors/space_sequencer/sequencer_ops.c

Anyway, if you like to add something to the VSE Reworked project you can just do a fork of this: https://github.com/tin2tin/blender_vse_reworked and submit pull requests.

NathanLovato commented 5 years ago

Thanks for all that info! Few operators should use utility functions, and if they do you can integrate a copy of the code to make the class self-contained.

I'm busy as well, probably until the end of May, if not June. Then I'd like to go give a hand on the Sequencer directly, trying to work in C.

Power Sequencer's UX is the way is it because:

Yes, the built-in features in the VSE are not all intuitive and don't give you so much control from Python's side.

At the moment I don't have any idea of what to add to be honest, considering all the features you added already. PS's tools mostly override Blender's default ones to remove the need to select or to make them work on multiple selected strips.

Anyway for the coming month I'll be quite busy. Same issue: gotta keep the company afloat, get some budget to pay the team. But thanks for the heads up 🙂