Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: Ankerite on 2017-11-13, 17:36:09

Title: How do I get rid of HdCache.hdc to make rebusfarm happy?
Post by: Ankerite on 2017-11-13, 17:36:09
Sorry, but how do you delete asset which don't exist?
Title: Re: How do I get rid of HdCache.hdc to make rebusfarm happy?
Post by: PROH on 2017-11-13, 18:04:00
Hi. Had the same problem with the hdc-file. It's coming from an old version of Corona, so either this is an old file, or your maxstart file contain it (in my case it was the latter).

The only way I've found to get rid of it, is to switch the renderer to something else (i.e. Scan line), clean the assets, save the file, reopen the file and switch the renderer back to Corona. The render settings will of course change back to default, so write them down before doing this.

Hope it helps
Title: Re: How do I get rid of HdCache.hdc to make rebusfarm happy?
Post by: Ankerite on 2017-11-14, 05:13:30
Hi. Had the same problem with the hdc-file. It's coming from an old version of Corona, so either this is an old file, or your maxstart file contain it (in my case it was the latter).

The only way I've found to get rid of it, is to switch the renderer to something else (i.e. Scan line), clean the assets, save the file, reopen the file and switch the renderer back to Corona. The render settings will of course change back to default, so write them down before doing this.

Hope it helps

Worked like a charm, thank you :)
Title: Re: How do I get rid of HdCache.hdc to make rebusfarm happy?
Post by: SHORT CUTS on 2017-11-14, 10:53:24
You dont need to switch the renderer, just pretend that you want to use "load from file" instead of "calculate from scratch" so you gain access to the filename field and delete whatever is in there, afterwards switch back to calculate from scratch.
Title: Re: How do I get rid of HdCache.hdc to make rebusfarm happy?
Post by: PROH on 2017-11-14, 11:01:39
Yes! I simply forgot that. Much easier :) Thanks.
Title: Re: How do I get rid of HdCache.hdc to make rebusfarm happy?
Post by: Ondra on 2017-11-20, 13:04:45
contacted rebus about this
Title: Re: How do I get rid of HdCache.hdc to make rebusfarm happy?
Post by: 3dwannab on 2018-03-11, 20:33:26
I have the same problem only I found this still exists in the AssetMetadata of the max file which is not removed/handled by Corona.

See excerpt from the metadata which is not listed in Max Asset Tracking showing filename:"HdCache.uhd"
Code: [Select]
(AssetMetadata_StructDef assetId:"{CD94B2BE-D5E2-4430-A30A-DEC169117561}" filename:"HdCache.uhd" type:#animation resolvedFilename:"")

To me, it looks like the filename: portion is not getting updated whereas resolvedFilename: is fine and gets updated when you update the file in the render dialog.

For the guys/girls above your problem can be solved easily by running this line in the listener which will remove it from the Asset Tracking (Not the metadata, it will still exist there).
It clears the path for the uhd path.
Code: [Select]
renderers.current.gi_uhdCache_file = ""
Ondra, shall I post this on the bugtracker?



For those that want to check run this (change the path between the quotes and point to your .max file) and search for type:#animation.
Code: [Select]
getMAXFileAssetMetadata "C:\Assets\Models\Maxstart.max"
Title: Re: How do I get rid of HdCache.hdc to make rebusfarm happy?
Post by: maru on 2018-03-13, 12:00:27
A few solutions are listed here:
https://forum.corona-renderer.com/index.php?topic=18089.0
Title: Re: How do I get rid of HdCache.hdc to make rebusfarm happy?
Post by: 3dwannab on 2018-03-13, 12:08:59
I was thinking of mass editing directories so I wrote a script which should remove that array. But setMaxFileAssetMetadata isin't working like I thought it should.

I've asked why here:
http://www.scriptspot.com/forums/3ds-max/general-scripting/using-setmaxfileassetmetadata-but-not-sticking

Here's the code I posted asking the Q (maybe Deadclown may be of help or other scripters or Corona Team)
PLEASE, DO NOT USE, IF SO. TEST FILES ONLY
Code: [Select]
-- Maxfile to get metadata
theMaxFile = @"C:\\Users\\username\\Documents\\3dsMax\\scenes\\Maxstart - Copy.max"
 
-- Get the metadata
oldMetaArray = getMAXFileAssetMetadata theMaxFile
 
-- Format print the old metadata
for i in oldMetaArray do (format "\nOLD METADATA: %" i)
 
-- Search for an array where there's not string matching "type:#animation resolvedFilename" and collect
NewmetaArray = for i in oldMetaArray where not matchpattern (i as string) pattern:"*type:#animation resolvedFilename*" collect i
 
-- Set theMaxFile with the NewmetaArray
setMaxFileAssetMetadata theMaxFile NewmetaArray
 
-- Check the theMaxFile metadata. Opps! Still the same.
for i in oldMetaArray do (format "\nNEW METADATA, STILL THE SAME: %" i)
Title: Working MXS code to remove .hdc file
Post by: 3dwannab on 2018-05-09, 20:25:32
I've managed to get that working. Here's the code to remove that asset completely from the metadata and ATSOps in the time it takes to save the file. Comments in the code.

No reopening is necessary.

Code: [Select]
/* Script to remove the *.hdc file from corona renderer whether missing or not.
Written by 3dwannab
v1.0 - 09/05/20018
*/
-- clearlistener()
if classof renderers.current == CoronaRenderer then (
-- Clear from render settings
renderers.current.gi_uhdCache_file = ""
--update asset tracking
ATSOps.refresh()
-- Get current maxfile
current_filename = (maxFilePath + maxFilename)
-- Create empty array
fileassets = #()
-- Retrieves all fileassets from current_filename var
fileassets = getMAXFileAssetMetadata current_filename
-- Search in above array where there's a string matching "*filename:\"*.hdc\" type:#animation resolvedFilename:\"*\"*" and collect it
ReleaseReference_Id = (for i in fileassets where matchpattern (i as string) pattern:"*filename:\"*.hdc\" type:#animation resolvedFilename:\"*\"*" collect i.assetId)[1]
-- ReleaseReference_Filename = (for i in fileassets where matchpattern (i as string) pattern:"*filename:\"*.hdc\" type:#animation resolvedFilename:\"*.hdc\"*" collect i.FileName)[1]
-- Releases the reference found in ReleaseReference_Id array
try(AssetManager.ReleaseReference ReleaseReference_Id)catch(print "No cache file found...")
-- Needed to update file only if ReleaseReference_Id not undefined
if ReleaseReference_Id != undefined then (
savemaxfile current_filename
-- Garbage collection
gc light:true
)
)