Author Topic: Retrieve The Package Resource Path from an Input  (Read 1639 times)

Is there a short-hand way to get the PKG Resource Path of a given input? I'd like to use it by default in some regression testing, if it exists (which it should, since I'd also like to validate / automate the existence and assignment of package resource icons for previewing)

I've take a stab at it, but uncovered something un-expected with Designer in the process.

I'm querying parameters belonging to compNode Implimentations whose type / name is bitmapresource.
I can use that get the path via mParamValue.getValue(). I can then optionally convert that from an internal package path to an absolute path fine.

However, that breaks in the even that a package resource icon has been assigned, via an internal resource, but the internal resource was deleted from the package in designer. It seems like pkg resource icon is cached because the preview image still shows up in Designer, and there are no dependency errors, even though the pkg resource path is still assigned to the input.

I just need to handle the event in code where sbs_doc.getObjectFromInternalPath() may return none.. but it also seems like Designer should warn me of what looks like a missing internal package resource reference.

oh, and the reason I get the exception in pysbs is because I'm using the following method to get the absolute path of the pkg resource icon:
Code: [Select]
sbs_doc.getObjectFromInternalPath(pkg_resource_path).mFileAbsPathwhich of course throws an exception because there is no resource object returned by the method.
Code: [Select]
AttributeError: 'NoneType' object has no attribute 'mFileAbsPath'
Last Edit: July 10, 2019, 06:44:45 pm