sanja-sa/gddragonbones

Some CanvasItem parameters doesn´t work from inspector.

Closed this issue · 6 comments

Win7 64 bit- Godot 2.1.4 compiled at 22/01/2018 from github 2.1 branch at godotengine/godot@69da799

From CanvasItem:

-Bones opacity: Works in inspector, changes aren´t reflected in preview. Works from code.
-Visible: Works in inspector and preview.
-Opacity: Toggles from visible to not visible. Parameter in inspector is only modificable writing from keyboard, changes are not reflected until you write "0", it seems binded to visible, not to Opacity.
-Self Opacity: Number can be dragged but there is not changes on screen nor preview. Works from code.
-Behind Parent: works
-Blend Mode: Doesn´t work, nor from code.
-Light Mask: Only works default bit, changing to second bit doesn´t work.

From Sprite:

-Modulate: Works in inspector, changes aren´t reflected in preview. Works from code.

I try compile with and without android option.

@Ranoller Thanks for your feedback.
I have made some correction, you can try it.

With opacity in godot and render polygone its a hack (I set opacity by hand for each polygone).
I think in Godot 3.0 it will be work properly, and I 'll correct this for 3.0 separatly.
( It can be made as in Spine plugin or in Creature Plugin, in this case render done at once, but I go by the way, that each Slot is a Node2D and, in that case, you can add to Slot(Node2D) yourself nodes (particles, skins and other things) in Spine Plugin and Creature Plugin you cannot do it :) )

Light Mask - can you give me a sample how it must be.

I test changes in the afternoon, thanks!

One thing.... is not better to inherit from Sprite for each slot? this allows you to inherit all Node2D methods and you can use "Flip H and V" like in the Spine plugin. (This can be done by scale *-1 by is more visual flip option), and if you use one node for slot, every slot can be modulated, flipped etc....

Light Mask question:

Light Mask are the layers in, if there is any Light2D masking that, the canvas object will be "masked"... that is, covered with the texture and the mix mode of the light. If your object is in layer 2 and the light2D only masks layer 1, light2D doesn´t affect this object. Light Mask is used to proyect shadows too. There are a demo called Light2D that shows uses.

Example: I have a DragonBones Pupetter that walk under a light, the pupetter is lighted, but i have a DragonBones Tree in background that i want not be iluminated by the light....

  1. Puppeter "Light Mask" bit 2 true bit 1 false,
  2. Light2D "Item Mask" bit 2 true bit 1 false,
  3. Tree "Light Mask" bit 1 true bit 2 false ..... and doesn´t iluminate.

If your plugin generates several Node2D, being light mask a property of CanvasItem from each node, probably is not inherited. Makes sense that godot doesn´t inherit by default Light Mask in child nodes to allow complex scenes. (Is not like Pos, Scale, etc... that should be inherited)

But I think that this property is bad binded to GDScript in godot because it should have 2 parameters minimum and help says that the methods in CanvasItem are:

void set_light_mask( int light_mask )
Set the ligtht mask number of this item.

int get_light_mask() const
Get this item's light mask number.

But in editor you can assign (int light_mask_layer, bool = enabled/disabled). So every CanvasItem should be able to mask different "Light Layers", not only one.

I think that there is confusion with this parameter in the engine, or I´m confused about the use. I will investigate c++ code in godot to see if I "find the light"... :)

@Ranoller Flipping for Armature is present in DragonBones, yet in plugin not implemented .
I'm not using Lighting Mask yet in Godot, in such case I don't understand how it works. I need more time to stydy this option. If you have small sample, where I can see result and how it works to try.
Ok! Thanks I'll try correct Lighting Mask option.

Now everything works...

I want to comment you one thing about the "One node by slot aproach"... there is a problem with mix modes - opacity - modulate alpha and this aproach:

dragonbonestest1

If you see if the Dragon bones node have any "transparency" or mix mode that make some pixel to have other alpha than 1, the back slot is displayed, so is not posible to use the object like it was an "unique" sprite (it´s expected that the opacity, modulate alpha, mix modes, etc... was applied to entire entity).

Light2D thing:
Item Mask is this:
dragonbonestest2
Dragon bones object is in layer 1.

Good work man! I´m happy with you initiative!

If is needed to close the issue, open other to the light mask, etc... I close. If not, I will comment on this to have conversation in order.

@Ranoller About opacity and blending. If you can see below, the pictures is identical.
db
godot

If you use additional opacity in Godot, its your choice. You can create animation, what you want, in DragonBone's editor, which use opacity how you want, in this case Godot editor is only instrument for rendering in game how you made it in editor, and some modification this animation.

At first, I'd created plugin with functionality as you talked above, but than I'd refused that to 'node structure', its more flexible to do some changes from script as native for Godot nodes. Maybe, I'm not right :).

Ah! I see... DragonBones opacity is per layer, there is no global opacity... Well, in Godot this can be acomplished by shader, so if global apha is necesary this can be the way. So.... there is no issues by my side :) . If Item Mask can be done... well. If not, Dragonbones object can be the first layer, and then dessigning in consecuence. Good work!