• Welcome to the Community Forums at HiveWire 3D! Please note that the user name you choose for our forum will be displayed to the public. Our store was closed as January 4, 2021. You can find HiveWire 3D and Lisa's Botanicals products, as well as many of our Contributing Artists, at Renderosity. This thread lists where many are now selling their products. Renderosity is generously putting products which were purchased at HiveWire 3D and are now sold at their store into customer accounts by gifting them. This is not an overnight process so please be patient, if you have already emailed them about this. If you have NOT emailed them, please see the 2nd post in this thread for instructions on what you need to do

Multiple cr2

Gadget Girl

Extraordinary
Contributing Artist
I have been investigating throwing up a message if the current figure is not Dawn, but I'm not real sure about the syntax for that. Does python just use if/else statements?
if InternalName.currentFigure [does not =] {not sure how to express that} "Dawn":
print "Whoa there partner!"

Here's how I would write that if/else statement:

Code:
if "Dawn" in InternalName.currentFigure():
    #do all the stuff
else:
    #give an error message

There are also try/except statements in python that can also be handy for catching things the code can just not do (which might not be what you have in this case). Here's an example from a script I've made that connects up nodes in the material room.

Code:
try:
        node2.ConnectToInput(rootNode.Input(j))
        print "Connected", node
except:
        print "Count not connect nodes"

Basically it try the first statement, but if it can't do it, like maybe there is no node or input, it goes and does the except statement.
 

Semicharm

Eager
Anyone know if it is possible to make a cr2 file that basically just loads several other cr2's? Kind of like a wearable preset in DS. I know it is possible to just lump all the cr2 figures together in one file, but I am looking for more of a link type arrangement, where you would just say, for example,

figureReadFile :Runtime:Another.cr2
figureReadFile :Runtime:Andanother.cr2

But I don't know the exact syntax for that, or even if it is possible.

Should be possible, as long as each figure loaded has a different ID number (the number after the ":" on "actor" parts and figure names). The ID tells Poser which figure a leftForearm actor or HairBow prop belongs to, which figure to conform to, and which figure an ERC link connects to. That's how CR2 files with multiple figures normally works. What you have here is really the same thing, just with each figure in a separate file.

That said, things like auto-conforming won't work unless the base figure is called first. If that's not what you want, then it might be better to use a script.
 

Semicharm

Eager
Here's how I would write that if/else statement:

Code:
if "Dawn" in InternalName.currentFigure():
    #do all the stuff
else:
    #give an error message
That would be:
Code:
if "Dawn" in scene.CurrentFigure().InternalName():
The problem is that InternalName() gives a generic reference, like "Figure 2". Also, using "in" would match if the substring "Dawn" is anywhere in the name. You could use:
Code:
if scene.CurrentFigure().Name().startswith("Dawn"):
Name() gives the actual name you see, like "Dawn". However, the above would still match something like "DawnSummerDress". Also, the user can change the figure name in the properties tab. It would be best to use something specific to a figure that would stay the same regardless of how many times the figure is used--like the geometry file name. You can get that with GeomFileName(), except it gives the entire path name. Without getting lost in the weeds in Mac vs PC naming issues, you can use os.path.basename() to get just "Dawn.obj".
Code:
if "Dawn.obj" == os.path.basename(scene.CurrentFigure().GeomFileName()):


One other issue I often have is that Poser tends to select the most recent figure, say a clothing item on a figure, and it's easy to forget that you still have that vs the base figure selected when using scripts like this. So, what I do is check if the current figure is conformed first.
Code:
import poser
scene = poser.Scene()
figure = scene.CurrentFigure()
if figure:
    parent = figure.ConformTarget()
   if parent:
      figure = parent
   if "Dawn.obj" == os.path.basename(figure.GeomFileName()):
    #do some stuff
Another bit of idiot proofing is to check that CurrentFigure is actually valid before using it. You can then decide what you need to do if there is no figure in the scene. Otherwise, Poser will scold you with a python error.
 

Gadget Girl

Extraordinary
Contributing Artist
The problem is that InternalName() gives a generic reference, like "Figure 2". Also, using "in" would match if the substring "Dawn" is anywhere in the name. You could use:

Name() gives the actual name you see, like "Dawn". However, the above would still match something like "DawnSummerDress". Also, the user can change the figure name in the properties tab. It would be best to use something specific to a figure that would stay the same regardless of how many times the figure is used--like the geometry file name. You can get that with GeomFileName(), except it gives the entire path name. Without getting lost in the weeds in Mac vs PC naming issues, you can use os.path.basename() to get just "Dawn.obj".

Oops, thanks for catching my mistakes. I 'pulled' the code out of a script I had written for something else, and didn't fully think it through. I like your solution of checking against the geometry file. I never thought of doing that and I could see that being useful in a lot of situations.
 

Gadget Girl

Extraordinary
Contributing Artist
Reality uses it.

:lol: At first I thought you mean reality as opposed to fantasy, then I realized you meant the program/plug in that let's you use lux renderer. I can definitely see where you would have to be very exact about which object you are working on, especially when you are acting on every item in the scene.
 

English Bob

Adventurous
But I don't know the exact syntax for that, or even if it is possible.

The keyword you're looking for is readScript - it's used in DAZ INJ/REM poses for instance. As far as I'm aware it can be placed in any of the library files, and it just means "fetch the named file and work your way through it, then resume on the next line". It's a subroutine call, for those who remember when programming languages still used those. :)

Usage:
readScript ":Runtime:filepath:File.ext"

Example (from INJ Stephanie 4.pz2):
readScript ":Runtime:libraries:!DAZ:Victoria 4: Deltas:InjDeltas.Stephanie 4All.pz2"

(I had to edit the line above to put a space between : and D which makes a smiley otherwise :D)

I know I've seen this used to call up CR2s, but I can't find an example right now.
 

3WC

Engaged
Contributing Artist
readScript is probably what I wanted to begin with, but I was also able to make everything conform or parent to the proper thing, so that worked out.
 

NG Artplay

Eager
Contributing Artist
Ghostman, that is AWESOME!! Sorry, from first page...drag and drop. Didn't know you could do that.
 

Glitterati3D

Dances with Bees
Ghostman, that is AWESOME!! Sorry, from first page...drag and drop. Didn't know you could do that.

That's how I load all conformers (and smart props). None of that select from the menu, Figure>Conform To - they conform automatically with drag and drop.
 
Top