sebastian.vesenmayer Posted June 3, 2019 Share Posted June 3, 2019 (edited) Hi, is there a fast way to export a Node reference with all its subobjects (objects,meshes,materials,textures) into a single folder. Our Artist imported a fbx file in Unigine Editor and I want only the converted assets, to load it later with the c++ api on the fly at any given location in the filesystem dynamically. I know, that they are saved in the .runtime folder, but it is hard to search for every object/mesh/material/texture manually with a few hundred subobjects uglyfied. Thanks, Sebastian Edited June 3, 2019 by sebastian.vesenmayer Link to comment
morbid Posted June 4, 2019 Share Posted June 4, 2019 Hello Sebastian, There's no straightforward way to do this, but we can help you with the custom code that will parse node reference. I need to clarify two things before we start: Do you want to extract runtimes only? No assets required? How you're planning to use this extracted node with related files? As far as I understood you want to put it in the external folder (not in the data directory of your project) and then load on demand. Am I correct? Thanks. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
sebastian.vesenmayer Posted June 4, 2019 Author Share Posted June 4, 2019 Hi morbid, 1. I am not sure if I get this correctly, but the meshes/materials/textures are located in the .runtime folder when importing a fbx and place it as a node, am I right? Do I only need these files for the Node/NodeReference? Then I would say yes. 2. The files will be placed together anywhere on the hard drive and I am loading the nodes on demand. Thanks. Link to comment
morbid Posted June 4, 2019 Share Posted June 4, 2019 1. Yep, that's right. I'd like to remind you that runtime files will be unavailable in the editor. 2. Got it, thanks. We're discussing possible solutions and I have some new questions: Can you show us a sample of such node reference? What objects you're storing inside? Which SDK version is this? The general task is to export node to another project, am I right? If you want to add the same node in the project it was extracted from, GUIDs will conflict and you won't be able to load this content. May I ask you how urgent is this for you? Thanks. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
sebastian.vesenmayer Posted June 4, 2019 Author Share Posted June 4, 2019 1. I can send you a node file later when, with all the object references. 2. atm we are on 2.7.2.but are looking forward to upgrade soon. 3. Not really a project, we are using Unigine as a rendering component and start always with an empty world with only rendersettings configured. Most of the content we are generating ( loading unigine nodes/ setting custom shaders / converting our own asset files) will be delivered over c++ api to the engine. We are not using a guids table because content changes with each customer and String/path based is more readable and configurable to us. 4. We are planning to integrate Unigine Editor in the workflow for our artists to polish our graphics, because we did not use pbr rendering in our old graphics engine. We are also planning to create our own 3D editor with unigine to address our needs. I have to discuss this first with our team. Arround August I guess. Thanks Link to comment
sebastian.vesenmayer Posted June 4, 2019 Author Share Posted June 4, 2019 This is the NodeReference the Editor creates. EDDM_fbx.node Link to comment
morbid Posted June 5, 2019 Share Posted June 5, 2019 If your node has only meshes and materials you can use the following pipeline to get runtimes with paths: Parse the node and find all GUIDs Find all runtime files with getAbsolutePath method https://developer.unigine.com/en/docs/2.7.2/api/library/filesystem/class.filesystem?rlang=cpp#getAbsolutePath_cstr_String Here come some specific things. Meshes are the easiest to process. You can find the required files with getAbsolutePath, no extra actions required. Materials and Properties files can be found in 3 steps. Firstly get the material with findMaterialByGUID: https://developer.unigine.com/en/docs/2.7.2/api/library/rendering/class.materials?rlang=cpp#findMaterialByGUID_UGUID_Material Then get the exact XML file guid with getFile: https://developer.unigine.com/en/docs/2.7.2/api/library/rendering/class.material?rlang=cpp#getFileGUID_UGUID When it is done you can find an absolute path to the material with getAbsolutePath. Texture path can be found in the material file with getTexturePath method: https://developer.unigine.com/en/docs/2.8/api/library/rendering/class.material?rlang=cpp#getTexturePath_int_cstr Hope this helps. Let us know if you need further help on this task. Thanks! UPD I've accidentally wrote getTextureName instead of getTexturePath. Now I've changed the text and the link. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
sebastian.vesenmayer Posted July 2, 2019 Author Share Posted July 2, 2019 Hi, is it possible to reference the texture and meshes with a relative and not absolute path? Else we have to regex replace materials and nodes when the root folder structure changes. Thanks! Link to comment
morbid Posted July 2, 2019 Share Posted July 2, 2019 You can use paths relative to the data folder, for instance: <texture name="emission">core/textures/syncker/syncker_sphere.dds</texture> How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
sebastian.vesenmayer Posted July 2, 2019 Author Share Posted July 2, 2019 So something like: <texture name="emission"> ../textures/example.dds </texture> is not allowed? Link to comment
morbid Posted July 2, 2019 Share Posted July 2, 2019 That will work, however, it's still a path related to the data_path (data folder). I've attached a small archive with two materials that uses the same link to the texture to make it demonstrative. relative_path.7z How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
sebastian.vesenmayer Posted July 2, 2019 Author Share Posted July 2, 2019 (edited) Thanks, I know what you want to say, so everything is only relative to the data path, but never from subfolders. Is this going to happen in future versions, that I can reference from a sub folder? Edited July 2, 2019 by sebastian.vesenmayer Link to comment
morbid Posted July 3, 2019 Share Posted July 3, 2019 We're focused on our new file system based on unique IDs (guids). Paths are considered to be a legacy in the current SDK versions. So, I'm afraid we're not going to extend or modify paths support in the future. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts