Page 4 of 4 FirstFirst 1234
Results 31 to 39 of 39
  1. Collapse Details
    #31
    Default
    Does this COFFEE script work in Mac C4D R12 or R13?

    Is it possible to do this in Python (which seems like the new hotness)?


    Reply With Quote
     

  2. Collapse Details
    #32
    Still "Senior Member" Gord.T's Avatar
    Join Date
    Oct 2006
    Location
    ON Canada
    Posts
    4,007
    Default
    I believe COFFEE is cross platform compatible so yes it should work on the Mac. I haven't look into python for C4D yet although I have dome a bit of it with RealFlow4 and it's a powerfull scripting language.
    I'll be reviewing the scripts and updating them as needed in the next few months or so.
    "Remember To Dip the Right End of the Cigar in your $250.00 dollar glass of Brandy." -Doc Bernard.


    Reply With Quote
     

  3. Collapse Details
    #33
    Still "Senior Member" Gord.T's Avatar
    Join Date
    Oct 2006
    Location
    ON Canada
    Posts
    4,007
    Default
    COFFEE scripting still works up to C4D R17 at least but C4D eventually went with Python exclusively.
    I'm on R20 now and while I can run my old COFFEE scripts on my other PC that has R17 on it I decided, out of need, to finally delve into Python this week so here is my first script.

    I'd be happy to answer any general questions on it but keep in mind I'm a total noob at python...and any code recommendations I'd be very interested in.

    I primarily wrote this code to fix some specific mesh errors on a custom Daz Genesis 8 character. Specifically the distorted eyes generated from a FacegenArtist Pro export and a distortion
    in the hidden teeth/tongue area that I accidentally messed up while sculpting the face in Zbrush (not it's the first time I've done that). So with this script I can quickly 'repair' those mesh areas in C4D without losing
    my current sculpt progress.
    Let me know if you get any use out of it or have any issues ect.

    Code:
    #########################################################################################
    #
    #                 gTransfer Points to a Morphable Polygon Object
    #                 Python script for C4D. Tested on R20 only. April 21 2021. -Gord.T
    #
    #                 Tranfers a point selection from one polygom model to another.
    #                 Both objects must have the same number of points and point indicies.
    #                 In other words one must be morphable to the other.
    #
    #                 Usage:
    #                      Select both the model that has the selected points already selected that you want to tranfer over to
    #                 and the model you want to transfer it to.
    #                 Make sure the 'recieving' model has no points selected.
    #                 Then run the script.
    #
    #
    #
    #########################################################################################
    
    
    import c4d
    from c4d import gui
    
    #======================================
    def gGetNumberOfSelectedPoints(obj):
    
        if not obj:
            gui.MessageDialog("Selected obj is not a valid object. Exiting")
            return-2
    
        bs = obj.GetPointS()# bs means it's a Base Select object.
        if not bs: return -3
        sel = bs.GetAll(obj.GetPointCount())  # Returns a selection of ALL points.
    
        nSelected = 0
        for index, selected in enumerate(sel):
            if not selected: continue
            nSelected = nSelected + 1
    
        return nSelected
    
    #======================================
    
    # Main function
    def main():
    
        print "Start script: gTransfer Points to a Morphable Polygon Object"
    
    
    #---------------------------------------------------------------
        # flags fro GetActiveObjects are:
            # 0 None
            # 1 Children
            # 2 Selection order. The selection array is sorted in the selection order, e.g the first selected object is the first element in the array.
        objs = doc.GetActiveObjects(0) #Look at a list of selected objects.
        if not objs:
            gui.MessageDialog("You must select 2 Polygon objects! One with it's points selected that are to be transferred to the other, and the other without it's points selected. Exiting")
            return
    
    
        nObjs = len(objs)
    
        if nObjs < 2:
            gui.MessageDialog("You must select 2 Polygon objects! One with it's points selected that are to be transferred to the other, and the other without it's points selected. Exiting")
            return
        elif nObjs > 2:
            gui.MessageDialog("You must select only 2 Polygon objects! One with it's points selected that are to be transferred to the other, and the other without it's points selected. Exiting")
            return
    
    
    #---------------------------------------------------------------
    #    We now have 2 objects. One of the two objects must have points selected that are to be tranferred to the second object.
    #    Identify and assign each appropriatly to objSrc and objDest.
    #    Lets assume for now that they are polygon objects because this code my also work on other objects with points.
    
        nPointsSelected_0 = gGetNumberOfSelectedPoints(objs[0])
        nPointsSelected_1 = gGetNumberOfSelectedPoints(objs[1])
    
        if nPointsSelected_0 > 0 and nPointsSelected_1 == 0:
            objSrc = objs[0]
            objDest = objs[1]
        elif nPointsSelected_1 > 0 and nPointsSelected_0 == 0:
            objSrc = objs[1]
            objDest = objs[0]
        elif nPointsSelected_1 > 0 and nPointsSelected_0 > 0:
            gui.MessageDialog('Only one of the two objects must have points selected that are to be transferred to the other. Exiting')
            return
        elif nPointsSelected_1 == 0 and nPointsSelected_0 == 0:
            gui.MessageDialog('One of the 2 objects must have points selected that are to be transferred to the other. Exiting')
            return
        elif nPointsSelected_1 < 0 or nPointsSelected_0 < 0:
            print "gGetNumberOfSelectedPoints return error code: Aborting."
        else:
             gui.MessageDialog('Unknown condition. Exiting')
             return
    
    #---------------------------------------------------------------
    
        bs = objSrc.GetPointS()# bs means it's a Base Select object.
        if not bs: return
        sel = bs.GetAll(objSrc.GetPointCount())  # Returns a selection of ALL points.
    
        for index, selected in enumerate(sel):
            if not selected: continue
            ptSrc = objSrc.GetPoint(index) #returns a vector, the position of a point
    
            objDest.SetPoint(index,ptSrc)
    
        objDest.Message (c4d.MSG_UPDATE) # MUST call this after the object to update it's polygons!!!
    
    #---------------------------------------------------------------
    
    
        c4d.EventAdd() # Update Cinema 4D
        print "Script End: gTransfer Points to a Morphable Polygon Object"
    
    
    
    # Execute main()
    if __name__=='__main__':
        main()
    
    ##############################END###############################
    //April 22

    I know that parts of a Daz mesh could be modified via ZB as well so I did a quick video of that for demonstration purposes only.
    It's not a tutorial and there is no audio.

    gRestoreDazMeshPartsWithGOZ
    https://vimeo.com/539963289

    That method is fine for something that doesn't require a high degree of accuracy. Doing it in C4D with my python script gives me precise control
    over what I'm modifying. I wanted to point out that difference.
    I don't have a video demonstration of using my script method at the moment.
    -------------------
    Last edited by Gord.T; 04-21-2021 at 09:44 PM.
    "Remember To Dip the Right End of the Cigar in your $250.00 dollar glass of Brandy." -Doc Bernard.


    Reply With Quote
     

  4. Collapse Details
    #34
    Default
    Can i ask you, can you port your tpwriter for c4d r12? I'm interested in baking tp to binary or plain, like cashing of core particles. IMP is abbreviated as GNU Interface Manipulation Program which is a tool editor for retouching of images and re-editing it for much for better image interface. Download GIMP 2.6
    Last edited by chadrickt2007; 05-23-2021 at 07:08 AM.


    Reply With Quote
     

  5. Collapse Details
    #35
    Still "Senior Member" Gord.T's Avatar
    Join Date
    Oct 2006
    Location
    ON Canada
    Posts
    4,007
    Default
    Quote Originally Posted by chadrickt2007 View Post
    Can i ask you, can you port your tpwriter for c4d r12? I'm interested in baking tp to binary or plain, like cashing of core particles. IMP is abbreviated as GNU Interface Manipulation Program which is a tool editor for retouching of images and re-editing it for much for better image interface. Download GIMP 2.6
    So it didn't work with R12? (you did mean R12 and not R21) And I assume your on a P.C and not a Mac. I'll have to check my archived disks to see if I still have the original project files (2009). Barring that, the other options would include running it on R10.1 or lastly I could try re-writing the entire plugin for R12. Interesting request though. Give me a week or 2 to look into it. I'll send you a Notification either way as well if I have any luck or not.

    ------------------
    Good News:
    I found the original project files with all of my notes. I had noted at one point I was having issues in R11 along with a code change fix for it. I don't think R12 was ever tested.
    I'll need to explore the project files more and what issues there were and so on...and that missing demo video.

    I had 3 demo versions released TpWriter_V1.4_DemoRelease_X86 was the last in this archive dated 08/07/2009.
    More later.
    Last edited by Gord.T; 05-25-2021 at 01:15 PM.
    "Remember To Dip the Right End of the Cigar in your $250.00 dollar glass of Brandy." -Doc Bernard.


    Reply With Quote
     

  6. Collapse Details
    #36
    Still "Senior Member" Gord.T's Avatar
    Join Date
    Oct 2006
    Location
    ON Canada
    Posts
    4,007
    Default
    chadrickt2007: Here is the latest version I had (it was the newest one and not the one I originally posted in post #6). It was tested in R11 so maybe it will work for R12 for you. Can I ask you to try it and let me know either way and if it still doesn't work then I'll have to reinstall R11 and R12 and RF4 and go from there. I also have the original c++ code to compile the plugin if your into c++ Visual Studio programming at all that you can have.

    So this should be TpWriter_V1.4_DemoRelease_X86.zip ->TpWriter_V1.4_DemoRelease_X86.zip

    Oh no, they're thinking. lolll - TpWriter icon):
    Last edited by Gord.T; 05-26-2021 at 02:58 PM.
    "Remember To Dip the Right End of the Cigar in your $250.00 dollar glass of Brandy." -Doc Bernard.


    Reply With Quote
     

  7. Collapse Details
    #37
    Still "Senior Member" Gord.T's Avatar
    Join Date
    Oct 2006
    Location
    ON Canada
    Posts
    4,007
    Default
    chad: That version probably won't work in R12. I'm looking into it some more to get reacquainted with the process. It has been a few years since I've compiled C4D plugins.

    Significant changes were made in R12, including a completely different internal architecture
    from http://andrewnoske.com/wiki/Cinema_4D_-_C%2B%2B_plugins
    "Remember To Dip the Right End of the Cigar in your $250.00 dollar glass of Brandy." -Doc Bernard.


    Reply With Quote
     

  8. Collapse Details
    #38
    Still "Senior Member" Gord.T's Avatar
    Join Date
    Oct 2006
    Location
    ON Canada
    Posts
    4,007
    Default
    Okay, I'll keep the rest of the updates in this thread and update accordingly. RE: TpWriter.

    * May 28 2021:
    -I've reinstalled R10.1 to begin the plugin tests from there then progressing to R12.
    -I'm not able to find my C4D R11 right now although there are many disks I'd have to check still.
    -I do have R12 but it's not installed yet as I just finished testing in R10.1

    --TpWriter-TpWriter_V1.4_DemoRelease_X86 IS working in R10.1.
    I'll make a demo vid of how to use it because I frankly forgot how to myself and I can't find the original demo vid (previous hard drive crash). So I'll try and have that for viewing tomorrow.

    * I'm still setting up my Visual Studio SDK's for recompiling, and that's being a bugger so far, and then I'll be looking at testing R12, or maybe I'll test V1.4 in it first. i.d.k.
    I'll be back tonight or tomorrow with a demo vid.
    ------
    Quick usage vid for V1.4 using R10.1 https://vimeo.com/556506429
    Last edited by Gord.T; 05-29-2021 at 12:14 AM.
    "Remember To Dip the Right End of the Cigar in your $250.00 dollar glass of Brandy." -Doc Bernard.


    Reply With Quote
     

  9. Collapse Details
    #39
    Still "Senior Member" Gord.T's Avatar
    Join Date
    Oct 2006
    Location
    ON Canada
    Posts
    4,007
    Default
    Here's the c++ source code for TpWriter_V1.4 if anyone else wants to play around with it.



    If and when I get my SDK's setup I'll have another look at porting the code.
    I think X-Particles can export particles as well although that's for R13 and above.

    Good luck.
    Attached Files Attached Files
    Last edited by Gord.T; 05-30-2021 at 02:40 AM.
    "Remember To Dip the Right End of the Cigar in your $250.00 dollar glass of Brandy." -Doc Bernard.


    1 out of 1 members found this post helpful.
    Reply With Quote
     

Page 4 of 4 FirstFirst 1234

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •