Controlling A Morph Slider From A Parameter Slider - what object type is it ?
Answer Part 1: A morph is a DzModifier on a DzShape on a DzObject on a DzNode, and not a DzProperty on a DzNode. Simple ! See this post below.
Answer Part 2: That's not quite true - a morph is actually a DzMorph, which is an undocumented derivative of DzModifier. See Richards comments below, here and here. The morph name is the name property of the DzMorph itself. However, the numeric value for the morph (which is what you see/control with the morph slider) is a DzProperty (having the name "Value") on the DzMorph. To get/set the numeric value of the morph you call the getValue()/setValue() method of the DzProperty called "Value".
Can you see why I refer to all of this as Object Obfuscation ?
Answer Part 3: So to control a morph from an ordinary parameter it appears that you set up an ERC link in the usual way using the insertController() method of the DzProperty named "Value" on the DzMorph. I think
~ ~ ~ ~ ~ ORIGINAL OP STARTS HERE ~ ~ ~ ~ ~
I have a simple prop with a single node.
Creating a DzERCLink between two sliders on the Parameters tab is not (usually) a problem ( https://www.daz3d.com/forums/discussion/342486/creating-a-simple-dzerclink-between-two-new-parameters/p1 )
Controlling a slider on the Surfaces tab from a slider on the Parameters tab is not (usually) a problem either ( https://www.daz3d.com/forums/discussion/341521/creating-dependencies-between-settings-on-the-surfaces-tab-and-parameters-tab/p1 )
But I now find myself wanting to control a Morph slider from a Parameters slider, and I'd assumed that the morph slider would be just another Dzproperty.
But despite the morph showing on the Parameters tab...
...I can't seem to access it in the same way as other parameters.
E.g.. the following gives me '13 Chip MT' NOT FOUND
var aNodes = Scene.getSelectedNodeList(); ... oNode = aNodes[0]; ... if( findElementProperty( oNode, "13 Chip MT" ) ) showAlert( "'13 Chip MT' already exists" ); else showAlert( "'13 Chip MT' NOT FOUND" ); ...
As usual, it's highly likely that I'm missing something obvious/doing something stupid.
Which is why I'm asking.
P.S. findElementProperty() is a function/method/whatever-you-call-it from this sample http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/elements/post_load_material_proxy_create/start (that link doesn't seem to work, but if you copy the URL and paste it goes to the right place,and gets a 'not found' because they've changed the darn URL!)
Comments
Using this, which is basically the code from findElementProperty() , but printing each propertyname...
...I get this...
2020-02-19 15:46:04.142 DEBUG: >>>ALERT:'13 Chip MT' NOT FOUND
2020-02-19 15:46:04.142 DEBUG: XTranslate
2020-02-19 15:46:04.142 DEBUG: YTranslate
2020-02-19 15:46:04.142 DEBUG: ZTranslate
2020-02-19 15:46:04.142 DEBUG: XRotate
2020-02-19 15:46:04.142 DEBUG: YRotate
2020-02-19 15:46:04.142 DEBUG: ZRotate
2020-02-19 15:46:04.142 DEBUG: Scale
2020-02-19 15:46:04.142 DEBUG: XScale
2020-02-19 15:46:04.142 DEBUG: YScale
2020-02-19 15:46:04.142 DEBUG: ZScale
2020-02-19 15:46:04.142 DEBUG: Point At
2020-02-19 15:46:04.142 DEBUG: Disable Transform
2020-02-19 15:46:04.142 DEBUG: Geometry
2020-02-19 15:46:04.142 DEBUG: lodlevel
2020-02-19 15:46:04.142 DEBUG: SubDIALevel
2020-02-19 15:46:04.142 DEBUG: SubDRenderLevel
2020-02-19 15:46:04.142 DEBUG: SubDAlgorithmControl
2020-02-19 15:46:04.142 DEBUG: SubDEdgeInterpolateLevel
2020-02-19 15:46:04.142 DEBUG: SubDNormalSmoothing
2020-02-19 15:46:04.142 DEBUG: Visible
2020-02-19 15:46:04.142 DEBUG: Visible in Viewport
2020-02-19 15:46:04.142 DEBUG: Selectable
2020-02-19 15:46:04.142 DEBUG: Renderable
2020-02-19 15:46:04.142 DEBUG: Cast Shadows
2020-02-19 15:46:04.142 DEBUG: Render Priority
2020-02-19 15:46:04.142 DEBUG: Visible in Simulation
2020-02-19 15:46:04.142 DEBUG: Value
2020-02-19 15:46:04.142 DEBUG: Total Number Of Chips
2020-02-19 15:46:04.142 DEBUG: Vertical Tiles
2020-02-19 15:46:04.142 DEBUG: Intermediate Chip Count
2020-02-19 15:46:04.142 DEBUG: Value For Vertical Tiling
2020-02-19 15:46:04.142 DEBUG: Intermediate Chip Count Minus One
2020-02-19 15:46:04.142 DEBUG: Value For Stack Height Morph
2020-02-19 15:46:04.142 DEBUG: 3DCheapskate's 'AddMy4ParametersWith2ERC.dsa' Script - completed without crashing ! Hurrah !
No '13 Chip MT' in sight.
Looking at the object index to work out what object I should be looking at is, for me, like doing oneof those "Where's Wally" puzzle pictures.
But without knowing what Wally looks like.
One obvious-ish place to start is by searching the object index for 'morph'.
Only three - DzMorphLoader, DzMorphLoaderBatch, DzMorphSupportAssetFilter.
Can't see anything to help me there.
But would I recognize something helpful if I saw it ?
How about the sample scripts?
Two with the word 'morph' - Save Morph Asset(s) and Silent OBJ Morph Loader Import
Can't see anything to help me there either.
Ho hum.
Edit:tantalizingly, DzMorphLoader has stuff like setControlPropertyERCCustomValue() and setMorphName() which make me think that it must be here somewhere...
Hmmm... I'd guess that morphs are related to geometry more than nodes.
And I think I recall a DzShape (introduced around DS4.5/4.6?) that never got documented in the object index - I think it's used in some of the sample scripts. And I'm fairly sure I've used it before, but not in relation to morphs.
Oh gawd ! Object Obfuscation !
Okay, I've found a bit of code where I needed to look at a DzShape:
nProp is a node.
Ha !
Got it ! Via the 'getNumModifiers()' and 'getModifier(#)' methods of a DzObject
...outputs
...
2020-02-19 19:28:37.938 DEBUG: Value For Vertical Tiling
2020-02-19 19:28:37.938 DEBUG: Intermediate Chip Count Minus One
2020-02-19 19:28:37.938 DEBUG: Value For Stack Height Morph
2020-02-19 19:28:37.938 DEBUG: oPropObj=ForDSimport_98
2020-02-19 19:28:38.000 DEBUG: modifier 0name = 13 Chip MT
2020-02-19 19:28:38.016 DEBUG: oShape=shape
2020-02-19 19:28:38.016 DEBUG: 3DCheapskate's 'AddMy4ParametersWith2ERC.dsa' Script - completed without crashing ! Hurrah !
So a morph is a modifier on an object on a prop node !
As obvious as Wally in a "Where's Wally" picture - i.e. when you know the answer already, it's easy.
Next part - can I slave a morph to a normal parameter (and assuming that I can, then how doI do it?)
Morph are DzModifier derivatives (DzMorphModifier, which isn't currently linked in the docs), and belong to the geometry as you say. You need to use the findModifier( name ) or getModifier( # ) and related methods as I recall.
Grab the old DS 3 scripting docs as the outline at least is in them.
Thanks Richard. I think I just beat you to it - although I wouldn't have worked out that there was an undocumented DzMorphModifer !
Anyway, to continue with the ERC part of the query.
The ERCLink constructor requires a DzNumericProperty as the controller, and the slave has to have an insertController() method. This is the sort of thing I've currently got,slaving on DzProperty to another DzProperty:
So the question is, does a DzModifier have an insertController() method ?
Time for this software monkey to go climb the DAZ Script Object hierarchy tree...
...already found a DzNumericProperty.insertController() banana.
The morph is controlled by a slider, and that slider must be associated with a DzNumericProperty, yes ? So it should just be a case of finding that.
There's no DzNumericProperty declared in DzModifier
But next branch up the hierarchy is DzElement, which has methods such as addProperty() and findPropertyByLabel().
Adding an extra bit of chewing gum to that scrip snippet...
...indicates that my DzModifier has a single property, 'Value'. That sounds vaguely promising.
...
2020-02-19 20:11:46.930 DEBUG: Intermediate Chip Count Minus One
2020-02-19 20:11:46.930 DEBUG: Value For Stack Height Morph
2020-02-19 20:11:46.930 DEBUG: oPropObj=ForDSimport_98
2020-02-19 20:11:46.930 DEBUG: modifier 0name = 13 Chip MT
2020-02-19 20:11:46.930 DEBUG: 13 Chip MT np = 1
2020-02-19 20:11:46.930 DEBUG: 13 Chip MT property 0: Value
2020-02-19 20:11:46.930 DEBUG: oShape=shape
2020-02-19 20:11:46.930 DEBUG: ALL DONE
2020-02-19 20:11:46.930 DEBUG: 3DCheapskate's 'AddMy4ParametersWith2ERC.dsa' Script - completed without crashing ! Hurrah !
The excitement's too much for me to bear ! I'm going to stop for this evening. Probably
Try oModifier.getValueChannel(), from memory.
http://www.http.com//docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/elements/post_load_material_proxy_create/start
has www.http.com at the beginning, that's why it isn't working.
And Rob has just pointed out that it's DzMorph, not DzMorphModifier, with a link to help http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/properties/node_property_presentations/start
Thanks Richard, I can now read/set the morph value, using this code which is a slightly adjusted bit from that Node Property sample script:
Running it I get:
...
2020-02-20 18:00:24.854 DEBUG: NODE PROPERTY: ZScale
2020-02-20 18:00:24.854 DEBUG: NODE PROPERTY: Point At
2020-02-20 18:00:24.854 DEBUG: NODE PROPERTY: Disable Transform
2020-02-20 18:00:24.854 DEBUG: - MISCELLANEOUS PROPERTY: Geometry
2020-02-20 18:00:24.854 DEBUG: - MISCELLANEOUS PROPERTY: lodlevel
2020-02-20 18:00:24.854 DEBUG: - MISCELLANEOUS PROPERTY: SubDIALevel
2020-02-20 18:00:24.854 DEBUG: - MISCELLANEOUS PROPERTY: SubDRenderLevel
2020-02-20 18:00:24.854 DEBUG: - MISCELLANEOUS PROPERTY: SubDAlgorithmControl
2020-02-20 18:00:24.854 DEBUG: - MISCELLANEOUS PROPERTY: SubDEdgeInterpolateLevel
2020-02-20 18:00:24.854 DEBUG: - MISCELLANEOUS PROPERTY: SubDNormalSmoothing
2020-02-20 18:00:24.854 DEBUG: NODE PROPERTY: Visible
2020-02-20 18:00:24.854 DEBUG: NODE PROPERTY: Visible in Viewport
2020-02-20 18:00:24.854 DEBUG: NODE PROPERTY: Selectable
2020-02-20 18:00:24.854 DEBUG: NODE PROPERTY: Renderable
2020-02-20 18:00:24.854 DEBUG: NODE PROPERTY: Cast Shadows
2020-02-20 18:00:24.854 DEBUG: NODE PROPERTY: Render Priority
2020-02-20 18:00:24.854 DEBUG: NODE PROPERTY: Visible in Simulation
2020-02-20 18:00:24.854 DEBUG: - MORPH PROPERTY: Value is set to 1.0466502904891968
2020-02-20 18:00:24.864 DEBUG: - MORPH PROPERTY: Value is reset to 0.32100000977516174
2020-02-20 18:00:24.864 DEBUG: NODE PROPERTY: Total Number Of Chips
2020-02-20 18:00:24.864 DEBUG: NODE PROPERTY: Vertical Tiles
2020-02-20 18:00:24.864 DEBUG: NODE PROPERTY: Intermediate Chip Count
2020-02-20 18:00:24.864 DEBUG: NODE PROPERTY: Value For Vertical Tiling
2020-02-20 18:00:24.864 DEBUG: NODE PROPERTY: Intermediate Chip Count Minus One
2020-02-20 18:00:24.864 DEBUG: NODE PROPERTY: Value For Stack Height Morph
2020-02-20 18:00:26.129 DEBUG: >>>ALERT:Done new DzMorph bit.
2020-02-20 18:00:26.129 DEBUG: ALL DONE
2020-02-20 18:00:26.129 DEBUG: 3DCheapskate's 'AddMy4ParametersWith2ERC.dsa' Script - completed without crashing ! Hurrah !
You need the name of the morph, the owner, rather than the numeric property that controls it - oOwner.name. The property will give you the label, however, if you want to work with the proeprty in order to generalise.