Query Scene Name

Query Scene Name

krishnasilari
Participant Participant
4,205 Views
3 Replies
Message 1 of 4

Query Scene Name

krishnasilari
Participant
Participant

Hi there!!

I am Krishna Silari from India

can please tell  me how to store the current scene file in variable in mel...
Ex : Krish_Ri_v001.ma is file or scene name, this name or scene want query and save in variable mel mel

i tried "file -loc,-list but result was showing entire path D://Krish/Krish_Ri_v001.ma

 

Thank you.

0 Likes
4,206 Views
3 Replies
Replies (3)
Message 2 of 4

haggi_master
Advocate
Advocate

You can try:

 

string $sn = `file -q -sn -shn`;
substring($sn, 0, size($sn) - 3);
0 Likes
Message 3 of 4

krishnasilari
Participant
Participant

🙂
Thq soo much...

one more issue I am facing..
I queried scene name..and I am trying to save the file or copy this in to some where else..(ex server)


string $scnName = `file -q -ns` ;
string $makdir = `sysFile -md "C:/Krishna/Work/PipeLine/SampleProject/Assets/Props/Mod/NewFolder"`;
string $serPath = "C:/Krishna/Work/PipeLine/SampleProject/Assets/Props/Mod/Krish_Mo_v001";
string $dirname = dirname ( $scnName );

is it rit?? please help

some thing i am missing

0 Likes
Message 4 of 4

haggi_master
Advocate
Advocate

I think the docs for sysFile explain it quite good:

 

 

// Move a scene to the new directory (we can rename it at the same time).
  sysFile -rename "C:/temp/mayaStuff/myScene.mb.trash"
      "C:/maya/projects/default/scenes/myScene.mb"; // Windows

  // Rename the scene to "myScene.will.be.deleted"
  sysFile -rename "C:/temp/mayaStuff/myScene.will.be.deleted"
      "C:/temp/mayaStuff/myScene.mb.trash";           // Windows

  // Copy a scene to the new directory
string $destWindows = "C:/temp/mayaStuff/myScene.mb.trash";
string $srcWindows = "C:/maya/projects/default/scenes/myScene.mb";
  sysFile -copy $destWindows $srcWindows;         // Windows


btw.: for more complex stuff like manipulating files, do string modifications etc. I heavily recommend python instead of mel, it is much easier to manipulate all these data in python and pymel.

 

 

0 Likes