<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[FieldList Enable Clamping]]></title><description><![CDATA[<p dir="auto">Hi.</p>
<p dir="auto">I'm working on a plugin that utilizes a FieldList control that I am creating using custom data type CUSTOMDATATYPE_FIELDLIST. My issue comes in with the "Enable/Disable Value Clamping" control and not being able to change it using code.</p>
<p dir="auto">I've looked through the sdk in relation to the FieldList entry and couldn't find anything that refrences it. The closest thing I could find was the FIELDLIST_FLAGS::CLAMPOUTPUT which not suprisingly had no effect on the control when used with SetFlags.</p>
<p dir="auto">This is my code for creating my FieldList control.</p>
<pre><code>	DescID DescFieldGroup = DescLevel(idFieldGroup, DTYPE_GROUP, 0);
	if (!singleid || DescFieldGroup.IsPartOf(*singleid, NULL))
	{
		BaseContainer bc;
		bc = GetCustomDataTypeDefault(DTYPE_GROUP);
		bc.SetInt32(DESC_COLUMNS, 1);
		bc.SetBool(DESC_SCALEH, TRUE);
		if (!description-&gt;SetParameter(DescFieldGroup, bc, idMainGroup))
			return TRUE;
	}
	cid = DescLevel(idGrowField, CUSTOMDATATYPE_FIELDLIST, 0);
	if (!singleid || cid.IsPartOf(*singleid, NULL))
	{

		BaseContainer bc;
		bc = GetCustomDataTypeDefault(CUSTOMDATATYPE_FIELDLIST);
		bc.SetBool(DESC_FIELDLIST_NOCOLOR, TRUE);
		
		bc.SetBool(DESC_FIELDLIST_NODIRECTION, TRUE);
		bc.SetBool(DESC_FIELDLIST_NOROTATION, TRUE);

		if (!description-&gt;SetParameter(cid, bc, DescFieldGroup))
			return TRUE;
	}
</code></pre>
<p dir="auto">Is it possible to change the control via code or can it only be changed manually by a user.</p>
<p dir="auto">Any help would be greatly appreciated.</p>
<p dir="auto">John Terenece</p>
]]></description><link>http://developers.maxon.net/forum/topic/14472/fieldlist-enable-clamping</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 15:24:46 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/14472.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 22 Mar 2023 21:17:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to FieldList Enable Clamping on Fri, 24 Mar 2023 17:06:24 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, that was exactly what I was looking for.</p>
<p dir="auto">John Terenece</p>
]]></description><link>http://developers.maxon.net/forum/post/71083</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/71083</guid><dc:creator><![CDATA[JohnTerenece]]></dc:creator><pubDate>Fri, 24 Mar 2023 17:06:24 GMT</pubDate></item><item><title><![CDATA[Reply to FieldList Enable Clamping on Fri, 24 Mar 2023 14:00:34 GMT]]></title><description><![CDATA[<p dir="auto">hi,</p>
<p dir="auto">for this, you must use the function <a href="https://developers.maxon.net/docs/cpp/2023_2/class_field_list.html#a1e495394fc5a1afd72d7ac1e6cffc115" target="_blank" rel="noopener noreferrer nofollow ugc">SetFlags</a> on the Field data and update the data on the object. The flag that must be set is <code>FIELDLIST_FLAGS::CLAMPOUTPUT</code></p>
<p dir="auto">Unfortunately, the UI do not update, you must deselect and reselect the object. I did not find anything yet to address this issue.<br />
I used c++ this time to be sure nothing was wrong with python.</p>
<pre><code class="language-cpp">BaseObject* op = doc-&gt;GetActiveObject();
if (!op)
	return maxon::NullptrError(MAXON_SOURCE_LOCATION);

GeData data;
op-&gt;GetParameter(FIELDS, data, DESCFLAGS_GET::NONE);
FieldList* fl = static_cast&lt;FieldList*&gt;(data.GetCustomDataType(CUSTOMDATATYPE_FIELDLIST));
fl-&gt;SetFlags(FIELDLIST_FLAGS::CLAMPOUTPUT, false);
op-&gt;SetParameter(FIELDS, GeData(CUSTOMDATATYPE_FIELDLIST, *fl), DESCFLAGS_SET::NONE);
</code></pre>
<p dir="auto">python code just in case</p>
<pre><code class="language-python">    fl = op[c4d.FIELDS]
    toggle = fl.CheckFlag(c4d.FIELDLIST_FLAGS_CLAMPOUTPUT)
    fl.SetFlags(c4d.FIELDLIST_FLAGS_CLAMPOUTPUT, not toggle)
    op[c4d.FIELDS] = fl
</code></pre>
<p dir="auto">Cheers,<br />
Manuel</p>
]]></description><link>http://developers.maxon.net/forum/post/71080</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/71080</guid><dc:creator><![CDATA[Manuel]]></dc:creator><pubDate>Fri, 24 Mar 2023 14:00:34 GMT</pubDate></item><item><title><![CDATA[Reply to FieldList Enable Clamping on Thu, 23 Mar 2023 15:55:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/manuel">@<bdi>Manuel</bdi></a><br />
Thanks for the reply.</p>
<p dir="auto">What I'm trying to change is this control.</p>
<p dir="auto"><img src="https://developers.maxon.net/forum/assets/uploads/files/1679586832539-clamp.png" alt="Clamp.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">John Terenece</p>
]]></description><link>http://developers.maxon.net/forum/post/71066</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/71066</guid><dc:creator><![CDATA[JohnTerenece]]></dc:creator><pubDate>Thu, 23 Mar 2023 15:55:48 GMT</pubDate></item><item><title><![CDATA[Reply to FieldList Enable Clamping on Thu, 23 Mar 2023 13:33:39 GMT]]></title><description><![CDATA[<p dir="auto">hi,</p>
<p dir="auto">It is not clear what parameter you want to modify. The code you are sharing is inside GetDDescription i suppose.<br />
You need to user SetParameter on your node itself. The tricky part is to build the DescID to target the right parameter.<br />
You need the ID of your fieldList, the ID of the layer on that list and the parameter ID on that layer. All level must be defined as CUSTOMDATATYPE_FIELDLIST.</p>
<p dir="auto">You must search for the layer inside your field list and call GetUniqueID on it. This will return the correct ID you must use in your DescLevel. Below a script that will flip/flop the parameter "enable/value" for the first layer in the list.<br />
<img src="https://developers.maxon.net/forum/assets/uploads/files/1679578190777-7be77196-b02c-4830-8ea6-6fbf8fef22bd-image.png" alt="7be77196-b02c-4830-8ea6-6fbf8fef22bd-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I created a python script for r20 and for more recent version</p>
<p dir="auto">R20 version</p>
<pre><code>
import c4d

def main():
    # Called when the plugin is selected by the user. Similar to CommandData.Execute.
    effector = op
    if effector is None:
        raise ValueError("there is no active objet")
    
    fieldList  = effector[c4d.FIELDS]
    root = fieldList.GetLayersRoot()
    clampLayer = root.GetDown()
    
    # Retriving the unique ID allows to construct the DescID to target the right parameter.
    clampUniqueID = clampLayer.GetUniqueID()
    
    # Building the DescID
    # This ID is composed of three level:
    # the first one define the field list parameter,
    # the second define  the layer, that is why we need its UniqueID,
    # the last level define the parameter in this layer.
    # Note that all DescLevel are of DataType CUSTOMDATATYPE_FIELDLIST
    enableID = c4d.DescID(c4d.DescLevel(c4d.FIELDS, c4d.CUSTOMDATATYPE_FIELDLIST), c4d.DescLevel(clampUniqueID,  c4d.CUSTOMDATATYPE_FIELDLIST),  c4d.DescLevel(c4d.ID_FIELDLAYER_ENABLE_VALUE, c4d.CUSTOMDATATYPE_FIELDLIST))

    # Retreving the value using GetParameter on the effector itself.
    value  = effector.GetParameter(enableID, c4d.DESCFLAGS_GET_NONE)
    # Define the oposite value
    effector.SetParameter(enableID, not value, c4d.DESCFLAGS_SET_NONE)


    c4d.EventAdd()
if __name__ == '__main__':
    main()
</code></pre>
<p dir="auto">Same example but for more recent version of c4d.</p>
<pre><code>from typing import Optional
import c4d

doc: c4d.documents.BaseDocument  # The active document
op: Optional[c4d.BaseObject]  # The active object, None if unselected

def main() -&gt; None:
    # Called when the plugin is selected by the user. Similar to CommandData.Execute.
    effector :c4d.BaseObject = op
    if effector is None:
        raise ValueError("there is no active objet")
    
    fieldList :c4d.FieldList = effector[c4d.FIELDS]
    root :c4d.GeListHead = fieldList.GetLayersRoot()
    clampLayer :c4d.modules.mograph.FieldLayer = root.GetDown()
    
    # Retriving the unique ID allows to construct the DescID to target the right parameter.
    clampUniqueID = clampLayer.GetUniqueID()
    
    # Building the DescID
    # This ID is composed of three level:
    # the first one define the field list parameter,
    # the second define  the layer, that is why we need its UniqueID,
    # the last level define the parameter in this layer.
    # Note that all DescLevel are of DataType CUSTOMDATATYPE_FIELDLIST
    enableID :c4d.DescID = c4d.DescID(c4d.DescLevel(c4d.FIELDS, c4d.CUSTOMDATATYPE_FIELDLIST), c4d.DescLevel(clampUniqueID,  c4d.CUSTOMDATATYPE_FIELDLIST),  c4d.DescLevel(c4d.ID_FIELDLAYER_ENABLE_VALUE, c4d.CUSTOMDATATYPE_FIELDLIST))

    # Retreving the value using GetParameter on the effector itself.
    value : bool  = effector.GetParameter(enableID, c4d.DESCFLAGS_GET_NONE)
    # Define the oposite value
    effector.SetParameter(enableID, not value, c4d.DESCFLAGS_SET_NONE)


    c4d.EventAdd()
if __name__ == '__main__':
    main()
</code></pre>
<p dir="auto">Cheers,<br />
Manuel</p>
]]></description><link>http://developers.maxon.net/forum/post/71065</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/71065</guid><dc:creator><![CDATA[Manuel]]></dc:creator><pubDate>Thu, 23 Mar 2023 13:33:39 GMT</pubDate></item></channel></rss>