Control Object always false in SceneHook::Execute

On 30/08/2017 at 06:31, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R16 
Platform:   Windows  ;   
Language(s) :     C++  ;


I came across this phenomenon today. When parsing objects within the thread context of a SceneHook::Execute() the method GetBit(BIT_CONTROLOBJECT) always returns false.

I am parsing selected objects (and their children) as well as objects, which tags are selected (using doc->GetActiveObjects(selection) and doc->GetActiveTags(selection)).

As test, I was then using a Hierarchy derived class to parse through the document but that results in an instant error.

p:\c4d_perforce_work\release\16.0\modules\xpressocore\source\graphview\gv_world.cpp(1264) : CRITICAL: Stop

I tried both - with and without - a BaseThread for Hierarchy.Run(). The BaseThread I used was the parameter from SceneHook::Execute()

When I parse the (partial) document from outside the thread context of the scene hook the GetBit(BIT_CONTROLOBJECT) returns true for control objects. Also, quickly printing the control bit from the Python console also yields true.

Is this a known problem?


On 30/08/2017 at 06:44, xxxxxxxx wrote:

NB: I am doing this when the execution flag is set to EXECUTIONFLAGS_EXPRESSION.


On 31/08/2017 at 05:39, xxxxxxxx wrote:

Hi Martin,

the BIT_CONTROLOBJECT gets set during execution (in the end only the generator knows, what it uses as input objects). I suggest to use AddToExecution() to define a later execution for your SceneHook.

On 31/08/2017 at 07:36, xxxxxxxx wrote:

Thanks so much. This did it.

I was not using AddToExecution() though I was receiving EXECUTIONFLAGS_CACHEBUILDING flags. So I assumed the cache building was done (and the objects had their "proper" state).