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. pyr
    3. Topics
    P
    • Profile
    • Following 1
    • Followers 0
    • Topics 22
    • Posts 51
    • Best 6
    • Controversial 0
    • Groups 0

    Topics created by pyr

    • P

      Negative Vertex Map values

      General Talk
      • python r25 • • pyr
      3
      0
      Votes
      3
      Posts
      560
      Views

      P

      hey,

      found the error. works exactly as i had planned. my code was correct, but i forgot to switch off use fields on the new vertex i mapped.

      thanks for the help anyway!

      grafik.png

    • P

      MergeDocument under a selected Null

      Cinema 4D SDK
      • python • • pyr
      2
      0
      Votes
      2
      Posts
      356
      Views

      ferdinandF

      Hey @pyr,

      Thank you for reaching out to us. The sentence 'if i do the whole thing via obj.InsertUnder(null) i miss the material' is a bit ambiguous, how do you mean that? I assume you mean that when you load two documents A and B and then start copying objects over by either cloning them or removing them from A and inserting them into B, that you then miss material references. Because the call you show us will load both objects and materials found at f into doc.

      A straightforward way to do what you want to do, parent everything that has been imported to a null, is to track the state of the top-level objects before and after the import. The difference between the states then tells you what to move where. In practice, there are some technical hoops to jump through, primarily the problem that you might run into dead references when you try to store objects references over the import process.

      Cheers,
      Ferdinand

      Result:

      Code:

      """Demonstrates how to parent the objects merged into a document to a null object. Must be run as a script manager script and will import the contents of #FILE into the active document. """ import c4d doc: c4d.documents.BaseDocument # The active document. FILE: str = r"file:///e:/test.c4d" # The document to import. def main() -> None: """ """ # Get the UUID markers of all top level objects. We get the markers and not the object # references because importing a document bears a good chance that these references will be # dead (C4DAtom.IsAlive() == False) when we access them again. uuidCollection: list[bytes] = [] op: c4d.BaseObject = doc.GetFirstObject() while op: uuidCollection.append(bytes(op.FindUniqueID(c4d.MAXON_CREATOR_ID))) op = op.GetNext() # Now we import our document. c4d.documents.MergeDocument(doc, FILE, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS | c4d.SCENEFILTER_MERGESCENE) # We create our null object to parent the imported stuff to. We also add its UUID to # #uuidCollection, so that we do not attempt to parent #null to itself ;) null: c4d.BaseObject = c4d.BaseObject(c4d.Onull) null.SetName(FILE) doc.InsertObject(null) c4d.EventAdd() uuidCollection.append(bytes(null.FindUniqueID(c4d.MAXON_CREATOR_ID))) # Now we iterate again over all top level objects and parent everything that does not appear in # #uuidCollection to #null. op: c4d.BaseObject = doc.GetFirstObject() # We have to do this on two steps, because when we would already move #op in the first step # where we find the things to move, we would sabotage our own loop here (because as soon as # we move the first op to the null, op.GetNext() would be None). move: list[c4d.BaseObject] = [] while op: if bytes(op.FindUniqueID(c4d.MAXON_CREATOR_ID)) not in uuidCollection: move.append(op) op = op.GetNext() # Actually move the items. for op in move: op.InsertUnderLast(null) c4d.EventAdd() if __name__ == "__main__": main()

    • P

      Encouraging evaluation when a document is opened

      Cinema 4D SDK
      • python • • pyr
      3
      0
      Votes
      3
      Posts
      414
      Views

      ferdinandF

      Hello @pyr,

      without any further replies or questions, we will consider this thread as solved by Thursday and flag it accordingly.

      Thank you for your understanding,
      Ferdinand

    • P

      CENTER AN OBJECT IN THE VIEW AND MAXIMIZE ITS SIZE

      Cinema 4D SDK
      • python • • pyr
      3
      0
      Votes
      3
      Posts
      509
      Views

      ferdinandF

      Hello @pyr,

      without any further questions or replies, we will consider this topic as solved by Monday and flag it accordingly.

      Thank you for your understanding,
      Ferdinand

    • P

      How to remove generator childs when converting via "c"

      Cinema 4D SDK
      • python r20 r21 s22 r23 • • pyr
      6
      0
      Votes
      6
      Posts
      862
      Views

      P

      forget about it. i removed the c4d.OBJECT_INPUT flag during development and forgot to add it back.

    • P

      How to change the EXR compression method via python

      Cineware SDK
      • • • pyr
      7
      0
      Votes
      7
      Posts
      1.7k
      Views

      M

      Thanks a lot for the update and yes maxon.InternedId should be used instead of maxon.Id.
      I will take care of updating the example in Github.
      Cheers,
      Maxime.

    • P

      Plugin is evaluated for all frames

      Cinema 4D SDK
      • r21 s22 r23 r20 python • • pyr
      2
      0
      Votes
      2
      Posts
      336
      Views

      ferdinandF

      Hi @pyr,

      thank you for reaching out to us. I am afraid we will need a little bit more than that, as otherwise it will be very hard to answer your question 😉

      What kind of plugin do you implement? What does it do or what would you consider as running?

      On a very abstract level you cannot really prevent plugins from running other than not registering them at the start of the application. But you can of course modify their output depending on basically everything, including render events and at what time offset some given document is.

      Cheers,
      Ferdinand

    • P

      Combine UV and worldposition while shader rendering

      Cinema 4D SDK
      • python • • pyr
      4
      0
      Votes
      4
      Posts
      579
      Views

      ManuelM

      hi,

      I had a look but as @zipit said, there's not way in python.

      Cheers,
      Manuel

    • P

      bc lost stored mesh

      Cinema 4D SDK
      • python • • pyr
      6
      0
      Votes
      6
      Posts
      800
      Views

      P

      After taking a deep dive into the documentation again i figure out that im thinking way to complicated. I use the Cache provided by cinema and write a custom check around it. This avoid using a cached mesh in a baseContainer and also removing a cinema4d breaking memoryleak in my plugin i just found.

      So thank you.

    • P

      Splinefield radius reset to 0 when using takes

      Cinema 4D SDK
      • r20 r21 • • pyr
      3
      0
      Votes
      3
      Posts
      316
      Views

      M

      Hi @pyr I don't think there is anything related to the SDK and its a Cinema 4D bug so I invite you to post it on https://support.maxon.net/open.php

      On the contrary, if you experience this bug only via a script please post your script here so we can help you.

      Cheers,
      Maxime.

    • P

      Avoid creating new field object as child from plugin

      Cinema 4D SDK
      • r21 r20 python • • pyr
      6
      0
      Votes
      6
      Posts
      725
      Views

      P

      Ah sorry.

    • P

      FieldList.GetCount Bug

      Cinema 4D SDK
      • r21 r20 r19 python • • pyr
      2
      0
      Votes
      2
      Posts
      406
      Views

      M

      Hi @pyr, I've just reached the development team about it.

      So for them, this is not a bug since FieldList store only baseLink.
      In Python, we don't have BaseLink, but if you are not aware of what it is, please read BaseLink Manual.

      But since there is no BaseLink in Python, if a link points to a destructed object (like in your case, Python simply returns None)

      So I guess your workaround is ok.
      Cheers,
      Maxime

    • P

      UNIT METER SCALE ISSUE

      Cinema 4D SDK
      • • • pyr
      4
      0
      Votes
      4
      Posts
      521
      Views

      r_giganteR

      Hi pyr, thanks for reaching out us.

      Consider that the Scale modifier operates on the transformation matrix of the object when in Object Mode, whilst it operates on the parameters specified as lengths when in Model Mode.
      Finally, as pointed out by @zipit, providing more context will be definitively beneficial since with a very simple example I'm not able to replicate the issue as well.

      Best, R

    • P

      FIELDLIST SIZE DON'T FIT IN UI

      Cinema 4D SDK
      • python • • pyr
      7
      0
      Votes
      7
      Posts
      973
      Views

      M

      While the bug is still there I set the topic as solved. I will bump the topic once the fix is in a release.

      Cheers,
      Maxime

    • P

      Howto add a Field input to a python plugin

      Cinema 4D SDK
      • python r19 r20 r21 • • pyr
      3
      0
      Votes
      3
      Posts
      440
      Views

      P

      @s_bach said in Howto add a Field input to a python plugin:

      FIELDLIST

      works fine - i think i got an strange error before and trying CUSTOMFIELDLIST etc.

      solved

    • P

      GetContour and GetVirtualObjects in one Plugin

      Cinema 4D SDK
      • python • • pyr
      4
      0
      Votes
      4
      Posts
      751
      Views

      P

      @rsodre works flawless!

    • P

      Generator Plugin update while under Fracture Object

      Cinema 4D SDK
      • r20 python • • pyr
      4
      0
      Votes
      4
      Posts
      576
      Views

      ManuelM

      Hello,

      Sorry for the delay.
      The bugs have been confirmed and will be fixed on a futur release.

      Cheers
      Manuel

    • P

      GeGetModata inside Python Generator returns none

      Cinema 4D SDK
      • r20 python • • pyr
      3
      0
      Votes
      3
      Posts
      560
      Views

      P

      to be honest - i don't know where my fault was. Unhappily i didn't commit the not working version. In my plugin i
      already used a virtual doc for some other calculations. thank you!

      vd.ExecutePasses(c4d.threading.GeGetCurrentThread(), True, True, True, c4d.BUILDFLAGS_NONE) md = c4d.modules.mograph.GeGetMoData(matrix) for m in md.GetArray(c4d.MODATA_MATRIX): rdPoints.append(m.off)

      works like a sharm.

    • P

      keep cinema4d from recalculate generator plugin while switching viewports and documents

      Cinema 4D SDK
      • python r20 • • pyr
      2
      0
      Votes
      2
      Posts
      457
      Views

      r_giganteR

      Hi Pyr, thanks for reaching us.

      With regard to the issue you reported, it looks like there's something unexpected happening that instead of returning the computed cache, regenerate and returns a new cache.

      Although it might occur that switching between documents require the generator to recreate the cache, switching between view definitively it's not supposed to happen.

      Considering that your information doesn't actually help too much in understanding how you're evaluating cache dirtiness nor what changes are you're checking in the vertexmap, could please post fragments of the code or, alternatively, try to reuse your cache dirtiness mechanism on an "simpler" plugin to see if it works reliably?

      Looking forward further comments, give best.

      Riccardo

    • P

      Matrix generates no points while on vertex mode using a spline generator plugin

      Cinema 4D SDK
      • python r20 • • pyr
      3
      0
      Votes
      3
      Posts
      679
      Views

      P

      Ok this was defently my fault. It works now.
      I was using GetVirtualObjects instead of GetContour.