Grease Pencil Multi-Object-Editmode Proposal


#1

Hello everyone,

I’d like to make multi-object editmode work for grease pencil objects. Multi object editmode is now almost done for all other objects in Blender except for grease pencil objects. In this post I want to ask a few questions regarding the development and propose a brief plan how to implement this feature.

The following video is a proof of concept that shows how select circle would work in multi object edit mode:

There are some significant changes to the code that need to be done but first a few questions.

1) Are devs willing to accept this feature?
Developing this feature will result in many submitted patches and some questions regarding the code, so I’m asking if the developers are willing to review patches and help with the development. I believe @dfelinto and @ideasman42 are the ones who would be responsible for this area of code?
2) If so, is this a good time to start with development?
I am aware that all efforts now should be directed towards making Blender 2.8 stable and finishing features only, but one could argue that this proposal is a completion to the multi-object editmode feature in Blender 2.8. What do you think?

Development Plan:

  • Make grease pencil objects draw properly in edit mode. (The video above uses a hacky code and breaks other functionalities in doing so, e.g. does not show the right number of selected vertices etc…)
  • Change the API of relevant parts of the code, e.g. refactor functions to take (only) Object * as argument instead of bGPdata *. So maybe work on the branch greasepencil-object and ccordinate with @Antonio_Vazquez and @Charlie on this?
  • Make a list of all objects that need porting (similar to T54641) and upload example patches, in case other developers want to help.
  • I will work on this on my free time so this feature will probably take 2 to 3 months to complete. I already submitted a few patches for porting operators for multi object edit mode, so I’ll try to make to make grease pencil objects behave as consistently as possible with multi object edit mode.

Thanks for reading. I’m looking forward to your feedback!


#2

I don’t know the details of your proposal, but there are some points that come to my mind:

  1. How are you going to support multiobject with multiframe? Maybe in meshes to have the feature to edit several objects at the same time is great, but in GP, the point is to edit several frames at the same time in the same object… maybe edit several objects with several frames at the same time is too much.

  2. For sure this change can introduce a lot of bugs (it’s normal), so I don’t think now (beta period) is the time to do it.

  3. You talk about change the API to use always *Ob instead of *GPD… have you cheched if this code is shared with Annotations?

  4. If you support multiobject, you will break a lot of code that is using the “current” bGPdata block. How are you going to “decide” what is the right datablock? We had a lot of problems with this simple topic when implement annotations and GP objects.

Sure there will be a lot more of problems… grease pencil works in its own way because there are a lot of differences between 3D workflow and 2D workflow, maybe you could focus on small changes improving areas or operators before changing something that I’m not sure is an artist request.

You could start porting sculpt brushes to “real” Blender brushes, or work in Eevee integration.

I would like to hear the opinion of @MatiasMendiola and Daniel.


#3

Thanks for the feedback.

My main argument was that it’s been decided that multi object edit mode should be supported in Blender 2.8, and since grease pencil is now an object in Blender that has an edit mode, I would expect it to be consistent with other object types.

However, if you think that this feature is really not needed, e.g. because the 2D workflow is different, then I would move on with my life and try to tackle brushes or something else :slight_smile:

Meshes can have shape keys as well. But editing (and then propagating the editing to other frames) always happened in one frame. Same would apply to GP objects.

well then that’s an argument against this proposal. If artists and other devs think the same then I would drop it.

I was under the impression that the goal of greasepencil-object branch is to make annotations gp objects as well (at least internally in the code) and then draw them differently depending on the active editor. So accessing bGPdata always happens through something like
bGPdata *gpd = (bGPdata *)ob->data
i.e. Object is would be just a wrapper for bGPdata and is not a different data block.


#4

@izo About shapekeys, yes this is something we want do in the future, but we need think how manage the shapekeys of each stroke for each frame. In meshes you have a unique geometry that changes (can) in shape for each frame…but in GP the geometry is different for each frame, so the shape keys problem is similar but not equal. There a lot more points to consider for shapekeys.

Annotations is using GPD datablock too, but it uses the datablock of the scene of image editor, etc, not linked to an object.

I was thinking more about multiobject editting and there are more problesm: for example, the list of layers and materials is used a lot to manage editing (filter, lock, hide, etc)…if you have 2 objects you will have only a list of layers and a list of materials, so you miss all this functionality…and you will have only the active one, you it’s very easy make mistakes addling, for example, a layer in the wrong object.


#5

As of right now, yes. But isn’t the plan to make annotations GP objects as well? What’s the point of having GP strokes as objects if you will pass and Object and bGPdata to the API?

This is a more general problem related multi object editmode I think. You can change the material of mesh objects in edit mode when several objects are selected as well. In that case, changes will apply to the active object only.

On a different note, I can see that it’s not obvious that we need this feature in the first place, so it would be nice to first decide whether multi object EditMode is desired for grease pencil objects.
You mentioned porting brushes and Eevee integration… how does the priority of these tasks compare to GP multi object editing? e.g. should they be done before 2.80 release? Could you estimate the effort required to finish these tasks? e.g. is the solution known but hasn’t been implemented yet or should one think about how to refactor large parts of code and think of an algorithm to implement?


#6

Never, the annotations also work with other editors that don’t support objects.


#7

I just need a little bit of your patience, guidance and understanding

I’m sorry to bother you with this question out of topic, I need to know why the blender console throws this error message, since I’ve seen it happen with many add-ons, and it just happened to me with Mesh Align Plus 0.4.0, in blender 2.79b

Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\mesh_align_to_gpencil_view.py", line 163, in poll
return check_if_any_gp_exists(context)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\mesh_align_to_gpencil_view.py", line 423, in check_if_any_gp_exists
if(check_if_object_gp_exists(context)):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\mesh_align_to_gpencil_view.py", line 432, in check_if_object_gp_exists
objectGP = bpy.context.active_object.grease_pencil
AttributeError: 'NoneType' object has no attribute 'grease_pencil'

location: <unknown location>:-1

Line 163 Add-on

    @classmethod
    def poll(cls, context):
        return check_if_any_gp_exists(context)

def align_bones_editmode(context, influence):
    obj = bpy.context.edit_object
    bo = obj.data.edit_bones

Line 163 return check_if_any_gp_exists(context)

def check_if_any_gp_exists(context):
    if(check_if_object_gp_exists(context)):
        return True
    elif(check_if_scene_gp_exists(context)):
        return True
    else:
        return False


def check_if_object_gp_exists(context):
    objectGP = bpy.context.active_object.grease_pencil

    if(objectGP is not None):
        if(len(objectGP.layers)>0):
            if(len(objectGP.layers[-1].active_frame.strokes) > 0):
                return True

    return False

Line 423 if(check_if_object_gp_exists(context)):
Line 432 objectGP = bpy.context.active_object.grease_pencil

it was fixed by deactivating some boxes with auto-detection in the add-on menu, but even so I want to learn about this, I’ve seen it in many places published with questions on how to solve it or why it happens, but nobody answers anything

I use blender 2.79b because at the moment I can only use my lap in the hospital
:disappointed:
pic