Page MenuHome

Bsurface addon don't work with new builds
Closed, ResolvedPublic

Description

System Information
Operating system and graphics card
gentoo amd64 gtx780 x2
Blender Version
Broken: latest (from builder.blender.org, for ex e240bd3)
Worked: 435eaa7 (from builder.blender.org)

Exact steps for others to reproduce the error
1- in edit mode paint gpencil strokes
2- push "Add Surface" button
3- get error "There aren't any strokes."

Event Timeline

@Eclectiel L (eclectiel), mind looking into this one? :)

@Joshua Leung (aligorith), just wondering, are there some PyAPI changes in the gpencil to which all the addons now need to adopt?

Sergey Sharybin (sergey) triaged this task as Normal priority.Dec 2 2014, 9:00 AM

It's not so much an API change, but rather that Grease Pencil gets created on Scene level instead of Object level by default now. At least the object_grease_scatter one we have handles this correctly, but unfortunately, not all of the ones out there are quite as vigorous.

BTW, I've now added an entry to the Python API changelog about this.

hi, grease pencil is a widely used tool & important to many peoples workflows.
care should be taken when breaking release addons & popular tools.
as there is no maintainer & I am responsible for it's inclusion in Blender, i'll try to fix &/or try to negotiate fixes with other addons & Blender devs.
this addon should be fixed before 2.73 release as it's wide user base would be very disappointed.

Hi Joshua,

I m kind of understand you but can you make so that Grease Pencils gets created on object as default because many artists use GP to sketch on model and many add-ons rely on that ability for now retopo workflow will get really slow. Please bring those stroke back please.

Hmm... maybe I'll need to implement that switch to set where these get added after all. The impression I get is that for standard (non-old-addon usage), it's better that these are not attached to the object.

For now, one with commit rights could just change the try block on line 108 in mesh_bsurfaces.py to:

# Check if they are grease pencil    
    try:
        #### Get the active grease pencil layer.
        strokes_num = len(main_object.grease_pencil.layers.active.active_frame.strokes)   
    except:
        strokes_num = len(bpy.data.grease_pencil[0].layers.active.active_frame.strokes)
        if strokes_num > 0:
            strokes_type = "GP_STROKES"
    else:
        if strokes_num > 0:
            strokes_type = "GP_STROKES"

I'm not sure its good python there since I'm not python expert and don't know all the specifics of try/except/else blocks, but it seems to work.

EDIT:
Actually it should (maybe) use the last gpencil block created and not [0], so I guess [-1]?

Here's a stop-gap patch to the addons themselves while I work on adding the toggle for setting whether gp datablocks are attached to the scene or to active objects.

It at least gets rid of the immediate problems, but at least from my tests, some other issues were cropping up. I'm not sure if those originated from this fix, or whether they were present in the addon.

I've committed the switch to set where these are attached to.

So, for modellers/users of these addons, the only change to your workflow should be to just set "Data Source" from "Scene" to "Object" before starting to use those addons.

if you forget to do so before starting to draw:

  1. Go to the Properties Region for the 3D View
  2. Toggle the switch from "Scene" to "Object. The Grease Pencil data/layers UI should disappear at this point
  3. Click the green pencil icon to assign the Grease Pencil datablock used to the active object instead. Or, simply draw a new stroke again.

I just test new build, it works!
Thank you.