Anyway to get filename of object by script ?

I want to write a script to get the originating filename of the currently selected object in the scene.

I know how to get various details of the object, but can't find anything that contains the filename. Is there anything that I have missed ?

Many thanks.

Comments

  • Yes it does, but for some reason it's not returning any filenames. Hmm.

  • Widdershins StudioWiddershins Studio Posts: 539
    edited November 2015

    Gone off at a tangent slightly. I found some code which is suppoesed to get the filename from a selected asset in the Content Manager.

    Trouble is that again no filename is being returned. I am at a bit of a loss as to how to get the actual value of properties from objects.

     

     

     

    // Get the pane managervar oPaneMgr = MainWindow.getPaneMgr();// Find the content library panevar oPane = oPaneMgr.findPane( "DzContentLibraryPane" );// If the pane was foundif( oPane ){	// Declare working variables	var oAsset, oMeta, oInstance; 	// Get the selected assets	var aAssets = oPane.getSelectedAssets();	// Iterate over the selected assets	for( var i = 0; i < aAssets.length; i += 1 ){		// Get the 'current' asset		oAsset = aAssets[ i ];		// Get the metadata for the asset		oMeta = oAsset.getMetadata();				print (oMeta.originalFilename);	} }
    Post edited by Widdershins Studio on
  • Is that one of Rob's sample scripts? If you do use those to help with your own script please remember to credit the original. I'm not sure why it's failing - is this in 4.8 or 4.9? Does it matter which of the types of folder you are in (soemthing-Formats, Products or Categories)?

    I've moved this to the scripting sub-forum so it's more likely to be noticed by those who may help.

  • Sorry there was no name that I could see. I just took a few elements and adpated it to do what I needed.

    Thanks for moving it.

    This is 4.8 64bit

    Not sure about the folders, I'll play with it.

  • If it was one of the sample scripts, the license terms are linked at the top of the page http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/eula/start (you are right that there's no name on the samples, but as far as I am aware all or almost all are by Rob Whisenant).

Sign In or Register to comment.