Synchronizing Custom Attributes Edited via Parameter Editor and Script.

Synchronizing Custom Attributes Edited via Parameter Editor and Script.

a2d4f3s1
Enthusiast Enthusiast
948 Views
8 Replies
Message 1 of 9

Synchronizing Custom Attributes Edited via Parameter Editor and Script.

a2d4f3s1
Enthusiast
Enthusiast

I'm encountering an issue with synchronizing custom attributes that have been edited using both the Parameter Editor and scripting in 3ds Max.
Here's a breakdown of my workflow:

 

  1. I used the Parameter Editor to add two items to Custom_Attributes in the Attribute Holder.
  2. Then, I edited and updated the Custom_Attributes items using a script with the [custAttributes.redefine oldDef newDef] function.
  3. However, when I open Edit/Delete in the Parameter Editor, the changes made via the script are not reflected. Moreover, editing through the Parameter Editor seems to revert the items back to their previous state.

a2d4f3s1_0-1705398197887.png

Is there a way to align the results of editing via the Parameter Editor and scripting, so that they reflect the same changes?
Any insights or solutions to resolve this discrepancy would be greatly appreciated.

 

Thank you in advance for your help!

0 Likes
949 Views
8 Replies
Replies (8)
Message 2 of 9

denisT.MaxDoctor
Advisor
Advisor

Why define and create a CA using the Parameter Editor and then modify it with a script? Isn't it easier to create the CA with a script from the beginning?

0 Likes
Message 3 of 9

denisT.MaxDoctor
Advisor
Advisor

Another point is that you must define an ID for your attribute... For example, I automatically remove all attributes from the scene without an attribute ID, without any verification of its necessity.

0 Likes
Message 4 of 9

a2d4f3s1
Enthusiast
Enthusiast

Hello,

First of all, thank you for your response.

I do agree that creating custom attributes (CA) via script from the beginning is generally a better approach.
So, why didn't I do it this way? The reason is that it was a client's preference. The original CA was also prepared by the client.

To set the context, understandably, our clients have little to no intention to understand scripting.
Their perspective is:

  • They want to create the initial version of the CA themselves.
  • They prefer major modifications to be done via script.
  • They want to make final adjustments on their own.

However, I do see the merit in having a workflow that allows non-script-savvy users to interact and modify CAs, if it were possible. It would indeed be advantageous to have a bidirectional approach for editing CAs that accommodates both script-based and non-script-based users.

Thank you again for your insights, and I'm open to any further suggestions or ideas.

0 Likes
Message 5 of 9

denisT.MaxDoctor
Advisor
Advisor

Does your client define a set of parameters and their type, or just the look and feel of the user interface?

0 Likes
Message 6 of 9

a2d4f3s1
Enthusiast
Enthusiast

Thank you for your question. I might not have fully grasped your query, but here's my response:

The clients use the Parameter Editor within its capabilities to define sets of parameters and their types.
Furthermore, they intend to continue editing these parameters using the Parameter Editor even after receiving them from me.

0 Likes
Message 7 of 9

a2d4f3s1
Enthusiast
Enthusiast

For example, here's a sample of CA similar to what we typically receive from the client.
This code was generated using custAttributes.getDefSource:

"attributes Custom_Attributes 
Redefine:CAT_CurrentDef
version:1
(
Parameters main rollout:params
(
'ParamA' Type:#string UI:'ParamA' Default:""
'A_01' Type:#float UI:'A_01' Default:1.0
'A_02' Type:#float UI:'A_02' Default:0.0
'A_03' Type:#float UI:'A_03' Default:0.0
'ParamB' Type:#string UI:'ParamB' Default:""
'B_01' Type:#float UI:'B_01' Default:0.0
'B_02' Type:#float UI:'B_02' Default:0.0
'B_03' Type:#float UI:'B_03' Default:0.0
'ParamC' Type:#string UI:'ParamC' Default:""
'Ratio_01' Type:#float UI:'Ratio_01' Default:50.0
'Ratio_02' Type:#float UI:'Ratio_02' Default:50.0
'Param18' Type:#string UI:'Param18' Default:""
'Color1' Type:#frgba UI:'Color1' Default:(::color 255 0 0)
'Color2' Type:#frgba UI:'Color2' Default:(::color 0 255  0)
'Color3' Type:#frgba UI:'Color3' Default:(::color 0 0 255)
)
Rollout Params "Custom Attributes"
(
label 'ParamA' "------------ParamA------------" Align:#Center Offset:[0,0] Type:#string
spinner 'A_01' "A_01:" Width:160 Height:16 Align:#Center Offset:[0,0] Type:#float Range:[0,1,1]
spinner 'A_02' "A_02:" Width:160 Height:16 Align:#Center Offset:[0,0] Type:#float Range:[0,1,0]
spinner 'A_03' "A_03:" Width:160 Height:16 Align:#Center Offset:[0,0] Type:#float Range:[0,1,0]
label 'ParamB' "-------------ParamB-------------" Align:#Center Offset:[0,0] Type:#string
spinner 'B_01' "B_01:" Width:160 Height:16 Align:#Center Offset:[0,0] Type:#float Range:[-100,100,0]
spinner 'B_02' "B_02:" Width:160 Height:16 Align:#Center Offset:[0,0] Type:#float Range:[-100,100,0]
spinner 'B_03' "B_03:" Width:160 Height:16 Align:#Center Offset:[0,0] Type:#float Range:[-100,100,0]
label 'ParamC' "------------ParamC------------" Align:#Center Offset:[0,0] Type:#string
spinner 'Ratio_01' "Ratio_01:" Width:160 Height:16 Align:#Center Offset:[0,0] Type:#float Range:[0,100,50]
spinner 'Ratio_02' "Ratio_02:" Width:160 Height:16 Align:#Center Offset:[0,0] Type:#float Range:[0,100,50]
label 'Param18' "------------Param18------------" Align:#Center Offset:[0,0] Type:#string
colorPicker 'Color1' "Color1:" Width:100 Height:18 Align:#Center Offset:[0,0] Type:#frgba Color:(::color 255 0 0) Alpha:true
colorPicker 'Color2' "Color2:" Width:100 Height:18 Align:#Center Offset:[0,0] Type:#frgba Color:(::color 0 255 0) Alpha:true
colorPicker 'Color3' "Color3:" Width:100 Height:18 Align:#Center Offset:[0,0] Type:#frgba Color:(::color 0 0 255) Alpha:False
)
)
"
0 Likes
Message 8 of 9

denisT.MaxDoctor
Advisor
Advisor

Long gone are the days when CA was just a data holder. Now it's 80% plugin and maybe 20% placeholder. Your client won't be able to write the functional part and the interface logic... So the definition your client creates can be used to generate the final functional attribute.
How to do it is clear and quite simple. But how to leave the ability to edit this attribute is still to be figured out.

Message 9 of 9

a2d4f3s1
Enthusiast
Enthusiast

I agree with you. That's why the gap with them is so deep...

0 Likes