我正在为After Effects编写一个脚本,它从图层收集所有属性并将它们写入XML文件.当我从XML中检索值时,某些值是readOnly,并且工具包会引发错误.
有没有办法检查它,像File对象的readonly属性?即:layer.property().(readonly || readOnly)
如果没有,有人可以告诉我,我可以采取哪些方法朝着正确的方向前进?
我有以下代码:
function f() {
//...do stuff with arguments
//and return something...
}
f(root,
f(child1),
f(child2,
f(subchild1),
....
),
);
Run Code Online (Sandbox Code Playgroud)
我想知道何时调用'f'的根级别,所以我引入一个标志作为参数:
f(root, '-r',
f(child1),
f(child2),
//...
)
Run Code Online (Sandbox Code Playgroud)
我的问题是:有没有办法知道何时在顶级"f(root,...)"上调用'f'而不添加额外的参数?
我想在所有应用程序中提供管道.根据我在Angular文档和互联网中读到的内容,如果我在根模块声明中声明了一个管道,那么它就是所有应用程序中的管道.我有这个AppModule代码:
@NgModule({
imports: [ BrowserModule, NavbarModule],
declarations: [ AppComponent, TranslatePipe],
bootstrap: [ AppComponent],
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
这对于子模块:
@NgModule({
imports: [ CommonModule],
declarations: [ NavbarMenuComponent],//<---Call the pipe in this component
})
export class NavbarModule { }
Run Code Online (Sandbox Code Playgroud)
管道:
@Pipe({
name: 'translate',
pure: false
})
export class TranslatePipe implements PipeTransform {
constructor() { }
transform(value: string, args: any[]): any {
return value + " translated";
}
}
Run Code Online (Sandbox Code Playgroud)
但是,当我在NavbarMenuComponent模板上调用管道时,它会抛出此错误:
"管道"翻译"无法找到"
如果我在子模块声明中声明管道它可以工作,但我需要使管道全局,所以当应用程序成长时,我不需要在所有模块中声明这个管道(和其他全局管道).有没有办法让管道全球化?