Hi, thanks for your answer. I'd like to add a title line like here for example the 'DINAMICS' line.
G
Posts made by Gemini
-
RE: Add Title Items (not packable) to Custom Menu
-
Add Title Items (not packable) to Custom Menu
Hey Forum,
I have two questions for you.
- Is there a way to add not pickable items like a title written with capital letter to custom menus created by python.
- How a toggle line be added and how can be get its sate ?
I added a part of my code above where the str item is not working sadly.
THanks,
G...
def insert(root: c4d.BaseContainer, title: str, data: MenuData) -> c4d.BaseContainer: """Inserts #data recursively under #root under the entry #title. """ # Create a new container and set its title. subMenu: c4d.BaseContainer = c4d.BaseContainer() subMenu.InsData(c4d.MENURESOURCE_SUBTITLE, title) # Iterate over the values in data, insert commands, and recurse for dictionaries. for key, value in data.items(): if isinstance(value, dict): subMenu = insert(subMenu, key, value) elif isinstance(value, int): subMenu.InsData(c4d.MENURESOURCE_COMMAND, f"PLUGIN_CMD_{value}") elif value is None: # Insert a separator subMenu.InsData(c4d.MENURESOURCE_SEPARATOR, None) elif isinstance(value, str): # Add a non-clickable title subMenu.InsData(c4d.MENURESOURCE_STRING, value) root.InsData(c4d.MENURESOURCE_SUBMENU, subMenu) return root
-
Easy Way to Set and Get parameter Values
Hey,
I need some information how to set and get a specific parameters:-
for example here on the render settings
-
On any node.
-
WHat's the easiest way to get a parameter id ( any object any parm ) ?
Thanks
Szabolcs -
-
RE: Customize Palettes by Python ( add Buttons )
Could you share information about layout editing if there are any python methods or threads here ?
-
Customize Palettes by Python ( add Buttons )
Hi,
Is there a way to insert a button to a Layout in C4D python ?
Thanks,
G -
RE: Plugin Which Creates MenuItems with Scripts ( not from user folder )
I just simply add a plugin to C4D which creates a user menu into C4D all in one pack without adding any script into the user C4D preferences folder ( library / scripts ) . Menu and script embedded solution all in one plugin inside.
-
RE: Plugin Which Creates MenuItems with Scripts ( not from user folder )
Anyone here ? Any practice like this ?
-
RE: Add Expression Value in Render Settings Save Path
The extension is different. So the file name too.
-
RE: Add Expression Value in Render Settings Save Path
Ups. Maybe. I'm checking..
-
Plugin Which Creates MenuItems with Scripts ( not from user folder )
Hey,
Can it be possible to create a user menu from a plugin with scripts ( lines ) which are not registered in the c4D user preference folder ? ( "c:\Users\xxx\AppData\Roaming\Maxon\Maxon Cinema 4D YY" )
Thanks in advance,
G -
RE: Add Expression Value in Render Settings Save Path
""" Copyright: MAXON Computer GmbH Author: Maxime Adam Description: - Registers two Tokens plugin. One visible in the render setting the other one not. - A token is a string that will be replaced during the token evaluation time by a string representation. Class/method highlighted: - c4d.plugins.RegisterToken - c4d.plugins.RegisterHiddenToken """ import c4d import re from c4d import documents def majorVersionToken(data): """The function that will be called to return the string representation of a token. Args: Returns: str: The string that will replace the token """ doc = documents.GetActiveDocument() # Get the file path of the current document file_name = doc.GetDocumentName() match = re.search(r'v\d{0,10}', file_name) version = 'v001' if match: version = 'v' + match.group().replace('v','').zfill(3) else: # print("No match found") pass return str(version) def minorVersionToken(data): """The function that will be called to return the string representation of a token. Args: Returns: str: The string that will replace the token """ doc = documents.GetActiveDocument() # Get the file path of the current document # file_path = doc.GetDocumentPath() file_name = doc.GetDocumentName() match = re.search(r'_\d{0,10}', file_name) version = '001' if match: version = match.group().replace('_','') if len( version) <= 3: version = version.zfill(3) else: pass return str(version) def shortProjectNameToken(data): """The function that will be called to return the string representation of a token. Args: Returns: str: The string that will replace the token """ # Get the file path of the current document file_name = documents.GetActiveDocument().GetDocumentName() match = re.search(r'v\d{0,3}', file_name) token = file_name.split( match.group())[0].rstrip('_') return str(token) def PythonHiddenToken(data): """The function that will be called to return the string representation of a token. Args: Returns: str: The string that will replace the token """ # Returns the frame number as a string. So this will replace the token by the frame number. return str(data[4]) if __name__ == "__main__": # First it's important to check if the token is not already registered for registeredToken in c4d.modules.tokensystem.GetAllTokenEntries(): # Checks if the token name is already used, if it's the case exit. if registeredToken.get("_token") in ["majorVersionToken", "PythonHiddenToken"]: exit() # Registers the token "PythonToken" that will be visible in te render setting. c4d.plugins.RegisterToken("mver", "_Project Mayor Version", "v002", majorVersionToken) c4d.plugins.RegisterToken("nver", "_Project Minor Version", "002", minorVersionToken) c4d.plugins.RegisterToken("shortproject", "_Project Short Name", "scene", shortProjectNameToken) # Registers the token "PythonHiddenToken" it will not be visible in te render setting. c4d.plugins.RegisterHiddenToken("PythonHiddenToken", "This is a Hidden Python Token", "001", PythonHiddenToken)
-
RE: Add Expression Value in Render Settings Save Path
Thanks for your answer.
Tokens are working well but I have a strange issue with them at the multi pass files, if I end the file with a string ( here 'XXX') the file works well but If not it adds '1' to it. Do I miss something in the process ? I think my python token string could not generate that end string there. -
Add Expression Value in Render Settings Save Path
Hello,
Is there a chance to add an expression result of python ( for me the mayor version from the C4D file name ) to the Render Settings Path string ? I would not use c++ custom token, because I'm not familiar in C++.
Thanks !
G