Thank you @ferdinand !
I forgot to ask something, do you know if Python support planned or is it unlikely ? Is there technical reasons behind the lack of Python support for Content Browser, and now Asset Browser ?
Thank you @ferdinand !
I forgot to ask something, do you know if Python support planned or is it unlikely ? Is there technical reasons behind the lack of Python support for Content Browser, and now Asset Browser ?
@ferdinand said in With the new asset browser, API for the content browser is no longer possible?:
One of the major entry points for the new asset system is AssetRepositoryInterface
in C++.
Hi,
I'm taking advantage of this topic to clarify something : if I've understood right is no way at the moment to access to the new Asset Browser with Python ?
Thank you
Hi @m_magalhaes ,
Sorry for the improper formatting of my question, I wasn't aware of these features.
Thank you for the suggestion, the workaround can do the trick with the right safety precautions.
Hello all,
I'm looking for a way to load multiple files of the same type at once through a script. Image files in this case.
I'm using the c4d.storage.LoadDialog function but it doesn't offer a setting to do a multi-selection.
It wasn't possible before, is it still the case ?
Thank you
Thank you for the explanation @ferdinand.
The example makes sense even for a beginner like me, that's great
Hi @ferdinand,
In fact I think I was looking for the eval() method which I know but somewhat have forgotten.
Thanks for pointing the fact that using it could be dangerous, but in this particular context I'm not sure to understand why ? I'm not a seasoned coder ( far from it ) but the linked article seems to point security issues in the context of using eval() in conjunction with input(), which is not the case here.
I'm doing this mainly to practice Python as much as possible, but I guess it is wasted computing power since these symbols are not changing anytime soon.
Anyway, I've learned some things, thank you for the help, much appreciated !
Hello !
I've wrote a simple function to store some constants in a list, from a string ( because I'm lazy) :
def geoTypeList():
geo_constants = "tube,cube,plane" # not the full list
geo_types = [("c4d.O" + i) for i in geo_constants.split(",")]
return geo_types # return the list
I was happy with my solution until I've tried to use it :
for i in objs:
if i.GetType() in geoTypeList():
print(i.GetName(), "is a", i.GetTypeName(), i.GetRealType())
else:
print("Not a geometry object")
I've tried many times and many variant until I've realized that I'm trying to check a constant against some strings, so it can't work. But I'm stuck here, I don't know how to pass the list items as constants and not as string.
Also before you ask, why I'm not just using ID integers ? Because I would like to keep the code easily readable, and the docs use the constants and symbols.
Thank you,
@m_magalhaes Yes please, and sorry for the delay :3
Hello guys,
Thank you for your detailed answers and sorry for the delay, I was on holiday.
@Cairyn
Sorry for the misunderstanding, in my mind hotkeys = shortcuts, I didn't want to make any particular distinction. What you described is also called Sticky Keys in some softwares.
To answer your questions : I want to be able to modify tool settings / attributes while the tool is enabled AND in interactive mode. Since I don't want to bother with gazillions of shortcuts and multiple keyboards, it has to be context sensitive so I can use the same set of keys with many tools.
But a picture is worth a thousand words, so I made a little demo of what I want to achieve in C4D : Modal Bevel Shortcuts demo
As you can see, the shortcuts allows to modify tool settings in real time, without loosing the ability to enter values manually in the attributes fields. What you don't see is that I can use the same set of keys with many tools and in the same fashion ( one key to toggle an option, two other to add / sub values like segments, number of clones etc. ). This software is context-sensitive by design at many levels and allow this kind of customisation without scripting.
@m_magalhaes
Thank you very much for the detailed answer and the script example. I have to take a deeper look at it but it works, and I've made two other scripts from it to simulate what I show in the link above. Please take a look : Cinema 4D - Modal Bevel Shortcuts POC #1
As you can see
So these results are encouraging but there is room for improvements :
Thanks,
Hello,
Python beginner here, my goal is to write a script or a plugin to interact with some (active) tool attributes through a predefined set of hotkeys. In short, context-sensitive hotkeys. As a bonus goal, I would like to add some settings in the Preferences window to change the hotkeys.
Until now I've managed to write simple python scripts ( but you can call it macros ), like these lines to change bevel mode f.e. :
if c4d.IsCommandChecked(431000015) is True :
if tool()[c4d.MDATA_BEVEL_MASTER_MODE] == 0:
tool()[c4d.MDATA_BEVEL_MASTER_MODE] = 1
else:
tool()[c4d.MDATA_BEVEL_MASTER_MODE] = 0
c4d.EventAdd()
It kind of works but it doesn't affect the active tool, only the UI.
And that's all for the moment. The SDK isn't really useful since I don't know where to start and how implement this, plus I guess there may be some specific constraints due to the interactive part.
So I would like to get some clues on the best way to tackle this. I've watch many C4D Python tutorials, look through the docs, the Python SDK and read few scripts but it doesn't make sense yet. Like baseContainer, what is this thing and why I have to call it to interact with a tool ? ( I'm really a beginner )
From what I've read what I want to do is not possible with a simple script, I should rather write a plugin to have the code running in background to evaluate tool activation and keystrokes. Is that correct ? Is it why the script doesn't trigger the active tool ?
Thanks,