Talk:Convert

From Synfig Studio :: Documentation
Revision as of 15:05, 21 September 2007 by Genete (Talk | contribs) (The Feature Itself - Proposed Additions)

Jump to: navigation, search

Timed Swap's Brokenness

The "Timed Swap" convert crashes synfig as soon as it is used.

The problem seems to be with ValueNode_TimedSwap::set_swap_length() and ValueNode_TimedSwap::set_swap_time() which both try to check that the type of their argument is correct, but fail to do so. dooglus

The Feature Itself - Proposed Additions

While useful, it appears a little incomplete. Suppose I want to fix one of a polygon's vertices such that it always forms a 90 degree angle with the vertex before it, and is a set distance from that vertex. I could do that if I could work out the angle of the previous side to the horizontal, but that doesn't seem to be possible. Also, while it's possible to use the composite conversion to construct a vector from an X and a Y value, it doesn't seem to be possible to go in the opposite direction. If I have a vector and I want to use just its X coordinate, I don't think I can. dooglus

I propose some new conversions: dooglus

Let me play with those feature for vertexs and I'll let you know. Genete

Vector Angle

Converting an angle parameter to "Vector Angle" adds sub-parameters:

  • vector "Vector"
  • real "Scalar"

The resulting value is the angle between "Vector" and the horizontal, multiplied by "Scalar":

  atan(Vector.Y/Vector.X) * Scalar
This would be mathematically unconsistent. Vector angel is already given by atan(Vector.X/Vector.Y). If you multiply it by Scalar then angle would be another thing (I don't know what). For example, Rotate layer have a angle value that is defined by an angle (real value). Its visual control is given by a radial duck attached to the center. If you modify the distance of the duck from the origin the duck will go to a defined (and not modificable) distance, due to the angle is the only useful value of the duck's position.
Also, better use atan2 function (or the defined in the math library) that allow a Y value of 0 without obtaining an exception call. Genete
Good point. I'll use atan2 rather than atan. I'm not sure about X/Y vs. Y/X - I'll use whatever works best. I'm thinking the Scalar might be useful if I want some object to rotate twice as quickly as some other object, for example. If you don't want this, leave the Scalar at its default value of 1.0. I was just copying the way that the Subtract convert works: it returns (LHS-RHS)*Scalar. There's no need to the Scalar really, but maybe it'll be useful sometimes. dooglus 11:17, 6 Sep 2007 (EDT)

Vector Length

Converting a real-valued parameter to "Vector Length" adds sub-parameters:

  • vector "Vector"
  • real "Scalar"

The resulting value is the length of "Vector", multiplied by "Scalar":

  |Vector| * Scalar

Vector X

Converting a real parameter to "Vector X" adds sub-parameters:

  • vector "Vector"
  • real "Scalar"

The return value is:

  Vector.X * Scalar

Vector Y

Converting a real parameter to "Vector Y" adds sub-parameters:

  • vector "Vector"
  • real "Scalar"

The return value is:

  Vector.Y * Scalar

Gradient Color

Converting a color parameter to "Gradient Color" adds sub-parameters:

  • gradient "Gradient"
  • real "Amount"

The return value is the color at position "Amount" in the given "Gradient".

This would allow us to pick specific single colors from a gradient, allow us to color-cycle layers through the colors in a gradient, etc.


Angle Vector Dot

Converting a Real parameter to a " Angle Vector Dot" adds sub-parameters:

  • Vector 1
  • Vector 2

The return value is the arcosine of the scalar product of both vectors divided by the product of their magnitudes.

acos((Vector1 · Vector2)/(|Vector1| * |Vector2|))

This would allow calculate the angle between any two vectors as well as the dot product of two vectors is the product of their absolute values of its magnitudes by the cosine of its angle.

Dot = Vector1 · Vector2 = |Vector1| * |Vector2| * cos(alpha)

there alpha is the angle between vector1 and vector 2. --Genete 09:05, 21 September 2007 (EDT)

Questions

Losing Waypoints

The "Convert" menu allows you to specify that the parameter should be controlled automatically in various ways. Ok, but once the parameter is converted to the other(s) one(s), how can it be automatically controlled? Maybe the parameter is now controlled by waypoints and keyframes as the normal parameters?. I'm interested into this feature because I have found that some layers (Eg. Curve Gradient) donesn't work properly in the version I have of synfigstudio (Vertices are "Unknown type". I hope using "convert" can arrange it and use some types of layers that seems that the default values are incorrectly set. Bye, Genete

What version to do use? When you convert the parameter, all existing waypoints for that parameter are deleted (I think) and you won't be allowed to edit that parameter directly any more. Instead, you edit the new sub-parameters.
Suppose you have a circle. Right-click its radius and convert to linear. Switch to animate-edit-mode, set the default interpolation type to be Constant (that's the very bottom setting in the toolbox window) and at time zero, set the rate to be 0.5 and the offset to be 0.5. That means the radius starts at 0.5 units and grows by 0.5 every second. You might have your parameters to be displayed in 'points' or some other unit. You can change that from the toolbox using File>Setup>Misc>Unit System. Set that to Units for this example. Don't forget to set it back after if you want to work in points again.
You'll see that there are now waypoints on the 'offset' and 'rate' parameters, and you can animate those parameters just like you could animate the radius before.
Go forward to 1s in the animation. You'll see that the circle's radius is now 1 (it grew by 0.5u from 0.5u), and set the rate to -0.5 and the offset to 1.5. This will cause the circle's radius to start shrinking by 0.5 per second from the 1s point onwards. The 1.5 offset is to arrange that the radius doesn't jump suddenly at 1s. If the radius is to go down from 1.0 at 1s at 0.5 per second, it would have been at 1.5 at 0s, so that's the offset we use.
Does that make sense? dooglus
I still having 0.61.05 (apr 29 2007). I hope can update ASAP.
Regarding "Convert" WOW! it is wonderful! absolutely amazing. It opens lots of new possibilities. Thanks for document it. - Genete

Exporting and Connecting

Can converted parameters be linked to other objects' normal/converted parameters? Genete

Yes. The best way to do this is via the 'Export' menu entry. Make sure you only have a single layer selected, then you can right-click on any parameter (regular, or converted) and say 'Export' to make the parameter easily available to other layers. It will ask you to name the parameter. There's a bug in Synfig (up to and including 0.61.06) which causes a crash when renaming exported values, so chose carefully. Then go to the 'Children' dialog, open up the "ValueBase Nodes" tree and you'll see all your exported values there. In the Children dialog, select the one you want to link to. Then select the layer you want to use the exported value in, right-click the parameter and select "Connect". That will connect to whatever is selected in the Children dialog, so long as it is the correct type. (You can't link a color to a vertex - it doesn't make any sense). dooglus 11:06, 6 Sep 2007 (EDT)

One suggestion for the initial description: To convert the value back to its original type, select "Disconnect" from its context menu. I would add: Disconnect would loose all the waypoints of the converted parameters and don't produce a conversion of the inserted waypoints. BTW it could be a very cool feature. Genete

OK, I'll add something like that, but what you wrote isn't quite true. Disconnect will lose all the waypoints only if the parameter hasn't been exported or linked somewhere else.
If you want to try converting a parameter to something else, but don't want it to forget your waypoints, export the parameter before you convert it. Then you can 'Connect' back to it by selecting it in the Children dialog first, then right-click, 'Connect' on the parameter in the Parameters dialog.
It makes some sense now. The Child tab was a mystery to me because always is empty. Ill try it. Genete 16:23, 6 Sep 2007 (EDT). But wait a moment... 'Export' is like keep a animation that can be used later with 'Connect'...? Can I recover the exported animation to play at any moment during time line?... Wow that's so cool!! Genete 16:36, 6 Sep 2007 (EDT)
Not quite. When you export a parameter, what you're exporting is the whole lifetime of that parameter - its waypoints, sub-parameters and so on. What you're talking about is similar to what happens when you export the canvas in an encapsulated layer. Try this: draw something, using a bunch of layers, and encapsulate the layers together into a single layer. Then select that layer and go to its parameters. It has a parameter called 'Canvas'. Export and name that, then look in the Canvases dialog. Double-click your exported canvas and it will open in a window of its own. You can edit it in isolation there. Also, if you look in the Children dialog, you'll see your canvas in the top section, separate from the ValueBase things.
The thing about re-using exported canvases at different points in time is something I've not been able to work out yet. I think it may be possible, but I've not had a good look.
Something else worth mentioning is this: if you look at the parameters for any encapsulated layer, or any "Layers>New>(Other|Default)>PasteCanvas" (I moved it from Default to Other in subversion - it was the only thing in the 'Other' menu), the 'Canvas' parameter gives you a drop-down menu listing all the canvases you've exported. If you have animate-edit mode enabled, then editing this Canvas parameter creates waypoints (although for some reason they don't show up) which keep a record of which canvas is showing when. You can use this to switch between 'scenes' in an animation.
Keep asking the questions - it's good to get this typed up - eventually I might even get around to putting it all in some kind of order!  :) dooglus 18:34, 6 Sep 2007 (EDT)
The problem with your suggestion of the cool feature is that it's possible to produce very complex patterns by using combinations of 'converts' - much more complex than can be created by waypoints, so in general there's no way to produce a set of waypoint to give the same animation. It would be possible to get close, by generating hundreds of waypoints, but that's a waste - why not just keep the type converted? dooglus 11:06, 6 Sep 2007 (EDT)

Also I don't know if conversion would maintain the waypoints of the original parameters. If not it would be also a cool feature. Genete

No, conversion and disconnection both wipe all the waypoints, because there's generally no way to convert between them. The 'undo' (control-z) function will of course get you your waypoints back if you convert by mistake.

Editing Wiki Talk Pages

By the way, when replying to something, use one more ':' at the start of each paragraph than at the start of the thing you're replying to. Then your reply will be indented. Also, typing three '~'s in a row will automatically sign your text (like this: dooglus) - useful for old text you forgot to sign before, and finally, typing four '~'s will sign and date your message, making it easier to follow. Like this: dooglus 11:06, 6 Sep 2007 (EDT)
Thanks for the edition tips and for your patience. I'm not familiar with this kind of editors. Genete 16:23, 6 Sep 2007 (EDT)

Usage of Convert -> BLine

I've discovered an usage of BLine. It is in the same sense that you have explained. Maybe it is my version but if I insert a Curve Gradient using New Layer right-click menu the curve gradient is inserted but the ducks of the curve are not shown so i cannot manipulate or insert any new point in the curve. If you make a Convert-> bline on the Vertexes list then the points ducks are shown and everything works OK. - Genete