• How to properly use OpenSSL for local validation

    Cinema 4D SDK c++ r21
    5
    0 Votes
    5 Posts
    859 Views
    S
    Just FYI: you find that information regarding ./res/libs/win64 in the documentation: Development for Microsoft Window
  • Get Objects from the Layer?

    Cinema 4D SDK r21 python
    4
    0 Votes
    4 Posts
    548 Views
    ferdinandF
    Hi, if I am not overlooking something here, the function recurse_hierarchy is neither recursive nor will it retrieve the layers for all objects in the scene. It will retrieve the layers for all siblings of the passed node, that were born after that node. You probably made a mistake copying your code or misunderstood what is meant by recursive. Cheers, zipit
  • Merge Tags

    Cinema 4D SDK r19 r20 r21 c++
    9
    0 Votes
    9 Posts
    1k Views
    r_giganteR
    Hi @C4DS, thanks for following up. One note that it's worthy to share: the outcomes of this thread are valid as long as you need to stick to Classic API. In Maxon API (R20 and higher) you can make very good use of the CustomDataTag (see also GitHub example) whose data merging is managed directly by the modeling kernel. Last but not least, as usual, if the discussion has come to an end, please don't forget to mark the question as SOLVED. Cheers, R
  • Create BaseBitmap() from Text?

    Cinema 4D SDK r21 python
    5
    0 Votes
    5 Posts
    522 Views
    B
    @m_adam Thanks for the response. For some reason, the return value is not accepted by the SetFont. It does not error out. It just uses the default font. In addition, how were you able to determine that the [508] is for the font name? I can't seem to see such reference in the documentation. You can check the working code here: import c4d from c4d import gui # Welcome to the world of Python def GetSegoeUiBoldFont(): bcFonts = c4d.bitmaps.GeClipMap.EnumerateFonts(c4d.GE_CM_FONTSORT_HIERARCHICAL) for familyId, familyBc in bcFonts: for fontDescriptionId, fontDescription in familyBc: if fontDescription[508] == "SegoeUI-Bold": return fontDescription print fontDescription def main(): w = 50 h = 50 image_with_text = c4d.bitmaps.GeClipMap() image_with_text.Init(w=w,h=h,bits=32) image_with_text.BeginDraw() image_with_text.SetColor(125,255,255) image_with_text.FillRect(x1=0,y1=0,x2=50,y2=50) image_with_text.SetColor(0,0,0) font_bc = GetSegoeUiBoldFont() print font_bc font_size = 15 image_with_text.SetFont(font_bc,font_size) image_with_text.TextAt(x=10,y=15,txt='head') image_with_text.EndDraw() bmp = image_with_text.GetBitmap() c4d.bitmaps.ShowBitmap(bmp) # Execute main() if __name__=='__main__': main()
  • Dialog Freezes when checking for Message()

    Cinema 4D SDK r21 python
    12
    0 Votes
    12 Posts
    1k Views
    B
    Thanks @m_adam. First time using the c4d.DrawViews(). It works as expected. Thanks for the introduction.
  • Get the Button GadgetID Directly Under the Mouse?

    Cinema 4D SDK r21 python
    11
    0 Votes
    11 Posts
    2k Views
    B
    Hi @m_adam Thanks for the patience. Your suggestions and reminders works are greatly appreciated. I guess the confusion stems mainly on my part because I posted slightly two different codes. You were responding to my initial post but I was thinking with the code from the succeeding post(the one in the rar file). Totally my bad. Anyhow, here is the working code (using the initial post) which works as I expected: import c4d class ColorButton(object): def __init__(self): self.width = None self.height = None self.color = None self.color = None self.btn_id = None self.menu_list = None def create(self, dlg, w, h, color, btn_id): self.width = w self.height = h self.color = color self.btn_id = btn_id bmp_color = c4d.bitmaps.BaseBitmap() bmp_color.Init(w, h) for y in xrange(w): for x in xrange(h): bmp_color.SetPixel(x, y, color[0], color[1], color[2]) bcBitmapButton = c4d.BaseContainer() bcBitmapButton[c4d.BITMAPBUTTON_BUTTON] = True bmp_btn = dlg.AddCustomGui(self.btn_id, c4d.CUSTOMGUI_BITMAPBUTTON, "", c4d.BFH_CENTER | c4d.BFV_CENTER, w, h, bcBitmapButton) bmp_btn.SetImage(bmp_color, True) def create_menu(self): self.menu = c4d.BaseContainer() for menu_item in self.menu_list: counter = 0 IDM_MENU = c4d.FIRST_POPUP_ID + counter self.menu.InsData(IDM_MENU, menu_item) counter += 1 class MyDialog(c4d.gui.GeDialog): def __init__(self): self.btn_id_list = [] self.class_btn_id_dict = {} def CreateLayout(self): red_button = ColorButton() red_button.create(self, w=50,h=50,color=(255,0,0), btn_id=6000) red_button.menu_list = ['Menu1', 'Menu2', 'Menu3'] self.btn_id_list.append(red_button.btn_id) self.class_btn_id_dict[6000] = red_button blue_button = ColorButton() blue_button.create(self, w=50,h=50,color=(0,0,255), btn_id=7000) blue_button.menu_list = ['Menu4', 'Menu5', 'Menu6', 'Menu7'] self.btn_id_list.append(blue_button.btn_id) self.class_btn_id_dict[7000] = blue_button green_button = ColorButton() green_button.create(self, w=50,h=50,color=(0,255,0), btn_id=8000) green_button.menu_list = ['Menu8', 'Menu9'] self.btn_id_list.append(green_button.btn_id) self.class_btn_id_dict[8000] = green_button return True def IsPositionOnGadget(self, gadgetId, x, y): # Be sure that the windows is opened, # in our case since we call it in BFM_INTERACTSTART it's ok buttonData = self.GetItemDim(gadgetId) if not buttonData["x"] < x < buttonData["x"] + buttonData["w"]: return False if not buttonData["y"] < y < buttonData["y"] + buttonData["h"]: return False return True def function_to_determine_gadgetId_under_mouse_cursor(self, x, y): for gadgetId in self.btn_id_list: if self.IsPositionOnGadget(gadgetId, x, y): return gadgetId def Message(self, msg, result): if msg.GetId() == c4d.BFM_ADJUSTSIZE: self._x = msg[3] # Retrieve Y size of the GeDialog self._y = msg[4] # Retrieve Y size of the GeDialog # We are on the main thread here elif msg.GetId() == c4d.BFM_INTERACTSTART: c4d.StopAllThreads() state = c4d.BaseContainer() self.GetInputState(c4d.BFM_INPUT_MOUSE, c4d.BFM_INPUT_MOUSERIGHT, state) if state.GetInt32(c4d.BFM_INPUT_VALUE) == True: x = state.GetInt32(c4d.BFM_INPUT_X) y = state.GetInt32(c4d.BFM_INPUT_Y) g2l = self.Global2Local() x += g2l['x'] y += g2l['y'] gadgetId = self.function_to_determine_gadgetId_under_mouse_cursor(x=x,y=y) if gadgetId in self.btn_id_list: if self.IsPositionOnGadget(gadgetId=gadgetId, x=x, y=y): button_class = self.class_btn_id_dict[gadgetId] button_class.create_menu() l2s = self.Local2Screen() print str(x+l2s['x']) + " :: " + str(y+l2s['y']) self.KillEvents() res = c4d.gui.ShowPopupDialog(cd=self, bc=button_class.menu, x=x+l2s['x'], y=y+l2s['y']) return True return c4d.gui.GeDialog.Message(self, msg, result) if __name__ == "__main__": dlg = MyDialog() dlg.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=20304050)
  • 0 Votes
    8 Posts
    1k Views
    B
    Ok. I figured it out. The ID was wrong. It was supposed to be 465001634 -b
  • R21 Windows System Error

    Cinema 4D SDK r21 c++ windows
    4
    0 Votes
    4 Posts
    1k Views
    S
    Hello, as Riccardo has pointed out, AdditionalIncludeDirectories has nothing to do with DLLs. It is used to define search paths for header files. See Additional include directories. It was never valid. Also, looking at the error, the plugin was installed into the C:/Program Files folder. In R21, there is no reason to install plugins there; one can install plugins at any location and just tell Cinema 4D the plugin path. best wishes, Sebastian
  • Undo for GeDialog (GUI)?

    Cinema 4D SDK r21 python
    4
    0 Votes
    4 Posts
    509 Views
    B
    @blastframe @m_magalhaes Thanks for the response and the confirmation that Undo is not included in the GeDialog(GUI). That said the supplied code works on my use case. Thanks again!
  • Issue with registering a ToolData

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    634 Views
    a_blockA
    Hi Maxime, thanks a lot! Both are valid solutions for me. Very helpful. Cheers
  • Quick Tab Radio for GeDialog?

    Cinema 4D SDK r21 python
    4
    0 Votes
    4 Posts
    661 Views
    B
    @r_gigante Thank you for the response and especially for the alternative code (first time to see a line with msg[c4d.BFM_ACTION_VALUE]. Both code works as expected.
  • Add Commands to ShowPopupDialog

    Cinema 4D SDK r21 python
    7
    0 Votes
    7 Posts
    1k Views
    B
    @m_adam Thanks for further clarification. @Ashton_FCS_PluginDev 's code works but I guess I'll just use the result of the ShowPopupDialog to trigger commands, as I added in the previous code.
  • Creating Class for Buttons Returns None

    Cinema 4D SDK r21 python
    5
    0 Votes
    5 Posts
    534 Views
    B
    @m_adam Ah. Gotcha. Thanks for the clarification and link.
  • Command() does not honor Dynamic Lists/Variable

    Cinema 4D SDK r21 python
    9
    0 Votes
    9 Posts
    920 Views
    B
    When you presented the order of execution of __init__(), CreateLayout and InitValues. That makes total sense especially the 2.2.1 when it resets to an empty list. Thanks for the clarification!
  • How to Generate Dynamic Functions?

    General Talk r21 python
    3
    0 Votes
    3 Posts
    557 Views
    B
    Gotcha. Thanks for the code and confirmation. For my code, it's not really a simple printing the ID. Each ID corresponds with a separate function/script. I guess I'll just store them in a separate list. Separate ID list and separate function script list. Then execute them by matching index.
  • Threading & job questions

    Cinema 4D SDK r20 r21 maxon api c++
    6
    1
    0 Votes
    6 Posts
    1k Views
    ManuelM
    hello, wow sorry this went out of my scope. Anything to add or can we set this thread to solved ? Cheers, Manuel
  • Right Click Contextual Menu on a Button?

    Cinema 4D SDK r21 python
    3
    0 Votes
    3 Posts
    618 Views
    B
    @m_adam Works as expected! Thanks again for the sample code, makes everything clear.
  • Free Form GUI Design Layout?

    Cinema 4D SDK r21 python
    5
    0 Votes
    5 Posts
    681 Views
    B
    @r_gigante Thanks for the response. Unfortunately, I still can't read C++ codes at the moment. Is there a python equivalent of that page? I can't seem to see one. There is a page for that but it's like a dictionary. It does not contain any sample codes like in C++ If it does not exist, do you have any C++ with an equivalent Python page in the documentation? I'll just to interpolate them as much as possible. ########################## I also checked the Github sample and it does contain a GeUserArea sample But the button part is still in GeDialog. Is it possible to make the GeUserArea part to be clickable like a button?
  • 0 Votes
    3 Posts
    944 Views
    r_giganteR
    Hi jhpark, thanks for reaching out us. Aside from the notes left by @blastframe - thanks dude for the remarks - I think it's worthy, thinking of a more generic scene, to mention the need BaseDocument::ExecutePasses() to be sure that everything is actually evaluated before querying the scene rather than the EventAdd() which serves a different scope. This function is responsible to execute the scene evaluation and, consequently to be sure that, moving from a frame to another, all the items in the scene reflect the changes imposed by the frame switch. The approach used by @blastframe actually operates on CTracks and key but, although this approach works fine for your specific case, when more evaluation dependencies are created in the scene you could easily end up in unexpected results. The code could then look like frames_count = 10 # [Set] frames counter for f in range(0, frames_count): doc.SetTime(c4d.BaseTime(f, doc.GetFps())) # evaluate the scene doc.ExecutePasses(None, True, True, True, c4d.BUILDFLAGS_NONE) obj = doc.SearchObject('Cube') # get object position x = int(obj.GetMg().off.x) y = int(obj.GetMg().off.y) z = int(obj.GetMg().off.z) # get object color r = int(obj[c4d.ID_BASEOBJECT_COLOR].x * 255) g = int(obj[c4d.ID_BASEOBJECT_COLOR].y * 255) b = int(obj[c4d.ID_BASEOBJECT_COLOR].z * 255) print("Frame = " + str(f) + ", (X,Y,Z) = " + str(x) + "," + str(y) + "," + str(z) + ", RGB = " + str(r) + "," + str(g) + "," + str(b))
  • Generator GetDimension() not called

    Cinema 4D SDK r21 c++
    9
    0 Votes
    9 Posts
    1k Views
    rsodreR
    @r_gigante ok thanks! I managed a workaround by filling my dummy spline with two zero length segments at the claculated bounding box limits.