Giter Site home page Giter Site logo

Head Vs wall... about bone_layer_manager HOT 5 CLOSED

fineskimo avatar fineskimo commented on August 9, 2024
Head Vs wall...

from bone_layer_manager.

Comments (5)

Irmitya avatar Irmitya commented on August 9, 2024 1

@fineskimo You have to manually enable Issues, for people to post issues, in forks.
You can also enable Discussions.

from bone_layer_manager.

Irmitya avatar Irmitya commented on August 9, 2024

I don't know what you mean.

  1. When adding constraints, I want numerous sub-properties associated with it, so I use
    CollectionProperty.
    What a collection property does is add a root property that behaves like a list, where you can only add items to it by using a sub_fuction [sub_group = root.add()]
    each sub_group then behaves like a PropertyGroup, wherein you can insert properties however you want.

  2. My reload addon uses a dynamic EnumProperty list
    that scans the available addons, to find their names to be used.

An Enum list can only reference Strings,

An enum list that "DOES" something after you click one of the items, is either an operator that invokes an enum search menu, or it's an enum property that has a function to run in its "update" property.

from bone_layer_manager.

fineskimo avatar fineskimo commented on August 9, 2024

It's really just about representation in the custom properties panel:

For example the following snippet would create a nice 'keyable' dropdown in the panel.
It's really just a thought that I got caught up in...

import bpy

def update_enum(self, context):
print(self, self.test_enum, context)

bpy.types.PoseBone.test_enum = bpy.props.EnumProperty(
items=(
('state_1', 'Name 1','Discript_1'),
('state_2', 'Name 2','Discript_2'),
('state_3', 'Name 3', 'Discript_3'),
),
name="test_enum",
default="state_1",
update=update_enum
)

bpy.data.objects["Armature"].pose.bones["Bone"].test_enum = "state_1"

from bone_layer_manager.

Irmitya avatar Irmitya commented on August 9, 2024

https://blender.stackexchange.com/questions/10910/dynamic-enumproperty-by-type-of-selection
https://docs.blender.org/api/master/bpy.props.html?highlight=enumproperty#bpy.props.EnumProperty

import bpy

def enum_function(self, context):
    # obj = context.object
    obj = self
        # self = the first line higher than wherever the property is assigned

    if obj.keys():
        items = list()
    else:
        # empty lists return a TypeError when you try to access them in python
        # It may not "stop" anything but I rather avoid all errors
        items = [(  # the sets of items have to be a tuple
            'none', "No Items", "Insert custom properties to define items",
            'WARNING', 1  # This line is optional, for displaying icons
        )]
    for (ind, name) in enumerate(obj.keys()):
        if name.startswith("RIGUI"):
            items.append((
                name,
                "UI: " + name,  # Text displayed for the item
                "Is a UI item",  # Shown when hovering mouse
                "ARMATURE_DATA",  # an icon to display
                ind + 1,  # when using icons, all enums must have unique ID#
            ))
        else:
            items.append((
                'error-' + name,
                f"xX -- {name} -- Xx",
                "Not a ui",
                'ERROR',  # display an error icon for no reason
                ind + 1,
            ))
    return items


def register():
    bpy.types.Object.dynamic_enum = bpy.props.EnumProperty(
        items=enum_function,
        name="Dyna Enum",
        description="This list will change based on Custom Properties",
    )

def unregister():
    del(bpy.types.Object.dynamic_enum)

if __name__ == "__main__":
    register()

from bone_layer_manager.

fineskimo avatar fineskimo commented on August 9, 2024

Legend... thanks.

from bone_layer_manager.

Related Issues (1)

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.