Adding a Model to SceneViewer?

now im a bit confused of the last couple posts because that was the general idea from the start

World’s a confusing place… xD Idk what you do wrong there, why do you want a model inside the plugin at all? You can access data inside your own plugin ofc, but not on another one. Then the other plugin needs a class that allows you access to the data.

well i just wanted a defacto model inside the module that would act as kind of a preview for an editor I’ve created to help out with certain aspects of my project. The editor works fine in theory [haven’t set up the binary exporter and loader which is probably just a couple lines] especially combined with current platform modules but i just wanted a defacto model to visually show what is happening instead of having to open blender or run the game to see it.

At least now that i know that you can load a model from a folder within the project of a class that is seeking it, I can continue messing around until i figure it out, instead of looking for alternative means. Thank you

hmm come to think of it i’ve been having odd issues and bugs with the platform to a point that i had to delete not only the var or cache folder but the whole AppDataRoaming.jmonkeyplatformdev folder and reinstall all the modules from scratch…though i doubt this would be the issue in this case



EDIT



hmm at the risk of going back into this loop again i wasn’t able to view it however i did realize it has been loading and for some odd reason in the properties panel of the loaded netbeans platform development version when selected in scene explorer it shows 0 vertices and 0 triangles. Meaning i most have missed a very basic step somewhere. In the platform itself it shows the same model loaded in a jME project as 2704 Vertexes and 4328 triangles and everything else is the same. So i am not loading it properly somehow



SceneApplication.getApplication().addSceneListener(this);

FileObject fileObject = FileUtil.toFileObject(FileUtil.normalizeFile(this_Is_A_File));

DataObject data = DataObject.find(fileObject);

ProjectAssetManager manager = data.getLookup().lookup(ProjectAssetManager.class);

request = new SceneRequest(this, NodeUtility.createNode(new Node(“Alex.j3o”), data),manager);

SceneApplication.getApplication().requestScene(request);

You just use a new empty node as your rootNode, no wonder its empty :wink:

hmm i tried loading the model like so and tried enqueing it (jst cuz) however i get an out of memory error which is odd i shouldn’t have to increase my heap any further



File f = new File(“src/Models/Test.j3o”);

FileObject fileObject = FileUtil.toFileObject(FileUtil.normalizeFile(f));

DataObject data = DataObject.find(fileObject);

ProjectAssetManager manager = data.getLookup().lookup(ProjectAssetManager.class);

Node model = (Node) SceneApplication.getApplication().getAssetManager().loadModel(“Models/Test.j3o”);

request = new SceneRequest(this, NodeUtility.createNode(model, data), manager);





i also tried it this way but get the same error



final JmeNode jmeNode = NodeUtility.createNode(root);





request = new SceneRequest(this, jmeNode, manager);



SceneApplication.getApplication().enqueue(new Callable() {



@Override

public Object call() throws Exception {

Node model = (Node) SceneApplication.getApplication().getAssetManager().loadModel(“Models/Test.j3o”);

Node realSpatial = jmeNode.getLookup().lookup(Node.class);

realSpatial.attachChild(model);

return null;

}

});

Why do you first get the ProjectAssetManager and then use the AssetManager of the scene in the upper example? Anyway apart from that it looks good, guess the oom is some faulty data in the j3o? Is the model really large?

well the other previous models where somewhat large compared to the current one i have but this one i am using now is barely over 400kb as a blender file and is 124kb as a j3o file it loads in test cases and in the scene viewer normally. I also placed the model in the same directory as the bundles.properties and the class looking for it

In the case of the asset manager i was changing things up to see if anything would work i forgot to change it back before i posted

EDIT:

Something i did realize though is that even though i simply get an out of memory error the projectmanager has not been initiated



EDIT



I attempted to use a couple models from MonkeyZone since it was said that it could be the fault of a faulty model exportation however the project asset manager still returns null; however the dataObject and the lookup for AssetData does not… I have tried using both SpatialAssetDataObject and BinaryModelDataObject as well as using mesh.xml models and using OgreXMLDataObject which have the similar methods but Project AssetManager still null. :cry:

Where is that data? It has to be in a project where an asset manager is registered (e.g. BasicGame).

Ahh okay that is the issue i suppose. The data is in a package inside the module i did this because its meant to be used for a couple of projects and having a dedicated model which has all the animations and can be used to preview the effects and position of the particle emitters etc i thought would be useful instead of guessing the time and using blender etc to try and get the proper time and relaunching the app repeatedly. Also I’ve been asked if it could be a standalone netbeans app. Is their a way to register the AssetManager to the module project?

Hm, you’d have to extend the project node like its done in the core using a ProjectAssetsNode and the corresponding layer.xml entry.

hmm that seemed to fail for my attempts…lmao So i treated projectassetmanager like assetmanager in pre-alpha and registered j30,j3m,j3md loaders and registered a locator; however, i get an out of memory error for each of monkeyzone’s models even after adding ‘‘run.args.extra=-J-Xmx1024m’’ to project.properties. I guess I am way off in setting it up like this? I am looking through the layer.xml and the ProjectAssetNode to see if i can do something like what you suggested instead.

You can set up a ProjectAssetManager using a FileObject of a folder too, just by using that constructor.

yeah but it asks also for a Project object which i seem not to be able to acquire since its the actual module; setting the project param to null adding absolute path of the folder from the FileObject through FileUtil and removing the extra locator and load lines still gives me an out of memory error and another under neath it makred error in scene. Its kind of halting progress now lmao

EDIT:

I seem to have found something that I have not realized before when i open a Basic Game Project and only attempt to load the same models i yet again get an out of memory error but now i am confused as of to this occurrence the settings of the harness should be the exact same as my development IDE yet folowing the same procedures on the development IDE poses no such issue

i even tried adding both

[java]netbeans_default_options="-J-Xms384m -J-Xmx1024m -J-XX:PermSize=32m -J-XX:MaxPermSize=96m -J-Xverify:none"

[/java]

and

[java]netbeans_default_options="-J-client -J-Xverify:none -J-Xmx1024m -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true"[/java]



Edit

The settings of the harness arn’t on par with the IDE but w/e i tried changing the values in

app.conf

[java]default_options="–branding ${branding.token} -J-Xms24m -J-Xmx1024m "[/java]

and

run.xml

[java] <property name=“run.args.common” value=’–userdir “${test.user.dir}” -J-Dnetbeans.logger.console=true -J-ea -J-Xmx1024m -J-XX:MaxPermSize=512m’/> [/java]

also at this point i am jst attempting to use the jme core to load a simple model in the scene viewer however i keep getting an out of memory exception. Are their any other suggestions?

No idea, I suppose you can load the model? Also you can initialize a ProjectAssetManager with a FileObject only (meaning a folder).

I cannot load the mode at all in the Developmental IDE even through GDE core which you double click or right click and edit in scene explorer. This occurs even in a fresh module suite without any additional models

So I guess the model has some other problem, can you load it in some model test (plain jme3)?

Its a normal procedure all of the models work in the main IDE and are small in size I also increased the memory heap further than i think it should be in the harness anyway so far i have tried editing project.properties(Module), platform.properties(Module), app.conf(Harness) & run.xml(Harness)

EDIT:

Through help from momoko i was able to figure out the issue I was having with out of memory and it was do to the binary loader being updated at some point. Meaning the j3o files I created with my updated version of the GDE was not compaitble with the older one since the hanress has none of the updates/ however after updating and refraining from repeatedly cleaning and building =p I was able to probably load the model



But I seem to be having one final problem since now everything is loading I get a weird error when sharing animations between meshes which is one of the main points of the editor. Its odd because it works fine in a normal JME BasicGame Project but in the projectsuite it throws an nosuchmethoderror. I copied over the contents of jmonkeyplatform/dev/var → build/testuserdir to make sure everything was updated properly however I still receive this odd error java.lang.NoSuchMethodError:com.jme3.animation.AnimControl.addAnim(Lcom/jme3/animation/BoneAnimation;)V

I have had it for the past couple of days and not exactly sure why. I did try enqueuing. One strange thing i did realize is in BasicGame I use Animation.java but even though everythign is updated accordingly the module dependency instead uses the older class BoneAnimation.java