• Directory UI component ?

    2
    0 Votes
    2 Posts
    430 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.
  • Check for missing textures

    4
    0 Votes
    4 Posts
    837 Views
    indexofrefractionI
    hi and thanks Maxime ! GetAllAssetsNew() is S22 only, and I had problems with InitRender() and Vray Bitmaps so I decided to manually check for the files... I had it already, but GenerateTexturePath() shortens the code quite a bit, because I dont have to check all possible paths. It seem GenerateTexturePath() returns the absolute path, if the file is found somewhere in the texture paths, otherwise it returns None. needs some testing, but until now it seems to work well. best, index
  • Creating Commands for Shortcuts

    s22 python
    4
    1
    0 Votes
    4 Posts
    413 Views
    ?
    @m_adam Thank you, again, Maxime
  • Writing/Reading Rendered Image to and from Text

    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.
  • Keeping text and edit UI component horizontally

    Moved
    3
    1 Votes
    3 Posts
    598 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.
  • Colorize plugin object icon

    python
    4
    0 Votes
    4 Posts
    690 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.
  • bc lost stored mesh

    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.
  • Avoid creating new field object as child from plugin

    r21 r20 python
    6
    0 Votes
    6 Posts
    977 Views
    P
    Ah sorry.
  • Post import - Updating alembic path does not update scene ?

    7
    0 Votes
    7 Posts
    2k Views
    ManuelM
    hi, I'll set this thread to solved without further feedback Cheers, Manuel
  • From Line Object to Spline

    python s22
    5
    0 Votes
    5 Posts
    1k Views
    ManuelM
    hi, I'll consider this thread as solved without further feedback Cheers, Manuel
  • Get visible objects from viewport in commandline

    11
    0 Votes
    11 Posts
    2k Views
    ManuelM
    hi, I tried creating a CommandData that you could be triggered with a parameter --> not working I tried creating a ObjectData that could react to MSG_DOCUMENTINFO in its Message function when the document is loaded --> not working I tried when the program is closing --> not working Based on my knowledge, there's no solution for your issue. Cheers, Manuel
  • Weird Bug on Creating FFD (1) Manually and (2) Script

    r21 python
    3
    0 Votes
    3 Posts
    381 Views
    B
    @m_adam Thanks for the response. #1 option works as expected.
  • Copy, Paste, Flip X a Pose Morph Target?

    r21 python
    12
    0 Votes
    12 Posts
    3k Views
    B
    @m_magalhaes @zipit I managed to flip the mesh (not necessarily a pose morph target since I'd have to know the API). Anyhow, here is a demo of it working: https://www.dropbox.com/s/bh4p26s4m9qwljw/c4d272_flip_miror_mesh.mp4?dl=0 Here is wip script. It only works if the x-axis is dead set on 0. Also, it is slow since it has to loop within a loop. import c4d from c4d import gui # Main function def main(): neutral_geo = doc.SearchObject('neutral_geo') posed_geo = doc.SearchObject('posed_geo') neutral_world_matrix = neutral_geo.GetMg() posed_world_matrix = posed_geo.GetMg() neut_lcl_pnts = neutral_geo.GetAllPoints() neut_gbl_pnts = [point * neutral_world_matrix for point in neut_lcl_pnts] posed_lcl_pnts = posed_geo.GetAllPoints() posed_gbl_pnts = [point * posed_world_matrix for point in posed_lcl_pnts] match_pnts = [] left_pnts = [] right_pnts = [] for idx, point in enumerate(neut_gbl_pnts): if point[0] == 0.0: # ignore points at the world x axis continue if point[0] > 0.0: left_pnts.append((idx,point)) if point[0] < 0.0: right_pnts.append((idx,point)) for left in left_pnts: for right in right_pnts: if left[1][1] == right[1][1]: # check if Y pos match if left[1][2] == right[1][2]: # check if Z pos match if left[1][0] == -1 * (right[1][0]):# check if X pos are inverse match_pnts.append((left[0],right[0])) for pnt in match_pnts: reversed_left = posed_lcl_pnts[pnt[1]] reversed_left[0] = reversed_left[0] * -1 reversed_right = posed_lcl_pnts[pnt[0]] reversed_right[0] = reversed_right[0] * -1 posed_geo.SetPoint(pnt[0], reversed_left) posed_geo.SetPoint(pnt[1], reversed_right) posed_geo.Message(c4d.MSG_UPDATE) c4d.EventAdd() # Execute main() if __name__=='__main__': main()
  • GetRad() and GetMp() for Selected Points?

    r21 python
    3
    0 Votes
    3 Posts
    366 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.
  • This topic is deleted!

    1
    2
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • Shader plugin & object

    7
    0 Votes
    7 Posts
    1k Views
    Y
    I have time and you have my attention sir Manuel! I'm looking forward for this I think adding this feature to C4D will be a good improvement... at least, for those who are interested in. Thank you again
  • Unable to update Alembic path in xref

    6
    0 Votes
    6 Posts
    1k Views
    M
    I know, it's not what you expected but there is for the moment no way to automate this using Cinema 4D API. Cheers, Maxime.
  • Splinefield radius reset to 0 when using takes

    r20 r21
    3
    0 Votes
    3 Posts
    487 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.
  • Check if the object parameters has been changed

    python
    6
    0 Votes
    6 Posts
    961 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.
  • Unique name for object

    c++ python r20
    5
    0 Votes
    5 Posts
    785 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.