Im ultra new to blender and am using v2.81 to create some poses for a game mod.

Can someone please correct this script below so that it will compile in v2.81 as it wont compile based on the format..and i have no clue after reading up for hours about the known script error in v2.8 i just cant get my head around the issue. i do not understand scripting or coding very well despite trying to fix this all night. Also i cannot understand the blender versions below 2.8 for creating poses seem so clunky compared to the newer version,no camera navigation without pain!!!no easy way of moving bones without a nightmare .. otherwise my script would compile in earlier versions but i just cant create the poses anywhere near as accurately or as fast as in v2.81

This is where the compile error is in the log:

SelectedObject = bpy.context.scene.objects.active
Armatura = SelectedObject.data

Appreciate any help Thanks

  • $\begingroup$ Why are you coding if you're not good at it? And add the whole script. $\endgroup$ – Lukasz-40sth Dec 4 '19 at 9:31
  • 1
    $\begingroup$ Possible duplicate of Blender 2.8 API, python, set active object $\endgroup$ – batFINGER Dec 4 '19 at 11:25
  • 3
    $\begingroup$ @Lukasz-40sth Perhaps to learn? Please be nice to other users. $\endgroup$ – Robert Gützkow Dec 4 '19 at 12:09
  • 1
    $\begingroup$ @ZMD, a few things that improve one's experience on this site: The titles should be descriptive. No point mentioning you are a begginer, or that you need help - that's obvious. You should state your question in the title. Try not to use incorrect terminology. No 'format error', 'compile error', or a 'log' , no compiling here. You should get AttributeError: 'bpy_prop_collection' object has no attribute 'active' in the System or Python Console running that code, you should post the error message if you ask about it and other details. People will be nicer to you if you form questions well. $\endgroup$ – Martynas Žiemys Dec 4 '19 at 12:57
  • $\begingroup$ @ Lukasz-40sth : Becuase im fairly good at game modding and require a slight adjustment to a template pre made script for my pose script to compile;) I would like to learn sure..but for now I am focused on the mod side and require a quick fix for my issue. Thank you for your reply $\endgroup$ – ZMD Dec 4 '19 at 14:03

Use bpy.context.object instead of bpy.context.scene.objects.active that does not work in 2.8x.

Works fine in 2.81:

enter image description here

| improve this answer | |
  • $\begingroup$ @ Martynas Žiemys Thankyou however that throws up the same compile error .I am using v2.81 not 2.8 $\endgroup$ – ZMD Dec 4 '19 at 14:04
  • $\begingroup$ here is the script error:AttributeError: bpy_prop_collection object has no attribute active $\endgroup$ – ZMD Dec 4 '19 at 14:09
  • $\begingroup$ @ZMD using ob = context.object and armature = ob.data as suggested above, will not throw that error. There is no collection (like scene.objects and no property "acitve" like in scene.objects.active. $\endgroup$ – batFINGER Dec 4 '19 at 14:20
  • $\begingroup$ @ Martynas Žiemys Ok thanks so this would be the correct formatting : SelectedObject = bpy.context.object Armatura = Object.data $\endgroup$ – ZMD Dec 4 '19 at 14:58
  • $\begingroup$ error: object is not defined .. $\endgroup$ – ZMD Dec 4 '19 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.