• Directory UI component ?

    Cinema 4D SDK
    2
    0 Votes
    2 Posts
    431 Views
    M
    Hi @nicholas_yue this can be done with the CUSTOMGUI_FILENAME Here a complete example import c4d class ExampleDialog(c4d.gui.GeDialog): def CreateLayout(self): """ This Method is called automatically when Cinema 4D Create the Layout (display) of the Dialog. """ settings = c4d.BaseContainer() settings[c4d.FILENAME_DIRECTORY] = True self.AddCustomGui(1000, c4d.CUSTOMGUI_FILENAME, "", c4d.BFH_SCALEFIT | c4d.BFV_CENTER, 0, 0, settings) # Creates a Ok and Cancel Button self.AddDlgGroup(c4d.DLG_OK | c4d.DLG_CANCEL) return True def Command(self, messageId, bc): """ This Method is called automatically when the user clicks on a gadget and/or changes its value this function will be called. It is also called when a string menu item is selected. :param messageId: The ID of the gadget that triggered the event. :param bc: The original message container :return: False if there was an error, otherwise True. """ # User changed the file path if messageId == 1000: print(self.GetFilename(1000)) # User click on Ok button if messageId == c4d.DLG_OK: print(self.GetFilename(1000)) return True # User click on Cancel button elif messageId == c4d.DLG_CANCEL: print("User Click on Cancel") # Close the Dialog self.Close() return True return True def main(): # Creates a new instance of the GeDialog dlg = ExampleDialog() # Opens the GeDialog, since it's open it as Modal, it block Cinema 4D dlg.Open(c4d.DLG_TYPE_MODAL_RESIZEABLE, defaultw=300, defaulth=50) if __name__ == "__main__": main() Cheers, Maxime.
  • Keeping text and edit UI component horizontally

    Moved Cinema 4D SDK
    3
    1 Votes
    3 Posts
    602 Views
    M
    Hi @nicholas_yue I confirm the correct way is to define the number of columns you want in a group. Please next time, post on the correct forum see How to post a Question, to set up tags and be sure to set up your topic as q question(QA Functionality. Cheers, Maxime.
  • Creating Commands for Shortcuts

    Cinema 4D SDK s22 python
    4
    1
    0 Votes
    4 Posts
    413 Views
    ?
    @m_adam Thank you, again, Maxime
  • Colorize plugin object icon

    Cinema 4D SDK python
    4
    0 Votes
    4 Posts
    695 Views
    M
    This functionality only exists since R21, for the previous versions, there is this hack that is very not recommended Plugins in plugin OR icons!!!!!. Cheers, Maxime.
  • Writing/Reading Rendered Image to and from Text

    Cinema 4D SDK python sdk
    13
    0 Votes
    13 Posts
    1k Views
    ?
    @m_adam Thank you, Maxime. I still learned a lot from your help, @zipit , thank you too.
  • 0 Votes
    9 Posts
    1k Views
    B
    @m_adam Thanks for the response. RE: without enabling the Post Deformers option. It seems like so. I initially thought I could reverse engineer it by getting the point's skin influence (its joint and its weight) and in a way factor it with the intended world vector. However, I gave up since I realize point can have several joints and several weight. Haha Don't get me wrong, enabling the post deformer works as expected. The problem comes because of its inherent nature "calculate the points position of the morph after they are deformed by a Deformer." It presupposes that the (near) last deformation comes from the pose morph. For example, Squash/Stretch>Bulge>Bend>Twist>Pose Morph. However, there are cases where the intended deformation is Pose Morph>Squash/Stretch>Bulge>Bend>Twist. So having the post deformer off while still getting the world position desired gives a bit of flexibility. Anyhow, thanks again for the help. I'll just use the post deformer for now and see where I get stuck. Have a great day ahead!
  • 0 Votes
    3 Posts
    382 Views
    B
    @m_adam Thanks for the response. #1 option works as expected.
  • bc lost stored mesh

    Cinema 4D SDK python
    6
    0 Votes
    6 Posts
    1k 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.
  • GetRad() and GetMp() for Selected Points?

    Cinema 4D SDK r21 python
    3
    0 Votes
    3 Posts
    367 Views
    B
    @zipit Thanks for the response. I was able to compute the bounding box as you mentioned. I went with the #2 route. Though I have problem with creating the FFD deformer, but that would be for another thread.
  • 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
    789 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
    1k 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
    962 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
    670 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
    821 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
    330 Views
    ?
    @zipit Hahahahaha! Thank you! I see my lines now. Who hoo!