Skip navigation
Currently Being Moderated

Refresh model tree

Apr 11, 2012 5:27 AM

Tags: #3d #model_tree

When I display model tree and only then add new model using "scene.addModel" the model tree does not get refreshed to display the added nodes. I have also tried to add scene.update(); and runtime.refresh(); but without any luck.


How to force model tree to refresh?

  • Currently Being Moderated
    Apr 11, 2012 9:23 PM   in reply to OldrichDK

    You shouldn't need to do anything - scene.addModel() automatically populates the model tree provided the internal names in the resource are valid. If it's not appearing then there's something wrong with the file; calling update() or refresh() won't make any difference.

    Mark as:
  • Currently Being Moderated
    Apr 12, 2012 4:18 AM   in reply to OldrichDK

    The model tree is published from the 3D API to the Acrobat UI when the 3D annotation is initialized (i.e. when the embedded script completes running for the first time). After that, the only changes you will see occur when a selection event bubble is triggered, so in your case where the models are being loaded after the init loop finishes, you need to force a selection event to fire by temporarily picking and unpicking the newest node in the scene:



    scene.selectedNode = scene.meshes.getByIndex(scene.meshes.count-1);

    scene.selectedNode = undefined;



    That will show your new node in the tree panel in the UI. What you're seeing is 'unintentional correct behavior' in the sense that there's no way to hide an entry in the tree so tying the UI update to a specific event bubble allows someone to add a model, set it to invisible, and avoid the node declaring itself in the UI until the author wants you to see it. Yes, we should have documented what I just told you... but you're only the second person to ask and it's been like this for years


    Most people will preload eall the resources during the init loop and set the dynamic bits of the model to invisible - in which case the tree lists everything. You're seeing that effect with your "Time 0 (0)" node.

    Mark as:
  • Currently Being Moderated
    Apr 12, 2012 11:52 PM   in reply to OldrichDK

    Sorry, no - we don't have multi-threading.


    The delay when calling addModel is nostly down to unpacking the resource data from the PDF object stream, so putting all your dynamic meshes into a single U3D file and loading them with one function call is quicker than loading each one from a separate resource. You still keep the names for each mesh.


    OldrichDK wrote:


    I was considering the same, i.e. preloading everything and then just changing visibility. The problem is that loading a single u3d resource takes ca. 1-3 seconds and if you want to preload lets say 10 time steps at once, the Adobe Reader gets frozen for 30 seconds or even more. This is not nice at all. Is there any solution to that, like preloading resources in background thread, so that gui remains responsive?

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points