Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. chuanzhen
    3. Posts
    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups

    Posts made by chuanzhen

    RE: How to Set UserData Group fold/unfold

    Thanks for help @a_block , @m_adam . I think the answer to this question is that we can't control the open/close of the group

    posted in Cinema 4D SDK •
    RE: How to Set UserData Group fold/unfold

    @m_adam Still can't succeed
    In the same Attribute Manager window, for multiple objects with the same UserData, it seems that it is impossible to control the opening or closing of a group alone. If I open (or close) the group of one object, the group corresponding to other objects will also be opened (or closed)

    posted in Cinema 4D SDK •
    RE: How to Set UserData Group fold/unfold

    @m_adam Setup succeeded, but the group GUI did not unfold

    use python
    group.gif

    c4d Use Default Open ,group unfold
    group1.gif

    c4d not Use Default Open ,but group not fold
    group2.gif

    posted in Cinema 4D SDK •
    RE: How to add a multi _line string UserData

    @m_adam Thanks for help!

    posted in Cinema 4D SDK •
    How to Set UserData Group fold/unfold

    Hi,
    in c4d manager UserData dialog can set group Default Open,but i dont how to set fold/unfold in python .
    my code:

    bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_GROUP)
    bc[c4d.DESC_NAME] = "group_test"
    group_did = obj.AddUserData(bc)
    
    bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_STRING)
    bc[c4d.DESC_NAME] = "test"
    bc[c4d.DESC_PARENTGROUP] = group_did
    did = obj.AddUserData(bc)
    

    Thanks for any help!

    posted in Cinema 4D SDK •
    How to add a multi _line string UserData

    Hi.
    i want set String UserData interface to multi_line,but in DESC dont find parameter to set.
    this is my code:

    bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_STRING)
    bc[c4d.DESC_NAME] = "test"
    did = obj.AddUserData(bc)
    

    Thanks for any help!

    posted in Cinema 4D SDK •
    RE: How to select an Edge

    @ferdinand Thanks your reply!

    posted in Cinema 4D SDK •
    RE: How to select an Edge

    Hi @Cairyn
    Thanks for your help, I use method 2 to achieve my goal.
    This is a plug-in to mirror a selection of the same / different objects. Thank you for your help again,gif_2 show its work
    gif_2
    success.gif

    posted in Cinema 4D SDK •
    RE: How to select an Edge

    Hi @cairyn ,thanks for your help!
    I have made some progress, but there are still some problems!

    the image_1 show want wo select 2 edges.
    image_1:
    wenti2.png

    Through your reply, it seems that I have got 2 directions to solve my problem. I will show it in the following image_2.
    image_2:
    temp1.png

    use method 2 ,can select the edge show on gif_1.
    gif_1:
    method2.gif
    method 2 code:

    import c4d
    from c4d import gui
    
    
    def main():
        if op == None:
            return
        if op.GetType() != c4d.Opolygon:
            return
        
        bs = op.GetEdgeS()
        bs.DeselectAll()
        poly_cnt = op.GetPolygonCount()
        
        sel = bs.GetAll(poly_cnt * 4)
        
        
        edge_list = [(0,1),(0,4)]
        
    
        for poly_id in range(poly_cnt):
            poly = op.GetPolygon(poly_id)
            for edge in edge_list:
                p1,p2 = edge
                
                edge_index = poly.FindEdge(p1,p2)
                if edge_index != c4d.NOTOK:
                    sel[poly_id * 4  + edge_index] = 1
        
        bs.SetAll(sel)
            
        
        c4d.EventAdd()
    
    # Execute main()
    if __name__=='__main__':
        main()
    posted in Cinema 4D SDK •
    How to select an Edge

    Hi,
    I know how to select a point / face, but I still don't know how to select an edge. Does each edge have a unique ID? For example, two quadrilateral faces have seven edges. If I choose an edge, I can know that its ID is 6.
    I have a picture below. I have marked the edges I want to choose, but I don't know what to do. Can have a simple code demonstration?问题.png
    Thanks for any help!

    posted in Cinema 4D SDK •
    RE: SetTimeRight fail!

    @ferdinand I also use ScreenToGif to make pictures!

    posted in Cinema 4D SDK •
    RE: SetTimeRight fail!

    @ferdinand Thank you for your detailed answer!
    In my autoweight function, there is no error in the calculation result of the tangent, but when setting the CKey, there is a problem. It seems that there are too many parameters set, which causes the left and right time values of the key frame to be set according to the calculation results. Then an unknown change was made, causing the final value to not match the calculated value. Although I still don't know why those settings will cause the value to go wrong.

    wrong code:

        key.SetInterpolation(curve,c4d.CINTERPOLATION_SPLINE)
    
        key.SetTimeLeft(curve,L_time_v)
        key.SetValueLeft(curve,TL_vector[1])
        key.SetTimeRight(curve, R_time_v)
        key.SetValueRight(curve, TR_vector[1])
    
        key[c4d.ID_CKEY_PRESET] = c4d.ID_CKEY_PRESET__CUSTOM
        key.ChangeNBit(c4d.NBIT_CKEY_AUTO, c4d.NBITCONTROL_CLEAR)
        key.ChangeNBit(c4d.NBIT_CKEY_BREAK, c4d.NBITCONTROL_SET)
        key.ChangeNBit(c4d.NBIT_CKEY_KEEPVISUALANGLE, c4d.NBITCONTROL_SET)
    

    current code:

        key.SetInterpolation(curve,c4d.CINTERPOLATION_SPLINE)
        key.SetTimeLeft(curve,L_time_v)
        key.SetValueLeft(curve,TL_vector[1])
        key.SetTimeRight(curve, R_time_v)
        key.SetValueRight(curve, TR_vector[1])
        key.ChangeNBit(c4d.NBIT_CKEY_AUTO, c4d.NBITCONTROL_CLEAR)
    

    Using the current code, the left and right time values of CKey, the calculated result matches the final result.
    this is an print example:

        Calculate_RTime: 0.0301874202486 After_Set_Get_from_Key_RTime 0.03
    

    gif also shows that it is working fine now.

    easyinout_end.gif

    posted in Cinema 4D SDK •
    RE: SetTimeRight fail!

    @ferdinand Thanks for your help!
    I have been looking for the source of the problem. After seeing your answer, I should have looked in the wrong direction (I always thought that SetTimeLeft() could not accurately transmit the value I calculated). Below I uploaded a GIF to show the problem I encountered more accurately.
    1: I use Add key slider to dynamically add functions. It will call my autoweight function by default. It can be seen that in the process of dynamic addition, the error of RightTime == 0 of some key frames appears
    2: When I dynamically use EasyInOut slider to perform the smoothing process, it also calls the autoweight function, and it still does not correct the wrong situation
    3: When I use c4d's default auto tangent classic for these key frames, then use EasyInOut again to perform the smoothing process, the autoweight function will work normally.
    So I don’t know why this happens, because the above code is used to set the key in the autoweight function

    It seems that can't see the gif in full,i upload a file ,can be download. easyinout2.gif

    easyinout2.gif

    posted in Cinema 4D SDK •
    RE: SetTimeRight fail!

    @aimidi said in SetTimeRight fail!:

    SetTangents

    Thanks for your help,but not find SetTangents() in python sdk

    posted in Cinema 4D SDK •
    SetTimeRight fail!

    Hi, when the value I set is very small, such as BaseTime.get() is 0.001, by using SetTimeRight(), but when I access this value again by script, the result is BaseTime.get() is 0. but SetTimeLeft() can Successfully set, such as BaseTime.get() is -0.001 !
    Thanks for any help!

            key.SetInterpolation(curve,c4d.CINTERPOLATION_SPLINE)
            
    
            key.SetTimeLeft(curve,L_time_v)
            key.SetValueLeft(curve,TL_vector[1])
            key.SetTimeRight(curve, R_time_v)
            key.SetValueRight(curve, TR_vector[1])
    
            key[c4d.ID_CKEY_PRESET] = c4d.ID_CKEY_PRESET__CUSTOM
            key.ChangeNBit(c4d.NBIT_CKEY_AUTO, c4d.NBITCONTROL_CLEAR)
            key.ChangeNBit(c4d.NBIT_CKEY_BREAK, c4d.NBITCONTROL_SET)
            key.ChangeNBit(c4d.NBIT_CKEY_KEEPVISUALANGLE, c4d.NBITCONTROL_SET)
    posted in Cinema 4D SDK •
    RE: About TimeLine Coordinate System

    @ferdinand Thanks for your detailed reply!
    " 2.The timeline (and as a matter of fact also the world coordinate system) has no implied unit. There is no direct translation as 1px == 1cm as both the horizontal axis and vertical axis depend on the zoom level." solved my question!

    posted in Cinema 4D SDK •
    About TimeLine Coordinate System

    Hi,
    I want to use my method to calculate the tangent and weight of the animation curve.

    But I ran into a problem. I can’t know how the vector base of the coordinate system of the TimeLine panel is defined. In the 3D coordinate system, x=1 cm, y=1cm, z=1cm, but in the TimeLine panel, x= 1Frame ?1 second, y =1 cm?1%? or 1 Degree.

    Thanks for any help!

    posted in Cinema 4D SDK •
    RE: How to get Data unit

    @ferdinand Thanks,great!

    posted in Cinema 4D SDK •
    How to get Data unit

    Hi,
    in picture object Position gui unit is real, Rotation gui unit is Degree , User data gui unit is Percent. how to know gui unit? and how to directly obtain the value displayed on the panel(Data = 0.1745, want to directly get 17.453)?
    无标题.jpg

    Thanks for any help!

    posted in Cinema 4D SDK •
    RE: How to get Preferences folder path?

    @m_adam Great, thank you!

    posted in Cinema 4D SDK •