Can't wrap my head around coding, please point me in the right direction

OK, I don’t even know how to explain what my problem is. There is a disconnect and I don’t know how to get over it.

Brief background: I am not a programmer, however I would like to better understand to write my own scripts and small plug ins.

I have gone through Code Acadamy, watched many tutorials (including Blender Cloud Python) and some Khan Academy.

As I am going through everything I understand it just fine, any errors I run into I am able to figure them out without to much trouble. I can also look at code and for the most part understand what is going on.

The Problem: When I stare at a blank screen (IDE) I am completely lost. I have no clue where to start and I dont even know what direction to go in. I don’t think I fully understand the programming way of thinking.

So I decided I will hold off on Python for now and try Animation Nodes, I thought maybe that will give me baby steps into being into the correct thought process.

Well, after watching many Animation Nodes tutorials and reading many post on BSE I felt like I have a good grasp of it.

YET AGAIN!! when I stare and the empty node screen I have no clue where to start. So I just pick the nodes that I think I want and of course nothing works the way I expect them to.

I just don’t understand what my disconnect is.

I have been out of High School for a while and that was the last time I touched Algebra. So I have been going to Khan Academy to brush up on my math.

Can someone point me in the right direction to better understand a more birds eye view of programming (i.e. OOP, recursion, scopes, etc… )

Thanks

Hello, I don’t mess with Python and have only messed with Lua on the Roblox platform for fun, currently learning C# for Unity (which is surprisingly easier to learn then I imagined a year ago) however regardless of the language you’re coding in, you just need to know what you’re making and figure out how to make that thing.

For me, I always have an idea, say a small racing game. I know in order to make the game I need to make the game logic loop, the controls for the car and the car itself. Now I know what I need to make in order to make a game, next step is to write the code for each part of the game.

So figure out what you want to make, then figure out how to go about doing that.

Since it seems to be the staring at a blank screen and not knowing where to start that gives you problems, maybe you could try this:

Pick an addon that you like, but would like even more if it did one little thing differently or extra. Then figure out how to modify the addon to do what you want. This has two good purposes: first, you will need to understand what the existing code does, at least in the area that you want to modify; and second, you will often end up copying code that kind of does what you want, but modifying it a little - and that’s easier than coming up with a whole approach from scratch. If you do this a few times, maybe it can help ease you into “the programming way of thinking”, as you put it.

Of course, this may not work at all. Different people learn differently.

1 Like

There are, really, two ways that you can begin to “program” Blender. The first is nodes, in all of its various manifestations throughout the system. These are a sort of “visual programming,” where you connect “nodes” to one another in a flow-graph that stretches from “sources” of data to their final “destinations.”

This flavor of programming is a bit like “plumbing.” One type of node is a source of data, and another its the final destination. Nodes between them act as filters of one kind or another. Each node has inputs on its left-hand side and outputs on its right, and various parameters that you can set. You assemble the node-network, or “noodle,” by “piping” outputs from one node to become “inputs” to another, so that various bits of data “flow” from one to the next.

“Python programming” – the IDE – is quite-frankly very rare.

My advise is to have a goal like create an addon that automates some mandane blender stuff and helps you in your work.

Next find snippets of code or existing acdons that you can take apart or modify. Run the addon but then tweak things and replace things bit by bit. This will take you through the process of actually learning first hand how some bits of code affect the addon.

Another friend is the script listener to copy script instructions straight inside blender while you use operators.

These are the 2 things that accelerated me into mastering python for blender.

1 Like

The way I do it is to pick a goal. I started with just making a script to move a box right 1 unit. Then go from there to build more complex projects. There’s always something I want to see happen, some problem I want to see solved. Even writing your own pie menus would probably be a good step.

I learned a lot from this guy: https://blog.michelanders.nl/

He used to have tutorials on how to build Python addons, but I couldn’t find them anymore. Might be in his new book that he’s writing.

I don’t think your problem is anywhere near trivial. There’s a huge disconnect between where you are and where you want to be. I think it’s one of the core problems of life, in general. How do you decide where to go and how to get there? The solution space is infinite. I wouldn’t expect for anyone to have a ready-made road on which to walk on. It’s something I have discovered step by step by building things.

1 Like

I’m a self-taught coder from the 1980s (Yes, I’ve traveled through time to answer your question with the wisdom of your ancestors).

The best way to learn coding is to learn it separately from Blender or any other software. Pick a language (you seem to have done that) and learn to code simple things by following a prescribed course. Books are best because you can re-read if you don’t understand rather than screwing with finding the right spot to rewind to on the timeline of a video.

Once you’re comfortable with coding in general, start in on coding a specific application (like Blender).

I’m a professional programmer and I still get a little bit of this from time to time. It sounds like you’ve learned a lot and are making good progress but even if you know how to code, when you step into an environment like Blender a whole other layer is added on top where you need to also know how to code for Blender, using its libraries, workflows, paradigms etc.

The best advice I can give you when staring at the blank text file is to break your program down into very small pieces and focus on laying the scaffolding to get the first step up and running. For example I wet my toes in Blender programming a couple of weeks ago by writing a small add-on that gave the camera the ability to auto focus.

The first thing I did was write a script to select the camera. Then I tried modifying some properties on the camera. Then I tried raycasting from the camera into the scene. Then I tried adding a button to fire a ray into the scene and report back, etc. This allowed me to get a feel for how to navigate Blender’s API and then I was able to start assembling the addon proper.

It’s sometimes called the tyranny of the blank page.

Start small and write a program with an easy goal.

John Steinbeck put it well and replace ‘ideas’ with ‘programs’ and it holds up well:
Ideas are like rabbits . You get a couple and learn how to handle them, and pretty soon you have a dozen.” – John Steinbeck.

Coding becomes super easy once you follow this very simple process

Pick a problem no matter how complex and break it down to smaller problems and break those down to even smaller. When the problems you got are tons but super simple. Then it’s time to start coding.

Most importantly learn while you code. There is no correct way of thinking. The only thing you must do is fun , as much as you can. This the best way to learn. Explore the code , execute line by line, inspect and evaluate. Open your mind and your imagination to realize the infinite potential and to find the goals that are important for you.

If someone tells you doing it all wrong, get away from that person. Misery leads to badly designed code. Fool around , have fun and learn.

2 Likes

I disagree. If you are a fluent Blender artist or operator it can help a lot if you start scripting in Blender. The extra layer you are talking about actually acts as a guidline. A lot of the things you do in python you normally do with buttons, spinners and gizmos all day long if you are Blender artist.
At least i found it a lot easier.

And a lot more motivating as well because of the instant visual feedback i would get from automating some simple tasks.

If you learn programming with out Blender the feedback you get are dry numbers and shopping lists.

These dry numbers and shopping lists actually became quite interesting, though, when after a while i wanted to deepen my skills.

@icyou520
Since you mentioned Animation Nodes it might make sense to create new node that does something AN can not do yet. Scripting new nodes is a relatively simple task and takes place in contained place. It is a very spcialized area and you do not have the abundance of options you have elsewhwere. Sometimes too much freedom can be overwhelming.

1 Like