On 18/04/2018 at 09:59, xxxxxxxx wrote:
Hi Peterakos, thanks for writing us.
I've tried to replicate the issue you mentioned but I wasn't able in the end to. Actually the array's cache dirty counter is properly increased every time the instance points to a different object in the scene as well as the array instance's data dirty counter. At the same time changing the camera position doesn't produce any effect on the array's cache dirty counter.
Assuming a scene like:
\
|-Plane
|-Disc
|-Array
|-ArrayInstance
and changing the pointed object in the array instance from disc to plane (or viceversa), produces on EVMSG_DOCUMENTRECALCULATED the following output:
Previous state:
Plane
hdOb: 1 / hdMa: 1 / hdObH: 0 / hdAl: 3
dDa: 11 / dMa: 1 / dCa: 1 / dCh: 0
Disc
hdOb: 1 / hdMa: 1 / hdObH: 0 / hdAl: 3
dDa: 15 / dMa: 1 / dCa: 1 / dCh: 0
Array
hdOb: 2 / hdMa: 1 / hdObH: 1 / hdAl: 4
dDa: 7 / dMa: 1 / dCa: 2 / dCh: 0
Array Instance
hdOb: 2 / hdMa: 1 / hdObH: 0 / hdAl: 3
dDa: 8 / dMa: 1 / dCa: 0 / dCh: 0
Current state:
Plane
hdOb: 1 / hdMa: 1 / hdObH: 0 / hdAl: 3
dDa: 11 / dMa: 1 / dCa: 1 / dCh: 0
Disc
hdOb: 1 / hdMa: 1 / hdObH: 0 / hdAl: 3
dDa: 15 / dMa: 1 / dCa: 1 / dCh: 0
Array
hdOb: 2 / hdMa: 1 / hdObH: 1 / hdAl: 4
dDa: 7 / dMa: 1 / dCa: 2 / dCh: 0
Array Instance
hdOb: 2 / hdMa: 1 / hdObH: 0 / hdAl: 3
dDa: 8 / dMa: 1 / dCa: 0 / dCh: 0
where:
hdOb -> GetHDirty(HDIRTYFLAGS_OBJECT)
hdMa -> GetHDirty(HDIRTYFLAGS_OBJECT_MATRIX)
hdObH -> GetHDirty(HDIRTYFLAGS_OBJECT_HIERARCHY)
hdAl -> GetHDirty(HDIRTYFLAGS_ALL)
dDa -> GetDirty(DIRTYFLAGS_DATA)
dMa -> GetDirty(DIRTYFLAGS_MATRIX)
dCa -> GetDirty(DIRTYFLAGS_CACHE)
dCh -> GetDirty(DIRTYFLAGS_CHILDREN)
For the sake of completeness here you are with the meaningful part of the code used to test the behavior
void SDKSupport_14186_Dialog::TraverseObjectAndCheckDirty(BaseObject *obj, String& res)
{
const String objName = obj->GetName();
const Int32 hDirtyObject = obj->GetHDirty(HDIRTYFLAGS_OBJECT);
const Int32 hDirtyMatrix = obj->GetHDirty(HDIRTYFLAGS_OBJECT_MATRIX);
const Int32 hDirtyObjectH = obj->GetHDirty(HDIRTYFLAGS_OBJECT_HIERARCHY);
const Int32 hDirtyAll = obj->GetHDirty(HDIRTYFLAGS_ALL);
const Int32 dirtyData = obj->GetDirty(DIRTYFLAGS_DATA);
const Int32 dirtyMatrix = obj->GetDirty(DIRTYFLAGS_MATRIX);
const Int32 dirtyCache = obj->GetDirty(DIRTYFLAGS_CACHE);
const Int32 dirtyChildren = obj->GetDirty(DIRTYFLAGS_CHILDREN);
res += "\n" + objName + " \n hdOb: " + String::IntToString(hDirtyObject) + " / hdMa: " + String::IntToString(hDirtyMatrix) + " / hdObH: " + String::IntToString(hDirtyObjectH)+ " / hdAl: " + String::IntToString(hDirtyAll) + "\n dDa: " + String::IntToString(dirtyData) + " / dMa: " + String::IntToString(dirtyMatrix) + " / dCa: " + String::IntToString(dirtyCache)+ " / dCh: " + String::IntToString(dirtyChildren);
if (obj->GetDown())
{
BaseObject* child = obj->GetDown();
TraverseObjectAndCheckDirty(child, res);
}
if (obj->GetNext())
{
BaseObject* brother = obj->GetNext();
TraverseObjectAndCheckDirty(brother, res);
}
}
Bool SDKSupport_14186_Dialog::CreateLayout()
{
_prevState = "";
SetTitle("SDKSupport_14186_Dialog");
AddMultiLineEditText(TextID_DLG_14186, BFH_SCALEFIT | BFV_TOP, SizePix(400), SizeChr(160));
return true;
}
Bool SDKSupport_14186_Dialog::CoreMessage(Int32 id, const BaseContainer &msg)
{
if (id == EVMSG_DOCUMENTRECALCULATED)
{
// attempt to retrieve the active document
GePrint("DocumentRecalculated");
BaseDocument* activeDoc = GetActiveDocument();
if(!activeDoc)
return false;
// attempt to retrieve the first object in the scene
BaseObject* first = activeDoc->GetFirstObject();
if (!first)
return false;
// traverse the scene and check dirty counters
String currentState;
TraverseObjectAndCheckDirty(first, currentState);
// present the previous and current dirty counter states
if (_prevState.Content())
SetString(TextID_DLG_14186, "Previous state:" + _prevState + "\nCurrent state:" + currentState);
else
SetString(TextID_DLG_14186, "Current state:" + currentState);
_prevState = currentState;
}
return true;
}
Bool SDKSupport_14186::Execute(BaseDocument* doc)
{
if (_dlg.IsOpen() == false)
_dlg.Open(DLG_TYPE_ASYNC, g_SDKSupport_13370_TestDialog, -1, -1, 400, SizeChr(160));
return true;
}
Bool SDKSupport_14186::RestoreLayout(void* secret)
{
return _dlg.RestoreLayout(g_SDKSupport_14186_Dialog, 0, secret);
}
Hoping it could be of any help, give best.
Riccardo