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 - Esteban Tovagliari

Pages: [1] 2
The problem is that you cannot assume that the list of selected nodes is sorted in any specific order.

An alternative could be creating the blend nodes and set their positions relative to the input color mask nodes.


Substance DesignerSubstance Designer - Scripting - Re: Color Mask
 on: June 07, 2021, 09:50:01 am 

Baking is not exposed in Designer's Python API.
As an alternative, I think you might be able to do what you want using the Substance Automation Toolkit.



The Python documentation we ship with Designer are the reference docs.
There are some examples, mostly UI related, in the online docs here:
Inside the application install folder, in resources/python you can find some samples and the PythonAPI unit tests could be useful also.
You can also find some Designer plugins in github and other sites that you can check.



You can use QtForPython's QFileDialog class to open a file chooser.
After that, you can use the returned filename to create a resource or any other thing you need.



It is not currently possible to update a resource file path using the Python API. It is a limitation of the API.
I don't have any suggestions for possible alternatives. Maybe using symbolic links at the OS level could work?



I can reproduce the issue. It is a bug. We opened a ticket in our bug database to keep track of it.

Unfortunately, I cannot offer you any alternative to set the editor type from Python at the moment.



Make sure that you call graph.compute() before trying to get some node output property value.
If the result of the node is not computed, the result of getPropertyValue() is None.

There is currently a limitation in graph.compute(). It will only compute the nodes that are connected directly or indirectly to output nodes. If the node you are interested in is not needed to compute the graph outputs it will not be computed.

You can create a temporary output node and connect the node you want to compute to it as a workaround.



It is not possible to delete resources, graphs or folders from Python at the moment.
This functionality has not been exposed into the Python API.



Currently it is not possible to specify filenames for outputs.

You can find the code for exportSDGraphOutputs in in the API folder.
It is short and easy to follow. You can copy it and modify it to do what you need.



Textures cannot be set for node properties. They are always computed from the graph and read only.
You could create a resource for each input that you need, create a new node and connect it and then compute the graph,
but there is a better way to do what you are trying to do.

Use input nodes in your graph for inputs. Export an sbsar for your graph and then you can use sbsrender to inject the bitmaps into the inputs and render the outputs of your graph.

You can make a script that calls sbsrender using Python's subprocess module and automate the process for many inputs.

Also there is another problem in your script. SD API is in general not thread safe. You cannot use it from threads.



I can confirm that we set a min size in the application's stylesheet and that is why you cannot override it.
We will see if we can fix this in a future release.

Another alternative could be assigning a new stylesheet to your UI elements.



I can reproduce it here. I am not sure what the issue is. We would need to look into it.
I tried using QToolButton instead of QPushButton and the min and max sizes are respected.
Could it be an alternative for your use case?



You can use Python's virtualenv to create virtual environments in your plugin's directory and modify sys.path in your plugin initialization code to add the virtualenv directory with the dependencies you want to use to Python's path. After that you can import the installed modules. That works in Maya, Nuke and other apps too.

Installing or updating Python modules in Designer's install directory is not recommended.
A future update could delete the modules you installed or be installed in another directory and your modules would not be available.



I think that in your long running code, you can call in the main thread from time to time
QCoreApplication.processEvents() and that should work ok. Personally, I usually call it in a loop 5 times or so
and that is usually enough to get some responsiveness. Also, make sure to call it frequently.

If you are doing most of the work in another thread, you can check the method here to perform actions on the main thread:


Substance DesignerSubstance Designer - Scripting - Re: How to import pyd file
 on: October 21, 2020, 05:50:26 pm 

DLL loading is not disabled in Designer. In fact it is used for Qt for Python and it works for other common modules like NumPy or PIL.

The DLL load failed error comes from Python itself and it is not very helpful. It usually means that either the DLL with the compiled python module or any DLL dependency of the compiled module failed to load or couldn't be found.
This error can be difficult to debug. You can try using Process Explorer to see exactly where the problem is.
Maybe there is an incompatibility between a DLL used in Designer and in the cryptography module.
That would explain why you can load it inside Python but not in Designer.

We don't ship the cryptography module with Designer. Did you install it yourself using pip or a similar tool?
It is not recommended to do this, as the installed modules could be deleted when Designer is updated.
You can instead install cryptography in another directory and use the PYTHONPATH environment variable to point to the dir where you installed it.


Pages: [1] 2