Export C++ project JS plugin

Forum for posting problems using QxEntityEditor

Export C++ project JS plugin

Postby mdw » Mon May 30, 2016 3:33 pm

Is there some overview of the possible operations on the "helper" JS object?

I would like to obtain an array of all entity_table_names.
mdw
 
Posts: 34
Joined: Mon Feb 15, 2016 2:45 pm

Re: Export C++ project JS plugin

Postby mdw » Wed Jun 01, 2016 1:34 pm

Moreover it would be cool to get the C++ project location out of the helper object to write files directly there. The path name should already be escaped ('\\' rather than '\').
mdw
 
Posts: 34
Joined: Mon Feb 15, 2016 2:45 pm

Re: Export C++ project JS plugin

Postby qxorm » Mon Jun 06, 2016 1:32 pm

Hello,

Is there some overview of the possible operations on the "helper" JS object ?

All methods provided by the helper instance is explained in the sample javascript file ./sample/custom_script.js of your QxEntityEditor package.
There is no documentation or manual of QxEntityEditor yet : but I plan to write a manual (like QxOrm manual) dedicated to QxEntityEditor.
This manual will describe all operations provided by the javascript helper instance.

I would like to obtain an array of all entity_table_names.

There is no method to get this list automatically.
But you can implement it quite easily :
1- in your javascript file, define a global variable.
2- then, on each call of the customProcess : function(params) function, just insert the entity id or entity table name in your global array.
3- then, when the *.pro file is written (which means that all entities have been processed) ==> your global array contains all entities.

Something like this :
Code: Select all
var allEntities = new Array(); // global variable

customProcess : function(params)
{
   try
   {
      allEntities.push(params[13]); // Add current entity id to the global array

      // Write the pro file ==> so all entities have been processed
      if (params[4].endsWith(".pro"))
      {
         // Here you can iterate over all entities
         for (i = 0; i < allEntities.length; i++)
         { /* ... */ }
      }
   }
   catch (err)
   { return ("[CustomScriptError] an unexpected error occurred : " + err); }
}


Note : for the next version of QxEntityEditor, I will add a method to the helper instance to get all entities id of a project.

it would be cool to get the C++ project location out of the helper object to write files directly there.

Ok I will add a method to get the output location to the helper instance for the next QxEntityEditor version.
For now, you can wait for the *.pro project file processed by the javascript (like example in my previous answer) ==> this way you can get the project location and you can write your own file there.
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: Export C++ project JS plugin

Postby qxorm » Mon Dec 12, 2016 9:38 am

Is there some overview of the possible operations on the "helper" JS object?

A documentation is now available here : https://www.qxorm.com/qxorm_en/manual_q ... #js_engine

I would like to obtain an array of all entity_table_names.

This is now possible : https://www.qxorm.com/qxorm_en/manual_q ... tions_list

it would be cool to get the C++ project location out of the helper object to write files directly there

Done : https://www.qxorm.com/qxorm_en/manual_q ... put_params
Code: Select all
log = log + "\n - output_location = " + params[16];
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am


Return to QxEntityEditor - Help

Who is online

Users browsing this forum: No registered users and 3 guests

cron