Notifications
Clear all

[Closed] custom attribute – remap a parameter with the same name

Hello,

I have a Custom Attribute with 2 parameters blocks (for a cleaner code a good separation of parameters).
Unfortunately, some parameters have been swapped from one parameter block to another.

I have already release the script to our 3dartists so they set up their scenes with the previous CA definition. So I need to remap the parameters that I swapped without impacting their setups.

I know the remap functionality of ca parameters but it seems to work only with parameters inside the same parameter block.

Here are some samples:

  • the first CA def:
(
CA_Example = attributes "CA Example Attribute" version:1 attribID:#(0xfba327e, 0x6ffd4ab0)
(
   parameters p1 rollout:roll
   (
      p1_param1 type:#string animatable:false ui:lbl_p1 default:"p1_param1";
   )
   parameters p2 rollout:roll
   (
      p2_param1 type:#string animatable:false ui:lbl_p2 default:"p2_param1";
   )

   rollout roll "CA Example roll"
   (
      edittext lbl_p1 "P1" text:(p1_param1 as string) readOnly:true;
      edittext lbl_p2 "P2" text:(p2_param1 as string) readOnly:true;
   )
)
custAttributes.add $ CA_Example;
)
  • the new CA definition:
(
CA_Example = attributes "CA Example Attribute" version:1 attribID:#(0xfba327e, 0x6ffd4ab0) 
                                             remap:#( #("p1_param1"), #("p1_param1"))
(
   parameters p1 rollout:roll
   (
      -- none
   )
   parameters p2 rollout:roll
   (
      p1_param1 type:#string animatable:false ui:lbl_p1 default:"p1_param1";
      p2_param1 type:#string animatable:false ui:lbl_p2 default:"p2_param1";
   )

   rollout roll "CA Example roll"
   (
      edittext lbl_p1 "P1" text:(p1_param1 as string) readOnly:true;
      edittext lbl_p2 "P2" text:(p2_param1 as string) readOnly:true;
   )
)
custAttributes.add $ CA_Example;
)

I would like to know if there is a way to remap a parameter of a Custom Attribute from one pblock to another one ?

Thanks,

2 Replies

My guess is that the only way to do this would be to build a new scripted plugin with a way to grab each instances parameters.

ie. if you’re building a material make a conversion tool that goes through the scene and calls each instances relevant parameter as its new parameter.

Yes, I will do it if I have no other options. Or I will let the parameters where they are and commenting my code explicitely.
But still, it is a strange behavior (and a strange request I admit )…