modify the real mesh using Mesh_modifier

View: New views
8 Messages — Rating Filter:   Alert me  

modify the real mesh using Mesh_modifier

by Carsten Haubold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey all,

I set up a "set weight" plugin for the NURBS modeling tools during a tiring lecture, and I faced the problem that I can set the weight to a new value and I see the changes on a black (not selected) curve and the selected one stays the same. As soon as I change the selection my changed mesh is gone, too.

I thought that mesh_modifier would do exactly that? How can I have persistant changes?

Another thing is: with the multiple property view you need to select NurbsCurveInstance and SetPointWeight from the nodes list and then select the points you want to apply a new weight to. If you select some points of the curve within the viewport and try to switch to the SetPointWeight property to apply the new weight, the selection of the mesh is discarded. So this is kind of unintuitive I think.

Cheers
Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

Re: modify the real mesh using Mesh_modifier

by bART Janssens-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 5/4/08, Carsten Haubold <CarstenHaubold@...> wrote:
> I set up a "set weight" plugin for the NURBS modeling tools during a tiring
> lecture, and I faced the problem that I can set the weight to a new value
> and I see the changes on a black (not selected) curve and the selected one
> stays the same. As soon as I change the selection my changed mesh is gone,
> too.
>
> I thought that mesh_modifier would do exactly that? How can I have
> persistant changes?

HI Carsten,

Glad to hear you are making good use of boring lecture time :)

The k3d::mesh_modifier should indeed make persistent changes. If you
use the context menu and select your modifier from the "Mesh Modifier"
submenu, it should work as expected. If not, I think it's best you
show us the code, so we can better help in debugging it.

Cheers,

--
Bart

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

Re: modify the real mesh using Mesh_modifier

by Carsten Haubold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Bart,


Glad to hear you are making good use of boring lecture time :)

The k3d::mesh_modifier should indeed make persistent changes. If you
use the context menu and select your modifier from the "Mesh Modifier"
submenu, it should work as expected. If not, I think it's best you
show us the code, so we can better help in debugging it.

uhm.. it does not appear under MeshModifier, only if I choose Create->Nurbs->NurbsSetWeight I can instanciate it.
What do I need to change so it appears in the context menu? I looked into others like Deformation plugins but did not notice anything special to add them there.

I committed it to SVN as it compiles correctly, its in modules/nurbs/set_weight.cpp.

Cheers
Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

Re: modify the real mesh using Mesh_modifier

by bART Janssens-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, May 4, 2008 at 3:31 PM, Carsten Haubold <CarstenHaubold@...> wrote:
> I committed it to SVN as it compiles correctly, its in
> modules/nurbs/set_weight.cpp.

The interface_list in get_factory is wrong, you should have both
imesh_source and imesh_sink.

--
Bart

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

Re: modify the real mesh using Mesh_modifier

by Carsten Haubold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ah okay, I fogot to add mesh_sink to the interfaces, I didnt look at that line :)

But the problem still is, when I add the Plugin I need to select it before I'm able to change the value, but as soon as I do that my selection gets discarded and thus the new value is not applyed to any point.

Cheers
Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

Re: modify the real mesh using Mesh_modifier

by Timothy M. Shead :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Carsten Haubold wrote:
> Ah okay, I fogot to add mesh_sink to the interfaces, I didnt look at
> that line :)
>
> But the problem still is, when I add the Plugin I need to select it
> before I'm able to change the value, but as soon as I do that my
> selection gets discarded and thus the new value is not applyed to any
> point.
I've committed some fixes to NubsSetWeight, there were several issues
worth mentioning:

* When you make a selection, then "apply" a modifier, the selection has
to be stored somewhere.  That somewhere is your modifier, so you will
see that it now derives from k3d::mesh_selection_sink, which provides
the storage.
* When you are a selection sink, you have to "merge" the stored
selection with your input before you can test for selections.  This may
seem a little funny, but it enables us to mix interactive selection with
pipeline components that create/modify selections, and it also makes it
possible to write modifiers that use *multiple* selections.
* You wouldn't have noticed any of this in the deformation modifiers,
because they derive from a different base-class that handles these details.
* You can't modify your inputs!  Const-casting was trying to tell you
something here.
* A mesh is a three-level hiearchy: mesh -> gprim -> arrays.  We do
shallow-copying at all levels, so when you go to modify anything, you
generally have to create a deep copy of the gprim, and then deep copies
of any arrays you wish to modify.  Note the calls to k3d::make_unique()
that do this deep-copying, and return a non-const object that you can
modify.
* Selections are floating-point weights in K-3D, not bools.  Although
it's an under-utilized feature at a UI level, the idea is that modifiers
should - wherever reasonable - use the selection to weight their
operation.  In this case you'll note that I used k3d::mix() to do a
linear interpolation between the original and new weights.  Since
selections are currently all 0.0 or 1.0, this works the way one would
expect, but "fuzzy" selections in the future will Just Work also.

Cheers,
Tim





-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

Re: modify the real mesh using Mesh_modifier

by Timothy M. Shead :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Timothy M. Shead wrote:

> Carsten Haubold wrote:
>  
>> Ah okay, I fogot to add mesh_sink to the interfaces, I didnt look at
>> that line :)
>>
>> But the problem still is, when I add the Plugin I need to select it
>> before I'm able to change the value, but as soon as I do that my
>> selection gets discarded and thus the new value is not applyed to any
>> point.
>>    
> I've committed some fixes to NubsSetWeight, there were several issues
> worth mentioning:
Forgot to mention:

* In testing, don't apply the same weight to every point and wonder why
the results didn't change, as I did ... :)

Cheers,
Tim


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development

Parent Message unknown Re: modify the real mesh using Mesh_modifier

by Carsten Haubold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Tim,

thx a lot, I'll have a look at it in detail later.. in my lectures :)

Cheers
Carsten

2008/5/5 Timothy M. Shead <tshead@...>:

Timothy M. Shead wrote:
> Carsten Haubold wrote:
>
>> Ah okay, I fogot to add mesh_sink to the interfaces, I didnt look at
>> that line :)
>>
>> But the problem still is, when I add the Plugin I need to select it
>> before I'm able to change the value, but as soon as I do that my
>> selection gets discarded and thus the new value is not applyed to any
>> point.
>>
> I've committed some fixes to NubsSetWeight, there were several issues
> worth mentioning:
Forgot to mention:

* In testing, don't apply the same weight to every point and wonder why
the results didn't change, as I did ... :)

Cheers,
Tim


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
K3d-development mailing list
K3d-development@...
https://lists.sourceforge.net/lists/listinfo/k3d-development