[GSoC 2020] Skeleton Tool

Yes!

Oh! Alrighty! Will do!

1 Like

Hey!

Is there a way to check if the current selected layer is a Skeleton layer? :confused:

The tool will add bone to the selected layer if it’s a skeleton layer. If it’s not a skeleton type, it’ll just add a new skeleton layer with bone accordingly.

I’m thinking to add active bone as a parameter to the skeleton layer. I think it’ll work well. As multiple layers will have their own active bone and just by selecting them, we can show the bone highlighted accordingly. What say? :slight_smile:

Yes. The current selected layer(s) (yes, plural) are available via synfigapp::SelectionManager . You can get this object via synfigapp::CanvasInterface::get_selection_manager().

You can check if a layer is of your desired type in two different way (at least):

  • the Layer type name (Layer::get_name()), or
  • C++ RTTI, ie., dynamic typecasting (etl::handle<[YourLayerClass]>::cast_dynamic([YourLayerObjectHandle]) if it’s a handle) : check if it doesn’t return nullptr and there you have it :wink:
1 Like

This is returning the user set name of the layer. :sweat_smile:

Will try this! Thanks! :slight_smile:

No, it’s not :wink: The label user assign to a label is called layer description, actually :slight_smile: Layer::get_description()

Nice :slight_smile: Don’t forget to do such things via synfigapp actions. Otherwise undo/redo won’t work.

I don’t think it’s the best way, as it is only useful for Synfig Studio, not rendering.

On the other hand, group layer already has such feature: lock children selection.

Anyway, you can do it if it helps you now at the beginning.

1 Like

Ohhh!! Cool! I’ll check it out!

yep!

Oh! Will check it out!

:sweat_smile: Will try to not include it!

Rewording: group layer already has a parameter useless for rendering, just for editing in Studio.
Sorry my english XD

1 Like

Weekly report : June 1st - June 7th

  • How was the last week? What did you accomplish?

    • Explored the action systems and docks.
    • Understood the code related to the ducks, layer_Skeleton, and Bone classes.
    • Started working on click to add bone with/without layer_Skeleton.
  • What is the #1 thing slowing you down?

    • Couldn’t find proper documentation for some classes.
  • What do you want to have done by the end of next week?

    • Finish the click to add bone functionality.

Not much work done as I had to work on some assignments deadlines. I will try to balance it with next week. :sweat:

1 Like

Yes, I agree about that.

I think there is no need to remember active bone in every layer.

I expect following workflow if user wants to modify existing Skeleton layer with Skeleton Tool:

  • User selects existing Skeleton Layer
  • User choosing Skeleton Tool (Actually, he can do that earlier ^__^)
  • Skeleton Layer has no active bone. Two possibilities:
    1. If user wants to indicate some bone as active, then he clicks that bone → it becomes active. User creates new bone and this new bone becomes child for active bone. After that newly created bone automatically marked as active.
    1. User not selects any bone → no active bone. User creates a new bone and this new bone has no parent (because there were no active bone during creation). After that newly created bone automatically marked as active.

If no skeleton layer is chose, then we’ll add a new layer and add a bone with origin at the click, right?

Alright. Will work in that direction.

Yes, exactly! :slight_smile:
And after that the new Skeleton layer becomes selected. And added bone becomes active bone.

Cool!
I’ve tried to use the ValueDescCreateChildBone to add child bone to the active bone. But it seems that the canvas is not set. How can I do that? :sweat_smile:

1 Like

You can get canvas from layer. :slight_smile:

How are we calling Non-static functions here? :sweat_smile: (sorry if it’s a silly doubt)

Here: :point_down:

The code is an implamentation of a method of a class ( Action::ValueDescCreateChildBone) that is derived from Action::CanvasSpecific.
That highlighted line is not a static method call: it’s just saying to call the “parent” (Action::CanvasSpecific) implementation of set_param() using current (and compatible, as it’s a derived one) object (I mean the this).

1 Like

Ohh cool! Figured that immediately but forgot to delete it here. :grimacing: So silly of me :sweat:

I made a new commit.

  • Added find_bone to find bones near click.
  • Set active bone :heavy_check_mark:
  • Adding a child bone to the active bone on click is working, but the origin of the child bone still needs fixing.

Actually, I want to change the color of the contour of the active bone. Can you suggest me the file I’ll have to refer to? :sweat_smile: Also, how do I enable handles when using this tool?

Please check this -

I am not sure what do you mean. Can you please clarify? ^__^"

Do you want to create new handles or reuse an existent one?
I can’t help you much, but “handle” is called “duck” in the code.

Sorry! I meant the ducks of the bones.

Okay! I already did! Maybe I missed something will do!