• How to enforce StatusBar redraws

    Cinema 4D SDK r21 python windows
    11
    0 Votes
    11 Posts
    1k Views
    M
    I am also having trouble to get the Status bar to update while a script is running. My old scripts using Callcomand nevertheless update the Status bar fine ...?!? nevermind got it working again ... mistake on my end. (passed a small flot to the statusbar instead of 0-100. kind regards mogh
  • DirectSample doc

    Moved Cinema 4D SDK python
    12
    0 Votes
    12 Posts
    2k Views
    a_blockA
    Thanks, Ferdinand
  • Unique name for object

    Cinema 4D SDK c++ python r20
    5
    0 Votes
    5 Posts
    993 Views
    C4DSC
    OK ... so I reinvented the wheel. # make unique tag name def makeUniqueTagName(theTag): if theTag != None: obj = theTag.GetObject() # get all names of the tags of same type usedNames = [] if obj != None: tag = obj.GetFirstTag() while tag != None: # skip the tag and # ignore tags of other types if tag != theTag and tag.IsInstanceOf(theTag.GetType()) == True: usedNames.append(tag.GetName()) tag = tag.GetNext() # If the name is already taken we will append a dot and number # and increment the number until a unique name is found. # Note that since we have created the tag we can assume that # the original name does not have a dot and number already. suffix = 0 uniqueName = theTag.GetName() while uniqueName in usedNames: suffix = suffix + 1 uniqueName = theTag.GetName() + '.' + str(suffix) theTag.SetName(uniqueName) return Maybe not the best nor cleanest code, but then again I am not used to code in Python. I am sure others might have a better solution, but this seems to work for what I need, so I am happy with how it turned out.
  • How to Add Multiple Redshift Pazzle Matte AOVs

    General Talk python
    2
    1
    0 Votes
    2 Posts
    1k Views
    ManuelM
    hi, if you wants to know how many AOVs you need for 10 objects you should use Ceil. After that, some math to have your ID raising by 1. numberOfAOVs = math.ceil(10 / 3.0) # will give you 4 for i in xrange(int(numberOfAOVs)): print ("create aov number {}".format(i)) for j in xrange (3): print ("value of field will be : {}".format(j + i * 3 ) ) I'm not a big fan of retrieving all the objects on each function. But first, make things works, than optimize. (at least at the beginning) Cheers, Manuel
  • 0 Votes
    12 Posts
    2k Views
    ?
    @m_magalhaes That's okay. Thank you for letting me know!
  • Check if the object parameters has been changed

    Cinema 4D SDK python
    6
    0 Votes
    6 Posts
    1k Views
    mfersaouiM
    Hi, Thank you @r_gigante, @zipit for your replies. The problem comes from the GetDDescription funtion because I use some of dynamic parameters on my objects. It is for this reason that op.IsDirty(c4d.DIRTY_DATA) returning True when I Move, Scale, Zoom or Rotate the perspective view.
  • Create a Redshift Camera with Python

    General Talk python r21
    3
    0 Votes
    3 Posts
    762 Views
    C
    Thanks! For whatever reason I couldn't get that particular code to work, but I eventually figured out a different method. I think my script is finished for now.
  • 0 Votes
    6 Posts
    1k Views
    C
    @Cairyn Thanks for this fantastic resource, I will definitely use this summer to level up with Python.
  • Change parameter's unit type

    Moved Cinema 4D SDK python
    5
    0 Votes
    5 Posts
    912 Views
    bacaB
    @zipit thanks a lot, but based on c++ docs made this (seems there are just more checking): def GetDDescription(self, node, description, flags) : data = node.GetDataInstance() if data is None or not description.LoadDescription(node.GetType()): return False singleID = description.GetSingleDescID() paramID = c4d.DescID(c4d.DescLevel(c4d.TESTPLUGIN_OFFSET)) if ( singleID is None or paramID.IsPartOf(singleID)[0] ): bc = description.GetParameterI(paramID) if (bc): if data.GetLong(c4d.TESTPLUGIN_MODE) == TESTPLUGIN_MODE_DISTANCE: bc.SetLong(c4d.DESC_UNIT, c4d.DESC_UNIT_METER) else: bc.SetLong(c4d.DESC_UNIT, c4d.DESC_UNIT_PERCENT) return (True, flags | c4d.DESCFLAGS_DESC_LOADED)
  • Drawing Multiple Lines from TagPlugin

    Cinema 4D SDK s22 python sdk
    3
    1
    0 Votes
    3 Posts
    345 Views
    ?
    @zipit Hahahahaha! Thank you! I see my lines now. Who hoo!
  • BaseDraw in TagDataPlugin

    Cinema 4D SDK s22 python sdk
    3
    0 Votes
    3 Posts
    388 Views
    ?
    @m_adam My apologies for not being clearer. I thought there was something wrong with how I was doing the Draw function. The issue was the TAG_IMPLEMENTS_DRAW_FUNCTION flag was missing. Thank you very much!
  • Render filtered Hardware Preview

    Cinema 4D SDK s22 classic api python
    10
    0 Votes
    10 Posts
    2k Views
    a_blockA
    Thanks for validating my assumptions. Much appreciated. Yes, I already have multiple code branches and for S22 my workaround looks as described. Because it doesn't hurt to insert the RenderData in this case, it doesn't even need multiple branches. Thanks for looking into it, Maxime. Is this going to be fixed in a future version?
  • 0 Votes
    3 Posts
    484 Views
    ?
    @m_magalhaes Remap did the trick! Thanks for the help, Manuel
  • How is NBIT_CKEY_ACTIVE used?

    Cinema 4D SDK python s22 sdk
    3
    0 Votes
    3 Posts
    271 Views
    ?
    @r_gigante Ahhhhhhhh, okay, I get it now. Thank you
  • Get Active Timeline Request

    Cinema 4D SDK
    7
    0 Votes
    7 Posts
    1k Views
    annA
    Indeed a better sdk will be better. I actually also hope that sdk can recognize which parameters of the object are activated in the object manager. I know that because c4d supports opening multiple object managers at the same time, this is really convenient. But it will also make it impossible to know which object manager the user is using, so there is no way to identify it in the current SDK.
  • problem with loading plugin in python_init.py

    Moved Cinema 4D SDK
    3
    0 Votes
    3 Posts
    656 Views
    W
    @m_adam it's strange, but this small script works fine without any problems with cinema 4d s22. cinema 4d r20 show this error only.
  • any way to close cinema 4d from the python script

    Moved Cinema 4D SDK
    4
    0 Votes
    4 Posts
    1k Views
    M
    Hi @wob there is noting built-in for that in Cinema 4D. but you can use the regular python way to kill the current process import signal import os os.kill(os.getpid(), signal.SIGTERM) But I just let you know, that it may be useless by nature python should be pretty good at not creating any memory leak, and should free the data as soon as possible, moreover your approach ( I don't know the whole pipeline) but may also be a big issue for a user since this will clause Cinema 4D without asking for saving. People may lose their work. So I really encourage you to be very careful with the use of this. Cheers, Maxime.
  • pop-up dialog windows and c4dpy : the problem

    Moved Cinema 4D SDK
    3
    0 Votes
    3 Posts
    840 Views
    M
    Hi @wob unfortunately this is not possible, c4dpy is a regular Cinema 4D executed as command line with the NoGui, and as all NoGui Cinema 4D execution, GeDialog is disabled. So its a limitation, and as said by zipit there is no Tkinter shipped with Cinema 4D in order to force people to use Cinema 4D dialog. So possible workarounds are: Install pip and install any 3rd party GUI module (but this is not officially supported by Cinema 4D so you may have some odd issues, but it should work). Execute a python script before from a system python installation that will create the Dialog and later execute c4dpy to do the Cinema 4D work. Cheers, Maxime.
  • "Axis Center " Script button reuse problem

    General Talk r21 python
    3
    0 Votes
    3 Posts
    769 Views
    X
    Thank you very much for your help to solve the previous doubts. I will continue to work hard.