14 threads found!
Thread | Author | Replies | Views | Last Reply |
---|---|---|---|---|
JimX | 8 | 345 | ||
JimX | 11 | 333 | ||
JimX | 6 | 330 | ||
JimX | 14 | 822 | ||
JimX | 6 | 594 | ||
JimX | 2 | 249 | ||
JimX | 3 | 467 | ||
JimX | 6 | 574 | ||
JimX | 8 | 631 | ||
JimX | 2 | 287 |
2002 Jun 01 9:37 PM
|
|
JimX | 6 | 195 | ||
JimX | 14 | 81 | ||
JimX | 1 | 35 | ||
JimX | 4 | 31 |
204 comments found!
With some wonderful help from Y-Phil, the solution is now tested and working on Mac and Windows, with Poser 11, 12 and 13, and so with both Python 2 and 3.
If anyone is interested in checking it out in earlier version of Poser, I have uploaded the scripts to Free Stuff, and called it "Load Specific Map." If you do, it would be nice if you would leave a comment about your results.
Thread: Making Materials Files More Specific | Forum: Poser 12
With some wonderful help from Y-Phil, the solution is now tested and working on Mac and Windows, with Poser 11, 12 and 13, and so with both Python 2 and 3.
If anyone is interested in checking it out in earlier version of Poser, I have uploaded the scripts to Free Stuff, and called it "Load Specific Map." If you do, it would be nice if you would leave a comment about your results.
Thread: Making Materials Files More Specific | Forum: Poser 12
Y-Phil, that would be great!
Yes, I do have 3Dream's Egypt hair. I like it very much. If we both have it, then it might make a good starting point for testing.
Let's establish a contact outside of the forum, so we can communicate details without bothering everyone else.
- JimX
Thread: Making Materials Files More Specific | Forum: Poser 12
You all gave me a lot to think about. I've been playing for 3 weeks now. I've tried 4 or 5 approaches. I got some to work, but they were rather clunky. Some of them did not work at all.
Then one day while browsing through the Poser official documentation, looking for some info on how the Shader Nodes hung together, I ran across a note that said that there was a way to call a Python script from a .pz2 file. Since an .mc6 file has a similar structure, I tried it there, and it worked!
So now I have written a script and stashed away in my primary Runtime, and I can hack an .mc6 file to call it. It then changes the Transparency map without changing the Texture map-- or vice versa, depending on what I put in the hacked .mc6 file. The neat thing is that the hacked file appears in the Poser library, just like all the regular material files. And it behaves the same way, too-- if you click the double arrows, or double click on the file, it applies the Texture or the Transparency (but not both). So it feels very much like standard Poser.
It turns out that the hacked .mc6 file can be very small-- only about 15 lines, most of which are just curly brackets. It would be quite possible to construct the files in a text editor. However, my keyboard skills consist mostly of creating typos, so I wrote some other Python scripts to build the hacked files. They work as close as I could make them to working like clicking the + button at the bottom of the library window. I stored them so that they show up in the Scripts > MaterialMods menu.
I've got it all working on Poser 12 on my Mac. If there is the kind of interest that Nerd mentioned, it might be interesting to see if the scripts work on Windows, and maybe some other versions of Poser (Poser 12 uses Python 3, while I believe earlier versions of Poser used Python 2; so there may be some issues with that.)
Thread: How to change an Image_Source path | Forum: Poser Python Scripting
Progress!
I got to wondering whether we were looking in the right place for the problem. The observation that the .mt5 hack only worked when the Preview material was selected gave me a clue. I had put the Python calls in the .mc6 files within each material section. I changed the .mt6 files so that all the Python calls for all the materials were in the Preview material section, and I eliminated all the other material sections.
It worked!
Problem solved. And (at least in the end), it wasn't a Python problem.
Thread: How to change an Image_Source path | Forum: Poser Python Scripting
Actually, I've got a lot of print statements in the code, for debugging purposes. Here are the results from one run:
Old path: /Users/jim/Library/Mobile Documents/com~apple~CloudDocs/Documents/Docs/Tech/Poser/Vic 4/Runtime/textures/KozHair/PonyTailHair/KptTailTXblack.jpg
New path: /Users/jim/Library/Mobile Documents/com~apple~CloudDocs/Documents/Docs/Tech/Poser/Vic 4/runtime/textures/KozHair/PonyTailHair/KptTailTXblond.jpg
ext name: PoserSurface int name: PoserSurface type: poser
ext name: Color_Texture int name: Image_Map type: image_map
Pre Path: /Users/jim/Library/Mobile Documents/com~apple~CloudDocs/Documents/Docs/Tech/Poser/Vic 4/Runtime/textures/KozHair/PonyTailHair/KptTailTXblack.jpg
Aft path: /KptTailTXblond.jpg
ext name: Transparency_Map int name: Image_Map_3 type: image_map
Pre Path: /Users/jim/Library/Mobile Documents/com~apple~CloudDocs/Documents/Docs/Tech/Poser/Vic 4/Runtime/textures/KozHair/PonyTailHair/KptTailTR.jpg
Aft path: /Users/jim/Library/Mobile Documents/com~apple~CloudDocs/Documents/Docs/Tech/Poser/Vic 4/Runtime/textures/KozHair/PonyTailHair/KptTailTR.jpg
(You may have to go to Full Screen for those long lines to make much sense)
The first line ("Old path:....") is what I am looking to change. It is in a local string property called oldFullPath.
The second line (" New path:....") is the value that I am trying to insert into the Image_Source data. It is in a local string property called newFullPath.
The third and fourth (and seventh) lines are just to make sure I am going where I was intending, as I looped through the Shader Nodes.
The fifth line is just print(inp.Value) ). It shows what was in the Image_Source before I did anything. One important thing is that it matches oldFullPath.
Then I executed:
The sixth line is the result of:
after having executed the inp.SetString(newFullPath) statement. This is one of those cases where Poser (or Python) also stripped off all of the leading folders.
The eighth and ninth lines are the Before & After for the next node I found. Since the Before path was not the same as the path I was looking for (oldFullPath), the Image_Source data was not changed. This is exactly what I intended.
By the way, I checked in Poser's Material Room after having run the script. The Image_Source data in the Shader Node that referenced the texture map that I was trying to change was still what it had been before executing the script. So even thought the inp.Value() seemed to have changed while running the script, the change did not stick.
If you have any ideas for where to go next, they would be most appreciated.
- JimX
Thread: How to change an Image_Source path | Forum: Poser Python Scripting
Thanks Y-Phil. Your caution about file path separators is important. I have been using os.path.join() to make sure that the separators are correct.
I had been using inp.SetString(".....") to set the value, as the documentation that I have does not mention any inp.SetValue. I had been looking for something like that. However, when I tried the SetValue() method, I got the error:
Traceback (most recent call last):
File "/Users/jim/Library/Mobile Documents/com~apple~CloudDocs/Documents/Docs/Tech/Poser/Vic 4/Runtime/python/InTest.py", line 59, in <module>
inp.SetValue(newFullPath)
AttributeError: 'poser.ShaderNodeInputType' object has no attribute 'SetValue'
So apparently, SetValue() doesn't exist on my version of Poser Python, which is in Poser 12 running on a Mac.
My problem with SetString() is that I get inconsistent results. Sometimes I even reboot and run the script again, and it comes out differently. There are two inconsistencies:
1. Sometimes the new string that is set into the Image_Source is the correct complete string. Sometimes it is just the file name, with all of the leading folders stripped off.
2. Sometimes the Image_Source data is updated. But more frequently the data is not actually updated at all-- so I do not effect any change.
------------
The context may be contributing to the confusion. I created a Python folder in my main runtime (not the one and the same folder as the app). I put this script in that folder. I then call the script from a specially-created shell .mt5 or .mc6 file. When I double-click on that materials file in the Poser library panel, it loads and the script is called.
What I am trying to do is to change the texture map without changing the transparency map. Or, alternatively, to change the transparency map without changing the texture map.
I have actually gotten this to execute correctly with an .mt5 file. So I have my hopes up that I may be getting close. But the script only if I have the Preview material selected (or, if I am in the Pose room, I respond to Poser's dialog box by saying 'Apply to Preview Material'). If I have the actual material to be changed selected, it does not change the Image_Source data. Frustrating, but at least I have detected a pattern there.
I have not yet gotten it to work at all from a similarly constructed shell .mc6 file.
----------
Any more ideas?
Thread: Accessing Poser Files Directly | Forum: Poser Python Scripting
I downloaded the three finder scripts. In the process, I found that they are available right here in the Renderosity Free Stuff.
I can't use the scripts directly, as they depend on Windows-only executables, and I'm on a Mac. But there are some good ideas in the code that might give me some inspiration.
Thread: Accessing Poser Files Directly | Forum: Poser Python Scripting
OK. I'll try that search.
Actually, what I want to do is to REPLACE all the Transparency Nodes, but none of the Texture Nodes. And vice-versa.
Actually, I found a reference in the online Poser documentation that says you can call a script out of a pz2 file. The mt5 and mc6 files have a similar structure, and I tried it with them. It worked. This gives my another set of things to try.
So I've got a couple of avenues to go down. Options are always good.
Many thanks.
Thread: Accessing Poser Files Directly | Forum: Poser Python Scripting
I'm trying to apply Texture Maps without applying Transparency Maps, and/or apply Transparency Maps without applying Texture Maps. Using Poser 11 on a Mac.
Those scripts sound interesting. I'd like to look into them.
I created an account on ShareCG. But I can't find those three scripts.
Thread: Accessing Poser Files Directly | Forum: Poser Python Scripting
What I was trying to do is manipulate some things in a material (or material collection) file. So the CurrentActor() would actually be a hr2 or pp2 file.
But. you've got a good idea about getting at least a guess as where to start DialogDirChooser: same Runtime as the geomPath, but over in the Materials library.
Thread: Modifying Materials | Forum: Poser Python Scripting
That makes some sense. The nodes I had found probably had to do with some much earlier version of Poser, before shader tress were introduced.
I'll go forward based on your suggestions.
Many thanks!
Thread: Making Materials Files More Specific | Forum: Poser 12
I'm not afraid to play around with hacking the files. In the past, I've even written utilities to do the job if it is complicated. But I haven't yet found a hack that would change one node while leaving another node unchanged.
It's really that I haven't yet found out how to hack a materials file so that any given node would remain the same as it was when I double-click on the hacked materials file. If I leave out a node in the materials file, Poser deletes that node when I apply the mt5 file. If I just delete the file reference in a mt5 or mc6 file, Poser inserts "none" into the file name for the Image_File node.
What I would like is to find a way that I could make a materials file so that the texture image file would change, but the transparency image file would remain the same as it already was in memory. And vice versa: make a materials file so that the texture image file would remain the same as it already was in memory, but the transparency image file would change.
Any ideas?
Thread: Making Materials Files More Specific | Forum: Poser 12
I have tried various hacks with the mt5 and mc6 files. Every time I remove a reference to a transparency Image_Map file, when Poser loads the file it over-writes what is there with "none" (or leaves the whole node out). So it then renders the hair without any transparency map. So I haven't yet found anything like that that works.
Nerd, I've been thinking about what you said. You're probably right that some new capability is probably needed in a future version of Poser, to indicate upon loading a mt5 or mc6 file whether unmentioned nodes should be deleted or kept in their prior condition. I think this would probably have to happen at the node level, not the material level; many prop-style hair objects have only one material-- but it has texture map and transparency map, and maybe even bump map and specular map.
However, I had an idea about how to address your second consideration: indicating what parts to replace, and what parts to leave alone. In Poser 12, when a user wants to add the current settings to a Materials folder and he/she clicks on the plus sign at the bottom of the library window, a pop-up window for the New Material Set appears, as in the bottom right of the image below:
There is an option to save "Selected nodes only." If this check-box were replaced in some future version of Poser with a set of 3 radio buttons that went something like:
- All nodes
- Selected nodes, deleting omitted nodes
- Selected nodes, keeping existing information for nodes omitted from file
then that might be enough to indicate what nodes to replace, what nodes to leave alone. Something similar would have to be done for materials in a mc6 file.
If this is a pretty common request, then maybe there is a reasonable solution. I can hope, anyway.
Thread: Making Materials Files More Specific | Forum: Poser 12
Thanks FVerbaas. You have given me a number of things to think about, and to try out. That is what I was looking for.
I was active with Poser a long time ago-- back in the Poser 4 days. Then I moved, started a new business, put a couple of kids through college, and otherwise got distracted from Poser. About a month ago, I decided to make some time to get back with Poser, even if just on a hobby basis. I now have Poser 12 on my Mac, and it's a lot different from Poser 4. I am using these little projects to learn how it all hangs together.
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Thread: How to change an Image_Source path | Forum: Poser Python Scripting