Getting color from pointer location



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 02/01/2009 at 04:31, xxxxxxxx wrote:

    I am completely new to all of this. Would like to know where to look so that I can use mouse pointer to ID colors on the screen and give back HEX or RGB values.

    Thank you.

    No spoon feeding required. Just some guidance.

    Richard



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 02/01/2009 at 19:39, xxxxxxxx wrote:

    Hmmm...

    Is it possible to include the color picker in C4D into COFFEE script?

    Richard



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/01/2009 at 04:19, xxxxxxxx wrote:

    This is unfortunatly not possible with COFFEE. Even with the C++ API it would probably require the use of OS routines.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/01/2009 at 04:32, xxxxxxxx wrote:

    As an afterthought, if you just want to use Cinema's own color picker you could create a dialog and add the color picker element, AddColorChooser().

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/01/2009 at 01:35, xxxxxxxx wrote:

    matthias,

    thanks

    richard



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/01/2009 at 03:28, xxxxxxxx wrote:

    Btw. you can do this even easier. There is the GeChooseColor() function which opens the color picker and returns the picked color as parameter.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/01/2009 at 17:07, xxxxxxxx wrote:

    sweet!



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/01/2009 at 18:40, xxxxxxxx wrote:

    matthias,

    jumped the gun a bit. how does one use GeChooseColor?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/01/2009 at 01:16, xxxxxxxx wrote:

    Here you go:

    > \> Vector color; \> \> if(GeChooseColor(&color;)) \> { \>      //do someting with color \> } \>

    The picked color is passed to the 'color' parameter.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/01/2009 at 08:02, xxxxxxxx wrote:

    matthias,

    having issues linking color picker parameters to materials created using insertmaterial.

    doc->InsertMaterial(mat, NULL, FALSE);
    // apply color from colorpicker to newly formed material
    mat->SetChannelState(CHANNEL_COLOR(IDC_MODUS), TRUE);

    IDC_MODUS refers to the native colorpicker that was evoked by AddColorChooser. I know that the above is incorrect. how do i get the color/brightness selected from the colorchooser to affect the parameters of the inserted material?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 21/01/2009 at 08:07, xxxxxxxx wrote:

    Get the 'color' using GeChooseColor and then set the material parameter:

    // Enable Color Channel in Material
    mat->SetChannelState(CHANNEL_COLOR, TRUE);
    // Set Color to 'color'
    mat->SetParameter(DescID(MATERIAL_COLOR_COLOR), GeData(color), DESCFLAGS_DONTCHECKMINMAX);



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/01/2009 at 14:20, xxxxxxxx wrote:

    I've been working with GeChooseColor and it is not as convenient as I would hope for. At least, I am not certain how I can "dock" it permanently into my plugin dialog. Right now it shows up as a "pop-up".

    I am also curious as to why I couldn't use the AddColorChooser attributes to affect materials created. Is there a way to pass the color and brightness of the AddColorChooser to materials created.

    Believe me, i have been trying various ways to get this to work and I have not found anything definitive in the SDK.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/01/2009 at 15:08, xxxxxxxx wrote:

    Maybe tell us something about what you are trying to achieve. GeChooseColor() is just a color picker dialog popup. AddColorChooser() is just the standard Cinema color dialog element.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/01/2009 at 15:41, xxxxxxxx wrote:

    matthias,

    one portion of the plug i'm working on is the ability to utilize the native c4d color-picker to create any objects and materials with the chosen color AND brightness control. it would also be nice to have the color-picker as a permanent feature of the dialog. surely there is an accessible way to use the standard color picker to affect materials/objects to be created.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/01/2009 at 17:14, xxxxxxxx wrote:

    Just to make sure we are talking about the same thing. This is an example plugin dialog with AddColorChooser(). Of course the look depends on Cinema's color chooser preferences.

    Here is the complete source code of the example dialog:

    > \> ///////////////////////////////////////////////////////////// \> // CINEMA 4D SDK                                           // \> ///////////////////////////////////////////////////////////// \> // (c) 1989-2004 MAXON Computer GmbH, all rights reserved // \> ///////////////////////////////////////////////////////////// \> \> // example code for a menu/manager plugin \> \> // be sure to use a unique ID obtained from www.plugincafe.com \> #define ID_ASYNCTEST 1000955 \> \> #include "c4d.h" \> #include "c4d_symbols.h" \> \> \> class AsyncDialog : public GeDialog \> { \>      private: \>           C4DGadget \*colorchooser; \> \>      public: \>           AsyncDialog(void); \>           virtual Bool CreateLayout(void); \>           virtual Bool InitValues(void); \>           virtual Bool Command(LONG id,const BaseContainer &msg;); \> }; \> \> enum \> { \>      IDC_COLOR = 1000 \> }; \> \> AsyncDialog::AsyncDialog(void) \> { \>      colorchooser = NULL; \> } \> \> Bool AsyncDialog::CreateLayout(void) \> { \>      // first call the parent instance \>      Bool res = GeDialog::CreateLayout(); \> \>      SetTitle("GuiDemo C++"); \> \>      GroupBegin(0,BFH_SCALEFIT|BFV_SCALEFIT,1,0,"",0); \>      { \>           colorchooser = AddColorChooser(IDC_COLOR,BFH_LEFT|BFV_TOP,SizePix(400),0,0); \>      } \> \>      return res; \> } \> \> Bool AsyncDialog::InitValues(void) \> { \>      // first call the parent instance \>      if (!GeDialog::InitValues()) return FALSE; \> \>      return TRUE; \> } \> \> Bool AsyncDialog::Command(LONG id,const BaseContainer &msg;) \> { \>      switch (id) \>      { \>           case IDC_COLOR: \>                { \>                     Vector color; \>                     Real brightness; \>                     if(colorchooser && GetColorField(colorchooser, color, brightness)) \>                     { \>                          //do something with color and brightness \>                           \>                          GePrint(RealToString(color.x)+" "+RealToString(color.y)+" "+RealToString(color.z)); \>                          GePrint(RealToString(brightness)); \>                     } \>                } \>                break; \>      } \>      return TRUE; \> } \> \> \> class AsyncTest : public CommandData \> { \>      private: \>           AsyncDialog dlg; \>      public: \>           virtual Bool Execute(BaseDocument \*doc); \>           virtual LONG GetState(BaseDocument \*doc); \>           virtual Bool RestoreLayout(void \*secret); \> }; \> \> LONG AsyncTest::GetState(BaseDocument \*doc) \> { \>      return CMD_ENABLED; \> } \> \> Bool AsyncTest::Execute(BaseDocument \*doc) \> { \>      return dlg.Open(TRUE,ID_ASYNCTEST,-1,-1); \> } \> \> Bool AsyncTest::RestoreLayout(void \*secret) \> { \>      return dlg.RestoreLayout(ID_ASYNCTEST,0,secret); \> } \> \> \> Bool RegisterAsyncTest(void) \> { \>      // decide by name if the plugin shall be registered - just for user convenience \>      String name=GeLoadString(IDS_ASYNCTEST); if (!name.Content()) return TRUE; \>      return RegisterCommandPlugin(ID_ASYNCTEST,name,0,NULL,String("C++ SDK Menu Test Plugin"),gNew AsyncTest); \> } \>

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/01/2009 at 17:42, xxxxxxxx wrote:

    matthias,

    that's just insane! :) now i feel guilty and humbled by your knowledge- thanks!

    i also take from this that there is no, unfortunately, convenient way to access the features of the native color picker in c4d...too bad.

    ah, so this is from one of the examples in the sdk...


Log in to reply