Object deselects everything



  • On 06/05/2015 at 06:57, xxxxxxxx wrote:

    The title is not very explanatory but I will try to describe what is going on.
    I created an ObjectPlugin. It creates a mesh that is generated from a spline.
    The generated mesh is quite complex and, to create it I have to create Sweep objects, make then editable, join the body and caps into a single object, optimize the resulting mesh, perform a bridge operation between some sweeps and finally, gather all the editable sweeps into a single object and optimize everything.
    It is working.
    However, when I perform any operation that forces a new mesh calculation, after being calculated, any object that was selected previously, gets deselected.
    For example, if I select the spline (it is an independent object) that is used as the basis for the calculation of the mesh and I adjust any of its parameters, the mesh is re-calculated but after that, the spline gets deselected from the Object Manager and the Attribute Manager becomes empty.
    Could it be because, for some operations ( MCOMMAND_JOIN and ID_MODELING_BRIDGE_TOOL , for example), I used a different document generated by IsolateObjects?
    Is this a normal behavior when the code generated internal new documents or am I doing something wrong?



  • On 06/05/2015 at 23:49, xxxxxxxx wrote:

    Hi Rui,

    If objects get deselected in the active document the selection state is definitely changed in your object plugin.
    If you're performing the modeling commands in another temp document the active document is not changed.
    I think you should check carefully your object plugin code.



  • On 08/05/2015 at 03:22, xxxxxxxx wrote:

    Found the problem.
    The IsolateObjects command deselects the objects from the document.
    If I create a new BaseDocument and manually insert the objects there, nothing gets deselected.
    Maybe there is a bug in the IsolateObjects command.



  • On 08/05/2015 at 06:39, xxxxxxxx wrote:

    Hi Rui,

    Originally posted by xxxxxxxx

    Found the problem.
    The IsolateObjects command deselects the objects from the document.
    If I create a new BaseDocument and manually insert the objects there, nothing gets deselected.
    Maybe there is a bug in the IsolateObjects command.

    I can't confirm this issue with IsolateObjects(). I've not been able to reproduce this behavior.
    Could you post some code showing it?
    Maybe run from inside a generator plugin the behavior is different. You could in that case try to call IsolateObjects() on a clone of the active document.



  • On 08/05/2015 at 07:06, xxxxxxxx wrote:

    Well, my code is pretty complex. Really, really complex.
    But I performed strategic returns to try to find the culprit and I always got no deselection of objects when the return was placed right before the line containing IsolateObjects.
    If the return was placed after the IsolateObjects, the other objects got deselected when my ObjectPlugin code was executed.
    After replacing all the IsolateObjects (I had four) with manual creation of documents and InsertObject commands, it works fine.



  • On 11/05/2015 at 09:02, xxxxxxxx wrote:

    If it's fine creating your own documents and inserting objects then I'll mark this thread as solved.
    IsolateObjects() is an heavy function and is only useful when called from the UI or a command.


Log in to reply