Quantcast
Channel: Daz Script Developer Discussion - Daz 3D Forums
Viewing all 1035 articles
Browse latest View live

Image saved as "r"

$
0
0

Hey,

does somebody know why this script saves the image in my temp dir with the name "r" instead of "mytest.png"? cool

 


    (function(){
    	var renderManager = App.getRenderMgr();
     
    	var renderOptions = renderManager.getRenderOptions();
		renderOptions.RenderImgTarget = renderOptions.DirectToFile;
		renderOptions.renderImgFilename = "mytest.png";
		renderOptions.applyChanges();
		renderManager.doRender()
    })();

 


DAZ Scripting and ES6

$
0
0

Hey DazTeam,

is it possible to update DAZ scripting to a more up to date JavaScript Version like ES6 or higher?

I`m missing a lot of ES6+ features like arrow functions, the spread operator, template strings or classes.

nodeInstance Targets not null for deleted nodes

$
0
0

In answer to a forum query I was trying to write a simple script to select orphaned instances, so as a test I created a couple of spheres, instanced one of them, then deleted the instanced node (which meant that the instance no longer drew). However, the script didn't select the orphan and when I addd a line to print the label of getTarget() it still returned sphere, and getObject still gave a non-null return too. is that correct? It certainly seemed unexpected.

// Find orphaned instances
// (c) Richard Haseltine, March 2018

// Get al the nodes in the scene
var nodes = Scene.getNodeList();

// Go through them looking for instances
for ( var n = 0 ; n < nodes.length ; n++ ) {
	// skip to the next node if this is a non-instance nodes
	if ( ! nodes[ n ].inherits( "DzInstanceNode" ) ) {
		continue;
	}
	// check to see if the instance lacks a target
	if ( nodes[ n ].getTarget() == null ) {
		// select it if it does
		nodes[ n ].select( true );
	}
}

It does work if I save the scene and reload.

Cursor Position

$
0
0

Edit* I see that this is only for 4.11 and above, so is there another way to get the cursor. 

 

In the Point reference page, there is an example for returning the cursors global position: 

var pntCursor = (new Point).cursorPos();

 

When I run this however I get the following error: 

Script Error: Line 17

TypeError: Result of expression '(new Point).cursorPos' [undefined] is not a function.
Stack Trace: ()@:17

Any Ideas? 

I'm running DS 4.10 32bit

 

Error: cannot access member ... of deleted QObject. Need help, please!

$
0
0

Hi,

First of all, I'm not familiar with js and QT neither.

I'm trying to create a simple script that displays a GUI on which I could choose any owned product I want, to batch export them. Nothing difficult, but I have that error message that randomly appears very often : "cannot access member 'title' of deleted Qobject" ("title', or any other attribute I try to get)

I tried to minimize my code to locate the cause, but nothing to do : error is too random so it's really hard to locate.

For example : if I run my script for the first time since I launched Daz, Error probability is 100%! then I re-run the script: success probability is 100% !!! then I take a break, come back 5 minutes later (script's still running, but doing nothing), It doesn't work anymore because most of QObjects have been deleted by their own will!

So my question is : did I miss something? is that a common mistake that requires doing something specific to be fixed?

I can join my script if needed, thanks a lot for any help!

Lost of volume when changing the poses, script DzMorphDeltas

$
0
0

I made a script to import morphs, with DzMorphDeltas

//example problem, copy deltas
oNode = Scene.getPrimarySelection();
oObject = oNode.getObject();
oModifier = oObject.findModifier( "FBMPearFigure" )
oMorphDeltas = oModifier.getDeltas ();
oNewModifier = new DzMorph( oMorphDeltas );
oNewModifier.setLabel( "New_FBMPearFigure" );
oNewModifier.setName( "New_FBMPearFigure" );
oObject.addModifier( oNewModifier );

Make the shape correctly, Testing with "Pear Figure". the new shape "New_FBMPearFigure" it loses volume for certain poses, for example, when moving the Side-Side leg 70,120.
Import with morphloader, work fine
it will be WeightMap ?. Links, ERC? what will I be missing?

Access material properties via script?

$
0
0

Hi all,

I'm writing a ray tracer (largely based on Peter Shirley's Galileo, but with some custom code), and I'd like to be able to render my G8M characters and DAZ scenes. I can use OBJ files, even making use of the MTL, but the MTL file that's output by default represents very little of the actual information beyond diffuse color, diffuse texture, opacity, in most cases. I've exported OBJ with a character using both 3Delight and Iray source materials, and the amount and type of material information seems to be about the same in both cases. Is there a freely available current reference for scripting in DS 4.10? The wiki is incomplete and isn't exactly helpful for a newcomer.

Thank you

How to automate navigation to the "M" Products folder?

$
0
0

I'm trying to create some scripts to navigate around in my DAZ Studio's Content Library pane (like bookmarks into the Content folders). I'm mostly able to do this, except for being able to navigate to the "M" folder in the Products folder.

The closest example I found for navigating in the Products folder is this:

 

MainWindow.getPaneMgr().findPane( "DzContentLibraryPane" ).browseToProduct( "The Girl 7", "d4073ebf-4915-48dc-ad9d-802f34cad36a" );

 

But that's navigating to a specific product. I just want to navigate to the "M" folder of products.

I'm trying to adapt the code I used to navigate to a folder in a non-primary repository:

 

// example 1, for DAZ Studio format folders in 2nd repository

var oPane = MainWindow.getPaneMgr().findPane( "DzContentLibraryPane" );

var aIdPath = [ App.getAssetMgr().getStudioDirID(),

"P:/Content/Repos2",

"P:/Content/Repos2/People",

"P:/Content/Repos2/People/Genesis 8 Female",

"P:/Content/Repos2/People/Genesis 8 Female/Poses",

"P:/Content/Repos2/People/Genesis 8 Female/Poses/Godin"

];

oPane.browseToIDPath( aIdPath );

oPane.updateContainer( aIdPath );

 

// example 2, for Poser format folders in 2nd repository

var oPane = MainWindow.getPaneMgr().findPane( "DzContentLibraryPane" );

var aIdPath = [ App.getAssetMgr().getPoserDirID(),

"P:/Content/Repos2/Runtime/Libraries",

"P:/Content/Repos2/Runtime/Libraries/Hand"   // NOT Hands

];

oPane.browseToIDPath( aIdPath );

oPane.updateContainer( aIdPath );

 

However, I don't think there is an equivalent getProductsDirID method on the AssetMgr.

How can I automate DS to navigate to the "M" folder in the "Products" area of the "Content Library" tab?

Thank you much for any assistance!
--John


Uncompressing duf files

$
0
0
I am working on a script that opens a duf file, edits its content as a string, then saves it again as a new duf. 

It works... except when the source file is compressed. Is there a way to uncompress the input file?

 

//some stuff before to choose our input file
  var ifp = DzFile( ifn ); //In
  ifp.open( DzFile.ReadOnly | DzFile.Translate );
  var ofp = DzFile( ofn );  //Out
  ofp.open( DzFile.WriteOnly | DzFile.Translate | DzFile.Truncate );
  for( var ln = ifp.readLine(); !ifp.eof(); ln = ifp.readLine() ) {
  ln2=ln.replace("a","b");
  ofp.writeLine( ln2 );
  ifp.close();
  ofp.close();

 

Saving a file to disk via daz script

$
0
0

Hi,

Looking for a way to save a file to disk via daz scripting api, basically I want to write json data to disk, so I can run simulations externally. Is this possible via the scripting api?

How to put an asset into scene

$
0
0

I am learning Daz script and have read some samples from daz documentation center. But I cannot find an example for putting an asset into scene such as loading a figure into scene and the dress up a cloth?

Can anybody give me any suggestion?

Thanks~

Modify all the mofifiers of a figure using a single method.

$
0
0

Hello,

I want to write a script which allows to modify morphs on a character.

When I import a character and I open the Parameters Tab, there are a lot of modifiers.
I would like to modify these modifiers using their names.

I made some tests and I found a solution.
Here is a small program which allows to modify the "Nipples" morph.
The current program only displays the Label and the value of this modifier.

fig = Scene.getPrimarySelection();
object = fig.getObject();
numMods = object.getNumModifiers();
print(numMods);
for (i = 0 ; i < numMods ; i++)
{
  curMod = object.getModifier(i);
  if (curMod.getName() == "PBMNipples")
  {
    curProp = curMod.getProperty(0);
    print(curProp.getLabel());    
    print(curProp.getValue());         
  }
}

I made another test to modify the left breast in UP/DOWN direction.
The name of this modifier in the Parameters Tab is "pCTRLlBreastUp-Down".
The corresponding script is:

fig = Scene.getPrimarySelection();
object = fig.getObject();
numMods = object.getNumModifiers();
print(numMods);
for (i = 0 ; i < numMods ; i++)
{
  curMod = object.getModifier(i);
  if (curMod.getName() == "pCTRLlBreastUp-Down")
  {
    curProp = curMod.getProperty(0);
    print(curProp.getLabel());    
    print(curProp.getValue());         
  }
}

This script don't display anything.
The "pCTRLlBreastUp-Down" modifier don't exist by using this method.
This modifier modifies the "lPectoral" node and applies to it a rotation on the X axis.
To modify this modifier, I found this solution:

numNodes = Scene.getNumNodes();
for (i = 0; i < numNodes; i++)
{
  curNode =Scene.getNode(i);
  if (curNode.getName() == "lPectoral")
  {
      print(curNode.getLabel());
      print(curNode.getXRotControl().getValue());
  }
}

This script works fine. My problem is that I will need to modify these 2 morphs using 2 different methods.

My question is:

Is there a method to modify all the modifiers of a figure viewable in the Parameters Tab by using only one method.

I thank you very much for your replies.

 

DzInstance vs DzInstanceGroupNode

$
0
0

Hi,

I'm struggling with an issue I just really cannot find a good solution to.
I grab the WS data for DzInstances, and create a new Node by coping the DzInstance "parent" and it works like a charm, but, when the instance is an DzInstanceGroupNode inside a DzInstanceGroup populated by UltraScatter, the WS data is "offet" to the center of the parent node by the radius of the Object.


See the attached images, anyone have a good "You forgot to.." anwer to this?

The "objects ceated" are set to white shader.

 

DAZ and QT( from UI file) widgets - how to combine work?

$
0
0

QT widgets work well with signals. But how to work together with DAZ widgets  and widgets from  UI file? For example, to put the DAZ button into QT Group box or in tab widget (and so on).

var loader = new DzUiLoader();
var dialog = new DzDialog();
var dialogWgt = loader.load("C:/untitled.ui",dialog);
var groupBox=dialog.findChildOfWidget("groupBox"); // QT widget from UI file
var But=new DzPushButton(groupBox) // DAZ widget into QT widget from UI
dialog.exec();
 

This code gives an error "general\dzscript.cpp(658): Unhandled error while executing script."

What I need to do to link different widgets - DAZ and QT?

 

How do I get dsa script to run in every frame?

$
0
0

I am new to daz scripting.

Simple question.- I have DSA script that I would like to run in every frame.

What is the easiest way to do that besides clicking  F5 and going to the next frame?

-J

Thanks in advance!

 


Keypress (down and up), mouse move, and mouse locking

$
0
0

Does anyone know how to do either of these functions in Daz script:

Detecting:
Key Down
Key Up
Mouse Movement

Overriding:
Mouse Locking (into the center)


Where could I find out info like this? The documentation is VERY limited, and the most info I get is from examining other scripts on some of the sites out there.

Total Newbie Question - Running DAZ Scripts from Poser Runtime Folders?

$
0
0

I started this project because I was searching in vain for documentation for a product and couldn't find it.  Then I tripped across the Documentation folder where I dump all the read-mes and user guides.  And I had (I thought) the brilliant idea of putting a DAZ Script in the product folders to automatically load the user guides I use the most frequently.  I found a sample DAZ script that worked perfectly from the IDE.  But  when I tried to save it in the Poser props folder where the product lives, the script didn't show up.  So I created a PNG file with the same name as the script.  It still didn't show up.  It works from inside the DAZ Studio formats section, which solves the problem with native DAZ products, but not Poser products that I'm using in DAZ Studio.  Is there some trick to getting scripts to run from within runtime/libraries?  Maybe embedding a pp2 or pz2 with a call to run the script?

I'm new to DAZ scripting but not to programming.

How do I set Opacity Strength in script?

$
0
0

I have a simple plane surface with an image set-up using the "diffuse color" property. I'm using this as a semi-transparent reference for setting up poses.

I can get and manipulate translations of that node in script, now I want to set the "Opacity Strength" of that node.

 

var item = Scene.findNodeByLabel( "TORI" );// Transparancy Object Reference Item

 

How to I access and set the "Opacity Strength" of that node?

 

script window show-hide

$
0
0

Hi!

When you work with the script dialog box, the work in the DAZ is blocked until you close the script or hide the window.
When the script window is hidden (but not closed), then you can work in the DAZ. OK.
Does anyone know how to call the dialog window back  from the DAZ -  dialog.hide() =>dialog.show()  .
Buttons, keys and so on ... I know now the option with a timer only. 

Daz Animation to 3Delight RIB file(s)

$
0
0

I posted this in the Discussion forum by mistake.

I am looking for some way (either built into DAZ Studio or scripted) to output a DAZ animation into a RIB file or a sequence of RIB files.

My current workaround uses a highly modified MCasual's https://sites.google.com/site/mcasualsdazscripts5/mcjribrender script to create my animated sequences. I have "watch folders" where a batch file looks for RIB files and automatically processes them via 3Delight's standalone. I run these watch folder batch scripts on mutliple machines on my network. It works relatively well but it still requires some manual work.

The tough thing about the above workaround is that I cannot cancel the script once it has run and for long animations it takes quite a bit of time. I'd rather output just one RIB file with all of the frames contained within (which seems broken in vanilla 4.10 3delight render settings). Even if it needs to be multiple RIB files, I can live with that.

I wonder how everyone else does animated renders. Any tips appreciated!

Viewing all 1035 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>