Navigation

    • Register
    • Login
    • Search
    1. Home
    2. Dunhou
    3. Posts
    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups

    Posts made by Dunhou

    RE: Can I bypass calling the material manager when create new materials?

    [email protected]
    No, it is not a build-in function, it is my plugin that I used all day, You can have a brief look here .it support main render engine in Cinema (Octane/Redshift/Arnold)( it seems I do a good job to fake it like original😊 )

    actually,I checked the c4d.IsCommandChecked(id) ,but it has a problem to me:
    If I check this in my code, when I create a material with my plugin, the material manager will closed, but I just don't want to tigger it like the gif you shown with the bulid-in function, so that I can decide open the material manager I wanted to.

    So I don't know which command will trigger the opened the material manager.
    Hope this time will be clear😊

    posted in Cinema 4D SDK •
    RE: Can I bypass calling the material manager when create new materials?

    @ferdinand Hey, Sorry to a bad description, here is a gif which has a better information.
    22.gif

    1:

    I create a material and auto apply to the cube, the material manager didn't popup (which I mean "silence" here )

    2:

    But when I create another material, the manager will popup immediately, can I bypass this and only popup the material manager only I hit the mat-ball icon?
    ( Or , which functions will take this behaviour and can I bypass the step )

    the main code about this function is like :

    • SetBit()
    • doc.InsertMaterial()
    • c4d.CallCommand(12252) # Render Materials
    • doc.GetActiveMaterial()
    • textag.SetMaterial()
      and some undo and call the Node Editor for certain renderer or rules for the function, it is also way long for the forum, I will send you a copy if it is needed.

    Cheers~

    posted in Cinema 4D SDK •
    Can I bypass calling the material manager when create new materials?

    Hi everyone,

    Some descriptions:

    I have a noising problem about the material manager, now it had a hided button for the material manager, I always create materials with my tools and want to leave the manager out, when I create 1st material it will silence the material manager but when a create the 2rd material it will popup.

    Problem:

    What will cause this happend in the manager, maybe the SetActiveMaterial or SetBit function , can I force silence the manager until I hit the button?
    (I need set active material to open certain node editor for the material)

    Cheers~

    posted in Cinema 4D SDK •
    RE: Can we add a folding option for the code block when searching

    @c4ds that is a bad news, but any way if it can be folding , it will have a great help.

    posted in General Talk •
    Can we add a folding option for the code block when searching

    Hey everyone,

    I found that when I searching in the forum, the answer who take a long long code block can fill the searching page immediately . and it is so hard the get to next ,can we have a option that we can set automatic folding the long codes when we just interested in some specific topics

    Cheers~

    posted in General Talk •
    RE: Ability to set DLG_TYPE_ASYNC Width & Height

    @m_adam
    Thanks for you reply , and there is nothing worry about the time, you are much busier than me😊

    I already try the defaultX and nothing changed, the dialog is always bigger than I set , it seems the dialog is considering teh hiden element size or something , the code is bit long for the forum ( maybe we should add a folding option to the code block in the forum ), and I sent an copy to ferdinand , and newest version has nothing changed for the UI part, Is that convenient for you to get a copy from ferdinand or post your email I can send you emails to,

    Cheers~

    posted in Cinema 4D SDK •
    RE: How to get the object newly added in current scene?

    @gheyret

    Maybe you should check this How to change light param

    @ferdinand has a great explain there

    posted in Cinema 4D SDK •
    RE: Ability to set DLG_TYPE_ASYNC Width & Height

    @m_adam Hey m_adam ,I find this topic when I try to set minimum size with my dialog, but I try the xpos=-3, ypos=-3, it doesn't work , I use a HideElement dialog like gedialog_menu_hide_content.py did.

    but the gui can not fit the minimum size , can I fix this?

    posted in Cinema 4D SDK •
    RE: How to understand symbols of some spcial case ?

    @ferdinand Thanks for your help.

    I did search on web and find the Unicode string, and Chinese characters is so much complicated ,when most user use Chinese for the GUI language, Maybe sometime the translation of the world "在队列中" witch means "in the queue" in English has changed ( I belive now Chinese translation is response to IHDT so it won't randomly changed). That is not a big problem but maybe a little "uniform" with the "ID"😊

    And the "brief moment" is I don't sure why does it happend. In another word ,I think the initializing render process can be also called "rendering" . so it is a bit of counterintuitive for me , maybe I should add an additional check to make sure the spying will not break while the brief.

    Cheers~

    posted in Cinema 4D SDK •
    RE: C4D Threading in python doesn't work as expect .

    @ferdinand thanks for your generoso help.

    I already send you an email with an zip file , and some notes in the front of the codes.

    Have a good day!

    posted in Cinema 4D SDK •
    RE: C4D Threading in python doesn't work as expect .

    @ferdinand Hello , a liitle furthur problem with the thread.

    When I try to End the spy theard , it will lock the main GUI , untill the running task is done , and don't know why does this happened.

    If more code is needed .I will send you an Email becouse it's a bit long(800 lines)

        def Abort(self):
            """Stop the Listening"""
            # Checks if there is a Thread process currently
            if self.RQListenerThread and self.RQListenerThread.IsRunning():
                if gui.QuestionDialog(Language.IDS_AskClose):
                    self.aborted = True
                    self.RQListenerThread.End() # False returns immediately although the thread will still run until it is finished
                    self.RQListenerThread = None
                    c4d.StatusSetText(f"Stop Listen to Render Queue")
    

    Cheers~

    posted in Cinema 4D SDK •
    RE: How to understand symbols of some spcial case ?

    @ferdinand Thanks for that!

    I think BatchRender.GetJsonJobs do a great job but a little pitty that the velue of the json is not use an "int" , so when I want to support Chinese users , it returns 'status': '在队列&#x4e2d like this , so I think it a little bit limitation for not a native English users.

    And the RM_ERROR and RM_ERROR2 code shows most I want , I belive a lot of symbols has teh same XXXX and XXXX2 situation,but most document didn't have any infomations .

    And a little questions with "Batch Render" but not the symbol, I don't sure should I post in another topic:

    When I use IsRendering to spy the render queue ,if A and B is switch rendering status ( aka , A is finishing , and B is just starting ).this few time would break the while and return a bad value not I want. How can I fix this?

    batchRender: BatchRender = c4d.documents.GetBatchRender()
    while batchRender.IsRendering():
        c4d.StatusSetText(f"Rendering....")    
        time.sleep(5)
    

    Cheers~

    posted in Cinema 4D SDK •
    How to understand symbols of some spcial case ?

    Hello everyone,

    Question

    I get some strange words from sdk and never found what they means, how can I get some info more spcificly?

    e.g. I try to check rendering states of my batch render ,when batch render come with a error then , alert me rather than waste all night time, some I think I can get a state list of render queue, when error happens , take an alert and never warning this element this time . but when I test the state , it seems RM_ERROR2 is the only one , I delete some texture to test a warning document , RM_ERROR still not worked , How can I get this symbols meaning ?

    This problem also heppened when some undo or some symbols have a number ending

    17091cc1-2e2b-488f-82fa-6a9eaa9aaf9c-image.png

    by the way , I think GetEnableElement document is wrong ?

    Cheers

    posted in Cinema 4D SDK •
    RE: C4D Threading in python doesn't work as expect .

    Thanks for this again ! @ferdinand

    That help me understand more about MessageData and how to use the Timer in a 牧场more clever way .

    And I get my code worked and run well.

    Happy weekend !

    posted in Cinema 4D SDK •
    RE: C4D Threading in python doesn't work as expect .

    Thanks for that explain @ferdinand @m_adam !

    A long time hard work, sorry to reply so late.

    I test for my purpose and it works as expected, thnaks again for your easy to read explain and a accompany tech explain , that helps a lot.

    I haven't notice that script manager can block main GUI , I tried to check internet and download some files with thread before in script mananger and lock for a while , I thought I did a totally wrong way , maybe it's time to try this again😊

    And by the way , I read the github link above and the extended version for teh baker plugin , the second one seems easier to understand for me .

    And a liitle stupid question for MessageData , I have a rough understand about this , in my opinion, the MessageData plugin is doing a continue spying , like every 100ms check once . Does it slow down Cinema 4D like a thread run forever ? What's the diffirence between them?
    (Don't sure if this will beyond the topic or the support range😧 )

    posted in Cinema 4D SDK •
    C4D Threading in python doesn't work as expect .

    Hello everyone :

    Problem :

    I am working with a plugin that I want to listen to render queues elements status, and send a e-mail to me when they are all finished, I think the I should loop the queue and check status in backgroud(aka threading) to not lock the main GUI. So I find C4D Therading Class. But something going wrong and run out my knowledge.

    The main problem is I search the therading document and github examples , it does have a Wait(Flase) function , but when I test the code , it will lock the main GUI anyway, when I leave Wait() function param "None" , It works but ask for a value in console. It does confuse me a lot . Did I do something wrong?

    Cheers😊

    Here is basic test codes :

    import c4d
    import time
    
    
    class MyThread(c4d.threading.C4DThread):
        def __init__(self):
            self.count = 0
    
        # Called by self.TestBreak in Main
        def TestDBreak(self):
            if self.count == 5:
                return True
            return False
    
        # Called when MyThread.Start() is called
        def Main(self):
    
            # Iterates over 10
            for i in range(10):
                self.count = i + 1
    
                # Checks if the thread is asked to quit and call TestDBreak for custom breaking condition
                if self.TestBreak():
                    print("Leaving")
                    break
    
                print("Current:", i)
                time.sleep(1)
    
    
    def main() :  
        thread = MyThread()  
        thread.Start()
        thread.Wait()
        #time.sleep(1)
        thread.End()  
      
    main()
    
    posted in Cinema 4D SDK •
    RE: PreferenceData plugin, Text disappears when directory is set

    @m_adam Thanks a lot for this example 👏 A big shout out !

    posted in Cinema 4D SDK •
    RE: How to set a Shader for Roughness ????

    @bentraje
    Reflection layer symbols can't drag to console to get , maybe you can check Materials document , And GitHub Example for this.

    And Shout out to @ferdinand ,this is my topic for this .

    Here is a little code I used to set textures for BaseMaterials :

    import c4d
    
    def main():
        # Creates a standard C4D Material
        mat = c4d.Material()
        if mat is None:
            raise RuntimeError("Failed to create a new default material.")
    
        # Removes the default specular layer
        mat.RemoveReflectionLayerIndex(0)
    
        # Adds a layer
        layer = mat.AddReflectionLayer()
        if layer is None:
            raise RuntimeError("Failed to create a new reflection layer.")
    
        # Sets the Layer to Blinn mode
        mat[layer.GetDataID() + c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION] = c4d.REFLECTION_DISTRIBUTION_SPECULAR_BLINN
        
        # Sets the shader for width
        colormap = "filename"
        shacolor = c4d.BaseList2D(c4d.Xbitmap)
        shacolor[c4d.BITMAPSHADER_FILENAME] = colormap
        mat.InsertShader(shacolor)    
        
        # Defines the Roughness float value
        mat[layer.GetDataID() + c4d.REFLECTION_LAYER_MAIN_SHADER_ROUGHNESS] = shacolor
    
        # Inserts a material in the active doc
        doc.InsertMaterial(mat)
    
        # Pushes an update event to Cinema 4D
        c4d.EventAdd()
    
    if __name__ == '__main__':
        main()
    
    posted in Cinema 4D SDK •
    RE: PreferenceData plugin, Text disappears when directory is set

    Hi @m_adam ,

    I also have a problem with filename in the preference . It has the same problem as @potashalum did, and I look for the Github py-preference example , I notice that a note Filename parameter type are not supported. .

    But I fine some build-in res file has the FILENAME attribute (like ...\description\prefsbrowser.res) , and it can actually read and set filename in preference , Is it fixed now and miss some information that I failed to do this in python😞

    For the suggestion of the example, I try to fake it with a bitmap , but I failed draw a bitmap in res file ,could you please update the Github example a little for this ,or some tricks and tips?

    Thanks!

    posted in Cinema 4D SDK •
    RE: How to detect a new light and pram change?

    @bentraje Thanks a lot ! I always want to spend some thing to do this , but unfortunately I am struggling to work with rendering .

    If I have some time hopes I can change this a bit more 😳

    posted in Cinema 4D SDK •