Group Details Private

administrators

  • RE: Ptex Shader Progress

    Hi @wuzelwazel, thanks a lot for sharing your progresses on the Ptex Shader and for sharing your code.

    I've moved the thread to the more appropriate "General Programming & Plugin Discussions" hoping other developers could contribute to the discussion.

    Cheers, Riccardo

    posted in General Programming & Plugin Discussions
  • RE: Generator GetDimension() not called

    Thanks @rsodre for following up.

    Actually there's nothing that comes on my mind to help you sort this issue out cause even implementing both ObjectData::GetContour() and ObjectData::GetVirtualObject() doesn't help to have the GetDimension effectively called.

    Cheers, R

    posted in Cinema 4D Development
  • RE: AddButton "Pressed" in GeDialog

    Hi @RenatoT , thanks for reaching out us.

    As @zipit suggested BitmapButton is the way to go and for the future I warmly recommend to use the tagging system for a better context.

    Cheers, R

    posted in Cinema 4D Development
  • RE: Identify when scene is rendering (Redshift)

    Hi @wen, thanks for the update. Great that you get things sorted out.

    Cheers, R

    posted in Cinema 4D Development
  • RE: Merge Tags

    Hi Daniel, I've checked more in detail about a potential answer to your question and actually you should consider to implement TagData::Message() and actually establish the related business logic when MSG_POINTS_CHANGED, MSG_POLYGONS_CHANGED are caught for data respectively stored per-point or per-polygon or MSG_PRETRANSLATE_POLYGONS, MSG_TRANSLATE_POLYGONS when n-gons are part of the process.

    Cheers, R

    posted in Cinema 4D Development
  • RE: Generator crashes and guidance

    @kbar said in Generator crashes and guidance:

    @zipit said in Generator crashes and guidance:

    OBJECT_DONTFREECACHE

    Yes that is the flag. If you enable that flag then you own the objects. And you pass the pointer as the result of the GetVirtualObjects call. But you MUST ensure correct deletion of the objects when the generator is deleted. And you must handle all read/write/copyto calls correctly for your generator.

    Thanks Kent for providing additional notes, but I think I need to clarify a bit about its real scope. The OBJECT_DONTFREECACHE allows generators to maintain their caches on their own which means that Cinema will not handle the cache deletion upon its generator object has been deleted. This flag is highly dangerous and should be used only in combination with a correct memory management design that secures against memory leaks.
    That said, this has no relation on the option to safely refer a BaseObject in the scene by directly storing or accessing its pointer. Again, safely accessing a reference to a BaseObject must be done via BaseLink.

    Cheers, R

    posted in Cinema 4D Development
  • RE: How to set completely custom render output filename?

    @jcooper said in How to set completely custom render output filename?:

    How do I control how much zero-padding is used for the $frame token? We typically use 4-digit, zero-padded frame tokens, but what if a situation called for, say, 6 digits?

    Hi John, with regard to the $frametoken the zero-padding is hardcoded but as stated by @zipit you can workaround it by registering your token (see here)
    .

    How do I get at the RenderData for a specific renderer such as Redshift? For instance, it has its own "filename" attribute, but I don't know how to access/modify it from the python API.

    You need to retrieve the RedShift BaseVideoPost and retrieve the corresponding data from its BaseContainer.

    Check the code below

        # Get the active RenderData
        renderData = doc.GetActiveRenderData()
        if renderData is None:
            raise RuntimeError("Failed to retrieve the render data.")
    
        # Get the active render settings
        renderSettings = renderData.GetData()
        if renderSettings is None:
            raise RuntimeError("Failed to retrieve the render settings.")
        
        # Get the first video post
        videopost = renderData.GetFirstVideoPost()
        if videopost is None:
            raise RuntimeError("Failed to retrieve the videopost associated with the render data.")
        
        # Search for the RedShift videopost
        while videopost is not None and videopost.GetType() != 1036219:
            print "RedShift is not set as renderer in the active RenderData, check next"
            videopost = videopost.GetNext()
        
        rsAOV = None
        # Retrieve the AOV -> Filname param value
        if videopost is not None and videopost.GetType() == 1036219: 
            rsAOV = videopost[c4d.REDSHIFT_RENDERER_AOV_PATH]
    
        # Reads the path stored in the render setting
        path = renderSettings[c4d.RDATA_PATH]    
        
        # Add token to the path
        path = path + rsAOV
    
        # Tokenizes the path from the render engine
        rpd = {'_doc': doc, '_rData': renderData, '_rBc': renderSettings, '_frame': 1}
    
        exclude = []
        finalFilename = c4d.modules.tokensystem.FilenameConvertTokensFilter(path, rpd, exclude)+".png"
    
        print finalFilename
    
    posted in Cinema 4D Development
  • RE: HashMap operator = cannot access private member

    Hi Daniel, first and foremost I terribly apologize for coming so late here.

    With regard to your question, I've a few comments:

    • maxon::BaseArray can store instance derived by classes that are not necessarily defined using MAXON_DISALLOW_COPY_AND_ASSIGN: the BaseArray Manual present in the Classes section four different cases of classes.
    • in < R20 the maxon::HashMap was not designed to manage instances derived by classes defined with the MAXON_DISALLOW_COPY_AND_ASSIGN: if you want to manage such instances in HashMap in R19 or older it's likely you have to store the instances in the stack and store the references in the HashMap.
      That said, in R19, you can either decide to use a class not defined with MAXON_DISALLOW_COPY_AND_ASSIGN with both maxon::BaseArray and maxon::HashMap or if you want to use the MAXON_DISALLOW_COPY_AND ASSIGN then you've to take care of storing references in the R19 HashMap.
    class TestClassDisallowCopyAndAssign
    {
    	MAXON_DISALLOW_COPY_AND_ASSIGN(TestClassDisallowCopyAndAssign)
    	
    private:
    	Bool _mybool;
    	Int32 _myint;
    	
    public:
    	
    	TestClassDisallowCopyAndAssign() {}
    	TestClassDisallowCopyAndAssign(const Bool boolVal, const Int32 intVal)
    	{
    		_mybool = boolVal;
    		_myint = intVal;
    	}
    	~TestClassDisallowCopyAndAssign() {}
    	
    	// move constructor
    	TestClassDisallowCopyAndAssign(TestClassDisallowCopyAndAssign&& src)
    	{
    		_mybool = std::move(src._mybool);
    		_myint = std::move(src._myint);
    	}
    
    	// move assignment operator
    	MAXON_OPERATOR_MOVE_ASSIGNMENT(TestClassDisallowCopyAndAssign);
    
    	// copy
    	Bool CopyFrom(const TestClassDisallowCopyAndAssign& src)
    	{
    		_mybool = src._mybool;
    		_myint = src._myint;
    		return true;
    	}
    	Bool GetBool() const { return _mybool; }
    	Int32 GetInt32() const { return _myint; }
    };
    
    class TestClass
    {
    	
    private:
    	Bool _mybool;
    	Int32 _myint;
    	
    public:
    	TestClass() {}
    	TestClass(const Bool boolVal, const Int32 intVal)
    	{
    		_mybool = boolVal;
    		_myint = intVal;
    	}
    	~TestClass() {}
    	TestClass(const TestClass& src) : _mybool(src._mybool), _myint(src._myint) { }
    	Bool GetBool() const { return _mybool; }
    	Int32 GetInt32() const { return _myint; }
    };
    
    ...
    	
    	// using BaseArray with a instances that can be copied
    	maxon::BaseArray<TestClass> arrayTestClass;
    	
    	TestClass item1 = TestClass(false, 1);
    	TestClass item2 = TestClass(true, 2);
    	TestClass item3 = TestClass(false, 3);
    	TestClass item4 = TestClass(true, 4);
    	
    	arrayTestClass.Append(item1);
    	arrayTestClass.Append(item2);
    	arrayTestClass.Append(item3);
    	arrayTestClass.Append(item4);
    	
    	for (Int32 i = 0; i < arrayTestClass.GetCount(); i++)
    	{
    		GePrint("arrayTestClass[" + String::IntToString(i) + "]: "+String::IntToString(arrayTestClass[i].GetBool())+"/"+String::IntToString(arrayTestClass[i].GetInt32()));
    	}
    	
    	// using HashMap with a instances that can be copied
    	maxon::HashMap<Int32, TestClass> mapTestClass;
    	
    	mapTestClass.Put(404, item1);
    	mapTestClass.Put(101, item2);
    	mapTestClass.Put(303, item3);
    	mapTestClass.Put(202, item4);
    	for (Int32 i = 0; i < mapTestClass.GetCount(); i++)
    	{
    		const Int32 k = mapTestClass.GetNonEmptyBucket(i)->GetKey();
    		const TestClass value = mapTestClass.GetNonEmptyBucket(i)->GetValue();
    		GePrint("mapTestClass["+String::IntToString(i)+"]: key["+String::IntToString(k)+"], value["+String::IntToString(value.GetBool())+"/"+String::IntToString(value.GetInt32())+"]");
    	}
    	
    	Int32 key = 101;
    	GePrint("mapTestClass@Key[" + String::IntToString(key)+"]: "+ String::IntToString(mapTestClass.FindEntry(key)->GetValue().GetBool()) + "/" + String::IntToString(mapTestClass.FindEntry(key)->GetValue().GetInt32()));
    	
    	key = 303;
    	GePrint("mapTestClass@Key[" + String::IntToString(key)+"]: "+ String::IntToString(mapTestClass.FindEntry(key)->GetValue().GetBool()) + "/" + String::IntToString(mapTestClass.FindEntry(key)->GetValue().GetInt32()));
    	
    	
    	// using BaseArray with instances that can NOT be copied (DISALLOW_COPY_AND_ASSIGN)
    	maxon::BaseArray<TestClassDisallowCopyAndAssign> arrayTestClassDCA;
    	
    	TestClassDisallowCopyAndAssign item1DCA = TestClassDisallowCopyAndAssign(false, 10);
    	TestClassDisallowCopyAndAssign item2DCA = TestClassDisallowCopyAndAssign(true, 20);
    	TestClassDisallowCopyAndAssign item3DCA = TestClassDisallowCopyAndAssign(false, 30);
    	TestClassDisallowCopyAndAssign item4DCA = TestClassDisallowCopyAndAssign(true, 40);
    	
    	arrayTestClassDCA.Append(item1DCA);
    	arrayTestClassDCA.Append(item2DCA);
    	arrayTestClassDCA.Append(item3DCA);
    	arrayTestClassDCA.Append(item4DCA);
    	
    	for (Int32 i = 0; i < arrayTestClassDCA.GetCount(); i++)
    	{
    		GePrint("arrayTestClassDCA[" + String::IntToString(i) + "]: "+String::IntToString(arrayTestClassDCA[i].GetBool())+"/"+String::IntToString(arrayTestClassDCA[i].GetInt32()));
    	}
    	
    	
    	// using HashMap with instances that can NOT be copied (DISALLOW_COPY_AND_ASSIGN)
    	maxon::HashMap<Int32, TestClassDisallowCopyAndAssign*> mapTestClassDCA;
    	mapTestClassDCA.Put(4040, &item1DCA);
    	mapTestClassDCA.Put(1010, &item2DCA);
    	mapTestClassDCA.Put(3030, &item3DCA);
    	mapTestClassDCA.Put(2020, &item4DCA);
    	for (Int32 i = 0; i < mapTestClass.GetCount(); i++)
    	{
    		const Int32 k = mapTestClassDCA.GetNonEmptyBucket(i)->GetKey();
    		TestClassDisallowCopyAndAssign** value = &(mapTestClassDCA.GetNonEmptyBucket(i)->GetValue());
    		GePrint("mapTestClassDCA["+String::IntToString(i)+"]: key["+String::IntToString(k)+"], value["+String::IntToString((*value)->GetBool())+"/"+String::IntToString((*value)->GetInt32())+"]");
    	}
    	
    	key = 2020;
    	GePrint("mapTestClassDCA@Key[" + String::IntToString(key)+"]: "+ String::IntToString(mapTestClassDCA.FindEntry(key)->GetValue()->GetBool()) + "/" + String::IntToString(mapTestClassDCA.FindEntry(key)->GetValue()->GetInt32()));
    	
    	key = 4040;
    	GePrint("mapTestClassDCA@Key[" + String::IntToString(key)+"]: "+ String::IntToString(mapTestClassDCA.FindEntry(key)->GetValue()->GetBool()) + "/" + String::IntToString(mapTestClassDCA.FindEntry(key)->GetValue()->GetInt32()));
    ...
    

    Best, R

    posted in Cinema 4D Development
  • RE: OperatorSetData for "Lists"?

    @esan said in OperatorSetData for "Lists"?:

    Another quick question. is there still a bug on c4d.GV_OBJECT_OPERATOR_OBJECT_OUT?

    Yes it's still there and being R20 maintenance ended it's likely to remain.

    Best, R

    posted in Cinema 4D Development
  • RE: How to set completely custom render output filename?

    Hi @jcooper and @PluginStudent, thanks for reaching out us and welcome to the Plugincafé community!

    All the topics suggested by @PluginStudent - kudos dude - are pertinent to address your issue and you should be ready to go. Nonetheless, if any further doubts arise, just follow up here.

    Last but not least, for the future I warmly recommend to make use of the thread tagging system in order to improve our community knowledge-base readability.

    Best, Riccardo

    posted in Cinema 4D Development