Kevin Snyder
Forum Replies Created
-
Great! Thank you. That works.
-
Great! Thank you. I appreciate it.
-
Kevin Snyder
May 7, 2020 at 7:27 pm in reply to: Changing variable value based on multiple conditionsThank you for the feedback Andrei. I appreciate it!
-
Gotcha, that makes sense. Thanks.
-
Thanks, Dan.
So I’m using the code below. From my understanding, if the property is from an effect var myText = “dog” and if the selected property isn’t from an effect var myText should be “cat”? Is that the correct assumption? For some reason, it always returns as “cat”.
var myProp = selectProps.isEffect;
var myText = myProp ? "dog" : "cat"; -
Dan, that works great. Thank you. I appreciate it. I’m trying to wrap my head around what you did to apply it to a version that works on any selected property. It will work with one property selected, but falls apart when I have more than one property selected.
function addSelected(){var myComp = app.project.activeItem; //Active comp
var selectProps = myComp.selectedLayers[0].selectedProperties; //Selected properties in comp;
var selectProp;
var n;
for (var i = 0; i < selectProps.length; i++){
selectProp = selectProps[i];
if (selectProp.propertyType == PropertyType.PROPERTY){
switch(selectProp.propertyValueType){
case PropertyValueType.OneD:
n = 1;
break;
case PropertyValueType.TwoD:
case PropertyValueType.TwoD_SPATIAL :
n = 2;
break;
case PropertyValueType.ThreeD:
case PropertyValueType.ThreeD_SPATIAL:
n = 3;
break;
case PropertyValueType.COLOR:
n = 4;
break;
default:
n = 0; // just in case
break;
}}
}
var myLayer = myComp.selectedLayers[0].name; //Get layer name;
var myProp = myComp.selectedLayers[0].selectedProperties[0].name; //Get property name;
var myControl = myProp + " " + "-" + " " + myLayer;//Combine property name and layer name
selectProp.addToMotionGraphicsTemplateAs(myComp, myControl); //Add property to EGP and rename;
app.project.activeItem.motionGraphicsTemplateName = "Master Properties"; //Set template name;
myComp.openInEssentialGraphics(); //Opens comp in essential graphics panel;
}var selectProp = app.project.activeItem.selectedProperties;
for (var i = 0; i < selectProp.length; i++){
addSelected(selectProp[i]);
} -
Thanks, Dan. I appreciate it. After some trial and error, I finally have a working script. The current version will add the selected layer’s position to the Essential Graphics Panel. How do I make it run on all selected layers and not just the first one?
app.beginUndoGroup("Add to EGP");function add(){
var myComp = app.project.activeItem; //Active comp
var selectProp = myComp.selectedLayers[0].position; //Position on selected layer;
var myLayer = myComp.selectedLayers[0].name; //Get layer name;
var myProp = "Position"; //Property name;
var myControl = myProp + " " + "-" + " " + myLayer;//Combine property name and layer name
selectProp.addToMotionGraphicsTemplateAs(myComp, myControl); //Add property to EGP and rename;
app.project.activeItem.motionGraphicsTemplateName = "Master Properties"; //Set template name;
myComp.openInEssentialGraphics(); //Opens comp in essential graphics panel;}
add()
app.endUndoGroup();
-
I would check out this tutorial. I think it will let you get the job done.
https://www.youtube.com/watch?v=i4rilThiRDE
Some contents or functionalities here are not available due to your cookie preferences!This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.
-
Alex,
Thank you for the expression. I appreciate it. It’s nice to get it all on one layer.
Kevin
-
Thank you, Kalleheikki. That sounds like a good way to make it work. I appreciate it.
Kevin