On 19/12/2017 at 05:27, xxxxxxxx wrote:
Sorry for the lack of decent explanation in my original message.
Here's the code to perform the connect.
I am using the MDATA_JOIN_MERGE_SELTAGS in order to merge the selection tags, I was hoping the original tag got merged, but the custom container is missing.
BaseDocument* mDoc = GetActiveDocument();
AutoAlloc<AtomArray> joinOps; if (!joinOps) return FALSE;
mcd.doc = mDoc;
mcd.arr = joinOps;
mcd.mode = MODELINGCOMMANDMODE_ALL;
mcd.bc = &bc;
Bool result = SendModelingCommand(MCOMMAND_JOIN, mcd);
joined = static_cast<BaseObject*>(mcd.result->GetIndex(0));
mDoc->InsertObject(joined, parent, pred);
Following is a script I am using to experiment with creation of custom container in the selection tag.
The script always creates a container if there is none, but I am simply put the lines in comment for reading out (I know I better create 2 scripts, one for writing the container and another for reading, but this was just an experiment)
# obtain valid ID from plugincafe
CUSTOMCONTAINER_PLUGIN_ID = xxxxxxx
def main() :
if (op == None) :
print "No active object"
tag = op.GetFirstTag()
if tag.IsInstanceOf(c4d.Tpolygonselection) :
bc = tag.GetDataInstance()
pgbc = bc.GetContainerInstance(CUSTOMCONTAINER_PLUGIN_ID)
if pgbc == None:
print "No custom container in selection tag"
# add a custom container to the selection tag
pgbc = bc.GetContainer(CUSTOMCONTAINER_PLUGIN_ID)
pgbc = "Test 2"
pgbc = "123456789"
print "custom container in selection tag"
# parse the custom container content
print " = ", pgbc
print " = ", pgbc
tag = tag.GetNext()
What I do is to first apply custom containers to the selection tags of the objects I want to connect.
Then I perform the connect via the plugin and read out the custom container from the selection tags. But there is none on the connected object.