Difference between revisions of "Talk:Convert"

From Synfig Studio :: Documentation
Jump to: navigation, search
(Compatibility (Yoyobuae's table format suggestion): editing table width)
m (Compatibility (Yoyobuae's table format suggestion): removed suggested table format - it's now in use on the page itself)
Line 232: Line 232:
  
 
Link = 1/X; Resulting Value = 1/(1/X) = X
 
Link = 1/X; Resulting Value = 1/(1/X) = X
 
== Compatibility (Yoyobuae's table format suggestion) ==
 
<blockquote>
 
{| style="width:55%"
 
| '''Version''' || '''Revision''' || '''Convert'''
 
|-
 
| '''(0.61.08)''' || ''not yet released''
 
|-
 
| &nbsp; || 1694 || [[#BLine Width|BLine Width]]
 
|-
 
| &nbsp; || 1691 || [[#Step|Step]]
 
|-
 
| &nbsp; || 1354 || [[#Subtract|Subtract]] (for gradients)
 
|-
 
| &nbsp; || 1354 || [[#Add|Add]] (for gradients)
 
|-
 
| &nbsp; || 1267 || [[#From Integer|From Integer]]
 
|-
 
| &nbsp; || 1267 || [[#Duplicate|Duplicate]]
 
|-
 
| &nbsp; || 1238 || [[#Reciprocal|Reciprocal]]
 
|-
 
| &nbsp; || 1226 || [[#Time Loop|Time Loop]]
 
|-
 
| &nbsp; || 1162 || [[#Reverse Tangent|Reverse Tangent]]
 
|-
 
| &nbsp; || 1132 || [[#aTan2|aTan2]]
 
|-
 
| &nbsp; || 1111 || [[#Cos|Cos]]
 
|-
 
| &nbsp; || 923 || [[#Switch|Switch]]
 
|-
 
| &nbsp; || 907 || [[#Random|Random]]
 
|-
 
| &nbsp; || &nbsp; ||
 
|-
 
| '''(0.61.07)''' || 878 || &nbsp;
 
|-
 
| &nbsp; || 776 || [[#Range|Range]]
 
|-
 
| &nbsp; || 744 || [[#BLine Vertex|BLine Vertex]]
 
|-
 
| &nbsp; || 744 || [[#BLine Tangent|BLine Tangent]]
 
|-
 
| &nbsp; || 742 || [[#Add|Add]]
 
|-
 
| &nbsp; || 739 || [[#Exponential|Exponential]]
 
|-
 
| &nbsp; || 666 || [[#Repeat Gradient|Repeat Gradient]]
 
|-
 
| &nbsp; || 610 || [[#Timed Swap|Timed Swap]]
 
|-
 
| &nbsp; || &nbsp; ||
 
|-
 
| '''(0.61.06)''' || 536 || &nbsp;
 
|-|}
 
</blockquote>
 

Revision as of 20:29, 6 March 2008

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)


Interval

Converting a Real, Angle, Integer (or other kind of scalar parameter) adds sub-parameters:

  • MAX
  • MIN
  • Scalar

The return value is the same number than the given by Scalar but truncated to its boundaries MAX, MIN.

 if Scalar >= MAX then return MAX
 else if Scalar <= MIN then return MIN
 else return Scalar
 end

This would allow link parameters of objects to the same of other objects but limited to certain intervals. The intervals could be also linked to other objects parameters so it would allow maintain the movement of a layer/Vertex or what ever other parameter inside certain limits defined by drawn parameters... --Genete 02:28, 27 September 2007 (EDT)

Thanks for the suggestion. I just added it, in r776 and r777.
I called it 'Range', since it specifies a range of acceptable values. Hope that's OK with you! -- dooglus 17:19, 27 September 2007 (EDT)
It is prefect! Range is a more precise name. Thanks for implement it so fast, you're welcome!. I think this conversion would be very useful to limit rotations and translations. I've just compiled from svn r780 and it works great!--Genete 18:05, 27 September 2007 (EDT)

Switch

Converting a any parameter to Switch adds tree sub-parameters:

  • Link (reference)
  • Link Alternative (reference)
  • Switch (on/off)

The returned value is Link is Switch sub parameter is set to off (default value) and Link Alternative if the Switch sub parameter is set to on.

It will allow modify the parameter to different types of conversions and also different exported parameters during animation. For example make a layer to follow two different Blines during animation.

Also it would eventually allow to link or unlink vertex to other vertex. --Genete 06:54, 13 October 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

Converting Color parameter to Add

I don't understand this kind of conversion for colors. If I convert a color into a Add type then it displays three sub parameters: LHS (color), RHS (color) and Scalar (float). The wiki says that the result is (LHS+RHS)*Scalar. The result not always is the thing one could think it would work. I believe that the RGBA individual values of each LHS and RHS colors are added and multiplied by the scalar. Maybe this should be the right way but in my opinion the colors should be truncated to its maximum - minimum values (0-100). If not you're obtaining an alpha value of bigger than 100 that only have sense for the amount parameter. For the rest of RGB values added values gives a shift in its meaning so red becomes green and green red. Just a thought. --Genete 14:24, 24 September 2007 (EDT)

It does exactly that - for each of R, G, B, and A, it added LHS + RHS and multiplies the result by the scalar. If Scalar=0.5 then this can be used to take the mean average of 2 colors. If any of R,G,B,A go <0 or >100, that doesn't matter. Synfig works with colors outside the range 0-100. I don't really understand it, but a color with an Alpha of 1000 on a layer with amount of 0.1 will be more opaque than a color with Alpha 100 on the same layer. I think this may have something to do with Synfig's HDRI aspirations. dooglus 15:45, 24 September 2007 (EDT)

Segment - Unknown Data type -

When converting a Vertex to Segment Vertex or Segment Tangent it creates two sub parameters one of them is called SEG Segment. When double click for editing it says "Unknown Data type". Is a data type pending to define, a bug or other thing? What should be a Segment then? --Genete 18:33, 27 September 2007 (EDT)

I never tried editing one directly before, so I hadn't seen that message. Try right-clicking the segment and converting it to composite - then you'll see what it is. Also, see Types for a list of the 13 types that Synfig uses.
I think it is probably what synfig used before blines were added - it's a single spline curve, with 2 points and 2 tangents. Basically, it's a bline, but with only 2 vertices. Maybe we don't need it any more, but I don't like modifying code when I don't understand the consequences. I do enough of that already... -- dooglus 18:58, 27 September 2007 (EDT)

Default values for Conversions

When you have a constant Value Node with a current value and you convert it to any of the convert types it would be desirable that the resulting value of the converted type returns the same than the original constant value.

Current definitions of Exponential and Reciprocal convert types changes the value of the Value Node being converted.

I propose these changes:


  1. Exponential:

Current behaviour:

Converting a Real ValueNode = X to Exponential gives:

Exponent = 1 ; Scale = X ; Resulting Value = e¹*X

Desired behaviour:

Converting a Real ValueNode = X to Exponential gives:

Exponent = 0 ; Scale = X ; Resulting Value = e°*X = X

  1. Reciprocal:

Current behaviour:

Converting a Real ValueNode = X to Reciprocal gives:

Link = X ; Resulting Value = 1/X

Desired behaviour:

Converting a Real ValueNode = X to Reciprocal gives:

Link = 1/X; Resulting Value = 1/(1/X) = X