0
$\begingroup$

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

$\endgroup$
6
  • $\begingroup$ Why are you coding if you're not good at it? And add the whole script. $\endgroup$ Dec 4, 2019 at 9:31
  • 1
    $\begingroup$ Possible duplicate of Blender 2.8 API, python, set active object $\endgroup$
    – batFINGER
    Dec 4, 2019 at 11:25
  • 3
    $\begingroup$ @Lukasz-40sth Perhaps to learn? Please be nice to other users. $\endgroup$
    – Robert Gützkow
    Dec 4, 2019 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$ Dec 4, 2019 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, 2019 at 14:03

1 Answer 1

0
$\begingroup$

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

$\endgroup$
7
  • $\begingroup$ @ Martynas Žiemys Thankyou however that throws up the same compile error .I am using v2.81 not 2.8 $\endgroup$
    – ZMD
    Dec 4, 2019 at 14:04
  • $\begingroup$ here is the script error:AttributeError: bpy_prop_collection object has no attribute active $\endgroup$
    – ZMD
    Dec 4, 2019 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, 2019 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, 2019 at 14:58
  • $\begingroup$ error: object is not defined .. $\endgroup$
    – ZMD
    Dec 4, 2019 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .