What happened to DzPolyShape in DAZ4.5
DraagonStorm
Posts: 748
The code below use to work in DAZ3 with a selected prop the line if( oShape.inherits( "DzPolyShape" ) ) value would be true and then the rest of the code would duplicate the prop... and so forth and so on....
Now at the line if( oShape.inherits( "DzPolyShape" ) ) with the same prop, the value is no longer true... So I'm not even sure if the rest of the code will still work now.
Trying to update my scripts for DS4.5
Also What happened to:
processEvents();
beginUndo();
setBusyCursor();
clearBusyCursor();
acceptUndo(...);
var oShape = oSelected.getObject().getCurrentShape();
var oNode = new DzNode();
var pBtn = wBtnGrp.selected;
switch( pBtn )
{
case 0:
nCopy = 1;
sOldLabel = oSelected.getLabel();
sLabel = "%1(%2)".arg( sOldLabel ).arg( nCopy );
while( Scene.findNodeByLabel( sLabel ) )
{
nCopy += 1;
sLabel = "%1(%2)".arg( sOldLabel ).arg( nCopy );
}
break;
case 1:
sOldLabel = oSelected.getLabel();
sLabel = "%1(%2,%3,%4)".arg( sOldLabel ).arg( xIteration ).arg( yIteration ).arg( zIteration );
break;
case 2:
nCopy = 1;
sOldLabel = oSelected.getLabel();
sLabel = "%1(%2)".arg( sOldLabel ).arg( nCopy );
while( Scene.findNodeByLabel( sLabel ) )
{
nCopy += 1;
sLabel = "%1(%2)".arg( sOldLabel ).arg( nCopy );
}
break;
default:
nCopy = 1;
sOldLabel = oSelected.getLabel();
sLabel = "%1(%2)".arg( sOldLabel ).arg( nCopy );
while( Scene.findNodeByLabel( sLabel ) )
{
nCopy += 1;
sLabel = "%1(%2)".arg( sOldLabel ).arg( nCopy );
}
break;
}
oNode.name = sLabel;
var oObject = new DzObject();
oNode.setObject( oObject );
if( oShape.inherits( "DzPolyShape" ) )
{
var oShape2 = new DzPolyShape();
for( var i = 0; i < oShape.getNumMaterials(); i++ )
{
oShape2.addMaterial( oShape.getMaterial( i ) );
}
oShape2.setPolyMesh( oShape.getPolyMesh() );
oObject.addShape( oShape2 );
Scene.addNode( oNode );
curNode = oNode;
var xProperty;
xProperty = oSelected.getXPosControl();
var nXPos = xProperty.getValue();
var yProperty;
yProperty = oSelected.getYPosControl();
var nYPos = yProperty.getValue();
var zProperty;
zProperty = oSelected.getZPosControl();
var nZPos = zProperty.getValue();
switch( pBtn )
{
case 0:
nXPos = nXPos + ( xIteration * pXaxisMove );
nYPos = nYPos + ( xIteration * pYaxisMove );
nZPos = nZPos + ( xIteration * pZaxisMove );
break;
case 1:
nXPos = nXPos + ( ( xIteration - 1 ) * pXaxisMove );
nYPos = nYPos + ( ( yIteration - 1 ) * pYaxisMove );
nZPos = nZPos + ( ( zIteration - 1 ) * pZaxisMove );
break;
case 2:
nXPos = gRnd( xRandomTranslationMinSlider.value, xRandomTranslationMaxSlider.value );
nYPos = gRnd( yRandomTranslationMinSlider.value, yRandomTranslationMaxSlider.value );
nZPos = gRnd( zRandomTranslationMinSlider.value, zRandomTranslationMaxSlider.value );
pXrotation = gRnd( xRandomRotationMinSlider.value, xRandomRotationMaxSlider.value );
pYrotation = gRnd( yRandomRotationMinSlider.value, yRandomRotationMaxSlider.value );
pZrotation = gRnd( zRandomRotationMinSlider.value, zRandomRotationMaxSlider.value );
aAxisScale = gRnd( aScaleSlider.value, aScaleSliderMax.value );
pXaxisScale = gRnd( xScaleSlider.value, xScaleSliderMax.value );
pYaxisScale = gRnd( yScaleSlider.value, yScaleSliderMax.value );
pZaxisScale = gRnd( zScaleSlider.value, zScaleSliderMax.value );
break;
default:
nXPos = nXPos + ( xIteration * pXaxisMove );
nYPos = nYPos + ( xIteration * pYaxisMove );
nZPos = nZPos + ( xIteration * pZaxisMove );
break;
}
setTransformProperty( "XTranslate", [ nXPos ] );
setTransformProperty( "YTranslate", [ nYPos ] );
setTransformProperty( "ZTranslate", [ nZPos ] );
if( xRotationSlider.value != 0 )
setTransformProperty( "XRotate", [ pXrotation ] );
if( yRotationSlider.value != 0 )
setTransformProperty( "YRotate", [ pYrotation ] );
if( zRotationSlider.value != 0 )
setTransformProperty( "ZRotate", [ pZrotation ] );
if( xRandomRotationMinSlider.value != 0 )
setTransformProperty( "XRotate", [ pXrotation ] );
if( yRandomRotationMinSlider.value != 0 )
setTransformProperty( "YRotate", [ pYrotation ] );
if( zRandomRotationMinSlider.value != 0 )
setTransformProperty( "ZRotate", [ pZrotation ] );
if( aScaleSlider.value != 0 )
{
aAxisScale = aAxisScale / 100;
setTransformProperty( "Scale", [ aAxisScale ] );
aAxisScale = aAxisScale * 100;
}
else
{
setTransformProperty( "Scale", [ 1 ] );
}
if( xScaleSlider.value != 0 )
{
pXaxisScale = pXaxisScale / 100;
setTransformProperty( "XScale", [ pXaxisScale ] );
pXaxisScale = pXaxisScale * 100;
}
else
{
setTransformProperty( "XScale", [ 1 ] );
}
if( yScaleSlider.value != 0 )
{
pYaxisScale = pYaxisScale / 100;
setTransformProperty( "YScale", [ pYaxisScale ] );
pYaxisScale = pYaxisScale * 100;
}
else
{
setTransformProperty( "YScale", [ 1 ] );
}
if( zScaleSlider.value != 0 )
{
pZaxisScale = pZaxisScale / 100;
setTransformProperty( "ZScale", [ pZaxisScale ] );
pZaxisScale = pZaxisScale * 100;
}
else
{
setTransformProperty( "ZScale", [ 1 ] );
}
}
Comments
The geometry pipeline changed significantly ~4.0.2.55. The names of the classes involved now are DzFacetShape and DzFacetMesh.
Nothing happened to the global methods you mention, they are still there.
-Rob
Thank you, that did the trick :)
BTW:
processEvents();
beginUndo();
setBusyCursor();
clearBusyCursor();
acceptUndo(...);
These work when I run the script, but will throw an error when in debug.