Forum: Poser Python Scripting


Subject: Does someone knows how to "Add to Scene" an MT5?

Y-Phil opened this issue on Oct 30, 2023 Β· 7 posts


Y-Phil posted Mon, 30 October 2023 at 1:27 PM

Poser's Material object has a dedicated function: LoadMaterialSet(....) which effectively loads either an MT5 or an MC6 file, which fine.

But I'd like to load an MT5 without removing the existing nodes setup, and this function doesn't seem to have another parameter to control this, as any tests I did with other parameters ended up in an error message "Invalid Spec map" or something like that.

pydoc didn't let me guess any other functions, so that, maybe, there's none.

I had an other idea: create a layer to add the MT5 in, but it looks like a dead end, too.

Thanks in advance.

π’«π’½π“Žπ“


(っ◔◑◔)っ

πŸ‘Ώ Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gamng, Asus Tuf Gaming RTX 4070 OC Edition, 1 TB SSD, 6+4+8TB HD
πŸ‘Ώ Mac Mini M2, Sequoia 15.2, 16GB, 500GB SSD
πŸ‘Ώ Nas 10TB
πŸ‘Ώ Poser 13 and soon 14 β€οΈ


Bastep posted Tue, 31 October 2023 at 2:55 AM

Y-Phil posted at 1:27 PM Mon, 30 October 2023 - #2983728

Poser's Material object has a dedicated function: LoadMaterialSet(....) which effectively loads either an MT5 or an MC6 file, which fine.

But I'd like to load an MT5 without removing the existing nodes setup, and this function doesn't seem to have another parameter to control this, as any tests I did with other parameters ended up in an error message "Invalid Spec map" or something like that.

I've been working intensively with Python and the material room in the last few weeks. No, there is no such possibility. This problem is only possible with an extended LoadMaterialSet command. So an add/replace option. But that's a matter for the developers.

pydoc didn't let me guess any other functions, so that, maybe, there's none.

I had an other idea: create a layer to add the MT5 in, but it looks like a dead end, too.

Thanks in advance.

Otherwise, you only have the option of loading the nodes somewhere, which you have done, and copying them from there into the target material using a recursive node query. I tried. My brain exploded. What is an additional obstacle is the inability to identify a selected node. This ultimately forces you to make manual changes in the material room. Which I don't think is the point of it.

Greetings

PS: Excuse my bad English. I'm already an older generation. We didn't have English lessons until very late in school. He had left no lasting impression.



Y-Phil posted Tue, 31 October 2023 at 4:08 AM

The purpose of this  script was to ease the upgrade of a character's material. My setups are fairly simple: on the Cycles part, there's a root Cycles node, to which is attached a compound node

How to detect and replace the said compound node: no problems
How to copy-paste a selected node: I think I know how, using the MaterialManager
How to select a specific node: no idea, but I know how to upload a specific MT5, delete any root nodes as these specific nodes don't have such node. Then using the MaterialManager: selectall, then copy, then paste elsewhere

the problem using this steps:
- can't create a new material, and then delete it afterwards
- can create a new layer, but how to load the MT5 in that layer instead of the base layer?

One solution could be to create specific MT5 that are ready-to-load in a specific layer.

I'll check this after my job.

π’«π’½π“Žπ“


(っ◔◑◔)っ

πŸ‘Ώ Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gamng, Asus Tuf Gaming RTX 4070 OC Edition, 1 TB SSD, 6+4+8TB HD
πŸ‘Ώ Mac Mini M2, Sequoia 15.2, 16GB, 500GB SSD
πŸ‘Ώ Nas 10TB
πŸ‘Ώ Poser 13 and soon 14 β€οΈ


Bastep posted Tue, 31 October 2023 at 5:37 AM

I haven't worked with the Material NodeManager Type class yet. The β€œHIGHLY EXPERIMENTAL” comment put me off.

Bastep



Y-Phil posted Wed, 01 November 2023 at 7:55 AM

Response from the support: we'll add a python function that corresponds to "Add to Scene"... Yay 

π’«π’½π“Žπ“


(っ◔◑◔)っ

πŸ‘Ώ Win11 on i9-13900K@5GHz, 64GB, RoG Strix B760F Gamng, Asus Tuf Gaming RTX 4070 OC Edition, 1 TB SSD, 6+4+8TB HD
πŸ‘Ώ Mac Mini M2, Sequoia 15.2, 16GB, 500GB SSD
πŸ‘Ώ Nas 10TB
πŸ‘Ώ Poser 13 and soon 14 β€οΈ


Bastep posted Wed, 01 November 2023 at 2:05 PM

This is a good message



an0malaus posted Thu, 16 November 2023 at 8:30 PM

A poser file parser is probably the only option short of dev additions to the Poser Python API.
The problem with the Python API is that it has so many gaping holes.
Primarily in the form of an absence of methods for creating items in the scene.

However, creating and linking nodes IS possible, but then the parser hurdle is the problem.

Others have developed their own parsers, but they are not available separately, but bundled into products (PFE for example).

As a caveat, though, first invent a reliable method for human suspended animation, before holding your breath.
I see peripherally how much the devs currently have on their plates, and new features might be fairly far down the implementation list.

I'm not trying to be a totally negative Nancy, here, just an informed optimist (i.e. pessimist). My Poser wish list is bigger than Ben Hur and SpaceX's Booster & Starship stack! :-)




My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.