Difference between revisions of "PanelValue Class"

From Derivative
Jump to navigation Jump to search
(PanelValue Class Auto Create)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{TDClassSummary|summary=A PanelValue describes an instance to a Panel Value.  They can be accessed through a component's panel member, and are used in the Panel Execute DAT.}}
+
{{TDClassSummary|label=PanelValue|summary=A PanelValue describes an instance to a [[Panel Value]].  They can be accessed through a component's [[Panel|panel]] member, and are used in the [[Panel Execute DAT]].
{{HelpbodyBegin}}
+
 
 +
For a list of available panel values, see: [[Panel Value]].}}
 +
<section begin=HELPBODY />
 
{{ClassMemberSection|empty=
 
{{ClassMemberSection|empty=
 
|Sectionsummary=
 
|Sectionsummary=
Line 8: Line 10:
 
     |class=PanelValue
 
     |class=PanelValue
 
     |name=name
 
     |name=name
     |returns=
+
     |type=str
 
     |set=0
 
     |set=0
     |text=The name of the panel value. See Panel Value for the list of possible names. name is a string.
+
     |text=The name of the panel value. See [[Panel Value]] for the list of possible names. name is a string.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=PanelValue
 
     |class=PanelValue
 
     |name=owner
 
     |name=owner
     |returns=
+
     |type=OP
 
     |set=0
 
     |set=0
     |text=The OP to which this object belongs.
+
     |text=The [[OP Class|OP]] to which this object belongs.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=PanelValue
 
     |class=PanelValue
 
     |name=val
 
     |name=val
     |returns=
+
     |type=value
     |set=0
+
     |set=1
 
     |text=Get or set the panel value.
 
     |text=Get or set the panel value.
 
}}
 
}}
Line 29: Line 29:
 
     |class=PanelValue
 
     |class=PanelValue
 
     |name=valid
 
     |name=valid
     |returns=
+
     |type=bool
 
     |set=0
 
     |set=0
 
     |text=True if the referenced panel value currently exists, False if it has been deleted.
 
     |text=True if the referenced panel value currently exists, False if it has been deleted.
Line 36: Line 36:
 
|Sectionsummary=
 
|Sectionsummary=
 
|items=
 
|items=
 +
{{SubSection|title=Casting to a Value
 +
|text=The PanelValue Class implements all necessary methods to be treated as a number or string, which in this case gets or sets its value. Therefore, an explicit call to eval() or set() is unnecessary when used in a parameter, or in a numeric expression.
 +
For example, the following are equivalent in a parameter:
 +
<syntaxhighlight lang=python>
 +
(float)parent().panel.u
 +
parent().panel.u.val
 +
parent().panel.u
 +
 +
# the following are also equivalent
 +
parent().panel.u.val + 1
 +
parent().panel.u + 1
 +
 +
# as are the following
 +
parent().panel.u.val = 0.5
 +
parent().panel.u = 0.5
 +
</syntaxhighlight>
 +
}}
 
}}
 
}}
{{HelpbodyEnd}}
+
<section end=HELPBODY />
 
{{History}}
 
{{History}}
 
{{#invoke:Category|list|Python Reference}}
 
{{#invoke:Category|list|Python Reference}}

Latest revision as of 18:35, 18 March 2021

A PanelValue describes an instance to a Panel Value. They can be accessed through a component's panel member, and are used in the Panel Execute DAT.

For a list of available panel values, see: Panel Value.


Members[edit]

namestr (Read Only):

The name of the panel value. See Panel Value for the list of possible names. name is a string.

ownerOP (Read Only):

The OP to which this object belongs.

valvalue :

Get or set the panel value.

validbool (Read Only):

True if the referenced panel value currently exists, False if it has been deleted.

Methods[edit]

No operator specific methods.

Casting to a Value[edit]

The PanelValue Class implements all necessary methods to be treated as a number or string, which in this case gets or sets its value. Therefore, an explicit call to eval() or set() is unnecessary when used in a parameter, or in a numeric expression. For example, the following are equivalent in a parameter:

(float)parent().panel.u
parent().panel.u.val
parent().panel.u

# the following are also equivalent
parent().panel.u.val + 1
parent().panel.u + 1

# as are the following
parent().panel.u.val = 0.5
parent().panel.u = 0.5

TouchDesigner Build: