• IsEqual not defined

    Cinema 4D SDK r20 c++
    3
    0 Votes
    3 Posts
    634 Views
    C4DSC
    @m_magalhaes said in IsEqual not defined: MAXON_OPERATOR_EQUALITY(Int32Pair, a, b); Thanks, didn't know about the MAXON_OPERATOR_EQUALITY. Very handy indeed. However, I had already tried providing an equality operator in my Int32Pair class, as such: Bool operator == (const Int32Pair& other) { return (a == other.a) && (b == other.b); } But that still resulted in the "IsEqual not defined" compiler error. The macro, however, is working fine. Looking further at my implementation of operator==, I now notice I didn't declare it as a const method. Adding the const does get rid of the compiler error. Oh boy! Overlooked a minor "typo", with major consequences. Again, thanks for the macro.
  • Copy link object

    Cinema 4D SDK r20 c++
    4
    0 Votes
    4 Posts
    1k Views
    M
    Hi, the topic is now marked as solved, did you solve your issue? The only workaround I was able to find is to make use of AddToExecution and define it to GENERATOR+1, here you retrieve and clone the cache of the linked object in a member variable of your instance, then in the next GVO you make use of this cache, but this has the application that you work always on a mesh that has been generated in a previous SceneExecution call, which may be an issue in case of animation. Cheers, Maxime.
  • Tag plugin and Dirty check

    Cinema 4D SDK r20 python
    5
    1
    0 Votes
    5 Posts
    906 Views
    P
    I create a workaround that is working. I think, like you say, that the Subdivision Surface is not ok, when I initially load the scene. I now get the polygon object under the sss and that works.
  • How to get InExcludeData in ModifyObject

    Cinema 4D SDK r20 c++
    4
    0 Votes
    4 Posts
    955 Views
    M
    @m_magalhaes Thank you for your answer. really helpful!
  • Tag used on multiple objects.

    Cinema 4D SDK python r20
    6
    0 Votes
    6 Posts
    1k Views
    P
    Read() and Write() works. Thanks.
  • modulo - behind the scenes

    Cinema 4D SDK r19 r20 c++
    3
    0 Votes
    3 Posts
    610 Views
    C4DSC
    Thanks for the info.
  • 0 Votes
    5 Posts
    1k Views
    M
    Since no news, I mark it as solved (closed), but feel free to open it again.
  • 0 Votes
    4 Posts
    1k Views
    M
    @r_gigante Oh!Thank you!The plug-in ID is the reason for the problem,use another shorter number and everything is ok. Thank your for your help!
  • Retrieve the World Rotation of a Selected Edge?

    Cinema 4D SDK r20 python
    4
    0 Votes
    4 Posts
    1k Views
    ManuelM
    hello, To answer this question if someone want to do it by code. import c4d from c4d import gui # Welcome to the world of Python # Main function def main(): #get the selected object op = doc.GetActiveObject() if not op: raise TypeError("there's no object selected") if not op.IsInstanceOf(c4d.Opolygon): raise TypeError("obj should be a polygon object") #setup neighbor nbr = c4d.utils.Neighbor() nbr.Init(op) #get the selected edge bs = op.GetSelectedEdges(nbr,c4d.EDGESELECTIONTYPE_SELECTION) #maximum number of edge should be number of polygon * 4 sel = bs.GetAll(op.GetPolygonCount() * 4) #get all polygon vadr = op.GetAllPolygons() #init point a and b index to -1 for error check a = b = -1 #initialise a counter to check in sel array. countEdge = 0 #we can check now every edge to find the corresponding points. So for each polygon for i in xrange(op.GetPolygonCount()): #get the polygon information pli = nbr.GetPolyInfo(i) for side in xrange(4): # Test all 4 sides of a polygon # Only proceed if edge is marked # and edge really exists (for triangles side 2 from c..d does not exist as c==d) if pli["mark"][side] or (side==2 and vadr[i].c == vadr[i].d): continue #if the edge is marked as selected in our sel array if sel[countEdge]: if side==0: a=vadr[i].a; b=vadr[i].b elif side==1: a=vadr[i].b; b=vadr[i].c elif side==2: a=vadr[i].c; b=vadr[i].d elif side==3: a=vadr[i].d; b=vadr[i].a countEdge +=1 if a == -1 or b == -1: raise ValueError("points index can't be negatives") #get all points array points = op.GetAllPoints() #Get the direction of the edge in global coordinate (multiply the points'vector by the matrix of the object) opmg = op.GetMg() #i've picked a direction from point a to point b so the angle could need to be reverted. dirVector = points[b]*opmg - points[a]*opmg #normalize a vector is often a good idea. dirVector.Normalize() #transform the vector to hpb note the result is in radian hpb = c4d.utils.VectorToHPB(dirVector) #transform radian to degree hpb.x = c4d.utils.RadToDeg(hpb.x) hpb.y = c4d.utils.RadToDeg(hpb.y) hpb.z = c4d.utils.RadToDeg(hpb.z) print "the edge is poiting to",dirVector,"the corresponding angle is", hpb # Execute main() if __name__=='__main__': main() Cheers Manuel
  • Updating C4DThread code to C4D R20

    Cinema 4D SDK
    7
    0 Votes
    7 Posts
    2k Views
    K
    @s_bach Aha! That helps! I will see how this works this weekend.
  • Saving & Loading User Preset

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    719 Views
    P
    Hi Maxime, thank you very much! Good to know. I would otherwise searched forever. Cheers, PdZ
  • c4dpy crashes

    Cinema 4D SDK python r20 windows
    4
    1
    0 Votes
    4 Posts
    752 Views
    P
    Ok, I will give it a try and let you know. Thanks.
  • Make Objects Editable (Streamlined)?

    Cinema 4D SDK r20 python
    5
    0 Votes
    5 Posts
    2k Views
    ManuelM
    Just to add some side notes : SendModelingCommand is waiting for a list of objects in case you want to execute that command on several objects. In your case, you only got one element in your list. You can have more informations about list here
  • Cinema Gradient, weird behaviour

    Cinema 4D SDK r20 sdk python
    7
    0 Votes
    7 Posts
    1k Views
    M
    Don't feel sorry yes this is the issue and since Knot ID are not ordered from right to left but from creation order its why it's confused you. Moreover, using a for loop will make way more sense and help you to avoid this kind of stuff. grad1 = shdr1[c4d.SLA_GRADIENT_GRADIENT] grad2 = shdr2[c4d.SLA_GRADIENT_GRADIENT] for knotId in xrange(grad1.GetKnotCount()): knot = grad1.GetKnot(knotId) grad2.InsertKnot(col=knot['col'], pos=knot['pos'],index=knot['index']) grad2.FlushKnots() shdr2[c4d.SLA_GRADIENT_GRADIENT] = grad2 Finally, a BaseShader is derived from BaseList2D which is derived from C4DAtom that mean you can use GetClone to retrieves a clone of this shader so your code can look like. import c4d def main(): mat = doc.GetFirstMaterial() colorShader = mat[c4d.MATERIAL_COLOR_SHADER] if colorShader is None: return copyColor = colorShader.GetClone() mat[c4d.MATERIAL_DIFFUSION_SHADER] = copyColor mat.InsertShader(copyColor) mat.Message(c4d.MSG_UPDATE) mat.Update(True, True) c4d.EventAdd() # Execute main() if __name__=='__main__': main() Cheers, Maxime.
  • Node-Based Materials

    Cinema 4D SDK r20 sdk windows
    6
    0 Votes
    6 Posts
    1k Views
    M
    As stated before, we are working on it and it will be released in the future. I can't say more. Regarding your question @Aaron this will be possible.
  • 0 Votes
    5 Posts
    1k Views
    B
    @m_adam Thanks for further clarification specially the catch with the dialog's on the script. Will now closed the thread. Have a great day ahead!
  • 0 Votes
    8 Posts
    1k Views
    r_giganteR
    Hi Frank, thanks for following up With regard to your latest question, there are no means to "ask" the Ngon system about that. Checking for the number of vertexes an n-gon is going to use before deciding to use it, it's a reasonable way to proceed. Cheers, Riccardo
  • Access Custom User Data By Name (not by ID)

    Cinema 4D SDK r20 python
    5
    0 Votes
    5 Posts
    2k Views
    B
    Thanks for the response @m_adam Have a great day ahead!
  • Output Current Sound Track Name

    Cinema 4D SDK python r20
    12
    3
    0 Votes
    12 Posts
    3k Views
    S
    Hello, it seems you just write the name of the last track into your user data field: obj[c4d.ID_USERDATA,19] = trak.GetName() Since you do not extend that string, it can only show one name. best wishes, Sebastian
  • 0 Votes
    3 Posts
    845 Views
    B
    HI @r_gigante Thanks for the response. With regard to 2CV-only Bezier curve: Yes, I only need 2 CV maximum. I understand that it will not interpolate complicated shapes properly but as you can see in my example, it's only a simple shape. Looking at it now. I have a feeling I am biting more than I can chew. I'm not sure I can solve it at the moment given my current knowledge. Will just perform it manually at the moment. Anyhow, thanks for responding. Have a great day ahead!