Skip to content

feat: Add support for Angle type to ValueNode_Logarithm (Log converter) - #3607

Closed
nilesh646 wants to merge 1 commit into
synfig:masterfrom
nilesh646:add-angle-log-converter
Closed

nilesh646 wants to merge 1 commit into
synfig:masterfrom
nilesh646:add-angle-log-converter

Conversation

@nilesh646

Copy link
Copy Markdown

This PR adds support for the Angle type in the Logarithm converter (ValueNode_Logarithm). Previously, the converter only accepted Real values. With this update, it can now also accept Angle inputs, which are internally converted to radians (as Real) before applying the logarithmic operation.

Changes Made

  • Modified operator() to handle ValueBase::TYPE_ANGLE safely.
  • Updated check_type() to accept both type_real and type_angle.
  • Improved the class documentation in valuenode_log.h to reflect the new support for Angle.

@nilesh646

Copy link
Copy Markdown
Author

This PR addresses issue #3582 by adding support for the Angle type to the Log converter (ValueNode_Logarithm). I’ve updated both the logic and documentation as suggested.

The PR is currently awaiting workflow approval and reviewer feedback. Kindly let me know if any changes are needed, or if anything else is required from my side to proceed.

Thanks in advance!


Real link = (*link_) (t).get(Real());
ValueBase input_value = (*link_)(t);
Real link = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation issue.

@rodolforg rodolforg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to build synfig once?

Comment on lines +128 to +130
switch (input_value.get_type())
{
case ValueBase::TYPE_REAL:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't work. ValueBase::get_type() doesn't return an enumeration.
Please check other valuenode implementations to see how it should be done.

link = input_value.get(Real());
break;
case ValueBase::TYPE_ANGLE:
link = input_value.get(Angle()); // Angle → Real

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conversion shouldn't be done this way.
You should use an Angle value in an Angle::rad() or Angle:degree() first, and then use .get() to make it a Real value number.
example:

Real real_value = Angle::rad(my_angle_var).get();

Comment on lines +137 to +138
synfig::warning("ValueNode_Logarithm: Unsupported type for input: %d", input_value.get_type());
return 0.0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check other valuenodes to see how we handle bad type cases.

* \brief Computes the natural logarithm (ln) of the input.
*
* Accepts input of type Real or Angle.
* If input is Angle, it is converted to radians before applying log().

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@morevnaproject , should it be parsed as radian or degree first?

@BobSynfig BobSynfig changed the title Add support for Angle type to ValueNode_Logarithm (Log converter) feat: Add support for Angle type to ValueNode_Logarithm (Log converter) Jul 24, 2025
@github-actions

Copy link
Copy Markdown

Thank you for attempting to improve your contribution description!
Below is how your updated contribution will appear in Synfig's release notes. Review it and make further improvements until you're satisfied!

✨ New Features

  • Add support for Angle type to ValueNode_Logarithm (Log converter)

    This PR adds support for the Angle type in the Logarithm converter (ValueNode_Logarithm). Previously, the converter only accepted Real values. With this update, it can now also accept Angle inputs, which are internally converted to radians (as Real) before applying the logarithmic operation.

    Changes Made

    • Modified operator() to handle ValueBase::TYPE_ANGLE safely.
    • Updated check_type() to accept both type_real and type_angle.
    • Improved the class documentation in valuenode_log.h to reflect the new support for Angle.

@Svarov-RZM

Copy link
Copy Markdown
Contributor

I am closing this.
It's stale, feedback wasn't addressed and there's a better one here: #3681

@Svarov-RZM Svarov-RZM closed this Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants