• Access C4D Objects outside C4D?

    r21 python
    10
    0 Votes
    10 Posts
    1k Views
    M
    VS Code and Sublime Text are not so well designed and simply spawn a bunch of python interpreters to retrieve the information they need, In contrast, pycharm does use only one and the same python interpreter its spawn. So that's why you got these issues.
  • RDATA_PATH not working with Render Settings

    r23 python
    3
    1
    0 Votes
    3 Posts
    446 Views
    M
    Hi @blastframe as demonstrated in tokensystem_render_r17.py you should always operate on the BaseContainer. Cheers, Maxime.
  • Radio button groups in two columns

    Moved
    6
    0 Votes
    6 Posts
    956 Views
    S
    Hi Maxime, it now works great, thank you very much for your support! Cheers, Stan
  • Compare only parts of two BaseContainers()

    r20 r21 s22 r23 c++
    6
    0 Votes
    6 Posts
    658 Views
    fwilleke80F
    Nice, Manuel, thank you! I guess, I'll try the SetDParameter() approach, too, in good time. Cheers, Frank
  • Emojis - macOS vs. Windows

    4
    3
    0 Votes
    4 Posts
    1k Views
    CairynC
    why do you think C4D has any special handling for emojis? The font rendering is OS dependent, so any kind of text - including emoji codepoints - is drawn by the underlying operating system routines. Anything else would mean a ridiculous effort by Maxon to replicate font behavior. (I do not know how Windows internally handles emojis, I doubt that every available font has all these characters so most likely certain codepoints are mapped to common glyphs regardless of the font... but that is not a C4D question anyway.)
  • I need help with this Python code

    Moved
    3
    0 Votes
    3 Posts
    470 Views
    M
    Without more information, from your side, I've set up your topic as solved but feel free to re-open it. Cheers, Maxime.
  • 0 Votes
    3 Posts
    671 Views
    M
    Without more information, from your side, I've set up your topic as solved but feel free to re-open it. Cheers, Maxime.
  • Select several files in LoadDialog()

    r21 python
    3
    0 Votes
    3 Posts
    370 Views
    B
    @r_gigante Ah gotcha. Thanks for the confirmation.
  • What is Vector.GetLengthSquared() really meant for?

    r21 python
    5
    0 Votes
    5 Posts
    985 Views
    CairynC
    @zipit said in What is Vector.GetLengthSquared() really meant for?: My major point was that there are certain programming assumptions (multiplication is better than division, never take the square root if avoidable, cubic complexity is uncomputable, etc.) that should be taken with a grain of salt due to the fact that they rely on a certain "state" of hardware. I.e. all these three do not really hold true anymore to the extent they once did. (...) That goes without saying... ultimately, any effort towards optimization needs to be checked for effectivity. Nevertheless, I was curious and abused a plugin of mine to execute some timer checks in C++, just for comparison (code excerpt only): using namespace std::chrono; Vector v(100.0, 100.0, 100.0); float f; milliseconds ms1, ms2, diff; ms1 = duration_cast<milliseconds>( system_clock::now().time_since_epoch() ); for (int i = 0; i < 100000000; i++) { f = 0; // v.GetLength(); } ms2 = duration_cast<milliseconds>( system_clock::now().time_since_epoch() ); diff = ms2 - ms1; GePrint(maxon::String("Time counter Empty:") + maxon::String::IntToString(diff.count())); ms1 = duration_cast<milliseconds>( system_clock::now().time_since_epoch() ); for (int i = 0; i < 100000000; i++) { f = v.GetLength(); } ms2 = duration_cast<milliseconds>( system_clock::now().time_since_epoch() ); diff = ms2 - ms1; GePrint(maxon::String("Time counter GetLength:") + maxon::String::IntToString(diff.count())); ms1 = duration_cast<milliseconds>( system_clock::now().time_since_epoch() ); for (int i = 0; i < 100000000; i++) { f = v.GetSquaredLength(); } ms2 = duration_cast<milliseconds>( system_clock::now().time_since_epoch() ); diff = ms2 - ms1; GePrint(maxon::String("Time counter GetSquaredLength:") + maxon::String::IntToString(diff.count())); Switching off all optimizations, I get (for multiple button presses): Time counter Empty:185 Time counter GetLength:921 Time counter GetSquaredLength:228 Time counter Empty:184 Time counter GetLength:922 Time counter GetSquaredLength:228 Time counter Empty:183 Time counter GetLength:921 Time counter GetSquaredLength:228 Time counter Empty:183 Time counter GetLength:922 Time counter GetSquaredLength:228 Time counter Empty:185 Time counter GetLength:921 Time counter GetSquaredLength:228 Time counter Empty:183 Time counter GetLength:921 Time counter GetSquaredLength:227 That is far more like what I expected (double so if you consider that the loop with a constant assignment already takes 185ms). Considering that I had to up the loop count to a hundred million to get measurable results, it is practically guaranteed that any difference between GetLength and GetLengthSquared in the Python sample is drowned in the Python interpreter's overhead, and any result from my initial tests must be attributed to sheer randomness.
  • UVW values inconsistency

    r21 s22 c++ python
    4
    0 Votes
    4 Posts
    987 Views
    rsodreR
    @r_gigante good to know, thanks!
  • Edge To Spline Modeling Command

    sdk r20 c++
    3
    0 Votes
    3 Posts
    987 Views
    J
    Thanks for the response, that was exactly what I needed. John Thomas
  • CloseDocument ?

    2
    0 Votes
    2 Posts
    467 Views
    CairynC
    Just check it manually: if currDoc.GetChanged() : c4d.gui.MessageDialog(c4d.plugins.GeLoadString(IDS_MSG_PROJECTCHANGED)) else : c4d.documents.KillDocument(currDoc) # works but ignores change status
  • Plugin ID Collision starting by Itself

    3
    0 Votes
    3 Posts
    621 Views
    ManuelM
    hi, no problem. By the way, the first register. The second show the collide message so it can't register. But that doesn't unload the first one. That's why your plugin was still working. Cheers, Manuel
  • Retrieving Viewport Camera Matrix

    r20 sdk c++
    9
    0 Votes
    9 Posts
    2k Views
    J
    Thanks for the detailed response @r_gigante, sorry about the late post. I wasn't trying to move an object into the camera view, I was just trying to get the information about a cameras perspective so that if necessary I could create an object that would have an orientation parallel to it. John Thomas
  • GetUserDataContainer() and UserData Values

    9
    0 Votes
    9 Posts
    2k Views
    ManuelM
    hi, ha, i was not setting any value. So yes, they are in the BaseContainer at id c4d.ID_USERDATA (=700) to filter the groups or separator you just have to check the type in the descLevel and compare with DTYPE_SEPARATOR or DTYPE_GROUP or either use DescId.IsPartOf like: for descId, parameterBc in op.GetUserDataContainer(): print(c4d.DESCID_DYNAMICSUB.IsPartOf(descId)) # Will print True for all of them Cheers, Manuel
  • c4d.CallButton(myTagPSR,c4d.ID_CA_CONSTRAINT_TAG_PSR_ADD)

    python
    6
    0 Votes
    6 Posts
    945 Views
    M
    Gload you solved your issue, if you have any questions, please feel free to open a new topic. Ho and I forget the most important, welcome in the plugincafe community Cheers, Maxime.
  • OBJ Export Options

    10
    0 Votes
    10 Posts
    2k Views
    .
    Thanks for looking at it Manuel. Sounds like your getting the same behavior I'm seeing. I'll add something to my script to parse it out. Thanks Manuel and Cairyn for taking time to help. .del
  • Different behavior on Mac for Commanddata options

    r23 python
    6
    0 Votes
    6 Posts
    692 Views
    ManuelM
    hi That's already mentioned in our application documentation. https://help.maxon.net/us/index.html#PREFSINTERFACE-PREF_INTERFACE_MAIN_GROUP Where do you think we should mention it ? Cheers, Manuel
  • Dump/Restore UserDataContainer

    4
    0 Votes
    4 Posts
    747 Views
    indexofrefractionI
    i finally succeeded in saving a BaseList2D userdata description (not the values) then loading and re-applying / cloning the full definition to a different BaseList2D, and finally copy over the values from the source to the target BaseList2D here is a similar topic for saving / loading the values (not the description) here: https://developers.maxon.net/forum/topic/11960/advice-for-saving-user-data/8 I made a comment there about copying the userdata values
  • Advice for Saving User Data?

    8
    0 Votes
    8 Posts
    1k Views
    indexofrefractionI
    @zipit said in Advice for Saving User Data?: # Write the data back. for cid, value in bc: descid = (c4d.ID_USERDATA, cid) # Check if the type of the element in op at the given descid matches # the data type we want to write, i.e. if the structure of the user # data has not changed. if isinstance(value, type(op[descid])): op[descid] = value a notice about the code part above : this gave me type errors and i solved it by not iterating through the bc, but instead through the ops UserData and skipping any DTYPE_GROUP and DTYPE_SEPARATOR (could be done also when reading the values, ofc) for descid, _ in op.GetUserDataContainer(): uid = descid[1].id dtype = descid[1].dtype name = _[c4d.DESC_NAME] value = bc[uid] print " uid={} dtype={} name={!r}".format(uid, dtype, name) if dtype == c4d.DTYPE_GROUP or dtype == c4d.DTYPE_SEPARATOR: pass elif dtype == c4d.DTYPE_SUBCONTAINER: pass # DTYPE_SUBCONTAINER - should never happen? elif isinstance(value, type(op[descid])): op[descid] = value else: pass # TYPE MISMATCH - should never happen?