Jump to: Board index » General » Fusion

comp name expression variable

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

Vincent Audineau

  • Posts: 19
  • Joined: Mon Nov 10, 2014 8:09 pm

comp name expression variable

PostFri Feb 06, 2015 2:23 pm

Hello,

Is there a expression variable to get the comp name.
In Houdini, there is $HIPNAME you can use to get the scene name in a path or in an text.

I wonder if it's possible in Fusion

Thanks for your help
Vincent AUDINEAU
www.vbkstudio.com
Offline
User avatar

Rony Soussan

  • Posts: 727
  • Joined: Tue Nov 11, 2014 5:33 pm

Re: comp name expression variable

PostFri Feb 06, 2015 5:36 pm

yes. right click in the text field of the text node and select CompName :)
Offline

Vincent Audineau

  • Posts: 19
  • Joined: Mon Nov 10, 2014 8:09 pm

Re: comp name expression variable

PostFri Feb 06, 2015 9:09 pm

thanks a lot
Vincent AUDINEAU
www.vbkstudio.com
Offline
User avatar

Blazej Floch

  • Posts: 191
  • Joined: Tue Nov 11, 2014 12:48 am
  • Location: Toronto, ON

Re: comp name expression variable

PostFri Feb 06, 2015 10:35 pm

You can also right click and Expression
This allows for text manipulation. And you can use Lua:
Code: Select all
-- Assume composition is: C:\path\Composition1.comp

Text(comp.Name) -- Composition1.comp
Text(comp.Filename) -- C:\path\Composition1.comp

-- Lua string manipulation
string.match(comp.Filename, "(.-)[^\\]-$") -- C:\path\
string.match(comp.Name, "([^%.]+)") -- Composition1
string.match(comp.Name, "(%..+)$") -- .comp
string.match(comp.Name, "%.(.+)$") -- comp

Most (all?) of the attributes of the Lua comp object are supported.
In the Console-Tab print
Code: Select all
==(comp:GetAttrs())
(== is a shortcut for dump() which is similar to python's pprint. That means it prints table structures nicely and even objects get a string representation.)
Code: Select all
Lua> ==comp:GetAttrs()
table: 0x03d7dec8
   COMPN_LastFrameRendered = -2000000000
   COMPB_HiQ = true
   COMPI_RenderFlags = 131090
   COMPN_ElapsedTime = 0
   COMPN_AverageFrameTime = 0
   COMPB_Locked = false
   COMPB_Modified = true
   COMPN_TimeRemaining = 0
   COMPN_CurrentTime = 15
   COMPN_RenderEnd = 60
   COMPN_AudioOffset = 0
   COMPS_Name = tire.comp
   COMPN_GlobalStart = 1
   COMPI_RenderStep = 1
   COMPS_FileName = C:\Users\Public\Documents\Blackmagic Design\Fusion\Comps\tire.comp
   COMPB_Rendering = false
   COMPN_RenderStartTime = 1
   COMPN_GlobalEnd = 1000
   COMPN_RenderEndTime = 60
   COMPN_RenderStart = 1
   COMPN_LastFrameTime = 0
   COMPB_Proxy = true
The Simple Expression names are similar but without the COMP*_ prefix and some have a bit different case: FileName -> Filename.
You need to use Text() or tostring() for non-string types like Booleans.

COMP basically means that this is the Attribute tag of the composition and the letter stands for the variable type:
  • N -> Number
  • I -> Integer
  • B -> Bool
  • H -> Handle
  • S -> String/Text
Offline
User avatar

Chad Capeland

  • Posts: 3027
  • Joined: Mon Nov 10, 2014 9:40 pm

Re: comp name expression variable

PostSat Feb 07, 2015 7:28 pm

I highly recommend adding Text(comp.FileName) to the metadata of your images before your savers. So useful for figuring out what file made what image you are looking at days, weeks, months from now.
Chad Capeland
Indicated, LLC
www.floweffects.com
Offline
User avatar

Chad Capeland

  • Posts: 3027
  • Joined: Mon Nov 10, 2014 9:40 pm

Re: comp name expression variable

PostSat Feb 07, 2015 7:36 pm

I highly recommend adding Text(comp.FileName) to the metadata of your images before your savers. So useful for figuring out what file made what image you are looking at days, weeks, months from now.

EDIT: Something like this...
Code: Select all
{
   Tools = ordered() {
      SetMetadata1 = Fuse.SetMetaData {
         Inputs = {
            FieldName = Input { Value = "SourceComp", },
            FieldValue = Input {
               Expression = "Text(comp.FileName)",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 935, 181.5, }, },
      },
   },
}


Oh, something else that's handy is putting in the computer name, this way if you are seeing random weird artifact in a render, you can check the metadata to see if the frames come from the same machines...

Code: Select all
{
   Tools = ordered() {
      SetMetadata1 = Fuse.SetMetaData {
         Inputs = {
            FieldName = Input { Value = "ComputerName", },
            FieldValue = Input {
               Expression = "os.getenv("COMPUTERNAME",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 935, 181.5, }, },
      },
   },
}
Last edited by Chad Capeland on Tue Feb 10, 2015 9:33 pm, edited 1 time in total.
Chad Capeland
Indicated, LLC
www.floweffects.com
Offline

Vincent Audineau

  • Posts: 19
  • Joined: Mon Nov 10, 2014 8:09 pm

Re: comp name expression variable

PostSun Feb 08, 2015 11:39 pm

wow !
there is some nice answers here.

thanks a lot !

Now it brings to me new question.
how could I use an expression (or something else ) to automate path creation.
For example, how could i use the compname to create afodler with the same name at rendertime ?

thanks again for your answer
Vincent AUDINEAU
www.vbkstudio.com
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: comp name expression variable

PostMon Feb 09, 2015 10:23 am

this is currently only possible with a custom render start script. loader/saver names cant be scripted (at the moment)
you could create a script that replaces the pathes in the saver and then saves your comp and starts to render/send to renderfarm.

this script could already create the pathes for you or you use the option in the save to create the folders at render start

Return to Fusion

Who is online

Users browsing this forum: No registered users and 23 guests