About Store Forum Documentation Contact



Post Reply 
Reload resoruce.
Author Message
mizukami Offline
Member

Post: #1
Reload resoruce.
i'm makking resource managing tool on EE program.
i need reload resource function (like right-click menu on EE tree-view).

My purpose is change resource's source-file and replace entity data, each or all.
But on EE editor, only a file can changed at a time.

Which method should i use?
04-04-2016 03:49 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Reload resoruce.
Hi,

You can select multiple elements, and right-click and do Reload too.

If you want to do this programatically, then I will add this feature for next release to the Editor Network Interface.
04-06-2016 01:40 AM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #3
RE: Reload resoruce.
i see. Thank you.

Even if only a file (to reload/replace), it cannot programatically at this EE version?
04-06-2016 02:51 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Reload resoruce.
Hi,

There are some methods in the Editor Interface:

Code:
Bool getImage(C UID &elm_id,   Image &image); // get image of 'elm_id' ELM_IMAGE element in the project, false on fail
      Bool setImage(C UID &elm_id, C Image &image); // set image of 'elm_id' ELM_IMAGE element in the project, false on fail

      // code
      Bool getCode(C UID &elm_id,   Str &code); // get source code of 'elm_id' ELM_CODE element in the project, false on fail
      Bool setCode(C UID &elm_id, C Str &code); // set source code of 'elm_id' ELM_CODE element in the project, false on fail

      // file
      Bool getFile(C UID &elm_id, File &data); // get data of 'elm_id' ELM_FILE ELM_SOUND ELM_VIDEO elements in the project, 'data' must be already opened for writing as the method will write  to it, false on fail
      Bool setFile(C UID &elm_id, File &data); // set data of 'elm_id' ELM_FILE ELM_SOUND ELM_VIDEO elements in the project, 'data' must be already opened for reading as the method will read from it, false on fail

      // material
      Bool    curMaterial        (C UID &elm_id                                                                 ); // open   material editor     of 'elm_id' ELM_MTRL                element in the project, if 'UIDZero' is passed then editor will close the material editor, false on fail
      Bool    getMaterial        (C UID &elm_id,   Material &material                                           ); // get    material parameters of 'elm_id' ELM_MTRL ELM_WATER_MTRL element in the project, false on fail
      Bool    setMaterial        (C UID &elm_id, C Material &material, Bool reload_textures, Bool adjust_params ); // set    material parameters of 'elm_id' ELM_MTRL ELM_WATER_MTRL element in the project, false on fail, 'reload_textures'=if reload the textures that were changed during this update (if this is set to false, then texture files names will get updated, however the texture images will remain the same), 'adjust_params'=if automatically adjust some parameters based on detected texture change (for example default specular value is 0, however if a specular map was added to the material in this change, then specular intensity value should be set to value >0 so the specular effect is visible, in this case 'adjust_params'=will automatically adjust specular intensity to 1 if a specular map was added and the intensity was 0. 'adjust_params' may adjust some other parameters as well)
      Bool reloadMaterialTextures(C UID &elm_id, bool base, bool reflection, bool detail, bool macro, bool light); // reload material textures   of 'elm_id' ELM_MTRL ELM_WATER_MTRL element in the project, false on fail

      // mesh
      Bool getMesh(C UID &elm_id,   Mesh &mesh, Matrix *matrix=null); // get mesh of 'elm_id' ELM_OBJ ELM_MESH elements in the project, false on fail, 'matrix'=matrix by which the mesh is going to be transformed by the editor
      Bool setMesh(C UID &elm_id, C Mesh &mesh                     ); // set mesh of 'elm_id' ELM_OBJ ELM_MESH elements in the project, false on fail

      // animation
      Bool getAnimation(C UID &elm_id,   Animation &anim); // get animation of 'elm_id' ELM_ANIM element in the project, false on fail
      Bool setAnimation(C UID &elm_id, C Animation &anim); // set animation of 'elm_id' ELM_ANIM element in the project, false on fail

      // object
      Bool    getObject(C UID &elm_id, ObjData &obj, Bool include_removed_params=false); // get    object data of 'elm_id' ELM_OBJ ELM_OBJ_CLASS elements in the project, 'include_removed_params'=if include object parameters that were removed, false on fail
      Bool modifyObject(C UID &elm_id, C Memp<ObjChange> &changes                     ); // modify object data of 'elm_id' ELM_OBJ ELM_OBJ_CLASS elements in the project according to specified list of 'changes', false on fail

If you mean ELM_FILE, then you can use getFile, setFile.
04-07-2016 01:07 AM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #5
RE: Reload resoruce.
Please let me confirm.
If original resource file replaced new one and do EE program (like below).

getImage( &uid, &image );
setImage( &uid, &image );

It functioned as reload(replace) the resource file new?
04-07-2016 03:51 AM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #6
RE: Reload resoruce.
Code:
// material
      Bool    curMaterial        (C UID &elm_id                                                                 ); // open   material editor     of 'elm_id' ELM_MTRL                element in the project, if 'UIDZero' is passed then editor will close the material editor, false on fail
      Bool    getMaterial        (C UID &elm_id,   Material &material                                           ); // get    material parameters of 'elm_id' ELM_MTRL ELM_WATER_MTRL element in the project, false on fail
      Bool    setMaterial        (C UID &elm_id, C Material &material, Bool reload_textures, Bool adjust_params ); // set    material parameters of 'elm_id' ELM_MTRL ELM_WATER_MTRL element in the project, false on fail, ...
These method is not shown at my (older) EE version.
Which version can use it? (However, we cannot update EE immediately.)

And, it can handle all material type? (ELM_MTRL, ELM_WATER_MTRL, ELM_PHYS_MTRL)

Code:
// object
      Bool modifyObject(C UID &elm_id, C Memp<ObjChange> &changes                     ); // modify object data of 'elm_id' ELM_OBJ ELM_OBJ_CLASS elements in the project according to specified list of 'changes', false on fail
If the purpose is only reload resource, Should i give "null" at "changes" parameter?
(This post was last modified: 04-07-2016 07:57 AM by mizukami.)
04-07-2016 07:55 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Reload resoruce.
Hi,

No these methods do not reload elements from file, they modify elements according to specified parameters.

Quote:Which version can use it? (However, we cannot update EE immediately.)
I always recommend using the latest version, which you can download from:
http://www.esenthel.com/?id=store&item=1
http://www.esenthel.com/?id=store&item=4
http://www.esenthel.com/?id=store&item=5
https://github.com/Esenthel/EsenthelEngine/tree/master

Quote:And, it can handle all material type? (ELM_MTRL, ELM_WATER_MTRL, ELM_PHYS_MTRL)
Please read the comments on the methods, they specify which material types are supported in these functions.

Quote:If the purpose is only reload resource, Should i give "null" at "changes" parameter?
this does not reload a resource, it changes the object according to specified list of parameters, if changes is null, then no change is made.
04-08-2016 12:16 AM
Find all posts by this user Quote this message in a reply
mizukami Offline
Member

Post: #8
RE: Reload resoruce.
(04-08-2016 12:16 AM)Esenthel Wrote:  No these methods do not reload elements from file, they modify elements according to specified parameters.

Was so? i see.
I want to know how to update resource file (that registed already) on EE.
Example, our database files(ELMS_FILE, ELMS_CODE) often updates outside of EE. So, i must recognize it for EE.
Normally, that's EE editor's function (right-click -> reload). But i want to do automatically.

(04-08-2016 12:16 AM)Esenthel Wrote:  I always recommend using the latest version, which you can download from:

Thank you.
Ofcourse we know that's better. But because of EE compatibility, our project cannot build leave alone (on new EE version). Our correction will take some of time, i think.
So, we cannot update EE immediately.

(04-08-2016 12:16 AM)Esenthel Wrote:  Please read the comments on the methods, they specify which material types are supported in these functions.

i missed. Sorry.
(This post was last modified: 04-08-2016 04:00 AM by mizukami.)
04-08-2016 03:59 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: Reload resoruce.
Hi,

When it comes to ELM_FILE and ELM_CODE, then it's no problem, you can use:
'setCode', 'setFile' methods with the current engine version.

As for reload from file, I'm working on it right now.
04-08-2016 04:13 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: Reload resoruce.
Hi,

"-added new method 'EditorInterface.reloadElms'"
This is now available in the source code on GitHub, master branch:
https://github.com/Esenthel/EsenthelEngine/tree/master

Binary update will be within a few weeks.

Hope this helps.
04-08-2016 04:26 AM
Find all posts by this user Quote this message in a reply
Post Reply