Whereas if your doing the more global variation, then:
bpy.types.Scene.STR_name = StringProperty(name="STR_name", default="")
...
layout.prop(context.scene, "STR_name", text="Name")
...
print("Name:",context.scene.STR_name)
...
# Also I think
bpy.context.scene.STR_name
EDIT:
BTW, what your code seems to do is create a new variable local to the place it was called (e.g. function block), so no error is seen or known because the scope is deifferent.
no this was in the console
seems that before it was changing the propertie type but now it cancels it and it disappears
which is strange !
i’m trying to modify and old script and better understand to modify the old script to update it to the latest built
but not working yet see other thread for propertie update
hope i can make this old sript works again it is about file and path prop
but seems that scene string does not ahve these atributes anymore
This module defines properties to extend blenders internal data, the result of these functions is used to assign properties to classes registered with blender and can’t be used directly.
then if you try to print the float propertie then it looks like you lost the flot properties it does not exist anymore?
That is true, it is the nature of assignment.
thisProp =bpy.props.FloatProperty(name="somename", default=1.3)
thisProp = 22
thisProp = bpy.data.objects["Cube"]
thisProp = "I am no longer an INT or Object, I am a string!"
nice to see the error
you have the working codes for thsi example with proper scope!
but this mutable things is not like in old program like basci or fortran
where you var were defined at the beginning like real or int complex
and it would stay like tht for the whole program
python is more evolved i guess but can trap you more often ! LOL
but what about the difference between prop and scene properties
and what about this object thing if still valid?
are prop like defined locally may be
one thing i think prop are for the tool pro panel by default only i think
so easy to use when doing an operator for the tool pro panel may be using add mesh menu
and i guess if you have other panel you need to go through with scene properties?
or am i missing something here?
mind you for the string property
prop can be defined for [‘FILE_PATH’, ‘DIR_PATH’, ‘FILENAME’, ‘NONE’]
but the scene properties cannot it’s only a string may be
and you can assign to a scene property a prop
if you avhe a chance look at my other thread for old prop
it will clarify things i guess with that example i tkink