Giter Club home page Giter Club logo

Comments (19)

zeffii avatar zeffii commented on July 1, 2024

here material refers to a string in this node self.material

row.prop_search(self, 'material', bpy.data, 'materials', text='', icon='MATERIAL_DATA')

if there are materials in the .blend this finds them, selecting one will assign the material name to self.material

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 1, 2024

oh that Looks extremly useful. I didn't know this prop_search thing
thanks :)

from animation_nodes.

zeffii avatar zeffii commented on July 1, 2024

There's plenty of nuggets like this in Sverchok, but I understand if you want to figure stuff out by yourself.

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 1, 2024

I will figure them out myself but if you have tips, feel free to share them :D

I dont now if you took a look at my code. Maybe you have some ideas how I can imrove my style or so.
I think you have way more experience than me :)

from animation_nodes.

zeffii avatar zeffii commented on July 1, 2024

I'll read your code base carefully, so far it looks nice and clean.

from animation_nodes.

zeffii avatar zeffii commented on July 1, 2024

but a great talk to absorb is: http://www.youtube.com/watch?v=OSGv2VnC0go
( Transforming Code into Beautiful, Idiomatic Python ) by Raymon Hettinger

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 1, 2024

Thanks for this link. Will watch this after my driving lesson :D
I often searched such videos but rarely found something really useful.
Then I bought the book 'clean code' and I like it a lot. Very helpful tips in there

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 1, 2024

thanks again :D pretty interesting stuff shown in this talk.

from animation_nodes.

zeffii avatar zeffii commented on July 1, 2024

Use a pep8 checker or pep-8 auto-formatter. First you will battle with it for a little, then you will see they are quite handy. What do you code in? Sublime? Vim? Gedit?

Avoid using variable names object and list, because they are builtin function names . Also they aren't helping you describe the content of the variable.

see: subheading "Avoiding dots"
Reduce the amount of dot chained lookups, especially in tight loops for speed.
This is what you do when you use aliasing too,

objects = bpy.data.objects
obj = objects['Cube']

If you can alias something once, before a tight loop that can help improve efficieny. Frequent access to objects is faster than the full path bpy.data.objects.

Aesthetically I like to push this into most things with dots. If you use bpy.props.FloatProperty 3 times, import it as from bpy.props import FloatProperty once at the top. If you need a whole collection of them do

from bpy.props import (
    FloatProperty, StringProperty, IntProperty, EnumProperty
)

yes this makes the import list a bit longer, but I defend that by saying we don't spend much time looking at the import list. But I must admit this is more style than anything, because these properties are generally only made explicit in the class body. If you have many many property definitions then you will want to import them first else you get a wall of text

from animation_nodes.

zeffii avatar zeffii commented on July 1, 2024

addendum: http://www.youtube.com/watch?v=DJtef410XaM (The Clean Architecture in Python : Brandon Rhodes) you will also learn a few things from Mr Rhodes.

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 1, 2024

I'm currently coding in Notepad++
Okay, will Keep that in mind that I shouldn't use the function names as variables. makes totally sense

Most of the time I already try to avoid dots, but you are right. I never imported FloatProperty , etc before using it.

I will Change that after the my current Project. I try to write something like another little Interpreter that generates a string that I can compile at runtime and then I want to run this on every Frame Change or so.

from animation_nodes.

zeffii avatar zeffii commented on July 1, 2024

most of bpy is a massive dict. (or behaves like a dict) . look up the .get() method for dicts, it will return a None if the key isn't present, you can also pass a fallback values .get(somekey, somefallback)

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 1, 2024

jep. I used this get method multiple time already.

Yeahh. it works.

from animation_nodes.

zeffii avatar zeffii commented on July 1, 2024

https://github.com/JacquesLucke/animation-nodes/blob/master/mn_cache.py#L14-L18

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 1, 2024

okay. your right :D
But I removed this file in my local branch.

from animation_nodes.

zeffii avatar zeffii commented on July 1, 2024

i'll fork (soon) and experiment too, there are things i'd like to try that don't make sense to implement Sverchok at this point

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 1, 2024

for example?

from animation_nodes.

zeffii avatar zeffii commented on July 1, 2024

various easing functions

from animation_nodes.

JacquesLucke avatar JacquesLucke commented on July 1, 2024

okay cool

I have 360 nodes running at 20 fps. I think thats quite good

from animation_nodes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.