• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSXA Blender python script for custom colour picker [SOLVED]

Messages
442
Country
malaysia
Hi,

I would like to get some info if anybody can help me create some custom color picker script which will be positioned under Material panel in blender. I want to position it under the red line as in the image below:

V9nxw.jpg


Code sample from other source:
Code:
import bpy

class DetailColor(bpy.types.Panel):
    bl_label = "Detail Color"
    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"
    bl_context = "material"

def draw(self, context):
        self.layout.prop(context.scene, "DetailColor", text='Detail Color')
        row = layout.row()
        # Material Property Added
        mat = context.active_object.active_material
        row.prop(mat, "DetailColor", text="")

def register():
    bpy.utils.register_class(DetailColor)
    bpy.types.Scene.DetailColor = bpy.props.FloatVectorProperty(
                                 name = "DetailColor",
                                 subtype = "COLOR",
                                 size = 4,
                                 min = 0.0,
                                 max = 1.0,
                                 default = (1.0,1.0,1.0,1.0)
                                 )

def unregister():
    bpy.utils.unregister_class(DetailColor)
  
if __name__ == "__main__":
    register()
The above sample code doesn't help to position below the red line. Hope someone could identify what is the issue in the codes there.

Thank you,
Manochvarma Raman
 
Messages
442
Country
malaysia
Hi @Dave_W,

Thank you for the suggestions. I have tried blender stackecxchange but it seems no one willing to help to specifically explain how to position it at our desired location. I will try blender aritist forum and see how is the response.
 

Dave_W

Resource contributor
Messages
185
I'm sorry.

I didn't look closely enough at your screenshot to see that the code you want is for the Blender2FSXP3D toolset. It is highly unlikely that you would get help on those forums for something like that.

Note to self: engage brain before putting mouth in gear :banghead:
 
Messages
442
Country
malaysia
Hi Dave_W,

That's ok :D. After trial and error, I was able to find out the code.

I think the toolset is almost complete now. Just a small proeprty detail is not showing up when loading the .MDL file into MCX. I have asked Arno to check it out. Once he found it, will release the toolset that is to be version 0.9.4
 

Dave_W

Resource contributor
Messages
185
I'm glad that you're getting it worked out. :)

Edit: I just saw that you have taken over maintaining the toolset now.

Thanks and good luck with that!
 
Last edited:

Ronald

Resource contributor
Messages
974
I have tried Blender Stackecxchange but it seems no one willing to help to specifically explain how to position it at our desired location.
A - My experience, By patient and learn to ask your question in the exact right format, first, since the Blender.StackExchange is very strict about it.
The StackExchange community is (highly professional and) a very different-type-of-community then most average Blender forums on the internet.

TIP: The better and more compact your question is formulated, the sooner you will have the right answer to continue:
Here are some tips to get you started, formatting your (future) questions:
- https://blender.stackexchange.com/tour
Since... In the end you will get the high-quality answers you'll need to get your Blender-Python challenge done Manochvarma


B - I would like to add to Dave_W's list:
- Blender (developer-level and end-users) IRC-chatrooms.
- Blender developers (e)mailing list.
On this Blender Wiki page you can read you can contact the developers (and other experienced end-users) directly:
- https://wiki.blender.org/index.php/Dev:Doc/Contact

This thread on the Blender Artists forum explains how to ask question in the Blender community
- https://blenderartists.org/forum/sh...-Developers-Invite-quot-Ask-us-Anything!-quot

I hope this information is helpful for you, so you know where to ask which type-of-blender-related questions in the future.


Before that I need to study python first.
Here are some official Blender places to get started:
- https://docs.blender.org/api/2.79a/
- https://docs.blender.org/api/248PythonDoc/
- https://docs.blender.org/api/

Blender Artists - Python API scripting forum:
- https://blenderartists.org/forum/forumdisplay.php?11-Python-Support[/url Other websites on Blender and Python: - https://docs.python.org/3/tutorial/ - [URL]http://blenderscripting.blogspot.nl/
- https://en.wikibooks.org/wiki/Blend...anced_Tutorials/Python_Scripting/Introduction
- https://sites.google.com/site/satishgoda/blender/learningblender25/tutorial-scripting-panels

Youtube videos on this subject
- https://www.youtube.com/results?sea...search_query=blender+python+api+custom+panels

BONUS: Free downloadable Blender Python API E-book:
- https://smtebooks.com/Downloads/5809/the-blender-python-api-pdf

Now you are ready to:wizard: unleash your inner Python....:eek:
 
Last edited:
Messages
442
Country
malaysia
Hi @Ronald

Thank you for the links. It was very helpful indeed.

I was able to find a solution for the question as below:
Python:
 Material.fsxm_DetailColor = FloatVectorProperty(
                                 name = "DetailColor",
                                 subtype = "COLOR",
                                 size = 4,
                                 min = 0.0,
                                 max = 1.0,
                                 default = (1.0,1.0,1.0,1.0)
                                 )

Thank you.
 

F747fly

Resource contributor
Messages
1,713
Country
netherlands
May I just ask why you want this? I'm assuming you want it to be like 3DS MAX where every new material gets a seperate colour, so when you export the materials don't become one? I personally found this is not very desirable. Firstly, you can use the same colour as many times as you like as long as the materials have atleast one setting (be it a texture set or an FSX parameter) different. Secondly, baking AO or other maps is a lot easier when using 1 colours (I personally make all my materials pure white, it works best for me).

Either way, glad you figured it out!
 
Messages
442
Country
malaysia
May I just ask why you want this? I'm assuming you want it to be like 3DS MAX where every new material gets a seperate colour, so when you export the materials don't become one? I personally found this is not very desirable. Firstly, you can use the same colour as many times as you like as long as the materials have atleast one setting (be it a texture set or an FSX parameter) different. Secondly, baking AO or other maps is a lot easier when using 1 colours (I personally make all my materials pure white, it works best for me).

Either way, glad you figured it out!
Hi Frits,
I was looking it for implementing P3D materials parameters into Blender2FSX/P3D toolset.
 
Top