I need to merge 2 objects in OBJECT_GENERATOR plugin and return the result but it returns only 1 object. my code looks like this. Am I doing something wrong?
import c4d, os
from c4d import plugins, utils, Vector as v
def GetVirtualObjects(self, op, hh):
virtualDoc = c4d.documents.BaseDocument()
cube1 = c4d.BaseObject(c4d.Ocube)
cube2 = c4d.BaseObject(c4d.Ocube)
virtualDoc.ExecutePasses(c4d.threading.GeGetCurrentThread(), True, True, True, c4d.BUILDFLAGS_INTERNALRENDERER)
output = utils.SendModelingCommand(command = c4d.MCOMMAND_JOIN, doc = virtualDoc, list = [cube1,cube2])
if __name__ == "__main__":
plugins.RegisterObjectPlugin(id = 1000000,
str = "Test",
g = Otest,
description = None,
info = c4d.OBJECT_GENERATOR,
icon = None)
Hi @merkvilson; MCOMAND_JOIN have changed in R18, now objects have to be under the same hierarchy.
See Behaviour of MCOMMAND_JOIN different in R18 or [Python] SendModelingCommand().
You have to combine objects to null, for example:
from c4d import gui
null = c4d.BaseObject(c4d.Onull)
for o in listy:
res = c4d.utils.SendModelingCommand(command = c4d.MCOMMAND_JOIN,
list = [null],
mode = c4d.MODELINGCOMMANDMODE_ALL,
bc = c4d.BaseContainer(),
doc = doc)
obs = doc.GetActiveObjects(0)
I had to double-check this in SDK
btw. is it possible to sort the search results by date? I was getting 8 years old posts when looking for this topic.
For sure go to https://plugincafe.maxon.net/search (you can also access this page by clicking on the little bolts/nuts which appears after a click on the top search bar.)
Then on this page, you can define more option to search, and you can decide which kind of sorting you prefer.
Thanks, buddy. Will take this into account
Finally please do not forget to mark your topic as solved. See Q&A Functionality .
I was looking for "Solved" option in tags section but could not find it.
Finally, I figured this out.
Seems like this is because my browser's zoom is set to 150%
thanks for pointing out this issue. We'll see if can get a fix for that (not all tags visible, if zooming in with browser).
In the end Maxime wasn't referring to tags at all. Instead he was talking about the Q&A Function we have in this forum. I took the freedom to mark this thread as solved (see this shiny green stamp next to the headline ).