HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Browsing repository in script  (Read 2402 times)

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
[Resolved] Browsing repository in script
« on: Mar 12, 11, 07:23:48 PM »

I have read over the repository external functions and I understand how to read/write data and read files. I would like to know if there is a way to get meta-data about the repo, such as a list of the files contained in a particular folder.  That would be very handy for an editor cell of a spec editor to allow the user to select an image or model file from the repo.

I know I could store the file names in a text file and read that or put them in a spec oracle, but either way would require the list to be maintained manually.

Of course HeroBlade has a repo browser window that pops up when adding assets to the asset library.  There isn't any we can access that functionality from scripts, is there?

Thanks.
« Last Edit: Nov 01, 12, 10:12:59 AM by HE-Cooper »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

HE-CHRISTOPHER

  • HeroEngine
  • *****
  • Posts: 424
    • View Profile
Re: Browsing repository in script
« Reply #1 on: Mar 22, 11, 07:29:03 PM »


There are a number of external functions that expose the C# parameter editing controls to being invoked by HeroScript including a file chooser dialog.

Code: [Select]
// C# Parameter Editors
//   callback to shared function ParamDialogCallback(okay as Boolean, result as String) in the specified script
external function ShowFileDialog(title as String, filter as String, startPath as String, iconView as Boolean, callback as ScriptRef)
external function ColorPickerDialog(defaultValue as String, callback as ScriptRef)
external function ValueParameterDialog(defaultValue as String, callback as ScriptRef)
external function VectorParameterDialog(defaultValue as String, callback as ScriptRef)


HeroScript does not, and probably will not have functions that allow for listing all the files in the repository or functionality due to performance concerns.

Logged
Christopher Larsen
CTO
HeroEngine

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Browsing repository in script
« Reply #2 on: Mar 22, 11, 09:20:01 PM »

Excellent. Thanks, Christopher. That ShowFileDialog will do the trick nicely.  And here I was all ready to make a custom gui and everything :).

Btw, is there any way to write out a file?  We are looking for ways to archive data for backup.

« Last Edit: Mar 22, 11, 10:09:27 PM by ScottZarnke »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Browsing repository in script
« Reply #3 on: Mar 23, 11, 03:54:33 AM »

OK, never mind on that last question.  I was only looking for repo functions that specifically had "file" in their names.  I see now from looking at how the spec oracles store their data that using SaveRepositoryData() does create a file in the "ScriptData" folder.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.