Understanding and Teaching Python for Unreal Engine | Unreal Educator Livestream

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] do [Music] [Music] hmm [Music] so [Music] [Music] hello i'm francois antoine director of hmi and embedded systems at epic games and i'm joe andresen technical product manager for hmi embedded systems at epic games today we're very proud to announce our human machine interface initiative our dedicated hmi team of technical artists and engineers is committed to this effort and we are continually adding new features to benefit all manufacturers we're thrilled that general motors recently announced gmc hummery v will be the first vehicle to use unreal engine in its digital cockpit this marks an exciting partnership in building next generation experiences on embedded systems unreal engine provides key features for design driven development quickly iterate with blueprints visual scripting collaborate with complete version control support instantly preview designs on your desktop and stay in control with direct access to source code these features and more enable designers artists and developers to work directly on the project that is deployed to the vehicle unreal engine is a comprehensive tool set for creating beautiful interactive visuals using your advanced scalable renderer niagara is a state-of-the-art particle system that brings your designs to life downloadable content instantly changes the look feel and functionality of your ui giving your users the freedom to customize their experience to highlight our commitment to hmi development we're happy to announce that in addition to linux and unreal engine as a library on android we're working to bring unreal engine to blackberry qnx's neutrino microkernel real-time operating system and you'll be able to craft a great navigation experience with our upcoming integration of mapbox with highly tested features used by millions of artists and developers unreal engine opens up exciting possibilities for all creators from prototyping and concepting to final production and beyond unreal engine is with you the entire way [Music] hello and welcome to another educator live stream for unreal engine we are very pleased today to have special guest mohamed moin and today we're going to be talking about python understanding and teaching python inside of unreal engine which is really exciting this is a stream that i've been really looking forward to and a special guest that i've been really looking forward to having on the stream and as usual we have mark flanagan here from the united kingdom and you can tell it's a little chilly everywhere because he's wearing his nice hoodie and we've got tom shannon joining us uh today from a very special place colorado he's usually here in north carolina but actually here he's chile also in colorado and muhammad joins us from montreal and it's really a pleasure to have muhammad we've known each other for quite some time and we've worked together on a number of different projects and we've corresponded on a number of different things worked on some great learning material and you know mohammed's a as it said in the intro card uh a epic grant recipient but also a mega grant recipient and i think uh you know before we get into it just introduce yourself and tell everyone on the stream a little bit more about yourself and you know your development background and some of the stuff that you do you've got some great websites you've worked on you're an author you are a programmer you're you know a game developer you do all kinds of things but you know tell everyone a little bit more about yourself in general and then i'll get into all the things that i like about you awesome thanks for having me today uh my name is muhammad i'm from egypt i started programming in very early age at the time i was not very good programmer uh i i was programming for uh or just just applications and one day i i wanted to work on a game this is how i started my journey with game programming at sometimes you weren't any engines or anything so the way you do it is just c or c or visual basic it was doable at that time this is uh 1990 something and from there i start learning by myself until today like 15 or 20 years later i still learning by myself i work within quite a few companies uh mostly as a programmer sometimes generalist programmer lots of times engine or tools programmers sometimes technical direction usually i don't care about what's the title as long as i'm going to do lots of fun stuff my journey was unreal started quite some time ago was unreal 2003 for a company called the spicy horse i uh at that time i really really liked unreal engine it was a very big wallet for me i started learning a lot of things and a lot of things about game creation and the game engines i learned it from the source of unleashed one on windows 3 and when epic uh put unreal four uh publicly for free or for like 11 or something i was almost the first person to buy i i purchased day one and within a week i start putting videos of my findings like you having the source code between your hand you can learn anything you can do anything so i start digging in the source code and make tutorials and videos and articles and tools and lots of fun stuff and this is how i learned it by soon as well like one day i found uh about python api it started to show up on the github source code and i was like oh what python in unreal so i start tracking this and i keep my eye on this and uh and compile it the version of the engine and it just started with it and we are here today to speak about pythons unreal fantastic uh and you know i think um gosh how long has it been like four or five years ago we started communicating uh i remember you you know you've been an author you you uh [Music] tell us a little bit about the the work that you've done as an author too yeah so i uh okay this is funny because uh i never thought about writing books or anything but uh like the first months of uh unreal for like argued 4.0 or something i saw there is a hidden plugin called paper 2d and the name caught my attention like what what is paper 2d it was like hidden in a folder called experimental so i made a build for this and start looking at it and then oh i can make a 2d game was unreal right away i started recording some videos and put them on youtube if you find this is probably the first 2g use on real uh video series it was uh april 2014 or something same same months as uh as a release and from this tutorial i got the publisher contacting me and say hey it looks like you digging too much into unreal are you interested into writing a book for this i said yeah why not it sounds fun so i wrote a book for ios game development was unreal at the time i still a mac user so i have iphone i have whatever whatever devices and it has accounts revision files and have everything set up so i can make the book happen i spent some months and i learned it from from the publisher i learned a lot from them about writing about how to structure a book how to really really make educational material i made a lot of mistakes and they were patient and they forgive me for that uh and because he forgave me when when time came after the release of my first books he contacted me are you looking in to write a second book so i said oh okay yeah i have two kids so let's make two books so i wrote the second book uh which is uh unreal rendering essentials and then after the release it's been like one year off and then they contacted me again at the time i had another kid so they asked me are you interested to write a third book said yeah so three books for three kids and i wrote the mastering unreal engine c bosmos yeah yeah so you know what uh what i think was important you know to me is that uh you know back in 2015 and 16 uh i was working in education with unreal engine and um i was visiting many universities and you know helping universities develop curriculum for unreal engine and and back then there were just not a lot of books uh available for universities that wanted to uh have books you know for students that were learning unreal engine so i remember getting my hands and reading um lighting and rendering essentials and mastering unreal engine and these were some of the books that i really enjoyed and liked you know to recommend to people because there was not a lot of material right after unreal engine 4 launched to help people to understand how the unreal engine render worked you know physically based lighting and rendering was still something that in many ways was relatively new uh we had of course our documentation uh which was you know has matured and gotten better and better and more robust over the years but these were really helpful books and it's one of the the places where i became familiar with your work uh and i think one of the reasons that i started reaching out to you initially was like hey you know this is really helpful material and i've been recommending these to instructors when they say well you know where do i get material to present to my students especially since you know back in you know these days there's a wealth of material and online material and it's easy to tell your students to go get online material but even as early as or late as 2015 people still really liked a lot of physical books you know to get their hands on i think things have transitioned a little bit more over time where people prefer online learning resources and you know justifiably they're easier to update than you know and they you know they kill less trees maybe uh and you know but still a lot of people like that physical artifact they like to sit down and leaf through a book and i know i still like to have a physical book to look at and these are still both fantastic books there's still lots of great things to learn from these books and i strongly recommend them because they still are very relevant and a lot of the foundations that you lay out in these books are really good so for anyone in the stream who still likes a good you know artifact a good book to to read i encourage these books because there's really good fundamentals of understanding lighting and the rendering of the engine even though i don't back in 2015 that must have been what version of unreal engine 4 was that for lighting and rendering maybe like point seven or so four point seven because unreal came out for uh uh 2014 so it was almost uh a year old i'm sure they've asked you to update them quite quite a few times we came a long way we've come a long way that uh you know at this point is almost 20 versions of the engine since uh that original book uh you know but i think that's a testament right because since then you have built websites you have also built uh some additional great youtube resources uh another thing that we communicated about is that you built a i think it was like a 27 video series about building a tank game inside of unreal engine which i really appreciate and really like because what what you did is you built the same game both in unity and unreal engine and you sort of showed the path to building both games in blueprint and in c-sharp which i thought was very very intelligent very clever because uh for anyone at the and this was probably two years ago two and a half years ago it's been it's been a while since uh you've done those it's even longer has it been longer than that it's even longer it's a tank game yeah right because there's a lot of people who are like well i i understand how to do things in chi sharp but i don't know how to transition those skills into blueprint and so i thought that was a very clever series because you were very helpful in describing that process of understanding what you would do in c sharp and what you don't necessarily have to transition immediately to c plus plus but instead can transition directly into blueprint and and i still think it's a very helpful series because there can be misconceptions specifically for programmers that they have to take everything they do in c sharp immediately into c plus plus can you just talk a little bit about that before we get into the python uh discussion yep yep so one of the things that sold unreal for me unreal for to to make the switch from any other tools i'm using like i used to have my own engine believe it or not it is not that great of an engine but it can handle some 2g games but when i found blue brands like i thought for a while if i have a full-time job and i work for a company and all the day i'm writing c plus plus when i go back home i don't need to keep writing c buzz plus i need a break i need to prototype something quickly i need to test something i need to try out new things if i'm going to do this receivables plus it's going to take a very long time and this is what actually solved the blueprints for me yes i'm siblings programmer but when when i start like putting the fundamental uh workflow for myself i said okay the big things i'm going to do in cblos plus and then expose it to blue grips and in blueprints i can use this to prototype quickly super quickly uh back then when i used to use c sharp and things like cocoas or any other tools and like github now have lots of free engines when i used to use those things c-sharp was was really fun because it it is much faster to write and it's much faster to see results than c plus plus but then blueprint came out and then i found blueprint itself is faster than the fast solutions that they used to use with c-sharp uh so i started using blueprints and this is actually why i went into the road of python was unreal because i do need to write tools for myself most of the time like working while working like i think it's a habit for any programmers that if there are some things that they need to do more than five times then it's better to write for this right yeah right yeah like it's fun and faster to write rules but at the same time if i'm going to write every tool i need in c plus plus it might take some time sometimes uh i need to whatever i need to write i need to to add it to the engine itself and we'll see in some examples today for some things that really requires the engine source to be recompiled but at the same time i don't want to waste my time like you compiling especially i have a very cute little pc here that uh go crazy and make too much noise and it cannot be usable when you compile any c plus plus right uh yeah so yeah that's because this was the selling point for me yeah it's here my q pc no that that's an interesting issue is it really that you compiling requires kind of a a decent computer or you're compile times get very very long and for folks who are you know you said you started running on a mac um and even now you know a lot of us are running on laptops or underpowered computers and stuff and and not having to compile code is is a big deal because it's already done yeah this thing is yeah like the thing is like when you work with c plus plus mostly for companies for example you work at epic if even if you need to compile something you're probably going to compile across the network so we are going to use the power of other 500 pc so you might compile the engine in 10 minutes who knows but yeah if you need to compile a loan at home no network just simple pc so it's a it might take quite some time so you need to find the solutions you need to find ways and i found python like let's say 80 percent of the tools that i need for my productivity can be achievable with the python api exists with unreal engine uh so yeah that was the reason i choose blueprint and later i choose python for tools with that said i still do lots of tools with cbs plus because python first it is not not every single exposed for python and second what if you need to introduce something new to the engine because at the end of the day what the python api and audio does it is communicating to the close bus right what if you need to communicate to something that is not actually exist you need to make a new asset pipe you need to make something and then okay you need to take your hands dirty and go to do it in c plus plus way yeah yeah uh so one thing uh before we get you know deeper into python is that um you you contribute you know for those of you who are not familiar when we release a new version of the engine the first paragraph of uh all of our neets notes typically mention all the contributors to that release of the engine so you can see that many people who are in that first paragraph are not always members of the engineering team at epic and and we do a lot of polls from github and and people who are contributing to a particular release of the engine so muhammad you've been on a variety of different releases of the engine you've contributed to the engine uh how many times would you say absolutely yes even before 4 10 or something uh it started with uh small things and it grow with was the time you know like some people have hope he's like swimming some people have hope is like cycling but other people have hope is like fixing bugs so it's fun to do yeah so you know it's a good way to learn a lot about the engine actually right of you know for any of you who are watching the stream today who are programmers know that it is always an option for for non-engineers working on the engine to contribute to the engine and and to be able to do that and we probably should you know do a stream specifically on that because uh you know we have educators uh university professors who contribute to the engine as well uh but so let's dig into you know today's topic specifically you know python is still uh considered an experimental feature of the engine um you know and that means that it is still in early phases of development and it's not been uh officially titled uh a part of the engine which means also that it is a plug-in in essence that you have to enable in order to use the feature now to clarify that that doesn't necessarily mean that you have to that it is not a native part of unreal you know there are many features of unreal that are plug-in based which means that it's not part of the core executable executable but that it is you know part of the engine it's just a module of the engine that you have to enable but it's still an experimental mode but it's been in experimental mode since version 420 so you know it's maturing very well and now that we are in preview 4.26 you know it's been in experimental mode since you know for six versions of the engine so it's maturing really nicely and you've been working with it since 420 is that correct as soon as i found it i believe it it probably could be earlier than 20. it's uh it's two years for now i think two years i can't remember the exact number yeah i think i released uh the freeze like so while while learning i start to build some tools and then when i found i have like a group of tools that is not project specific it is not specifically for my project it can be used by anyone for anything so i gathered them and put them in a github story for free uh this was like a year and a half ago right uh so six months earlier it started right well so you know what's kind of interesting is that um if you if you're going to github and actually getting the source of the engine there are things that that you can start working with even before they end up in our release notes and people can sort of you know so uh if you're compiling your own version of the engine you may encounter things that you know are there before they are officially announced in our release notes so i think one of the very first mentions of python in an official capacity is in in the 420 maybe even 419 but i think the first time that there's official mention as far as i can see is 420 of the engine but if you're actually working in the source code on a regular basis you may be able to find that there were ways that you can access python before 420 and you know that is a for those of you who are actually working with the source code you know epic is very transparent and you go to the trello board and you can find that there's lots of things that we're working on that actually are in the source code but um so it's still though considered experimental uh and you have to enable it as a plug-in which i'm sure you'll cover a little bit later on um so you can run python in many different ways though right so you when you enable python you can run it of course inside of the editor but you can also run it as a command line and there are command line enablement so that you can run it in many different ways because python is very much a pipeline tool and it can be used very much as a pipeline tool i think that that one of the the reasons that it was brought into unreal is because there are many uh industries like the film industry and of course the game industry that loves to use python as a pipeline tool to help implement pipeline and i think that's one of the things that you really talk about in the course that you developed for python is that you can use it once it's like you said to not do a lot of repetitive tasks but also you can run python as a startup tool and you can enable it in the project settings as a startup tool and do a lot of things that really uh help if you're building you know custom studio versions of the engine where you want things to happen at startup or you know can you tell us a little bit more about sort of running python uh and other ways to do it that way so shall we start with uh like a sharing screen sure yep okay i share this screen so can you see it yes okay so i uh i'll be creating here an empty project it's third-person template just to test out our stuff everything as it is and it's create a project uh by the way i'm using 427 which is uh because i'm using the github source so if it crashed or you see some things that you don't you are not familiar to see this is because it's 427. also if you see something not familiar because this version also have like it's my personal version so it has some modifications and i'm using it to show some stuff i modified for the python plugin to to use it for my own projects so hold on just a second here if i may interrupt the rest of us plebeians out here are on like 426 preview three and you're already living in 2023 [Laughter] this is this is the power of github everybody and i just want to know what's the future like well and this is what's cool is this is like bleeding edge internal at epic when we have changes we push them up to these streams and so you're working like either the same day or a couple of days behind our engineering team so if you really want to see what's next in unreal get on github and and you know start around like like you have it's uh it's pretty amazing like yeah i i didn't this is one of the things actually thanks for that announcement as there is and this is actually one one of the things that i i found on investigating and studying right now i found it uh in two seven so um i'm looking at it right now it is a new tool uh i found in the source but yeah back here so first thing to do if you need to use uh the python plugin is just to enable the plugin if you go to the plugins and in the scripting you need to enable the python editor scripting plugin as well yeah here it tells you that it is experimental or better and then yeah it's at your own risk and yet i didn't find any problems maybe one percent of a problem but i it is really really smooth and there is no issues uh i say yes and you need the editor scripting utilities because we need to do some work today with the editor as well and for sequencer and movie render pipeline it is things if you are going to make tools that is touching those parts of the engine like if you're going to make a tool that is automating stuff in the sequencer so you need to enable this so uh you enable this part of the api just in case and this require restart it is very quick thing so let's do it i have my project here it's very important because we need to see something in the project file here as soon as it show up if you go to project settings where you have all the things for your project there's a section called the plugins a new section show up which is python don't panic if your version doesn't have those those are things i have added for my own engine version but what we need to do here is we need to enable something called the developer mode why you need to enable the developer mode if you look here into the intermediate uh like next to your project intermediate folder there is nothing called python here if we enable the developer mode it requires a restart and as soon as we start there is a new folder will show up here which is very important for you if you are going to write python and you need to write it in an efficient way give it the time and then you have something called python stuff and in this folder there is a new file called unreal.qi what is this for people who are not familiar with python just the second i need to open it here okay uh this is a very large file as you can see even my my mouse can scroll you see how large it is this is what i call a definitions file this file contains all the definitions for all the things that are exposed from the c plus plus source to python api uh if you look to older versions of unreal i i will be uploading a video later today on my uh my channel showing comp there is a like i'm comparing an old unreal stop file or definitions file from the very very very first uh versions of unreal and with uh this one this file is already 13 megabytes which is a huge uh vertex file and in the very early stages of unreal python api it was like 100 kilobyte and the file was way smaller than this for a quarter if this tells you something yep yep if there's still something it tells that there is a lot of working progress happening in this api and every day there's a lot of stuff being exposed uh to make it usable so to make the use of this definition file you need to add it to your ide this is very important for the auto compilation when you write code just do not write while just just blind you don't know what you are you're writing it's this file makes it easier for you to write the code this file usually i'm going to use ui chart so if i look here this file goes to the installation of pycharm system and then you put it wherever the version i have several versions of phr i put it in all of them and this makes the definitions or makes my ide can recognize those uh unreal definitions uh the other thing important thing about this developer options that we enabled here in the python project settings this will allow you to get more uh console messages in unreal editors that tells you when you make a mistake or you make something wrong it's going to show you what actually is the problem it is like when you do an issue with c sharp or c plus plus and then the compiler or visual studio tells you what is the issue this is the same thing but it's in unreal so it shows you here in the output log what issues uh you have and this is very uh helpful so i'm going to open uh my py charm here and i will make a new directory for this stream just quickly make a directory let's stream and here let's start adding python files i will add a python file and let's call this one loger the very first thing you do and the most important thing in any programming language is just logging stuff to the console uh this is uh step number one write something for unreal you need to import unreal which is going to import you see here when i when i write uh my ide can now recognize there is something called unreal that i can import and in this unreal i can say unreal look when i say look it tells me you wanna log or log error or log warning or whatever so i say just look and old school running this can be done in many ways one of the first ways i can do i can get i can browse to this file join explorer i can get the file name or basically the file name and file directory and come here to my unreal and here in in the output you have different options for the output command or python if i'm in command i say i want to execute python and this python going to be this file so it runs a python i see this green line which means it runs this file and then my file has this log python it say hello world so the same thing if if i go back here and say okay it's unreal look for example warning warning and may be [Music] real error see the difference this is how fast it is i i just threw the thing here i can come here i can execute it oh don't forget py the file and then i have all of them this is the difference colors are important when you log stuff so if i'm going to do this this is a very simple tool if i'm going to do this with class was it's going to take at least 5 to 10 minutes to make the header file to make the source file to make the plugin file and to compile everything and to go back to the editor and to use uh this basic tool uh this is one way to run it uh the other way to run it i you see here if i put the python file the directory a path and then i press enter it is not going to recognize this because every time i'm in command i need to write py first but the output log have different modes you can switch to the python mode and here right away you can put the file name and then it's going to run just in case another way to run this is from file you can say execute python script and then you locate your python and then you execute it this is this is a couple of ways of executing uh python and one thing to mention uh unreal is using i guess 2.7 bison 2.7 and unreal have its own python which means you don't have to go to python.org and install python so for example i have here different environments on my pc this version of unreal is this one so if i open here this is my my unreal version and i search here in in this engine folder for python.exe i get this one if i run it so this is the interpreter for python of unreal but at the same time i have my own python here python i have two different versions of python installed this is 3.7 i'm going to run it this is its interpreter and 3 8. why i'm showing this okay i have a package like recently i installed the package called numpy i i installed penalty of packages but when you install a package the package will be installed for your default environment which means if you're unreal script you going to use a package with unreal you need to make sure you install the package with the unreal uh version of your python so if i'm going to 3.7 where i installed my this is my 3.7 it's where i installed uh my package if i for example say uh import [Music] numpy as mp then i i get no errors because now my pyson 3.7 did import this but if i try with 3.8 where i'm sure i didn't install this give me error it's a there is no module called numpy and because i installed it in my version however my unreal uh despite my unreal is is my pc and like what i won't say is that unreal is using its own version so i installed here but it's not going to go to unreal anyway so if i done was unreal like import lumpy as mp also it complains that is not exist so what i mean be careful that unreal have its own version of python if you need to add any modules or import or like extend this you need to do it here in your engine version of python don't do it with your default python environment that's very helpful this is yeah this is how we we can uh look something other thing we can do like uh as we mentioned ways of running scripts there is something if you notice in the project settings called startup scripts and startup scripts is an array on a list of scripts that you need to run you need the editor to run as soon as editor started and before it start ticking so for example if i i have here my project i'm going to close a project and i'm going to open it again you'll see as soon as the project open there is nothing uh unusual happen just open i see here all the the usual loading messages but if i go to here the project settings and within the python settings i add to the startup scripts myscript this script then as soon as the editor it will ask to restart as soon as the editor open it will search for this file and then will execute this file and then we get the three messages here so it's after the editor did launch and before it start ticking uh okay so now we do this but it doesn't look good and it is not usable what if we shares a project with someone else he doesn't have necessarily to have this long pass what we can do here we can just put the name of the script and this is another way of executing scripts or spyson but we do something called additional passes and additional passes is whenever you try to run a script unreal can't recognize this but it knows that this is a python file it will go to the additional passes and then it will start searching for this file if it find it it will execute it if it doesn't find it it will show you so if i put here an additional passes and then i browse i can now browse to this stream folders that we just created and we start this additional passes anyone can change their own additional passes it it is fine but the core element which is the script itself it doesn't change so here it ran it so there is many ways to run python scripts and those are the most common ones so again to be be clear python scripts run both outside the editor inside the editor and but not really so much during gameplay like blueprints and c plus plus mostly do they're they so just to be clear that really the intent of python is not to replace blueprints or c plus plus for building game code but it's really for all that stuff that you do outside of the game uh working with the editor and working with your assets and working with your different applications or python is really cool because it it works in all of those applications presumably yep it is meant to be an editor thing only and we will see in some examples later on that we can do things at the game while it is running in editor but if we try to do the same thing while the game is running standalone not everything going to happen as long as we including uh or we importing uh an editor module so we can go with another example for assets for example show as you mentioned it works with assets so let's see how this can work with assets i'm going to start typing here let's make a new script new price one and let's call this yeah it's python file of course first set okay first thing first import unreal okay we need to deal with something called global global editor utility base if we are going to work with the editor we need to work with the utilities class we need to deal with something here with the content browser so if we look here into the documentation which is very great reference this is a python api documentation by the way it looks strange but it is really helpful as long as you search for what you want so i i know that i need the global editor utility base so i search for it and then it showed me this is the global editor utility base it have lots of functions that can handle lots of sensitive stuff in the editor what i need i need to select an asset and then uh a bunch of assets and then just check some information about those assets because later on this is a core uh this is a core of manipulating assets you can get them and then you can query about their information and based on this information you can do it if this is an asset is not used okay let's delete it if this is an asset that should be duplicated it should be moved to another folder let's automatically do this so in in here we are going to search for for example get oops selection or get selected so you find right away it tells you there is a get selected assets and this is going to return you an array or a list of objects so what we need to write it's basically unreal the global editor utility base don't get selected assets it is the same way you write in any programming language so i'm going to come here and before i i i use the global editor with database i will store it somewhere so i say unreal class cluster and i'm going to call it editor details and this is basically the unreal global editor utility base now what i can do i can say a new variable hold for example selected assets and this selected assets is basically editor utils okay can't show yeah it was loading get selected assets so now what i know is that this is an array of a selected assets and in order to make sure that this is correct i'm going to loop through this array i'm going to say four sit in elected assets and for every asset for example let's use zoundry look the things that we already made unreal.log but not hello world we're going to say the asset if we look here like keeps up the api you reference for everything here it say it it's going to return you an array of objects so what is object if you open this object you see it is something inherited from object page what is object page oh okay this is a page object that every single unreal is inherited from which means anything you're going to deal with in unreal have those functions so you can get the name you can get the full name uh you can get the outer like the package you can get the pass you can get a lot of things so i'm going to say this asset get it should show up go to completion okay f name example real the plug only that we can get one more funny one it's very useful and i count on it a lot as a class that class which tells you what classes is because sometimes you can create a very modular script python script and this can run on all the assets and paste on the assets if it's animation assets and do that if it's a blue branch and do that if it's a texture then delete it or do whatever so you can say unreal.log and because it's a loop we're going to [Music] just return floating under the clock to add like a brick or something in all of them now remember we already added uh an uh the additional passes like into the python script and we can right away just type the name of this script and it will run uh right away so i'm going to just quickly show an explorer username come here okay let's select something maybe mannequin animation select all of those from a ps3 and then we can right away here right key y our script right and boom it's a syntax error and this is why unreal uh output look with developer mode is very important it tells me here there's an issue with line number four it tells you exactly where the issue is and if the issue is with uh the components that cannot be casted to another component or something cannot be acid it's going to give you all the details so you you're trying to cast this and it cannot be casted to that which is very useful so we'll come here line number four and we forgot this which is a python thing again py just a script run it this is what i'm talking about it gives you selected assets in this line line number seven object needs an argument global editor utility bids okay let's come here outline seven okay selected assets yup yes now it ran it get all those so you see like there's four four uh four parts every asset it tells you it's animation blueprint this is a pass uh its name is third person and bb and all the information we ask it for wearing the information is a key to start manipulating and working with with assets and and do lots of changes on those assets is that clear any questions looking good not so fun yeah that's awesome let's go ahead to another fundamental part of the editor scripting which is creating us so now we can query assets and based on this we can start later like modify them rename them uh assign a texture to a specific material or something like this uh replace assets but let's see how we can create assets because this is touching another important part uh people who work with the c plus plus source are familiar with which is called z factories uh so it's important to work with those factors who know how this is working so i'm going to create a new script i'm going to call this one uh yet asset and of course we're going to import unreal and we're going to create a new asset so this asset will need a name so we'll call it for example i'm going to create a blueprint so call it blue print name and equal to something like this and then this asset need to be located somewhere this blueprint i need to put it somewhere so you can say blueprint pass and this will be where i'm going to put this asset i'm going to usually people putting stuff into blueprints folder inside the content but we don't have one we don't have to worry about this because if we said this blueprint is located into the content folder inside the subfolder called bluegrand andrew we're going to create this folder for us and in python api this content folder it's not actually called content it's called game if you you see it as a content but if you hover your mouse you see like the tooltips say it's game so it's important to know this content is game so i'm going to say i'm going to put my my new asset into inside this game and inside do something like this now i define it the name and the pass for the assets that i'm going to create how i'm going to create this as assets are created with something called factories factory is like a factory in real life the milk factory make milk uh cheese factory make cheers same thing if you're going to make a blue brand so we need a blueprint factory so just right away you come here to the python api and we search for blue trend factory and then we get a lot of blue brand structures there's a blueprint factory there's an animation blueprint factory everything you can create in unreal have its own unique shock result if i open this bluegrain factory it has a function called create new and this is what we are going to to use so we need to use unreal dot to branch factory so i'm going to store this into a variable i'm going to say my factory or factory equal to unreal dot print factory so now i have the factories that i can use to create assets okay when you create a new blueprint usually you right click you say blueprint class so you now say i need the blueprint factory to create a blue branch for me and then it asks you pick a parent class so we need to simulate this step of picking a parent class and this is in blueprints called settings apparent or set parent or set parent class if i create one of those here for example this actor and i open it first thing you see here it's called new blueprint but its parent class is actor so we need to modify this or we need to decide this before we create it so we come here we say factory factory is an object is an unreal object as i mentioned everything is inherited from unreal objects so if i press here on the factory it's inherited from object and object is inherited from object base and object pairs have something called set editor properties or set editor property so we need to set the editor property that is called parent class so if i get this factory and say set edit property the property name that we need to set is parent class and we needed to create what type anytime example actor character player controller anything so let's create a player controller i go here and say i need to create or is the parent to be unreal dot layer controller now i i i choose my factory i prepared the factory and told it what actually i need to do but i didn't make anything else so i'm going to say acid tools this is a new variable equal to unreal but set tools helpers and this is important one to be used when you create stuff if i go here to the api and search for the asset tools helpers i guess the acid tools helpers and there is something okay i get here is asset tools helpers this is asset tools and here we need to find create so create have something called create asset and with create acid we define a name which we already choose here we put a name here variable and then we define a package pass again we define we created a variable to hold our path and then the class the factory the class we're going to create a blueprint the factory we already created our factory and prepared it and told the factory we need this specific parent and yeah we leave this as one yeah so this is the thing i like about this api it's very simple and it showed to you exactly what you expect you can sometimes copy the entire line paste it in your code and just modify those parameters and it tells you if there's a return what is your turn type it's very easy to read if you are not familiar with python or even if you are new to programming it is not like uh the c plus plus one for new beginner for the beginners and new people who come to the class plus and want to write tools they find it overwhelming and huge and complicated it is not complicated if you are familiar with the language itself uh but it is big it's a big engine so things are huge anyways so we need to use this create asset so we got here the acid tool helpers i just needed to get acid tools just get the references as if tools and then i say my factory let's finally initialize this factory [Music] uh that's the factory wi-fi my asset or something like this this equal to the new function that we just saw as it was a create asset and create as it needs the name it's a blueprint name and needs here this is uh the use of the stop file that we show how to to generate first it shows you a tooltip what about the parameters that you need to put it tells me that i already add this asset name i need to add the package pass now uh so blueprint pass it tells me i need the asset class skip this one and tells me i need the factory we already have the factory and just a second now we create a file and i think it's good to go let's just try to see if there is any issues what is the name of this file now it's create asset so we come here we can run the script right away or we can from file which is my favorite way execute create asset and then suddenly we had a new folder called blueprints and if you open it it has [Music] the streaming blueprint which is paste if you hover the mouse it says apparent class if you can see it like the third line current class is player controller if you would change this and you change your mind and this is a c plus plus two you're going to take quite some time to change this so i'm going to show you how fast it is to change this we don't need player controller we need the game mode it's game mode right away uh maybe it's a good idea to change its name as well something like this too just change it right away i can't then run the same script it created the game mode right away i i didn't have to compile i didn't have to waste time i don't have to do anything okay what if i give this tool to the artist or to whoever designer whoever the person is going to use it and say okay can can this file instead of having the store can it automatically save i don't have to waste time to do this i can come here and basically oops wrong one i can come here to the api and i can search for save loaded for example it is still in the editor asset libraries that we use it's called save loaded asset and we pass an acid to it and we give we say only if it's dirty or no it's true by default so we can come here and say unreal it hit your asset library dot save asset what asset we need to save it's my file the file that we just created and i'm not i'm not going to put true because it's true by default so now if i delete this two files i run it it creates a file and it's automatically save oh okay it has an issue it's a line searching okay blueprint as a string okay where it is here my file okay it should be fine edit your asset library same asset okay i think it was not safe as it were to save for the asset there is another save asset somewhere no not assets accept because you can pass there is a two versions of this function so you have loaded asset and save loaded assets here you can pass uh a one object and here you can pass an array of elements so if we run it again it creates asset and save it right away select the parent do everything quickly imagine you need to create lots of assets lots of types lots of things if it depends we'll see later uh when we create a streaming world and how we can create a streaming wallet uh very quickly well good yeah amazing awesome okay but we don't need always to create the same asset like we come here to change the name which is kinda boring what if we need to make it easier we need the user to define what name what number of assets here here is our the file create one asset every time we need to create another asset we have to run the file what if we can give the user the ability to define the name of the new assets as well the number of those new assets or maybe is uh what classes or what what whatever we can make a use of something called arguments or command line arguments for people who are not familiar with this basically when you launch a script in python or even when you launch an exe or any application you can pass parameters or arguments to this and this can be used inside for example you can launch unreal editor which is this editor and pass it a command argument called game so and on a project and then it is not going to open use this editor that you see but it will launch the game itself so we'll see how to do this in python i'm going to copy this entire code here because we're going to create assets so instead of writing gold from scratch we can paste on this so i'm going to call it caps acid with args and we're gonna paste everything it's still important rio still we have the same name still we have uh [Music] put them into the same folder uh but we need new stuff here we're gonna keep the factory we are going to use the factory actually and we're gonna define what is the number of assets we'll be creating and what is the name so we're gonna say created assets count is equal to because we need the arguments that is going to be passed to this python script we need to import something called says which is system basically uh this equal to the first value the account is going to be a number so it's system dot our human number one arguments starting from zero it's like any array indexing it starts zero one two three but always in in i think in all software uh uh engineering languages is uh the item number zero is going to be what is running so if i'm doing this with unreal uh the argument number zero is going to piece a pass for unreal exe if i'm doing this with python script the argument number zero will be the python script pass and then we're going to do another one which is the name we need to pass a name so name and this will be actually string and this will piece argument number two but this mean every time we run this all the assets will be created will have the same name and this can lead to conflict for example because remember now we are not using the right click menu if you are using the right click menu i can say a material leave it when i right click and say another material and we will be smart enough to pick a different name for it because it knows that there is one already with this name but when you use python this is not actually the case you need to define names uh carefully uh in order to avoid issues so i'm going to say here is like a number so which means that we are going we are going to replace this value with a number later on now we have the factory it's the same factory we have the parent class same let's say we're not going to make game modes uh right now let's say we are going to create characters we have a game full of characters full of enemies full of stuff and then the acid tools it's still the same but instead of creating the file we are going to make for loop so 4x in range what is range what what is the number of assets we want to create it is actually the created asset count it's not semicolon and then we create the file and then we save it instead of giving this name which is which is [Music] that one uh we are going to use uh that thing that we have created here we're gonna use this and we say percent and what is what we need to replace this d was is the x x is basically a number everything remains the same so now if i runs this script it give error if i don't pass to it a number of assets i need to create and if i don't pass to it uh a name of assets that i need to create so i'm going to copy the name of this guy create assets with arguments and with this way if we have arguments we cannot run from here because if i run it from here it expects some values and it won't find those values and it will complain to me okay but i can run it from here i can say python yes i need to create 10 assets and all of them called uh ap mbc like nbc's right away i have nbc's 10 npcs all of them have the names that i choose and all of them have uh like indexes it's even more fun we can take this to a whole new level we can make it easier than typing here we delete everything here we come to the content browser we create a editor utility widget let's call it uh mbc not npc on like assets ether now we open this assets creator we come here second we had a button and there is a text on this button and maybe oops we for example say it and then we add here a name we need to define a name for those so we're gonna search for text text box give it a default value for example my set and we need a count like a number so we can add the slider for example for this this slider will be taking one tick we can have up to 1000 assets who knows and minimum value is one asset and just we're going to add a text to display what we are doing in here so i'm going to add a text here and i'm going to pine this text to the value of this slider so create binding and then we're going to get the slider i'm going to get the value we're going to hook it here when we p we need to truncate first because it's a float so we need to truncate this value so it show up as a string as a as an integer and now when we press create this is the cool part we need to just simulate the process of writing something in here so we're gonna say uh execute console command and this command will be as follow i'm gonna append this would be py as we used to do it followed by space followed by the script name followed by the arguments space the first argument is here the first argument number one is the number so it's basically is this a slider value we're gonna get value and we're gonna truncate this to make sure it's an integer and to string and then it's followed by space and followed by the other argument which is the name i'm gonna get this text box i'm gonna get value oops get text and put it here if everything is right we should now be able to right click here say run editor utility he opens this folder i say i i i'm gonna call my assets characters zombies whatever and then i'm gonna create 194 one of them and unreal will do it it's very easy to hook a python script with the ui with the umg and then you have everything created sorted renamed and just ready to use of course if you are going to make those like all those zombies uh variations uh based on uh on an nbc class then you don't you are not going to define the class here as a character and then you are going to define whatever class you are going to use for this but it's very easy to connect things with umg to make it more modular we can even add a new attribute here to define what class we're going to create so we can even uh define the class from here and we can have as many arguments as we want like the maximum number of arguments i needed in a script was 10 arguments and python never told me it's over limit or something so we can do a lot of stuff with with this workflow that is super cool that really is awesome it's it's like uh it's one of those things where each piece is kind of like uh-huh uh-huh and then you put it all together and you go oh whoa there's all the things i can do with that oh because you know up until that point you're like oh i don't want to have to type in the python thing how am i going to teach my students to do that um and one of the questions that came up here was like you know what's a practical use for this and you know obviously in pipeline there's a lot of practical uses but i wanted to address as an educator as a teacher um learning this sort of stuff can help you in deploying your lesson plans when you're teaching interactive stuff you can you know create tools and workflows so that your students don't have to master all the complexities of whatever it is whether it's you know submitting source control or even just naming objects the right way or whatever you know i've seen teachers who uh have scripts to to set up the folder structure for every project so that when the student starts they just run the python it they say what's your project name and it builds the folder structure so that every project looks the same so that you know if you're grading 200 projects it's nice that everything's in the right place um and then even then you can use script if everything's in the same place to like pull out certain assets or you know just validate that they created whatever it was so um you know outside of the that like production workflow in the classroom tools like this are really really helpful and uh i'm always impressed with how teachers kind of take these and make these really cool workflows and even i've seen entire like grading goods examples for this yeah i totally agree a really good example for this when i create like as as as a person who create projects to share with people so they can learn from those projects sometimes but sometimes lots of the times when i create a project it starts as a prototype so you don't care about a textured name you don't care about an object name you don't care sometimes you don't care where you put assets you have textures next to materials next two meshes but later on you need to deliver to those people something easy to understand and this is why there is some some assets here like there is a some scripts here i made them put in github there's one called organized assets per type it put all types of assets in one place or prefix all assets for example it search for all for example animation blueprint or animation funds and gives them a prefix anim or if it's a blueprint give it a prefix pb or or if it's a particle system or niagara i'd call it fx this makes it very organized and then you can distribute all your content as you mentioned already all the projects or the educational projects are distributed have the same uh i call it as the same blood like they feel the same like when a student look between different projects they don't feel oh this is organized in a different way or a naming convention here is a difference in a name and conversion there but having such a script creating such a script you can organize all your projects quickly like just like this yeah let's take one step back and share everyone your github because uh i don't know that we formally shared with everyone that you have a github with already a bunch of assets i know it was put in the chat but uh yeah this is a really valuable resource there is a forum post here as well for it uh maybe the past is very long for this but uh yeah it's in the python it's in uh it's in the editor scripting section of the forums it's called free python scripts library and uh when i was doing those scripts i used to make small videos like those ones like showing how to use each of those like very small like 30 second one minute that's a video showing every script in action how to use it and how to run it and and what is expected result of this scripts so it is uh good to do it's a good thing to check so you share assets in here that people can use immediately like the one you just showed which is great and they're good examples of uh everything you've been describing already give you one more great example yes okay before we make before we do it really quickly there's a yeah sure question that's come through the chat uh people are asking if you can run python scripts at runtime they're asking during game mode but i imagine that's the same question as at run time can you can you run python scripts at runtime you can see we can satisfy people okay let's create one script here one of my favorite uh things i'm gonna create a python file i'm gonna call this a game called iso because i have different uh different versions of game called python or different reasons for a game to call python but this one is a screen shooter because it takes screenshots i'm gonna import unreal as always and then we're gonna use something called automation library [Music] here mission library so this automation library it does automation for stuff and at the same time it allow to do things while the game is running in editor uh and it's very useful for and it's very useful because it helped me to take screenshots where issues happen in my game so you can trigger this if a problem in a game it takes screenshot from you for you either from the player view or from a specific point we'll see now there is penalty of functions here but the one i use is a high resist screenshot which is an equivalent to this amazing ones that i really love and by the way couple of options here i use the one who added them nice power of source code so after importing unreal we're gonna like store the class uh i'm gonna say i like to do this it is not necessary but i like to do it because i like to keep code organized somehow uh because this is also the way i i did learn uh python so it's unreal class class i'm gonna call it automation lib or automation library it's basically unreal commission library now what we're gonna do is say automation permission lib take it with a screenshot which have lots of arguments it's gonna ask me about okay the size on x 20 80 the size and y 720 you can go up to whatever like uh i uh the last thing i tried was 4k and it was fine but it takes quite some time it's basically the same feature same feature uh the same window in the editors that i show you uh we're gonna call the picture uh my fancy picture at one time for example what else uh camera actually for now it's none we're gonna see this later uh none is the keyword for uh for python which means which like null for c plus or something like this uh mask we don't need mask hdr we don't need hdr compression it's by default set to low it's set to [Music] it's easier to copy it from here compression latency low and i have no notes and this is a script to take a screenshot from the editor ui it doesn't look very fancy right now but we'll see why it is fancy when we do it at runtime but i'm going to come here to this uh screen shooter and just py screen shooter okay there's an issue the script it's in line seven we're gonna see what's line seven is automation library take screenshot take high resist screenshot 2080 okay flash why okay another error still on line seven see what the issue has where it is where it is yep information library okay let me piece a picture need a name need a type ng still same thing false false completion okay it doesn't recognize what is compression tolerance is and here it's a error name compression tolerance is not defined it thinks that compression tolerance is a variable and i didn't define it but actually my mistake is i didn't write on real with compression tolerance so i say this compression tolerance is something subjective to unreal so py this enter and then we have the screenshot here this image this is not super fun yet what we can do here we close this grab that we can because every time now i'm going to capture this it will give me the same picture but different view like for example if i'm looking here at this guy i'm gonna write from here faster screen shooter so i'm gonna get this picture from this view if i go here next to this question mark i'm gonna run the same script again boom here this one it's going to replace the picture which i don't need so what we can do is we can come here and we modify this uh the value here and replace it with something like uh the time or the date time or anything okay so we're gonna do here from date time worked with time import the time so we can get the current time value or the current uh value of date and time because if you got the date it is making no sense because it's going to replace the picture again so we're going to say date time now of x or something is equal to the time dot now and then we're gonna convert this to a string so we can use it string from time and needed percent percent day percent months percent a year or probably it can't recognize because the um here and then percent uh what's the hour now percent what is the minutes and what is the second and let's just put all into codes and i hate this visual studio smarter than doing this now we have the date time as as uh as a suffix as a value so we can say this is the name of the image plus the date time or maybe underscore plus the date time plus dot png now when i take this screenshot here i have this image and when i move my camera like here i have another image next to it and so on and so forth so i have multiple images now can we use this at runtime yeah of course why not so what we can do is i would go to this guy this player and let's say every time he jump and he jump consider it every time the character dies or every time the character is stuck for 10 minutes cannot move for 10 minutes let's take a screenshot so very simple as simple as [Music] execute console command with this script name notice this one where it is it's here screen shooter symbol as this so every time i jump i should take a 720p picture screenshot so i move oops stock why because you're giving a live demo yep it has to happen manager responding oh why i have to win this luckily unreal never crashes it just stops responding or it goes away yeah but it's not a crash maybe because this is uh my 7 my 4 27 version oh yes i forgot we are using the the version that we say don't use your version you're messing with the space-time continuum something's gonna go wrong here quantum physics uh pb two brands person so when i jump secret console command this console command that's fine so here okay i jump take screenshot jump take screenshot jump take screenshot you can i i connect it with jump and you can do this the same thing from c plus plus uh you can do the same thing from blueprint anything it's not only taking a screenshot but you because this is python you can include uh you can include uh a library a library like uh i don't know there is many layers like uh skippy numpy pil like fight uh pyson imaging library to start uh do some changes in this images like uh resizing the image or clipping the image or cutting pieces of the image or adding poster processing to the image or adding notes to the image adding some text to the image any lots of things you can do uh with the python libraries and if i come here i have all the pictures and this is python pin called from uh from within uh [Music] the editor uh while running another example i have uh in here actually let me grab it from the other screen okay so here i have this project it's going to execute a script that is searching for actors with a specific tag and then animate them so for example you see this flying actor it has a unique tag oops not components here back it has attack called python can manipulate and at runtime when i press play uh thermal blueprints are resolved okay let's come here just disable those things okay let's just delete everything here for now i was still complaining okay you know what i'm gonna delete this don't need it yeah no time to fix it try and bug me now so if i press play why now so this box is not moved by bluegrains is not moved by uh we see blastblast or anything it is moved by python i just search for specific for static mesh actors that have a mobility that are movable and then i start set their uh set get zero location and change the value by using another function called set location i can find it here and maybe not here yep like here so this actor basically is going to search for this uh this python script is basically going to get all the gameplay actors uh to get all actors of a specific class i set my class uh to static mesh actor and then it's going to validate if any of them have the python can manipulate so which means if i copy this one for example here copy this one and set it to movable so i can animate at runtime and then in the tags copy this tag value and put here gives us like here if i press play this guy will not move if i give its attack actor tag and then press play those will be moving and this is animated from python not from blue brands so this is an example of of like making a benefit of a python script but at runtime so could you package that into a packaged game how does that work it won't work in a packaged game because it use some editor utilities uh the thing is at run times editor utility is uh most likely going to be stripped so you can't use them however the funny things that i found in the source code of the plugin as a python plugin is runtime plugin which means you can with some modification use it at runtime so out of the box right now you you still need the editor because it's got the whole plugin but there's some hints exactly if if you want to get breaks you can play the game but in the viewports i gotcha exactly in the viewport yeah but you like if you want to like move actors and do those things it's going to be naive to try to do this with python when you have bluebrands uh it's it's it's going to be much faster than even learning it uh but you can use the python api to do things like taking screenshots from specific locations like like i showed here we were taking the screenshots from uh from us from from the player location but we can put a camera in the wallet like for example i can quickly modify my script with another version that i have here uh why is this a script with this version and i'm gonna delete those and now every time i jump the image will be taken from a viewport of a camera so if i come here and uh i create a camera like camera actor and let's say this is my overview camera that show the entire level and i come here to the camera and give it uh a tag because my script i i like to to use tags for uh for python scripts so i calling it shooting cam for example so now every time i jump for now it's jump but in in in a game you're testing in editor you can hook this to any uh undesired behavior but now every time i jump there is a screenshot should be saved and looks like it didn't work yep it didn't work uh okay we can't check this later but yeah it was working to be honest screen shooter okay no clue why it doesn't work this time yeah like for example if i come here to the level blueprint open level blueprint and i paste let's say the same node at startup for example uh where's the level 2. disappear after the conversation so the gameplay execute this command maybe delay two seconds or something and then excuse this command this python command so i'm here well looks like there's an error in here yeah it's say editor-in-play mode but uh yeah usually it should work it it was working earlier maybe not in 427 but this was an experiment i was doing into bending the runtime thing and execute python from viewport so there's i can imagine that there's some work going on right now by the development team uh on the python side of things so i can imagine that that as you you know working at 427 there's a good chance that that some stuff is not working as expected currently yeah and this is pretty happy it's worked as well as it has yeah yeah saying this is good for educators by the way to be one step ahead because if you need to teach something you need to teach something unique and something not exist like if you want to teach if you want to teach how to anything like make an android build you'll find the hundred uh tutorial about this but the pissed video was the first one because those this was for the person who didn't find any tutorials and he was digging really really deep until they found how to do it and share it with others so peeing on the master and and trying to get the latest version from the master build it it gives you the opportunity to find the new tools the new experimental and hidden games and know about them and start learning them as early as possible uh this is a really good tip yeah i imagine a lot of the folks that are experimenting with virtual production uh being able to build small tools like this that can help them do virtual scouting and create playback windows or you know i know that i've seen and gone to shops where they have camera bookmark little ui windows where they're like you know we want to set up a shot here and set up a shot there and they have notations and they have all kinds of things that you can write to the screen and and so having the ability to do that in python really quickly and build these little in-engine tools that that you can do in python especially people coming for instance from the film industry that have python knowledge maybe from working in you know maya or something like that and very quickly get in here what i'm seeing you do is that you use the blueprint command tool and the way that you use the command tool is very effective and so is that is that a currently like a best practice that you use all the time that you hook it up to an issue a command that calls the python script yep i do this a lot because uh like tools that you cannot see and you cannot communicate with are not usually very efficient a tool that you cannot communicate with is a tool that is going to do a specific exact task but if you need a modular tool that you can modify then you need the tools that you can see and you can define your metrics define what you need to change what you need to do and i found this is uh can be done with with ui at the beginning i was doing it via slate and cblos plus but found it uh like uh it's killing the point of using python right using yeah you are using python for speed so why going to see blasphemous and then i found that oh wait i can use the editor utility widget for my benefit at this time when i was using the cbos plus saying the edit related widget was not out yet but as soon as i found it and i saw i saw it in one stream or something uh epic were showing how to use it as we did widget i think for me that this can be more useful than what this it was built for and then i start hooking it with what i know about python and and the mix came together and became very useful you can actually in the course uh i show how to create a launcher which is basically a lot of patterns in one window and each pattern is going to show to execute a specific python and this specific python is going to do uh whatever it's going to do so you can have lots of editor extensions and it's hooked into one window you can call it my window and then you create a python to launch this window and then you put this python into your pi startup script so you have a unique tools that you created for yourself let's say 10 20 tools and you have them always launching when unreal editor launched one thing i wanted to mention here is a plugin itself is very fun to work with in a c plus plus level as well as you see here i added some functionalities to allow me to execute python scripts post importing after importing an asset you execute one two three four or whatever and after loading an asset do one two three four or after saving an asset to one two three four and then you can create an asset that renames stuff and you can hook it here for example uh post saving it's going to add prefix then you don't have to worry about renaming files anymore you just import the files if it's a blueprint when you save it it's automatically going to rename itself uh bb underscore whatever name is uh so yeah it is it is uh you can expand the plugin more and once those so you added you added these to the plugin sorry you added these to the plugin ah so if someone were to get this right now they wouldn't they wouldn't see these no it's not in 27 uh yeah it's not in 27 seconds or 26 27 version this is how how it looks when you open the python it's called the python plugins editor settings and here i just double clicked uh another project that is built with 24 or 25 just a second does it show up here my pc is tiny literally my cpu is just this size like but it is powerful somehow so while this is opening for those folks on the stream that maybe are interested in learning python uh and don't know python currently do you have any recommendations for resources just for learning python that they can then apply to um working in unreal engine because maybe some people don't even know python they maybe they've been working in blueprint maybe they've been working on other things there's tons of resources i know jpi reference is very is very helpful like i would say majority of what i learned it was from the api reference is that right and the other part was from what i know in unreal itself like if you are familiar with blueprint or familiar with class plus you will find things here like because you know that when you have an actor you can set actor location if you have uh if you have an actor actors have tags you can get tagged so if you search for those things you'll find them right away or even if you just search for actor and unreal actor then you can start comparing all the things that you have here with what you already know in the blue brands if you are an already unreal user it will be a matter of week to be able to write your own scripts without uh looking on the internet or anything all what you need is just uh this api reference it's very helpful if you need a hand someone to take your hands in you can search in youtube youtube now i i start seeing lots of people start talking about python and start using gap uh starts using python in their api i saw one artist epic shared about before he's an artist he's not a programmer at all he starts using the editor utility widget to create fascinating tools to use in his game uh so youtube have lots of stuff for this uh also the forums uh there is a python or editor scripting section in the forums there it is here yeah this editor scripting section uh people ask a lot of questions about python in this section and uh i i sometimes i answer and sometimes i i go and look for like the good there's a good thing about programming there is no right way to write code regardless it's a python or anything else so it's always healthy and always good to look at what people write so you can learn and evolve your knowledge so this section was mostly about editor utility widget and those things or and utilities but now you start seeing lots of people speaking and asking about python uh this is the project as i mentioned to you this is for 424 or 425 and if you see in the python here you can only have add additional passes and start up scripts but all the other ones here that is uh post import post loading and post save it things that i made because i i needed them i'm looking forward to your pull request on the github so we all get that yeah hopefully soon there is uh like i prefer six bucks new features are tough because yeah i know because you know it's a lot to think about and make sure it works and stuff and and sometimes there is one ongoing actually so like yeah well that you know like really at first you know we looked at this but after seeing your examples of how what python can do and how you can use it and how you can kind of decide to use it in the editor out of the editor it's you know it's kind of its own thing that the editor ties into so seeing how you can you know automate all of that and then you know tie that into these events that happen in unreal in your day-to-day workflow i hope people can start to see how that can unlock like like you said uh you know with your extension there what a cool idea when you import an asset or you save an asset for it to check if it's named correctly and then if it's not just fix it wouldn't that be neat do you have just a general even more fun show you something uh something a little interesting one last thing sure uh if you open here this this level this is actually a big wallet if you open levels you will see this this wallet made of as you see those sub levels hundreds also levels are created with bison applied here all of them so you created all the levels and connected them to your wallet and gives them identical names like world division or imap or whatever and just was it's a very tiny script uh i've had to do something similar like that for a gridded world um and there were 128 grids that i had to go and manually make and name and place you should keep those lines it was like this was you know pre-editor utility priya if only there were blueprint or you know i didn't even think about level creation lots of tools now can help it's only three button clicks to do it but i have to do those three button clicks on yeah [Music] yeah more than that that's a really good like rule of rule you know good rule to follow is once you're once you hit that number five or you see there's more than five um there's and there's a good thing and this is my time right over the length of a project it's going to be more than that it's get a script out now do you have a general best practice of what you might do in python over blueprint since you you know you work in both fluidly what would you do in python and say well i'll do this in python instead of blue if it's a content browser definitely anything in content browser it's just 99 i'm going to do it with python okay either blueprint nor c plus plus the only way i i deal with c plus plus while doing something for the content browser if i introduce a new asset if i'm creating new asset type then i i do it uh in c bus bus and while compiling anything needed in the content browser for this new asset i just do it within the c plus plus plugin but if it is something already exists in unreal and it is already existing the unreal uh module then i just do it anything for content browser as you see like those wallet this wallet is basically maps in the in the content browser that makes good sense yeah there is also in the viewport if i'm going to spawn stuff or instantiate things or move things or rename sometimes you keep dragging stuff and putting in the world and then uh you end up with a lot of things that is not organized and i need to create folders using python and then here specific uh what's called metrics like i say okay if it is a light poster processing or skylight or whatever then puts them in a folder called light if it is a mesh puts them and the mesh mobility is static put them in a folder called static mesh and and so on and so forth so it is v it's very easy to organize this outline or this wallet outliner with python that's really helpful are there any questions in the uh the chat in particular as we're approaching uh the magic hour of four o'clock here in uh eastern time zone and uh epic games headquarter time which is typically the time we start to wrap up the stream we want to make sure we address any of your questions this has been a really informative stream and we hope that you guys really take a lot from it and thank very much mohammed for sharing all this great insight i know that i've learned a lot from today's stream [Music] yeah i think i think python and then this whole tool side is is not something that a lot of people uh know until they're in the industry and they've worked on projects and they see that there's this whole tools and pipeline group and if you're working at you know epic or ea or whatever you're probably not hitting the add import button in unreal um you're probably running a python script or something in shotgun or something you know completely bespoke um and so it's really important for students to be exposed to that so that it's not you know a total system shock the more that they can see how that works in the real world that's that's really really helpful um and it's it's important for students to see that like that these careers exist and that they're in really high demand because it's a weird skill set that most that people don't they don't know so they don't go to school going i want to be a technical pipeline director because no one knows what the heck that is until they've worked with the technical pipeline director and they're like oh i want to do that i like doing that stuff or they've worked on a project and they've naturally filled that in so it's really key for us to do stuff like this to show educators students that these roles exist and that they're really cool and and that these skills can help you you know make your own projects but really stand out in the field because if you're an artist you're cool but if you're an artist who can make stuff that makes all your other artists on the team better then you're a pretty awesome artist asset so these are the sorts of skills that we like to show to our education community that's outside of what you kind of typically think of than the programmer character art environment are sort of bubble very much in visual effects pipeline td's um python is kind of bread and butter for them now so the fact that it's within unreal they can take the same principles the same concepts and actually apply them across the entire pipeline which makes a massive difference the kind of renaming stuff and the kind of important creation stuff um you know it's phenomenal particularly if you have something i know so many people struggle with naming conventions for riggs for example and um oh yeah just so you could name it exactly the same with an underscore l you know exactly eventually you're going to miss one of those 400 bones for sure well even for those folks that uh you know they're maybe they're working on you know a huge suite of characters now with open world games you know you have and so the fact that you can go into a folder select every asset do a turn table and export that into a folder or something like that is a just a huge thing that you can either put somebody in an intern role or whatever and have them do it for a week or you can push a button have it done in a few seconds and you know that is exactly what uh people that integrate with shotgun or something like that will create a python tool or you know maybe even have to go and purchase some of these tools or download or whatever or expect it from internal libraries but the fact that you can make it and customize it yourself is a huge benefit so hopefully this has been informative to you all anything else that you'd like to add mohammed before we start to wrap up today's stream thank you if anybody have question can reach me on the forums twitter or the blog or anything and yeah um and i'm facing up your course again yes we do have a special treat uh at the end of the stream uh you know as we'd mentioned uh muhammad has a course on python that uh he created is on udemy so uh he was very generous to share a special code that we are sharing at the very end of the stream because we're going to share it with you guys who are participating and then but by the time we make it up onto youtube it probably will disappear so i'm going to post it up here we're ready mohammed the time here we go so streaming on the bottom here so if you use this special coupon code python ue4 for python underscore stream you'll get 50 off of the course that he has and mark has also posted it there and so by the time this makes it onto the youtube this will probably disappear we'll just edit it right out so um once again thank you very much i'll let it scroll a couple times as we are rolling and that coupon code won't disappear if you like write it down now and you need to buy it will be okay i think it lasts for five days or a week it's it's like an option i found in the website i click click click and copy you've got a couple days to take advantage of it yeah yeah yeah back to full price so mark put it in the chat it's a udemy class uh it's a pretty massive class right uh i don't how many videos are in your class there on the udemy class muhammad how many how many different units are there i don't actually just go somewhere questions yep or something yeah it's four four hours and uh it's near 100 uh student and uh yeah the quality of the video is high because i uh i recorded multiple times i guess luis knows this uh i recorded multiple times yeah great so be sure you take advantage of uh of you know uh this course if if you've enjoyed this material we we don't typically do this but i think that you know just being able to take advantage of this kind of a tool set i think is really valuable so uh we hope you enjoyed today's stream and i'm going to stop ticking this so that we can capture the end of the stream and uh thank you all for coming next week next friday we have another great stream uh you know that we've been doing a series on becoming uh you know character artist becoming a triple a technical artist becoming a variety of different things so next friday we're doing another one of those becoming a triple a audio designer so we've got zach bellick and a couple of the guys that are some of our senior audio designers uh musical directors at epic games working on fortnite and they're going to come in and talk about becoming um what it means to work in unreal engine as a audio designer so i should be another great stream uh i know that audio sometimes uh is is not talked about you know and we talk about some of the programming features but actually implementing those features in a game of the scale and scope before tonight we're not particularly going to talk about fortnite but we're going to talk about working in audio as audio designers inside of a real-time tool like unreal engine so it should be another amazing stream please join us next friday at 2 p.m eastern daylight time and we're really excited to have you all back so without further ado thank you mohammed thank you tom thank you mark and we'll see you next friday stream see you all next friday thank you all
Info
Channel: Unreal Engine
Views: 24,752
Rating: undefined out of 5
Keywords: Unreal Engine, Epic Games, UE4, Unreal, Game Engine, Game Dev, Game Development, Python Programming, Unreal Engine Programming, Unreal Engine Python
Id: D-mDLwNawVU
Channel Id: undefined
Length: 123min 53sec (7433 seconds)
Published: Thu Oct 22 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.