Open emil-dietrich opened 1 year ago
Interesting contribution! I will take some time to review the code and test the feature, hopefully it will be a good addition to Game Rig Tools
For the last commit a8414a8 before: after:
xx
was what I entered in the input field
I will need some time to check if this is safe
eval seems to have some security risk, I will need some time to research if this is ok to add
If there is a security risk its that you can use python within blender.
Everyone can open a text file in blender and press execute.
To add to it: Only one variable is accessible by the expression and that is bone
.
If you have open questions or if theres something unclear you can also ask here. You don't need to investigate alone.
Blender also uses expressions for drivers. They evaluate the python code from C++, but that does not really matter. https://github.com/blender/blender/blob/01a2bd03695f217616acc2581fe8746f5cd226d7/source/blender/python/intern/bpy_driver.cc#L573
Fair Point, I will do some testing and if it works will I will merge it
Dont merge what you dont understand. Dont feel pressured to add this before you are comfortable with the changes.
Sry, for another addition:
rigify also dynamically executes python code, see finalize_script
property.
It calls it as follows (in generate.py:594): exec(finalize_script.as_string(), {})
(You can see where rigify is located on your hard drive if you go to the preferences -> addons -> rigify -> File: ...)
exec
and eval
are basically the same, but eval
returns a value and exec
does not.
The above still applies - if you dont feel comfortable with the change im fine with that.
I think it would be a good addition, I will merge it, but I will take some time to study it
Each bone is extracted if the expression returns
True
. Each bone is accessible in the expression by the varbone
.eval(bytecode, ...)