Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. pyr
    P

    pyr

    @pyr

    6
    Reputation
    46
    Posts
    187
    Profile views
    0
    Followers
    1
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    pyr Follow

    Best posts made by pyr

    RE: Python Autocomplete in Script Manger

    here you go:

    https://plugincafe.maxon.net/topic/10784/14228_autocomplete-for-pycharm/2

    posted in Cinema 4D SDK •
    RE: Close any C4D Window

    can't test it right now, but this should do the trick.

    you'll need to install these packages to your c4d installation to make it work

    import win32gui
    import win32ui
    import win32co
    from pynput.keyboard import Key, Controller
    handle = win32gui.FindWindow(0, "Texture Manager")
        try:
            if handle:
                
                keyboard = Controller()    
                win32gui.SetForegroundWindow(handle)
                keyboard.press(Key.ctrl)
                keyboard.press(w)
    
                keyboard.release(Key.ctrl)   
                keyboard.press(w)
        except:
            pass
    
    
    posted in Cinema 4D SDK •
    RE: Python Generator: Getting polygon data from new generators

    The default python generator returns a parametric object (c4d.Ocube). So you have to convert it to a editable poly in the generator itself. So you don't need a cso in your script but in the generator when using parametric objects.

    Python Generator

    import c4d
    #Welcome to the world of Python
    
    
    def main():
        c = c4d.BaseObject(c4d.Ocube)
        return c4d.utils.SendModelingCommand(command = c4d.MCOMMAND_CURRENTSTATETOOBJECT,list    = [c],
                                                     bc      = c4d.BaseContainer(),
                                                     mode    = c4d.MODELINGCOMMANDMODE_ALL,
                                                     doc     = doc,
                                                     flags   = 0)[0]
    

    script

    import c4d
    
    doc = c4d.documents.GetActiveDocument()
    gen =doc.GetActiveObject()
    print gen.GetCache()
    
    
    
    
    posted in Cinema 4D SDK •
    RE: How to remove generator childs when converting via "c"

    forget about it. i removed the c4d.OBJECT_INPUT flag during development and forgot to add it back.

    posted in Cinema 4D SDK •

    Latest posts made by pyr

    Encouraging evaluation when a document is opened

    I have several object plugins and they all have the same problem - my custom caching functions work as expected until the document is saved and reopened. In that case the generator object returns an empty object. is there any kind of event I could use to force an update?

    posted in Cinema 4D SDK •
    CENTER AN OBJECT IN THE VIEW AND MAXIMIZE ITS SIZE

    I got a setup with a stationary camera. i need to keep the object centered in my view and maximize its size but i can't change the rotation / position of my camera.

    what i have so far is the following:

    i calculate the center of the objekt and change the offset accordingly to center the object. now if i want to zoom in my offset calculations are wrong again.

    correct.PNG

    fovProblem.c4d

    edit:

    can someone please move the thread into the right subforum?

    posted in Cinema 4D SDK •
    RE: Polygon Islands Convenience Method?

    here is a script i use to color polygon groups. unfortunately a bit slow

    import c4d
    from c4d import gui
    import random
    
    def main():
        random.seed(666)
    
        c4d.CallCommand(12139) # point mode
        selection  = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_NONE)
        for s in selection:
    
            cnt = s.GetPointCount()
            tag = c4d.VariableTag(c4d.Tvertexcolor, cnt)
    
    
            data = tag.GetDataAddressW()
    
            bs = s.GetPointS()
    
            done = []
    
            for i in range(cnt):
    
                if i in done: continue
    
                r = random.random()
                g = random.random()
                b = random.random()
    
                c = c4d.Vector4d(r,g,b,1)
    
                bs.DeselectAll()
                bs.Select(i)
    
                c4d.CallCommand(12557)
    
                sel = bs.GetAll(cnt)
    
                for index, selected in enumerate(sel):
                    if not selected: continue
    
                    done.append(index)
                    c4d.VertexColorTag.SetColor(data, None, None, index, c)
    
                done = list(set(done))
    
            s.InsertTag(tag)
    
    # Execute main()
    if __name__=='__main__':
        main()
    
    posted in Cinema 4D SDK •
    RE: How to remove generator childs when converting via "c"

    forget about it. i removed the c4d.OBJECT_INPUT flag during development and forgot to add it back.

    posted in Cinema 4D SDK •
    RE: How to remove generator childs when converting via "c"

    @m_magalhaes said in HOW TO REMOVE GENERATOR CHILDS WHEN CONVERTING VIA "C":

    Something you can do is touching the objects either with a dependency list or directly.

    Ah - i thought that touch only works with GVO. Never tried it to be honest. This solve at least the visibilty problem.

    posted in Cinema 4D SDK •
    How to remove generator childs when converting via "c"

    Hey,

    i have built a spline gernerator that modifies a spline, when i convert the object i get my modified spline but also the hirachie remains. however i only need the new spline object.

    Since GetContour() unfortunately doesn't support HirachyHelper I don't know how to hide the original objects and how to prevent the original splines from being present after the conversion.

    https://gumroad.com/l/spliner

    posted in Cinema 4D SDK •
    RE: How to change the EXR compression method via python

    <3<3<3<3

    posted in Cineware SDK •
    RE: How to change the EXR compression method via python

    The script change the compression method to zip not to Zips or what i expected: RLE because rle was the given value.

    posted in Cineware SDK •
    How to change the EXR compression method via python

    I need to change my exr compression to one scanline at a time but beside using a c4d default document is there any other way to change it directly in a script?

    posted in Cineware SDK •
    RE: urllib2.urlopen fails on C4D for Mac

    R23 still has the same Error

    posted in Cinema 4D SDK •