How do you set the property value slider in the parameters tab
GenerationX
Posts: 56
How do you read back and set the selected or highlighted property value slider in DAZ3d Studio using C++
I want to highlight a slider and press a key to reset to zero or a value....
Post edited by GenerationX on
Comments
The Parameters pane is not [directly] accessible via the [C++] Plugin SDK. It is, in fact, part of a plugin itself; i.e. Interface Components.
So, why make a point of indicating "directly" instead of just saying "no"? Well, because it is possible to generate and execute script via plugin (if you are dead set on a plugin being involved)... and the Parameters pane is accessible via script... IF you're up for a bit of self-discovery (i.e. no published documentation) and you realize that what you discover isn't officially supported. Meaning, it may change, without warning or notification.
Below is an example of what I mean by "self-discovery"...
Of particular interest to you, in this instance, will be a function named "getNodeEditor". Iterating over the members of the return value for this function will reveal a function named "getPropertySelections". So, you may eventually end up with something like...
This is, of course, just one piece of the puzzle. I can tell you, with absolute certainty, that you can accomplish what you describe... i.e. assign a shortcut to a custom action that executes a script, that utilizes the scripting API to obtain an array of selected properties from the Parameters pane and then modifies those properties in some way. But you're going to have to learn how to fish a little, to get there... (ref. "If you give a man a fish, you feed him for a day. If you teach a man to fish, you feed him for a lifetime.").
If you are interested in continuing the discussion, being as this will be a scripting endeavor, it would be best to move this thread to the Developer Discussion forum so that those who script might also benefit.
-Rob
Thanks for the info, just need to convert to SDK plugin :down:
var oPaneMgr = MainWindow.getPaneMgr();
var oPane = oPaneMgr.findPane( "DzParametersPane" );
if( oPane ){
var oEditor = oPane.getNodeEditor();
var aProperties = oEditor.getPropertySelections( true );
for( var i = 0; i < aProperties.length; i += 1 ){
print( aProperties[ i ].getLabel() );
aProperties[ i ].setValue(1.0); //<--= Set the value here<br /> }
}
Ok this works in c++, but how do you read back the script value and get the selected node in c++?
So I take it that "The Parameters pane is not [directly] accessible via the [C++] Plugin SDK." applies to the Property Hierarchy pane as well? It's also a plugin or part of one? I could get a pointer to the "DzHierarchyPane" but not be able to read or modify Node properties (Parameter Settings), correct?
So if Scripting is the answer but most of my functionality must be in a [C++] Plugin, how would one pass data from Plugin to Script and back?
In your public DzPane class insert:
In your main .cpp
Change the “MY_PANE” to your DzPaneAction name. Use the code at the top of this page to see if your MyInput functions get listed don't forget to change "DzParametersPane" to your DzPaneAction name..
You can send the node address my changing (char In) to (DzNode* In)
I have tested this out and is works. :p
Thank you for the example! I'll give it a try.:-)
So I found this script:
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/properties/node_properties/start
Which is very cool at demonstrating how to iterate thru all the properties of a selected node. It got me thinking about an almost abandoned approach to duplicating the same thing in Qt (SDK C++). So I tried... and somewhat succeeded. Looks like I can iterate thru every property (DzProperty) as well as all the available keys associated with that property (DzPropertySettings) fairly well. Once put into an array, I can loop thru and pick out what I want to look at:
I picked out a specific property for example "Y Rotate" and looked thru the settings (DzPropertySettings) to see what I can pick up:
Current selected node is: Genesis
Property : Label : Y Rotate
Property : Hidden : no
Property : Path : /General/Transforms/Rotation
Property : UserProperty : no
Property : CanAnimate : yes
Property : Locked : no
Property : Manipulator : yes
Property : Favorite : no
Property : GlobalFavorite : no
Property : Selected : no
Property : AutoFollow : no
Property : XYZInterest : Y
Property : Clamped : no
Property : Mapable : no
Property : NeedMap : no
Property : DefaultImageGamma : 1
Property : Min : 0
Property : Max : 0
Property : Sensitivity : 0.5
Property : AsPercent : no
I tried other indexes but there are only 20. So what is missing? The actual value of the property. I have no idea how to proceed. In the script example, I added a 4th column on the output section to see if getValue() would work. It does.
As for the Qt (SDK C++) code side of it, I believe DzFloatProperty or DzNumericProperty may be involved. But I have no idea how to get from DzProperty to the Float or Numeric property. Does anyone have any ideas? Rob? Any secret squirrel handshake - don't mind that many behind the curtain... kinda hint?
Ah.. never mind... I got it.
My lack of Qt strikes again. And my C++ isn't all that good either. But... I can now read and write to any property on a selected node... With a SDK C++ plugin. No script. Now the fun starts!
Here's the missing piece:(see my prev post for the rest of this)
Hello,
So I ran the "pane explorer" script found in the above posts on the "aniMate" pane. My goal is to randomly load aniblocks on all the figures in the scene. By looking at some of the files in the animations bundles I purchased on the DAZ store, I saw that they were using the addBlock(QString) method to add an aniblock to a layer. But I first have to create a layer for a given figure before I can call that method. From the "pane explorer" dump, there are two candidate methods I suspect might do the job for me:
getAnimateTrack is the main culprit. But I don't know what the parameters are. I suspect the two strings to be the name of the figure node in the scene and the name of the aniMate layer to be created, the bool I will figure out eventually, I guess, but the last function (a return handler?) I don't know. As for the addValue method, I prefer to ask first instead of guessing.
Anyone using those could help me a little?
Thanks,
Vincent
Reverse engineering is not that easy. ;-)
If I try this:
I get this:
I'll put that on hold until I get cheered up by some of you guys! ;-)
Help is welcome!
Vincent
I am sorry to inform you that aniMate does not really support what you want to do.
getAnimateTrack is a leftover function from a past project. The method does nothing.
Oh! Sad. Thanks for your reply.
Not sure what your trying to do, but you will find no handy functions in animate2! If there is any c++ plugins ideas let it be said here. :coolsmile: