Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Bradford Smith

Pages: [1] 2 3 ... 6
I'm finding that I need to hide / deprecate content in a shelf to keep it from moving forward in new assets, but I also need it around for resource update / clean / compact operations.

This would be similar to "hide in library" in Designer, but in Painter it would need to be configured independently of that particular attribute.

I think I got it. I misread the parameters.. "Parent Doc" to me sounded like the source, containing doc, not the doc to hold the instance. I interpreted the parameters opposite of their intention.

swapping the document parameters results in the expected outcome now

Code: [Select]
comp_instance.changeInstancePath(sbs_doc, new_dependency_doc, new_dependency_graph_path)

And, using this method reduced the code a bit, since it create's the new dependency for me and updates UIDs and paths. I only need to remove the old one now.

I've still been trying for a while this morning to get this to work. I'm either missing something completely, or it's trickier than I imagined.

I've tried to get the comp instance nodes, and change their paths, but it's not working as expected.

Code: [Select]
dependant_nodes = sbs_doc.getAllReferencesOnDependency(dependency) # type: list[pysbs.compnode.compnode.SBSCompNode]
for dependant in dependant_nodes:
    comp_instance = dependant.getCompImplementation() # type: pysbs.compnode.compimplementation.SBSCompInstance
    comp_instance.changeInstancePath(new_dependency_doc, sbs_doc, new_dependency_graph_path)

I know the graph exists, because I've parsed the new parent graph, and computed it's internal graph path using the API in a helper function.. that is what is being assigned to 'new_dependency_graph_path' and passed in as the 'aGraphRelPath' parameter.

Code: [Select]

But I'm still getting exceptions trying to update the path

Code: [Select]
  File "D:\Pipeline\Dev\_Colossus\Python\python27Lib\Lib\site-packages\pysbs\compnode\", line 303, in changeInstancePath
    raise SBSImpossibleActionError('Failed to change the instance path to '+aGraphRelPath)
pysbs.api_exceptions.SBSImpossibleActionError: Failed to change the instance path to pkg:///new_graph_to_assign

I'm stuck trying to replace dependencies. I'm creating permutations of template graphs, and I need to replace the dependency and update it's associated comp node instances with the correct graph path.

I first create my new dependency with
Code: [Select]
Then I update references using
Code: [Select]
sbs_doc.declareDependencyUIDChanged(dependency.mUID, new_dependency.mUID)
I can query for dependent nodes using
Code: [Select]
sbs_doc.getAllReferencesOnDependency(dependency) but I can't figure out how to update the path to the graph.

My comp node instance looks something like this:

Code: [Select]
<path v="pkg:///Old_Graph?dependency=1348955762"/>
but I need to update to something like this:
Code: [Select]
<path v="pkg:///New_Graph?dependency=1348955762"/>

I have a number of use cases in painter, where I need to set some blend modes by default for certain types of base materials. These are usually modes specific to well defined user channels. Without the ability to do so, implementations often don't get set or set properly, resulting in un-intended results or bugs

Can the user data input in designer be utilized to specify a default Painter blend mode for a given output?

Example.. on an output node in Designer, the user data could have an expression:

Substance PainterSubstance Painter - Scripting - Re: Editing layer stack
 on: April 09, 2019, 06:22:14 pm 
@adibrachid. Not at the moment no. In fact, you can't even fully query the layer's properties and values

Is it possible to query for the user channel assignment for a given channel identifier?

I'm needing to validate that a standard channel "heat" is assigned to userX.

Actual Issue:
I actually don't WANT to have to validate it however since materials and tools don't rely on hard coded user index assignments. They supply I/O by using the defined names, like "heat". But I'm still reliant on needing hard coded user index assignments because of the following two limitations that I'm aware of:
  • I'm auto disabling channels in materials, tools,  etc using the userData string parameter. Since it does NOT take into account the string identifier when it enables / disables, I'm stuck with need to hard code user channel index assignments instead of supplying a list of string literal names
  • The export presets also don't work with generically named identifiers. They always expect "heat" to be in a certain user channel

I can't seem to find a method for doing that personally.

Technically speaking, I'm not sure if Alg considers the Export Preset a "resource"
If you look at the results of the entire resource query using a wildcard, you'll notice there are no export presets present.

Code: [Select]
var allResources = alg.resources.findResources("allegorithmic", '*')

I'm needing to get information on the exported texture resolution, per texture set (since each texture set has it's own output size property). That however, doesn't seem to be a property of the maps object returned by the engine via onExportFinished(), and I don't see any other way to query that info.

The current texture set isn't a guarantee, since the exported size may be different.

Is it possible to get that info from the API currently?

Is there any information on making the AlgDialog modal? I need to pause the script execution and prompt and wait for user feedback to branch the logic. The
Code: [Select]
modality: Qt.ApplicationModal doesn't seem to be working as expected

I'm finding that for complex plugins, I'm often doing the following to debug scope and async issues...

I configure plugins with both a debugMode and stackTrace which print various values and function calls to the console for debugging. I'd love to be able to configure verbosity levels and set additional colors in the output console. I could subclass the logger now, and add my own levels that rely on some global value, but I can't seem to set the color of the particular line or substring in the console output.. or can I?

Ideally, I'd want to colorize things differently: signal emissions, method calls, etc

Eventually I'd like to autofix / modify what I can...

but for now, I'd simply like to select the offending layer. Is there a way I can update the currently selected layer? This is simply to make the layer easier to find for the user, so they can manually fix the issue.

Is there a way I can query for the number of times that a resource is referenced by the project? Certain resources are meant to have only 1 instance in the layer stack, and I need to check the number of times the resource is instanced in the stack.


I'm currently logging multiple project issues, and would like to update the current layer selection based on it's path / uid in order to better the user toward the issue. Is that possible at this time?

Substance PainterSubstance Painter - Scripting - Re: Export layers as .spsm
 on: September 26, 2018, 07:21:51 pm 
"a smart material file is more about recovering past work"

That's an excellent point, and one that's probably often overlooked (I know I have). That tends to be what I don't like about smart materials since all my tools originate from designer.. but there's lots of valid use cases where smart material data is quite valuable.

Best of luck!

Pages: [1] 2 3 ... 6