Coder Social home page Coder Social logo

bxx's People

Watchers

 avatar  avatar  avatar

bxx's Issues

name shadowing

there's too many function names that have the same names as types etc this is stupid

script reloading is unstable

the automatic reloading is kind of unstable and based on a timer. I often enter a buggy state where it gets stuck reading the lockfile and unable to recover

pyobject memory issues

This is a hackaround:

cls(T const& obj): __VA_ARGS__ { m_obj = obj.getattr<python_object>(#cls).m_obj; Py_IncRef(m_obj); Py_IncRef(m_obj); }

it shouldn't be necessary to increase references twice, and it suggests something is going wrong with that pyobject for another reason.

sometimes, visual studio cannot find script pdbs

Most of the time it seems like visual studio finds the debug pdbs fine and I can attach to blender and debug my scripts just fine, but sometimes it doesn't find them. This hasn't happened in a while, but making this issue in case it happens again.

weird behavior in app handler callbacks

bxx/bxx/app_handlers.cpp

Lines 13 to 27 in d89632f

void register_handler(std::string const& target, std::function<void(bxx::python_tuple const&)> func)
{
// todo: for some bizarre reason this stops working if i don't pass all varargs python-side,
// but everything is still in the first tuple once it reaches C++
size_t event_idx = lib_register_event([=](bxx::python_tuple const& tuple) {
func(tuple.get<python_tuple>(0));
return bxx::python_object();
});
exec({
fmt::format("@bpy.app.handlers.persistent"),
fmt::format("def event_{}_{}(*args):",get_script_index(),event_idx),
fmt::format(" fire_event({},{}, args)",get_script_index(),event_idx),
fmt::format("register_app_handler({}, bpy.app.handlers.{}, event_{}_{})", get_script_index(), target, get_script_index(), event_idx, target)
});
}

escape quotes

lots of code depends on quotes so escape those from names

add constraints / modifiers

Constraints are id, so you can get them as pointers. They can be implemented like this:

namespace bxx
{
    enum class owner_space
    {
        WORLD,
        CUSTOM,
        POSE,
        LOCAL_WITH_PARENT,
        LOCAL
    };

    class constraint : public id
    {
        PYFIELD(bool,active)
        PYFIELD(bool,enabled)
        PYFIELD(float,error_location)
        PYFIELD(float,error_rotation)
        PYFIELD(float,influence)
        PYFIELD(bool,is_override_data)
        PYFIELD(bool,is_valid)
        PYFIELD(bool,mute)
        PYFIELD(std::string,name)
        PYFIELD_STRINGENUM(owner_space,owner_space)
        PYFIELD(bool,show_expanded)
        PYFIELD(object,space_object)
    };
}

clean up and decide python_object / id relationship

This is one of the larger things that I need to do before adding much more to the system right now.

As for the api, we can easily convert between python/id types since python types can just be called as_pointer() and id types can just use get_full_name to access pyobject globally. However, if an id type uses mostly python methods i guess that would be slower if we don't support caching it somehow.

Pros of each type

id_ptr

  • fast (no refcounting needed)
  • multithreaded
  • unsafe. dangling pointers can easily happen = program crash, not good.

python

  • safe (though i can still null check id), i can check everything
  • can dangling pointers happen? what happens to pyobjects after you delete the object they refer to? At least the program shouldn't crash from that.

Type Hierarchy

  • object_base - an object that can somehow resolve a PyObject*. Has convenience methods for call, setattr, getattr etc.
  • id - generic object that has get_name and get_full_name, extends object_base and resolves PyObject through eval(get_full_name) etc (could maybe cache that PyObject? since if PyObject is dangling id is too?)
  • id_ptr - id that has a pointer (template), this can be initialized with a python_object through as_pointer (it could also cache a raw PyObject*?)
  • python_object - refcounted PyObject* wrapper, has convenience extensions python_list and python_dict

How do we get children???? of objects

  • This is specific to some id types, not all id types can have children.

WE NEED TO CLEARLY MARK UP PYTHON METHODS IN THE DOCUMENTATION

Should python functions have some py_ prefix to make this clear? what is thread safe...

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.