How to export asset path for assets inside an object

Tue 29. Jul 2014, 13:50

Hey guys, i have multiple object under Flow, and lots of assets that are used in multiple objects.
My hierarchy looks like this :
Flow
- Level1
- Level2


I would like to export all assets that are used in Level1.
I tried something like this
<Group Query="SELECT * FROM Assets WHERE IsDescendantOf($Level1)" />
But it doesnt work, im assuming it is because the assets are not under Level1, but referenced in it.
Also, i tried to just export all existing assets for testing, and i cant get the FilePath of my assets
By doing a Query in my code i can get the name and the technicalName of my assets, but the FilePath is missing in my Asset class that get generated.
my export file looks like this

<Package Name="Level1" Filename="Level1.xml" Type="XML" Version="0">
<Filters>
<Export>ClassTypes</Export>
<Export>TemplateTypes</Export>
<Export>AllObjects</Export>
</Filters>
<Types>
<Using Package="DefaultTypes" />
<Using Package="DefaultTemplates" />
</Types>
<Objects>
<Group Query="SELECT * FROM $Level1TRANSFORM UniqueReferences(Attachments)" />
<Group Query="SELECT * FROM Assets" />
<Group Query="SELECT * FROM Flow WHERE IsDescendantOf($Level1)" />
<Group Query="SELECT * FROM $Level1WHERE ObjectType = DialogueFragment TRANSFORM UniqueReferences(Speaker)" />
</Objects>
</Package>

if anyone can help with my issues that would be helpful. thanks
denisb
 
Posts: 3
Joined: Wed 16. Jul 2014, 14:39

Re: How to export asset path for assets inside an object

Tue 29. Jul 2014, 15:46

So far the best i could do was export all assets using :
<Group Query="SELECT * FROM Assets" />

And have :
<Package Name="CustomTypes">
<Types>
<Class Type="Asset" Name="Asset" Id="0xFFA5">
<Member Id="Name" />
<Member Id="TechnicalName" />
<Member Id="Description" />
<Member Id="MimeType" />
<Member Id="AssetType" />
<Member Id="Data" />
<Member Id="Color" />
<Member Id="AssetFilename" />
<Member Id="FilePath" />
<Member Id="AbsoluteFilePath" />
<Member Id="OriginalSource" />
</Class>
</Types>
</Package>

And this inside of my Level1 package.
<Using Package="CustomTypes" />
<Using Package="DefaultTypes" />


Which export the data in my Level1.xml but when i try to use it in code like this
Access.Query query = new Query();
query.Prototypes().With(ItemType.Class, Asset.ClassId);
var allAssets = query.Execute().Result;
foreach(var asset in allAssets)
{
if (fragment.Ref.ObjectId == id)
{
var newAsset = new Asset(asset.Ref);
}
}
My newAsset have the data for some of the variables, but the new variables that i added in my CustomType are not populated properly, they are all null.
denisb
 
Posts: 3
Joined: Wed 16. Jul 2014, 14:39

Re: How to export asset path for assets inside an object

Thu 7. Aug 2014, 15:36

So I was able to export the FilePath of my assets, but again I am exporting all assets, not just the one contained in my project.
My project hierarchy looks like this :

Flow
- Case_001
- Case_002
- Dialogue1
- Action1
- Feature1
- Slot

And action1 and dialogue1 both have different template that include a feature with a slot and a stripes in it.

If I use
<Group Query="SELECT * FROM $Case_002 TRANSFORM UniqueReferences(Attachments)" />
<Group Query="SELECT * FROM Flow WHERE IsDescendantOf($Case_002)" />
it will only export reference to assets that are inside Case_002, but not the asset itself.

But if I add
<Group Query="SELECT * FROM Assets" />
then it will also export all Assets, and then I can use my reference from earlier to find my asset FilePath value.
The problem is that it is exporting all Assets, even if they are not included in Case_002.
So i probably need something like
<Group Query="SELECT * FROM Assets WHERE IsDescendantOf(allFragmentInCase_002)" />
denisb
 
Posts: 3
Joined: Wed 16. Jul 2014, 14:39

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 25 guests

Who We Are
Contact Us
Social Links