Grasshopper

algorithmic modeling for Rhino

Strange behaviour from Grasshopper after expiringSolution of Object

I found a solution to my problem described here: Please read this discussion first.

http://www.grasshopper3d.com/forum/topics/strange-behaviour-from-mo...

By calling ExpireSolution(true) on the sliders after all my code has finished running I have solved this issue. However by doing so I get some strange behavior from Grasshopper I can't describe this behavior with pictures so I'll just explain it in words.

Basically I cannot pan left or right and I cannot access the canvas (Disconnect or connect wires - move components around the canvas) it seems like Grasshopper is waiting for something.

Any help would be greatly appreciated! Thanks!

Views: 398

Replies to This Discussion

If you're changing more than one object, I wouldn't use ExpireSolution(true), but instead ExpireSolution(false). Then, only after you have expired all the objects in question, should you trigger a new solution on the document. Or, if you know exactly how many objects you are expiring, you can call ExpireSolution(true) on the last one.

As for the problem you're describing, it sounds like some object is eating all the mouse events because it was at some point activated and never deactivated itself. How is your code triggered? Via a menu? By clicking on some custom object? By clicking on a Button or Toggle?

David,

Thank you for your reply!


The code is trigged by a modifed form of the Grasshopper.Kernel.Special.GH_ButtonObject

The code is trigged by the line: ownerOfThisAttribute.createDesignSpace();

public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
{
if (e.Button != MouseButtons.Left || sender.Viewport.Zoom < 0.5f || !this.m_button.Contains(e.CanvasLocation))
{
return base.RespondToMouseDown(sender, e);
}
this.Owner.ButtonDown = true;

this.Owner.ExpireSolution(true);

ownerOfThisAttribute.createDesignSpace();

return GH_ObjectResponse.Capture;

}

public override GH_ObjectResponse RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
{
if (!this.Owner.ButtonDown)
{
return base.RespondToMouseUp(sender, e);
}
this.Owner.ButtonDown = false;

this.Owner.ExpireSolution(true);

return GH_ObjectResponse.Release;
}

Yeah the button has problems. Try returning

return GH_ObjectResponse.Handled;

instead of Capture from the double click handler.

Thanks David that worked!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service