On 19/10/2017 at 11:32, xxxxxxxx wrote:

When I have a bool with 2 objects under it, the objects are hidden and only the result is shown.
However, when you select on of these 2 objects, you see the bounding box and you can edit them in the view using the colored dots.

I like to do the same in my own object plugin. So, hide the children and show only the result, but make it possible to edit the children in the view by showing the bounding box and dots to edit the object.

I can show the dots by using  NBIT_HIDEEXCEPTVIEWSELECT, but then the bounding box is not shown.

What should I do?


On 19/10/2017 at 13:53, xxxxxxxx wrote:

I found one option:
- set a Display tag on the generator with the visibility to 0%.
That seems exactly as done with for example a bool.


On 20/10/2017 at 06:11, xxxxxxxx wrote:

After some additional testing, it is not working when you set it on the generator.
You must first insert a null and put the display tag on that null (I think)?

I would like to know the best doing this (how cinema is doing this?).

On 20/10/2017 at 06:43, xxxxxxxx wrote:

That is also not working correctly.
I am stuck now.

On 20/10/2017 at 07:41, xxxxxxxx wrote:

Hi Pim,

first you need to register the ObjectData plugin with the OBJECT_INPUT flag.
Second the input objects need to be processed correctly in GetVirtualObjects(), either with GetAndCheckHierarchyClone() or manually via NewDependenceList(), TouchDependenceList() et al.

Unfortunately I only have C++ examples at hand, demonstrating this. See here: atom.cpp (GetAndCheckHierarchyClone()) or objectdata_loftedmesh.cpp (DependenceList)

On 20/10/2017 at 07:46, xxxxxxxx wrote:

Hi Andreas ,
Thanks, I will try to understand and implement it.


On 20/10/2017 at 08:01, xxxxxxxx wrote:

Some further questions.

GetAndCheckHierchyClone: Check and generate a clone of the child objects of a parent generator.

I also read that you can do this for all children of the generator.

  • allchildren  (bool) –  True  if all children should be used in the check.

If so, do I get clones for all children or just one and only if one of the children is dirty?
The return seems only one object?

Return type:|
dict{ cloneBaseObjectdirty : bool}
| Returns:|
The cloned object and a dirty flag:  True  if some part of the child objects in the chain has changed, or False** if nothing has changed.



On 20/10/2017 at 10:45, xxxxxxxx wrote:

Here a small test, but it does not bring me what I want.

    def GetVirtualObjects(self, op, hierarchyhelp) :
        if (op.GetDown() and op.GetDown().GetNext()) :           #2 objects?
            res = op.GetAndCheckHierarchyClone(hierarchyhelp, op.GetDown(), c4d.HIERARCHYCLONEFLAGS_0, True)
            object = res['clone']                               #only one is returned?
            dirty = res['dirty']
            if dirty:
                objA = op.GetDown()
                objB = objA.GetNext()
                #Connect and delete
                obj = utils.SendModelingCommand(command=c4d.MCOMMAND_JOIN, list=[objA, objB])
                if not obj: 
                    print "Error MCOMMAND_JOIN"
                    return None
                return obj[0]           #result of Connect&Delete
                return None
            return None

I see a result sometimes, when I drag one of the children.
But see them twice.
I only want to see the result, but still able to edit the children. Just like the Bool object does.

Also, I only use the GetAndCheckHierarchyClone() to see if it dirty.
I do not see how I can all the cloned children.
I receive only one clone.

Here how I register the plugin.

    pluginstr = "Test object plugin"       
    okyn = plugins.RegisterObjectPlugin(id=PLUGIN_ID, str=pluginstr,
                                description="testobjectplugin", icon=icon,
                                info=c4d.OBJECT_GENERATOR | c4d.OBJECT_INPUT)

On 23/10/2017 at 09:59, xxxxxxxx wrote:


in case of multiple input objects you get those returned grouped under a Null object.
So in your case it would rather look like so:

	if op.GetDown() is None or op.GetDown().GetNext() is None:
		return c4d.BaseObject(c4d.Onull)
        res = op.GetAndCheckHierarchyClone(hierarchyhelp, op.GetDown(), c4d.HIERARCHYCLONEFLAGS_0, True)
        if res['dirty'] == False:
            return res['clone']
        objA = res['clone'].GetDown()
        objB = objA.GetNext()
	# ...

Furthermore you should return None only in case of severe errors, otherwise rather a Null object.

On 23/10/2017 at 13:15, xxxxxxxx wrote:

Thanks, clear now.
And indeed, I do not see the children, exactly as a Bool.