Wed, Jan 8, 7:38 AM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2025 Jan 07 11:07 am)



Subject: help wanted with poserpython.


benwhe ( ) posted Thu, 03 April 2014 at 10:22 AM · edited Tue, 19 November 2024 at 1:28 AM

file_503273.txt

I want to load a primitive prop, then color it. sounds simple.  It seems the prop needs material.


ockham ( ) posted Thu, 03 April 2014 at 11:00 AM · edited Thu, 03 April 2014 at 11:02 AM
Online Now!

Looks like you're going off track around here:

poser.SetColor(1, 0, 0)  AttributeError: 'module' object has no attribute 'SetColor'

SetColor needs to be applied to a Shader Node, not to the overall scene. 

There are several tiresome steps to reach all the way down to a Shader Node.  I'm pretty sure you'll run through those steps if you keep pushing through the tutorial stuff, but you're not quite at that point yet!

Here's one way to reach the simplest ShaderNode.

import poser
scene=poser.Scene()
mat=scene.CurrentMaterial()
r=100
g=200
b=150
mat.SetDiffuseColor(r,g,b)
diffuseColNode = mat.ShaderTree().Node(0).Input(0)
diffuseColNode.SetColor(r,g,b)

 

Note that the material itself needs to have its Diffuse Color set, and then the Diffuse Color node needs to have its Color set.  Both are needed for some reason.  (See why I used the word Tiresome?)

 

My python page
My ShareCG freebies


PhilC ( ) posted Fri, 04 April 2014 at 2:08 AM

Would you like me to copy/paste everything from here? RDNA thread where you ask the same question?

I feel that you are being tripped up by the use of the prop that you are using to test your scripts out on. You need to use one that already has materials assigned to it, the one you are currently using does not. You have then tried to add materials by applying a material collection but because you are just picking a file at random you are getting errors.

I'm happy to help but if you want me now to monitor and answer in both threads it may become confusing.


Privacy Notice

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.