On 25/08/2017 at 23:38, xxxxxxxx wrote:
I'm drawing from ToolData based plugin.
I've done a bit of research here. To avoid errors caused by rest of my code I played with Cinema R18 SDK sample PickObjectTool plugin because it is closest to what I am doing.
I inserted following code at the beginning of PickObjectTool::Draw() function:
if (flags == TOOLDRAWFLAGS_0) // <-- this is how I'm drawing (and makes the strange bug)
//if (flags & TOOLDRAWFLAGS_HIGHLIGHT) // <-- this looks like the solution
// 3D draw, red line
bd->SetPen(Vector(1, 0, 0));
bd->DrawLine(Vector(0, 0, 0), Vector(200, 200, 200), NOCLIP_Z);
// 2D draw, green line
bd->SetPen(Vector(0, 1, 0));
bd->DrawLine2D(Vector(0, 0, -MAX_Z), Vector(200, 200, -MAX_Z));
I found out that it behaves a bit differently than I reported:
If I draw when flags == TOOLDRAWFLAGS_0 it draws 2D green line only if there is at least one object in scene with highlighted orange border (so if I change mode or deselect object or select object without this orange border - for example Null object, green line disappears).
If I draw when flags contain TOOLDRAWFLAGS_HIGHLIGHT everything works fine, so this is my solution. Due to a bit simple description of TOOLDRAWFLAGS in documentation I didn't even consider this option.