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. gsmetzer
    3. Topics
    G
    • Profile
    • Following 0
    • Followers 0
    • Topics 16
    • Posts 48
    • Best 1
    • Controversial 0
    • Groups 0

    Topics created by gsmetzer

    • G

      Getting radius of text during rendering

      Cinema 4D SDK
      • 2024 python • • gsmetzer
      2
      0
      Votes
      2
      Posts
      357
      Views

      i_mazlovI

      Hi @gsmetzer ,

      Thank you for providing the scene that shows the problem!

      Your code in the Python generator should be scoped with functions and classes. The code outside of main() function is only run once. Please also make sure you're familiar with cinema threading restrictions: Threading Manual.

      Once you cover the code into a separate function it starts working (check the code below). Although, you are kind of misusing the python generator object (as it doesn't generate any cache). The Python Tag could probably be a better fit here.

      Another note is that although changing other object's attributes is somewhat acceptable, you can still fall into a trap of changes being delayed, because of lacking the recalculate pass after you've changed the value. It might be worth trying to store your text in a user data attribute of python generator. And for the text object just create an xpresso tag that drives the text value from the string in the user data attribute of python generator. This way you can fine tune the execution priority order: documentation.

      One more thing. I've also received the missing font error upon loading your test scene, make sure it is fixed to have the code working.

      Cheers,
      Ilia

      Code for your python generator:

      import c4d def foo(): children = op.GetChildren() widths = [] for i in range(len(children)): radius = children[i].GetRad() widths.append(round(radius.x)) return widths def main(): op[c4d.ID_USERDATA,1][c4d.PRIM_TEXT_TEXT] = str(foo()) return
    • G

      Output multiple file types from one render.

      Cinema 4D SDK
      • 2024 python macos windows • • gsmetzer
      4
      0
      Votes
      4
      Posts
      642
      Views

      G

      The API does appear to have movie saving features. https://developers.maxon.net/docs/py/2023_2/modules/c4d.bitmaps/MovieSaver/index.html

    • G

      Multiple unique render files from same file?

      General Talk
      • programming download • • gsmetzer
      5
      0
      Votes
      5
      Posts
      840
      Views

      G

      Ok, I ran into the issue of polling the BatchRender.IsRendering. I don't have the python skills to do multi-threading to check when a render is complete. I was able to hack in a time.sleep function but it is very problematic for longer renders and crashes a lot.

      Instead I went the route of Takes though Take are a bit cumbersome to setup but it is working nicely. I'll post the code here for anyone looking to do something similiar. I can just RenderAllTakes command and get each object rendered with its name using a $Take render token.

      def main(): doc = c4d.documents.GetActiveDocument() inEx = op[c4d.ID_USERDATA,4] # In/Exclude User Data for i in range(0 , op[c4d.ID_USERDATA,4].GetObjectCount()): #Iterate through each shot based on our shot slider in user data activeObj = inEx.ObjectFromIndex(doc, i) #deterimine which object is active if op[c4d.ID_USERDATA,1] == i: activeObj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = False #turn visibility On activeObj[c4d.ID_BASEOBJECT_VISIBILITY_RENDER] = False render_filename = inEx.ObjectFromIndex(doc, i).GetName() #Gets the name of the currently active object op[c4d.ID_USERDATA,5] = render_filename else: activeObj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = True #turn visibility Off activeObj[c4d.ID_BASEOBJECT_VISIBILITY_RENDER] = True c4d.EventAdd() ################ SEND ALL def BuildTakes(): #Sequencer() takedata = doc.GetTakeData() obj = doc.GetActiveObject() #print( Description.GetParameterI(op[c4d.ID_USERDATA,1], ar=None)) inEx = op[c4d.ID_USERDATA,4] # In/Exclude User Data for i in range(0,op[c4d.ID_USERDATA,4].GetObjectCount()): #Sequencer() take = takedata.AddTake(inEx.ObjectFromIndex(doc, i).GetName(), None, None) take.FindOrAddOverrideParam(takedata, obj , c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA, c4d.DTYPE_SUBCONTAINER, 1),c4d.DescLevel(1)), i , backupValue=None, deleteAnim=False) take.FindOrAddOverrideParam(takedata, inEx.ObjectFromIndex(doc, i), c4d.ID_BASEOBJECT_VISIBILITY_EDITOR, False, backupValue=None, deleteAnim=False) take.FindOrAddOverrideParam(takedata, inEx.ObjectFromIndex(doc, i), c4d.ID_BASEOBJECT_VISIBILITY_RENDER, False, backupValue=None, deleteAnim=False) #op[c4d.ID_USERDATA,1] = 0 #Sequencer() #c4d.MSG_DESCRIPTION_CHECKUPDATE #Sequencer() #c4d.EventAdd() def ClearTakes(): tk = doc.GetTakeData() tk.ResetSystem()
    • G

      Any examples of how c4d.gui.BaseCustomGui works?

      Cinema 4D SDK
      • python 2023 2024 • • gsmetzer
      3
      0
      Votes
      3
      Posts
      582
      Views

      G

      This is an excellent explanation , thank you.

    • G

      Frame All command on Spline User Data

      Cinema 4D SDK
      • python 2023 • • gsmetzer
      8
      0
      Votes
      8
      Posts
      1.1k
      Views

      i_mazlovI

      Hi Gabriel,

      Sorry for the delay in this thread.

      Unfortunately you cannot control this folding GUI functionality as it is sealed to the non-public GUI implementation. That would not be the case when using custom GUI implementations.

      Cheers,
      Ilia

    • G

      Trim a bitmap

      Cinema 4D SDK
      • • • gsmetzer
      5
      0
      Votes
      5
      Posts
      833
      Views

      G

      Thank you, @s_bach I have enough here to figure out what I need to do. Cheers!

    • G

      Changing CUSTOMGUI_RANGE

      General Talk
      • • • gsmetzer
      5
      0
      Votes
      5
      Posts
      879
      Views

      r_giganteR

      Hi gsmetzer,

      with regard the use of the range slide in a resource file please have a look at <Cinema 4D folder>/resource/modules/olod.res: the LOD_BAR parameter is a range slider

      With regard to using the NodeData::GetDDescription() please check:

      py-dynamic_parameters_object_r18.pyp py-preference_r19.pyp py-spherify_modifier_r13.pyp

      Best, Riccardo

    • G

      Delete marker with python

      Cinema 4D SDK
      • • • gsmetzer
      3
      0
      Votes
      3
      Posts
      694
      Views

      G

      Thank you @m_adam

      markers[0].Remove()

      worked in the Python Generator without crashing. I hope it isn't stupid to try this. I do plan on converting it to a plugin. Thanks, you can solve this question.

    • G

      Drag and Drop onto Range Slider

      Cinema 4D SDK
      • python r19 • • gsmetzer
      15
      0
      Votes
      15
      Posts
      1.9k
      Views

      ManuelM

      hello,

      I'll mark this thread as solved tomorrow if you have nothing to add.

      Cheers,
      Manuel

    • G

      Set Knot Value of RangeData, bug?

      Cinema 4D SDK
      • r19 python • • gsmetzer
      3
      0
      Votes
      3
      Posts
      492
      Views

      G

      Thank You,
      How embarrassing I forgot to write back to the UserData. (I shouldn't code late at night) Solved.

    • G

      Update timeline markers on user data slider input.

      Cinema 4D SDK
      • python r20 r21 • • gsmetzer
      4
      0
      Votes
      4
      Posts
      687
      Views

      G

      Thank You @m_magalhaes and @zipit

      Both your suggestions were very helpful. The controller works very well @m_magalhaes I just needed to convert my user data input to BaseTime and it works perfectly.

      I was able to solve the updating issue to work how I want. I only needed to add:

      c4d.GeSyncMessage(c4d.EVMSG_TIMECHANGED)

      Now my timeline markers update nicely as I change values.

      This topic can be marked solved.

    • G

      Load file from plugin directory

      Cinema 4D SDK
      • python sdk • • gsmetzer
      4
      0
      Votes
      4
      Posts
      666
      Views

      ManuelM

      hello,

      @zipit thanks for your answer.

      for your next threads, please help us keeping things organised and clean. I know it's not your priority but it really simplify our work here.

      Q&A New Functionality. How to Post Questions especially the tagging part.

      I've added the tags and marked this thread as a question so when you considered it as solved, please change the state 🙂

      In the python help, you have a link to github where you can find examples.
      https://github.com/PluginCafe/cinema4d_py_sdk

      you will see sometimes in those example this code :

      path, fn = os.path.split(__file__) bmp = bitmaps.BaseBitmap() bmp.InitWith(os.path.join(path, "res", "gravitation.tif"))

      Just to add a few words about c4d.storage.GeGetC4DPath() That's the classic API.

      In c++ with the maxon API you have GetUrl

      In Python, in r20 symbol are not set and if you want to retrieve the resource directory it will return the Cinema4D's one and not your plugin's one.

      Cheers
      Manuel

    • G

      Spline User Data Presets

      Cinema 4D SDK
      • python r20 • • gsmetzer
      11
      0
      Votes
      11
      Posts
      1.4k
      Views

      G

      Thank You @m_magalhaes very helpful! I succeeded. I should have been able to figure this out from the example in the API.
      I've used the code basically as you have it with my spline datas saved in different hyperfiles. I then load that data from my tag.

      Thanks again.