Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Resize Comp Issues

New Here ,
Jul 18, 2011 Jul 18, 2011

Hi Folks,

I am trying to resize multiple Comps through script and having odd results. Hopefully someone can help clear the issue up for me.

Here is a basic example of code:

var selectedFootage = app.project.selection;

function setCompositionSize( selectedFootage )
    {
        for( var i=0; i<selectedFootage.length; i++ )
        {
            if( (selectedFootage instanceof CompItem) )
            {
                selectedFootage.width = sizeWidth;
                selectedFootage.height = sizeHeight;
            }
        }
    } 

Note: The UI has two fields a user can enter -- Width and Height.

In the test project, I have three comps which are 1920x1080 (as set manually in the Composition Settings). The problem seems to happen when I set the size to something with a different ratio than the original (such as 648x486). The code will halt on one of these lines:

selectedFootage.width = sizeWidth;
selectedFootage.height = sizeHeight;

It will not make the change and the script will have to be force stopped. If I run the script againt, and set it to something like 1280x720, it appears to work fine.

Is there something I am missing when altering these? Any help/advice/suggestions would be greatly appreciated!

Thanks!

-Jason

TOPICS
Scripting
650
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2011 Jul 18, 2011

I didn't have any problem changing a 320x200 comp to 133x50 with this:

{

var selectedFootage = app.project.selection;

function setCompositionSize( selectedFootage )
    {
        for( var i=0; i<selectedFootage.length; i++ )
        {
            if( (selectedFootage instanceof CompItem) )
            {
                selectedFootage.width = 133;
                selectedFootage.height = 50;
            }
        }
    }

setCompositionSize(selectedFootage);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 18, 2011 Jul 18, 2011

I tried the same size Comp and changed it to the size you said worked and it did indeed work -- the first time. The second time, it didn't do anything at all.

The odd thing is that this seems to work sometimes and not others. I can't isolate the differences between the working and non-working tests.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2011 Jul 18, 2011
LATEST

I can't get it to fail--single selection, multiple selections, project bin active/inactive, etc. as long as a comp is selected.

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines