Jump to content
Developer Wiki and Function Reference Links ×

Animations - The Challenge Series


Recommended Posts

Sorry I've been missing the forums lately, it's back as one of my home tabs so I should be here a little more.

I've been working on the designs recently for the Melbourne Comedy Festival which has a centrepiece of a large revolve with several set elements.

As part of a cute package I threw together I ended up using the Orbital Animation feature to do a really nice rendering of the items on the revolve.

I then got to thinking how hard it would be to implement this functionality into the actual planset, re:automation.

Attached is me around 2 hours in (It's 2015, viewer will still open it or I'll downsave if needed peeps). (Note not to scale, no detail, it's just the concept). It's around 900 frames long, and I haven't put compensation in for multiple runnings of the script within the boundaries yet.

That aside I've learnt several things!

1) Seems that 3D isometric views of a design layer aren't visually affected by RedrawAll until you change perspective, render type or between Top/Plan and Plan.

2) All rendering styles except Wireframe and Sketch don't update in any 3D view from the design layer.

3) Viewports do update in Isometric modes. Why I have no idea.

4) Even with a wait command and an UpdateVP the viewport with any other mode other than Wireframe or Sketch won't update even one frame.

So my question is this Brains Trust. Can you run and/or edit and run my script and get an OpenGL animated rendering in a viewport and/or the raw design layer?

I have a feeling it's a few lines away from doing it just can't quite get there.

Hope you're all well.

J

PS. On a side note if anyone knows how to set the perspective and co-ordinates of the Viewport Portal feel free to attach a linked article.

Link to comment

I've been working on my own challenge.

Progress:

Now with your keyboard you can trigger the Fly lines to move up, down or remain stationary. (1, 2 & 3 key)

Notated code, sorry!

Found more flexibility - about to work on up/down limits and perhaps changing key style to latching.

Need Help With:

Why won't OpenGL refresh. You'll notice that I'm running this whole thing through a viewport. In a standard design layer it won't RedrawAll. I've tried for resetting the viewport to no avail. Any input welcome!

Opinions on concept. Post getting actual rendered modes to work I'm thinking temp dialog for control, got a design in the works.

Anyone who has an example of exporting a .jpg from script would be much appreciated!

I'll keep at it, don't be scared to break it.

J

Link to comment

James

You're not going to believe this. But this makes it work in the design layer with Open GL

I don't know why.

mk

Procedure TEST;

VAR

SimpleCounter : INTEGER; {Tick Counter}

HeightBumper : INTEGER; {mm Bump to Fly1}

FlyState : INTEGER; {0: Stationary, 1: Up, 2: Down}

cCode : INTEGER; {Secondary Keydown testing}

bCode : INTEGER; {Primary Keydown testing}

Fly1 : HANDLE; {Handle to Fly}

Revolve : HANDLE; {Handle to Revolve}

viewport : HANDLE; {Handle to Viewport}

exitState : REAL; {Redundant from previous test}

xM, yM : REAL; {Mouse stop co-ords}

BEGIN {Main}

DselectAll; {Hope these aren't causing issues}

UnDoOff;

Revolve := GetObject('Rev3'); {Get named object x}

Fly1 := GetObject('C1');

viewport := GetObject('Viewport-1');

SimpleCounter := 1; {Reset tick counter}

HeightBumper :=5; {Fly speed both up and down}

bCode :=27; {Aka Bail code - Esc Key - testing}

exitState := 1; {Still here from dialog input}

IF exitState = 1 THEN

BEGIN

REPEAT {Overall loop state}

REPEAT {Key input loop state}

Message(Concat(SimpleCounter,' ',cCode,' ',FlyState)); {Debug output}

HRotate(Revolve, 0, 0, 3); {Revolve just does its thing}

HMoveBackward(Revolve,FALSE);

HMoveForward(Revolve,FALSE);

CASE FlyState OF {Bumping either up or down pending key input}

1: Move3DObj(Fly1, 0, 0, HeightBumper);

2: Move3DObj(Fly1, 0, 0, -(HeightBumper));

End;

HMoveBackward(Fly1,FALSE);

HMoveForward(Fly1,FALSE);

SimpleCounter := SimpleCounter+1; {Increment Counter}

ResetObject(Revolve); {Resets}

ResetObject(Fly1);

RedrawAll; {Redraw - thought this would do openGL updates - lame}

UNTIL KeyDown(cCode);

If(cCode=49) Then FlyState := 0; {Input Keycodes - STD 1, 2 & 3 on primary}

If(cCode=50) Then FlyState := 1;

If(cCode=51) Then FlyState := 2;

UNTIL KeyDown(bCode) | MouseDown( xM, yM );

END; {of exitState = 1}

END; {of Main}

Run (TEST);

Link to comment

Firstly Michael Klaers you make my weekend so much better!

How strange though! Are you saying all these objects needed was a nudge to actually update?

Apart from this mega update now thanks to MK's input it's looking kinda fun/cool.

Progress:

I've made a few changes with the flys, they now stop at a lower dead, which is kind of nice.

I'm going to keep playing with this over the next two days. If you have feedback / concepts that you think might be fun to try list them and I'll either have a look at implementing them and/or try out your code!

;) J

Link to comment

Continuing progress on my personal challenge series.

I've played with several elements over the last few hours, and with a 14 hours plan ride ahead I'm looking forwards to getting into the depths of a few new ideas.

Progress:

New Set - Much more to look at and actualish scaled.

Played with actual backdrops now that OpenGL is behaving.

Can set record fields for PIO fields

Lighting seems to work also, shadowing issues when enabled.

Challenges:

Soft goods not updating with RedrawAll. If you run this and let the curtain open counter go up (9 key) the curtain won't open. If you terminate the script with esc it will adapt to the width as required. I don't know why, it does have a force update button in the Object Info palette, not sure if this is triggered differently to an Redraw or UpdateObject.

Lighting (see a post just before this entitled _Light On). Wanted to try fading lights at rates. Figured I could just SetRField data to the _Brightness or _Light On fields, seems not.

If anyone has any links to scripts that involve moving the perspective of the viewer (much like the walkthrough tool) I'd love to hear about them. Even if you have a command in mind that might be relevant. It's somewhere down the line but I want to get into it soon.

I'll keep you posted.

J ;)

Link to comment

Michael,

Totally in the same boat now. Welcome to the party! ;)

If I hard break your script at anytime the door opens to the current listed amount.

I also tried making your whole script a separate procedure with long wait times in between, but it only renders the very last frame same as if it limits out at 180 degrees.

I'm just wondering if when the script is finalised if there's a bigger refresh that we're not aware of that forces all plugin objects to refresh all values. Super weird though, I'm seeing the same thing with all plugin objects: Lighting Device Colour Changes, Doors, Windows, Soft Goods, Human Figure, Plant Tool.

I'll have a think on the plane.

J

Link to comment

I just tried creating a new workspace with a menu command that runs the script to open the door by 1.

Then I used another script to DoMenuTextByName. My thinking was that the script imbedded in the menu command would finish running and allow the door to redraw.

No luck. It doesn't redraw until the primary script stops running.

Any other ideas?

mk

Link to comment

Did you know that you can run a vectorscript inside of an apple script?

I don't think I recommend it.

But by running a vectorscript that opens the door +1 and running it 180 times with an apple script you can (very poorly) animate a door opening.

This works with the file posted above:

tell application "Vectorworks 2015"


repeat with x from 1 to 180

	run VectorScript "Procedure TEST;

{--- Define Variables ---}

VAR


TheDoorInQuestion	: HANDLE;
HowOpenIsTheDoor	: INTEGER;
OpenIsTheDoorTEXT: DYNARRAY[] of CHAR;




BEGIN

TheDoorInQuestion := GetObject('Door1');				{Get named object Door1}

OpenIsTheDoorTEXT := GetRField(TheDoorInQuestion, 'Door', 'OpenAngle');   {Get the Open Angle}

HowOpenIsTheDoor := Str2Num(OpenIsTheDoorTEXT);							{Convert the angle to integer}


HowOpenIsTheDoor := HowOpenIsTheDoor - 1;							{Index up one}

OpenIsTheDoorTEXT := Num2Str(0,HowOpenIsTheDoor);					{Convert Integer to String}

Message(OpenIsTheDoorTEXT,'   ',HowOpenIsTheDoor);					{Message makes it look like it's working...}

SetRField(TheDoorInQuestion, 'Door', 'OpenAngle',OpenIsTheDoorTEXT);		{The value instantly goes to 0. Sad.}




ResetObject(TheDoorInQuestion);


RedrawAll;																{None of this seems to matter}
HMoveBackward(TheDoorInQuestion,FALSE);
HMoveForward(TheDoorInQuestion,FALSE);


END;


RUN(TEST);"

end repeat
end tell

Link to comment

Cute.

Not practical but cute for sure. Haha.

I feel like Pat Stanford's gonna come in here and bust open some like like SetPref(12348,False) and it'll change the game.

Triggering the script itself multiple times seems illogical, there just has to be a refresh that we just don't know about. A forced refresh designed for plugin objects.

I tried running the Refresh Instruments command via a DoMenuTextByName to no avail, thought we could get tricky and use something that also forces a refresh in data.

Arghh.

J

Link to comment

Sorry Gentlemen, I don't have any magic wand for this one.

PIOs are not created or reset during the running of a script. I have fought this several times and never won.

When I was fighting it, I wanted to insert a PIO and convert it to a group. I could never get a handle to the object to work with because the object was not created until the script finished running and handed back all of the objects to VW to draw.

I don't know how AnimationWorks does its magic. I think it might have to do with the fact that each frame is basically being written to disk individually.

Maybe Julian will give us at least a hint.

Regards,

Pat

Link to comment

@Michaelk (1) - Same-ish struggles, seemed relevant. Haha. Let me know if you stopover in Dubai, I'm here for ~ two weeks.

@Pat Stanford - How dull! Do you think it's some sort of 'can't have two scripts running at the same time' thing and that a PIO needs something that the script is using?

@Michaelk (2) - Maybe another cheeky DoByMenuTextNameThing? I don't know if that works for custom entries though. And if my above reply to Pat does become true, where an element of the scripting run process is the same for a PIO then it might be to no avail. :(

Surely people have gotten around this; I'm looking at you Matt Panzer, Joshua Benghiat, Robert Anderson, Petri Sakkinen, and all the other smart cookies who play with the boundaries of PIOs.

J

Link to comment
  • Vectorworks, Inc Employee

Hey guys,

As much as I'd like to have the answer, I'm afraid Pat's right. PIOs do not regenerate until the currently running script has completed. There might be some possibilities, but they'd be pretty involved using custom PIOs that repeatedly reset one another.

I do wonder if Python could better make this happen. I would definitely look into it first. Unfortunately, I'm not the sharpest cookie in the pantry when it comes to Python.

Link to comment

Scripts always run sequentially, no matter what. Python may, in theory, get around this, so you can give it a try, but the PIO script may need to be in Python as well. VS basically saves all the ResetObject calls in a script for the end, and runs them in order. SDK modules can run in the background, so that would probably be the ultimate solution.

I suppose in theory you could have a script re-run itself with DoMenuTextByName, controlling the iterations by writing to the repository (see the Utilities section). Could be a can of worms.

If you are looking for an automated but not necessarily elegant solution, you could write an additional script that stores the curtain configurations into classes that your animation script can then toggle.

-Josh

Link to comment

Thanks for the provocative responses guys.

I'll find some time and have a crack at Python goodness over the next few days.

Still seeking an example/direction/ideas for triggering the Export > Image File command. If there's a Vectorscript command for it I don't think I've found it yet in the function listing, otherwise I'll be investigating a DoByMenu and attempting to figure the required settings post dialog box.

I'll keep you posted brains trust.

J

PS. I enjoy looking in the pantry and finding Cans of Worms and Dull Cookies, they're my favourite brain snacks.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...