How to hide plugin from Plugins menu?
-
On 11/03/2018 at 05:17, xxxxxxxx wrote:
Hello plugincafe
I have an Object Generator plugin and I would like to hide it from plugins menu and show another plugin(Command plugin) that will add my Object Generator plugin to the scene, assign the desired tags to it, and change some render settings.
Unfortunately, I have never tried something like this and I would like to know how to register 2 plugins from one python code.
Here is a test plugin(Object Generator) that creates Helix Spline.
1. import c4d, os 2. 3. class Testplugin(c4d.plugins.ObjectData) : 4. 5. def GetVirtualObjects(self, op, hh) : 6. return c4d.BaseObject(5185) 7. 8. if __name__ == "__main__": 9. bmp = c4d.bitmaps.BaseBitmap() 10. dir, file = os.path.split(__file__) 11. fn = os.path.join(dir, "res", "icon.tif") 12. bmp.InitWith(fn) 13. result = c4d.plugins.RegisterObjectPlugin(id = 1040447, 14. str = "Test Plugin", 15. g = Testplugin, 16. description = "Otestplugin", 17. info = c4d.OBJECT_GENERATOR | c4d.OBJECT_ISSPLINE, 18. icon = bmp)
I wonder which parts of this code should I change and what should I add there in order to make this plugin work correctly.
Have a nice day!
-Merk
-
On 11/03/2018 at 07:01, xxxxxxxx wrote:
Ok. I figured out how to hide Object Generator Plugin from C4D's menu.
I simply had to add c4d.PLUGINFLAG_HIDE- if __name__ == "__main__":
- bmp = c4d.bitmaps.BaseBitmap()
- dir, file = os.path.split(__file__)
- fn = os.path.join(dir, "res", "icon.tif")
- bmp.InitWith(fn)
- result = c4d.plugins.RegisterObjectPlugin(id = 1040447,
- str = "Test Plugin",
- g = Testplugin,
- description = "Otestplugin",
- info = c4d.OBJECT_GENERATOR | c4d.OBJECT_ISSPLINE | c4d.PLUGINFLAG_HIDE ,
- icon = bmp)
-
On 11/03/2018 at 07:21, xxxxxxxx wrote:
Figured out
1. import c4d, os 2. 3. #Create Object Generator Plugin 4. class Testplugin(c4d.plugins.ObjectData) : 5. def GetVirtualObjects(self, op, hh) : 6. return c4d.BaseObject(5185) 7. 8. #Create Command Data Plugin 9. class TestpluginCommand(c4d.plugins.CommandData) : 10. def Execute(self, doc) : 11. obj = c4d.BaseObject(1040447) 12. doc.InsertObject(obj) 13. c4d.EventAdd() 14. return True 15. 16. if __name__ == "__main__": 17. bmp = c4d.bitmaps.BaseBitmap() 18. dir, file = os.path.split(__file__) 19. fn = os.path.join(dir, "res", "icon.tif") 20. bmp.InitWith(fn) 21. 22. #Register Object Generator Plugin 23. c4d.plugins.RegisterObjectPlugin(id = 1040447, 24. str = "Test Plugin", 25. g = Testplugin, 26. description = "Otestplugin", 27. info = c4d.OBJECT_GENERATOR | c4d.OBJECT_ISSPLINE | c4d.PLUGINFLAG_HIDE, 28. icon = bmp) 29. 30. #Register Command Data Plugin 31. c4d.plugins.RegisterCommandPlugin(id=1000010 , 32. str="Test Plugin", 33. help="Create Test Plugin", 34. info=0, 35. dat=TestpluginCommand(), 36. icon=bmp)