Modifier nodes

Moderator: Chad

User avatar
Chad
Fusionator
Posts: 1389
Joined: Fri Aug 08, 2014 1:11 pm
Been thanked: 11 times

Re: Modifier nodes

#16

Post by Chad » Fri Jun 02, 2017 7:26 am

Sorry for late reply.

I'm not sure if that's a bug or if you're just not supposed to do both. Like the alternative may be to have two inputs, one as a slider, one as the flow input. The slider one would update if the flow input changed. You'd need all the event handling to work just right, though.

User avatar
Farmfield
Fusionista
Posts: 366
Joined: Tue Feb 10, 2015 2:16 am
Location: Goteborg - Sweden
Contact:

Re: Modifier nodes

#17

Post by Farmfield » Sat Jun 03, 2017 8:32 am

Chad wrote: [...] it's just to show how easy it is to make [...]
As I'm not sure this has been stated clearly enough before... Chad, you are a complete and utter crazy person. :D

User avatar
Kristof
Fusionista
Posts: 545
Joined: Thu Aug 07, 2014 1:30 pm
Answers: 1
Been thanked: 16 times

Re: Modifier nodes

#18

Post by Kristof » Thu Jul 25, 2019 2:59 pm

SecondMan wrote: ↑
Tue Aug 30, 2016 12:13 pm
That's about as far as I got a while ago when you told me how to do it. It's neat, but it screws up the viewer. Once you've dragged a modifier in there, it will only ever display a strip at the top. And you don't get a visual link between the modifiers and the nodes, of course.
If you open up a viewer in another window, you won't have that problem. Weird. Goes way back too, tried it in a 6.4 out of curiosity.
Last edited by Kristof on Fri Jul 26, 2019 1:10 am, edited 1 time in total.

User avatar
Kristof
Fusionista
Posts: 545
Joined: Thu Aug 07, 2014 1:30 pm
Answers: 1
Been thanked: 16 times

Re: Modifier nodes

#19

Post by Kristof » Thu Jul 25, 2019 3:07 pm

@Chad, could you have a look at these three simple fuses, please? I have one that creates a float, a point and a point offset that will add its float inputs to the position coming in. Weird thing is that the initial position is also being modified, while they are two different fuses. So I must be doing something wrong.

In Fu 6.4 this doesn't happen, but it also won't add the offset (it does so in Fu 9).

Comp (first download and install the fuses shared below):

Code: Select all

{
	Tools = ordered() {
		Float1 = Fuse.Float {
			Inputs = {
				Float = Input { Value = 2, },
			},
			ViewInfo = OperatorInfo { Pos = { 605, 82.5 } },
		},
		Point1 = Fuse.Point {
			CtrlWZoom = false,
			Inputs = {
				Position = Input { Value = { 3, 2 }, },
			},
			ViewInfo = OperatorInfo { Pos = { 495, 115.5 } },
		},
		Point_Offset1 = Fuse.Point_Offset {
			Inputs = {
				Position = Input {
					SourceOp = "Point1",
					Source = "Output",
				},
				XOffset = Input {
					SourceOp = "Float1",
					Source = "Output",
				},
				YOffset = Input {
					SourceOp = "Float1_1",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 660, 115.5 } },
		},
		Float1_1 = Fuse.Float {
			ViewInfo = OperatorInfo { Pos = { 715, 82.5 } },
		}
	}
}
Float fuse:
  1. -- ============================================================================
  2. -- Blabber
  3. -- ============================================================================
  4.  
  5. --[[
  6.  
  7.  The authors hereby grant permission to use, copy, and distribute this
  8.  software and its documentation for any purpose, provided that existing
  9.  copyright notices are retained in all copies and that this notice is
  10.  included verbatim in any distributions. Additionally, the authors grant
  11.  permission to modify this software and its documentation for any
  12.  purpose, provided that such modifications are not distributed without
  13.  the explicit consent of the authors and that existing copyright notices
  14.  are retained in all copies.
  15.  
  16.  IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
  17.  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
  18.  OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES
  19.  THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF
  20.  SUCH DAMAGE.
  21.  
  22.  THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
  23.  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  24.  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
  25.  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND
  26.  DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
  27.  UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  28.  
  29. --]]
  30.  
  31. -- ============================================================================
  32. -- Constants
  33. -- ============================================================================
  34.  
  35. VERSION = "v0.1 (2019-0719) by Kristof Indeherberge"
  36. FUSE_NAME = "Float"
  37.  
  38. -- ============================================================================
  39. -- Float fuse
  40. -- Fuse that creates a float number
  41. -- ============================================================================
  42.  
  43. FuRegisterClass( FUSE_NAME , CT_Tool , {
  44.     --REG_Fuse_NoEdit = true,
  45.     --REG_Fuse_NoReload = true,
  46.     --REG_Fuse_TilePic = fuse_pic,
  47.     --REG_NoBlendCtrls = true,
  48.     REG_NoCommonCtrls = true,
  49.     --REG_NoMotionBlurCtrls = true,
  50.     --REG_NoPreCalcProcess = true,  -- call Process for precalc requests (instead of PreCalcProcess)
  51.     --REG_OpNoMask = true,
  52.     --REG_SupportsDoD = true,   -- this tool supports DoD
  53.     --REG_TimeVariant = true,
  54.     --REG_Unpredictable = true, -- this tool shall never be cached
  55.     --REG_Version = 100,
  56.     REGS_Category = "xmnr0x23\\Math",
  57.     --REGS_Company = "UNT",
  58.     --REGS_HelpTopic = "http://en.wikipedia.org/wiki/Acme_Corporation",
  59.     REGS_Name = FUSE_NAME,
  60.     REGS_OpDescription = "Create a float number",
  61.     REGS_OpIconString = FUSE_NAME,
  62.     --REGS_URL = "http://en.wikipedia.org/wiki/Acme_Corporation",
  63.     } )
  64.  
  65. function Create()
  66.  
  67.     InFloat = self:AddInput( "Float" , "Float" , {
  68.         LINKID_DataType = "Number",
  69.         INPID_InputControl = "SliderControl",
  70.         INP_Default = 1.0,
  71.         } )
  72.  
  73.     OutN = self:AddOutput( "Output" , "Output" , {
  74.         LINKID_DataType = "Number",
  75.         LINK_Main = 1,
  76.         } )
  77.        
  78. --[[
  79.     InLabel = self:AddInput( VERSION , "version" , {
  80.         LINKID_DataType = "Text",
  81.         INPID_InputControl = "LabelControl",
  82.         INP_External = false,
  83.         INP_Passive = true,
  84.         } )
  85. --]]
  86.        
  87. end
  88.  
  89. function Process( req )
  90.  
  91.     local inA = InFloat:GetValue( req ).Value
  92.     print ( inA )
  93.     out = inA
  94.     OutN:Set( req , out )
  95.  
  96. end
  97.  
Point fuse:
  1. -- ============================================================================
  2. -- Blabber
  3. -- ============================================================================
  4.  
  5. --[[
  6.  
  7.  The authors hereby grant permission to use, copy, and distribute this
  8.  software and its documentation for any purpose, provided that existing
  9.  copyright notices are retained in all copies and that this notice is
  10.  included verbatim in any distributions. Additionally, the authors grant
  11.  permission to modify this software and its documentation for any
  12.  purpose, provided that such modifications are not distributed without
  13.  the explicit consent of the authors and that existing copyright notices
  14.  are retained in all copies.
  15.  
  16.  IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
  17.  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
  18.  OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES
  19.  THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF
  20.  SUCH DAMAGE.
  21.  
  22.  THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
  23.  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  24.  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
  25.  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND
  26.  DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
  27.  UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  28.  
  29. --]]
  30.  
  31. -- ============================================================================
  32. -- Constants
  33. -- ============================================================================
  34.  
  35. VERSION = "v0.1 (2019-0719) by Kristof Indeherberge"
  36. FUSE_NAME = "Point"
  37.  
  38. -- ============================================================================
  39. -- Float fuse
  40. -- Fuse that creates a integer number
  41. -- ============================================================================
  42.  
  43. FuRegisterClass( FUSE_NAME , CT_Tool , {
  44.     --REG_Fuse_NoEdit = true,
  45.     --REG_Fuse_NoReload = true,
  46.     --REG_Fuse_TilePic = fuse_pic,
  47.     --REG_NoBlendCtrls = true,
  48.     REG_NoCommonCtrls = true,
  49.     --REG_NoMotionBlurCtrls = true,
  50.     --REG_NoPreCalcProcess = true,  -- call Process for precalc requests (instead of PreCalcProcess)
  51.     --REG_OpNoMask = true,
  52.     --REG_SupportsDoD = true,   -- this tool supports DoD
  53.     --REG_TimeVariant = true,
  54.     --REG_Unpredictable = true, -- this tool shall never be cached
  55.     --REG_Version = 100,
  56.     REGS_Category = "xmnr0x23\\Math",
  57.     --REGS_Company = "UNT",
  58.     --REGS_HelpTopic = "http://en.wikipedia.org/wiki/Acme_Corporation",
  59.     REGS_Name = FUSE_NAME,
  60.     REGS_OpDescription = "Create a point",
  61.     REGS_OpIconString = FUSE_NAME,
  62.     --REGS_URL = "http://en.wikipedia.org/wiki/Acme_Corporation",
  63.     } )
  64.  
  65. function Create()
  66.  
  67.     InPoint = self:AddInput( "Position" , "Position" , {
  68.         LINKID_DataType = "Point",
  69.         INPID_InputControl = "OffsetControl",
  70.         INPID_PreviewControl = "PointControl",
  71.         --INP_Default = 1.0,
  72.         --INP_Integer = true,
  73.         ICS_Name = "Position Locator"
  74.         } )
  75.  
  76.     OutN = self:AddOutput( "Output" , "Output" , {
  77.         LINKID_DataType = "Point",
  78.         LINK_Main = 1,
  79.         } )
  80.        
  81. --[[
  82.     InLabel = self:AddInput( VERSION , "version" , {
  83.         LINKID_DataType = "Text",
  84.         INPID_InputControl = "LabelControl",
  85.         INP_External = false,
  86.         INP_Passive = true,
  87.         } )
  88. --]]
  89.  
  90. end
  91.  
  92. function Process( req )
  93.  
  94.     local inA = InPoint:GetSource( req.Time )
  95.  
  96.     --print ( inA )
  97.     out = inA
  98.     OutN:Set( req , out )
  99.  
  100. end
  101.  
Point offset fuse:
Code: [Select all] [Expand/Collapse] [Download] (point_offset.fuse)
  1. -- ============================================================================
  2. -- Blabber
  3. -- ============================================================================
  4.  
  5. --[[
  6.  
  7.  The authors hereby grant permission to use, copy, and distribute this
  8.  software and its documentation for any purpose, provided that existing
  9.  copyright notices are retained in all copies and that this notice is
  10.  included verbatim in any distributions. Additionally, the authors grant
  11.  permission to modify this software and its documentation for any
  12.  purpose, provided that such modifications are not distributed without
  13.  the explicit consent of the authors and that existing copyright notices
  14.  are retained in all copies.
  15.  
  16.  IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
  17.  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
  18.  OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES
  19.  THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF
  20.  SUCH DAMAGE.
  21.  
  22.  THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
  23.  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  24.  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
  25.  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND
  26.  DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
  27.  UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  28.  
  29. --]]
  30.  
  31. -- ============================================================================
  32. -- Constants
  33. -- ============================================================================
  34.  
  35. VERSION = "v0.1 (2019-0719) by Kristof Indeherberge"
  36. FUSE_NAME = "Point_Offset"
  37.  
  38. -- ============================================================================
  39. -- Float fuse
  40. -- Fuse that creates a integer number
  41. -- ============================================================================
  42.  
  43. FuRegisterClass( FUSE_NAME , CT_Tool , {
  44.     --REG_Fuse_NoEdit = true,
  45.     --REG_Fuse_NoReload = true,
  46.     --REG_Fuse_TilePic = fuse_pic,
  47.     --REG_NoBlendCtrls = true,
  48.     REG_NoCommonCtrls = true,
  49.     --REG_NoMotionBlurCtrls = true,
  50.     --REG_NoPreCalcProcess = true,  -- call Process for precalc requests (instead of PreCalcProcess)
  51.     --REG_OpNoMask = true,
  52.     --REG_SupportsDoD = true,   -- this tool supports DoD
  53.     --REG_TimeVariant = true,
  54.     --REG_Unpredictable = true, -- this tool shall never be cached
  55.     --REG_Version = 100,
  56.     REGS_Category = "xmnr0x23\\Math",
  57.     --REGS_Company = "UNT",
  58.     --REGS_HelpTopic = "http://en.wikipedia.org/wiki/Acme_Corporation",
  59.     REGS_Name = FUSE_NAME,
  60.     REGS_OpDescription = "Create a point",
  61.     REGS_OpIconString = FUSE_NAME,
  62.     --REGS_URL = "http://en.wikipedia.org/wiki/Acme_Corporation",
  63.     } )
  64.  
  65. function Create()
  66.  
  67.     InPoint = self:AddInput( "Position" , "Position" , {
  68.         LINKID_DataType = "Point",
  69.         --INPID_InputControl = "OffsetControl",
  70.         --INPID_PreviewControl = "PointControl",
  71.         --INP_Default = 1.0,
  72.         --INP_Integer = true,
  73.         --ICS_Name = "Position Locator",
  74.         LINK_Main = 1,
  75.         } )
  76.  
  77.     InXOffset = self:AddInput( "X Offset" , "XOffset" , {
  78.         LINKID_DataType = "Number",
  79.         LINK_Main = 2,
  80.         INP_Required = true,
  81.         })  
  82.        
  83.     InYOffset = self:AddInput( "Y Offset" , "YOffset" , {
  84.         LINKID_DataType = "Number",
  85.         LINK_Main = 3,
  86.         INP_Required = false,
  87.         })
  88.  
  89.     OutN = self:AddOutput( "Output" , "Output" , {
  90.         LINKID_DataType = "Point",
  91.         LINK_Main = 1,
  92.         } )
  93.        
  94. --[[
  95.     InLabel = self:AddInput( VERSION , "version" , {
  96.         LINKID_DataType = "Text",
  97.         INPID_InputControl = "LabelControl",
  98.         INP_External = false,
  99.         INP_Passive = true,
  100.         } )
  101. --]]
  102.        
  103. end
  104.  
  105. function Process( req )
  106.  
  107.     local point = InPoint:GetSource( req.Time )
  108.     local x_offset = InXOffset:GetValue( req ).Value
  109.     local y_offset = InYOffset:GetValue( req ).Value
  110.  
  111.     --print ( point )
  112.     point.X = point.X + x_offset
  113.     point.Y = point.Y + y_offset
  114.     out = point
  115.  
  116.     OutN:Set( req , out )
  117.  
  118. end
  119.  

User avatar
PeterLoveday
Fusioneer
Posts: 145
Joined: Sun Sep 14, 2014 6:09 pm
Answers: 6
Been thanked: 16 times

Re: Modifier nodes

#20

Post by PeterLoveday » Thu Jul 25, 2019 6:55 pm

Nodes should never modify their incoming parameters. (Some, like Image, will actively prevent this)

Instead, create a copy to output:
  1.     local point = InPoint:GetSource( req.Time )
  2.     local x_offset = InXOffset:GetValue( req ).Value
  3.     local y_offset = InYOffset:GetValue( req ).Value
  4.  
  5.     local out = point:Copy()
  6.     out.X = out.X + x_offset
  7.     out.Y = out.Y + y_offset
  8.  
  9.     OutN:Set( req , out )

User avatar
Kristof
Fusionista
Posts: 545
Joined: Thu Aug 07, 2014 1:30 pm
Answers: 1
Been thanked: 16 times

Re: Modifier nodes

#21

Post by Kristof » Fri Jul 26, 2019 1:03 am

Thanks @PeterLoveday! Works now... :) This is neat, I like it how you can connect this to a 2D transform node--RMB and select it from the menu.

What's the difference between CopyOf() and Copy()?

User avatar
SecondMan
Site Admin
Posts: 3415
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 3
Location: Vancouver, Canada
Been thanked: 78 times
Contact:

Re: Modifier nodes

#22

Post by SecondMan » Fri Jul 26, 2019 2:24 am

Copy() is a generic function that all parameter types may implement. CopyOf() is specific to Image. The only real difference in behaviour is that CopyOf() may be interrupted if the tool is told to abort. Copy() will always complete the copying across of pixel data. It is generally a better idea to use CopyOf() with images, but either will work.

https://www.steakunderwater.com/VFXPedi ... age/CopyOf

We should also split this off to a separate topic for the Fuses forum. Think of a good title for it? :)

User avatar
Kristof
Fusionista
Posts: 545
Joined: Thu Aug 07, 2014 1:30 pm
Answers: 1
Been thanked: 16 times

Re: Modifier nodes

#23

Post by Kristof » Fri Jul 26, 2019 2:52 am

Thanks @SecondMan! Yeah, I was thinking of creating a new thread to demonstrate this workflow. The error described above kept me from going forward and from creating a demo comp (I have something simple in mind).

Feel free to go ahead if you want. :)