<?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[Load presets args in python?]]></title><description><![CDATA[<p dir="auto">Hey Community,</p>
<p dir="auto">I want to load some presets args for special objects,  e.g, implement the function of selecting and loading preset buttons<br />
<img src="/forum/assets/uploads/files/1746508475968-2c504c88-7958-42c5-9d4b-d4a34b2d80ad-image.png" alt="2c504c88-7958-42c5-9d4b-d4a34b2d80ad-image.png" class=" img-fluid img-markdown" /><br />
but I look the assets api handbook and the <a href="https://developers.maxon.net/docs/cpp/2025_0_1/page_handbook_assetapi_implement_preset_asset_type.html" target="_blank" rel="noopener noreferrer nofollow ugc">preset example</a>, it need a <code>PresetLoadArgs</code> but it seems not valid in python.</p>
<p dir="auto">How can I achieve similar effects in existing versions?</p>
<p dir="auto">Cheers~<br />
DunHou</p>
]]></description><link>http://developers.maxon.net/forum/topic/16221/load-presets-args-in-python</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 16:56:14 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/16221.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 06 May 2025 05:19:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Load presets args in python? on Wed, 07 May 2025 09:03:44 GMT]]></title><description><![CDATA[<p dir="auto">It sounds worth a try, but there may be latency issues when it comes to changes, or data changes can be manually processed during the changes</p>
<p dir="auto">Perhaps for my needs, I can force the database to be use GetSceneRepository, anyway, it's worth a try. Thank you for your guidance <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f60a.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--blush" style="height:23px;width:auto;vertical-align:middle" title=":blush:" alt="😊" /></p>
]]></description><link>http://developers.maxon.net/forum/post/76422</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76422</guid><dc:creator><![CDATA[Dunhou]]></dc:creator><pubDate>Wed, 07 May 2025 09:03:44 GMT</pubDate></item><item><title><![CDATA[Reply to Load presets args in python? on Wed, 07 May 2025 08:08:46 GMT]]></title><description><![CDATA[<p dir="auto">well, that would not change anything about you being able to cache this. When your dialog is being opened, you start a thread which collects that information, and you then build your layout first without that information (i.e., empty combo boxes or wherever you want to put that information), when the thread is done, you invoke a layout rebuild which then uses that new information. You could of course also start the data collection earlier, e.g., when C4DPL_STARTACTIVITY is emitted. But make sure that you then call there <a href="https://developers.maxon.net/docs/py/2025_2_0/modules/maxon_generated/frameworks/asset/interface/maxon.AssetDataBasesInterface.html#maxon.AssetDataBasesInterface.WaitForDatabaseLoading" target="_blank" rel="noopener noreferrer nofollow ugc">WaitForDatabaseLoading</a>.</p>
]]></description><link>http://developers.maxon.net/forum/post/76421</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76421</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Wed, 07 May 2025 08:08:46 GMT</pubDate></item><item><title><![CDATA[Reply to Load presets args in python? on Wed, 07 May 2025 07:28:58 GMT]]></title><description><![CDATA[<p dir="auto">yes, but I want to use it in my own dialog, it needs to be as fast as normal drop down, but it is not a necessary function so I can wait for this.</p>
]]></description><link>http://developers.maxon.net/forum/post/76420</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76420</guid><dc:creator><![CDATA[Dunhou]]></dc:creator><pubDate>Wed, 07 May 2025 07:28:58 GMT</pubDate></item><item><title><![CDATA[Reply to Load presets args in python? on Wed, 07 May 2025 06:11:56 GMT]]></title><description><![CDATA[<p dir="auto">You could just do it in a thread in the background to cache the information.</p>
]]></description><link>http://developers.maxon.net/forum/post/76419</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76419</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Wed, 07 May 2025 06:11:56 GMT</pubDate></item><item><title><![CDATA[Reply to Load presets args in python? on Wed, 07 May 2025 04:03:33 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ferdinand">@<bdi>ferdinand</bdi></a> ,</p>
<p dir="auto">Thanks for the tips, sadly to see that GetDefaultSettings is broken, and I tried GetDefaultObject. It is way too slow, so I had to give up this until GetDefaultSettings fixed.</p>
<p dir="auto">Thanks for your time</p>
<p dir="auto">Cheess~<br />
DunHou</p>
]]></description><link>http://developers.maxon.net/forum/post/76418</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76418</guid><dc:creator><![CDATA[Dunhou]]></dc:creator><pubDate>Wed, 07 May 2025 04:03:33 GMT</pubDate></item><item><title><![CDATA[Reply to Load presets args in python? on Tue, 06 May 2025 16:29:49 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/dunhou">@<bdi>Dunhou</bdi></a>,</p>
<p dir="auto">Thank you for reaching out to us. No, you do not need <code>PresetLoadArgs</code>, these are only required when you want to handle preset asset drag events. To load a preset, you just need <code>maxon.AssetCreationInterface</code>, which has been wrapped for Python. The primary method to use for this would be <code>GetDefaultSettings</code>, which unfortunately is broken. I provide below a workaround with  <code>maxon.AssetCreationInterface.GetDefaultObject</code>.</p>
<p dir="auto">Depending on what you want to do <code>GetDefaultObject</code> will work fine (when you just have to load a handful of predefined presets) or a bit clunky (when you have to discover all preset assets for a given scene element type).</p>
<p dir="auto">Because this concerns a bug, I have moved the topic.</p>
<p dir="auto">Cheers,<br />
Ferdinand</p>
<h4>Result</h4>
<p dir="auto"><img src="/forum/assets/uploads/files/1746548944373-79019eff-94b4-4b2f-8d03-9d469f864a66-image-resized.png" alt="79019eff-94b4-4b2f-8d03-9d469f864a66-image.png" class=" img-fluid img-markdown" /></p>
<h4>Code</h4>
<pre><code class="language-py">"""Demonstrates how the find and apply preset assets.

For this script to work sensibly, you should have a few preset assets for the Cube object, as 
accessible with the preset dropdown in the top right corner of the Attribute Manager.
"""

import c4d
import maxon

doc: c4d.documents.BaseDocument  # The currently active document.
op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.

def main() -&gt; None:
    """Called by Cinema 4D when the script is being executed.
    """
    # Get the global asset repository and all preset assets in it.
    repo: maxon.AssetRepositoryRef = maxon.AssetInterface.GetUserPrefsRepository()
    presets: list[maxon.AssetDescription] = repo.FindAssets(
        maxon.AssetTypes.DefaultsPreset(), maxon.Id(), maxon.Id(), maxon.ASSET_FIND_MODE.LATEST)

    # Now iterate over all assets in it:
    for i, asset in enumerate(presets):
        c4d.gui.StatusSetBar(float(i) / float(len(presets)))
        c4d.gui.StatusSetText(f"Processing {i + 1} of {len(presets)} assets...")

        # Get the name of the asset.
        name: str = asset.GetMetaString(maxon.OBJECT.BASE.NAME, maxon.Resource.GetCurrentLanguage(), "")

        # This is how we would do this normally, but #GetDefaultSettings is brokeen. #types would
        # hold the BaseList2D types #asset is applicable to, and #settings would hold the data
        # container for the preset.
        # types: maxon.BaseArray[maxon.Int32] = maxon.BaseArray(maxon.Int32)
        # settings: c4d.BaseContainer = c4d.BaseContainer()
        # maxon.AssetCreationInterface.GetDefaultSettings(asset, types, settings)

        # As a workarround, we can do this, which even without inserting the nodes, is very much 
        # not a cheap operation. Doing this for a handful of assets (e.g., a list of hard-coded
        # presets) is fine, but for all of them, it takes a while.
        op: c4d.BaseList2D = maxon.AssetCreationInterface.GetDefaultObject(asset)
        if not op:
            continue
        
        # We found an Ocube asset.
        if op.CheckType(c4d.Ocube):
            op.SetName(name)
            doc.InsertObject(op)
    
    c4d.gui.StatusClear()
    c4d.EventAdd()

if __name__ == '__main__':
    main()
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/76415</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76415</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Tue, 06 May 2025 16:29:49 GMT</pubDate></item></channel></rss>