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
    • Login
    1. Home
    2. mp5gosu
    M
    • Profile
    • Following 3
    • Followers 4
    • Topics 19
    • Posts 271
    • Best 79
    • Controversial 0
    • Groups 0

    mp5gosu

    @mp5gosu

    123
    Reputation
    473
    Profile views
    271
    Posts
    4
    Followers
    3
    Following
    Joined Last Online
    Website www.roberthitzer.de Location Hamburg Age 41

    mp5gosu Unfollow Follow

    Best posts made by mp5gosu

    • RE: Adding Custom Tree to TreeView.

      For custom nodes, check this thread here: https://developers.maxon.net/forum/topic/7651

      For using GeListNodes, etc. I currently don't have a minimal example. But let me try to bump you in the right direction.

      The TreeViewCustomGui uses a root object. This root is so to say a "container" that holds your list structure. This can be anything - you are then responsible to handle all the actions within the TreeViewFunctions, like GetNext(), GetDown() and so on. It is entirely up to you what you deliver to these functions. This level of abstraction comes with great flexibility.

      If you want to go for GeListNode, the following may work for you:
      Create a GeListHead - this is your root.
      Fill this root with GeListNodes as you desire.
      Then, hand the root over to your TreeViewCustomGui via SetRoot()
      And now, in the TreeViewFunctions, all you have to do is handle the nodes.

      So, if you can go a bit into detail, we should be able to pinpoint a solution.

      If you have any questions, I'll be happy to help. 🙂

      edit: By the way, you may want to start with BaseList2D instead of GeListNode since it already has SetName() / GetName() implemented and also supports selection bits. This is a bit easier to start off if you want to experiment.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Move an object in hierarchy

      Hi, you have to write an own routine for that. I was writing this one a while ago:

      /**
       * @brief Moves all children of srcObj to tgtObj. Adds Undos.
       * @param srcObj The source object
       * @param tgtObj The target object
       */
      inline void g_MoveChildren(BaseObject* srcObj, BaseObject* tgtObj)
      {
      	if (!srcObj)
      		return;
      
      	auto doc = srcObj->GetDocument();
      	if (!doc)
      		return;
      
      	auto child = srcObj->GetDown();
      
      	while (child)
      	{
      		const auto temp = child->GetNext();
      		doc->AddUndo(UNDOTYPE::CHANGE, child);
      		child->Remove();
      		child->InsertUnderLast(tgtObj);
      		child = temp;
      	}
      }
      

      For further information about hierarchy manipulation, see https://developers.maxon.net/docs/cpp/2023_2/page_manual_gelistnode.html#page_manual_gelistnode_lists_edit

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Creating a Circle (spline) with varying number of points.

      You may also want to take a look at the official Cinema 4D SDK for an example of a circle object: https://github.com/PluginCafe/cinema4d_cpp_sdk_extended/blob/master/plugins/cinema4dsdk/source/object/circle.cpp

      Though it's C++, the algorithm should be easily adaptable.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Which message do I receive when a command plugin dialog is closed?

      You can simply implement AskClose(): https://developers.maxon.net/docs/py/2023_2/modules/c4d.gui/GeDialog/index.html?highlight=askclose#GeDialog.AskClose

      Or even DestroyWindow() etc.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: get lamp attributes?

      In Python, it's actually more convenient. You simply access them like this:
      Example is a cube, we want its X-size:
      Cube[c4d.PRIM_CUBE_LEN,c4d.VECTOR_X]
      You can simply drag an object's parameter into the command line of the console or the console itself. It then shows you the parameter names.
      That is the most simple and easiest way.
      However, that might not always work depending on what you want to read, so you have to use BaseContainer or GetParameter() as well.

      Oh and may I kindly ask you for tagging this thread correctly? It makes it easier to search the forums, so other users can benefit from your question.
      https://developers.maxon.net/forum/topic/10953/how-to-post-questions

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Python: Selection tag

      SelectionsTags return BaseSelects.
      You can then iterate over all polygons of your object and select those, that are contained in a BaseSelect.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Save variables during current session (until C4D is closed)

      In addition to @m_adam's answer, you can use GetWorldPluginData() to save variables. Those even do exist after restarting Cinema 4D. You can clear them on application exit.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Dealing with Symbolcache

      'open' or any other pure python function needs to be decoded as utf8.

      See hint here: https://developers.maxon.net/docs/py/2023_2/modules/c4d.storage/index.html?highlight=loaddialog#c4d.storage.LoadDialog

      Edit: a little late. 🙂

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Simulating a Scrub in the Timeline?

      You may want to try ExecutePasses() - that command will animate the current frame of the document and therefore works like scrubbing the timeline.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: How to change the EXR compression method via python

      Oh yes, you are right. The SDK example doesn't work at all.
      Problem is, maxon.Id is wrong. maxon.InternedId would be the correct way for setting the save options. Here's the correct code:

      """
      Copyright: MAXON Computer GmbH
      Author: Maxime Adam
      Description:
          - Configures OpenEXR output render format with SetImageSettingsDictionary() then reads these with GetImageSettingsDictionary().
      Class/method highlighted:
          - c4d.bitmaps.SetImageSettingsDictionary()
          - c4d.bitmaps.GetImageSettingsDictionary()
      Compatible:
          - Win / Mac
          - R20, R21, S22, R23
      """
      import c4d
      import maxon
      
      
      def main():
          # Retrieves render data and its container
          renderData = doc.GetActiveRenderData()
          bc = renderData.GetDataInstance()
      
          # Gets image filters options
          saveOptions = bc.GetContainerInstance(c4d.RDATA_SAVEOPTIONS)
      
          # Sets OpenEXR output format
          bc[c4d.RDATA_FORMAT] = c4d.FILTER_EXR
      
          # Defines OpenEXR settings
          compressionmethodID = maxon.InternedId('net.maxon.mediasession.openexr.export.compressionmethod')
          halffloatID = maxon.InternedId('net.maxon.mediasession.openexr.export.halffloat')
          layernumberingID = maxon.InternedId('net.maxon.mediasession.openexr.export.layernumbering')
      
          # Configures OpenEXR format options with a maxon.DataDictionary
          exportSettings = maxon.DataDictionary()
          exportSettings.Set(compressionmethodID, maxon.Id("rle"))
          exportSettings.Set(halffloatID, True)
          exportSettings.Set(layernumberingID, True)
      
          # Stores settings in render data container
          c4d.bitmaps.SetImageSettingsDictionary(exportSettings, saveOptions, c4d.FILTER_EXR)
      
          # Pushes an update event to Cinema 4D
          c4d.EventAdd()
      
          # Retrieves OpenEXR images settings
          settings = c4d.bitmaps.GetImageSettingsDictionary(saveOptions, c4d.FILTER_EXR)
      
          # Reads and prints OpenEXR format options
          print("openexr.export.compressionmethod: " + str(settings.Get(compressionmethodID)))
          print("openexr.export.halffloat: " + str(settings.Get(halffloatID)))
          print("openexr.export.layernumbering: " + str(settings.Get(layernumberingID)))
      
      
      if __name__ == '__main__':
          main()
      
      posted in Cineware SDK
      M
      mp5gosu

    Latest posts made by mp5gosu

    • RE: Dark theme and accent color

      Hello @r_gigante , thanks for the answer. And yes, thought so.
      By the way, on my company's calibrated display, the red looks way less saturated. Guess, it's time to calibrate my displays again. 🙂

      But for those interested, there are browser extensions to override styles and thus colors. (https://chrome.google.com/webstore/detail/stylish-custom-themes-for/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en)
      Still using it for display the topic titles in original case instead of all uppercase.

      posted in General Talk
      M
      mp5gosu
    • Dark theme and accent color

      Hey there!

      Thank you for finally adding a dark theme to the forum. Just a minor note though: The red used across this site is a bit too agressive. I know that the colors comes from the new CI, bit it really hurts eyes on my display. I know that every display is different, but may it be possible to adjust the value/saturation of the accent color?

      Thanks & best,
      Robert

      posted in General Talk
      M
      mp5gosu
    • RE: UVW coordinates in ShaderData.Output()

      And I'm still convinced that I had the same problem a while ago and managed to draw a custom preview via Draw() method. (There should be a BL entry)
      But still, I don't know if I remember right.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: External dependencies question

      Here you go: https://github.com/NiklasRosenstein/py-localimport
      That helper is also available as a minified version.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Global Matrix - Trying to copy data from Mixamo Control Rig with Python

      You have to update the document each frame with ExecutePasses()
      In your for loop, simply add doc.ExecutePasses(None, True, True, False, c4d.BUILDFLAGS_NONE) as the first method call. (Adjust parameters to your needs.)

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: UVW coordinates in ShaderData.Output()

      As far as I remember, Viewport drawing is handled in Draw() method.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Erratic Keyboard Messages in GeDialog

      Did you try my proposed fix? 😉

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Erratic Keyboard Messages in GeDialog

      This happens because tools that will be called twice in short succession gain focus in the C4D layout. Therefore your Dialog loses focus as the Move tool is bound toE.
      I don't kbnow exactly how to prevent that behavior, but there should be some message that can be processed. SDK team will be more of help here.

      edit: Easy fix: return c4d.NOTOK after your print statement. That consumes the message and does not call the base function, so Cinema simply does not get notified of the event.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Error: Wrong indentation of namespace member

      Are both header files or is the upper one a cpp file?
      Also, do the errors com from Intellisense or is it a style check/compilation error?

      If the LLVM convention is used, the error is correct. LLVM namespace formatting conventions don't use any intentaion. You might be a able to fix this by ignoring this error explicitly.
      It also might be caused by a bug in XCode.

      posted in Cinema 4D SDK
      M
      mp5gosu
    • RE: Purely dynamic description for shader?

      Sure, your statement was correct. That's why I mentioned the possible misunderstanding here. That's on my side (as usual :)).
      You posts are invavuable for all of us, so I'd be damned if I'm going to accuse you of being wrong. 😛

      posted in Cinema 4D SDK
      M
      mp5gosu