Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cherrypicker

Pages: [1]
1
Reflecting on this more, as you've stated that this is going to continue to be how animated corona proxies operate, perhaps it would be a good idea for Corona to come up with a Corona preview tool for capturing animated viewport previews. For those artists that aren't necessarily scripting savvy. Corona is marketed on it's simplicity after all. Just a thought.....

2
Indeed thanks Aram. One thing to note is that this captures the entire viewport, so differs to the usual create preview (which doesn't work with animated corona proxy), which only captures the space within safe frames which is what you typically want when doing a playblast, so some additional scripting is needed to crop down to this.

3
Amazing thanks Aram and Frood. I seem to have a working script now.  Tested dropping the sleep down all the way to 0.01 for a speedier preview, but I anticipate this scaling with scene complexity. Will test. Thanks again for the help getting this workaround working.  If a future corona update could avoid the need for a workaround though that would be good too :-)

4
Hi Aram

I've tidied up and collated the latest version of the script below.  I've removed all the rollout elements and things, so hopefully I've not missed anything.  Currently the script is waiting for 0.1s, then simulating a left click in the viewport, running a complete redraw and then capturing the next preview frame.

Thanks

fname = getFilenameFile(maxFileName)
previewFolder = (GetDir #preview) + "\\MP4 Previews\\" + fname + "\\"
if (doesDirectoryExist previewFolder == false) do (makeDir previewFolder)

function makeParam LoWord HiWord =
(
bit.or (bit.shift HiWord 16) (bit.and LoWord 0xFFFF)
)

function LeftMouseButtonClick x y =
(
   WM_LBUTTONDOWN = 0x0201
   WM_LBUTTONUP    = 0x0202      
   MK_LBUTTON = 0x0001

   stopLoop = false
   hwnd = undefined
   for w in (windows.getChildrenHWND #max) where w[4] == "ViewPanel" while stopLoop == false do
   (
      hwnd = w[1]
      stopLoop = true            
   )
   hwnd = (windows.getChildrenHWND hwnd)[1][1]
   p0 = makeParam x y

   windows.postmessage  hwnd WM_LBUTTONDOWN 0 p0
   windows.postmessage  hwnd WM_LBUTTONUP 0 p0
   format "Clicked % %!\n" x y
)

version = 001
if (viewport.getType() == #view_camera) then
(
   cam = viewport.getCamera()
   preview_name = previewFolder + fname + "_" + cam.name + "_v" + (formattedPrint version format:"03d") + ".avi"
)

else (preview_name = previewFolder + fname + ".jpg")
resWidth = renderWidth
resHeight = renderHeight
fstart = animationrange.start
fend = animationrange.end
count = fstart as integer
sliderTime = fstart
for t = fstart to fend do
(
   strNum = count as string
   if strNum.count < 4 then
   (
      str = ""
      for i=1 to (4 - strNum.count) do (str += "0")
      strNum = str + strNum
   )
   else (strNum = strNum)
   local preview_name = previewFolder + fname + "_" + strNum + ".jpg"
   local anim_bmp = bitmap resWidth resHeight filename:preview_name
   local targetTime = timeStamp() + (0.1s).ticks
   while timeStamp() < targetTime do ()
   LeftMouseButtonClick (random 200 800) (random 200 800)
   CompleteRedraw()
   dib = gw.getViewportDib()
   copy dib anim_bmp
   save anim_bmp
   close anim_bmp   
   count += 1
   sliderTime += 1
)

5
Hi Aram

Yes that's all correct.  I've tried waiting for several seconds before trying to capture the next frame but this doesn't appear to work so far, so any insight you can get from the devs would be much appreciated.  I can upload the script but it's gone through several iterations, trying several different approaches, so it's quite messy at the moment. Let me know if you think it would be helpful though.

Thanks in advance.

6
Hi Aram. Yes I'd seen the other posts about this thanks and was aware that it was due to the change to asynchronous loading with corona 7.  What I'd ideally like to know is what is telling the proxy to change back to displaying the full mesh as nothing I've tried as outlined above seems to have worked.  Something must trigger it somewhere otherwise how does it know to change at all?

7
Morning. Any further thoughts on this?  I've now also tried simulating a left mouse button click randomly in the 3ds max window to see if that simulated user interaction would work, but this also fails. Would appreciate some insight from devs, or anyone in the know, as to what interaction causes the proxy to switch between mesh and the "performance" box.  Otherwise I guess I'll just have to keep throwing ideas at the wall to see if anything sticks....

8
Hi Avi.  Thanks for the reply. I just tried your suggestion and it still resulted in a box being used for the preview unfortunately.  I had actually already tried this, as well as setting the proxy back to something other than a mesh, and then back to a mesh on each frame to see if that would kick start it, but that also didn't work.

I think that there's something going on under the hood that's telling the proxy to go into performance mode, and revert the mesh to a box to maintain viewport performance.

Under normal circumstances that would be fine, if I'm just navigating the viewport, but in this instance I'm trying to get an animation preview of the scene, so need to be able to see the mesh animation from the proxy otherwise it's worthless.

Are you able to find out what it is that's telling the proxy to switch between mesh and this performance mode to see if it can be subverted via maxscript?

Thanks in advance for the help.

9
Hi. As per the title, is there a way to force Corona Proxys to display as a mesh instead of the box that appears (which I know is to maintain viewport performance)? So that we're able to do viewport animation previews? And can this be automated with maxscript for example?  What is the mechanism that tells the proxy to stop needing to display the box and show the mesh again? Is it simply a time delay per frame?  Is it an fps requirement? Or something else?

I'm currently trying to write a tool with maxscript to automate the creation of animated viewport previews to mp4 instead of avi, and theorised that I could iterate through the timeline and save each frame as a still image and then get that image sequence converted to the mp4.  I've tried doing forceRedraw(), as well as disable and enableSceneRedraw() in tandem with a time delay hoping this would allow the proxy to revert to a mesh again before the next frame is captured. None of these things have worked so far.

So is anyone able to give some incite into this?

Thanks in advance for the help.

Pages: [1]