Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Register
    • Login
    1. Maxon Developers Forum
    2. wen
    3. Topics
    W
    • Profile
    • Following 0
    • Followers 0
    • Topics 5
    • Posts 16
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by wen

    • W

      adding assets to a userdatabase in the assetbrower with Python

      Bugs
      • python • • wen
      9
      0
      Votes
      9
      Posts
      997
      Views

      M

      Hi @wen I've moved your topic to the bug section since it's indeed a bug, I will ping you on this topic once the fix is available, it should come in one of the next update.
      The issue is that the internal cache is not properly updated and therefor this is failing.

      With that's said there is a ugly workaround which consist of calling it twice so the cache is properly updated.
      Find bellow a version that is going to work in all versions

      import c4d import maxon import os def CreateRepFromUrl(url: maxon.Url) -> maxon.UpdatableAssetRepositoryRef: """Create a new repository from a given database URL. If there is no valid database at the given URL, it creates a database at the URL. It always create a new repository and the associated database asset, even if there are existing repositories for that database. """ # Make type checks if not isinstance(url, maxon.Url): raise TypeError("First argument is not a maxon.Url") # Create a unique identifier for the repository. rid = maxon.AssetInterface.MakeUuid(str(url), True) # Repositories can be composed out of other repositories which are called bases. In this # case no bases are used to construct the repository. But with bases a repository for all # user databases could be constructed for example. bases = maxon.BaseArray(maxon.AssetRepositoryRef) # Create a writable and persistent repository for the database URL. If #_dbUrl would point # to a location where no database has been yet stored, the necessary data would be created. if c4d.GetC4DVersion() < 2025200: try: repository = maxon.AssetInterface.CreateRepositoryFromUrl( rid, maxon.AssetRepositoryTypes.AssetDatabase(), bases, url, True, False, False, None) except Exception as e: repository = maxon.AssetInterface.CreateRepositoryFromUrl( rid, maxon.AssetRepositoryTypes.AssetDatabase(), bases, url, True, False, False, None) else: try: repository = maxon.AssetInterface.CreateRepositoryFromUrl( rid, maxon.AssetRepositoryTypes.AssetDatabase(), bases, url, True, False, False) except Exception as e: repository = maxon.AssetInterface.CreateRepositoryFromUrl( rid, maxon.AssetRepositoryTypes.AssetDatabase(), bases, url, True, False, False) if not repository: raise RuntimeError("Repository construction failed.") return repository if __name__ == '__main__': if not maxon.AssetDataBasesInterface.WaitForDatabaseLoading(): raise RuntimeError("Could not load asset databases.") dbPath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "testdb") print(CreateRepFromUrl(maxon.Url(dbPath)))

      Cheers,
      Maxime.

    • W

      connect material to reference node

      Cinema 4D SDK
      • 2025 python • • wen
      6
      0
      Votes
      6
      Posts
      856
      Views

      ferdinandF

      Hey,

      Node attributes are things that are directly present on a GraphNode. You could also call them fields, because a GraphNode like many things in our API has qualities of a DataDictionay, i.e., you can write values over keys into it, just like for Python's own dict.

      Such node attributes (for true nodes) are then rendered out quite similarly to port values in the Attribute Manager but they are fundamentally different from ports, as users cannot drive their value with a connection, i.e., the value of a port of another node. And a port also always requires another GraphNode attached to the true node¹ for which they are a port, while the attribute sits directly on the true node.

      An attribute, e.g., the name of a node, will also never show up in the node representation in the graph. In the screen below I for example right clicked on the RS Reference node and invoked Add Input > All; but things like Name, Color, Show Preview etc. are alle not listed.

      174097cf-d777-49d2-b0ea-0057c8474a5e-image.png

      That is because they are all attributes and not ports. There is unfortunately no absolute rule like 'everything in Basic is attributes and everything else is ports'. While it holds (for now) true that everything in Basic is an attribute, especially Redshift also puts attributes into other tabs. They usually only appear in more complex scenarios when dealing with port bundles and variadic ports, but they exist.

      And just for clarity, attributes do not only exist on nodes that are what our API calls 'true nodes'¹, but also on other GraphNode types, e.g., a GraphNode representing a port. It is just that they are usually not rendered out to the GUI there and more of an internal nature (nodes have a lot of internal attributes).

      Cheers,
      Ferdinand

      ¹ GraphNode instances that represent what the end user would consider a 'node', e.g., the RS Reference node, and with that excluding GraphNode instances that for example represent an input port.

    • W

      Access renderer specific settings with python

      Cinema 4D SDK
      • sdk python • • wen
      6
      0
      Votes
      6
      Posts
      1.6k
      Views

      ferdinandF

      Hey @wen,

      Thanks for sharing the example scene!

      Got a new question though, what do you mean with:

      "In R25 Redshift does not have a "Raw" color profile anymore"

      I looked at the wrong parameter; I thought your second script was still for REDSHIFT_RENDERER_COLOR_MANAGEMENT_OCIO_RENDERING_COLORSPACE as the previous example, but it is for REDSHIFT_RENDERER_COLOR_MANAGEMENT_OCIO_VIEW. So, you are right, "Raw" is still there 🙂

      Cheers,
      Ferdinand

    • W

      Identify when scene is rendering (Redshift)

      Cinema 4D SDK
      • python • • wen
      6
      0
      Votes
      6
      Posts
      979
      Views

      rsodreR

      @wen I was trying to do the same the past days.
      I could'nt figure out how to detect if Redshift IPR is enabled, but I found some relevant RS Ids.

      The 1038666 command opens the IPR window, but as far as I know there's no way to get the dialog instance to call IsOpen()

      The 1036752 CoreMessage is sent during IPR renders, but without any additional parameters (PAR1/PAR2). Not sure if there's something else we can extract from that message.

      What I ended up doing is adding a bool to my plugin to enable IPR features, but would be good to enable automatically.

    • W

      Get mode (object, face, edge, point) with python

      Cinema 4D SDK
      • python • • wen
      4
      0
      Votes
      4
      Posts
      665
      Views

      W

      Thanks Sebastian.