Curves created dynamicly

(15 posts) (3 voices)

Tags:

No tags yet.

  1. MatthNexxtep

    member
    Joined: Sep '14
    Posts: 18

    Hello,

    I have a problem with a VSL. I wrote a script with VSL to draw a curve but when i call this script many times, each script delete (or erase ?) the last curve and draw a new curve over. In fact if I launch the script to draw 4 differents curves, I have just the curve of my last script.

    Thanks for your answer.

    Posted 3 years ago #
  2. CodeMasterMike

    veteran
    Joined: Feb '08
    Posts: 314

    What do you exactly mean with "draw a curve"? Do you mean to create a new curve or add curvepoints?
    Do you want to create a brand new curve in the script, or update existing curve(s)?

    Below I added a simple script, where I create a dynamic Curve and add a controlpoint to that curve. Everytime the script is called, a new dynamic curve is created. Maybe that is something you need?

    Curve NewAddedCurve = bc.CreateCurve("New Curve", true, true);
    CurvePoint TempCurvePoint = bc.CreateCurvePoint("New Point", true, true);
    NewAddedCurve.AddControlPoint(TempCurvePoint);
    Posted 3 years ago #
  3. MatthNexxtep

    member
    Joined: Sep '14
    Posts: 18

    In fact when I create new curve with a script like yours, that's works the first time, but When i recall this script the first curve disappear from the player and that the second curve appear.

    Important :
    I call my script from a C# application with "player.SendMessageToObjectByName("Level", "createCurve", 1)". and I receive this instruction with the player. When I receive this instruction with the "Wait Message BB" I launch the script and create a curve (different of the previous curve).

    Thanks for your help.

    Posted 3 years ago #
  4. tomekj

    veteran
    Joined: Oct '05
    Posts: 143

    Can you post a chunk of your script that causes trouble? I've been working a lot with curves and never had problems with that.

    Posted 3 years ago #
  5. MatthNexxtep

    member
    Joined: Sep '14
    Posts: 18

    I have create asmall project to illustrate my problem. You can download it to : http://rapidshare.com/files/425778863/Release.rar

    Thanks for your help.

    Posted 3 years ago #
  6. tomekj

    veteran
    Joined: Oct '05
    Posts: 143

    had a very quick look.
    the problem seems to be in the render curve bb. for every curve you need a separate instance of that bb. now, whenever a new curve is created it replaces the old curve in the render curve bb. you should make a script that you dynamically attach to every curve with a render curve bb in it.

    Posted 3 years ago #
  7. MatthNexxtep

    member
    Joined: Sep '14
    Posts: 18

    I don't understand how to dynamically attach the render curve BB to each curve. I must do the render Curve in my script ? bt I don't know how doing this, and that's not the same as the current script with the Render Curve BB after ?

    Thanks.

    Posted 3 years ago #
  8. tomekj

    veteran
    Joined: Oct '05
    Posts: 143

    Best Answer

    hmmm, you won't get far in virtools without dynamically attached scripts. you can find many tutorials about that in virtools docs. anyways, about your problem: you're lucky i enjoy occasional procrastination from my own work: attached is an example....

    Attachments

    1. curve_example.cmo (5.1 KB, 38 downloads) 3 years old
    WARNING: Files uploaded in the forums are not monitored by 3DVIA and therefore might contain content that is malicious or offensive. Download at your own risk
    Posted 3 years ago #
  9. MatthNexxtep

    member
    Joined: Sep '14
    Posts: 18

    Thanks a lot for this sample. This solution solve my problem, it's perfect. Thanks again.

    Posted 3 years ago #
  10. MatthNexxtep

    member
    Joined: Sep '14
    Posts: 18

    When the Curve is created like this (with your script for example), I d'ont know how change the material of my curve. The Set material BB don't work and do a second render Curve on the Curve don't work too.
    In fact I just want to change material of my curve when I click on it or when i receive a message from the player.

    Thank's.

    Posted 3 years ago #
  11. tomekj

    veteran
    Joined: Oct '05
    Posts: 143

    there are many ways to do it. e.g. create a new attribute with material as its value, attach it to the curve or to whatever holds the script, copy the shortcut to that attribute value into your script and link it up to the render curve BB. to change the material you should then only need to change the value of that attribute (for example by set attribute BB).

    Posted 3 years ago #
  12. MatthNexxtep

    member
    Joined: Sep '14
    Posts: 18

    Okay, thank's, I'll try to do it. I'm sorry if my questions aren't very interresting, but I begin with Virtool.

    Posted 3 years ago #
  13. MatthNexxtep

    member
    Joined: Sep '14
    Posts: 18

    I'll do it, but when I change material with set attribute BB, the render of my curve doesn't change ...
    And another difficulty of my problem is that I have some differents curves (and i don't know how many, it's dynamic) and each one with a different material... that can be change over the time.
    For exemple if I click on a button in my C# application I send a message to virtool to change the current material of one of my curve (selected by name)

    I try many solutions but I dont' find one which works well...

    Posted 3 years ago #
  14. tomekj

    veteran
    Joined: Oct '05
    Posts: 143

    like I said, try to do some tutorials to understand how it all works in Virtools. it's not very complicated, you just need to learn and practice some of the basic concepts. attached an extended example - should help you get started.

    Attachments

    1. curve_example_extended.cmo (9.6 KB, 25 downloads) 3 years old
    WARNING: Files uploaded in the forums are not monitored by 3DVIA and therefore might contain content that is malicious or offensive. Download at your own risk
    Posted 3 years ago #
  15. MatthNexxtep

    member
    Joined: Sep '14
    Posts: 18

    Okay, thank's for this sample, I think that we learn more faster with a good example than just with doc.
    Thanks a lot.

    Posted 3 years ago #

Reply

You must log in to post.