Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Author Topic: ASL Parametric Script Questions  (Read 6931 times)

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
ASL Parametric Script Questions
« on: June 12, 2008, 07:58:13 pm »

In writing the chain_maker parametric plugin, I ran across a couple of issues. I wonder if they can be addressed though some sort of work-around.

Issue 1:  I wanted to write the script such that it followed the selected path like in Steve's "spline.txt", but I discovered that the only way I could "activate" the script after the icon was pressed was to click in the editor window.  Clicking (or actually running the script - I cannot tell which) effectively de-selects the previous selected shape and automatically selects the shape created by the script.

Issue 2:  When a parametric plug-in script is run by clicking the icon, then clicking (or click-dragging) in the editor window, the parametric shape is created at the editor click coordinates and the origin is assigned at the new shape's "centroid".

Question 1:  Is there some way to store what was previously selected?  I've tried numerous things, but outside of having a separate non-parametric non-plugin script write it somewhere (like a material name or some attribute, etc.), then reading it with the actual parametric plugin script, nothing works.

Question 2:  Are the coordinates of the initial click in the editor window (after selecting the script's icon) stored someplace accessible?  I cannot find it in the documentation.  The availability of these coordinates has multiple applications.

Steve:  I love the scripting abilities of Anim8or!  If there is anything I can do to help with development of the ASL for all of Anim8or, please let me know.  I have been a programmer for a long time in multiple languages, and have written similar scripting languages for other applications.

Logged

Kubajzz

  • Flying Platypus
  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 548
  • Little doggie ate my avatar...
    • View Profile
Re: ASL Parametric Script Questions
« Reply #1 on: June 12, 2008, 08:38:57 pm »

I think there is no way to create parametric chain maker script.

Parametric shape properties cannot depend on what was selected before the shape was created, the shape only depends on its parameters.

The only way to create a shape according to a spline is to write a command script (that's what you have already done), but command scripts can't have parameters in the current version of ASL... So I guess we will have to wait for some of the future releases.

I love your chain maker script by the way!
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: ASL Parametric Script Questions
« Reply #2 on: June 12, 2008, 08:52:03 pm »

Kubajazz,

Thank you for the compliment.  I'm glad you like it.

I did post a parametric version, but I kinda cheated.  See the post in the other thread.
Logged

karate5662

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • my mini city
Re: ASL Parametric Script Questions
« Reply #3 on: June 12, 2008, 09:05:33 pm »

perhaps you can work around some of the issues by making a script that, when you run it with a spline selected, it stores the spline name. then, when you run the parametric script, it looks in that variable for the spline to make the chain with. if the variable is empty or does not exits, you could have the script execute the way it does now.
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 1547
    • View Profile
Re: ASL Parametric Script Questions
« Reply #4 on: June 13, 2008, 07:01:11 am »

The original spline following script that I posted is a"run-once to build the original object" command scripts, not a parameteric one.  It could be installed as a command script or run explicitly.  It doesn't work as a parameteric scripts.

The output of parameteric scripts are supposed to be entirely defined by their numeric parameters.  That's why they can't access any other input (like look to see what other shapes are in the object, see what frame they are in, the time of day, etc.).  If they could be influenced that way then they could look different when put into a scene, etc.

I suppose it's possible to keep the original spline as something like a lot of parameters but that's not anything Anim8or can do.  You'd have to type in a whole lot of numeric values to change the shape of the spline.  That's not something that any human I know could do in any controlled manner :).

Another more likely possibility is to make a new kind of script - a "derivative object" script or some such name.  You'd build a shape of some sort (e.g. a spline) and then attach a script to it.  Whenever the shape was modified the script would be run.   The base shape wouldn't be visible (except in the Object editor where you could edit it) but the result of the script would.  I think that would do something more like what you want.  Anyway it's an interesting idea.
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: ASL Parametric Script Questions
« Reply #5 on: June 13, 2008, 03:54:48 pm »

Steve,

I'm not sure I understand your last post.  It is entirely possible to access the other shapes in an object from a parametric script.  I do it in the parametric version of the chain_maker script.  It follows the splines that are renamed to "chainpathXX".  The only limitation was the inability to see what had been previously selected or access the coordinates of the mouse click that activated the script.
Logged

Kubajzz

  • Flying Platypus
  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 548
  • Little doggie ate my avatar...
    • View Profile
Re: ASL Parametric Script Questions
« Reply #6 on: June 13, 2008, 04:19:55 pm »

...The only limitation was the inability to see what had been previously selected or access the coordinates of the mouse click that activated the script.

...and another limitation is that you must not edit/rename/delete the spline after the chain is built (unless you convert the chain to mesh).

Great script anyway, I didn't believe anithing like this would be possible  ;)
Logged

Steve

  • Administrator
  • Hero Member
  • *****
  • Posts: 1547
    • View Profile
Re: ASL Parametric Script Questions
« Reply #7 on: June 14, 2008, 09:33:10 pm »

Well, I never intended for that.  Accessing other objects really shouldn't be allowed :)  That makes parameteric scripts unpredictable as you've discovered.
Logged

NickE

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: ASL Parametric Script Questions
« Reply #8 on: June 14, 2008, 09:52:31 pm »

Steve,

Not entirely unpredictable...one must just be careful on how the script is used.

On another note, is there (or will there be) a function that will let one access the information in multiple objects in the project in the same manner as one can access the multiple shapes in an object?
Logged

hihosilver

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1294
    • View Profile
Re: ASL Parametric Script Questions
« Reply #9 on: June 15, 2008, 12:36:37 am »

Quote
Another more likely possibility is to make a new kind of script - a "derivative object" script or some such name.  You'd build a shape of some sort (e.g. a spline) and then attach a script to it.  Whenever the shape was modified the script would be run.   The base shape wouldn't be visible (except in the Object editor where you could edit it) but the result of the script would.  I think that would do something more like what you want.  Anyway it's an interesting idea.

This sounds like a fabulous idea to me.  It may be difficult to figure out how to show the progress though.  Perhaps there'd have to be a button like the hide/show bones button.
Logged

karate5662

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • my mini city
Re: ASL Parametric Script Questions
« Reply #10 on: June 15, 2008, 01:23:35 am »

That "derivative" object class would be really useful. It would also be nice to use with morph targets.
Logged