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

Traverse Surface Selection Sets?

$
0
0

Anybody know of a way to traverse surface selection sets or determine what sets a material is in?

I created an ugly way to do it with G3F, but I'd like something a bit more elegant.

var aTemplates = Array(
    Array("Face", "Lips", "Ears", "EyeSocket"),
    Array("Torso"),
    Array("Toenails", "Legs"),
    Array("Fingernails", "Arms"),
    Array("Teeth", "Mouth"),
    Array("Eyelashes"),
    Array("Cornea", "Pupils", "Sclera", "Irises"),
    Array("EyeMoisture")
);
function getTemplate(mat) {
	var nTemplates = aTemplates.length;
	for (var i = 0; i < nTemplates; i++) {
		if ( aTemplates[i].indexOf(mat.name) >= 0 ) {
			return "Template %1".arg(i+1);
		}
	}
	return false;
}
//...

Thanks!


Drawing in ViewPort?

$
0
0

Is there a way to draw something in Viewport. I'd like to extend the "Thirds Guide" approach. The image I render will have some margins in post-render, so I would like to see them in when composing. Ideally I'd like to be able to do rounded rectangle, oval, and anything else, but just set of vertical and horisontal guidlines would be good enough. Is there any access to such things as the "Thirds Guide" in Viewport?

 

Thanks.

newbie question : how to set the position and rotation of a character ?

How to get image file name from Environment Map (Iray Settings)

$
0
0

So, Iray is new, and I can not find documentation for Render Settings in the Documentation Center. And of course there isn't any in the DS3 version of documentation.

I need to get and set the image file name that is assigned to the Environment Map in Irays Render Settings.

How to create a new file using DzFile ?

$
0
0

hello,

 

I'm having hard time trying to create a simple .ini file

I know how to read or write an existing file but cannot achieve to create a new one...

var path_file_daz_ini = " B:\\- ALBUM -\\Page 03\\5.Obj\\p03c08_joao.ini"


function create_daz_ini(srcFilePath) {
    
    var srcFile = new DzFile(srcFilePath);
    
    print (srcFilePath)
    if (!srcFile.open(DzFile.ReadOnly)) {
        MessageBox.critical("Could not open file.", "Open File", "&OK", "");
        return;
    }
        
    srcFile.close();
    }
    
 
create_daz_ini(path_file_daz_ini)

 

thanks for your help

Genesis3 surface => UDIM tile mappings

$
0
0

For Genesis3 surfaces, will a given surface always have the same UDIM tile number (e.g. 1002) for all UVSets?   For instance, will the Torso surface always have UDIM tile 1002 for any UVSet (Victoria 7/Karen 7/etc)?   Or can UDIM tile numbers vary between UVSets for  given surface?

If the mapping isn't static, is there any way to lookup the UDIM tile number for a given surface/UVSet via the scripting interface or SDK?

Thanks

 

Bending body part via script

$
0
0

I am trying to write this bit of code, but cannot find any references to acceptable syntax. I would like to do the following:

While having Genesis 2 Female selected (or any part of her body), I would like to bend her forearm, say 16.5 units. So I need to be able to tell the script that G2F is selected, find her left forearm, get it's current z rotation and assign that to a variable.

Please help. The current documentation is incomplete, and I don't know what to do or where to find some examples.

Thanks,
Slosh

How would I remove specific points from a morph file via script?

$
0
0

I've got a Studio script creation question. I'm wondering if it's possible to create a script that can go thru a morph file and eliminate certain points from the morph from a prearranged set of points. Like say you've got a morph that you've created and all is well and good except there's an issue that causes distortion in say the eyeball area. The reason I ask is that I've got a few morphs I've created for Genesis 2 Male. I've managed to transfer them over to Genesis 3 Male. All seems to work fine except I get major distortion in the eyes and in the mouth area. I even get it on morphs that are only body shapes and nothing has been done to the head or face areas. What I've been doing is going thru the DUF file and manually editing and removing the points that correspond to those areas. And thru some morphs I made for those specific areas I know which points need to be removed. So I know the range of numbers that could be used. I just wondered if there was an easier way of editing the morph under than by hand.

Thanks,

David


How to apply a pose preset?

$
0
0

I'm new to Daz Studio scripting, but experienced with programming. Could someone please give a pointer on what library functions to use to apply a saved pose preset onto a character? Thanks!

Merge Images in Script

$
0
0

Is there any way to merge Images in Script and then save out the merged image?

Remove/Reset LIE masks and layers

$
0
0

Is there a way to remove the LIE masks/layers applied to a surface?

Get View Type in Current View Port

$
0
0

Not even sure if that's the right wording...

How would I get what is selected in the drop down for how the scene looks in the view port.. And possibly set it to something else.

 

[Solved] Add scene or assets in "Smart Content/Saved Files/Local User"?

$
0
0

Hello,

I am trying to see if there is a way to add a scene (I guess it would be similar for assets) in the "Saved Files/Local User" category of the Smart Content in DS 4.9? The scene is saved by script using App.getAssetIOMgr().doSaveWithOptions

I was trying to find a command in App.getContentMgr() but without success.

Then I told to myself it may not be in the Content Manager since these files may not be in any content library. So I looked at the "App" level to see what I could find, but I don't manage to see anything inspiring me the right way. I was looking for something like "App.getSmartContentMgr" but there is no such element. Maybe the App.getAssetIOMgr? 

Anyone having an idea on the subject?

This should be possible because if you save a new scene "the classical way" this is automatically done, so this should also be possible to do it when a scene is saved by script with doSaveWithOptions() too.

 

 

Search and select a specific Property in the Parameter-Pane

$
0
0

Hi Guys,

I'm looking for a Script-Snippet (or at least the name of the correct Class/Method, I have to use), which allows to navigate to specific Properties and/or Property-Group in the Parameter-Pane. Sometimes it's hard to change Values in the tree of hundreds of Parameters. And there are a few settings that I often use.

My Idea is now, to write a Script, which simply selects a specific Property (i.E. "Pose Controls -> Head -> Mouth -> Mouth Smile" etc.). The Script need not to change the Value, it should just locate it in the tree (or at least a Group).

I'd make a custom Dialog, place simple Buttons for "GoTo Mouth Smile Prop" and so on. Assigning this Dialog to a Keyboard-Shortcut would be very usefull.

Thx in advance,
Peter

Reverse Deformation by Script

$
0
0

Any chance anyone knows if there is an existing function for applying reverse deformations via script?  I've scoured DzMorph, DzModifier, and DzMorphDeltas, but no luck so far.  There is an "ApplyInverse" function in DzMorph, but that doesn't seem to be wrapped (or I haven't figured out how to use it) and I'm not sure that has anything to do with reverse deformations (seems more likely it is what it sounds like, the deltas inverted).


Surface Selection Script

$
0
0

Before I ask my question I would like to state that I have no idea how to make script or where to even start.

Can a script be made to select all surfaces with a particular named texture map or via material ID colour. This could be for surfaces that cannot be selected via the normal methods easily, say a light bulb in a shade, multiples of. Yes there is a reason I would like to know how or if it is even possible.

 

If it is possible would anyone like to help me achieve this.

script for DzTabWidget

$
0
0

 I've found a script  for DzTabWidget. Perhaps it is required someone.

 wDlg = new DzDialog;

wTabStack = new DzTabWidget( wDlg );

wOptionPage = new DzVGroupBox( wTabStack );

wPrefsPage = new DzVGroupBox( wTabStack );

var wDlgLayout = new DzGridLayout( wDlg );

wDlgLayout.addMultiCellWidget( wTabStack, 0, 1, 0, 0 );

var wDlgBtnsGB = new DzGroupBox( wDlg );

wDlgBtnsGB.flat = true;

var wDlgBtnsLyt = new DzGridLayout( wDlgBtnsGB );

wDlgBtnsLyt.setColStretch( 1, 1 );

wDlgLayout.addMultiCellWidget( wDlgBtnsGB,1, 1,0, 0 );

wOptionPage.flat = true;

wTabStack.addTab( wOptionPage, "1 page" );

wPrefsPage.flat = true;

wTabStack.addTab( wPrefsPage, "2 page" );

wDlg.maxWidth = wDlg.minWidth;

wDlg.maxHeight = wDlg.minHeight;

wDlg.exec()

Vertical slider

$
0
0

I don't understand how to do slider (to example enumslider) as vertical. 

Please help me with codewink Thanks

How do signals work?

$
0
0

Hello :)

Could anyone explain how a signal works? I have made an attachment and I want its material to change if Genesis does. I have worked out how to apply "duplicate" the Gen material when the attachment first loads, but now I am stuck on updating it whenever Gens material changes. I just don't understand how to setup a signal. I know my code is a bit rough at the moment but will fix it up if I can figure this last step out. I have done hours of google searches and found only 2 posts that remotely help, but all the links from them are dead. I have got the SDK docs but they don't explain how to use things, just what is available.

 

I am assuming I am meant to use "settingsChanged(DzMaterial*)" but I just don't know what to do with it.

My Code atm:


// DAZ Studio version 4.9.0.63 filetype DAZ Script

var aNodes = Scene.getSelectedNodeList();
if (aNodes.Length > 1){
	return false;
}

var sScript = 'c2.dsa';	
var oSrcNode = aNodes[0];
var oTgtNode = oSrcNode.findNodeChild ("g3Lump");
var oSrcObject = oSrcNode.getObject();
var oTgtObject = oTgtNode.getObject();
var oSrcShape = oSrcObject.getCurrentShape();
var oTgtShape = oTgtObject.getCurrentShape();
var oSrcMaterial = oSrcShape.findMaterial( "Torso" );
var oTgtMaterial = oTgtShape.findMaterial( "Torso" );
var oContext = new DzElementDuplicateContext();
 
	// Duplicate the material
	var oDupeMaterial = oSrcMaterial.doDuplicateElement( oContext );
 
	// Set the name of the duplicate to the name of the target
	oDupeMaterial.name = oTgtMaterial.name;
 
	// Set the label of the duplicate to the label of the target
	oDupeMaterial.setLabel( oTgtMaterial.getLabel() );
 
	// If the duplicate material classname and the source material classname do not match
	if( oDupeMaterial.className() != oSrcMaterial.className() ){
		// If the duplicate material inherits types we know provide a setMaterialName function
		if( oDupeMaterial.inherits( "DzShaderMaterial" ) || oDupeMaterial.inherits( "DzBrickMaterial" ) ){
			// Copy the material name
			oDupeMaterial.setMaterialName( oSrcMaterial.getMaterialName() );
		}
	}
 
	// Re-create any aliases that exist
	oContext.createAlaises();
 
	// Re-create any ERC links that exist
	oContext.createERC();
 
	// Resolve references to the source material
	oContext.doResolve();
 
	// Finalize the duplication
	oContext.doFinalize();
 
	oTgtShape.replaceMaterial( oTgtMaterial, oDupeMaterial );
var cbm = App.getCallBackMgr();
var cb = cbm.createCallBack("chMat", sScript, true);
cb.setConnection(oSrcMaterial, 'settingsChanged(DzMaterial*)');

 

Thanks to anyone who can help me :) an example of any kind would be appreciated or just an explanation would also be awesome!

Two scripting questions *solved*

$
0
0

Hello,

I've been digging into scritping and I've found two things I trip on, maybe someone knows. This is on OS X btw,

(1) DzDir seems to trip on directory names beginning with !, is this a known thing ? If I set a directory full path to a directory named !Base sets, DzDir::exists() returns false, but the same directory wirhout ! in the beginning, is OK.

(2) Can you do recursion in DZScript, or is that a no no? I tried to implement a directory weeder the same way I always do, but I get a total lockup. Is the something you need to carefully consider? 

Viewing all 1027 articles
Browse latest View live


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