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

detecting collisions

$
0
0

Hi , i have two questions.

i'm planning to write a script that can help avoid poking through something when posing a character  (a kind of basic physics engine) 

is there a method to detect collision on and between characters ,  how the smoothing modifier knows what part of the body it should morph ?  

is there a callback (signal?)  that fires while or after you change the position of an object or a character on the scene?

if you have some advices and some examples , it will be helpful , thanks


Find figures?

$
0
0
How can loop through all nodes in a scene, and only find figures of type "Genesis8Female" ?
What function must I call that contains that particular substring?

Problems saving figure/prop asset via script

$
0
0

I am trying to save a figure/prop asset using the sample (http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/file_io/save_dsf_figure_prop_support/start) but am getting errors I cannot understand at the point that the save happens, immediately after the file save dialog has appeared and I have specified a path and file name:

general\dzscript.cpp(658): Unhandled error while executing script.
QScriptEngine::popContext() doesn't match with pushContext()

I have made only necessary changes to the sample:

  1. hard-coded the 'product name' and 'item name' in the call to setSupportPathOptions() at line 359
  2. replaced sClassName in the second argument to compile the value sFile at line 411 with a string to produce the file path I want to save to (matching the path I choose in the save dialog).
  3. removed lines 370-380 - see further explanation for this below.

The reason for wanting to get this working is that executing the figure/prop asset save through the UI causes DS to crash immediately after entering a file name in the file save dialog.  I have reported this as a bug but support have not offered any answers (yet).  Google is less informative on the second line of the above error than I expected.

I am using DS 4.10.

Regarding change 3 above, as I read these lines 370-380, they are intended to cause an options dialog to be displayed when the variable bShowOptions is set to true.  However, the function getOptions of the DzAssetIOFilter object (actually inherited from DzFileIO) produces an ugly error in this scenario.

Executing Script...

general\dzcontentmgr.cpp(4082): Empty path passed to DzContentMgr::getMappedPath()
general\dzscript.cpp(658): Unhandled error while executing script.
QScriptEngine::popContext() doesn't match with pushContext()

The documentation for this function doesn't explain what the 'empty' path (third argument to the getOptions() function, a string) should be set to - obviously a path, but a path to what?  I haven't been able to guess a value that prevents this error appearing.

So, no problem I thought, I'm happy not to have the options dialog displayed, so I'll settle for bShowOptions set to false - by not pressing the Ctrl key, or by explicitly setting it to false in the script.  But there is still a problem, because the getOptions function is called and it appears to set all the options back to the unhelpful defaults that you start with, i.e. you lose the vendor name, product name and item name, plus also the ContentType and Category.  This is obvious from the debug statements.

Any suggestions as to how to get this to work appreciated.  Perhaps someone knows what would be a valid path as the third argument to getOptions()?  I've tried paths that exist, but none works so far.

DAZScript wrapper for QTreeView?

$
0
0

Hi there,

i'm starting scripting and found a lot of information in the scripting reference guide and the qt documentation archive for qt 4.8.6. What i'm looking for (and did not found yet) is a DazScriptWrapper for QTreeView. The DzNodeSelectionComboBox shows a tree for selection of nodes so i think it seem to possible to create a tree, but how?

Any idea, link or example is very welcome.

Bulk photo creation for an art project I'm working on

$
0
0

Hi,

I'm looking for use DAZ Studio for an art project I'm working on. I need a way to make 'passport photos' of lots of people - they dont need to be realistic. they do need to be different genders, weights and ages.

Is it possible to do the following in Daz Studio with scripting:

  • Start a new scene.
  • Add a new actor.
  • Add clothes, hair and stuff - randomly based on things I own or a list or something.
  • Change parameters - weight, height, hair color, etc.
  • Render a photo - I guess use a camera to do this?
  • Save the file (photo and scene).
  • And do this multiple times.

I'm happy to script things myself (or pay for support to help me do this) but can it be done?

Thanks for your help! If this isn't the way to go, I'll look at plan B.

Thanks so much!

Ben

 

How do I link cameras to render settings?

$
0
0

How do I set individual cameras in a scene to distinct settings:  Iray vs 3Delight, or (especially!) different render dimensions?

String to windows clipboard

$
0
0

Hi all,

Does anyone know how to pass a string from DAZ script to Windows clipboard? I have seen the DzProperty.copyToClipboard() but this is for properties or their values.

I have checked the objects in the Object Index but I haven't found something that is related to Windows Clipboard unless I have missed something in sarching....

 

Thanks in advance

"Press any key"

$
0
0

Is there a way to check if any key is pressed? There are the globals to check shift and ctrl, DzApp can check the modifiers generally and for a particular key or combo, but I don't see a method to ask if any key has been pressed (returning a string, presumably). I want to be able to stop a script with any key press, rather than having to ask for one in particular. dzApp also has the mouseEvent() signal, but there doesn't seem to be a keyboardEvent() to match


Script for add layer on

$
0
0

Hello,

I'm not a developper but I'm little familiar with php langage and I hope I could understand DAZ scripting because my request is not difficult (I believe) and it could give me great result..

I would like to modify an image on shader (ex bump image) like we can manually with Layered Image Editor. Only change one layer, don't touch to others.

So How to get the current layers properties and modified them ?

I would like to add/remove and/or replace a line :

For example replace bump2.jpg by bump3.jpg

Or add another bump layer in one image-library set

Replace that :

"image_library" : [

{

"id" : "bump",

"name" : "bump",

"map_size" : [ 1600, 1600 ],

"map_gamma" : 1,

"map" : [

{

"url" : "/url-link/bump.jpg",

"label" : "bump.jpg",

"color" : [ 0, 0, 0 ],

"transparency" : 1,

"invert" : false,

"rotation" : 0,

"xmirror" : false,

"ymirror" : false,

"xscale" : 1,

"yscale" : 1,

"xoffset" : 0,

"yoffset" : 0,

"operation" : "alpha_blend"

},

{

"url" : "/url-link/bump2.jpg",

"label" : "bump2",

"color" : [ 0, 0, 0 ],

"transparency" : 0.3,

"invert" : false,

"rotation" : 0,

"xmirror" : false,

"ymirror" : false,

"xscale" : 1,

"yscale" : 1,

"xoffset" : 0,

"yoffset" : 0,

"operation" : "alpha_blend"

}

]

},

by

"image_library" : [

{

"id" : "bump",

"name" : "bump",

"map_size" : [ 1600, 1600 ],

"map_gamma" : 1,

"map" : [

{

"url" : "/url-link/bump.jpg",

"label" : "bump.jpg",

"color" : [ 0, 0, 0 ],

"transparency" : 1,

"invert" : false,

"rotation" : 0,

"xmirror" : false,

"ymirror" : false,

"xscale" : 1,

"yscale" : 1,

"xoffset" : 0,

"yoffset" : 0,

"operation" : "alpha_blend"

},

{

"url" : "/url-link/bump3.jpg",

"label" : "bump3",

"color" : [ 0, 0, 0 ],

"transparency" : 0.3,

"invert" : false,

"rotation" : 0,

"xmirror" : false,

"ymirror" : false,

"xscale" : 1,

"yscale" : 1,

"xoffset" : 0,

"yoffset" : 0,

"operation" : "alpha_blend"

},

{

"url" : "/url-link/bump4.jpg",

"label" : "bump4",

"color" : [ 0, 0, 0 ],

"transparency" : 0.3,

"invert" : false,

"rotation" : 0,

"xmirror" : false,

"ymirror" : false,

"xscale" : 1,

"yscale" : 1,

"xoffset" : 0,

"yoffset" : 0,

"operation" : "alpha_blend"

}

]

},

 Please give me help ! :)))))

Modifying the vertices of a geometry from a binary file

$
0
0

Hello,

I write a program which animates a node in Daz Studio.

When I want to transfer this animation to Daz Studio, the speed for this transfer is very slow in script.

I just started to write a plugin which allows to accelerate this communication by using binary files and the SDK.

My script calls a plugin function which executes this update.

My problem is I do not find a way to perfectly update the vertices in the SDK.

The vertices are correctly updated but the normals stay the same by using directly a DzVertexMesh class and without using a DzGeometry class.

In script it is possible to call the "setVertex" function of a geometry, In the SDK, I did not find the method.

Why I start this thread here : because my base program is a script, because my thread in the SDK forum has no reply since one week and I think the script forum seems more reactive and because I think programming competencies are in the two forums.

Thank you by advance.

Writing a function for "Timechanging"

$
0
0

Hello,

I wrote a function which modifies the scene when the time changes in Daz Studio.

If I start the script, nothing happens.

I have to add an infinite loop after the definition of the callback to see my function working correctly.

This method works fine, but I have to kill this loop before to close The Daz Studio application. Otherwise, it stays in memory.

My question is :

Is there a way to make this function integrated in the Daz Studio global loop?

I thank you for your replies.

     Gérald

Reverse source shape from target (Transfer Utility) with script?

$
0
0

I'm currently learning simple scripting and working with the Transfer Utility: http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/transferutility_dz

I wrote a script that works almost as intended, but I want to transfer morphs from the Genesis 2 Female in a non-default pose. I could use the "Reverse source shape from target" option, however I just can't find the corresponding setter method in the API documentation. There are setter methods for almost everything else, so I found this a bit strange. Is it missing or am I just overlooking it? Maybe there is another way to achive the same effect?

Three in one: iray decal, an instance and find by type

$
0
0

Hello, I've accidentally found script ide and it gave me an idea to speed things vastly. I'm completely new about it.

I've a few questions to get me started for my project:

1- How can I create an iray decal via script?

I've searched the forums quite a bit, but couldn't come to a hit for creating an iray decal via script. By also looking at object index doesn't ring any bells for object creation.

2- How can I create an instance of an existing object via script?

I need to create instance of an existing object. Then I will manipulate it (move-scale-etc I think I can handle this part).

3- How can I confirm a type of object is e.g. Null?

I need to filter or loop by type of objects. For example, what gives me back "Null" via script when I was iterating through objects?

I want to achieve something like: if ( typeof (itemBeingIterated) == "Null" ) { ... } or something like if ( typeof(selectedItem) == "Decal" ) { ... }

 

Any help will be appreciated, thanks!

Is it possible to trigger "Bake To Studio Keyframes" from Animate via script

$
0
0

I'm trying to activate the "Bake to Studio Keyframes" from the pluggin animate 2 (and I think animate lite), via a script, and I totally fail. On animate 2, when I do it manually, I have to right click in the Animate2 Tab of theAnimate2 pane to access "Bake to Studio Keyframes".

First I tried to reach this action by script through the Pane manager, I easily grabbed the pane using : var oAnimatePane = App.getInterface().getPaneMgr().findPane("aniMate") but once I am in there, I don't find in the debugger any command which could help me getting closer to the action of baking to keyframes. I tried getOptionsMenu, but of course this does not give me an access to what I want (which is only accessible via a right click in the "Animate2" tab of the pane, and not in the menu of the pane). 

Second I had a look at the loooong list of Daz Studio Actions, but did not find anything in this list which seems to do what I want (filtered search with "time", or "key", or "bake" terms). It can be logical because it is not really a Daz Studio action since it is a pluggin action. 

This is why my question is that, knowing that I cannot access it via the menu of the pane or via the existing Daz Studio Actions (except if I missed something), do you think that this action be triggered by a script ?

Thanks if you have any opinions or tips about that!

 

Assign category to file

$
0
0

I am trying to assign a set category to a spesifc file using a script.

unfortenetly so far i have only figured out how to read the categoris.


How do I retrieve all attributes from a DzDomElement

$
0
0

I've been trying to develop a depth first XML parser that emits events on start tag, end tag, and text (SAX parser). I can recurse through the DzDomElements just fine using ::firstChild() and ::nextSibling(), but I can't find a way to retrieve a list of attributes on the node. I can pull the value of elements by name, but what I really want is to build a dictionary of name, value pairs.

I've been crawling through the documentation and dumping objects for the last couple of days, but I can't find a method that will allow me to enumerate the attributes.

Has anybody done this?

How to get all metricNames of current style?

$
0
0

In the http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/general_ui/simple_dialog/start sample i found the following: 

// Get the current style
var oStyle = App.getStyle();
 
// Get the height for buttons
var nBtnHeight = oStyle.pixelMetric( "DZ_ButtonHeight" );

In another example i found, that DZ_GeneralMargin is another valid metricName.

So, how to get the list of all metricNames of the current style or all the default names for DAZ-Styles?

 

Trying to get morphed mesh vertices values

$
0
0

Hi. I'm trying to get mesh vertices values via script, but looks like morphs aren't applied to vertices values, i.e. using script like that one http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/geometry_info/start I get same values no matter if I morph object or scale it. Object is imported .obj file, attached to Genesis 8 Female body via transfer utility, and all morphs are applied to that body (but I've tried to scale object itself - no luck).

Also  vertex values are not adequate to even bounding box (which is updating, btw):

obj= Scene.findNodeByLabel( "my_sword")
mesh= obj.getObject().getCurrentShape().getGeometry()

print(obj.getObject().getBoundingBox());
		
var X=[1000,-1000],Y=[1000,-1000],Z=[1000,-1000];
for (i= 0; i<mesh.getNumVertices(); i+= 1) {
	f= mesh.getVertex(i);
	if (f.x<X[0])X[0]= f.x;
	if (f.x>X[1])X[1]= f.x;
	if (f.y<Y[0])Y[0]= f.y;
	if (f.y>Y[1])Y[1]= f.y;
	if (f.z<Z[0])Z[0]= f.z;
	if (f.z>Z[1])Z[1]= f.z;
}
print(X,Y,Z);

My expectation was that X[1]-X[0] would be same as bbox[0][1]-bbox[0][0], because of extreme values of vertex positions. But no, bbox is correct and gives higher values than vertex positions! And it works ok with scale and morphs. I want same for vertices.

EDIT: looks like if I don't use Transfer Utility, initial values are same for bbox and extreme values of vertex coordinates. But no update on scale or morph anyway.

Multi select don't work in my script

$
0
0

Hi this is a scriptlet, from A script I am making. It is a listbox I am filling with selected nodes of the scene. It needs to be multi select, but I cant multi select in the listbox. I try to use extended here, but I also try to use Multi. Both are not working. What is the problem?

 

/*********************************************************************/
// Globals
/*********************************************************************/
var selNodes = Scene.getSelectedNodeList()		// Get the selected nodes from te scene
var nSelNodes = selNodes.length;				// The length of the selected node array


// Create and define DzListBox: 'Surfaces'
var Surfaces = new DzListBox( Dropper );
Surfaces.setGeometry( 190, 21, 171, 181 );
Surfaces.SelectionMode = Surfaces.Extended;
for( var i = 0; i < nSelNodes; i++ )
{
	if( selNodes[i].name != selNodes[i].getLabel() )
	{
		Objects.insertItem( selNodes[i].name + "/" + selNodes[i].getLabel() );
	}
	else
	{
		Objects.insertItem( selNodes[i].name );
	}
}

 

Is function.bind gone?

$
0
0

I try to connect a bound function to a signal to get my old context back. Unfortunately i get the error 'TypeError: Result of expression 'fctn.bind' [undefined] is not a function.'.

var bbb = {
	"txt": "BBB-Text",
	"p1": "BBB-P1",
	"go": function(localThis) { 
		print("Function Code (this): Text = " + this.txt + "; p1 = " + this.p1); 
		print("Function Code (bbb): Text = " + bbb.txt + "; p1 = " + bbb.p1); 
	}
}

print("*** BBB GO ***");
bbb.go();	

print("*** FCTN GO ***");
var fctn = bbb.go;
fctn();

function anotherFunction() {
	print("anotherFunction");
}

var timer = new DzTimer();
timer.timeout.connect(anotherFunction);
timer.timeout.connect(bbb.go);
timer.timeout.connect(fctn);
timer.timeout.connect(fctn.bind(bbb)); // TypeError: Result of expression 'fctn.bind' [undefined] is not a function.

print("*** TIMER START ***");
timer.singleShot = true;
timer.start(100);

// sleep... // keep script alive while timer is running 

Ok, the workaround (directly referencing the defining var) will work ... but is not what i wanted.

Viewing all 1027 articles
Browse latest View live


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