@ferdinand Thank you very much for your help, I have solved the problem!
Latest posts made by treezw
-
RE: How do I sort the plug-in menu?
-
RE: How do I sort the plug-in menu?
@ferdinand I don't quite understand what you mean, because the plugin I took the screenshot of is also in the "Extensions" menu, but it has "Group Separator".
-
RE: How do I sort the plug-in menu?
@ferdinand I'm very sorry, but I was wondering how the separator on the screenshot is implemented? Yes, my question is in the "Extensions" menu
-
How do I sort the plug-in menu?
I registered several plugins in a .pyp file, but when I opened Cinema4D and opened the plugins menu, I found that his sorting is very bad, I want to know how to sort according to my requirements, and I want to add delimiters between the plugins, but I don't know how to do it
1、This is an example of a plug-in menu separator:
,
2、This is an example of the plugin I registered:import c4d, random, os, webbrowser from c4d import documents, gui, BaseContainer, storage as s, gui as g, utils as u, bitmaps from typing import Optional from c4d.gui import GeDialog # START ----------------------------- Plugins_ID ------------------------------------------------------------------------------------------------------------------------ Rig_Start_Plugins_ID = 9863771 Animation_Camera_Plugins_ID = 9863772 Add_Switch_Plugins_ID = 9863773 About_tree_Plugins_ID = 9863787 # END ----------------------------- Plugins_ID ------------------------------------------------------------------------------------------------------------------------ # START ----------------------------- 绑定开始 ------------------------------------------------------------------------------------------------------------------------ class Rig_Start(c4d.plugins.CommandData): def Execute(self, doc): pass return True if __name__ == "__main__": scriptPath = os.path.split(__file__)[0] bmp_Rig_Start = bitmaps.BaseBitmap() iconPath_Rig_Start = os.path.join(scriptPath, "res", "Rig_Start.tif") bmp_Rig_Start.InitWith(iconPath_Rig_Start) c4d.plugins.RegisterCommandPlugin( id=Rig_Start_Plugins_ID, str="绑定开始", info=0, icon=bmp_Rig_Start, help="创建绑定初始层组", dat=Rig_Start(), ) # END ----------------------------- 绑定开始 ------------------------------------------------------------------------------------------------------------------------ # START ----------------------------- Animation_Camera ------------------------------------------------------------------------------------------------------------------------ class Animation_Camera(c4d.plugins.CommandData): def Execute(self, doc): pass return True if __name__ == "__main__": scriptPath = os.path.split(__file__)[0] bmp_Animation_Camera = bitmaps.BaseBitmap() iconPath_Animation_Camera = os.path.join(scriptPath, "res", "Animation_Camera.tif") bmp_Animation_Camera.InitWith(iconPath_Animation_Camera) c4d.plugins.RegisterCommandPlugin( id=Animation_Camera_Plugins_ID, str="CameraAnimation", info=0, icon=bmp_Animation_Camera, help="创建动画摄像机层组", dat=Animation_Camera(), ) # END ----------------------------- Animation_Camera ------------------------------------------------------------------------------------------------------------------------ # START ----------------------------- 添加开关 ------------------------------------------------------------------------------------------------------------------------ class Add_Switch(c4d.plugins.CommandData): def Execute(self, doc): pass return True if __name__ == "__main__": # 获取脚本所在目录 scriptPath = os.path.split(__file__)[0] bmp_Add_Switch = bitmaps.BaseBitmap() iconPath_Add_Switch = os.path.join(scriptPath, "res", "Add_Switch.tif") bmp_Add_Switch.InitWith(iconPath_Add_Switch) c4d.plugins.RegisterCommandPlugin( id=Add_Switch_Plugins_ID, str="添加开关", info=0, icon=bmp_Add_Switch, help="选中层,点击添加开关!", dat=Add_Switch(), ) # END ----------------------------- 添加开关 ------------------------------------------------------------------------------------------------------------------------ # START ----------------------------- 关于... ------------------------------------------------------------------------------------------------------------------------ class About_tree(c4d.plugins.CommandData): def Execute(self, doc): pass return True if __name__ == "__main__": # 获取脚本所在目录 scriptPath = os.path.split(__file__)[0] bmp_about_tree = bitmaps.BaseBitmap() iconPath_about_tree = os.path.join(scriptPath, "res", "about_tree.tif") bmp_about_tree.InitWith(iconPath_about_tree) c4d.plugins.RegisterCommandPlugin( id=About_tree_Plugins_ID, str="关于...", info=0, icon=bmp_about_tree, help="使用教程及后续更新...", dat=About_tree(), ) # END ----------------------------- 关于... ------------------------------------------------------------------------------------------------------------------------
-
How to modify python tags as generators first?
import c4d def main(): cloner = c4d.BaseObject(c4d.Omgcloner) python = c4d.BaseTag(c4d.Tpython) cloner.InsertTag(python) doc.InsertObject(cloner) c4d.EventAdd() if __name__ == '__main__': main()