Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add percent input node #2076

Merged
merged 12 commits into from
Aug 11, 2023
30 changes: 30 additions & 0 deletions backend/src/packages/chaiNNer_standard/utility/value/percent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from __future__ import annotations

from nodes.properties.inputs import SliderInput
from nodes.properties.outputs import NumberOutput

from .. import value_group


@value_group.register(
schema_id="chainner:utility:percent",
name="Percent",
description="Outputs the given percent.",
icon="MdCalculate",
inputs=[
SliderInput(
"Percent",
minimum=0,
maximum=100,
default=50,
precision=0,
controls_step=1,
unit="%",
),
],
outputs=[
NumberOutput("%", output_type="Input0"),
],
)
def percent_node(number: int) -> int:
return number