Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. WickedP
    3. Topics
    • Profile
    • Following 0
    • Followers 0
    • Topics 35
    • Posts 95
    • Best 6
    • Controversial 0
    • Groups 0

    Topics created by WickedP

    • WickedPW

      CAMERA_ZOOM and Pparallel

      Cinema 4D SDK
      • c++ • • WickedP
      4
      0
      Votes
      4
      Posts
      359
      Views

      ferdinandF

      Hey @WickedP,

      It did not come across as abrupt or rude, but it was clear that you were a bit frustrated, and I was just trying to make clear that they had to choose some magic number, as that is the nature of rendering an orthographic projection. As to why we chose this number, I have no idea, as this happened 20 years or an even longer time back, long before I was at Maxon. It could either be because programmers simply love powers of two, or something more concrete such as that a power of two leads to less floating precision losses when multiplying other numbers with them, or simply that they did chose 1024x576 as the norm render size then.

      And you can set the camera width and height, but you just do this in the render settings with the render resolution, which was pretty standard for 3D software I would say. The new Redshift camera then uses a more complex model with an actual sensor and fitting the sensor to the render resolution (which I ignored here since you showed us using a Standard camera).

      Cheers,
      Ferdinand

    • WickedPW

      Dynamic desription issue

      Cinema 4D SDK
      • c++ • • WickedP
      4
      0
      Votes
      4
      Posts
      286
      Views

      ferdinandF

      You do not have to do that; I only recommended this for the case when you happen to have to override a dynamic parameter of the same ID with a new GUI/datatype, then you should also set a new default value. But as I said and as you can see here at the Python dynamic description example (in C++ we have a similar one), Cinema 4D will do the bookkeeping for you. Here we read the value of Dynamic REAL 6 at 1106.

      4361ae57-21f3-47d2-87e4-84709bf6f809-image.png

      Once we have modified the description, in this case removed Dynamic REAL 6, Cinema 4D will update the data container for us and remove the data at 1106.

      2712461d-c0c7-4280-96f5-ca9be93dfd8b-image.png

      Cheers,
      Ferdinand

    • WickedPW

      Getting font file/directory

      Cinema 4D SDK
      • c++ • • WickedP
      3
      0
      Votes
      3
      Posts
      579
      Views

      WickedPW

      Hi @m_adam,

      No probs. I can work without it.

      I'm more after the font file, I only mentioned the directory thinking it might help.

      I'm using a library to help with draw functions for a user interface, and I'd like to set the font to the same as Cinema's so there's consistency in the look. The library allows you to set a font via a path to the font file.

      Perhaps if the fonts data container could include a Filename/String to the file itself in future? Just a thought.

      Cheers,

      WP.

    • WickedPW

      Sub-frame document time

      Cinema 4D SDK
      • c++ windows • • WickedP
      3
      0
      Votes
      3
      Posts
      593
      Views

      WickedPW

      Is there any way to get around the apparent hard-coded maximum frame rate limit?

      WP.

    • WickedPW

      Converting image bit depth

      Cinema 4D SDK
      • c++ • • WickedP
      4
      0
      Votes
      4
      Posts
      688
      Views

      ferdinandF

      Hey @WickedP,

      Good to hear that you solved your problem. And I know that the color management and pixel format stuff can be a royal pain in the ***, you have my sympathies. Things tend to also get REALLY lovely when you also must deal with OCIO.

      Please do not hesitate to reach out again when you run in further troubles.

      Cheers,
      ferdinand

    • WickedPW

      BFM_DRAGRECEIVE

      Cinema 4D SDK
      • sdk c++ • • WickedP
      3
      0
      Votes
      3
      Posts
      660
      Views

      WickedPW

      Thanks @m_adam,

      I had to jump through a bunch of hoops with this one, because I put the queue process into a progress dialog so that for large file arrays there's an indicator of progress. Otherwise it just appears to hang and the user won't know why. But this made it tricky when the timer is also used because of the different thread contexts involved with the timer, the progress dialog and everything else on the main thread. But with a bit of care, it seems to work.

      Thanks again,

      WP.

    • WickedPW

      ShowBitmap() and image name

      Cinema 4D SDK
      • sdk c++ • • WickedP
      5
      0
      Votes
      5
      Posts
      1.0k
      Views

      ferdinandF

      Hey @WickedP,

      Thank you for pointing it out. There was a problem with how the CSS of the plugin providing the solved feature, the forum CSS, and our styling CSS did mesh in the light skin. I fixed it by putting even more CSS on top of things - because who doesn't love a solid mess in the CSS 😛

      PS: I am aware that the search feature could also still use some work under the dark skin. It is just not the highest priority when things are ugly but readable.

      Cheers,
      Ferdinand

    • WickedPW

      ProgressDialog and SetTitle()

      Cinema 4D SDK
      • sdk c++ • • WickedP
      3
      0
      Votes
      3
      Posts
      589
      Views

      WickedPW

      Hi @i_mazlov

      The dialog/gui is open. It's a progress dialog that I use to run an export function.

      I did some more digging, and I believe I've solved it. I had to put the SetTitle() into the dialog's Timer() function. So, something like this:

      virtual void MyProgressDialog::Timer(const BaseContainer& msg) { // 'title' is a class-level string variable SetTitle(title); return ProgressDialog::Timer(msg); }

      Seems to work as expected.

      WP.

    • WickedPW

      Link to online docs

      General Talk
      • • • WickedP
      3
      1
      Votes
      3
      Posts
      761
      Views

      WickedPW

      @ferdinand ah great, thanks. For others reading, may need a hard-refresh to get it to show.

      68055f1b-8472-4768-8b26-64b7edc1a9b5-image.png

      Cheers,

      WP.

    • WickedPW

      Using recent VS to make older builds

      Cinema 4D SDK
      • • • WickedP
      5
      0
      Votes
      5
      Posts
      758
      Views

      WickedPW

      Thanks Maxime. And apologies for the delay - I didn't see the response.

      WP.

    • WickedPW

      Setting mouse position

      Cinema 4D SDK
      • • • WickedP
      4
      0
      Votes
      4
      Posts
      718
      Views

      WickedPW

      @i_mazlov thanks for posting the link to the icon resource page listing. Have bookmarked it.

      Thanks @ferdinand, I noticed the CSS change. It's made scrolling through what were large pages more digestible and quicker. Hopefully I haven't upset too many others. But appreciated from my end.

      Post edit: I know this topic was about setting the mouse position, but seems like that's an OS level thing for now. So have marked topic as solved.

    • WickedPW

      Multi-menu menu, how to

      Cinema 4D SDK
      • sdk c++ • • WickedP
      5
      0
      Votes
      5
      Posts
      1.1k
      Views

      WickedPW

      Thanks @ferdinand,

      Agree. I've avoided using OS-specific calls up until now. But for this one I've had to make an exception. Not an ideal solution, but it seems to work:

      e9057cac-086c-4810-bb9c-c198ecdc2427-image.png

      To get around the lost window focus issue, I'm using the first dialog's Timer() to poll and check if any dialog in the menu has window focus. If none do, e.g., a user has clicked away, the system self-destructs. If a menu selection is made, it sends a Message() back to the calling object with details, and then self-destructs.

      It's all a bit of a hack. But it works. 🤷

      WP.

      Update: I'll mark this thread as solved. If I have any further questions I'll pop back in.

    • WickedPW

      Adding Layers to a MultipassBitmap

      Cinema 4D SDK
      • c++ • • WickedP
      2
      0
      Votes
      2
      Posts
      413
      Views

      ManuelM

      Hi,
      If you want the layer and folder to be displayed in the picture viewer you need to define the parameter MPBTYPE_SAVE to True.
      MPBTYPE_SHOW is defined by default to true when you add a layer.
      This parameter will just disable the layer as seen below. (the red eye)
      7375d915-1e62-4b6b-b174-3a16d05a5e20-image.png

      This example will create a folder with a layer in it and another layer below the folder.

      If it is working with pyhton, it should work with c++, you can share a bit of your code so we can reproduce it.

      from typing import Optional import c4d doc: c4d.documents.BaseDocument # The active document op: Optional[c4d.BaseObject] # The active object, None if unselected def main() -> None: mpb = c4d.bitmaps.MultipassBitmap(640, 480, c4d.COLORMODE_ARGB) folder1 = mpb.AddFolder(None) folder1.SetParameter(c4d.MPBTYPE_NAME, "folder") folder1.SetParameter(c4d.MPBTYPE_SAVE, True) layer1 = folder1.AddLayer(None, c4d.COLORMODE_ARGB) layer1.SetParameter(c4d.MPBTYPE_NAME, "layer1") layer1.SetParameter(c4d.MPBTYPE_SAVE, True) layer2 = mpb.AddLayer(folder1, c4d.COLORMODE_ARGB) layer2.SetParameter(c4d.MPBTYPE_NAME, "layer2") layer2.SetParameter(c4d.MPBTYPE_SAVE, True) c4d.bitmaps.ShowBitmap(mpb) if __name__ == '__main__': main()

      Cheers,
      Manuel

    • WickedPW

      Rendering into Multipassbitmap a "Depth Matte" Layer

      Cinema 4D SDK
      • c++ • • WickedP
      5
      0
      Votes
      5
      Posts
      844
      Views

      ferdinandF

      Hey @wickedp,

      thank your for your reply. First of all,

      I don't expect you to do everything

      in case my answer gave the impression that I am unwilling to add such an example - that is not the case. I just must play a bit the gatekeeper for not letting our code examples become too convoluted and fringe. So, this was less a "ugh, we do not have time for this" than a "what demonstrates the general relevance of such example/information for most users?" thing.

      First of all, thank you for sharing what you would like to have documented as an example and your code. I personally would still say that this is an extremely specific example of a use case most users probably will never encounter. Which makes it a not so good example case. But we also have many fringe examples in our code base, and in the case one needs such example, it is quite helpful, as the parameter handling of bitmaps is a bit cryptic.

      I have added a task to our task pool to add such an example. I will add it in one of the next releases.

      Cheers,
      Ferdinand

    • WickedPW

      Render settings Multi-Pass flag

      Cinema 4D SDK
      • c++ sdk • • WickedP
      4
      0
      Votes
      4
      Posts
      642
      Views

      ferdinandF

      Hello @wickedp,

      I have forked your questions as they both did constitute new topics, find them here:

      Rendering into Multipassbitmap Depth Pass Adding Layers to a MultipassBitmap

      Cheers,
      Ferdinand

    • WickedPW

      GeClipMap and init(BaseBitmap)

      Cinema 4D SDK
      • c++ sdk • • WickedP
      13
      0
      Votes
      13
      Posts
      1.6k
      Views

      WickedPW

      Sounds like what I'm doing should be OK then. If I run into any problems, I'll pop back in for further advice.

      Thanks @ferdinand, your help is always appreciated. We can close this one.

      WP.

    • WickedPW

      Getting keyboard commands in GeDialog()

      Cinema 4D SDK
      • c++ sdk • • WickedP
      7
      1
      Votes
      7
      Posts
      1.3k
      Views

      ferdinandF

      Hello @c4ds,

      thank you for reaching out to us.

      GetInputState()

      Just as a FYI, while you not might remember me, I was actually already around on the old forum 😉 So, I had a look again, looking at our:

      Codebase: Nothing is using BFM_INPUT_CHANNEL in this manner, not even really, really, really old code. Plugin Café History: Yes, there are some mentions of GetInputState(BFM_INPUT_KEYBOARD, BFM_INPUT_CHANNEL, but these come exclusively from users who
      a. Have problems with retreiveing the pressed key
      b. Not use the method to retreive any speciifc key and are only intersted in modifiers or other data provided in the response container. I did not find any code examples posted by Maxon using this form.

      I do not want to be rude here, but what you are doing is not correct and likely never was. This code floated around on Plugin Café and apparently people were copying each other but the code is at least now simply wrong (when one is interested in polling specific keys).

      Yes, you can use GetInputState(BFM_INPUT_KEYBOARD, BFM_INPUT_CHANNEL, bc) and this will not crash or any thing, but it is also meaningless. You could also call GetInputState(BFM_INPUT_KEYBOARD, 123456789, bc) and it would be as meaningful. If you are not interested in a specfic key being pressed, than this will also 'work' for you as the askchannel argument is then irrelevant.

      But we should really stop indicating that this is the right way to go, because that is where all the confusion comes from. Find a Python script at the end of the posting which in detail demonstrates this. Please stop indicating that this is a valid approach, as people will read this and then the cycle starts over again.

      Input Events Page for the C++ Documentation

      Thank you for making me aware of this. The target of these links, page_input_events has long been removed. I still have access to that archived page, and while the page was not too useful, I can only speculate why it has been done in this form. I will fix this this in an upcoming release. In the meantime, you should look at:

      the BFM Symbol Group: This however does not contain only input event symbols, but all GUI related event symbols. Input event related symbols folllow the form BFM_INPUT_... plus things like the KEY symbols or the Input Events page of the Python docs which is much better. Something like this unfournetely never existed in C++ the old C++ page was entierly different. Maybee it got removed in order to make room for something similar to the Python page, and then things were somehow not carried out?

      Long story short, I will provide a meaningful input events page for C++ in the upcoming release. In the meantime I would recommend the Python page.

      Cheers,
      Ferdinand

      The code for GetInputState(BFM_INPUT_KEYBOARD, BFM_INPUT_CHANNEL, bc) being not a meaningful thing:

      """Demonstrates that #BFM_INPUT_CHANNEL does not carry any meaning as the argument #askchannel for GetInputState. """ import c4d def main() -> None: """ """ bc: c4d.BaseContainer = c4d.BaseContainer() if not (c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.BFM_INPUT_CHANNEL, bc)): raise RuntimeError("Could not poll input event.") # Iterate over the container, there is nothing meaningful in there when you want to query a # specific key. print ("\nThe result container:") for key, value in bc: print (f"key: {key}, value: {value}") # And here some selected values to be a bit more verbose. print ("\nSelected values:") print (f"{bc[c4d.BFM_INPUT_CHANNEL] = }") # Will return 1768973153, i.e., itself. print (f"{bc[c4d.BFM_INPUT_VALUE] = }") # Will return False. print (f"{bc[c4d.BFM_INPUT_ASC] = }") # Will return the empty string. # We can of course still use the result container to poll for things that are also evaluated as # for example modifier keys (or the mouse position in case of the mouse device). print ("\nThe container is still valid for other stuff, but BFM_INPUT_CHANNEL is" + "meaningless in that context:") print (f"BFM_INPUT_CHANNEL: {bc[c4d.BFM_INPUT_MODIFIERS] = }") # But we would not have to use BFM_INPUT_CHANNEL for that, we also just could do this here: bc: c4d.BaseContainer = c4d.BaseContainer() if not (c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, 123456789, bc)): raise RuntimeError("Could not poll input event.") print (f"123456789: {bc[c4d.BFM_INPUT_MODIFIERS] = }") # And just for completeness, in case someone is just reading this snippet, here is how you # should use these functions: print ("\nHow it should be done:") bc: c4d.BaseContainer = c4d.BaseContainer() # Querying for a specific key with GetInputState. print ("\nQuerying a specific input state:") # Note that you must poll for upper case characters, e.g., X instead of x. if not c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, ord ("X"), bc): raise RuntimeError("Failed to query input events.") # Test if the queried key is indeed being pressed. print (f"{bc[c4d.BFM_INPUT_VALUE] == 1 = }") # Test if this did co-occur with a CTRL button press. print (f"{bc[c4d.BFM_INPUT_QUALIFIER] == c4d.QUALIFIER_CTRL = }") # Querying for the general state with key with GetInputEvent, i.e., capturing all inputs and # not only a specific one. print ("\nQuerying the current input state:") bc: c4d.BaseContainer = c4d.BaseContainer() if not c4d.gui.GetInputEvent(c4d.BFM_INPUT_KEYBOARD, bc): raise RuntimeError("Failed to query input events.") # Get the key which is currently be pressed as an ASCII value. print (f"{bc[c4d.BFM_INPUT_CHANNEL] = } ({chr (bc[c4d.BFM_INPUT_CHANNEL])})") # We can still read all the other things which are written into an input event container, as # for example a modifier key state. print (f"{bc[c4d.BFM_INPUT_QUALIFIER] == c4d.QUALIFIER_CTRL = }") if __name__ == '__main__': main()

      An example output for pressing CTRL + X while running the script:

      The result container: key: 1768973430, value: 1801812322 key: 1768973153, value: 1768973153 key: 1768976737, value: 2 key: 1768975727, value: 258 key: 1768978017, value: 0 key: 1768977985, value: 0.0 key: 1801548643, value: Selected values: bc[c4d.BFM_INPUT_CHANNEL] = 1768973153 bc[c4d.BFM_INPUT_VALUE] = 0 bc[c4d.BFM_INPUT_ASC] = '' The container is still valid for other stuff, but BFM_INPUT_CHANNEL ismeaningless in that context: BFM_INPUT_CHANNEL: bc[c4d.BFM_INPUT_MODIFIERS] = 258 123456789: bc[c4d.BFM_INPUT_MODIFIERS] = 258 How it should be done: Querying a specific input state: bc[c4d.BFM_INPUT_VALUE] == 1 = True bc[c4d.BFM_INPUT_QUALIFIER] == c4d.QUALIFIER_CTRL = True Querying the current input state: bc[c4d.BFM_INPUT_CHANNEL] = 88 (X) bc[c4d.BFM_INPUT_QUALIFIER] == c4d.QUALIFIER_CTRL = True >>>
    • WickedPW

      Right-mouse click on dialog tab

      Cinema 4D SDK
      • c++ • • WickedP
      8
      0
      Votes
      8
      Posts
      1.2k
      Views

      ferdinandF

      Hey,

      You can set answer and mark as solved. If I have any follow-up questions I'll pop back in.

      Thanks for the reply!

      I was wondering about dividing by the count as well. But not sure if that would work for tabs where there are different widths?

      Right, I admittedly did not think of that, but what you could do is measure the width of each tab string with GeClipMap:: or GeUserArea::GetTextWidth and then normalize these values. After that you can apply that to the tab widths you want to calculate. As pseudo-code:

      GetItemDim(ID_MY_TABGADGET, ..., gadgetWidth) averageTabWidth = gadgetWidth / tabCount titleWidths = (clipmap.GetTextWidth(s) for s in tabTitles) maxTitleWidth = max(titleWidths) normalizedTitleWidths = (t / maxTitleWidth for t in titleWidths) absoluteTabWidths = (averageTabWidth * ntw for ntw in normalizedTitleWidths)

      This would not be pixel-perfect and way hackier than at least I would be comfortable with. But if you are stubborn enough, you can make everything work 🙂

      Cheers,
      Ferdinand

    • WickedPW

      Matrix4

      Cinema 4D SDK
      • c++ classic api • • WickedP
      6
      0
      Votes
      6
      Posts
      853
      Views

      WickedPW

      Thanks @ferdinand,

      I've been trying to remove a matrix math library from my software, but having never been taught any of this before (code that is), I was fumbling around in the dark on how to re-assemble things. But I've managed to end up with a blend of C4D and my own functionality, which is fine.

      The image below probably won't mean much to you, but it tells me it's working correctly again.

      218e9cdd-fa5d-4f09-80b9-c2ddc191eb2a-image.png

      We can probably mark as solved.

      WP.

    • WickedPW

      Normal tangents to world

      Cinema 4D SDK
      • • • WickedP
      7
      0
      Votes
      7
      Posts
      976
      Views

      ferdinandF

      Hello @wickedp,

      without any further activity before Wednesday, the 16.03.2022, we will consider this topic as solved and remove the "unsolved" state from this topic.

      Thank you for your understanding,
      Ferdinand