i have a script request! (Poses)
Moderators: Víctor Paredes, Belgarath, slowtiger
- Víctor Paredes
- Site Admin
- Posts: 5814
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
-
- Posts: 45
- Joined: Mon Jun 11, 2007 9:02 am
-
- Posts: 45
- Joined: Mon Jun 11, 2007 9:02 am
Don't forget that it takes into account point animation, so if you don't copy your neutral pose into the first frame of the animation after the pose set up you're going to get some strange results. That kept tripping me up, so I just thought I'd mention it.
And start labeling your pose bones from "pose2" onwards. Pose1 is the neutral pose, which isn't used except to compare the other poses to. Everything else is the same, I think.
And start labeling your pose bones from "pose2" onwards. Pose1 is the neutral pose, which isn't used except to compare the other poses to. Everything else is the same, I think.
The problem with the expanding shape is that the script always runs 3 times... or at least 1 time every time you click or do anything in a frame. Layer scripts constantly run all the time.
If you do something that uses and CHANGES the points positions on the current frame then the values are constantly added to the points values... it's an eternal loop... if you let it go too far it could expand to envelop the entire solar system... the galaxy! THE UNIVERSE!
-vern
If you do something that uses and CHANGES the points positions on the current frame then the values are constantly added to the points values... it's an eternal loop... if you let it go too far it could expand to envelop the entire solar system... the galaxy! THE UNIVERSE!

-vern
- Víctor Paredes
- Site Admin
- Posts: 5814
- Joined: Wed Jan 26, 2005 12:18 am
- Location: Barcelona/Chile
- Contact:
-
- Posts: 45
- Joined: Mon Jun 11, 2007 9:02 am
I would need to look at the code a little closer and test out where it's happening. I don't have time right now but when I get a chance I will try to look it over.
Basically look at the code... if there is a spot where you access the point positions of the current frame "moho.frame" and then adding something to it then that will cause the expanding or continuously movie points. Each time the points position is changed it adds onto it again... and it changes... then the script runs accessing the new values... adds again... etc etc... forever...
... I had to rent another storage unit to hold those expanding shapes...
I've gotten around this in some scripts by using a custom function I created that only runs the script ONCE per frame. However there are drawbacks to this because changes aren't updated. For instance moving a bone won't update the point positions because the script doesn't run again.
-vern
Basically look at the code... if there is a spot where you access the point positions of the current frame "moho.frame" and then adding something to it then that will cause the expanding or continuously movie points. Each time the points position is changed it adds onto it again... and it changes... then the script runs accessing the new values... adds again... etc etc... forever...
... I had to rent another storage unit to hold those expanding shapes...

I've gotten around this in some scripts by using a custom function I created that only runs the script ONCE per frame. However there are drawbacks to this because changes aren't updated. For instance moving a bone won't update the point positions because the script doesn't run again.
-vern
Okay... I just remembered something.
What you need to do is change the order of the code execution. It is getting the point positions after changing them which causes that "loop". You need to get the "unchanged" point position and save it somehow. In a variable or table. Each frame that has keys or point motion that is different from the poses would then update that list. You need a list that of point positions that have the pose motion "subtracted" so they can be applied "fresh" each time the script runs.
This is going to be a performance hog I think with really dense mesh files. It has to get the point positions on the frame before the script changes them... do the calculations for the poses and bones... then apply the previous values to the pose values. Each frame does it over again.
Remember you can't get the point locations AFTER any changes have been made or you get that feedback loop.
Hey this script runs pretty dang fast on my PC. I guess I never tried it there before. I was using it on the mac which is a dog.
-vern
What you need to do is change the order of the code execution. It is getting the point positions after changing them which causes that "loop". You need to get the "unchanged" point position and save it somehow. In a variable or table. Each frame that has keys or point motion that is different from the poses would then update that list. You need a list that of point positions that have the pose motion "subtracted" so they can be applied "fresh" each time the script runs.
This is going to be a performance hog I think with really dense mesh files. It has to get the point positions on the frame before the script changes them... do the calculations for the poses and bones... then apply the previous values to the pose values. Each frame does it over again.
Remember you can't get the point locations AFTER any changes have been made or you get that feedback loop.
Hey this script runs pretty dang fast on my PC. I guess I never tried it there before. I was using it on the mac which is a dog.
-vern
-
- Posts: 510
- Joined: Sat Jul 29, 2006 1:34 pm
- Location: New York City
- Contact:
Hi PocketGoat, using the new script I can indeed adjust points between poses but I can't seem to control where to place them. Here is my test file:
http://darthfurby.com/as/poses090514.zip
Maybe I did something wrong? I don't know, but big thumbs up for taking a crack at this!
http://darthfurby.com/as/poses090514.zip
Maybe I did something wrong? I don't know, but big thumbs up for taking a crack at this!
Yes Darth,
That is due to the point locations constantly updating while the script runs. You can't "grab" the points because they keep changing their locations. Notice that the preview doesn't match the construction curves? There is a spot in the code where the points are changing before the frame is refreshed. I think there is a way around this but I have to get my brain into "Script" mode... I'm in "creative" mode at the moment.
-vern
That is due to the point locations constantly updating while the script runs. You can't "grab" the points because they keep changing their locations. Notice that the preview doesn't match the construction curves? There is a spot in the code where the points are changing before the frame is refreshed. I think there is a way around this but I have to get my brain into "Script" mode... I'm in "creative" mode at the moment.

-vern
-
- Posts: 510
- Joined: Sat Jul 29, 2006 1:34 pm
- Location: New York City
- Contact:
-
- Posts: 45
- Joined: Mon Jun 11, 2007 9:02 am
This is more a proof of concept at this stage DarthFurby. At least it means with a little more work that it'll be possible to use poses with bone or point animation, or even multiple pose setups on the same layer.
Also, I've realized I'm not storing the point difference's properly, so there'll be some strange results because of that. I'm working on it though.
Also, I've realized I'm not storing the point difference's properly, so there'll be some strange results because of that. I'm working on it though.
I have encountered this "loop" issue many times when creating scripts for bones. My bones will gradually start sliding away and the zoom off into... the outermost edges of the workspace. Very annoying. I always forget the exact steps to fix this issue.
The redrawing of the screen that doesn't match the vectors may actually be a different issue. It has to do with how AS updates the view. For example you may not WANT to update the view at the END of a process. You may want to do it at the FRONT or beginning of a function to update THE LAST loop through the modification.
Think about this for a moment...
The points are in position X on a frame. Your function gets that position does stuff to it blah blah to get a new value Y. Then X = X + Y.
Then that function ends. If you update the view immediately the point is in a new position. Now the script or another function runs again... the new position is used. If instead you updated at the BEGINNING of the function you can grab the OLD values of the points position before doing any modifications.
It could be that the code that is changing point values based on the poses is running first... then the other bit of code is adding on top of that value instead of waiting to do it once at the end.
I'm talking out my arse... I have no clue really.
I always put the exact same number of equal packets in my 24 oz coffee... I when I'm not in "code" mode I have to count them like 3 times. 
-vern
The redrawing of the screen that doesn't match the vectors may actually be a different issue. It has to do with how AS updates the view. For example you may not WANT to update the view at the END of a process. You may want to do it at the FRONT or beginning of a function to update THE LAST loop through the modification.
Think about this for a moment...
The points are in position X on a frame. Your function gets that position does stuff to it blah blah to get a new value Y. Then X = X + Y.
Then that function ends. If you update the view immediately the point is in a new position. Now the script or another function runs again... the new position is used. If instead you updated at the BEGINNING of the function you can grab the OLD values of the points position before doing any modifications.
It could be that the code that is changing point values based on the poses is running first... then the other bit of code is adding on top of that value instead of waiting to do it once at the end.
I'm talking out my arse... I have no clue really.

When I'm not in "script" mode... I can't even do 1+1=2... more like "1984" and "2+2=5".DarthFurby wrote:Hey, at least you have a "script" mode to switch to, I'm stuck in "1+1=2" mode.


-vern