Ezbaze Posted July 8, 2023 Share Posted July 8, 2023 What Application are you using? Designer Are you using the latest release version? v2.1.1 Can you reproduce it? Yes Does it happen for a new document? If not can you upload a document that shows the problem? Yes hardware acceleration Same issue with both. What happened for you (and what you expected to happen) Does not work: "var aa = 0; aa = aa * 1; aa" Does not work: "var aa = 0; var aa = aa * 1; aa" But this does: "var aa = 0; var aa_ = aa * 1; aa_" Meaning I can't use a variable to update itself? If for some reason this is by design, I think that it would be a VERY good idea to mention this in the documentation, preferably highlighted in red Quote Link to comment Share on other sites More sharing options...
Staff stokerg Posted July 10, 2023 Staff Share Posted July 10, 2023 Hi @Ezbaze, Do you have an afphoto/afdesign setup where the working example is being used? I'm struggling to see what the end goal is from just the working example and if something needs logging with the Developers around this, a sample file would be a big help! Quote Link to comment Share on other sites More sharing options...
Ezbaze Posted July 10, 2023 Author Share Posted July 10, 2023 1 hour ago, stokerg said: Hi @Ezbaze, Do you have an afphoto/afdesign setup where the working example is being used? I'm struggling to see what the end goal is from just the working example and if something needs logging with the Developers around this, a sample file would be a big help! Agreed, here is the file: File: Reassign_Variable.afphoto Quote Link to comment Share on other sites More sharing options...
lepr Posted July 11, 2023 Share Posted July 11, 2023 14 hours ago, stokerg said: I'm struggling to see what the end goal is from just the working example [...] The end goal of the OP's example is irrelevant. The bug is that the PT filter produces no effect when a new value is assigned to an already defined variable. For example, the following contrived example will break the PT: var aa = 0.2; aa = 0.4; aa Whereas, the following will not break the PT: var aa = 0.4; aa Quote Link to comment Share on other sites More sharing options...
NotMyFault Posted July 11, 2023 Share Posted July 11, 2023 This is old, at least since 1.5, probably from beginning. despite the name „var“, the named objects are constants, not variables. You can assign a value only once per expression. my workaround is to add a number to the „var“ name for re-assignments. Quote Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080 LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 iPad Air Gen 5 (2022) A2589 Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps. My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected. Link to comment Share on other sites More sharing options...
NotMyFault Posted July 11, 2023 Share Posted July 11, 2023 On 7/8/2023 at 8:08 PM, Ezbaze said: Meaning I can't use a variable to update itself? Yes. Quote Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080 LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 iPad Air Gen 5 (2022) A2589 Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps. My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected. Link to comment Share on other sites More sharing options...
Ezbaze Posted July 11, 2023 Author Share Posted July 11, 2023 4 hours ago, lepr said: The end goal of the OP's example is irrelevant. The bug is that the PT filter produces no effect when a new value is assigned to an already defined variable. For example, the following contrived example will break the PT: var aa = 0.2; aa = 0.4; aa Whereas, the following will not break the PT: var aa = 0.4; aa That's wrong actually, the issue is with using the variable to reassign the same variable: var a = 0; a = 1; a Quote Link to comment Share on other sites More sharing options...
lepr Posted July 11, 2023 Share Posted July 11, 2023 1 hour ago, Ezbaze said: That's wrong actually, the issue is with using the variable to reassign the same variable: var a = 0; a = 1; a Actually, what I wrote is not wrong. Your new example is identical to mine, except you used 'a' where I used 'aa' and you used 0 and 1 where I used 0.2 and 0.4. The bug involves the assigning of anything to an already defined variable. Quote Link to comment Share on other sites More sharing options...
NotMyFault Posted July 11, 2023 Share Posted July 11, 2023 Probably this is no bug, but a misleading name. variables in PT filters are effectively constants, which can only be set once as input. variables in the lower part are kind of global: these names are recognized in all formulas (channels). variables set in formulas are local (recognized only in that line/formula per channel. None of these can be re-assigned. Quote Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080 LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 iPad Air Gen 5 (2022) A2589 Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps. My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected. Link to comment Share on other sites More sharing options...
Ezbaze Posted July 11, 2023 Author Share Posted July 11, 2023 1 hour ago, lepr said: Actually, what I wrote is not wrong. Your new example is identical to mine, except you used 'a' where I used 'aa' and you used 0 and 1 where I used 0.2 and 0.4. The bug involves the assigning of anything to an already defined variable. You're right, I just tried "var aa = 1; aa = 0; aa" which should have turned the white fill layer to black but it stayed white Quote Link to comment Share on other sites More sharing options...
Ezbaze Posted July 11, 2023 Author Share Posted July 11, 2023 7 minutes ago, NotMyFault said: Probably this is no bug, but a misleading name. variables in PT filters are effectively constants, which can only be set once as input. variables in the lower part are kind of global: these names are recognized in all formulas (channels). variables set in formulas are local (recognized only in that line/formula per channel. None of these can be re-assigned. Yes I see how this could be intended, but as someone who writes code I was very surprised when I noticed that it isn't working as code usually does, it also gets very messy the more things you add to the function line input per channel ( Using 0/1 as on/off for parts of PT filter ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.