Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Login
    1. Maxon Developers Forum
    2. Cinema 4D SDK
    Log in to post
    Load new posts
    • Newest to Oldest
    • Oldest to Newest
    • Most Posts
    • Most Votes
    • Most Views
    • B

      Global Variable doesn't work on CoreMessage?

      r21 python • • bentraje
      7
      0
      Votes
      7
      Posts
      975
      Views

      M

      @bentraje I don't have that much to add on your topic since I think @zipit already explained everything nicely.

      In any case some good resource for you about how global variable works in Python Global keyword in Python and Mutable vs Immutable Objects in Python.

      Regarding your last question, I think you should open a new topic, but the short answer there is no way to pass directly a variable with a MessageData, the best way is to use a scope accessible by both part and store this variable in this shared scope (can be global or any other).

      Cheers,
      Maxime.

    • B

      SetActiveRenderData Does Not Work As Expected?

      r21 python • • bentraje
      3
      0
      Votes
      3
      Posts
      371
      Views

      B

      @PluginStudent

      Thanks for the explanation.
      Your solution works as expected 🙂

    • B

      GetWidth() for GeDialog?

      r21 python • • bentraje
      4
      0
      Votes
      4
      Posts
      399
      Views

      B

      Hi @m_adam .

      Apologies for bringing up the thread again. I just have a follow up question.

      The def Message works well for the consecutive duration of the dialog.
      But for the initial life (i.e on startup), the def Message will not be executed .

      Is there a way to determine the width and height of the dialog upon its startup?

    • D

      Avoiding invalidating saved scenes when implementing Read/Write

      c++ sdk • • doppelgamer
      18
      0
      Votes
      18
      Posts
      2.0k
      Views

      ManuelM

      hi,

      back to the subject, i was tracking the bug and I discovered it was on my chair. After messing around too much about the code, I was doing something very wrong.

      when you register your scenehook what is the level ? (last parameter of RegisterSceneHookPlugin)

      Cheers,
      Manuel

    • rsodreR

      Custom data+gui access with GetParameter()

      c++ r21 r20 r19 • • rsodre
      6
      0
      Votes
      6
      Posts
      1.2k
      Views

      rsodreR

      @m_magalhaes No hurry, for now there's just one place where I need this, I get it using the BaseContainer. But I will probably use it more often, so if the DOTS example is updated I can replicate the solution to my own type and remove this workaround.

      Thanks!

    • C4DSC

      First Time calling SetAction does show the Brush tool's AM

      r20 r21 c++ • • C4DS
      16
      0
      Votes
      16
      Posts
      1.7k
      Views

      C4DSC

      @m_adam said in First Time calling SetAction does show the Brush tool's AM:

      And I did test only on R21 so be sure to check again because I wasn't able to reproduce as you said with default layout in R21.

      Cheers,
      Maxime.

      I am using R21.207 and with default layout see the brush tool in the AM (identical to what happens with R20.059). For safety, I have now tested your solution on R21 and works as expected.

    • M

      PolygonObject.SetSelectEdges() and the Neighbor() class, a giant dilemma

      • • mikegold10
      6
      0
      Votes
      6
      Posts
      1.2k
      Views

      M

      @m_adam said in PolygonObject.SetSelectEdges() and the Neighbor() class, a giant dilemma:
      ...

      Hope it answers your questions,
      Cheers,
      Maxime

      Thank you Maxime, this is a lot of useful info. Let me think through all of this and reply here if I have any further issues.

    • B

      Unnecessary Executions Under BFM_INPUT_VALUE

      r21 python • • bentraje
      5
      0
      Votes
      5
      Posts
      559
      Views

      B

      @zipit

      Thanks for the confirmation! 🙂

    • B

      Changing Display Filter Does Not Work When Rendering?

      r21 python • • bentraje
      4
      0
      Votes
      4
      Posts
      462
      Views

      ManuelM

      Hello,

      thanks for the answer 🙂

      by the way you could also clone the renderdata, modify the clone and send it to as a parameter to the function RenderDocument. That way, you don't have to "restore" them.

      Just in case, don't forget that data may not be saved in the BaseContainer.

      Cheers,
      Manuel

    • SwinnS

      Redshift deleting using old information

      • • Swinn
      17
      0
      Votes
      17
      Posts
      2.5k
      Views

      ManuelM

      hi,

      your question is sometimes not obvious 😄
      Even with the scene it's a bit compicated.

      What i can say about your code is that you should be more defensive in your code. Always check the value before continue.

      For example what if the object is not found ? You should continue to the next item or stop ?

      for item in spline_UD: rs_mat = doc.SearchObject ("S" + str (item) + " Gas") if rs_mat is None: # Because we don't have object to continue, we iterate to the next item. continue ...

      Cheers,
      Manuel

    • SwinnS

      update User Data with Preset info

      python • • Swinn
      5
      0
      Votes
      5
      Posts
      874
      Views

      ferdinandF

      Hi,

      you cannot, because the data container of a BaseList2D is not dynamically typed (like Python itself), but bound to data types specified in its description. If you want to change the data type of an user data element, you will have to modify the description of that element via GetUserDataContainer and SetUserDataContainer. There is also no 2D-Vector type in Cinema, only the crosshair thing custom GUI which you can apply to a Vector description element.

      Cheers,
      zipit

    • E

      Setting up ObjectData plugin priority in Python

      python sdk • • Eduardo Oliveira
      3
      0
      Votes
      3
      Posts
      578
      Views

      M

      Hi @Eduardo-Oliveira first of all welcome on the PluginCafe community.

      I think @zipit already provided you some correct answers or at least point you that this workflow is kind of strange for a Cinema 4D user since normally the object by itself doesn't really set its own position, but it's up to a tag (constraint Tag) to define the object position to another one.

      But in case you really want to do it, doing it in the Execute method of your ObjectData is fine.

      def AddToExecution(self, op, list): list.Add(op, c4d.EXECUTIONPRIORITY_GENERATOR, c4d.EXECUTIONFLAGS_CACHEBUILDING) return True def Execute(self, op, doc, bt, priority, flags): op.SetMg(doc.GetFirstObject().GetMg()) return c4d.EXECUTIONRESULT_OK

      You also need to ensure you registered your object with the flag c4d.OBJECT_CALL_ADDEXECUTION so AddToExecution and Execute are called.

      Cheers,
      Maxime.

    • fwilleke80F

      Draw HUD-like text to viewport

      r21 classic api • • fwilleke80
      12
      0
      Votes
      12
      Posts
      1.8k
      Views

      fwilleke80F

      Hm, not bad. In deed, it has the potential to look more like the "normal" HUD, without doing hacky stunts. And it is a bit faster than DrawMultipleHUDText().

      However, even if I only draw 4 texts using this code, the framerate on my iMac is down to 24 fps (tested in R21). Using my own code, I get 127 fps. I'll see if it can be optimised more (e.g. by making the clip map a member of MyClass so it does not have to be allocated for every draw call.

      Cheers,
      Frank

      EDIT: And it gets slower in a linear way. drawing 4 texts only gives me 12 fps. So, it looked promising, and I thank you very much for the code, as it gives me some new inspiration on how to do text drawing in the viewport), but for what I need to do (drawing > 30 texts on average), it is not suitable.

    • B

      Implement A Rudimentary Licensing Solution?

      r21 python • • bentraje
      13
      0
      Votes
      13
      Posts
      1.2k
      Views

      B

      Thanks will close the thread for now.

    • P

      TreeViewFunctions, two LV_USER fields

      r20 python • • pim
      8
      0
      Votes
      8
      Posts
      951
      Views

      P

      Thanks, it is working.

    • B

      Remove the Default CreateContextMenu in TreeViewFunctions?

      r21 python • • bentraje
      3
      0
      Votes
      3
      Posts
      364
      Views

      B

      @m_magalhaes

      Thanks! It works as expected

    • ?

      Rotating Spline Points

      s22 python sdk • • A Former User
      8
      0
      Votes
      8
      Posts
      1.6k
      Views

      ?

      @nophoto Very nice! Thank you 🏆

    • B

      Will R22 be Python 3 as Python 2 "dies" in 2020?

      r21 python • • bentraje
      4
      0
      Votes
      4
      Posts
      869
      Views

      r_giganteR

      Hi @iluxa7k thanks for following up.

      At the moment, as told in the very first answer, there are no updates I can share about the adoption of Python 3 in C4D. Rest assured that this is still under our PMs' radar.

      Best, Riccardo

    • I

      Make clean-up after script

      python • • iluxa7k
      3
      0
      Votes
      3
      Posts
      570
      Views

      r_giganteR

      Hi @iluxa7k thanks for reaching out us.

      With regard to your question, as already pointed out by @zipit , the Python del statement just is only responsible for decrementing the reference counter for the instance being "deleted" and not to actually free the memory used by the instance itself. This is clearly noted in the official Python documentation on the Note coming along with object.__del__(self) in Python 3 or object.__del__(self) in Python 2 .
      Given that, also consider that the del app statement you've described in your first post might not actually deliver the "clean-up" action you're thinking about.

      Best, Riccardo

    • fwilleke80F

      Debugger says: You MUST NOT NEVER EVER use a modal dialog in a timer

      r20 r21 c++ maxon api classic api macos • • fwilleke80
      24
      0
      Votes
      24
      Posts
      16.1k
      Views

      ManuelM

      arff, that's really strange, I'll send you a simple example and see if the error still happen on your system.